Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.resources.servicecore
Class ServiceProvider

    java.lang.Object
      org.jini.rio.resources.servicecore.ServiceProvider

All Implemented Interfaces:
  Remote, Administrable, MonitorableService, EventProducer, Service, Watchable

Direct Known Subclasses:
  ServiceBeanAdapter

    public abstract class ServiceProvider

extends Object
implements Service

The ServiceProvider is an abstract class that provides the infrastructure required to make a Jini service. This class needs to be extended by Service developers. All ServiceProvider instances can be an Event Producer. An Event Producer is a service that has a zero-to-many dependency between objects such that when it's state changes all it's dependants are notified. All ServiceProvider instances provide support for the Rio Watchable framework. The Rio Watchable framework provides a mechanism to collect and analyze programmer-defined metrics defined in local and distributed applications

The ServiceProvider supports the following configuration entries; where each configuration entry name is associated with the component name org.jini.rio.resources.servicecore

- eventListenerPreparer

  Type: | ProxyPreparer
  Default: | new BasicProxyPreparer() ``
  Description: | Specifies the proxy preparer to use for `RemoteEventListener` s registered with this service in calls to `ServiceProvider.register(org.jini.rio.event.EventDescriptor, net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)`. During event notification, this service calls the `notify` method on `RemoteEventListener` instances returned from this preparer. This entry is obtained at service start and restart.

Field Summary
`protected Map<Long,EventHandler>` | `eventTable` The eventTable associates an EventHandler to an EventDescriptor for the ServiceProvider.
`protected WatchRegistry` | `watchRegistry` The watchRegistry is used to fetch WatchDataSource instances that have been created and registered in this ServiceProvider

Constructor Summary
`ServiceProvider()`

Method Summary
`abstract void` | `destroy()` Left for concrete implementations of this class to implement
`WatchDataSource[]` | `fetch()` Returns an array of all WatchDataSource instances
`WatchDataSource[]` | `fetch(String id)` Returns an array of WatchDataSource instances that match the input `id`.
`abstract Object` | `getAdmin()` Left for concrete implementations of this class to implement
`Configuration` | `getConfiguration()` Get the Configuration for the ServiceProvider
`Map<Long,EventHandler>` | `getEventTable()` Get the event table.
`abstract Object` | `getServiceProxy()` Concrete implementations must define a mechanism to retrieve the proxy to represent the service on the network
`abstract Uuid` | `getUuid()` Return the Uuid for the Service
`WatchRegistry` | `getWatchRegistry()` Get the WatchDataSourceRegistry
`EventRegistration` | `register(EventDescriptor descriptor, RemoteEventListener listener, MarshalledObject handback, long duration)` The register method creates a leased `EventRegistration` for the EventDescriptor type passed in based on the requested lease duration.
`void` | `setConfiguration(Configuration config)` Set the Configuration for the ServiceProvider
`void` | `setEventTable(Map<Long,EventHandler> eventTable)` Set the event table.
`void` | `setWatchRegistry(WatchRegistry watchRegistry)` Set the WatchDataSourceRegistry

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jini.rio.core.MonitorableService
`monitor, ping, startHeartbeat`

Field Detail

### eventTable

    protected Map<Long,EventHandler> eventTable

  The eventTable associates an EventHandler to an EventDescriptor for the ServiceProvider. Event registration requests for events this ServiceProvider has advertised will consult the eventTable to determine the correct EventHandler to use in order to return an event registration

### watchRegistry

    protected WatchRegistry watchRegistry

  The watchRegistry is used to fetch WatchDataSource instances that have been created and registered in this ServiceProvider

Constructor Detail

### ServiceProvider

    public ServiceProvider()

Method Detail

### setConfiguration

    public void setConfiguration(Configuration config)

  Set the Configuration for the ServiceProvider

  Parameters:
    `config` - The Configuration

### getConfiguration

    public Configuration getConfiguration()

  Get the Configuration for the ServiceProvider

  Returns:
    The Configuration

### register

    public EventRegistration register(EventDescriptor descriptor,
                                      RemoteEventListener listener,
                                      MarshalledObject handback,
                                      long duration)
                               throws LeaseDeniedException,
                                      UnknownEventException,
                                      RemoteException

  Description copied from interface: `EventProducer`
  The register method creates a leased `EventRegistration` for the EventDescriptor type passed in based on the requested lease duration. The implied semantics of notification are dependant on `EventHandler` specializations.

  Specified by:
    `register` in interface `EventProducer`
  Parameters:
    `descriptor` - The EventDescriptor to register
    `listener` - A RemoteEventListener
    `handback` - A MarshalledObject referencing a handback object to be used with Event notification
    `duration` - Requested EventRegistration lease duration
  Returns:
    An EventRegistration
  Throws:
    `LeaseDeniedException` - if the duration parameter is not accepted
    `UnknownEventException` - if the service does not produce events described by the EventDescriptor
    `RemoteException` - if communication errors occur
  See Also:
    `EventProducer.register(org.jini.rio.event.EventDescriptor, net.jini.core.event.RemoteEventListener, java.rmi.MarshalledObject, long)`

### getAdmin

    public abstract Object getAdmin()

  Left for concrete implementations of this class to implement

  Specified by:
    `getAdmin` in interface `Administrable`

### destroy

    public abstract void destroy()

  Left for concrete implementations of this class to implement

### getServiceProxy

    public abstract Object getServiceProxy()

  Concrete implementations must define a mechanism to retrieve the proxy to represent the service on the network

  Returns:
    A proxy suitable for communication to the service

### getUuid

    public abstract Uuid getUuid()

  Return the Uuid for the Service

  Returns:
    The Uuid

### fetch

    public WatchDataSource[] fetch()

  Description copied from interface: `Watchable`
  Returns an array of all WatchDataSource instances

  Specified by:
    `fetch` in interface `Watchable`
  Returns:
    An array of WatchDataSource objects
  See Also:
    `Watchable.fetch()`

### fetch

    public WatchDataSource[] fetch(String id)

  Description copied from interface: `Watchable`
  Returns an array of WatchDataSource instances that match the input `id`.

  Specified by:
    `fetch` in interface `Watchable`
  Parameters:
    `id` - The identifier to fetch
  Returns:
    An array of WatchDataSource objects
  See Also:
    `Watchable.fetch(String)`

### setEventTable

    public void setEventTable(Map<Long,EventHandler> eventTable)

  Set the event table.

  Parameters:
    `eventTable` - The event table

### getEventTable

    public Map<Long,EventHandler> getEventTable()

  Get the event table.

  Returns:
    The event table

### getWatchRegistry

    public WatchRegistry getWatchRegistry()

  Get the WatchDataSourceRegistry

  Returns:
    The WatchRegistry

### setWatchRegistry

    public void setWatchRegistry(WatchRegistry watchRegistry)

  Set the WatchDataSourceRegistry

  Parameters:
    `watchRegistry` - The WatchRegistry

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.