org.ws4d.java
Class DPWSFramework

java.lang.Object
  extended by org.ws4d.java.DPWSFramework

public final class DPWSFramework
extends java.lang.Object

This is the main framework class for the Java Multiedition DPWS Stack (JMEDS 2.0).

It offers static methods to start and stop the framework.

This class verifies the existence of the following modules:

Furthermore this class allows access to some special and optional framework components like:

Important: It is necessary to start the framework before anything else can be used!

Your code could look something like this:

 DPWSFramework.start(args);
 
 // Your code here
 
 DPWSFramework.stop();
 


Field Summary
static int ATTACHMENT_MODULE
          Identifier for the attachment support.
static int CLIENT_MODULE
          Identifier for the client support (Client module).
static int COMMUNICATION_DPWS_MODULE
           
static int EVENTING_MODULE
          Identifier for the event support.
static int PLATFORM_CLDC_MODULE
          Identifier for the CLDC platform support.
static int PLATFORM_SE_MODULE
          Identifier for the SE platform support.
static int PRESENTATION_MODULE
           
static int SECURITY_MODULE
          Identifier for the security support.
static int SERVICE_MODULE
          Identifier for the service and device support.
 
Method Summary
static void addClientSubscrption(ClientSubscription subscription)
          Adds a event subscription to the framework.
static AttachmentFactory getAttachmentFactory()
          Returns an implementation of the attachment factory which allows to handle incoming and outgoing attachments.
static CommunicationManager getCommunicationManager(java.lang.String comManId)
          Returns an instance of a communication manager based on the given identifier.
static EventingFactory getEventingFactory()
           
static FileSystem getLocalFileSystem()
          Returns an implementation of the file system supported by the given platform.
static MonitorStreamFactory getMonitorStreamFactory()
          Returns the MonitorStreamFactory which allows to wrap streams and redistribute data.
static Presentation getPresentation()
          Returns the class which allows to create a presentation URL.
static ProxyFactory getProxyFactory()
           
static ResourceLoader getResourceAsStream(URI location)
          Returns an input stream which allows to read a resource from the given location.
static SecurityManager getSecurityManager()
           
static ThreadPool getThreadPool()
          Returns the thread pool used by the framework.
static Toolkit getToolkit()
          Get the Toolkit of this framework.
static boolean hasModule(int module)
          Allows to verify whether a module has been loaded and can be used or not.
static boolean isRunning()
          Indicates whether the framework was started or not.
static void kill()
          Stops the framework immediately!!!!
static boolean onCldcLibrary()
          checks whether the current framework instance is running on top of the CLDC library.
static void removeClientSubscrption(ClientSubscription subscription)
          Removes a event subscription.
static void setMonitorStreamFactory(MonitorStreamFactory factory)
          Set the factory for stream monitoring.
static void setPropertiesPath(java.lang.String path)
           
static void start(java.lang.String[] args)
          Starts the framework.
static void stop()
          Stops the framework as soon as possible.
static boolean supportsConfiguration(int config)
          Allows to verify whether some modules are loaded or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_MODULE

public static final int CLIENT_MODULE
Identifier for the client support (Client module).

This identifier can be used to verify whether the Client module has been loaded or not. To check this module, use the hasModule(int) method.

The Client module includes the classes to create a DPWS client and the classes which are necessary if the client wants to use the device and service discovery.

See Also:
Constant Field Values

SERVICE_MODULE

public static final int SERVICE_MODULE
Identifier for the service and device support. (Service module).

This identifier can be used to verify whether the Service module has been loaded or not. To check this module, use the hasModule(int) method.

The Service module includes the classes to create a DPWS device and service.

See Also:
Constant Field Values

EVENTING_MODULE

public static final int EVENTING_MODULE
Identifier for the event support. (Eventing module)

This identifier can be used to verify whether the Eventing module has been loaded or not. To check this module, use the hasModule(int) method.

The Eventing module includes the classes to handle incoming DPWS events.

