KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > plugins > fractal > context > InterfaceContext


1 /*====================================================================
2  
3  Objectweb Browser Framework
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): Jerome Moroy.
23  Contributor(s): ______________________________________.
24  
25  ---------------------------------------------------------------------
26  $Id: InterfaceContext.java,v 1.1 2004/04/20 16:37:26 moroy Exp $
27  ====================================================================*/

28
29 package org.objectweb.util.browser.plugins.fractal.context;
30
31 import java.util.List JavaDoc;
32 import java.util.Vector JavaDoc;
33
34 import org.objectweb.fractal.api.Component;
35 import org.objectweb.fractal.api.Interface;
36 import org.objectweb.fractal.api.control.BindingController;
37 import org.objectweb.util.browser.api.Entry;
38 import org.objectweb.util.browser.core.naming.AbstractContext;
39 import org.objectweb.util.browser.core.naming.DefaultEntry;
40 import org.objectweb.util.browser.core.naming.DefaultName;
41 import org.objectweb.util.browser.plugins.fractal.FcBrowser;
42
43 /**
44  * Basic interface context.
45  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
46  * @version 0.1
47  */

48 public class InterfaceContext
49      extends AbstractContext
50 {
51     /** the interface wrapper reference. */
52     protected InterfaceWrapper interfaceWrapper ;
53
54     /**
55      * @return Returns the interfaceWrapper.
56      */

57     protected InterfaceWrapper getInterfaceWrapper() {
58         return interfaceWrapper;
59     }
60
61     /**
62      * @param interfaceWrapper The interfaceWrapper to set.
63      */

64     protected void setInterfaceWrapper(InterfaceWrapper interfaceWrapper) {
65         this.interfaceWrapper = interfaceWrapper;
66     }
67
68     /* (non-Javadoc)
69      * @see org.objectweb.util.browser.api.Context#getEntries()
70      */

71     public Entry[] getEntries(Interface itf) {
72         List JavaDoc l = new Vector JavaDoc();
73         Component ci = itf.getFcItfOwner();
74         Interface bindInterface = null;
75         try {
76             BindingController bc = FcBrowser.getBindingController(ci);
77             bindInterface = (Interface)bc.lookupFc(itf.getFcItfName());
78         } catch(Exception JavaDoc e) { }
79         if(bindInterface!=null)
80             l.add(new DefaultEntry(bindInterface,
81                                    new DefaultName(FcBrowser.getPrefixedName(bindInterface)),
82                                    this));
83         return (Entry[])l.toArray(new Entry[0]);
84     }
85
86     /* (non-Javadoc)
87      * @see org.objectweb.util.browser.core.naming.AbstractContext#getEntries()
88      */

89     public Entry[] getEntries() {
90         return getEntries(getInterfaceWrapper().getItf());
91     }
92     
93     /* (non-Javadoc)
94      * @see org.objectweb.util.browser.core.naming.AbstractContext#setWrapped(java.lang.Object)
95      */

96     public void setWrapped(Object JavaDoc object) {
97         setInterfaceWrapper((InterfaceWrapper) object);
98     }
99     
100     /* (non-Javadoc)
101      * @see org.objectweb.util.browser.core.naming.AbstractContext#getWrapped()
102      */

103     public Object JavaDoc getWrapped() {
104         return getInterfaceWrapper();
105     }
106 }
107
Popular Tags