View Javadoc

1   /*
2    * Created on 29.04.2005 from Linke
3    *
4    */
5   package net.sf.crispy;
6   
7   import java.lang.reflect.Method;
8   import java.util.Properties;
9   
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      
24      private Properties properties = new Properties();
25      private String urlAndPort = null;
26      private Object invocationStrategy = null;
27      
28      
29      public Executor () {    }
30  
31      public void setProperties(Properties pvProperties) { properties = pvProperties; }
32      public Properties getProperties() { return properties; }
33  
34      public void setUrlAndPort(String pvUrlAndPort) { urlAndPort = pvUrlAndPort; }
35      public String getUrlAndPort() { return urlAndPort; }
36      
37      public void setInvocationStrategy (Object pvInvocationStrategy) { invocationStrategy = pvInvocationStrategy; }
38      public Object getInvocationStrategy () { return invocationStrategy; }
39      
40      /**
41       * Strategy for invocation the remote service.
42       * @return <code>InvocationStrategy</code>
43       */
44      public InvocationStrategy getDefaultInvocationStrategy() { return null;}
45      
46      /**
47       * If <code>true</code>, then invoke before execute method <code>Converter.makeSimple()</code> 
48       * and after call <code>Converter.makeComplex</code>.
49       * 
50       * @return Default is <code>false</code>.
51       */
52      public boolean withConverter() { return false; }
53      
54      /**
55       * Get default url and port. If no url and port is in properties.
56       *  
57       * @return Default url and port.
58       */
59      public abstract String getDefaultUrlAndPort();
60      
61      /**
62       * Make the invocation of the services.
63       * 
64       * @param pvProxyClass Service interface. Class of the invoked service.
65       * @param pvProxy 
66       * @param pvMethod Method to call.
67       * @param pvArgs Parameter of the method.
68       * @return Result of the <code>execute</code> method.
69       * @throws Exception
70       */
71      public abstract Object execute(Class pvProxyClass, Object pvProxy, Method pvMethod, Object pvArgs[]) throws Exception;
72  
73  }