See Also:
Constant Field Values

PLATFORM_SE_MODULE

public static final int PLATFORM_SE_MODULE
Identifier for the SE platform support. (SE module)

This identifier can be used to verify whether the SE module has been loaded or not. To check this module, use the hasModule(int) method.

The SE module includes the classes which allow networking and file access for Java SE platforms.

See Also:
Constant Field Values

PLATFORM_CLDC_MODULE

public static final int PLATFORM_CLDC_MODULE
Identifier for the CLDC platform support. (CLDC module)

This identifier can be used to verify whether the CLDC module has been loaded or not. To check this module, use the hasModule(int) method.

The CLDC module includes the classes which allow networking for Java CLDC platforms.

See Also:
Constant Field Values

ATTACHMENT_MODULE

public static final int ATTACHMENT_MODULE
Identifier for the attachment support. (Attachment module)

This identifier can be used to verify whether the Attachment module has been loaded or not. To check this module, use the hasModule(int) method.

The Attachment module includes the classes to send and receive attachments.

See Also:
Constant Field Values

SECURITY_MODULE

public static final int SECURITY_MODULE
Identifier for the security support. (Security module)

This identifier can be used to verify whether the Security module has been loaded or not. To check this module, use the hasModule(int) method.

The Security module includes the classes to secure the DPWS communication, using WS-Security techniques.

See Also:
Constant Field Values

PRESENTATION_MODULE

public static final int PRESENTATION_MODULE
See Also:
Constant Field Values

COMMUNICATION_DPWS_MODULE

public static final int COMMUNICATION_DPWS_MODULE
See Also:
Constant Field Values
Method Detail

start

public static void start(java.lang.String[] args)
Starts the framework.

This method initializes the necessary framework components.

Important: It is necessary to start the framework before anything else can be used!

This method starts the watchdog, loads the properties and initializes the communications modules.

Parameters:
args - Here you can pass-through the command-line arguments. the first element is interpreted as the location of the properties file.

stop

public static void stop()
Stops the framework as soon as possible.

This method is the counter piece to start(String[]). It stops the framework and the running components. This method will wait until the opened connection are ready to be closed.

If it is necessary to stop the framework immediately the kill() method should be used.

See Also:
start(String[]), kill()

kill

public static void kill()
Stops the framework immediately!!!!

This method is the counter piece to start(String[]). It stops the framework and the running components. This method will not wait until the opened connection are ready to be closed, any existing connection will be closed instant.

See Also:
start(String[]), stop()

isRunning

public static boolean isRunning()
Indicates whether the framework was started or not.

This method returns true if the framework is running, false otherwise.

Returns:
true if the framework is running, false otherwise.

addClientSubscrption

public static void addClientSubscrption(ClientSubscription subscription)
Adds a event subscription to the framework. This allows the framework to unsubscribe on shutdown.

Parameters:
subscription - the subscription which the framework should take care about.

removeClientSubscrption

public static void removeClientSubscrption(ClientSubscription subscription)
Removes a event subscription.

Parameters:
subscription - the subscription which is not important any more.

hasModule

public static boolean hasModule(int module)
Allows to verify whether a module has been loaded and can be used or not.

You can check the modules listed below.

Parameters:
module - the module identifier.
Returns:
returns true if the module has been loaded, false otherwise.
See Also:
CLIENT_MODULE, SERVICE_MODULE, EVENTING_MODULE, ATTACHMENT_MODULE, PLATFORM_SE_MODULE, PLATFORM_CLDC_MODULE, SECURITY_MODULE, ATTACHMENT_MODULE, PRESENTATION_MODULE

supportsConfiguration

public static boolean supportsConfiguration(int config)
Allows to verify whether some modules are loaded or not.

This method allows to check several modules with one method. If you want to check only one module, see the hasModule(int) method.

You can check the modules listed below.

Parameters:
config - the modules to check.

