View Javadoc

1   /*
2    * Created on 06.05.2005 from Linke
3    *
4    */
5   package net.sf.crispy.proxy;
6   
7   import java.util.Properties;
8   
9   import net.sf.crispy.InvocationStrategy;
10  import net.sf.crispy.Property;
11  import net.sf.crispy.util.Util;
12  
13  
14  /**
15   * Parent-Proxy for all classes that have your own stubs. 
16   * 
17   * @author Linke
18   *
19   */
20  public abstract class StaticProxy extends Proxy {
21  
22  	public static final String PROPERTY_CURRENT_INTERFACE_CLASS = "crispy.temp.property.current.interface.class";
23  	
24  	
25      private Object invocationStrategy = null;
26  
27      public StaticProxy () {}
28      public StaticProxy (Properties pvProperties) { setProperties(pvProperties); }
29  	
30      public String getUrlAndPort() {
31      	String lvUrlAndPort = getProperties().getProperty(Property.REMOTE_URL_AND_PORT, getDefaultUrlAndPort());
32      	return Util.cutString(lvUrlAndPort, "/");
33      }
34      
35      /**
36       * Get default url and port, if no url and port is in properties.
37       *  
38       * @return Default url and port.
39       */
40      public abstract String getDefaultUrlAndPort();
41  
42      /**
43       * Get default <code>InvocationStrategy</code>, if no <code>InvocationStrategy</code> is set in the properties.
44       *  
45       * @return Default <code>InvocationStrategy</code> or <code>null</code>.
46       */
47      public InvocationStrategy getDefaultInvocationStrategy(Properties pvProperties){
48      	return null;
49      }
50      
51      public void setInvocationStrategy (Object pvInvocationStrategy) { invocationStrategy = pvInvocationStrategy; }
52      public Object getInvocationStrategy () { return invocationStrategy; }
53          
54  }