OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.core.ServiceEnvironment Class Referenceabstract

DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based on a system property. More...

Inheritance diagram for org.omg.dds.core.ServiceEnvironment:
Inheritance graph
Collaboration diagram for org.omg.dds.core.ServiceEnvironment:
Collaboration graph

Classes

interface  ServiceProviderInterface
 This interface is for the use of the DDS implementation, not of DDS applications. More...
 

Public Member Functions

final ServiceEnvironment getEnvironment ()
 
abstract ServiceProviderInterface getSPI ()
 This method is not intended for use by applications. More...
 

Static Public Member Functions

static ServiceEnvironment createInstance (ClassLoader classLoader)
 Create and return a new instance of a concrete implementation of this class with the given environment. More...
 
static ServiceEnvironment createInstance (String implClassNameProperty, Map< String, Object > environment, ClassLoader classLoader)
 Look up the system property identified by the given string and load, then instantiate, the ServiceEnvironment implementation class identified by its value. More...
 

Static Public Attributes

static final String IMPLEMENTATION_CLASS_NAME_PROPERTY
 

Detailed Description

DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based on a system property.

All public concrete and abstract methods of this class are reentrant. The reentrancy of any new methods that may be defined by subclasses is unspecified.

Definition at line 45 of file ServiceEnvironment.java.

Member Function Documentation

◆ createInstance() [1/2]

static ServiceEnvironment org.omg.dds.core.ServiceEnvironment.createInstance ( ClassLoader  classLoader)
static

Create and return a new instance of a concrete implementation of this class with the given environment.

This method is equivalent to calling:

createInstance(IMPLEMENTATION_CLASS_NAME_PROPERTY, null, classLoader);

See also
#createInstance(String, Map, ClassLoader)
IMPLEMENTATION_CLASS_NAME_PROPERTY

Definition at line 79 of file ServiceEnvironment.java.

◆ createInstance() [2/2]

static ServiceEnvironment org.omg.dds.core.ServiceEnvironment.createInstance ( String  implClassNameProperty,
Map< String, Object >  environment,
ClassLoader  classLoader 
)
static

Look up the system property identified by the given string and load, then instantiate, the ServiceEnvironment implementation class identified by its value.

The class must be accessible and have a public constructor.

The public constructors of the implementation class will first be searched for one accepting a single argument of type Map. If one is found, it will be called with the environment map provided to this method as its argument. If no such constructor is found, a no-argument constructor will be used instead, and the provided environment, if any, will be ignored. If the implementation class provides no public constructor with either of these signatures, an exception will be thrown.

By default, the class loader for the ServiceEnvironment class will be used to load the indicated class. If this class loader is null – for instance, if it is the bootstrap class loader – then the system class loader will be used in its place. If it is also null, a ServiceConfigurationException will be thrown.

Neither the class loader nor the loaded class will be cached between invocations of this method. As a result, execution of this method is expected to be relatively expensive. However, as any DDS object can provide a reference to its creating ServiceEnvironment via org.omg.dds.core.DDSObject#getEnvironment(), executions of this method are also expected to be rare.

Parameters
implClassNamePropertyThe name of a system property, the value of which will be taken as the name of a ServiceEnvironment implementation class to load.
environmentA collection of name-value pairs to be provided to the concrete ServiceEnvironment subclass. If that class does not provide a constructor that can accept this environment, the environment will be ignored. This argument may be null; a null environment shall be considered equivalent to an empty map.
classLoaderThe class loader to use to load the service implementation class. If it is null, this class's class loader will be used if it is accessible; otherwise, the system class loader will be used.
Returns
A non-null ServiceEnvironment.
Exceptions
NullPointerExceptionIf the given property name is null.
IllegalArgumentExceptionIf the given property name is the empty string.
ServiceConfigurationExceptionIf the class could not be loaded because of an issue with the the invocation of this method or the configuration of the runtime environment. For example, the class may not be on the class path, it may require a native library that is not available, or an inappropriate class may have been requested (e.g. one that is not a ServiceEnvironment or that doesn't have a no-argument constructor).
ServiceInitializationExceptionIf the class was found but could not be initialized and/or instantiated because of an error that occurred within its implementation.
See also
createInstance(ClassLoader)
DDSObject::getEnvironment()
System::getProperty(String)
Class::getClassLoader()
ClassLoader::getSystemClassLoader()
ClassLoader::loadClass(String)

Definition at line 156 of file ServiceEnvironment.java.

◆ getEnvironment()

final ServiceEnvironment org.omg.dds.core.ServiceEnvironment.getEnvironment ( )
Returns
the org.omg.dds.core.ServiceEnvironment object that directly or indirectly was used to create this object.

Implements org.omg.dds.core.DDSObject.

Definition at line 289 of file ServiceEnvironment.java.

◆ getSPI()

abstract ServiceProviderInterface org.omg.dds.core.ServiceEnvironment.getSPI ( )
abstract

This method is not intended for use by applications.

The DDS-standard classes use it to delegate to a Service implementation.

Member Data Documentation

◆ IMPLEMENTATION_CLASS_NAME_PROPERTY

final String org.omg.dds.core.ServiceEnvironment.IMPLEMENTATION_CLASS_NAME_PROPERTY
static
Initial value:
=
"org.omg.dds.serviceClassName"

Definition at line 50 of file ServiceEnvironment.java.


The documentation for this class was generated from the following file: