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 da...@apache.org on 2008/03/17 14:52:50 UTC
svn commit: r637889 - in /webservices/axis2/trunk/java/modules/metadata:
src/org/apache/axis2/jaxws/description/impl/
test/org/apache/axis2/jaxws/description/impl/
Author: damrhei
Date: Mon Mar 17 06:52:44 2008
New Revision: 637889
URL: http://svn.apache.org/viewvc?rev=637889&view=rev
Log:
Changes here include updating the URIResolverImpl to deal with unknown protocols and updating the DescriptionFactoryImpl to transfer properties from client-side DBCs to client-side EndpointDescription objects.
Modified:
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?rev=637889&r1=637888&r2=637889&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Mon Mar 17 06:52:44 2008
@@ -331,6 +331,9 @@
if (log.isDebugEnabled()) {
log.debug("EndpointDescription updated: " + endpointDesc);
}
+
+ setPropertiesOnEndpointDesc(endpointDesc, composite);
+
return endpointDesc;
}
@@ -435,6 +438,29 @@
return true;
}
return false;
+ }
+
+ /**
+ * This method will set any properties supplied on the DescriptionBuilderComposite instance
+ * on the EndpointDescription. If the DBC is null or there are no properties present, this
+ * method will have no effect.
+ */
+ static void setPropertiesOnEndpointDesc(EndpointDescription endpointDesc, DescriptionBuilderComposite
+ composite) {
+ if(composite != null
+ &&
+ composite.getProperties() != null
+ &&
+ !composite.getProperties().isEmpty()) {
+ for(String key : composite.getProperties().keySet()) {
+ Object value = composite.getProperties().get(key);
+ if(log.isDebugEnabled()) {
+ log.debug("Setting property from DBC onto EndpointDescription, key= " +
+ key + ", value= " + value);
+ }
+ endpointDesc.setProperty(key, value);
+ }
+ }
}
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java?rev=637889&r1=637888&r2=637889&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/URIResolverImpl.java Mon Mar 17 06:52:44 2008
@@ -287,7 +287,14 @@
else{
if(log.isDebugEnabled()){
if(baseURL !=null){
+
+ // even though this is unknown, since there is a protocol, let's
+ // try to build the URL
log.debug("unknown protocol in url "+ baseURL.getProtocol());
+ if(log.isDebugEnabled()){
+ log.debug("Constructing path with unknown protocol");
+ }
+ url = new URL(baseURL.getProtocol(), baseURL.getHost(), resolvedURI.toString());
}else{
log.debug("baseURL is NULL");
}
Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java?rev=637889&r1=637888&r2=637889&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java Mon Mar 17 06:52:44 2008
@@ -30,6 +30,8 @@
import org.apache.axis2.jaxws.description.builder.CustomAnnotationProcessor;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter;
+import org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl;
+import org.apache.axis2.jaxws.description.validator.EndpointDescriptionValidator;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
@@ -201,6 +203,41 @@
EndpointDescription ed = edColl.iterator().next();
assertNotNull(ed);
assertNotNull(ed.getHandlerChain());
+ }
+
+ /**
+ * This will verify that properties are correctly copied from a DBC to an
+ * EndpointDescription instance by a helper method in DescriptionFactoryImpl.
+ */
+ public void testSetPropertiesOnEndpointDesc() {
+
+ // first get an EndpointDescription instance
+ JavaClassToDBCConverter converter = new JavaClassToDBCConverter(AnnotatedService.class);
+ HashMap<String, DescriptionBuilderComposite> dbcMap = converter.produceDBC();
+ DescriptionBuilderComposite dbc = dbcMap.get(AnnotatedService.class.getName());
+ assertNotNull(dbc);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put("testKey", "testValue");
+ dbc.setProperties(properties);
+ List<ServiceDescription> sdList = DescriptionFactoryImpl.createServiceDescriptionFromDBCMap(dbcMap, null);
+ assertNotNull(sdList);
+ assertEquals(sdList.size(), 1);
+ ServiceDescription sd = sdList.get(0);
+ assertNotNull(sd);
+ assertNotNull(dbc.getWebServiceAnnot());
+ String pn = dbc.getWebServiceAnnot().portName();
+ String tns = dbc.getWebServiceAnnot().targetNamespace();
+ assertNotNull(pn);
+ assertNotNull(tns);
+ QName portQName = new QName(tns, pn);
+ EndpointDescription ed = sd.getEndpointDescription(portQName);
+ assertNotNull(ed);
+
+ // now test the setPropertiesOnEndpointDesc method
+ DescriptionFactoryImpl.setPropertiesOnEndpointDesc(ed, dbc);
+ assertNotNull(ed.getProperty("testKey"));
+ assertEquals(ed.getProperty("testKey"), "testValue");
+
}
private InputStream getXMLFileStream() {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org