1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jetspeed.serializer.objects;
19
20 import javolution.xml.XMLFormat;
21 import javolution.xml.stream.XMLStreamException;
22
23 public class JSSecondaryData extends JSSnapshot
24 {
25
26 public static final int softwareVersion = 1;
27
28 public static final int softwareSubVersion = 0;
29
30 private String encryption;
31
32
33 private JSApplications applications;
34
35
36 /***
37 * check the software version and subvversion against the saved
38 * version...and verify whether it is compatible...
39 *
40 * @return the current software can process this file
41 */
42 public boolean checkVersion()
43 {
44 return true;
45 }
46
47 /***
48 * @return Returns the softwareSubVersion.
49 */
50 public int getSoftwareSubVersion()
51 {
52 return softwareSubVersion;
53 }
54
55 /***
56 * @return Returns the softwareVersion.
57 */
58 public int getSoftwareVersion()
59 {
60 return softwareVersion;
61 }
62
63
64 public JSSecondaryData()
65 {
66 super();
67 System.out.println("JSSecondaryData Class created");
68 }
69
70 public JSSecondaryData(String name)
71 {
72 super();
73
74 applications = new JSApplications();
75 }
76
77
78 /****************************************************************************
79 * SERIALIZER
80 */
81 protected static final XMLFormat XML = new XMLFormat(JSSecondaryData.class)
82 {
83
84 public void write(Object o, OutputElement xml)
85 throws XMLStreamException
86 {
87
88 try
89 {
90
91 JSSnapshot.XML.write(o,xml);
92
93 JSSecondaryData g = (JSSecondaryData) o;
94
95
96 /*** implicitly named (through binding) fields here */
97
98 xml.add(g.getApplications());
99
100
101 } catch (Exception e)
102 {
103 e.printStackTrace();
104 }
105 }
106
107 public void read(InputElement xml, Object o)
108 {
109 try
110 {
111 JSSnapshot.XML.read(xml, o);
112 JSSecondaryData g = (JSSecondaryData) o;
113
114 while (xml.hasNext())
115 {
116 Object o1 = xml.getNext();
117
118 if (o1 instanceof JSApplications)
119 g.applications = (JSApplications) o1;
120 }
121 } catch (Exception e)
122 {
123 e.printStackTrace();
124 }
125 }
126 };
127
128
129
130
131 /***
132 * @param applications
133 * The applications to set.
134 */
135 public void setApplications(JSApplications applications)
136 {
137 this.applications = applications;
138 }
139
140 public JSApplications getApplications()
141 {
142 return applications;
143 }
144
145
146 }