KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > kernel > plugins > registry > AbstractKernelRegistryEntry


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software 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 software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.kernel.plugins.registry;
23
24 import org.jboss.dependency.spi.Controller;
25 import org.jboss.dependency.spi.ControllerMode;
26 import org.jboss.dependency.spi.ControllerState;
27 import org.jboss.dependency.spi.DependencyInfo;
28 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
29 import org.jboss.util.JBossObject;
30 import org.jboss.util.JBossStringBuilder;
31 import org.jboss.util.NotImplementedException;
32
33 /**
34  * Abstract Kernel registry entry.
35  *
36  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
37  * @version $Revision: 40742 $
38  */

39 public class AbstractKernelRegistryEntry extends JBossObject implements KernelRegistryEntry
40 {
41    /** The name */
42    protected Object JavaDoc name;
43
44    /** The target */
45    protected Object JavaDoc target;
46
47    /**
48     * Create an abstract kernel registry entry
49     *
50     * @param target any target object
51     */

52    public AbstractKernelRegistryEntry(Object JavaDoc target)
53    {
54       this.target = target;
55    }
56
57    /**
58     * Create an abstract kernel registry entry
59     *
60     * @param name the name
61     * @param target any target object
62     */

63    public AbstractKernelRegistryEntry(Object JavaDoc name, Object JavaDoc target)
64    {
65       this.name = name;
66       this.target = target;
67    }
68
69    public Object JavaDoc getName()
70    {
71       return name;
72    }
73    
74    public void setName(Object JavaDoc name)
75    {
76       this.name = name;
77       flushJBossObjectCache();
78    }
79
80    public Object JavaDoc getTarget()
81    {
82       return target;
83    }
84
85    // @todo SORT THIS OUT, i.e. dependency that doesn't go through controller
86

87    public Controller getController()
88    {
89       throw new NotImplementedException("getController");
90    }
91
92    public DependencyInfo getDependencyInfo()
93    {
94       return null;
95    }
96
97    public Throwable JavaDoc getError()
98    {
99       throw new NotImplementedException("getError");
100    }
101
102    public ControllerState getState()
103    {
104       return ControllerState.ERROR;
105    }
106
107    public ControllerState getRequiredState()
108    {
109       throw new NotImplementedException("getRequiredState");
110    }
111
112    public void setRequiredState(ControllerState state)
113    {
114       throw new NotImplementedException("setRequiredState");
115    }
116    
117    public ControllerMode getMode()
118    {
119       return ControllerMode.MANUAL;
120    }
121    
122    public void setMode(ControllerMode mode)
123    {
124       throw new NotImplementedException("setMode");
125    }
126
127    public void install(ControllerState fromState, ControllerState toState) throws Throwable JavaDoc
128    {
129       throw new NotImplementedException("install");
130       
131    }
132
133    public void setController(Controller controller)
134    {
135       throw new NotImplementedException("setController");
136       
137    }
138
139    public void setError(Throwable JavaDoc error)
140    {
141       throw new NotImplementedException("NYI setError");
142       
143    }
144
145    public void uninstall(ControllerState fromState, ControllerState toState)
146    {
147       throw new NotImplementedException("uninstall");
148       
149    }
150
151    public void toString(JBossStringBuilder buffer)
152    {
153       buffer.append("target=").append(target);
154    }
155    
156    public void toShortString(JBossStringBuilder buffer)
157    {
158       buffer.append(target);
159    }
160 }
Popular Tags