1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.apache.ws.scout.registry.infomodel; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.Iterator; |
21 | |
|
22 | |
import javax.xml.registry.InvalidRequestException; |
23 | |
import javax.xml.registry.JAXRException; |
24 | |
import javax.xml.registry.LifeCycleManager; |
25 | |
import javax.xml.registry.UnexpectedObjectException; |
26 | |
import javax.xml.registry.infomodel.InternationalString; |
27 | |
import javax.xml.registry.infomodel.Service; |
28 | |
import javax.xml.registry.infomodel.ServiceBinding; |
29 | |
import javax.xml.registry.infomodel.SpecificationLink; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public class ServiceBindingImpl extends RegistryObjectImpl implements ServiceBinding |
38 | |
{ |
39 | 0 | private Collection<SpecificationLink> links = new ArrayList<SpecificationLink>(); |
40 | 0 | private String accessuri = null; |
41 | 0 | private Service service = null; |
42 | 0 | private ServiceBinding targetbinding = null; |
43 | 0 | private boolean validateuri = false; |
44 | |
|
45 | |
public ServiceBindingImpl(LifeCycleManager lifeCycleManager) |
46 | |
{ |
47 | 0 | super(lifeCycleManager); |
48 | 0 | } |
49 | |
|
50 | |
public ServiceBindingImpl(LifeCycleManager lifeCycleManager, InternationalString n) |
51 | |
{ |
52 | 0 | super(lifeCycleManager, n); |
53 | 0 | } |
54 | |
|
55 | |
public void addSpecificationLink(SpecificationLink sl) throws JAXRException |
56 | |
{ |
57 | 0 | links.add(sl); |
58 | 0 | ((SpecificationLinkImpl)sl).setServiceBinding(this); |
59 | 0 | } |
60 | |
|
61 | |
public void addSpecificationLinks(Collection col) throws JAXRException |
62 | |
{ |
63 | |
try |
64 | |
{ |
65 | 0 | Iterator iter = col.iterator(); |
66 | 0 | while(iter.hasNext()) |
67 | |
{ |
68 | 0 | addSpecificationLink((SpecificationLink)iter.next()); |
69 | |
} |
70 | 0 | } catch (ClassCastException e) |
71 | |
{ |
72 | 0 | throw new UnexpectedObjectException(); |
73 | 0 | } |
74 | 0 | } |
75 | |
|
76 | |
public String getAccessURI() throws JAXRException |
77 | |
{ |
78 | 0 | return accessuri; |
79 | |
} |
80 | |
|
81 | |
public Service getService() throws JAXRException |
82 | |
{ |
83 | 0 | return service; |
84 | |
} |
85 | |
|
86 | |
public Collection getSpecificationLinks() throws JAXRException |
87 | |
{ |
88 | 0 | return links; |
89 | |
} |
90 | |
|
91 | |
public ServiceBinding getTargetBinding() throws JAXRException |
92 | |
{ |
93 | 0 | return targetbinding; |
94 | |
} |
95 | |
|
96 | |
public void removeSpecificationLink(SpecificationLink link) throws JAXRException |
97 | |
{ |
98 | 0 | links.remove(link); |
99 | 0 | } |
100 | |
|
101 | |
public void removeSpecificationLinks(Collection col) throws JAXRException |
102 | |
{ |
103 | 0 | links.removeAll(col); |
104 | 0 | } |
105 | |
|
106 | |
public void setAccessURI(String s) throws JAXRException |
107 | |
{ |
108 | 0 | if(targetbinding != null) |
109 | 0 | throw new InvalidRequestException("There is already a Target Binding defined"); |
110 | 0 | accessuri = s; |
111 | 0 | } |
112 | |
|
113 | |
public void setTargetBinding(ServiceBinding sb) throws JAXRException |
114 | |
{ |
115 | 0 | if(accessuri != null) |
116 | 0 | throw new InvalidRequestException("There is already an Access URI defined"); |
117 | |
|
118 | 0 | targetbinding = sb; |
119 | 0 | } |
120 | |
|
121 | |
public boolean getValidateURI() throws JAXRException |
122 | |
{ |
123 | 0 | return validateuri; |
124 | |
} |
125 | |
|
126 | |
public void setValidateURI(boolean b) throws JAXRException |
127 | |
{ |
128 | 0 | validateuri = b; |
129 | 0 | } |
130 | |
|
131 | |
|
132 | |
public void setService(Service s) |
133 | |
{ |
134 | 0 | service =s; |
135 | 0 | } |
136 | |
} |