KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > runtime > bean > ContextPersistenceDelegate


1 package org.apache.beehive.controls.runtime.bean;
2 /*
3  * Copyright 2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * $Header:$
18  */

19
20 import java.beans.BeanInfo JavaDoc;
21 import java.beans.DefaultPersistenceDelegate JavaDoc;
22 import java.beans.Encoder JavaDoc;
23 import java.beans.Expression JavaDoc;
24 import java.beans.IntrospectionException JavaDoc;
25 import java.beans.Introspector JavaDoc;
26 import java.beans.PersistenceDelegate JavaDoc;
27 import java.beans.PropertyDescriptor JavaDoc;
28 import java.beans.Statement JavaDoc;
29 import java.beans.XMLEncoder JavaDoc;
30 import java.util.Set JavaDoc;
31
32 import org.apache.beehive.controls.api.ControlException;
33
34 /**
35  * The ContextPersistenceDelegate class supports the XML persistance of ControlBeanContext
36  * instances by implementing the <code>java.beans.PersistenceDelegate</b> API, and overriding
37  * the default persistance algorithm based upon the runtime structure for Controls.
38  * <p>
39  */

40 public class ContextPersistenceDelegate extends DefaultPersistenceDelegate JavaDoc
41 {
42     /**
43      * PersistenceDelegate.instantiate()
44      */

45     protected Expression JavaDoc instantiate(Object JavaDoc oldInstance, Encoder JavaDoc out)
46     {
47         //
48
// Instead of directly creating a context instance, simply ask the containing
49
// bean to return the associated context.
50
//
51
return new Expression JavaDoc(((XMLEncoder JavaDoc)out).getOwner(), "getControlBeanContext", null);
52     }
53
54     /**
55      * PersistenceDelegate.initialize()
56      */

57     protected void initialize(Class JavaDoc<?> type, Object JavaDoc oldInstance, Object JavaDoc newInstance, Encoder JavaDoc out)
58     {
59         //super.initialize(type, oldInstance, newInstance, out);
60
}
61
62     /**
63      * PersistenceDelegate.writeObject()
64      */

65     public void writeObject(Object JavaDoc oldInstance, Encoder JavaDoc out)
66     {
67         super.writeObject(oldInstance, out);
68     }
69 }
70
Popular Tags