KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > component > common > su > ServiceUnitDataHandler


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id$
20  * -------------------------------------------------------------------------
21  */

22
23 package org.objectweb.petals.component.common.su;
24
25 import java.util.HashMap JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import javax.jbi.servicedesc.ServiceEndpoint;
29
30 import org.objectweb.petals.tools.jbicommon.descriptor.Consumes;
31 import org.objectweb.petals.tools.jbicommon.descriptor.JBIDescriptor;
32 import org.objectweb.petals.tools.jbicommon.descriptor.Provides;
33 import org.w3c.dom.Document JavaDoc;
34
35 /**
36  * Handles useful information about a Service Unit like :<br/> - the service
37  * unit description (jbi descriptor)<br/> - links between Provides nodes and
38  * activated endpoints<br/> - links between activated endpoints and
39  * corresponding service description<br/> - links between Consumes nodes and
40  * corresponding addresses<br/> - the installation root<br/> - the service
41  * unit name<br/>
42  *
43  * @author ofabre
44  *
45  */

46 public class ServiceUnitDataHandler {
47
48     private JBIDescriptor descriptor;
49
50     private Map JavaDoc<ServiceEndpoint, Provides> epJBIDesc;
51
52     private Map JavaDoc<ServiceEndpoint, Document JavaDoc> epServiceDesc;
53
54     private Map JavaDoc<String JavaDoc, Consumes> addressToConsumes;
55
56     private String JavaDoc installRoot;
57
58     private String JavaDoc name;
59
60     public ServiceUnitDataHandler() {
61         super();
62         addressToConsumes = new HashMap JavaDoc<String JavaDoc, Consumes>();
63         epServiceDesc = new HashMap JavaDoc<ServiceEndpoint, Document JavaDoc>();
64         epJBIDesc = new HashMap JavaDoc<ServiceEndpoint, Provides>();
65     }
66
67     public void addEndpointDescription(final ServiceEndpoint endpoint,
68         final Document JavaDoc description) {
69         epServiceDesc.put(endpoint, description);
70     }
71
72     public void addJBIDescription(final ServiceEndpoint endpoint,
73         final Provides provides) {
74         epJBIDesc.put(endpoint, provides);
75     }
76
77     public JBIDescriptor getDescriptor() {
78         return descriptor;
79     }
80
81     public Map JavaDoc<ServiceEndpoint, Provides> getEpJBIDesc() {
82         return epJBIDesc;
83     }
84
85     public Map JavaDoc<ServiceEndpoint, Document JavaDoc> getEpServiceDesc() {
86         return epServiceDesc;
87     }
88
89     public String JavaDoc getInstallRoot() {
90         return installRoot;
91     }
92
93     public String JavaDoc getName() {
94         return name;
95     }
96
97     public void setName(String JavaDoc name) {
98         this.name = name;
99     }
100
101     public void removeEndpoint(final ServiceEndpoint endpoint) {
102         epServiceDesc.remove(endpoint);
103         epJBIDesc.remove(endpoint);
104     }
105
106     public void setDescriptor(final JBIDescriptor descriptor) {
107         this.descriptor = descriptor;
108     }
109
110     public void setEpJBIDesc(final Map JavaDoc<ServiceEndpoint, Provides> epJBIDesc) {
111         this.epJBIDesc = epJBIDesc;
112     }
113
114     public void setEpServiceDesc(
115         final Map JavaDoc<ServiceEndpoint, Document JavaDoc> epServiceDesc) {
116         this.epServiceDesc = epServiceDesc;
117     }
118
119     public void setInstallRoot(final String JavaDoc installRoot) {
120         this.installRoot = installRoot;
121     }
122
123     public Map JavaDoc<String JavaDoc, Consumes> getAddressToConsumes() {
124         return addressToConsumes;
125     }
126
127     public void setAddressToConsumes(
128         final Map JavaDoc<String JavaDoc, Consumes> addressToConsumes) {
129         this.addressToConsumes = addressToConsumes;
130     }
131
132     public void addAddressToConsumes(final String JavaDoc address,
133         final Consumes consumes) {
134         addressToConsumes.put(address, consumes);
135     }
136
137 }
138
Popular Tags