com.ibm.portal.portlet.service.spi
Interface PortletServiceProvider

All Superinterfaces:
PortletService

public interface PortletServiceProvider
extends PortletService

Interface that must be implemented by portlet service providers. This interface defines lifecycle methods for the intialization of the portlet service implementation.
All portlet service implementations must implement this interface so that they can be properly managed by the portlet container. It is the decision of the portlet container how many service implementations will be instantiated. All service providers must be programmed in a thread-safe way so that the same instance can be used by multiple portlets concurrently.

Since:
5.1
Note:
This interface is designed to be implemented by clients.

Method Summary
 void init(java.util.prefs.Preferences servicePreferences)
          Initialize the portlet service.
 

Method Detail

init

void init(java.util.prefs.Preferences servicePreferences)
          throws PortletServiceUnavailableException
Initialize the portlet service. This method is invoked for every instance of the portlet service created by the container before the service is passed to the first requestor. It is guaranteed that this method will be invoked exactly once for every instance of a portlet service provider.

There is no corresponding destroy method in the lifecycle of the portlet service, because there is nothing that a portlet service could reasonably do in this method. It is not appropriate to free up resources only in such a method, because portlet service providers will typically live until the portal is shut down, therefore resources would be consumed for the entire lifetime of the portal.

If a portlet service needs to acquire resources that it keeps for longer than a single method call, then it is recommended to use resource pools managed by the application server, like data sources, or to have explicit release methods in the service API so that the client using the portlet service can manage the resource consumption.

Parameters:
servicePreferences - The configuration information for the portlet service. This object is read-only; all modifying operations throw a BackendStoreException if such an exception is declared and do nothing otherwise.
Throws:
PortletServiceUnavailableException - Service providers may throw an exception of this type if they encounter a problem during intialization (e.g a missing configuration parameter) that prevents the service from operating.