KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > OpenCCM_DCI > cif > DCIInformationSegImpl


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

26
27 package org.objectweb.openccm.OpenCCM_DCI.cif;
28
29 import org.objectweb.openccm.OpenCCM_DCI.*;
30
31 /**
32  * This is the implementation of the DCIInformation facet provided by the
33  * DCIManager component.
34  * This class inherits from the skeleton
35  * generated by the OpenCCM's CIF to Java mapping generator.
36  *
37  * @author <a HREF="mailto:Frederic.Briclet@lifl.fr">Briclet Frederic</A>
38  */

39
40 public class DCIInformationSegImpl
41      extends org.objectweb.openccm
42             .OpenCCM_DCI.DCIManagerSessionComposition
43             .DCIInformationSeg
44 {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50

51     private org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM DCI;
52
53     // ==================================================================
54
//
55
// Internal methods.
56
//
57
// ==================================================================
58

59     // ==================================================================
60
//
61
// Constructor.
62
//
63
// ==================================================================
64

65     // ==================================================================
66
//
67
// Public methods.
68
//
69
// ==================================================================
70

71     public void setupDCI()
72     {
73         DCI=(org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM)get_context();
74     }
75
76     /**
77      * The 'get_node_manager' operation returns
78      * a node manager associated to the given node name.
79      *
80      * @param node_node The node name to search.
81      *
82      * @return The NodeManager instance associated to the given node name.
83      *
84      * @throw ::Components::InvalidName
85      * Thrown when the node name is unknown,
86      * i.e. No NodeManager instance for this node name.
87      *
88      * WARNING: Must be merged with the NodeManagement::get_node operation.
89      */

90     public org.ist.coach.DCI.NodeManager
91     get_node_manager(String JavaDoc node_name)
92     throws org.omg.Components.InvalidName
93     {
94         org.objectweb.openccm.OpenCCM_DCI.
95             DCIManagerPackage.node_managersConnection
96             connect[]=DCI.get_connections_node_managers();
97         
98         for(int i=0;i<connect.length;i++)
99             if(connect[i].objref.node_name().equals(node_name))
100                 return connect[i].objref ;
101         
102         throw new org.omg.Components.InvalidName();
103     }
104
105     /**
106      * Obtain all the node managers.
107      *
108      * @return All the node managers.
109      */

110     public org.ist.coach.DCI.NodeManager[]
111     get_node_managers()
112     {
113         org.objectweb.openccm.OpenCCM_DCI.
114             DCIManagerPackage.node_managersConnection
115             connect[]=DCI.get_connections_node_managers();
116         
117         org.ist.coach.DCI.NodeManager[] nodes=
118             new org.ist.coach.DCI.NodeManager[connect.length];
119         
120         for(int i=0;i<connect.length;i++)
121             nodes[i]=connect[i].objref;
122         
123         return nodes;
124     }
125
126     /**
127      * The 'get_dci_properties' operation returns
128      * the DCI properties in a XML format.
129      *
130      * @return DCI properties in a XML format.
131      *
132      * WARNING: What parameters must be accepted by this operation?
133      */

134     public org.ist.coach.DCI.DCIDescriptor[]
135     get_dci_properties()
136     {
137         // TODO: Must be implemented!
138
throw new org.omg.CORBA.NO_IMPLEMENT JavaDoc();
139     }
140
141     /**
142      * The 'get_node_properties' operation returns
143      * the node properties in a XML format.
144      *
145      * @return Node properties in a XML format.
146      *
147      * WARNING: What parameters must be accepted by this operation?
148      */

149     public org.ist.coach.DCI.DCIDescriptor[]
150     get_node_properties(String JavaDoc nodeName)
151     {
152         try
153         {
154             return get_node_manager(nodeName)
155                   .provide_node_information()
156                   .get_node_properties();
157         }
158         catch(org.omg.Components.InvalidName exc)
159         {
160             // TODO: Exception trace must be reported in a better way.
161
exc.printStackTrace(System.err);
162             throw new org.omg.CORBA.BAD_PARAM JavaDoc();
163     }
164     }
165
166 }
167
Popular Tags