01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.jee.oejb3;
18:
19: import javax.xml.bind.annotation.XmlAccessType;
20: import javax.xml.bind.annotation.XmlAccessorType;
21: import javax.xml.bind.annotation.XmlElement;
22: import javax.xml.bind.annotation.XmlRootElement;
23: import javax.xml.bind.annotation.XmlType;
24: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
25: import java.util.ArrayList;
26: import java.util.List;
27: import java.util.Map;
28: import java.util.LinkedHashMap;
29: import java.util.Properties;
30:
31: /**
32: */
33: @XmlAccessorType(XmlAccessType.FIELD)
34: @XmlType(propOrder={"properties","ejbDeployment"})
35: @XmlRootElement(name="openejb-jar")
36: public class OpenejbJar {
37: @XmlElement(name="properties")
38: @XmlJavaTypeAdapter(PropertiesAdapter.class)
39: protected Properties properties;
40:
41: @XmlElement(name="ejb-deployment",required=true)
42: protected List<EjbDeployment> ejbDeployment;
43:
44: public List<EjbDeployment> getEjbDeployment() {
45: if (ejbDeployment == null) {
46: ejbDeployment = new ArrayList<EjbDeployment>();
47: }
48: return this .ejbDeployment;
49: }
50:
51: public Map<String, EjbDeployment> getDeploymentsById() {
52: Map<String, EjbDeployment> map = new LinkedHashMap<String, EjbDeployment>();
53: for (EjbDeployment deployment : getEjbDeployment()) {
54: map.put(deployment.getDeploymentId(), deployment);
55: }
56: return map;
57: }
58:
59: public Map<String, EjbDeployment> getDeploymentsByEjbName() {
60: Map<String, EjbDeployment> map = new LinkedHashMap<String, EjbDeployment>();
61: for (EjbDeployment deployment : getEjbDeployment()) {
62: map.put(deployment.getEjbName(), deployment);
63: }
64: return map;
65: }
66:
67: public int getEjbDeploymentCount() {
68: return getEjbDeployment().size();
69: }
70:
71: public void addEjbDeployment(EjbDeployment ejbDeployment) {
72: getEjbDeployment().add(ejbDeployment);
73: }
74:
75: public void removeEjbDeployment(EjbDeployment ejbDeployment) {
76: getEjbDeployment().remove(ejbDeployment);
77: }
78:
79: public Properties getProperties() {
80: if (properties == null) {
81: properties = new Properties();
82: }
83: return properties;
84: }
85:
86: }
|