This project has retired. For details please refer to its
Attic page.
AsyncRegistration xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.v3.client.mapping;
18
19 import java.util.HashMap;
20 import java.util.Map;
21 import java.util.Properties;
22
23 import org.apache.commons.logging.Log;
24 import org.apache.commons.logging.LogFactory;
25 import org.apache.juddi.v3.client.config.UDDIClerk;
26 import org.apache.juddi.v3.client.mapping.wsdl.BPEL2UDDI;
27 import org.apache.juddi.v3.client.mapping.wsdl.WSDL2UDDI;
28
29 public class AsyncRegistration implements Runnable {
30
31 private static Log log = LogFactory.getLog(AsyncRegistration.class);
32 private UDDIClerk clerk;
33 private URLLocalizer urlLocalizer;
34 private Properties properties;
35 private static Map<String,ServiceLocator> serviceLocators = new HashMap<String,ServiceLocator>();
36 private RegistrationInfo registrationInfo;
37
38 public AsyncRegistration(UDDIClerk clerk, URLLocalizer urlLocalizer,
39 Properties properties, RegistrationInfo registrationInfo) {
40 super();
41 this.clerk = clerk;
42 this.urlLocalizer = urlLocalizer;
43 this.properties = properties;
44 this.registrationInfo = registrationInfo;
45
46 }
47
48 public void run() {
49
50 try {
51 ServiceLocator serviceLocator = null;
52 synchronized (serviceLocators) {
53 if (!serviceLocators.containsKey(clerk.getName())) {
54 serviceLocator = new ServiceLocator(clerk, urlLocalizer, properties);
55 serviceLocators.put(clerk.getName(), serviceLocator);
56 } else {
57 serviceLocator = serviceLocators.get(clerk.getName());
58 }
59 }
60 if (RegistrationType.WSDL.equals(registrationInfo.getRegistrationType())) {
61 WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(clerk, urlLocalizer, properties);
62 wsdl2UDDI.registerBusinessService(registrationInfo.getServiceQName(),
63 registrationInfo.getPortName(),
64 registrationInfo.getServiceUrl(),
65 registrationInfo.getWsdlDefinition()).getBusinessService();
66
67 } else if (RegistrationType.BPEL.equals(registrationInfo.getRegistrationType())) {
68 BPEL2UDDI bpel2UDDI = new BPEL2UDDI(clerk, urlLocalizer, properties);
69 bpel2UDDI.register(registrationInfo.getServiceQName(),
70 registrationInfo.getPortName(),
71 registrationInfo.getServiceUrl(),
72 registrationInfo.getWsdlDefinition());
73 } else {
74 log.error("Registration error, due to unsupported registration type of " + registrationInfo.getRegistrationType());
75 }
76 } catch (Exception e) {
77 log.error("Not able to register " + registrationInfo.getRegistrationType()
78 + " endpoint " + registrationInfo.getServiceQName()
79 + " to UDDI Registry. " + e.getMessage(),e);
80 }
81
82 }
83
84 public ServiceLocator getServiceLocator(String clerkName) {
85 return serviceLocators.get(clerkName);
86 }
87 }