This project has retired. For details please refer to its
Attic page.
WebServicesTestBindingFactory xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.bindings.webservices;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory;
25 import org.apache.chemistry.opencmis.commons.SessionParameter;
26 import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
27
28
29
30
31 public class WebServicesTestBindingFactory {
32
33 private WebServicesTestBindingFactory() {
34 }
35
36 public static CmisBinding createBinding(String url, String username, String password) {
37 boolean isPrefix = true;
38 String urlLower = url.toLowerCase();
39
40 if (urlLower.endsWith("?wsdl")) {
41 isPrefix = false;
42 } else if (urlLower.endsWith(".wsdl")) {
43 isPrefix = false;
44 } else if (urlLower.endsWith(".xml")) {
45 isPrefix = false;
46 } else if (urlLower.endsWith(".aspx")) {
47 isPrefix = false;
48 } else if (urlLower.endsWith("/wsdl")) {
49 isPrefix = false;
50 }
51
52 return createBinding(url, isPrefix, username, password);
53 }
54
55 public static CmisBinding createBinding(String url, boolean isPrefix, String username, String password) {
56
57 Map<String, String> parameters = new HashMap<String, String>();
58 parameters.put(SessionParameter.USER, username);
59 parameters.put(SessionParameter.PASSWORD, password);
60
61 if (!isPrefix) {
62 parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
63 parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
64 parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url);
65 parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url);
66 parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url);
67 parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url);
68 parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url);
69 parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
70 parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
71 } else {
72 parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");
73 parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url + "NavigationService?wsdl");
74 parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
75 parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url + "VersioningService?wsdl");
76 parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
77 parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url + "RelationshipService?wsdl");
78 parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url + "MultiFilingService?wsdl");
79 parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
80 parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
81 }
82
83
84 CmisBindingFactory factory = CmisBindingFactory.newInstance();
85 CmisBinding binding = factory.createCmisWebServicesBinding(parameters);
86
87 return binding;
88 }
89 }