1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.apache.ws.scout.registry; |
18 | |
|
19 | |
import java.io.Serializable; |
20 | |
import java.net.URI; |
21 | |
import java.util.Properties; |
22 | |
import java.util.Set; |
23 | |
|
24 | |
import javax.xml.registry.Connection; |
25 | |
import javax.xml.registry.JAXRException; |
26 | |
import javax.xml.registry.RegistryService; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
public class ConnectionImpl implements Connection, Serializable |
36 | |
{ |
37 | |
private static final long serialVersionUID = 3542404895814764176L; |
38 | 348 | private boolean closed = false; |
39 | 348 | private boolean synchronous = true; |
40 | |
private Set credentials; |
41 | |
private final IRegistryBase registry; |
42 | |
private final String postalScheme; |
43 | |
private final int maxRows; |
44 | |
private String uddiVersion; |
45 | |
|
46 | |
public ConnectionImpl(URI queryManagerURI, URI lifeCycleManagerURI, URI securityManagerURI, String transportClass, String postalScheme, int maxRows, |
47 | |
String uddiNamespace, String uddiVersion) |
48 | 348 | { |
49 | 348 | Properties prop = new Properties(); |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | 348 | this.uddiVersion = uddiVersion; |
56 | 348 | if (uddiVersion != null) { |
57 | 336 | prop.setProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, uddiVersion); |
58 | |
} else { |
59 | 12 | prop.setProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, RegistryImpl.DEFAULT_UDDI_VERSION); |
60 | |
} |
61 | |
|
62 | 348 | if (uddiNamespace!=null) { |
63 | 336 | prop.setProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, uddiNamespace); |
64 | |
} else { |
65 | 12 | prop.setProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, RegistryImpl.DEFAULT_UDDI_NAMESPACE); |
66 | |
} |
67 | |
|
68 | 348 | if (transportClass!=null) { |
69 | 336 | prop.setProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME, transportClass); |
70 | |
} else { |
71 | 12 | String transport = SecurityActions.getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME); |
72 | 12 | if (transport != null) { |
73 | 0 | prop.setProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME, transport); |
74 | |
} |
75 | |
} |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | 348 | if ("3.0".equals(uddiVersion)) { |
81 | 0 | registry = new RegistryV3Impl(prop); |
82 | |
} else { |
83 | 348 | registry = new RegistryImpl(prop); |
84 | |
} |
85 | 348 | registry.setInquiryURI(queryManagerURI); |
86 | 348 | registry.setPublishURI(lifeCycleManagerURI); |
87 | 348 | registry.setSecurityURI(securityManagerURI); |
88 | 348 | this.postalScheme = postalScheme; |
89 | 348 | this.maxRows = maxRows; |
90 | |
|
91 | 348 | } |
92 | |
|
93 | |
public RegistryService getRegistryService() throws JAXRException |
94 | |
{ |
95 | 270 | RegistryServiceImpl reg = new RegistryServiceImpl(registry, postalScheme, maxRows, uddiVersion); |
96 | 270 | reg.setConnection(this); |
97 | 270 | return reg; |
98 | |
} |
99 | |
|
100 | |
public void close() |
101 | |
{ |
102 | 186 | closed = true; |
103 | 186 | } |
104 | |
|
105 | |
public boolean isClosed() |
106 | |
{ |
107 | 0 | return closed; |
108 | |
} |
109 | |
|
110 | |
public Set getCredentials() |
111 | |
{ |
112 | 450 | return credentials; |
113 | |
} |
114 | |
|
115 | |
public void setCredentials(Set credentials) |
116 | |
{ |
117 | 222 | this.credentials = credentials; |
118 | 222 | } |
119 | |
|
120 | |
public boolean isSynchronous() |
121 | |
{ |
122 | 0 | return synchronous; |
123 | |
} |
124 | |
|
125 | |
public void setSynchronous(boolean synchronous) |
126 | |
{ |
127 | 0 | this.synchronous = synchronous; |
128 | 0 | } |
129 | |
} |