To check more than one module, sum up their values.
e.g. DPWS_CLIENT_MODULE+DPWS_SERVICE_MODULE

Returns:
returns true if all given modules have been loaded, false otherwise.
See Also:
CLIENT_MODULE, SERVICE_MODULE, EVENTING_MODULE, ATTACHMENT_MODULE, PLATFORM_SE_MODULE, PLATFORM_CLDC_MODULE

getThreadPool

public static ThreadPool getThreadPool()
Returns the thread pool used by the framework.

This thread pool is necessary for thread handling, because CLDC does not have an own thread pool. All threads created by the framework are created with this thread pool.

Returns:
the thread pool.

getCommunicationManager

public static CommunicationManager getCommunicationManager(java.lang.String comManId)
Returns an instance of a communication manager based on the given identifier.

The communication manager is a special layer for communication. It allows the handling of incoming messages for different technologies. e.g. DPWS.

Parameters:
comManId - the identifier to receive a CommunicationManager.
Returns:
CommunicationManager

getResourceAsStream

public static ResourceLoader getResourceAsStream(URI location)
                                          throws java.io.IOException
Returns an input stream which allows to read a resource from the given location.

The location is a URL. The loaded communication managers can be registered for different URL schemas. This allows the loading of resources from different locations.

Parameters:
location - the location of the resource (e.g. http://example.org/test.wsdl).
Returns:
an ResourceLoader containing input stream for the given resource and ProtocolData for network resources. Returns null if no communication manager could find a resource at the given location.
Throws:
java.io.IOException - throws an exception when the resource could not be loaded properly.

getToolkit

public static Toolkit getToolkit()
Get the Toolkit of this framework.

The retrieved toolkit includes Java Edition specific utility methods. Framework must have already been started.

Returns:
The specific toolkit used by the framework.

getPresentation

public static Presentation getPresentation()
Returns the class which allows to create a presentation URL.

Returns:
the presentation creator.

setMonitorStreamFactory

public static void setMonitorStreamFactory(MonitorStreamFactory factory)
Set the factory for stream monitoring.

This enables the monitoring of streams for debug purposes. A MonitorStreamFactory wraps streams to redistribute data. A communication manager can use the factory to redistribute data to the streams created by the factory.

Parameters:
factory - the factory which wraps streams and redistribute data.

getMonitorStreamFactory

public static MonitorStreamFactory getMonitorStreamFactory()
Returns the MonitorStreamFactory which allows to wrap streams and redistribute data.

Returns:
the factory to wrap streams and redistribute data.
See Also:
setMonitorStreamFactory(MonitorStreamFactory)

getLocalFileSystem

public static FileSystem getLocalFileSystem()
                                     throws java.io.IOException
Returns an implementation of the file system supported by the given platform.

It is necessary to load the corresponding module for platform support.

Returns:
an implementation of the file system.
Throws:
java.io.IOException - will throw an exception when the module could not be loaded correctly or the runtime configuration does not support a local file system.
See Also:
PLATFORM_SE_MODULE, PLATFORM_CLDC_MODULE

getSecurityManager

public static SecurityManager getSecurityManager()

setPropertiesPath

public static void setPropertiesPath(java.lang.String path)

getAttachmentFactory

public static AttachmentFactory getAttachmentFactory()
                                              throws java.io.IOException
Returns an implementation of the attachment factory which allows to handle incoming and outgoing attachments.

It is necessary to load the corresponding module for attachment support.

Returns:
an implementation of the attachment factory.
Throws:
java.io.IOException

getEventingFactory

public static EventingFactory getEventingFactory()
                                          throws java.io.IOException
Throws:
java.io.IOException

getProxyFactory

public static ProxyFactory getProxyFactory()
                                    throws java.io.IOException
Throws:
java.io.IOException

onCldcLibrary

public static boolean onCldcLibrary()
checks whether the current framework instance is running on top of the CLDC library. Returns true if this is the case.

Returns:
in case the framework runs on top of the Java CLDC configuration