public abstract class MApp
extends java.lang.Object
MApp
, define the required methods
(onInitialization()
and onTermination()
). These methods are protected and
are only callable from the SDK itself.
MApp
is an abstract class; applications create a subclass and instantiate it.
You can add or modify other methods as needed to the newly created subclass.
MApp
can start multiple sessions.
MAppProperties
Modifier and Type | Field and Description |
---|---|
static boolean |
bIncomingRvXMLUnicode |
static boolean |
bIsRvXmlMessageFormat |
static int |
DEFAULT_APP |
static java.lang.String |
PROCESS_ID |
static int |
THIN_APP |
Modifier | Constructor and Description |
---|---|
protected |
MApp(MAppProperties appProperties)
Defines an
MApp with the specified MAppProperties . |
protected |
MApp(MAppProperties p_appProp,
int p_appType) |
Modifier and Type | Method and Description |
---|---|
void |
addMethodToClassMicroAgent(MHawkMethod method)
Note: Unsuppoted API
|
void |
addSession(MSession session) |
void |
cleanup() |
void |
createConfigDeserializer() |
boolean |
createDefaultHawkMicroAgents(MHawkRegistry hawkRegistry) |
void |
decrDispatchers() |
AmxMessage |
dispatchAmxEvents(java.lang.String serviceName,
AmxMessage tibAmxInMsg,
java.lang.String amxExchangeId,
MAmxSender amxSender) |
MAdapterServiceInfo |
getAdapterServiceInfo()
Return the service information associated with this
MApp . |
MAdvisory |
getAdvisory()
Get the
MAdvisory instance for this application. |
MAdvisoryListener |
getAdvisoryListener()
Get the
MAdvisoryListener instance for this application. |
MAppProperties |
getAppParameters()
Get the parameters passed into the constructor for this
MApp instance. |
MClassRegistry |
getClassRegistry()
Get the
MClassRegistry instance for this application. |
java.lang.String |
getClientVariable(java.lang.String name) |
java.lang.String[][] |
getClientVariables() |
MComponent |
getComponentByName(java.lang.String name)
Convenience method to get the named component.
|
MComponentRegistry |
getComponentRegistry()
Get the component registry.
|
MConfigDeserializer |
getConfigDeserializer() |
MProperties |
getConfigProperties()
Retrieve the
MProperties instance created by MApp . |
MStartup |
getControlBlock() |
long |
getDispatchers() |
static java.lang.String |
getEncoding() |
java.lang.String |
getGlobalVariable(java.lang.String name) |
java.lang.String[][] |
getGlobalVariables() |
MHawkRegistry |
getHawkRegistry()
Retrieve the TIBCO Hawk registry.
|
MHostInfo |
getHostInfo()
Return the Host information associated with this
MApp . |
static MApp |
getInstance() |
MPropertiesRegistry |
getPropertiesRegistry()
Retrieve the
MPropertiesRegistry for this MApp . |
MRvSslConnectionSpec |
getRvSslSpec()
Deprecated.
Note: Unsupported API
|
com.tibco.tibrv.TibrvQueueGroup |
getTibrvQueueGroup() |
MTrace |
getTrace()
Retrieve the trace object attached to this application manager.
|
boolean |
hasSubscriberAdvisorySent() |
void |
incrDispatchers() |
void |
init() |
MGUID |
newGUID()
Create a new globally unique object for use with this application manager.
|
boolean |
nextEvent(long timelimit)
Dispatch the next event for the entire
MApp . |
protected abstract void |
onInitialization()
This method performs application-specific initialization.
|
protected abstract void |
onTermination()
Application-defined method that the SDK calls when an adapter application calls
MApp.stop() . |
void |
removeSession(MSession session) |
void |
setAdapterServiceInfo(MAdapterServiceInfo p_adapterServiceInfo)
Sets the service information associated with this
MApp . |
void |
setAdvisoryListener(MAdvisoryListener listener)
Set a custom advisory listener to listen to advisory messages
|
void |
setControlBlock(MStartup p_startup) |
static void |
setEncoding(java.lang.String p_encoding) |
void |
setHostInfo(MHostInfo p_hostInfo)
Sets the Host information associated with this
MApp . |
void |
setRvSslSpec(MRvSslConnectionSpec rvSslSpec)
Deprecated.
Note: Unsupported API
|
void |
setSubscriberAdvisorySent(boolean hasAdvisorySent) |
void |
setupClassRegistry(MPropertiesRegistry p_propertiesRegistry)
Deprecated.
|
void |
setupPropertiesRegistry(com.tibco.infra.repository.RepoClient p_repoClient)
Deprecated.
|
void |
start()
Begin initialization.
|
void |
start(boolean startEventLoop)
When applications call this method,
MApp goes through the following initialization steps:
Reads in the information that the adapter instance description defines explicitly or points to. |
void |
stop()
Stop this adapter application.
|
public static final java.lang.String PROCESS_ID
public static boolean bIncomingRvXMLUnicode
public static boolean bIsRvXmlMessageFormat
public static final int DEFAULT_APP
public static final int THIN_APP
protected MApp(MAppProperties appProperties)
MApp
with the specified MAppProperties
.
Before creating the MApp
application manager, applications create an
instance of MAppProperties
and set the application name, version,
banner information, and information about the location of the adapter instance
description object.
MApp
directly but instead create
instances of an application-specific subclass of MApp
.appProperties
- MAppProperties
class that encapsulates information about the
application name, version, banner information, command-line arguments, and configuration URL.protected MApp(MAppProperties p_appProp, int p_appType)
public static MApp getInstance()
public void incrDispatchers()
public void decrDispatchers()
public long getDispatchers()
public void init() throws MException
MException
public void cleanup() throws MException
MException
public static java.lang.String getEncoding()
public static void setEncoding(java.lang.String p_encoding)
protected abstract void onInitialization() throws MException
Every adapter application must implement this method.
This method is protected because it can only be called from MApp
. It is called by start()
.
MException
- (or subclass of it) in case of any error.protected abstract void onTermination() throws MException
MApp.stop()
.
When MApp.stop()
is called, the SDK first calls the application-defined
onTermination()
method, then performs some cleanup of its own.
Every adapter application must implement this method.
This method is protected; it can only be called from within the SDK itself. It is
called from within the stop()
method which applications call to terminate an application.
MException
- (or subclass of it) in case of any error.stop()
public final void start() throws MException
MException
- under any of the following circumstances:
onInitialization()
. The exception is forwarded.
MPublisher
,
MSubscriber
,
MSession.nextEvent(long)
,
nextEvent(long)
,
onInitialization()
,
start(boolean)
public final void start(boolean startEventLoop) throws MException
MApp
goes through the following initialization steps:
MPublisher
}, MSubscriber
, and so forth).
onInitialization()
.
Calling this method multiple times has no effect.
startEventLoop
- If this parameter is set to true
, the default,
MApp
starts the event loop. If the parameter is set to false
,
applications call MApp.nextEvent()
or MSession.nextEvent()
to process events.MException
- under any of the following circumstances:
onInitialization()
. The exception is forwarded.
start()
public final void stop() throws MException
When applications call this method, MApp
goes through the following shutdown steps:
onTermination()
to allow the application to perform cleanup.
After applications have called stop()
, they can no longer
access any of the objects that the class library itself created because
MApp
performs internal clean-up while executing this method.
Calling this method multiple times has no effect.
MApp.stop()
does not deactivate persistent/RVCM MSubscriber instances. If an
application should unregister from receiving persisten/RVCM messages, it
should call MSubscriber.deactivate()
for that subscriber.
MException
- if there was an exception during execution of onTermination()
(exception is forwarded).onTermination()
,
start()
public boolean nextEvent(long timelimit) throws MException
MApp
.
This contrasts with the method
MSession.nextEvent()
,
which dispatches the next event for one session only.timelimit
- Time limit in milliseconds.
If the next event cannot be executed within the time specified by this parameter, the method returns.
If, for example, you set the time limit to 1 second and no event occurs in this second (or has occurred in the past and has not yet been reported), then this method terminates and no exception is thrown.
MException
public MGUID newGUID()
Call this convenience method whenever you need a unique ID.
MGUID
public MTrace getTrace()
public MAppProperties getAppParameters()
MApp
instance.
The information
in the returned MAppProperties
object is augmented by information in
the adapter instance description and by command-line information.MApp
instance.public MAdvisory getAdvisory()
MAdvisory
instance for this application.public MAdvisoryListener getAdvisoryListener()
MAdvisoryListener
instance for this application.public void setAdvisoryListener(MAdvisoryListener listener) throws MException
listener
- Custom advisory listener used for handling advisory messages.
Note: This call replaces the default advisory listener provided by TIBCO Adapter SDK.MException
MAdvisoryListener
public MClassRegistry getClassRegistry()
MClassRegistry
instance for this application.
If an application uses metadata, MApp
parses the objects
in the public repository directory into a number of classes.
The MClassRegistry
class is the application entry point for
information about these classes.MClassRegistry
instance for this application.
Return null if no MClassRegistry
exists.
public MHawkRegistry getHawkRegistry()
public MComponentRegistry getComponentRegistry()
MApp
instance.
Components include instances of MEventSource
,
MHawkMicroAgent
,
MSink
or of any subclasses of these classes.MComponentRegistry
public MComponent getComponentByName(java.lang.String name)
public MProperties getConfigProperties()
MProperties
instance created by MApp
.
The returned object encapsulates configuration information.
MApp
parses configuration information during initialization and stores
it in an MProperties
instance. Applications can then retrieve that
information by calling this method.
Applications can only call this method after the start()
method has been called.
MProperties
instance created by MApp
.public MPropertiesRegistry getPropertiesRegistry()
MPropertiesRegistry
for this MApp
.MPropertiesRegistry
public void setRvSslSpec(MRvSslConnectionSpec rvSslSpec)
public MRvSslConnectionSpec getRvSslSpec()
public boolean createDefaultHawkMicroAgents(MHawkRegistry hawkRegistry) throws MException
MException
public void setupPropertiesRegistry(com.tibco.infra.repository.RepoClient p_repoClient) throws MException
MException
public void setupClassRegistry(MPropertiesRegistry p_propertiesRegistry) throws MException
MException
public MHostInfo getHostInfo()
MApp
.public void setHostInfo(MHostInfo p_hostInfo)
MApp
.p_hostInfo
- Adapter host information to be setpublic MAdapterServiceInfo getAdapterServiceInfo()
MApp
.public void setAdapterServiceInfo(MAdapterServiceInfo p_adapterServiceInfo)
MApp
.p_adapterServiceInfo
- adapter service information to be set.public MStartup getControlBlock()
public void setControlBlock(MStartup p_startup)
public MConfigDeserializer getConfigDeserializer()
public com.tibco.tibrv.TibrvQueueGroup getTibrvQueueGroup()
public void addSession(MSession session)
public void removeSession(MSession session)
public void createConfigDeserializer()
public void addMethodToClassMicroAgent(MHawkMethod method) throws MException
MException
public java.lang.String[][] getGlobalVariables() throws MException
MException
public java.lang.String getGlobalVariable(java.lang.String name) throws MException
name
- The name of the global variableMException
public java.lang.String[][] getClientVariables()
public java.lang.String getClientVariable(java.lang.String name) throws MException
name
- The name of the client variableMException
public void setSubscriberAdvisorySent(boolean hasAdvisorySent)
public boolean hasSubscriberAdvisorySent()
public AmxMessage dispatchAmxEvents(java.lang.String serviceName, AmxMessage tibAmxInMsg, java.lang.String amxExchangeId, MAmxSender amxSender)