|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ApplicationCommand.java | 0% | 20% | 33,3% | 22,2% |
|
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 | 19 |
public ApplicationCommand() {
|
31 | 19 |
super();
|
32 |
} |
|
33 |
|
|
34 | 0 |
public Object execute(Object arg) {
|
35 | 0 |
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 | 0 |
public SessionManager getSessionManager() {
|
47 | 0 |
return sessionManager;
|
48 |
} |
|
49 |
|
|
50 |
/**
|
|
51 |
* @param manager
|
|
52 |
*/
|
|
53 | 16 |
public void setSessionManager(SessionManager manager) { |
54 | 16 |
sessionManager = manager; |
55 |
} |
|
56 |
|
|
57 |
/**
|
|
58 |
* @return
|
|
59 |
*/
|
|
60 | 0 |
protected static Logger getLogger() { |
61 | 0 |
return logger;
|
62 |
} |
|
63 |
|
|
64 | 0 |
protected ServerProcess getServerProcess( String sessionId ){
|
65 |
|
|
66 | 0 |
Session session = getSessionManager().getSession(sessionId); |
67 | 0 |
if( session != null ) |
68 | 0 |
return (ServerProcess)session.getObject("SERVER_PROCESS"); |
69 |
|
|
70 | 0 |
logger.warning("Server Process found for session with id : [" + sessionId + "]."); |
71 | 0 |
return null; |
72 |
} |
|
73 |
|
|
74 |
} |
|
75 |
|
|