public final class JMEDSFramework
extends java.lang.Object
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:
ThreadPool CommunicationManager (at least one is necessary) MonitorStreamFactory (optional) FileSystem (optional)
Important: It is necessary to start the framework before anything else
can be used!
Your code could look something like this:
JMEDSFramework.start(args); // Your code here JMEDSFramework.stop();
| Modifier and Type | Field and Description |
|---|---|
static int |
CLIENT_MODULE
Identifier for the client support (Client module).
|
static java.lang.String |
CLIENT_MODULE_PATH |
static int |
SERVICE_MODULE
Identifier for the service and device support.
|
static java.lang.String |
SERVICE_MODULE_PATH |
| Modifier and Type | Method and Description |
|---|---|
static void |
addClientSubscription(ClientSubscription subscription)
Adds a event subscription to the framework.
|
static MonitorStreamFactory |
getMonitorStreamFactory()
Returns the
MonitorStreamFactory which allows to wrap streams and redistribute data. |
static ResourceLoader |
getResourceAsStream(URI location,
CredentialInfo credentialInfo,
java.lang.String comManId)
Returns an input stream which allows to read a resource from the given location.
|
static ThreadPool |
getThreadPool()
Returns the thread pool used by the framework.
|
static boolean |
hasModule(int module)
Allows to verify whether a module has been loaded and can be used or not.
|
static boolean |
isKillRunning() |
static boolean |
isRunning()
Indicates whether the framework was started or not.
|
static boolean |
isStopRunning() |
static void |
kill()
Stops the framework immediately!!!!
|
static void |
removeClientSubscription(ClientSubscription subscription)
Removes a event subscription.
|
static void |
setClientModuleClassExists(boolean exists) |
static void |
setMonitorStreamFactory(MonitorStreamFactory factory)
Set the factory for stream monitoring.
|
static void |
setPropertiesPath(java.lang.String path) |
static void |
setServiceModuleClassExists(boolean exists) |
static void |
start(java.lang.String[] args)
Starts the framework.
|
static void |
stop()
Stops the framework as soon as possible.
|
static void |
stopIgnoringInstancesCount() |
static boolean |
supportsConfiguration(int config)
Allows to verify whether some modules are loaded or not.
|
public static final int 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 client and the classes which are necessary if the client wants to use the device and service discovery.
public static final java.lang.String CLIENT_MODULE_PATH
public static final int 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 device and service.
public static final java.lang.String SERVICE_MODULE_PATH
public static void start(java.lang.String[] args)
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.
args - Here you can pass-through the command-line arguments. the first element is interpreted as the location of
the properties file.public static void stop()
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.
start(String[]),
kill()public static void stopIgnoringInstancesCount()
public static boolean isRunning()
This method returns true if the framework is running, false otherwise.
true if the framework is running, false otherwise.public static void kill()
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.
start(String[]),
stop()public static boolean isKillRunning()
public static boolean isStopRunning()
public static void addClientSubscription(ClientSubscription subscription)
subscription - the subscription which the framework should take care about.public static void removeClientSubscription(ClientSubscription subscription)
subscription - the subscription which is not important any more.public static boolean hasModule(int module)
You can check the modules listed below.
module - the module identifier.true if the module has been loaded, false otherwise.CLIENT_MODULE,
SERVICE_MODULEpublic static boolean supportsConfiguration(int config)
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.
config - the modules to check. To check more than one module, sum up their values.
e.g. CLIENT_MODULE +
SERVICE_MODULE
true if all given modules have been loaded, false otherwise.CLIENT_MODULE,
SERVICE_MODULEpublic static ThreadPool getThreadPool()
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.
public static ResourceLoader getResourceAsStream(URI location, CredentialInfo credentialInfo, java.lang.String comManId)
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.
location - the location of the resource (e.g. http://example.org/test.wsdl).ResourceLoader containing input stream for the given resource and ConnectionInfo for
network resources. Returns null if no communication manager could find a resource at the given
location.java.io.IOException - throws an exception when the resource could not be loaded properly.public static MonitorStreamFactory getMonitorStreamFactory()
MonitorStreamFactory which allows to wrap streams and redistribute data.setMonitorStreamFactory(MonitorStreamFactory)public static void setMonitorStreamFactory(MonitorStreamFactory factory)
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.
factory - the factory which wraps streams and redistribute data.public static void setPropertiesPath(java.lang.String path)
public static void setClientModuleClassExists(boolean exists)
public static void setServiceModuleClassExists(boolean exists)