Openwings API Documentation (v1.1)

net.openwings.component
Interface ComponentComplex

All Superinterfaces:
Component

public interface ComponentComplex
extends Component

This interface extends the Component interface to provide additional service-based functionality to the Openwings architecture.


Method Summary
 ContainerAccess getContainerAccess()
          This method is used to obtain access to the Container in which this component is running.
 Manager getManager()
          This method is used to obtain a management context that the component can use to instantiate management plug-ins (MBeans).
 PolicyLoader getPolicyLoader()
          This method is used to obtain a PolicyLoader that the component can use to instantiate policies.
 java.lang.Object getUserInterface(UniqueID serviceID)
          This method is used to obtain a User Interface for a given service object.
 UniqueID provideService(java.lang.Class serviceInterface, java.lang.Object service, ProvideServiceParameters parameters)
          This method is used to make a synchronous (remote method) service available to other components (join).
 void publishService(java.lang.Class serviceInterface, EventServiceListener listener, EventServiceParameters parameters)
          This method registers for notification of the ability to publish an asynchronous (event or messaging) service.
 ServiceResult publishService(java.lang.Class serviceInterface, EventServiceParameters parameters)
          This method is used to indicate that the component will publish an asynchronous (event or messaging) service.
 ServiceResult publishService(java.lang.Class serviceInterface, PublishServiceParameters parameters)
          This method is used to explicitly create a topic for publishing an asynchronous (event or messaging) service.
 void subscribeService(java.lang.Class serviceInterface, java.lang.Object service, EventServiceListener listener, EventServiceParameters parameters)
          This method registers for notification of the ability to subscribe to an asynchronous (event or messaging) service.
 ServiceResult subscribeService(java.lang.Class serviceInterface, java.lang.Object service, EventServiceParameters parameters)
          This method is used to subscribe to a an asynchronous (event or messaging) service.
 void useService(java.lang.Class serviceInterface, UseServiceListener listener, UseServiceParameters parameters)
          This method registers for notification of synchronous (remote method) services provided other components (lookup).
 ServiceResult[] useService(java.lang.Class serviceInterface, UseServiceParameters parameters)
          This method finds multiple synchronous (remote method) services provided by another component (lookup).
 
Methods inherited from interface net.openwings.component.Component
connectDistributedObject, discardUsedService, disconnectDistributedObject, distributeObject, distributeObject, getComponentDescriptor, getComponentID, provideService, provideService, publishService, publishService, removeEventServiceListener, removeProvidedService, removeUseServiceListener, shutdown, subscribeService, subscribeService, undistributeObject, unpublishService, unsubscribeService, useService, useService
 

Method Detail

getPolicyLoader

public PolicyLoader getPolicyLoader()
This method is used to obtain a PolicyLoader that the component can use to instantiate policies. Calling this method repeatedly returns the same PolicyLoader. This method returns the same result as net.openwings.policy.PolicyLoaderFactory.getPolicyLoader().

Returns:
a PolicyLoader

getManager

public Manager getManager()
This method is used to obtain a management context that the component can use to instantiate management plug-ins (MBeans). Calling this method repeatedly returns the same Manager. This method returns the same result as net.openwings.management.ManagerFactory.getManager().

Returns:
a Manager

getContainerAccess

public ContainerAccess getContainerAccess()
This method is used to obtain access to the Container in which this component is running. The object returned allows component code to save and retrieve its state. Calling this method repeatedly returns the same ContainerAccess. This method returns the same result as net.openwings.containerContainerAccessFactory.getContainerAccess().

Returns:
a ContainerAccess object, or null if this component is not running in an Openwings Container.

provideService

public UniqueID provideService(java.lang.Class serviceInterface,
                               java.lang.Object service,
                               ProvideServiceParameters parameters)
                        throws InvalidServiceException
This method is used to make a synchronous (remote method) service available to other components (join). This variant adds a ProvideServiceParameters object which describes how the service is provided.

A service object that is intended to receive remote calls should be a distributed object, that is, an object returned from the distributeObject() method.

Repeated calls to this method for the same serviceInterface/service with a new parameters object cause the new parameters to be applied in place of the old.

Repeated calls to this method with all arguments the same have no effect unless removeProvidedService() has been called.

If a service is provided with the correct serviceInterface and service but there is a problem with a particular discovery plug-in, no Exception is thrown. Instead the component continues using other discovery plug-ins to try to provide the service.

Parameters:
serviceInterface - interface describing the service provided
service - object implementing the specified interface
parameters - controls the providing of this service
Returns:
unique identifier used to reference this service
Throws:
InvalidServiceException - thrown if service does not implement Serializable and serviceInterface

useService

public ServiceResult[] useService(java.lang.Class serviceInterface,
                                  UseServiceParameters parameters)
                           throws InvalidServiceException
This method finds multiple synchronous (remote method) services provided by another component (lookup).

This variant adds a UseServiceParameters object which controls how the service is selected and attached.

Repeated calls to this method with the same serviceInterface and parameters may return different sets of service objects.

