Package org.objectweb.joram.mom.dest
Class AdminTopic
- java.lang.Object
-
- fr.dyade.aaa.agent.Agent
-
- org.objectweb.joram.mom.dest.Destination
-
- org.objectweb.joram.mom.dest.Topic
-
- org.objectweb.joram.mom.dest.AdminTopic
-
- All Implemented Interfaces:
AgentMBean,Encodable,Serializable,AdminTopicMBean,ClusterDestinationMBean,DestinationMBean,TopicMBean
public final class AdminTopic extends Topic implements AdminTopicMBean
TheAdminTopicclass implements the administration topic behavior, basically processing administration requests.It receives administration requests from the client encapsulated in JMS messages:
- If the request concerns an user or a destination it forwards the request to the target. This target directly replies (*) to the client sending a JMS message to the replyTo destination specified in the original JMS message.
- If the request can be processed by the administration topic, either the request concerns the local server and it is processed, or it is forwarded to the administration topic of the target server.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAdminTopic.DestinationDesc
-
Field Summary
Fields Modifier and Type Field Description (package private) static AgentIdadminIdprivate static booleanDEBUGprivate Map<String,AdminTopic.DestinationDesc>destinationsTableTable holding the local server's destinations names.private static Loggerloggerprivate longmsgCounterCounter of messages produced by this AdminTopic.private Map<String,AgentId>proxiesTableTable holding the TCP users proxies identifiers.private static AdminTopicrefReference of the server's local AdminTopic instance.private Map<String,AgentId>requestsTableTable keeping the administrator's requests.private static longserialVersionUIDdefine serialVersionUID for interoperabilityprivate intserverIdIdentifier of the server this topic is deployed on.private Map<String,Identity>usersTableTable holding the TCP users identifications.-
Fields inherited from class org.objectweb.joram.mom.dest.Topic
fatherId, friends, nbMsgsReceiveSinceCreation, selectors, subscribers
-
Fields inherited from class org.objectweb.joram.mom.dest.Destination
clients, dmqId, freeReading, freeWriting, nbMsgsDeliverSinceCreation, nbMsgsSentToDMQSinceCreation, READ, READWRITE, strbuf, strictCounters, task, temporary, WRITE
-
Fields inherited from class fr.dyade.aaa.agent.Agent
agentProfiling, emptyString, fixed, logmon
-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description AdminTopic()Constructs anAdminTopicagent.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private voidbroadcastRequest(AdminRequest request, int avoidServerId, AgentId replyTo, String msgId)Sends the administration request to AdminTopic of all servers except the given one.private booleancheckServerId(int serverId)Returnstrueif a given server identification corresponds to the local server's.protected voidclusterJoin(ClusterJoinNot not)Overrides thisTopicmethod; if this AdminTopic is on server0, new cluster fellow is notified to other fellows and other fellows are notified to it.protected voidclusterJoinAck(ClusterJoinAck ack)Overrides thisTopicmethod; aClusterAckis not expected by an AdminTopic.private AdminTopic.DestinationDesccreateDestination(String destName, AgentId adminId, Properties properties, byte type, String className, String requestClassName, StringBuffer strbuf)Instantiating the destination class or retrieving the destination.static AdminTopic.DestinationDesccreateDestinationAndSave(String destName, AgentId adminId, Properties properties, byte type, String className, String requestClassName, StringBuffer strbuf)Deprecated.private StringcreateMessageId()voidcreateQueue(String name)Creates a new queue on the local server.voidcreateQueue(String name, int serverId)Creates a new queue on the selected server.voidcreateQueue(String name, String queueClassName, int serverId)Creates a new queue on the selected server.voidcreateTopic(String name)Creates a new topic on the local server.voidcreateTopic(String name, int serverId)Creates a new topic on the selected server.voidcreateTopic(String name, String topicClassName, int serverId)Creates a new topic on the selected server.voidcreateUser(String user, String passwd)Creates a new user on the local server.voidcreateUser(String user, String passwd, int serverId)Creates a new user on the selected server.voidcreateUser(String user, String passwd, int serverId, String identityClassName)Creates a new user on the selected server.static voidCreateUserAndSave(CreateUserRequest request, AgentId replyTo, String msgId)Deprecated.voiddeleteNot(AgentId from, DeleteNot not)Overrides thisDestinationmethod.static voiddeleteUser(String userName)private voiddistributeReply(AgentId to, String msgId, AdminReply reply)Actually sends anAdminReplyobject to an identified destination.private voiddoProcess(AgentId replyTo, String msgId)private AdminReplydoProcess(GetRightsReplyNot not)Processes aMonit_GetUsersRepnotification holding a destination's readers' or writers' identifiers.private voiddoProcess(AddDomainRequest request, AgentId replyTo, String msgId, AgentId from)Adds a new domain to the configuration.private voiddoProcess(AddServerRequest request, AgentId replyTo, String msgId, AgentId from)Adds a server to the configuration.private voiddoProcess(AdminCommandRequest request, AgentId replyTo, String requestMsgId)Process an admin command.private voiddoProcess(CreateDestinationRequest request, AgentId replyTo, String msgId)Processes aCreateDestinationRequestinstance requesting the creation of a destination.private voiddoProcess(CreateUserRequest request, AgentId replyTo, String msgId)Processes aCreateUserRequestinstance requesting the creation of aUserAgentfor a given user.private voiddoProcess(DeleteDestination request, AgentId replyTo, String msgId)Processes aDeleteDestinationinstance requesting the deletion of a destination.private voiddoProcess(DeleteUser request, AgentId replyTo, String msgId)Processes aDeleteUserinstance requesting the deletion of a user.private voiddoProcess(DestinationAdminRequest request, AgentId replyTo, String msgId)Processes aDestinationRequestrequest by forwarding it to its target destination, if local.private voiddoProcess(GetConfigRequest request, AgentId replyTo, String msgId)Gets the current configuration.private voiddoProcess(GetDestinationsRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetDestinationsrequest by sending registered destinations.private voiddoProcess(GetDMQSettingsRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetDMQSettingsrequest either by processing it and sending back the default DMQ settings, or by forwarding it to its target destination or proxy.private voiddoProcess(GetDomainNames request, AgentId replyTo, String msgId)private voiddoProcess(GetJMXAttsRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetJMXAttsrequest or forwards it to its target destination if needed.private voiddoProcess(GetRightsRequest request, AgentId replyTo, String msgId)Processes aGetRightsRequestrequest by forwarding it to its target destination, if local.private voiddoProcess(GetServersIdsRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetServersIdsrequest by sending the list of the platform servers' ids.private voiddoProcess(GetStatsRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetStatrequest or forwards it to its target destination if needed.private voiddoProcess(GetUsersRequest request, AgentId replyTo, String msgId)Processes aMonitor_GetUsersrequest by sending the users table.private voiddoProcess(RemoveDomainRequest request, AgentId replyTo, String msgId, AgentId from)Removes a domain in the configuration.private voiddoProcess(RemoveServerRequest request, AgentId replyTo, String msgId, AgentId from)Removes a server in the configuration.private voiddoProcess(SetDMQRequest request, AgentId replyTo, String msgId)Processes aSetDMQrequest requesting a given queue to be set as the DMQ of a given destination or user.private voiddoProcess(SetThresholdRequest request, AgentId replyTo, String msgId)Processes aSetThresholdrequest requesting a given threshold value to be set as the threshold of a given destination or user.private voiddoProcess(StopServerRequest request, AgentId replyTo, String msgId)Processes aStopServerRequestinstance requesting to stop a given server.private voiddoProcess(UpdateUser request, AgentId replyTo, String msgId)Processes anUpdateUserinstance requesting to modify the identification of a user.private voiddoProcess(UserAdminRequest request, AgentId replyTo, String requestMsgId)Handle administration request about user.protected voiddoUnknownAgent(UnknownAgent uA)Specializes thisTopicreaction.static AgentIdgetDefault()Gets the identifier of the default administration topic on the current server.static AgentIdgetDefault(short serverId)Gets the identifier of the default administration topic on a given server.private AgentIdgetProxyId(Identity identity, String inaddr)Method used byConnectionManagerproxies to check their clients identification.private voidhandleAdminNotification(AdminNotification adminNot)Method implementing the reaction to aAdminNotificationnotification notifying of the creation of an administrator proxy.private voidhandleAdminReply(AdminReplyNot not)Method implementing the reaction to aorg.objectweb.joram.mom.notifications.AdminReplynotification replying to an administration request.protected voidhandleDeniedMessage(String msgId, AgentId replyTo)Method used to send a response when a message is denied because of a lack of rights.private voidhandleGetProxyIdListNot(GetProxyIdListNot not)private voidhandleGetProxyIdNot(GetProxyIdNot not)private static ObjectinvokeStaticMethod(Properties prop)Invokes a static method on the server using the specified properties.static booleanisAdminTopicId(AgentId id)Returns true if the given AgentId is the unique identifier of an AdminTopic agent.static booleanisDestinationTableContain(String destName)Deprecated.static AdminTopic.DestinationDesclookupDest(String name, byte type)Retrieves an existing destination.static AgentIdlookupUser(String name)Retrieves an existing userprotected ClientMessagespreProcess(AgentId from, ClientMessages msgs)Overrides thisDestinationmethod;private voidprocessAdminRequests(AgentId replyTo, String msgId, AdminRequest request, AgentId from)Method getting the administration requests from messages, and distributing them to the appropriate reactions.private voidprocessAdminRequests(ClientMessages not)Method getting the administration requests from messages, and distributing them to the appropriate reactions.voidreact(AgentId from, Notification not)Distributes the received notifications to the appropriate reactions.private voidreadObject(ObjectInputStream in)Deserializes anAdminTopicinstance.static voidregisterDest(AgentId id, String name, byte type)Registers a newly created destination.protected voidrequestGroupNot(AgentId from, RequestGroupNot not)static AdminTopic.DestinationDescreverseLookupDest(String agentId, byte type)Retrieves an existing destination.static voidsetRightAndSave(SetRight request, AgentId replyTo, String msgId)Deprecated.protected voidtopicForwardNot(AgentId from, TopicForwardNot not)Overrides thisTopicmethod; the forwarded messages contain admin requests and will be processed.StringtoString()Returns a string representation of this destination.static voidunregisterDest(String name)Removes a registered destination.private voidwriteObject(ObjectOutputStream out)Serializes anAdminTopicinstance.-
Methods inherited from class org.objectweb.joram.mom.dest.Topic
createTopicForward, doClientMessages, doDeleteNot, doRightRequest, finalize, forwardMessages, forwardMessages, getClusterElements, getNbMsgsReceiveSinceCreation, getNumberOfSubscribers, getStats, getSubscriberIds, getType, handleAdminRequestNot, initialize, processMessages, sendToCluster, subscribeRequest, unsubscribeRequest, wakeUpNot
-
Methods inherited from class org.objectweb.joram.mom.dest.Destination
agentFinalize, agentInitialize, clientMessages, decode, delete, encode, forward, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQAgentId, getDMQId, getEncodedSize, getJMXStatistics, getNbMsgsDeliverSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getRights, interceptorsAvailable, isAdministrator, isFreeReading, isFreeWriting, isLocal, isReader, isValidJMXAttribute, isWriter, postProcess, processAdminCommand, processInterceptors, processPause, processSetRight, processStartHandler, processStopHandler, replyToTopic, setAdminId, setFreeReading, setFreeWriting, setPeriod, setProperties, setRight, unknownAgent
-
Methods inherited from class fr.dyade.aaa.agent.Agent
agentSave, delete, delete, deploy, deploy, doAdminSyncNotification, getAgentId, getCommitTime, getEncodableClassId, getId, getLogTopic, getName, getReactNb, getReactTime, hasName, incWorkInProgress, isAgentProfiling, isDeployed, isFixed, isUpdated, load, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName, setNoSave, setSave
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.dyade.aaa.agent.AgentMBean
getAgentId, getCommitTime, getReactNb, getReactTime, isAgentProfiling, isFixed, resetCommitTime, resetReactTime, resetTimer, setAgentProfiling
-
Methods inherited from interface org.objectweb.joram.mom.dest.ClusterDestinationMBean
getClusterElements
-
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationMBean
delete, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getName, getNbMsgsDeliverSinceCreation, getNbMsgsReceiveSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getType, isFreeReading, isFreeWriting, setFreeReading, setFreeWriting, setPeriod
-
Methods inherited from interface org.objectweb.joram.mom.dest.TopicMBean
getNumberOfSubscribers, getSubscriberIds
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
ref
private static AdminTopic ref
Reference of the server's local AdminTopic instance.
-
serverId
private int serverId
Identifier of the server this topic is deployed on.
-
destinationsTable
private Map<String,AdminTopic.DestinationDesc> destinationsTable
Table holding the local server's destinations names. This table is used by more than one thread so it needs to be synchronized.Key: destination name
Object: destination agent identifier
-
usersTable
private Map<String,Identity> usersTable
Table holding the TCP users identifications.Key: user name
Object: user password
-
proxiesTable
private Map<String,AgentId> proxiesTable
Table holding the TCP users proxies identifiers.Key: user name
Object: proxy's identifier
-
requestsTable
private Map<String,AgentId> requestsTable
Table keeping the administrator's requests.Key: request's message identifier
Value: request's message ReplyTo field
-
msgCounter
private long msgCounter
Counter of messages produced by this AdminTopic.
-
adminId
static AgentId adminId
-
-
Constructor Detail
-
AdminTopic
public AdminTopic() throws RequestExceptionConstructs anAdminTopicagent.- Throws:
RequestException
-
-
Method Detail
-
toString
public String toString()
Description copied from class:TopicReturns a string representation of this destination.- Specified by:
toStringin interfaceAgentMBean- Specified by:
toStringin interfaceDestinationMBean- Overrides:
toStringin classTopic- Returns:
- A string representation of this agent.
-
getDefault
public static AgentId getDefault(short serverId)
Gets the identifier of the default administration topic on a given server.
-
getDefault
public static final AgentId getDefault()
Gets the identifier of the default administration topic on the current server.
-
isAdminTopicId
public static final boolean isAdminTopicId(AgentId id)
Returns true if the given AgentId is the unique identifier of an AdminTopic agent.- Parameters:
id- the AgentId to verify.- Returns:
- true if the given AgentId is the unique identifier of an AdminTopic agent.
-
react
public void react(AgentId from, Notification not) throws Exception
Distributes the received notifications to the appropriate reactions.
-
getProxyId
private AgentId getProxyId(Identity identity, String inaddr) throws Exception
Method used byConnectionManagerproxies to check their clients identification.- Parameters:
identity-inaddr-- Returns:
- The agent unique identifier of the authentified user.
- Throws:
Exception- If the user does not exist, is wrongly identified, or does not have any proxy deployed.- See Also:
ConnectionManager
-
handleDeniedMessage
protected void handleDeniedMessage(String msgId, AgentId replyTo)
Method used to send a response when a message is denied because of a lack of rights.- Overrides:
handleDeniedMessagein classDestination
-
handleAdminNotification
private void handleAdminNotification(AdminNotification adminNot)
Method implementing the reaction to aAdminNotificationnotification notifying of the creation of an administrator proxy.- Parameters:
adminNot- theAdminNotificationnotification.
-
handleAdminReply
private void handleAdminReply(AdminReplyNot not)
Method implementing the reaction to aorg.objectweb.joram.mom.notifications.AdminReplynotification replying to an administration request.A reply is sent back to the connected administrator if needed.
-
handleGetProxyIdNot
private void handleGetProxyIdNot(GetProxyIdNot not)
-
handleGetProxyIdListNot
private void handleGetProxyIdListNot(GetProxyIdListNot not)
-
doProcess
private AdminReply doProcess(GetRightsReplyNot not)
Processes aMonit_GetUsersRepnotification holding a destination's readers' or writers' identifiers.
-
requestGroupNot
protected void requestGroupNot(AgentId from, RequestGroupNot not)
- Overrides:
requestGroupNotin classDestination
-
preProcess
protected ClientMessages preProcess(AgentId from, ClientMessages msgs)
Overrides thisDestinationmethod;- Overrides:
preProcessin classDestination- Parameters:
msgs-ClientMessagesnotifications hold requests sent by an administrator.from- The sender of the message- Returns:
- The incoming messages after processing.
-
clusterJoinAck
protected void clusterJoinAck(ClusterJoinAck ack)
Overrides thisTopicmethod; aClusterAckis not expected by an AdminTopic.- Overrides:
clusterJoinAckin classTopic
-
clusterJoin
protected void clusterJoin(ClusterJoinNot not)
Overrides thisTopicmethod; if this AdminTopic is on server0, new cluster fellow is notified to other fellows and other fellows are notified to it.- Overrides:
clusterJoinin classTopic
-
topicForwardNot
protected void topicForwardNot(AgentId from, TopicForwardNot not)
Overrides thisTopicmethod; the forwarded messages contain admin requests and will be processed.- Overrides:
topicForwardNotin classTopic
-
deleteNot
public void deleteNot(AgentId from, DeleteNot not)
Overrides thisDestinationmethod. Deletion requests are not accepted by AdminTopics.- Overrides:
deleteNotin classDestination
-
doUnknownAgent
protected void doUnknownAgent(UnknownAgent uA)
Specializes thisTopicreaction.- Overrides:
doUnknownAgentin classTopic
-
processAdminRequests
private void processAdminRequests(ClientMessages not)
Method getting the administration requests from messages, and distributing them to the appropriate reactions.
-
processAdminRequests
private void processAdminRequests(AgentId replyTo, String msgId, AdminRequest request, AgentId from)
Method getting the administration requests from messages, and distributing them to the appropriate reactions.
-
doProcess
private void doProcess(StopServerRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aStopServerRequestinstance requesting to stop a given server.- Throws:
UnknownServerException
-
doProcess
private void doProcess(CreateDestinationRequest request, AgentId replyTo, String msgId) throws UnknownServerException, RequestException
Processes aCreateDestinationRequestinstance requesting the creation of a destination.- Throws:
UnknownServerException- If the target server does not exist.RequestException- If the destination deployment fails.
-
createDestination
private AdminTopic.DestinationDesc createDestination(String destName, AgentId adminId, Properties properties, byte type, String className, String requestClassName, StringBuffer strbuf) throws UnknownServerException, RequestException
Instantiating the destination class or retrieving the destination.- Parameters:
destName- destination NameadminId- other admin (null for TopicAdmin)properties- destination propertiestype- destination type ("queue" or "topic")className- creates an instance of the classrequestClassName-strbuf- information- Returns:
- DestinationDesc contain destination description
- Throws:
UnknownServerExceptionRequestException
-
doProcess
private void doProcess(DeleteDestination request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aDeleteDestinationinstance requesting the deletion of a destination.- Throws:
UnknownServerException
-
doProcess
private void doProcess(CreateUserRequest request, AgentId replyTo, String msgId) throws UnknownServerException, RequestException
Processes aCreateUserRequestinstance requesting the creation of aUserAgentfor a given user.- Throws:
UnknownServerException- If the target server does not exist.RequestException- If the user already exists but with a different password, or if the proxy deployment failed.
-
doProcess
private void doProcess(UpdateUser request, AgentId replyTo, String msgId) throws RequestException, UnknownServerException
Processes anUpdateUserinstance requesting to modify the identification of a user.- Throws:
RequestException- If the user does not exist, or if it's new name is already used.UnknownServerException
-
doProcess
private void doProcess(DeleteUser request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aDeleteUserinstance requesting the deletion of a user.- Throws:
UnknownServerException
-
doProcess
private void doProcess(SetDMQRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aSetDMQrequest requesting a given queue to be set as the DMQ of a given destination or user. If the AgentId of the destination is NullId set the default DMQ. If the AgentId of the DMQ is NullId unset the DMQ.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(SetThresholdRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aSetThresholdrequest requesting a given threshold value to be set as the threshold of a given destination or user. If the AgentId of the destination is NullId set the default threshold. If the threshold value is less than 0 reset the threshold.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(GetServersIdsRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aMonitor_GetServersIdsrequest by sending the list of the platform servers' ids.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(GetDomainNames request, AgentId replyTo, String msgId)
-
doProcess
private void doProcess(GetDestinationsRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aMonitor_GetDestinationsrequest by sending registered destinations.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(GetUsersRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aMonitor_GetUsersrequest by sending the users table.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(GetRightsRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aGetRightsRequestrequest by forwarding it to its target destination, if local.- Throws:
UnknownServerException
-
doProcess
private void doProcess(GetDMQSettingsRequest request, AgentId replyTo, String msgId) throws UnknownServerException
Processes aMonitor_GetDMQSettingsrequest either by processing it and sending back the default DMQ settings, or by forwarding it to its target destination or proxy.- Throws:
UnknownServerException- If the target server does not exist.
-
doProcess
private void doProcess(GetStatsRequest request, AgentId replyTo, String msgId)
Processes aMonitor_GetStatrequest or forwards it to its target destination if needed.
-
doProcess
private void doProcess(GetJMXAttsRequest request, AgentId replyTo, String msgId)
Processes aMonitor_GetJMXAttsrequest or forwards it to its target destination if needed.
-
doProcess
private void doProcess(DestinationAdminRequest request, AgentId replyTo, String msgId)
Processes aDestinationRequestrequest by forwarding it to its target destination, if local.
-
doProcess
private void doProcess(AddDomainRequest request, AgentId replyTo, String msgId, AgentId from)
Adds a new domain to the configuration.- Parameters:
request- The request describing the domain to create.replyTo- The destination to reply.msgId- The JMS message id needed to reply.from- TheAgentIdof sender.
-
doProcess
private void doProcess(RemoveDomainRequest request, AgentId replyTo, String msgId, AgentId from)
Removes a domain in the configuration.- Parameters:
request- The request describing the domain to remove.replyTo- The destination to reply.msgId- The JMS message id needed to reply.from- TheAgentIdof sender.
-
doProcess
private void doProcess(AddServerRequest request, AgentId replyTo, String msgId, AgentId from)
Adds a server to the configuration.- Parameters:
request- The request describing the server to create.replyTo- The destination to reply.msgId- The JMS message id needed to reply.from- TheAgentIdof sender.
-
doProcess
private void doProcess(RemoveServerRequest request, AgentId replyTo, String msgId, AgentId from)
Removes a server in the configuration.- Parameters:
request- The request describing the server to remove.replyTo- The destination to reply.msgId- The JMS message id needed to reply.from- TheAgentIdof sender.
-
broadcastRequest
private void broadcastRequest(AdminRequest request, int avoidServerId, AgentId replyTo, String msgId)
Sends the administration request to AdminTopic of all servers except the given one. This method is used to broadcast server/domain creation and deletion.- Parameters:
request- The administration request.avoidServerId- The id. of the server to avoid.replyTo- The destination to reply.msgId- The JMS message id needed to reply.
-
doProcess
private void doProcess(GetConfigRequest request, AgentId replyTo, String msgId)
Gets the current configuration.- Parameters:
request-replyTo-msgId-
-
distributeReply
private void distributeReply(AgentId to, String msgId, AdminReply reply)
Actually sends anAdminReplyobject to an identified destination.- Parameters:
to- Identifier of a destination to send the reply to.msgId- Identifier of the original request.reply- TheAdminReplyinstance to send.
-
createMessageId
private String createMessageId()
-
doProcess
private void doProcess(UserAdminRequest request, AgentId replyTo, String requestMsgId) throws UnknownServerException
Handle administration request about user.- Parameters:
request-replyTo-requestMsgId-- Throws:
UnknownServerException
-
doProcess
private void doProcess(AdminCommandRequest request, AgentId replyTo, String requestMsgId) throws UnknownServerException
Process an admin command.- Parameters:
request- The administration request.replyTo- The destination to reply.requestMsgId- The JMS message id needed to reply.- Throws:
UnknownServerException
-
invokeStaticMethod
private static Object invokeStaticMethod(Properties prop) throws Exception
Invokes a static method on the server using the specified properties. TODO (AF): Should be factorized in an helper class.- Parameters:
prop-- Throws:
Exception
-
checkServerId
private boolean checkServerId(int serverId) throws UnknownServerExceptionReturnstrueif a given server identification corresponds to the local server's.- Parameters:
serverId- Server identifier.- Throws:
UnknownServerException- If the server does not exist.
-
writeObject
private void writeObject(ObjectOutputStream out) throws IOException
Serializes anAdminTopicinstance.- Throws:
IOException
-
readObject
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
Deserializes anAdminTopicinstance.- Throws:
IOExceptionClassNotFoundException
-
createUser
public void createUser(String user, String passwd) throws Exception
Creates a new user on the local server.SimpleIdentityclass is used.- Specified by:
createUserin interfaceAdminTopicMBean- Parameters:
user- the user namepasswd- the user password- Throws:
Exception
-
createUser
public void createUser(String user, String passwd, int serverId) throws Exception
Creates a new user on the selected server.SimpleIdentityclass is used.- Specified by:
createUserin interfaceAdminTopicMBean- Parameters:
user- the user namepasswd- the user passwordserverId- the server where the user will be created- Throws:
Exception
-
createUser
public void createUser(String user, String passwd, int serverId, String identityClassName) throws Exception
Creates a new user on the selected server.- Specified by:
createUserin interfaceAdminTopicMBean- Parameters:
user- the user namepasswd- the user passwordserverId- the server where the user will be createdidentityClassName- the identity class name to instantiate- Throws:
Exception
-
createQueue
public void createQueue(String name)
Creates a new queue on the local server.- Specified by:
createQueuein interfaceAdminTopicMBean- Parameters:
name- the queue name
-
createQueue
public void createQueue(String name, int serverId)
Creates a new queue on the selected server. The queue will be an instance ofQueue.- Specified by:
createQueuein interfaceAdminTopicMBean- Parameters:
name- the topic nameserverId- the server where the queue will be deployed
-
createQueue
public void createQueue(String name, String queueClassName, int serverId)
Creates a new queue on the selected server.- Specified by:
createQueuein interfaceAdminTopicMBean- Parameters:
name- the topic namequeueClassName- the queue class to instantiateserverId- the server where the queue will be deployed
-
createTopic
public void createTopic(String name)
Creates a new topic on the local server.- Specified by:
createTopicin interfaceAdminTopicMBean- Parameters:
name- the topic name
-
createTopic
public void createTopic(String name, int serverId)
Creates a new topic on the selected server. The topic will be an instance ofTopic.- Specified by:
createTopicin interfaceAdminTopicMBean- Parameters:
name- the topic nameserverId- the server where the topic will be deployed
-
createTopic
public void createTopic(String name, String topicClassName, int serverId)
Creates a new topic on the selected server.- Specified by:
createTopicin interfaceAdminTopicMBean- Parameters:
name- the topic nametopicClassName- the topic class to instantiateserverId- the server where the topic will be deployed
-
deleteUser
public static void deleteUser(String userName)
-
lookupDest
public static AdminTopic.DestinationDesc lookupDest(String name, byte type) throws RequestException
Retrieves an existing destination.- Parameters:
name- The name of the destination.type- The type of the destination.- Returns:
- the descriptor of the destination, null if it does not exist.
- Throws:
RequestException- If the existing destination have a different type.
-
lookupUser
public static AgentId lookupUser(String name)
Retrieves an existing user- Parameters:
name- The name of the user
-
registerDest
public static void registerDest(AgentId id, String name, byte type)
Registers a newly created destination.- Parameters:
id- The unique identifier of the created destination.name- The name of the created destination.type- The type of the created destination.
-
unregisterDest
public static void unregisterDest(String name)
Removes a registered destination.- Parameters:
name- The name of the destination to remove.
-
CreateUserAndSave
public static void CreateUserAndSave(CreateUserRequest request, AgentId replyTo, String msgId) throws UnknownServerException, RequestException, IOException
Deprecated.Processes aCreateUserRequestinstance requesting the creation of aUserAgentfor a given user and save Agent AdminTopic. (used by ScalAgent mediation)- Throws:
UnknownServerException- If the target server does not exist.RequestException- If the user already exists but with a different password, or if the proxy deployment failed.IOException- transaction exception
-
createDestinationAndSave
public static AdminTopic.DestinationDesc createDestinationAndSave(String destName, AgentId adminId, Properties properties, byte type, String className, String requestClassName, StringBuffer strbuf) throws UnknownServerException, RequestException, IOException
Deprecated.Instantiating the destination class or retrieving the destination and save Agent AdminTopic. (used by ScalAgent mediation)- Parameters:
destName- destination NameadminId- other admin (null for TopicAdmin)properties- destination propertiestype- destination type ("queue" or "topic")className- creates an instance of the classrequestClassName-strbuf- information- Returns:
- DestinationDesc contain destination description
- Throws:
UnknownServerExceptionRequestExceptionIOException- transaction exception.
-
setRightAndSave
public static void setRightAndSave(SetRight request, AgentId replyTo, String msgId) throws UnknownServerException, IOException
Deprecated.Processes aSetRightinstance requesting to grant a user a given right on a given destination. And save Agent TopicAdmin. (used by ScalAgent mediation)- Parameters:
request-replyTo-msgId-- Throws:
UnknownServerExceptionIOException
-
isDestinationTableContain
public static boolean isDestinationTableContain(String destName)
Deprecated.is destinationTable contain destName ? (used by ScalAgent mediation)- Parameters:
destName- destination name.- Returns:
- true if contain.
-
reverseLookupDest
public static AdminTopic.DestinationDesc reverseLookupDest(String agentId, byte type)
Retrieves an existing destination.- Parameters:
agentId- The identifier of the destination.type- The type of the destination.- Returns:
- the descriptor of the destination, null if it does not exist.
-
-