01: /*
02: * Created on 29.04.2005 from Linke
03: *
04: */
05: package net.sf.crispy;
06:
07: import java.lang.reflect.Method;
08: import java.util.Properties;
09:
10: import org.apache.commons.logging.Log;
11: import org.apache.commons.logging.LogFactory;
12:
13: /**
14: * Send the method to the server and wait of return-value.
15: *
16: * @author Linke
17: *
18: */
19: public abstract class Executor {
20:
21: protected static final Log log = LogFactory.getLog(Executor.class);
22:
23: private Properties properties = new Properties();
24: private String urlAndPort = null;
25: private Object invocationStrategy = null;
26:
27: public Executor() {
28: }
29:
30: public void setProperties(Properties pvProperties) {
31: properties = pvProperties;
32: }
33:
34: public Properties getProperties() {
35: return properties;
36: }
37:
38: public void setUrlAndPort(String pvUrlAndPort) {
39: urlAndPort = pvUrlAndPort;
40: }
41:
42: public String getUrlAndPort() {
43: return urlAndPort;
44: }
45:
46: public void setInvocationStrategy(Object pvInvocationStrategy) {
47: invocationStrategy = pvInvocationStrategy;
48: }
49:
50: public Object getInvocationStrategy() {
51: return invocationStrategy;
52: }
53:
54: /**
55: * Strategy for invocation the remote service.
56: * @return <code>InvocationStrategy</code>
57: */
58: public InvocationStrategy getDefaultInvocationStrategy() {
59: return null;
60: }
61:
62: /**
63: * If <code>true</code>, then invoke before execute method <code>Converter.makeSimple()</code>
64: * and after call <code>Converter.makeComplex</code>.
65: *
66: * @return Default is <code>false</code>.
67: */
68: public boolean withConverter() {
69: return false;
70: }
71:
72: /**
73: * Get default url and port. If no url and port is in properties.
74: *
75: * @return Default url and port.
76: */
77: public abstract String getDefaultUrlAndPort();
78:
79: /**
80: * Make the invocation of the services.
81: *
82: * @param pvProxyClass Service interface. Class of the invoked service.
83: * @param pvProxy
84: * @param pvMethod Method to call.
85: * @param pvArgs Parameter of the method.
86: * @return Result of the <code>execute</code> method.
87: * @throws Exception
88: */
89: public abstract Object execute(Class pvProxyClass, Object pvProxy,
90: Method pvMethod, Object pvArgs[]) throws Exception;
91:
92: }
|