com.objectxp.mms
Class MMSServiceFactory

java.lang.Object
  extended bycom.objectxp.mms.MMSServiceFactory

public class MMSServiceFactory
extends java.lang.Object

Factory for constructing MMS Service objects.

Use this class to create MMSService objects. The factory depends on user-provided configuration properties for its operation. The factory offers two methods for acquiring an MMSService implementation:

Please note that the factory creates single instances for each service, therefore calling getService multiple times for the same service name always returns the same object.

Example Usage

 MMSServiceFactory factory = MMSServiceFactory.createFactory(this.getClass().getResourceAsStream("mms.configuration");
 MMSService service = factory.getDefaultService();
 

Since:
jSMS 2.0

Method Summary
static MMSServiceFactory createFactory(java.io.File configuration)
          Construct a new MMSServiceFactory.
static MMSServiceFactory createFactory(java.io.InputStream in)
          Construct a new MMSServiceFactory.
static MMSServiceFactory createFactory(java.util.Properties configuration)
          Construct a new MMSServiceFactory.
 MMSService getDefaultService()
          Construct (if necessary) and return the default MMSService.
 MMSService getService(java.lang.String name)
          Construct (if necessary) and return a named MMS Service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createFactory

public static MMSServiceFactory createFactory(java.io.InputStream in)
                                       throws java.io.IOException
Construct a new MMSServiceFactory. The InputStream must provide the factory configuration using key=value pairs. The stream will be closed after reading the configuration.

Parameters:
in - the configuration input stream.
Throws:
java.io.IOException - if an I/O error occurs while reading from the InputStream.
Since:
jSMS 2.2

createFactory

public static MMSServiceFactory createFactory(java.util.Properties configuration)
Construct a new MMSServiceFactory. The Properties supplied will be used when constructing MMSService objects.

Parameters:
configuration - the MMS configuration.

createFactory

public static MMSServiceFactory createFactory(java.io.File configuration)
                                       throws java.io.IOException
Construct a new MMSServiceFactory. The File passed as argument must contain key=value pairs holding the configuration.

Parameters:
configuration - the configuration file.
Throws:
java.io.IOException

getDefaultService

public MMSService getDefaultService()
                             throws ConfigurationException
Construct (if necessary) and return the default MMSService.

The default MMSService configuration can be specified by using the configuration property mms.default.service. If set, the factory will use the prefix "mms.name. when looking for the service configuration. If no default service is specified, the factory will use the prefix "mms".

The factory configuration must contain at least the following properties:

 prefix.transport.class Name of the class implementing the Transport interface. Look at the Transport interface to see the available implementations
 prefix.protocol.name Name of the Protocol to use. Available Protocols are:
  • mm1
  • mm7

See MM1Service for a list of configuration properties supported by the MM1 implementation.
See MM7Service for a list of configuration properties supported by the MM7 implementation.

Returns:
a MMS Service
Throws:
ConfigurationException - if the service cannot be obtained due to a wrong or incomplete configuration.

getService

public MMSService getService(java.lang.String name)
                      throws ConfigurationException
Construct (if necessary) and return a named MMS Service.

The factory configuration must contain at least the following properties:

 mms.name.transport.className of the class implementing the Transport interface. Look at the Transport interface to see the available implementations
 prefix.protocol.name Name of the Protocol to use. Available Protocols are:
  • mm1
  • mm7

See MM1Service for a list of configuration properties supported by the MM1 implementation.
See MM7Service for a list of configuration properties supported by the MM7 implementation.

Parameters:
name - a Properties object holding the configuration required to construct and configure the Service and its associated protocol and transport objects. If this parameter is null, the default service will be returned.
Returns:
a MMS Service
Throws:
ConfigurationException - if the service cannot be obtained due to a wrong or incomplete configuration.
See Also:
getDefaultService()


object XP, Inc. © 2000-2007. All rights reserved object XP