juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcunn...@apache.org
Subject svn commit: r1177332 - in /juddi/trunk: juddi-client/ juddi-client/src/main/java/org/apache/juddi/v3/client/transport/ juddi-extras/ juddi-extras/juddi-client-extras/ juddi-extras/juddi-client-extras/src/ juddi-extras/juddi-client-extras/src/main/ judd...
Date Thu, 29 Sep 2011 15:27:42 GMT
Author: tcunning
Date: Thu Sep 29 15:27:42 2011
New Revision: 1177332

URL: http://svn.apache.org/viewvc?rev=1177332&view=rev
Log:
JUDDI-530
Add the SAP Registry JAXWS to juddi-extras, the dependency on cxf in 
juddi-client was causing build failures.

Added:
    juddi/trunk/juddi-extras/
    juddi/trunk/juddi-extras/juddi-client-extras/
    juddi/trunk/juddi-extras/juddi-client-extras/pom.xml
    juddi/trunk/juddi-extras/juddi-client-extras/src/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java
    juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java
Removed:
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java
Modified:
    juddi/trunk/juddi-client/pom.xml

Modified: juddi/trunk/juddi-client/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/pom.xml?rev=1177332&r1=1177331&r2=1177332&view=diff
==============================================================================
--- juddi/trunk/juddi-client/pom.xml (original)
+++ juddi/trunk/juddi-client/pom.xml Thu Sep 29 15:27:42 2011
@@ -51,22 +51,5 @@
     	<artifactId>wsdl4j</artifactId>
     	<version>1.6.2</version>
     </dependency>
-
-    <dependency>
-        <groupId>org.apache.cxf</groupId>
-        <artifactId>cxf-rt-frontend-jaxws</artifactId>
-        <version>${cxf.version}</version>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.cxf</groupId>
-        <artifactId>cxf-rt-transports-http</artifactId>
-        <version>${cxf.version}</version>
-        <exclusions>
-            <exclusion>
-                <groupId>cglib</groupId>
-                <artifactId>cglib</artifactId>
-            </exclusion>
-       </exclusions>
-    </dependency>
   </dependencies> 
 </project>

