if (!agent.isStarted() || sender == null) {
out.println(MSG.getMsg(AgentI18NResourceKeys.IDENTIFY_NOT_SENDING));
} else if (args.length <= 1) {
// the user didn't specify a locator URI, by default, we'll send the command to our configured server
out.println(MSG.getMsg(AgentI18NResourceKeys.IDENTIFY_ASK_SERVER_FOR_ID));
CommandResponse response = sender.sendSynch(command);
out.println(response);
// let the server know about the time of the server
if (response instanceof IdentifyCommandResponse && response.isSuccessful()) {
long serverTime = ((IdentifyCommandResponse) response).getIdentification().getTimestamp();
agent.serverClockNotification(serverTime);
}
} else if (args.length > 2) {
out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
} else {
ServerEndpoint serverEndpoint = AgentUtils.getServerEndpoint(agent.getConfiguration(), args[1]);
// use the generic client utility to issue the command
RemoteCommunicator rc = agent.createServerRemoteCommunicator(serverEndpoint.transport,
serverEndpoint.namePort.address, serverEndpoint.namePort.port, serverEndpoint.transportParams);
GenericCommandClient client = new GenericCommandClient(rc);
out.println(MSG.getMsg(AgentI18NResourceKeys.IDENTIFY_ASK_REMOTE_SERVER_FOR_ID, args[1]));
sender.preprocessCommand(command);
CommandResponse response = client.invoke(command);
client.disconnectRemoteCommunicator();
out.println(response);
}