This project has retired. For details please refer to its Attic page.
ExtensibleObjectImpl xref
View Javadoc
1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
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.Map;
21  
22  import javax.xml.registry.JAXRException;
23  import javax.xml.registry.infomodel.ExtensibleObject;
24  import javax.xml.registry.infomodel.Slot;
25  
26  /**
27   * Implements JAXR Interface.
28   * For futher details, look into the JAXR API Javadoc.
29   *
30   * @author Anil Saldhana  <anil@apache.org>
31   */
32  public class ExtensibleObjectImpl implements ExtensibleObject
33  {
34      private Map<String,Slot> slots = new HashMap<String,Slot>();
35  
36      public void addSlot(Slot slot) throws JAXRException
37      {
38          slots.put(slot.getName(), slot);
39      }
40  
41      public void addSlots(Collection slots) throws JAXRException
42      {
43          for (Object slot : slots) {
44              addSlot((Slot) slot);
45          }
46      }
47  
48      public Slot getSlot(String slotName)
49      {
50          return (Slot) slots.get(slotName);
51      }
52  
53      public Collection<Slot> getSlots()
54      {
55          return slots.values();
56      }
57  
58      public void removeSlot(String slotName)
59      {
60          slots.remove(slotName);
61      }
62  
63      public void removeSlots(Collection slotNames)
64      {
65          slots.keySet().removeAll(slotNames);
66      }
67  }