com.neeve.emx
Class EmxFactory

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.emx.EmxObject
          extended by com.neeve.emx.EmxFactory

public final class EmxFactory
extends EmxObject

Factory class used to create EMX dispatchers, events and network link endpoints.

This class is a singleton class used to create dispatcher, event and link endpoint objects. Since there can be several deployed EMX implementations, the user should always use the factory to instantiate EMX objects. The factory isolates the user from the actual implementation.


Nested Class Summary
static class EmxFactory.EmxImpl
          EMX implementations.
 
Method Summary
 IEmxAlarmEvent createAlarmEvent(EmxFactory.EmxImpl impl, IEmxEventHandler handler, int interval)
          Create an EMX alarm event.
 IEmxDispatcher createDispatcher(EmxFactory.EmxImpl impl, String name, IEmxDispatcher.Params params)
          Create an EMX dispatcher.
 IEmxNwLnkClientEndpoint createNwLnkClientEndpoint(EmxFactory.EmxImpl impl, String descriptorStr, HashMap<String,Object> props)
          Create an EMX network link client endpoint.
 IEmxNwLnkClientEndpoint createNwLnkClientEndpoint(EmxFactory.EmxImpl impl, com.neeve.util.UtlAddressDescriptor descriptor)
          Create an EMX network link client endpoint.
 IEmxNwLnkEndpoint createNwLnkEndpoint(boolean client, EmxFactory.EmxImpl impl, String descriptorStr, HashMap<String,Object> props)
          Create an EMX network link client or server endpoint.
 IEmxNwLnkEndpoint createNwLnkEndpoint(boolean client, EmxFactory.EmxImpl impl, com.neeve.util.UtlAddressDescriptor descriptor)
          Create an EMX network link client or server endpoint.
 IEmxNwLnkServerEndpoint createNwLnkServerEndpoint(EmxFactory.EmxImpl impl, String descriptorStr, HashMap<String,Object> props)
          Create an EMX network link server endpoint.
 IEmxNwLnkServerEndpoint createNwLnkServerEndpoint(EmxFactory.EmxImpl impl, com.neeve.util.UtlAddressDescriptor descriptor)
          Create an EMX network link server endpoint.
 IEmxUserEvent createUserEvent(EmxFactory.EmxImpl impl, IEmxEventHandler handler)
          Create an EMX user event.
 EmxFactory.EmxImpl getDefaultEmxImpl()
          Return the default EMX implementation configured for use.
static EmxFactory getInstance()
          Return the singleton EMX factory instance
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EmxFactory getInstance()
Return the singleton EMX factory instance

Returns:
Returns the EMX factory
Threading:
This method is safe for concurrent access by multiple threads

getDefaultEmxImpl

public final EmxFactory.EmxImpl getDefaultEmxImpl()
Return the default EMX implementation configured for use.

Returns:
Returns the default configured EMX implementation.

This method returns the default EMX implementation configured for use. The default implementation is retrieved from the nv.emx.impl system property. In case the system property is not set, the default impl defaults to EmxFactory.EmxImpl.NIO

Threading:
This method is safe for concurrent access by multiple threads

createDispatcher

public final IEmxDispatcher createDispatcher(EmxFactory.EmxImpl impl,
                                             String name,
                                             IEmxDispatcher.Params params)
                                      throws EEmxException
Create an EMX dispatcher.

Parameters:
impl - The EMX implementation to use. Refer to EmxFactory.EmxImpl for supported EMX implementations.
name - The name to be assigned to the dispatcher. This name is only use for debugging and trace purposes.
params - Specifies operational parameters to be used by the created dispatcher.
Throws:
EEmxException - Thrown if any other exception was encountered while creating the dispatcher.
Threading:
This method is safe for concurrent access by multiple threads

createUserEvent

public final IEmxUserEvent createUserEvent(EmxFactory.EmxImpl impl,
                                           IEmxEventHandler handler)
Create an EMX user event.

Parameters:
impl - The EMX implementation to use. Refer to EmxFactory.EmxImpl for supported EMX implementations.
handler - The handler to be associate with the event.

This method creates an EMX user event.

Threading:
This method is safe for concurrent access by multiple threads

createAlarmEvent

public final IEmxAlarmEvent createAlarmEvent(EmxFactory.EmxImpl impl,
                                             IEmxEventHandler handler,
                                             int interval)
Create an EMX alarm event.

Parameters:
impl - The EMX implementation to use. Refer to EmxFactory.EmxImpl for supported EMX implementations.
handler - The handler to be associate with the event.
interval - The alarm interval (in milliseconds).

This method creates an EMX alarm event.

Threading:
This method is safe for concurrent access by multiple threads

createNwLnkEndpoint

public final IEmxNwLnkEndpoint createNwLnkEndpoint(boolean client,
                                                   EmxFactory.EmxImpl impl,
                                                   com.neeve.util.UtlAddressDescriptor descriptor)
                                            throws EEmxNwLnkInvalidTypeException,
                                                   EEmxException
Create an EMX network link client or server endpoint.

Parameters:
client - A value of true in this parameter will create a client endpoint and a value of false will create a server endpoint.
impl - The EMX implementation to use. Refer to EmxFactory.EmxImpl for supported EMX implementations.
descriptor - An address descriptor that contains the information needed to create the endpoint.
Returns:
Returns the created network link endpoint
Throws:
EEmxNwLnkInvalidTypeException - Thrown if the link type specified in the network link descriptor is invalid
EEmxException - Thrown if any other exception was encountered while creating the new network link endpoint.

