com.ibm.portal.portlet.service

Interface PortletServiceHome

  • All Superinterfaces:
    java.io.Serializable

    Deprecated.

    @Deprecated
    public interface PortletServiceHome
    extends java.io.Serializable
    Interface for retrieving portlet services. Portlet services are accessed by a JNDI lookup; the lookup returns an implementation of this interface, which allows to get the actual portlet service.

    The default JNDI name for looking up a portletservice is portletservice/ followed by the name of the service interface. If a portal provides any implementation for a portlet service interface, it will always register the service under that name.

    If an application requires more flexibility in the selection of a portlet service implementation, it may instead look up the portlet service under a portlet specific JNDI alias; the administrator is then responsible for mapping that alias to an actual service implementation using the application server administration facilities.

    Coding example for looking up a service:

     PortletServiceHome psh;
     javax.naming.Context ctx = new javax.naming.InitialContext();
     try {
      psh = (PortletServiceHome)ctx.lookup("portletservice/com.ibm.portal.propertybroker.service.PropertyBrokerService");
      if (psh == null) 
       System.out.println("no PropertyBrokerService Home");
      else
       propertyFactoryService = (PropertyFactory)psh.getPortletService(com.ibm.portal.propertybroker.service.PropertyBrokerService.class);
     } catch(javax.naming.NameNotFoundException ex) {
        ... error handling ...
     }
     
    The returned PortletServiceHome object is valid for the lifetime of the portal. It is recommended to perform the JNDI lookup in the init method of the portlet and store the PortletServiceHome object home in an instance variable.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      com.ibm.portal.portlet.service.PortletService getPortletService(java.lang.Class service)
      Deprecated. 
      Return a service for the given service interface.
    • Method Detail

      • getPortletService

        com.ibm.portal.portlet.service.PortletService getPortletService(java.lang.Class service)
                                                                        throws PortletServiceUnavailableException
        Deprecated. 
        Return a service for the given service interface.

        Service references obtained by calling this method may only be accessed within the request in which they were retrieved.

        Note that you may cast the returned service only to the interface that has been requested. Programmers must not assume that the returned object will be the actual implementation of the service, it may also be a proxy object that passes calls to the service implementation. Therefore it is illegal to cast the returned service to any extended or alternative interface.

        Parameters:
        service - the service interface
        Returns:
        an implementation of the requested interface
        Throws:
        PortletServiceIllegalInterfaceException - if the service home cannot provide an an implementation for the requested interface.
        PortletServiceInstatiationException - if the creation of a service implementation failed.
        PortletServiceUnvailableException - if a service implementation could be created but an exception occured during the service-specific intialization.
        PortletServiceUnavailableException
IBM WebSphere Application ServerTM
Release 8.5