1 /* 2 * Replica is published under the terms 3 * of the Apache Software License. 4 */ 5 package replica.core; 6 7 import java.util.logging.Logger; 8 9 import replica.command.Command; 10 import replica.server.ServerProcess; 11 import replica.session.Session; 12 import replica.session.SessionManager; 13 14 /*** 15 * Base command class for all server commands. 16 * 17 * @author Pedro Costa 18 * @author Helder Silva 19 * @since 20/Jan/2004 20 */ 21 public abstract class ApplicationCommand implements Command { 22 23 static Logger logger = Logger.getLogger(ApplicationCommand.class.getName()); 24 25 SessionManager sessionManager; 26 27 /*** 28 * 29 */ 30 public ApplicationCommand() { 31 super(); 32 } 33 34 public Object execute(Object arg) { 35 return execute((ApplicationMessage)arg); 36 } 37 38 /* (non-Javadoc) 39 * @see replica.command.Command#execute(java.lang.Object) 40 */ 41 protected abstract Object execute(ApplicationMessage arg); 42 43 /*** 44 * @return 45 */ 46 public SessionManager getSessionManager() { 47 return sessionManager; 48 } 49 50 /*** 51 * @param manager 52 */ 53 public void setSessionManager(SessionManager manager) { 54 sessionManager = manager; 55 } 56 57 /*** 58 * @return 59 */ 60 protected static Logger getLogger() { 61 return logger; 62 } 63 64 protected ServerProcess getServerProcess( String sessionId ){ 65 66 Session session = getSessionManager().getSession(sessionId); 67 if( session != null ) 68 return (ServerProcess)session.getObject("SERVER_PROCESS"); 69 70 logger.warning("Server Process found for session with id : [" + sessionId + "]."); 71 return null; 72 } 73 74 }

This page was automatically generated by Maven