01: /*
02: * Copyright 2001-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.apache.ws.scout.registry.infomodel;
17:
18: import java.util.Collection;
19: import java.util.HashMap;
20: import java.util.Iterator;
21: import java.util.Map;
22:
23: import javax.xml.registry.JAXRException;
24: import javax.xml.registry.infomodel.ExtensibleObject;
25: import javax.xml.registry.infomodel.Slot;
26:
27: /**
28: * Implements JAXR Interface.
29: * For futher details, look into the JAXR API Javadoc.
30: *
31: * @author Anil Saldhana <anil@apache.org>
32: */
33: public class ExtensibleObjectImpl implements ExtensibleObject {
34: private Map<String, Slot> slots = new HashMap<String, Slot>();
35:
36: public void addSlot(Slot slot) throws JAXRException {
37: slots.put(slot.getName(), slot);
38: }
39:
40: public void addSlots(Collection slots) throws JAXRException {
41: for (Iterator i = slots.iterator(); i.hasNext();) {
42: addSlot((Slot) i.next());
43: }
44: }
45:
46: public Slot getSlot(String slotName) {
47: return (Slot) slots.get(slotName);
48: }
49:
50: public Collection<Slot> getSlots() {
51: return slots.values();
52: }
53:
54: public void removeSlot(String slotName) {
55: slots.remove(slotName);
56: }
57:
58: public void removeSlots(Collection<String> slotNames) {
59: slots.keySet().removeAll(slotNames);
60: }
61: }
|