Author: kurtstam
Date: 2011-06-09 13:28:59 -0400 (Thu, 09 Jun 2011)
New Revision: 1379
Modified:
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
Log:
RIFTSAW-358 - using async registration so we can use JAXWSTransport for UDDI
registration.
Modified:
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java
===================================================================
---
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java 2011-06-09
08:31:13 UTC (rev 1378)
+++
trunk/runtime/uddi/src/main/java/org/jboss/soa/bpel/uddi/UDDIRegistrationImpl.java 2011-06-09
17:28:59 UTC (rev 1379)
@@ -36,13 +36,14 @@
import org.apache.juddi.v3.client.config.UDDIClerk;
import org.apache.juddi.v3.client.config.UDDIClerkManager;
import org.apache.juddi.v3.client.mapping.BPEL2UDDI;
-import org.apache.juddi.v3.client.mapping.ServiceLocator;
+import org.apache.juddi.v3.client.mapping.AsyncRegistration;
+import org.apache.juddi.v3.client.mapping.RegistrationInfo;
+import org.apache.juddi.v3.client.mapping.RegistrationType;
import org.apache.juddi.v3.client.mapping.URLLocalizer;
import org.apache.juddi.v3.client.transport.TransportException;
import org.jboss.soa.bpel.runtime.JBossDSPFactory;
import org.jboss.soa.bpel.runtime.engine.ode.UDDIRegistration;
import org.jboss.soa.dsp.ws.WSDLReference;
-import org.uddi.api_v3.BindingTemplate;
/**
*
@@ -58,9 +59,9 @@
UDDIClerk bpelClerk = null;
boolean selfRegister = false;
- BPEL2UDDI bpel2UDDI = null;
- ServiceLocator serviceLocator = null;
+ URLLocalizer urlLocalizer = null;
Properties properties = null;
+ AsyncRegistration registration = null;
public UDDIRegistrationImpl(Properties properties) {
super();
@@ -69,7 +70,7 @@
String bpelUDDIConfig = properties.getProperty(BPEL_UDDI_CONFIG);
if (bpelUDDIConfig!=null) {
try {
- UDDIClerkManager clerkManager = new UDDIClerkManager(bpelUDDIConfig);
+ UDDIClerkManager clerkManager = new UDDIClerkManager(bpelUDDIConfig, properties);
clerkManager.start();
selfRegister = clerkManager.getClientConfig().isRegisterOnStartup();
Map<String,UDDIClerk> clerks =
clerkManager.getClientConfig().getUDDIClerks();
@@ -81,9 +82,7 @@
throw new ConfigurationException("Could not find UDDI Clerk named "+
bpelClerk.getName());
}
this.properties = properties;
- URLLocalizer urlLocalizer = new JBossURLLocalizer(properties);
- bpel2UDDI = new BPEL2UDDI(bpelClerk, urlLocalizer, properties);
- serviceLocator = new ServiceLocator(bpelClerk, urlLocalizer, properties);
+ urlLocalizer = new JBossURLLocalizer(properties);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
@@ -99,7 +98,7 @@
* @throws RemoteException
*/
public void shutdown() throws Exception {
- serviceLocator.shutdown();
+ registration.getServiceLocator(bpelClerk.getName()).shutdown();
}
/**
* Registers a BPEL ServiceEndpointReference (EPR) into a UDDI registry using the jUDDI
client code.
@@ -109,18 +108,27 @@
* @param metaData
* @param wsdlRef
*/
- public void registerBPELProcess(QName serviceName, String version, String portName, URL
serviceUrl,
+ public void registerBPELProcess(QName serviceQName, String version, String portName, URL
serviceUrl,
URL wsdlURL, Definition wsdlDefinition) {
if (selfRegister) {
try {
- BindingTemplate binding = bpel2UDDI.register(serviceName, portName, serviceUrl,
wsdlDefinition);
- serviceLocator.addService(binding.getServiceKey());
+ RegistrationInfo registrationInfo = new RegistrationInfo();
+ registrationInfo.setServiceQName(serviceQName);
+ registrationInfo.setVersion(version);
+ registrationInfo.setPortName(portName);
+ registrationInfo.setServiceUrl(serviceUrl);
+ registrationInfo.setWsdlUrl(wsdlURL);
+ registrationInfo.setWsdlDefinition(wsdlDefinition);
+ registrationInfo.setRegistrationType(RegistrationType.BPEL);
+ registration = new AsyncRegistration(bpelClerk, urlLocalizer, properties,
registrationInfo);
+ Thread thread = new Thread(registration);
+ thread.start();
} catch (Exception e) {
- log.error("Unable to register service " + serviceName
+ log.error("Unable to register service " + serviceQName
+ " ." + e.getMessage(),e);
} catch (Throwable t) {
- log.error("Unable to register service " + serviceName
+ log.error("Unable to register service " + serviceQName
+ " ." + t.getMessage(),t);
}
@@ -136,8 +144,9 @@
public void unRegisterBPELEPR(QName serviceName, String portName, URL serviceURL) {
if (selfRegister) {
try {
+ BPEL2UDDI bpel2UDDI = new BPEL2UDDI(bpelClerk, urlLocalizer, properties);
String serviceKey = bpel2UDDI.unRegister(serviceName, portName, serviceURL);
- serviceLocator.removeService(serviceKey);
+ registration.getServiceLocator(bpelClerk.getName()).removeService(serviceKey);
} catch (Exception e) {
log.error("Unable to unRegister EPR for " + serviceName
+ " ." + e.getMessage(),e);
@@ -149,7 +158,7 @@
}
public String lookupEndpoint(QName serviceQName, String portName) {
- return serviceLocator.lookupEndpoint(serviceQName, portName);
+ return registration.getServiceLocator(bpelClerk.getName()).lookupEndpoint(serviceQName,
portName);
}
/**
@@ -157,7 +166,7 @@
*/
public WSDLReference lookupWSDL(QName serviceQName, String portName) {
- log.info("No yet supported.");
+ log.info("Not yet supported.");
return null;
}