Parameters:
serviceInterface - interface describing the desired service or null for all service interfaces
parameters - controls the selection and use of a service.
Returns:
result array of ServiceResult objects, each containing a service object implementing the specified interface and its unique identifier, or null if no services could be located
Throws:
InvalidServiceException - thrown if:
  • serviceInterface is not a valid interface or null

useService

public void useService(java.lang.Class serviceInterface,
                       UseServiceListener listener,
                       UseServiceParameters parameters)
                throws InvalidServiceException
This method registers for notification of synchronous (remote method) services provided other components (lookup).

This variant adds a UseServiceParameters object which controls how services are selected and attached.

Repeated calls to this method for the same serviceInterface/listener, with a new parameters object cause the new parameters to be applied in place of the old.

Repeated calls to this method with identical arguments have no effect.

Parameters:
serviceInterface - interface describing the desired service or null for all service interfaces
listener - notification object
parameters - controls the selection and use of a service.
Throws:
InvalidServiceException - thrown if
  • serviceInterface is not a valid interface or null

getUserInterface

public java.lang.Object getUserInterface(UniqueID serviceID)
This method is used to obtain a User Interface for a given service object. The default behavior when a service is used is for the user interface to be generated immediately and returned in a ServiceResult or ServiceResult, but the buildUserInterfaceImmediately parameter in UseServiceParameters or EventServiceParameters can be set to override this. In that case, this method would be called to obtain the UI.

Parameters:
serviceID - unique identifier for a service

publishService

public ServiceResult publishService(java.lang.Class serviceInterface,
                                    PublishServiceParameters parameters)
                             throws InvalidServiceException
This method is used to explicitly create a topic for publishing an asynchronous (event or messaging) service. The PublishServiceParameters is used to describe the service (topic).

Repeated calls to this method with identical arguments have no effect unless unpublishService has been called.

Repeated calls to this method for the same serviceInterface with a new parameters object cause the new parameters to be applied in place of the old.

Parameters:
serviceInterface - interface describing the service
parameters - describes attributes and user interfaces associated with the service (topic).
Returns:
ServiceResult containing object implementing serviceInterface and a unique identifier for the service (topic)
Throws:
InvalidServiceException - thrown if serviceInterfaceis not a valid interface
Since:
0.9

publishService

public ServiceResult publishService(java.lang.Class serviceInterface,
                                    EventServiceParameters parameters)
                             throws InvalidServiceException
This method is used to indicate that the component will publish an asynchronous (event or messaging) service. This variant adds an EventServiceParameters which is used to select the service (topic).

Repeated calls to this method with the same serviceInterface and parameters may return different results.

Parameters:
serviceInterface - interface describing the service
parameters - controls the selection of the service (topic).
Returns:
result object containing an object implementing the specified interface and a unique identifier for the service (topic)
Throws:
InvalidServiceException - thrown if serviceInterfaceis not a valid interface
Since:
0.9

publishService

public void publishService(java.lang.Class serviceInterface,
                           EventServiceListener listener,
                           EventServiceParameters parameters)
                    throws InvalidServiceException
This method registers for notification of the ability to publish an asynchronous (event or messaging) service. This variant adds an EventServiceParameters which is used to select the service (topic). The EventServiceListener is notified when the desired topic becomes available.

Repeated calls to this method with identical parameters have no effect unless removeEventServiceListener() has been called.

Repeated calls to this method for the same serviceInterface with a new parameters object cause the new parameters to be applied in place of the old.

Parameters:
serviceInterface - interface describing the service
listener - notification object
parameters - controls the selection of the service (topic).
Throws:
InvalidServiceException - thrown if serviceInterfaceis not a valid interface
Since:
0.9

subscribeService

public ServiceResult subscribeService(java.lang.Class serviceInterface,
                                      java.lang.Object service,
                                      EventServiceParameters parameters)
                               throws InvalidServiceException
This method is used to subscribe to a an asynchronous (event or messaging) service.

This variant adds an EventServiceParameters object which controls how services (topics) are selected.

Repeated calls to this method with identical arguments have no effect unless unsubscribeService has been called.

Parameters:
serviceInterface - interface describing the service
service - object implementing the specified interface
parameters - controls the selection of the service (topic).
Throws:
InvalidServiceException - thrown if
  • servicedoes not implement serviceInterface
  • serviceInterfaceis not a valid interface
Since:
0.9

subscribeService

public void subscribeService(java.lang.Class serviceInterface,
                             java.lang.Object service,
                             EventServiceListener listener,
                             EventServiceParameters parameters)
                      throws InvalidServiceException
This method registers for notification of the ability to subscribe to an asynchronous (event or messaging) service. This variant adds a parameters object which is used to select the

This variant adds an EventServiceParameters object which controls how services (topics) are selected.

Repeated calls to this method with identical arguments have no effect unless removeUseServiceListener has been called.

Repeated calls to this method for the same serviceInterface with a new parameters object cause the new parameters to be applied in place of the old.

Parameters:
serviceInterface - interface describing the service
service - object implementing the specified interface
listener - notification object
parameters - controls the selection of the service (topic).
Throws:
InvalidServiceException - thrown if
  • servicedoes not implement serviceInterface
  • serviceInterfaceis not a valid interface
Since:
0.9

Openwings API Documentation (v1.1)