KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > registry > impl > AbstractEntry


1 /*
2  * $Id: AbstractEntry.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.registry.impl;
12
13 import org.mule.registry.Entry;
14 import org.mule.registry.Registry;
15 import org.mule.registry.RegistryException;
16
17 import java.io.IOException JavaDoc;
18 import java.io.Serializable JavaDoc;
19
20 /**
21  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
22  */

23 public abstract class AbstractEntry implements Entry, Serializable JavaDoc
24 {
25
26     protected transient String JavaDoc currentState;
27     protected String JavaDoc name;
28     protected String JavaDoc installRoot;
29     protected String JavaDoc stateAtShutdown;
30     protected transient Registry registry;
31
32     protected AbstractEntry(Registry registry)
33     {
34         this.currentState = UNKNOWN;
35         this.stateAtShutdown = UNKNOWN;
36         this.registry = registry;
37     }
38
39     protected void readObject(java.io.ObjectInputStream JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc
40     {
41         in.defaultReadObject();
42         this.currentState = UNKNOWN;
43     }
44
45     /*
46      * (non-Javadoc)
47      *
48      * @see org.mule.jbi.registry.Entry#getName()
49      */

50     public String JavaDoc getName()
51     {
52         return this.name;
53     }
54
55     /*
56      * (non-Javadoc)
57      *
58      * @see org.mule.jbi.registry.Entry#getInstallRoot()
59      */

60     public String JavaDoc getInstallRoot()
61     {
62         return this.installRoot;
63     }
64
65     /*
66      * (non-Javadoc)
67      *
68      * @see javax.jbi.management.LifeCycleMBean#getCurrentState()
69      */

70     public synchronized String JavaDoc getCurrentState()
71     {
72         return this.currentState;
73     }
74
75     /*
76      * (non-Javadoc)
77      *
78      * @see org.mule.jbi.registry.Entry#getStatusAtShutdown()
79      */

80     public String JavaDoc getStateAtShutdown()
81     {
82         return this.stateAtShutdown;
83     }
84
85     public void setCurrentState(String JavaDoc currentState) throws RegistryException
86     {
87         this.currentState = currentState;
88         getRegistry().save();
89     }
90
91     /*
92      * (non-Javadoc)
93      *
94      * @see org.mule.jbi.registry.Entry#setInstallRoot(java.lang.String)
95      */

96     public void setInstallRoot(String JavaDoc installRoot)
97     {
98         this.installRoot = installRoot;
99     }
100
101     public void setName(String JavaDoc name)
102     {
103         this.name = name;
104     }
105
106     public void setStateAtShutdown(String JavaDoc statusAtShutdown)
107     {
108         this.stateAtShutdown = statusAtShutdown;
109     }
110
111     public Registry getRegistry()
112     {
113         return registry;
114     }
115
116     public void setRegistry(Registry registry)
117     {
118         this.registry = registry;
119     }
120
121     protected void checkDescriptor() throws RegistryException
122     {
123         // nothing to do (yet?)
124
}
125
126 }
127
Popular Tags