View Javadoc

1   package net.sf.crispy.strategy;
2   
3   import java.util.Map;
4   
5   import net.sf.crispy.InvocationStrategy;
6   import net.sf.crispy.util.Converter;
7   
8   /**
9    * Example:
10   * <br>
11   * the url (namespace = InvocationStrategy.URL) = <i>http://localhost:8080/axis/services</i>
12   * <br>
13   * invoke of the class (InvocationStrategy.CLASS_NAME): <i>test.crispy.example.service.Calculator</i>
14   * <br>
15   * <b>convert result:</b> <i>http://localhost:8080/axis/services/Calculator</i>
16   *   
17   * 
18   * @author Linke
19   *
20   */
21  public class UrlPlusClassNameInvocationStrategy implements InvocationStrategy {
22  
23  	public Object convert(Map pvPropertyMap) {
24  		String lvInvocationString = (String) pvPropertyMap.get(InvocationStrategy.CLASS_NAME);
25  		String lvClassName = Converter.getClassWithoutPackage(lvInvocationString, false);
26  		// if namespace exist, than overwrite class name
27  		String lvConstNameSpace = (String) pvPropertyMap.get(InvocationStrategy.CONST_NAMESPACE);
28  		if (lvConstNameSpace != null) { lvClassName = lvConstNameSpace; }
29  
30  		String lvNameSpace = (String) pvPropertyMap.get(InvocationStrategy.URL);
31  		
32  		return lvNameSpace + "/" + lvClassName;
33  	}
34  
35  }