KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > ccm > runtime > ComponentIdImpl


1 // ====================================================================
2
//
3
// ECM: The Extensible Container Model
4
// Copyright (C) 2004 THALES
5
// Contact: openccm-ecm@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): Mathieu Vadet.
23
// Initial Funding: IST COACH European project (IST-2001-34445)
24
// http://www.ist-coach.org
25
//
26
// ====================================================================
27

28
29
30 package org.objectweb.ccm.runtime;
31
32 import org.objectweb.corba.runtime.*;
33
34 /**
35  ** <p>Default implementation for the <tt>Components::ComponentId</tt> interface.</p>
36  **/

37 public class ComponentIdImpl
38 extends org.omg.CORBA.LocalObject JavaDoc
39 implements org.omg.Components.ComponentId
40 {
41     // segment id
42
static private String JavaDoc _class_name = "ComponentIdImpl";
43     private short _facet_id;
44     private short _segment_id;
45     private byte[] _object_id;
46     private org.omg.Components.SegmentDescr[] _seg_descrs;
47
48     // default constructor
49
public
50     ComponentIdImpl(short fid, short segid,
51                     org.omg.Components.SegmentDescr[] descrs)
52     {
53         // segment id
54
_facet_id = fid;
55         _segment_id = segid;
56         _seg_descrs = descrs;
57         _object_id = null;
58     }
59
60     //
61
// IDL:omg.org/Components/ComponentId:1.0
62
//
63

64     final public short
65     get_facet_id()
66     {
67         return _facet_id;
68     }
69
70     final public short
71     get_segment_id()
72     {
73         return _segment_id;
74     }
75
76     final public byte[]
77     get_object_id()
78     {
79         if (_object_id==null) {
80             // find object id
81
org.omg.Components.SegmentDescr[] descrs = _seg_descrs;
82             for (int i=0;i<descrs.length;i++) {
83                 if (descrs[i].segment_id==_segment_id) {
84                     _object_id = descrs[i].object_id;
85                     break;
86                 }
87             }
88         }
89
90         return _object_id;
91     }
92
93     final public org.omg.Components.SegmentDescr[]
94     get_segment_descrs()
95     {
96         return _seg_descrs;
97     }
98
99     final public org.omg.Components.ComponentId
100     create_with_new_target(short new_facet, short new_segment)
101     {
102         return new ComponentIdImpl(new_facet, new_segment, _seg_descrs);
103     }
104 }
Popular Tags