This project has retired. For details please refer to its
Attic page.
UDDIPublicationService xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.v3.client.transport.wrapper;
18
19 import java.util.HashMap;
20
21 import org.apache.juddi.v3.client.ClassUtil;
22 import org.apache.juddi.v3.client.config.UDDIClient;
23 import org.apache.juddi.v3.client.config.UDDIClientContainer;
24 import org.apache.juddi.v3.client.transport.Transport;
25 import org.uddi.api_v3.AddPublisherAssertions;
26 import org.uddi.api_v3.DeleteBinding;
27 import org.uddi.api_v3.DeleteBusiness;
28 import org.uddi.api_v3.DeletePublisherAssertions;
29 import org.uddi.api_v3.DeleteService;
30 import org.uddi.api_v3.DeleteTModel;
31 import org.uddi.api_v3.GetAssertionStatusReport;
32 import org.uddi.api_v3.GetPublisherAssertions;
33 import org.uddi.api_v3.GetRegisteredInfo;
34 import org.uddi.api_v3.SaveBinding;
35 import org.uddi.api_v3.SaveBusiness;
36 import org.uddi.api_v3.SaveService;
37 import org.uddi.api_v3.SaveTModel;
38 import org.uddi.api_v3.SetPublisherAssertions;
39 import org.uddi.v3_service.UDDIPublicationPortType;
40 import org.w3c.dom.Element;
41 import org.w3c.dom.Node;
42
43
44
45
46 public class UDDIPublicationService {
47 private final static String DEFAULT_NODE_NAME = "default";
48
49 private String clientName = null;
50 private String nodeName = null;
51
52 private HashMap<String, Handler> operations = null;
53
54
55 public UDDIPublicationService() {
56 super();
57 clientName = System.getProperty("org.apache.juddi.v3.client.name");
58 nodeName = System.getProperty("org.apache.juddi.v3.client.node.name",DEFAULT_NODE_NAME);
59 operations = new HashMap<String, Handler>();
60 operations.put("get_registeredInfo", new Handler("getRegisteredInfo", GetRegisteredInfo.class));
61 operations.put("save_business", new Handler("saveBusiness", SaveBusiness.class));
62 operations.put("save_service", new Handler("saveService", SaveService.class));
63 operations.put("save_binding", new Handler("saveBinding", SaveBinding.class));
64 operations.put("save_tModel", new Handler("saveTModel", SaveTModel.class));
65 operations.put("delete_business", new Handler("deleteBusiness", DeleteBusiness.class));
66 operations.put("delete_service", new Handler("deleteService", DeleteService.class));
67 operations.put("delete_binding", new Handler("deleteBinding", DeleteBinding.class));
68 operations.put("delete_tModel", new Handler("deleteTModel", DeleteTModel.class));
69 operations.put("add_publisherAssertions", new Handler("addPublisherAssertions", AddPublisherAssertions.class));
70 operations.put("set_publisherAssertions", new Handler("setPublisherAssertions", SetPublisherAssertions.class));
71 operations.put("get_publisherAssertions", new Handler("getPublisherAssertions", GetPublisherAssertions.class));
72 operations.put("delete_publisherAssertions", new Handler("deletePublisherAssertions", DeletePublisherAssertions.class));
73 operations.put("get_assertionStatusReport", new Handler("getAssertionStatusReport", GetAssertionStatusReport.class));
74 }
75
76
77
78
79 public void validateRequest(String operation)
80 throws UnsupportedOperationException
81 {
82 if ((operation == null) || (operation.trim().length() == 0))
83 throw new UnsupportedOperationException("operation " + operation + " not supported");
84 }
85
86 public Node publish(Element uddiReq) throws Exception {
87 return publish(uddiReq, nodeName, clientName);
88 }
89
90 public Node publish(Element uddiReq, String nodeName, String clientName) throws Exception
91 {
92 UDDIClient client = UDDIClientContainer.getUDDIClient(clientName);
93 String clazz = client.getClientConfig().getUDDINode(nodeName).getProxyTransport();
94 Class<?> transportClass = ClassUtil.forName(clazz, this.getClass());
95 Transport transport = (Transport) transportClass.getConstructor(String.class, String.class).newInstance(clientName, nodeName);
96 UDDIPublicationPortType publish = transport.getUDDIPublishService();
97
98
99 RequestHandler requestHandler = new RequestHandler();
100 requestHandler.setPortType(publish);
101 String operation = requestHandler.getOperation(uddiReq);
102 Handler opHandler = operations.get(operation);
103 if (opHandler == null) {
104 throw new IllegalArgumentException("Operation not found : " + operation);
105 }
106
107 requestHandler.setMethodName(opHandler.getMethodName());
108 requestHandler.setOperationClass(opHandler.getParameter());
109
110 @SuppressWarnings("unused")
111 String version = requestHandler.getVersion(uddiReq, operation);
112 validateRequest(operation);
113
114 Node temp = requestHandler.invoke(uddiReq);
115
116 return temp;
117 }
118 }