ADK CVS

tryllian.afc.task.find
Class JNDIResolveTask

java.lang.Object
  extended bytryllian.afc.task.AbstractTask
      extended bytryllian.afc.task.DefaultTask
          extended bytryllian.afc.task.interaction.SendAndReceiveTask
              extended bytryllian.afc.task.interaction.QueryTask
                  extended bytryllian.afc.task.find.JNDIResolveTask
All Implemented Interfaces:
java.util.EventListener, MessageHandler, java.io.Serializable, Task

public class JNDIResolveTask
extends QueryTask

Resolves a jndi context-name as if a call to Context.listBindings() was done by asking it locally to a (remote) habitat system agent. The result is always returned as a List. The type depends on the getter method used to retrieve the results.

NOTE: only the bound objects are returned, not their names.

See Also:
tryllian.are.fipa.constants.LanguageConstants#JNDI_RESOLVE, SendAndReceiveTask.getResult(), Serialized Form

Field Summary
 
Fields inherited from class tryllian.afc.task.AbstractTask
NL
 
Fields inherited from interface tryllian.afc.task.Task
EMPTY_FINISH_VALUE, FORCED_FINISH_FAILURE, NO_TIME_OUT, TASK_TIMED_OUT
 
Constructor Summary
JNDIResolveTask()
          Default constructor sets subject, the contextName should be set before starting the task.
 
Method Summary
 java.util.List getAgentAddresses()
          Returns a list containing only the AddressURIes in the result list.
 java.lang.String getContextName()
          Get the context name to be resolved.
 java.util.List getContextNames()
          Return list with only contextnames (not agentaddresses) as strings.
 java.lang.String getHabitat()
          Get the name of the habitat where to do the lookup.
 java.util.List getResult()
          Get the result: a list of strings that represent the Objects of the bindings that are in the context.
 void setContextName(java.lang.String contextName)
          Set the context name to be resolved.
 void setHabitat(java.lang.String habitatName)
          Get the name of the habitat where to do the lookup.
 void taskStarted()
          Sets arguments of the message, contextName should have been set before this method is called - that is, before the task is started.
 
Methods inherited from class tryllian.afc.task.interaction.SendAndReceiveTask
getArguments, getConversation, getLanguage, getReceivePerformative, getReceiver, getSendPerformative, getSubject, handleMessage, processResult, setArguments, setLanguage, setReceivePerformative, setReceiver, setSendPerformative, setSubject
 
Methods inherited from class tryllian.afc.task.DefaultTask
addFinishingTask, addTask, getSubtasks, handleHeartbeat, propagateHeartbeat
 
Methods inherited from class tryllian.afc.task.AbstractTask
addTaskListener, fail, fail, finish, finish, finish, forceFinish, forceFinish, getAgentContext, getFinishValue, getState, getSupertask, getTimeOut, heartbeatReceived, logException, messageReceived, removeTaskListener, setAgentContext, setFinishValue, setTimeOut, succeed, succeed, taskAdded, taskEnded, taskRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNDIResolveTask

public JNDIResolveTask()
Default constructor sets subject, the contextName should be set before starting the task.

Method Detail

taskStarted

public void taskStarted()
Sets arguments of the message, contextName should have been set before this method is called - that is, before the task is started.

Overrides:
taskStarted in class AbstractTask

getResult

public java.util.List getResult()
Get the result: a list of strings that represent the Objects of the bindings that are in the context. These Strings are either bindings or AddressURIes. Use getAgentAddresses to get a list of only AddressURIes in the result, and use getContextNames to get a list of only contextsNames (as Strings).

Overrides:
getResult in class SendAndReceiveTask
Returns:
List of String with (unconverted) results of the remote resolve
Throws:
java.lang.IllegalStateException - if the task did not succeed (yet).

getAgentAddresses

public java.util.List getAgentAddresses()
Returns a list containing only the AddressURIes in the result list. The elements are all converted to AddressURI.

Returns:
List of AddressURI
Throws:
java.lang.IllegalStateException - if the task did not succeed (yet).

getContextNames

public java.util.List getContextNames()
Return list with only contextnames (not agentaddresses) as strings. That is: return only the elements of result that start with {#link tryllian.naming.NamingConstants#ROOT_SPACE}.

Returns:
List of String with context names
Throws:
java.lang.IllegalStateException - if the task did not succeed (yet).

setContextName

public void setContextName(java.lang.String contextName)
Set the context name to be resolved.

Parameters:
contextName - the name of the context to be resolved

getContextName

public java.lang.String getContextName()
Get the context name to be resolved.

Returns:
the name of the context to be resolved

getHabitat

public java.lang.String getHabitat()
Get the name of the habitat where to do the lookup.

Returns:
the name of the habitat.

setHabitat

public void setHabitat(java.lang.String habitatName)
Get the name of the habitat where to do the lookup.


Copyright 2005, Tryllian Solutions B.V.