com.ibm.connections.spi.service
Class ServiceHelper

java.lang.Object
  extended by com.ibm.connections.spi.service.ServiceHelper

public class ServiceHelper
extends java.lang.Object

This SPI provides detail about the configured services in Lotus Connections and utility methods to interact with those services. This is a singleton class.


Method Summary
 java.net.URL buildInterServiceURLFromPath(Service service, java.lang.String path)
          Creates a fully qualified URL to the provided resource path, using the specified service.
 java.net.URL buildURLFromPath(Service service, java.lang.String path, boolean secure)
          Creates a fully qualified URL to the provided resource path, using the specified service.
 java.util.Collection<Service> getEnabledServices()
          Returns the collection of the enabled services in this deployment.
 java.util.Collection<Service> getInstalledServices()
          Returns the collection of installed services in this deployment.
static ServiceHelper INSTANCE()
          Singleton accessor method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

INSTANCE

public static ServiceHelper INSTANCE()
Singleton accessor method

Returns:
the singleton instance of this service helper

getInstalledServices

public java.util.Collection<Service> getInstalledServices()
Returns the collection of installed services in this deployment. The returned collection will contain each installed service, according to the information in LotusConnections-config.xml

Returns:
the collection of installed services

getEnabledServices

public java.util.Collection<Service> getEnabledServices()
Returns the collection of the enabled services in this deployment. The returned collection will contain the each enabled service, according to the information in LotusConnections-config.xml A Lotus Connections service is enabled if at least one of the enabled or sslEnabled attributes is true.

Returns:
the collection of enabled services

buildInterServiceURLFromPath

public java.net.URL buildInterServiceURLFromPath(Service service,
                                                 java.lang.String path)
                                          throws ServiceNotAvailableException
Creates a fully qualified URL to the provided resource path, using the specified service. The returned URL will through through the configured inter-service URL. This should be used for constructing URLs for server to server calls. If the path is prefixed with a {} placeholder then that service name will be used in preference to any name specified in the service parameter.

Parameters:
service - the service
path - the path
Returns:
the fully qualified inter-service URL to the resource
Throws:
java.lang.IllegalArgumentException - if path is null, or if service name is null/emtpy and the path does not contain a service placeholder
ServiceNotAvailableException - if the service name specified by the service parameter or overridden by the service placeholder is not enabled

buildURLFromPath

public java.net.URL buildURLFromPath(Service service,
                                     java.lang.String path,
                                     boolean secure)
                              throws ServiceNotAvailableException
Creates a fully qualified URL to the provided resource path, using the specified service. The returned URL will through through the configured inter-service URL. This should be used for constructing URLs for server to server calls. If the path is prefixed with a {} placeholder then that service name will be used in preference to any name specified in the service parameter. If the secure parameter is set to true, then an https URL will be returned if https is enabled for the service. If https is not enabled then null will be returned. If secure is false, but the system is configured to use confidential communications then an https URL will always be returned.

Parameters:
service - the name of the service
path - the path
secure - indicate if a secure https URL is required
Returns:
the fully qualified inter-service URL to the resource
Throws:
java.lang.IllegalArgumentException - if path is null, or if service name is null/emtpy and the path does not contain a service placeholder
ServiceNotAvailableException - if the service name specified by the service parameter or overridden by the service placeholder is not enabled