You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2004/05/25 21:41:44 UTC
cvs commit: ws-axis/java/test/wsdd PackageTests.java TestGlobalConfiguration.java
gdaniels 2004/05/25 12:41:44
Modified: java/src/org/apache/axis AxisEngine.java
EngineConfiguration.java
java/src/org/apache/axis/configuration FileProvider.java
NullProvider.java SimpleProvider.java
java/src/org/apache/axis/deployment/wsdd WSDDConstants.java
WSDDDeployment.java WSDDGlobalConfiguration.java
WSDDService.java
java/src/org/apache/axis/handlers/soap SOAPService.java
java/test/wsdd PackageTests.java
TestGlobalConfiguration.java
Log:
Improve role support, and add ability to set engine and service roles
via <role> in WSDD.
Revision Changes Path
1.111 +5 -4 ws-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- AxisEngine.java 25 Feb 2004 14:02:28 -0000 1.110
+++ AxisEngine.java 25 May 2004 19:41:43 -0000 1.111
@@ -349,9 +349,6 @@
return config.getGlobalResponse();
}
- // fixme: this exposes the /actual/ actorsURIs array - do we intend this?
- // if so, then we need to document this so that people don't change this
- // by accident but have the chance to change a copy
// fixme: publishing this as ArrayList prevents us moving to another
// List impl later
/**
@@ -362,7 +359,7 @@
*/
public ArrayList getActorURIs()
{
- return actorURIs;
+ return (ArrayList)actorURIs.clone();
}
/**
@@ -469,6 +466,10 @@
setOptions(globalOptions);
normaliseOptions(this);
+
+ // fixme: If we change actorURIs to List, this copy constructor can
+ // go away...
+ actorURIs = new ArrayList(config.getRoles());
}
/**
1.15 +9 -0 ws-axis/java/src/org/apache/axis/EngineConfiguration.java
Index: EngineConfiguration.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/EngineConfiguration.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- EngineConfiguration.java 25 Feb 2004 14:02:28 -0000 1.14
+++ EngineConfiguration.java 25 May 2004 19:41:43 -0000 1.15
@@ -22,6 +22,7 @@
import javax.xml.namespace.QName;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* EngineConfiguration is an interface that the Message Flow subsystem
@@ -158,4 +159,12 @@
* returned
*/
Iterator getDeployedServices() throws ConfigurationException;
+
+ /**
+ * Get a list of roles that this engine plays globally. Services
+ * within the engine configuration may also add additional roles.
+ *
+ * @return a <code>List</code> of the roles for this engine
+ */
+ List getRoles();
}
1.51 +11 -0 ws-axis/java/src/org/apache/axis/configuration/FileProvider.java
Index: FileProvider.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- FileProvider.java 25 Feb 2004 14:02:33 -0000 1.50
+++ FileProvider.java 25 May 2004 19:41:43 -0000 1.51
@@ -23,6 +23,7 @@
import java.io.PrintWriter;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import javax.xml.namespace.QName;
@@ -284,5 +285,15 @@
*/
public Iterator getDeployedServices() throws ConfigurationException {
return deployment.getDeployedServices();
+ }
+
+ /**
+ * Get a list of roles that this engine plays globally. Services
+ * within the engine configuration may also add additional roles.
+ *
+ * @return a <code>List</code> of the roles for this engine
+ */
+ public List getRoles() {
+ return deployment.getRoles();
}
}
1.11 +11 -0 ws-axis/java/src/org/apache/axis/configuration/NullProvider.java
Index: NullProvider.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/configuration/NullProvider.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NullProvider.java 25 Feb 2004 14:02:33 -0000 1.10
+++ NullProvider.java 25 May 2004 19:41:43 -0000 1.11
@@ -27,6 +27,7 @@
import javax.xml.namespace.QName;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* A do-nothing ConfigurationProvider
@@ -84,6 +85,16 @@
* Get an enumeration of the services deployed to this engine
*/
public Iterator getDeployedServices() throws ConfigurationException {
+ return null;
+ }
+
+ /**
+ * Get a list of roles that this engine plays globally. Services
+ * within the engine configuration may also add additional roles.
+ *
+ * @return a <code>List</code> of the roles for this engine
+ */
+ public List getRoles() {
return null;
}
}
1.14 +42 -0 ws-axis/java/src/org/apache/axis/configuration/SimpleProvider.java
Index: SimpleProvider.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/configuration/SimpleProvider.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SimpleProvider.java 25 Feb 2004 14:02:33 -0000 1.13
+++ SimpleProvider.java 25 May 2004 19:41:43 -0000 1.14
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* A SimpleProvider is an EngineConfiguration which contains a simple
@@ -57,6 +58,7 @@
Hashtable globalOptions = null;
Handler globalRequest = null;
Handler globalResponse = null;
+ List roles = new ArrayList();
/** Our TypeMappingRegistry */
TypeMappingRegistry tmr = null;
@@ -259,5 +261,45 @@
serviceDescs.add(service.getServiceDescription());
}
return serviceDescs.iterator();
+ }
+
+ /**
+ * Set the global role list for this configuration. Note that we use
+ * the actual passed value, so if anyone else changes that collection,
+ * our role list will change. Be careful to pass this a cloned list if
+ * you want to change the list later without affecting the config.
+ *
+ * @param roles
+ */
+ public void setRoles(List roles) {
+ this.roles = roles;
+ }
+
+ /**
+ * Add a role to the configuration's global list
+ *
+ * @param role
+ */
+ public void addRole(String role) {
+ roles.add(role);
+ }
+
+ /**
+ * Remove a role from the configuration's global list
+ *
+ * @param role
+ */
+ public void removeRole(String role) {
+ roles.remove(role);
+ }
+
+ /**
+ * Get a list of roles that this engine plays globally. Services
+ * within the engine configuration may also add additional roles.
+ *
+ * @return a <code>List</code> of the roles for this engine
+ */
+ public List getRoles() {
+ return roles;
}
}
1.34 +1 -0 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java
Index: WSDDConstants.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- WSDDConstants.java 1 Apr 2004 20:47:51 -0000 1.33
+++ WSDDConstants.java 25 May 2004 19:41:44 -0000 1.34
@@ -102,6 +102,7 @@
public static final String ELEM_WSDD_JAXRPC_ROLE = "role";
public static final String ELEM_WSDD_JAXRPC_HEADER = "header";
public static final String ELEM_WSDD_FAULT = "fault";
+ public static final String ELEM_WSDD_ROLE = "role";
public static final QName QNAME_PARAM = new QName(URI_WSDD, ELEM_WSDD_PARAM);
public static final QName QNAME_DOC = new QName(URI_WSDD, ELEM_WSDD_DOC);
1.58 +5 -0 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
Index: WSDDDeployment.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- WSDDDeployment.java 11 May 2004 01:25:14 -0000 1.57
+++ WSDDDeployment.java 25 May 2004 19:41:44 -0000 1.58
@@ -40,6 +40,7 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
@@ -507,6 +508,10 @@
public Hashtable getGlobalOptions() throws ConfigurationException {
return globalConfig.getParametersTable();
+ }
+
+ public List getRoles() {
+ return globalConfig == null ? new ArrayList() : globalConfig.getRoles();
}
/**
1.32 +16 -0 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDGlobalConfiguration.java
Index: WSDDGlobalConfiguration.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDGlobalConfiguration.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- WSDDGlobalConfiguration.java 25 Feb 2004 14:02:34 -0000 1.31
+++ WSDDGlobalConfiguration.java 25 May 2004 19:41:44 -0000 1.32
@@ -20,10 +20,13 @@
import org.apache.axis.Handler;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.utils.Messages;
+import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
/**
@@ -36,6 +39,7 @@
{
private WSDDRequestFlow requestFlow;
private WSDDResponseFlow responseFlow;
+ private ArrayList roles = new ArrayList();
/**
* Default constructor
@@ -61,6 +65,12 @@
if (respEl != null && respEl.getElementsByTagName("*").getLength()>0) {
responseFlow = new WSDDResponseFlow(respEl);
}
+
+ Element [] roleElements = getChildElements(e, ELEM_WSDD_ROLE);
+ for (int i = 0; i < roleElements.length; i++) {
+ String role = XMLUtils.getChildCharacterData(roleElements[i]);
+ roles.add(role);
+ }
}
protected QName getElementName()
@@ -145,6 +155,8 @@
throw new WSDDException(Messages.getMessage("noTypeOnGlobalConfig00"));
}
+
+
/**
*
* @param registry XXX
@@ -175,6 +187,10 @@
requestFlow.deployToRegistry(registry);
if (responseFlow != null)
responseFlow.deployToRegistry(registry);
+ }
+
+ public List getRoles() {
+ return (List)roles.clone();
}
}
1.107 +12 -0 ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- WSDDService.java 20 Apr 2004 12:07:31 -0000 1.106
+++ WSDDService.java 25 May 2004 19:41:44 -0000 1.107
@@ -50,6 +50,7 @@
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Vector;
+import java.util.List;
/**
* A service represented in WSDD.
@@ -69,6 +70,9 @@
/** Which namespaces should auto-dispatch to this service? */
private Vector namespaces = new Vector();
+ /** Which roles does this service support? */
+ private List roles = new ArrayList();
+
private String descriptionURL;
/** Style - document, wrapped, message, or RPC (the default) */
@@ -178,6 +182,12 @@
if (!namespaces.isEmpty())
desc.setNamespaceMappings(namespaces);
+ Element [] roleElements = getChildElements(e, ELEM_WSDD_ROLE);
+ for (int i = 0; i < roleElements.length; i++) {
+ String role = XMLUtils.getChildCharacterData(roleElements[i]);
+ roles.add(role);
+ }
+
Element wsdlElem = getChildElement(e, ELEM_WSDD_WSDLFILE);
if (wsdlElem != null) {
String fileName = XMLUtils.getChildCharacterData(wsdlElem);
@@ -439,6 +449,8 @@
if ( getQName() != null )
service.setName(getQName().getLocalPart());
service.setOptions(getParametersTable());
+
+ service.setRoles(roles);
service.setEngine(((WSDDDeployment)registry).getEngine());
1.116 +13 -1 ws-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
Index: SOAPService.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- SOAPService.java 3 May 2004 20:04:09 -0000 1.115
+++ SOAPService.java 25 May 2004 19:41:44 -0000 1.116
@@ -59,6 +59,7 @@
import java.util.Vector;
import java.util.Map;
import java.util.HashMap;
+import java.util.List;
/** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
* invocation. It has an request chain, an response chain, and a pivot-point,
@@ -167,7 +168,18 @@
return acts;
}
-
+ public List getRoles() {
+ return getActors();
+ }
+
+ /**
+ * Set the service-specific role list
+ *
+ * @param roles a List of Strings, each containing a role URI
+ */
+ public void setRoles(List roles) {
+ actors = new ArrayList(roles);
+ }
/**
* MustUnderstandChecker is used to inject SOAP semantics just before
1.13 +1 -0 ws-axis/java/test/wsdd/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdd/PackageTests.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PackageTests.java 27 Oct 2003 19:56:19 -0000 1.12
+++ PackageTests.java 25 May 2004 19:41:44 -0000 1.13
@@ -25,6 +25,7 @@
suite.addTestSuite(TestBadWSDD.class);
suite.addTestSuite(TestAdminService.class);
suite.addTestSuite(TestJAXRPCHandlerInfoChain.class);
+ suite.addTestSuite(TestRoles.class);
//suite.addTestSuite(TestXSD.class);
return suite;
1.3 +16 -4 ws-axis/java/test/wsdd/TestGlobalConfiguration.java
Index: TestGlobalConfiguration.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/wsdd/TestGlobalConfiguration.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestGlobalConfiguration.java 11 Dec 2002 22:40:19 -0000 1.2
+++ TestGlobalConfiguration.java 25 May 2004 19:41:44 -0000 1.3
@@ -6,16 +6,22 @@
import org.apache.axis.configuration.XMLStringProvider;
import org.apache.axis.server.AxisServer;
+import java.util.List;
+
public class TestGlobalConfiguration extends TestCase
{
static final String PARAM_NAME = "testParam";
static final String PARAM_VAL = "testValue";
-
- String doc =
+ static final String ROLE = "http://test-role1";
+ static final String ROLE2 = "http://test-role2";
+
+ String doc =
"<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\">\n" +
" <globalConfiguration>\n" +
" <parameter name=\"" + PARAM_NAME +
"\" value=\"" + PARAM_VAL + "\"/>\n" +
+ " <role>" + ROLE + "</role>\n" +
+ " <role>" + ROLE2 + "</role>\n" +
" </globalConfiguration>\n" +
"</deployment>";
@@ -34,13 +40,19 @@
{
XMLStringProvider provider = new XMLStringProvider(doc);
AxisServer server = new AxisServer(provider);
-
+
Object optVal = server.getOption(PARAM_NAME);
assertNotNull("Option value was null!", optVal);
assertEquals("Option was not expected value", optVal, PARAM_VAL);
-
+
optVal = server.getOption("someOptionWhichIsntSet");
assertNull("Got value for bad option!", optVal);
+
+ List roles = server.getActorURIs();
+ assertTrue("Engine roles did not contain " + ROLE,
+ roles.contains(ROLE));
+ assertTrue("Engine roles did not contain " + ROLE2,
+ roles.contains(ROLE2));
}
public static void main(String[] args) throws Exception {