This method create a new EMX network link endpoint. Information needed to create the endpoint is specified via an address descriptor object.

Threading:
This method is safe for concurrent access by multiple threads

createNwLnkEndpoint

public final IEmxNwLnkEndpoint createNwLnkEndpoint(boolean client,
                                                   EmxFactory.EmxImpl impl,
                                                   String descriptorStr,
                                                   HashMap<String,Object> props)
                                            throws EEmxNwLnkDescriptorFormatException,
                                                   EEmxNwLnkInvalidTypeException,
                                                   EEmxException
Create an EMX network link client or server endpoint.

Parameters:
client - A value of true in this parameter will create a client endpoint and a value of false will create a server endpoint.
impl - The EMX implementation to use. Refer to EmxFactory.EmxImpl for supported EMX implementations.
descriptorStr - A structured string that contains information needed to create the endpoint. The string must be of the form defined by an address descriptor object (see UtlAddressDescriptor) i.e of the form [type]://[address]&prop=name&prop=name&...&prop=name where the type specifies the type of link to be create (e.g. tcp, ssl, http etc) and the remaining portion of the string specifies the address and configuration parameters to be used by the instantiated link endpoint (e.g. endpoint host name, port, socket buffer size etc). The permitted properties that can be specified in this portion is link type specific.
props - A table containing properties for use by the created link endpoint. Properties specifies in this table are superceded by properties parsed from the descriptor string.
Returns:
Returns the created network link endpoint
Throws:
EEmxNwLnkDescriptorFormatException - Thrown if the descriptor is not of the form [link type]://[address]&prop=name&prop=name&....
EEmxNwLnkInvalidTypeException - Thrown if the link type specified in the network link descriptor is invalid
EEmxException - Thrown if any other exception was encountered while creating the new network link endpoint.

This method is a convenience method to create a new EMX network link endpoint. Information needed to create the endpoint is specified via a structured string (see descriptorStr) and a properties table. The method parses the descriptor string and properties table into an UtlAddressDescriptor and invokes the network link creation method that uses an address descriptor to accept link creation info.

Threading:
This method is safe for concurrent access by multiple threads

createNwLnkClientEndpoint

public final IEmxNwLnkClientEndpoint createNwLnkClientEndpoint(EmxFactory.EmxImpl impl,
                                                               String descriptorStr,
                                                               HashMap<String,Object> props)
                                                        throws EEmxNwLnkDescriptorFormatException,
                                                               EEmxNwLnkInvalidTypeException,
                                                               EEmxException
Create an EMX network link client endpoint.

This method is a convenience method to create a network link client endpoint. The method calls the appropriate createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor) method to create the client endpoint.

Throws:
EEmxNwLnkDescriptorFormatException
EEmxNwLnkInvalidTypeException
EEmxException
See Also:
createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor)
Threading:
This method is safe for concurrent access by multiple threads

createNwLnkClientEndpoint

public final IEmxNwLnkClientEndpoint createNwLnkClientEndpoint(EmxFactory.EmxImpl impl,
                                                               com.neeve.util.UtlAddressDescriptor descriptor)
                                                        throws EEmxNwLnkDescriptorFormatException,
                                                               EEmxNwLnkInvalidTypeException,
                                                               EEmxException
Create an EMX network link client endpoint.

This method is a convenience method to create a network link client endpoint. The method calls the appropriate createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor) method to create the client endpoint.

Throws:
EEmxNwLnkDescriptorFormatException
EEmxNwLnkInvalidTypeException
EEmxException
See Also:
createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor)
Threading:
This method is safe for concurrent access by multiple threads

createNwLnkServerEndpoint

public final IEmxNwLnkServerEndpoint createNwLnkServerEndpoint(EmxFactory.EmxImpl impl,
                                                               String descriptorStr,
                                                               HashMap<String,Object> props)
                                                        throws EEmxNwLnkDescriptorFormatException,
                                                               EEmxNwLnkInvalidTypeException,
                                                               EEmxException
Create an EMX network link server endpoint.

This method is a convenience method to create a network link server endpoint. The method calls into the createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor) to create the server endpoint. Refer to createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor) for parameter documentation.

Throws:
EEmxNwLnkDescriptorFormatException
EEmxNwLnkInvalidTypeException
EEmxException
See Also:
createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor)
Threading:
This method is safe for concurrent access by multiple threads

createNwLnkServerEndpoint

public final IEmxNwLnkServerEndpoint createNwLnkServerEndpoint(EmxFactory.EmxImpl impl,
                                                               com.neeve.util.UtlAddressDescriptor descriptor)
                                                        throws EEmxNwLnkDescriptorFormatException,
                                                               EEmxNwLnkInvalidTypeException,
                                                               EEmxException
Create an EMX network link server endpoint.

This method is a convenience method to create a network link server endpoint. The method calls the appropriate createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor) method to create the server endpoint.

Throws:
EEmxNwLnkDescriptorFormatException
EEmxNwLnkInvalidTypeException
EEmxException
See Also:
createNwLnkEndpoint(boolean, com.neeve.emx.EmxFactory.EmxImpl, com.neeve.util.UtlAddressDescriptor)
Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2015 Neeve Research, LLC. All Rights Reserved.