public abstract class AmiMethod extends java.lang.Object implements AmiMethodInterface, java.lang.Comparable
AmiMethodInterface
as a convenient abstract class.
Classes that extend from this AmiMethod
abstract class must
implement the following methods:
public abstract AmiParameterList getArguments();
public abstract AmiParameterList getReturns();
public abstract AmiParameterList onInvoke(AmiParameterList
arguments) throws AmiException;
Constructor and Description |
---|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type)
Constructor for creating an instance of AmiMethod object
|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type,
int timeout)
Constructor for creating an instance of AmiMethod object
|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type,
int timeout,
java.lang.String indexName)
Constructor for creating an instance of AmiMethod object.
|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type,
int timeout,
java.lang.String[] indexName)
Constructor for creating an instance of AmiMethod object.
|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type,
java.lang.String indexName)
Constructor for creating an instance of AmiMethod object.
|
AmiMethod(java.lang.String name,
java.lang.String help,
AmiMethodType type,
java.lang.String[] indexName)
Constructor for creating an instance of AmiMethod object.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object otherMethod)
Compares if this AMI method with some other AMI method in order to enable alphabetical sorting.
|
boolean |
equals(AmiMethodInterface method)
Compares if the given AMI method is equivalent of this AMI method.
|
abstract AmiParameterList |
getArguments()
Returns an
AmiParameterList that serves to describe the
input arguments of this AMI method. |
java.lang.String |
getHelp()
Return the help text of the method.
|
java.lang.String[] |
getIndexName()
Returns the name of the output parameter that serves as the index name.
|
java.lang.String |
getName()
Return the name of this method.
|
abstract AmiParameterList |
getReturns()
Returns an
AmiParameterList that serves to describe the
output return arguments of this AMI method. |
AmiSession |
getSession()
Returns the AmiSession object that this method belongs to.
|
int |
getTimeout()
Returns the timeout interval of this AMI method, in milliseconds.
|
AmiMethodType |
getType()
Return the type object of this AMI method.
|
abstract AmiParameterList |
onInvoke(AmiParameterList arguments)
This method is invoked by the AMI Java API when a method invocation
arrives from the managing TIB/Hawk Agent.
|
void |
setIndexName(java.lang.String indexName)
Sets the AMI method's index parameter name.
|
void |
setIndexName(java.lang.String[] indexName)
Sets the AMI method's index parameter name.
|
void |
setSession(AmiSession ami)
Sets the
AmiSession for this method. |
java.lang.String |
toString() |
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type)
name
- Name of the methodhelp
- Help text of the methodtype
- Type of the method
This constructor does not make any effort to perform input argument
validation. Validation is performed only at
AmiSession.addMethod
.
The type parameter must be one of the following:
AmiConstants.METHOD_TYPE_INFO
AmiConstants.METHOD_TYPE_ACTION
AmiConstants.METHOD_TYPE_ACTION_INFO
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type, int timeout)
name
- Name of the methodhelp
- Help text of the methodtype
- Type of the methodtimeout
- Timeout of the method
This constructor does not make any effort to perform input argument
validation. Validation is performed only at
AmiSession.addMethod
.
The type parameter must be one of the following:
AmiConstants.METHOD_TYPE_INFO
AmiConstants.METHOD_TYPE_ACTION
AmiConstants.METHOD_TYPE_ACTION_INFO
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type, java.lang.String indexName)
name
- Name of the method.help
- Help text of the method.type
- Type of the method.indexName
- AMI method parameter name that serves as the index.
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type, int timeout, java.lang.String indexName)
name
- Name of the method.help
- Help text of the method.type
- Type of the method.timeout
- Timeout of the method.indexName
- AMI method parameter name that serves as the index.
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type, java.lang.String[] indexName)
name
- Name of the method.help
- Help text of the method.type
- Type of the method.indexName
- AMI method parameter names that serve as the index.
public AmiMethod(java.lang.String name, java.lang.String help, AmiMethodType type, int timeout, java.lang.String[] indexName)
name
- Name of the method.help
- Help text of the method.type
- Type of the method.timeout
- Timeout of the method.indexName
- AMI method parameter names that serve as the index.
public final void setSession(AmiSession ami) throws AmiException
AmiSession
for this method.setSession
in interface AmiMethodInterface
ami
- The AmiSession to be associated with.AmiException
- is thrown if this method has been previously
associated with another AmiSession
.
Please note that the application should not invoke this method directly
to set the session. Instead, use
If the application invokes this method directly then attempts to perform
AmiSession.addMethod(AmiMethodInterface)
to associate this
method with the desired
AmiSession
object.
AmiSession.addMethod
on this method, the latter operation will
throw an
AmiException
.
public void setIndexName(java.lang.String indexName)
setIndexName
in interface AmiMethodInterface
indexName
- Name of the parameter that serves as the index.
public void setIndexName(java.lang.String[] indexName)
setIndexName
in interface AmiMethodInterface
indexName
- Names of the parameter that serve as the index.
This method needs to be used when the AMI method has composite index names.
public final AmiSession getSession()
getSession
in interface AmiMethodInterface
Please note that until this method is been added to an AMI session, the session object returned from this method is null.
public final java.lang.String getName()
getName
in interface AmiMethodInterface
Please note that the constructor of this object does not perform input argument validation, therefore the string returned from this method may be null.
public final java.lang.String getHelp()
getHelp
in interface AmiMethodInterface
Please note that the constructor of this object does not perform input argument validation, therefore the string returned from this method may be null.
public final AmiMethodType getType()
getType
in interface AmiMethodInterface
The returned type object is one of the following:
AmiConstants.METHOD_TYPE_INFO
AmiConstants.METHOD_TYPE_ACTION
AmiConstants.METHOD_TYPE_ACTION_INFO
public int getTimeout()
getTimeout
in interface AmiMethodInterface
public boolean equals(AmiMethodInterface method)
Two AMI methods are said to be equivalent if they have the same AMI method names.
public int compareTo(java.lang.Object otherMethod)
compareTo
in interface java.lang.Comparable
public java.lang.String[] getIndexName()
getIndexName
in interface AmiMethodInterface
The index name is necessary and required if this AMI method has the potential to return multiple rows of data.
public abstract AmiParameterList getArguments()
AmiParameterList
that serves to describe the
input arguments of this AMI method.getArguments
in interface AmiMethodInterface
Subclass of the AmiMethod class must implement this method for the purpose of returning the method input arguments specification. If the AMI method does not have any input arguments, then null should be returned.
public abstract AmiParameterList getReturns()
AmiParameterList
that serves to describe the
output return arguments of this AMI method.getReturns
in interface AmiMethodInterface
Subclass of the AmiMethod class must implement this method for the purpose of specifying the method return arguments. If the AMI method does not have any return arguments, then null should be returned.
AMI method of type AmiConstants.METHOD_TYPE_INFO
and
AmiConstants.METHOD_TYPE_ACTION_INFO
must return a non-null
AmiParameterList
with at least one AmiPaarmeter
.
public abstract AmiParameterList onInvoke(AmiParameterList arguments) throws java.lang.Exception
onInvoke
in interface AmiMethodInterface
arguments
- Input arguments of the method invocationjava.lang.Exception
- The application is allowed to throw any Exception
object from this method where the text message of the Exception will be
used by the AMI API as the method invocation reply.
Note that AmiException thrown from this method is capture by the AMI Java API and is turned into an error reply. This error reply is sent back to the invoking Agent as the result of the method invocation.
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2000-2019 TIBCO Inc. All Rights Reserved.