KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > Containers > MetaInformation > AttributeTypeListImpl


1 /*====================================================================
2
3 created on 1 juil. 2003
4 OpenCCM: The Open CORBA Component Model Platform
5 Copyright (C) 2001-2002 USTL - LIFL - GOAL
6 Contact: openccm-team@objectweb.org
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 USA
22
23 Initial developer(s): Hameau Fabien.
24 Contributor(s): ______________________________________.
25
26 */

27 package org.objectweb.openccm.Containers.MetaInformation;
28
29 import org.objectweb.ccm.util.Table;
30 import org.omg.CORBA.LocalObject JavaDoc;
31 import org.omg.Components.InvalidName;
32
33 /**
34  * @author hameau
35  *
36  * To change the template for this generated type comment go to
37  * Window>Preferences>Java>Code Generation>Code and Comments
38  */

39 public class AttributeTypeListImpl
40 extends LocalObject JavaDoc
41 implements AttributeTypeList
42 {
43   Table _attributes;
44   
45   public AttributeTypeListImpl()
46   {
47     _attributes = new Table();
48   }
49
50   public AttributeType get_attribute_type(String JavaDoc name) throws InvalidName
51   {
52     return (AttributeType) _attributes.get(name);
53   }
54
55   /* (non-Javadoc)
56    * @see org.objectweb.openccm.Containers.MetaInformation.AttributeTypeListOperations#get_named_attribute_types(java.lang.String[])
57    */

58   public AttributeType[] get_named_attribute_types(String JavaDoc[] names) throws InvalidName
59   {
60     AttributeType[] result = new AttributeType[names.length];
61
62     // Iterate on all the connections.
63

64     int i = 0;
65     for(i=0;i<names.length;i++)
66     {
67       result[i] = (AttributeType)_attributes.get(names[i]);
68     }
69     return result;
70   }
71
72   /* (non-Javadoc)
73    * @see org.objectweb.openccm.Containers.MetaInformation.AttributeTypeListOperations#get_all_attribute_types()
74    */

75   public AttributeType[] get_all_attribute_types()
76   {
77     int idx = 0;
78     AttributeType[] result = new AttributeType[_attributes.size()];
79   
80    // Iterate on all the connections.
81

82    for(java.util.Enumeration JavaDoc elements = _attributes.elements(); elements.hasMoreElements(); )
83    {
84        AttributeType info = (AttributeType)elements.nextElement();
85        result[idx++] = info;
86    }
87    return result;
88   }
89
90   /* (non-Javadoc)
91    * @see org.objectweb.openccm.Containers.MetaInformation.AttributeTypeListOperations#add_interface_type(org.objectweb.openccm.Containers.MetaInformation.AttributeType)
92    */

93   public void add_attribute_type(AttributeType ift)
94   {
95     _attributes.put(ift.name(),ift);
96   }
97
98   /* (non-Javadoc)
99    * @see org.objectweb.openccm.Containers.MetaInformation.AttributeTypeListOperations#remove_attribute_type(java.lang.String)
100    */

101   public void remove_attribute_type(String JavaDoc name) throws InvalidName
102   {
103     _attributes.remove(name);
104   }
105 }
106
Popular Tags