Added: juddi/trunk/juddi-extras/juddi-client-extras/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-extras/juddi-client-extras/pom.xml?rev=1177332&view=auto
==============================================================================
--- juddi/trunk/juddi-extras/juddi-client-extras/pom.xml (added)
+++ juddi/trunk/juddi-extras/juddi-client-extras/pom.xml Thu Sep 29 15:27:42 2011
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright 2001-2009 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.juddi</groupId>
+    <artifactId>juddi-parent</artifactId>
+    <version>3.1.2-SNAPSHOT</version>
+  </parent> 
+  <artifactId>juddi-client-extras</artifactId>
+  <packaging>bundle</packaging>
+  <name>jUDDI Client side extras</name>
+  <properties>
+    <cxf.version>2.3.6</cxf.version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+	<groupId>org.apache.juddi</groupId>
+        <artifactId>juddi-client</artifactId>
+        <version>${project.parent.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.juddi</groupId>
+        <artifactId>uddi-ws</artifactId>
+        <version>${project.parent.version}</version>
+     </dependency>
+     <dependency>
+        <groupId>commons-configuration</groupId>
+        <artifactId>commons-configuration</artifactId>
+        <version>1.6</version>
+     </dependency>
+      <dependency>
+		<groupId>javax.servlet</groupId>
+		<artifactId>servlet-api</artifactId>
+		<version>2.5</version>
+		<scope>provided</scope>
+	 </dependency>
+	 <dependency>
+    	<groupId>wsdl4j</groupId>
+    	<artifactId>wsdl4j</artifactId>
+    	<version>1.6.2</version>
+    </dependency>
+
+    <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-rt-frontend-jaxws</artifactId>
+        <version>${cxf.version}</version>
+	<scope>compile</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-rt-transports-http</artifactId>
+        <version>${cxf.version}</version>
+        <exclusions>
+            <exclusion>
+                <groupId>cglib</groupId>
+                <artifactId>cglib</artifactId>
+            </exclusion>
+       </exclusions>
+       <scope>compile</scope>
+    </dependency>
+  </dependencies> 
+</project>

Added: juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java?rev=1177332&view=auto
==============================================================================
--- juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java
(added)
+++ juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/SAPRegistryJAXWSTransport.java
Thu Sep 29 15:27:42 2011
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2001-2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.v3.client.transport;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.ws.BindingProvider;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.v3.client.JUDDIApiService;
+import org.apache.juddi.v3.client.UDDIService;
+import org.apache.juddi.v3.client.config.Property;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.v3_service.UDDICustodyTransferPortType;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionListenerPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
+
+/**
+ * Add a special JAXWSTransport for use with the SAP Registry.     Need to add
+ * a CXF interceptor because SAP does not like the default XML declaration.
+ * 
+ * @author Tom Cunningham <tcunning@apache.org>
+ *
+ */
+public class SAPRegistryJAXWSTransport extends JAXWSTransport {
+	
+	public SAPRegistryJAXWSTransport() {
+		super();
+	}
+		
+	public SAPRegistryJAXWSTransport(String nodeName) {
+		super(nodeName);	
+	}
+	
+	public SAPRegistryJAXWSTransport(String managerName, String nodeName) {
+		super(managerName, nodeName);
+	}
+	
+	public UDDIInquiryPortType getUDDIInquiryService(String endpointURL) throws TransportException
{
+
+		if (inquiryService==null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getInquiryUrl();
+				}
+				UDDIService service = new UDDIService();
+				inquiryService = service.getUDDIInquiryPort();
+				Map<String, Object> requestContext = ((BindingProvider) inquiryService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+				
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(inquiryService);
+				cxfClient.getInInterceptors().add(xmldwi);
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return inquiryService;
+	}
+	
+	public UDDISecurityPortType getUDDISecurityService(String endpointURL) throws TransportException
{
+
+		if (securityService==null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getSecurityUrl();
+				}
+				UDDIService service = new UDDIService();
+				securityService = service.getUDDISecurityPort();
+				Map<String, Object> requestContext = ((BindingProvider) securityService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(securityService);
+				cxfClient.getInInterceptors().add(xmldwi);
+
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return securityService;
+	}
+	
+	public UDDIPublicationPortType getUDDIPublishService(String endpointURL) throws TransportException
{
+
+		if (publishService==null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getPublishUrl();
+				}
+				UDDIService service = new UDDIService();
+				publishService = service.getUDDIPublicationPort();
+				Map<String, Object> requestContext = ((BindingProvider) publishService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(publishService);
+				cxfClient.getInInterceptors().add(xmldwi);
+
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return publishService;
+	}
+	
+	public UDDISubscriptionPortType getUDDISubscriptionService(String endpointURL) throws TransportException
{
+
+		if (subscriptionService==null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getSubscriptionUrl();
+				}
+				UDDIService service = new UDDIService();
+				subscriptionService = service.getUDDISubscriptionPort();
+				Map<String, Object> requestContext = ((BindingProvider) subscriptionService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(subscriptionService);
+				cxfClient.getInInterceptors().add(xmldwi);
+
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return subscriptionService;
+	}
+	
+	public UDDISubscriptionListenerPortType getUDDISubscriptionListenerService(String endpointURL)
throws TransportException {
+		if (subscriptionListenerService == null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getSubscriptionListenerUrl();
+				}
+				UDDIService service = new UDDIService();
+				subscriptionListenerService = service.getUDDISubscriptionListenerPort();
+				Map<String, Object> requestContext = ((BindingProvider) subscriptionListenerService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(subscriptionListenerService);
+				cxfClient.getInInterceptors().add(xmldwi);
+
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return subscriptionListenerService;
+	}
+	
+	public UDDICustodyTransferPortType getUDDICustodyTransferService(String endpointURL) throws
TransportException {
+		if (custodyTransferService == null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getCustodyTransferUrl();
+				}
+				UDDIService service = new UDDIService();
+				custodyTransferService = service.getUDDICustodyPort();
+				Map<String, Object> requestContext = ((BindingProvider) custodyTransferService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+
+				XMLDeclarationWritingInterceptor xmldwi = new XMLDeclarationWritingInterceptor();			

+				Client cxfClient = ClientProxy.getClient(custodyTransferService);
+				cxfClient.getInInterceptors().add(xmldwi);
+
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return custodyTransferService;
+	}
+	
+	/**
+	 * This is a jUDDI specific API
+	 */
+	public JUDDIApiPortType getJUDDIApiService(String endpointURL) throws TransportException
{
+		if (publisherService == null) {
+			try {
+				if (endpointURL==null)  {
+					UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+					endpointURL = manager.getClientConfig().getUDDINode(nodeName).getJuddiApiUrl();
+				}
+				JUDDIApiService service = new JUDDIApiService();
+				publisherService = (JUDDIApiPortType) service.getPort(JUDDIApiPortType.class);
+				Map<String, Object> requestContext = ((BindingProvider) publisherService).getRequestContext();
+				requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
+				setCredentials(requestContext);
+			} catch (Exception e) {
+				throw new TransportException(e.getMessage(), e);
+			}
+		}
+		return publisherService;
+	}
+
+	public String getNodeName() {
+		return nodeName;
+	}
+
+	public void setNodeName(String nodeName) {
+		this.nodeName = nodeName;
+	}
+	
+	/**
+	 * Sets the credentials on the RequestContext if the services are protected
+	 * by Basic Authentication. The username and password are obtained from the 
+	 * uddi.xml.
+	 * 
+	 * @param requestContext
+	 * @throws ConfigurationException
+	 */
+	private void setCredentials(Map<String, Object> requestContext) throws ConfigurationException
{
+		UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
+		Properties properties = manager.getClientConfig().getUDDINode(nodeName).getProperties();
+		String username = null;
+		String password = null;
+		if (properties.containsKey(Property.BASIC_AUTH_USERNAME)) {
+			username = properties.getProperty(Property.BASIC_AUTH_USERNAME);
+		}
+		if (properties.containsKey(Property.BASIC_AUTH_PASSWORD)) {
+			password = properties.getProperty(Property.BASIC_AUTH_PASSWORD);
+		}
+		if (username!=null && password!=null) {
+			requestContext.put(BindingProvider.USERNAME_PROPERTY, username);
+			requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
+		}
+	}
+
+}

Added: juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java?rev=1177332&view=auto
==============================================================================
--- juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java
(added)
+++ juddi/trunk/juddi-extras/juddi-client-extras/src/main/java/org/apache/juddi/v3/client/transport/XMLDeclarationWritingInterceptor.java
Thu Sep 29 15:27:42 2011
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2001-2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.v3.client.transport;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import java.io.OutputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+
+/**
+ * Add a CXF interceptor to add the XML declaration.
+ * 
+ * * @author Tom Cunningham <tcunning@apache.org>
+ *
+ */
+public class XMLDeclarationWritingInterceptor extends AbstractPhaseInterceptor<SoapMessage>
{
+	
+    public XMLDeclarationWritingInterceptor () { 
+        super(Phase.PRE_STREAM); 
+        addBefore(StaxOutInterceptor.class.getName());
+    } 
+
+    @Override 
+    public void handleMessage(SoapMessage message) throws Fault { 
+    	message.put("org.apache.cxf.stax.force-start-document", Boolean.TRUE);      
+    } 
+} 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message