Revision 6861 trunk/frameworks/_fwAndami/src/com/iver/andami/persistence/serverData/ServerDataPersistence.java
ServerDataPersistence.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.4 2006-05-19 06:41:50 jaume |
|
46 |
* Revision 1.5 2006-08-28 07:56:54 jaume |
|
47 |
* *** empty log message *** |
|
48 |
* |
|
49 |
* Revision 1.4 2006/05/19 06:41:50 jaume |
|
47 | 50 |
* removed unnecessary imports |
48 | 51 |
* |
49 | 52 |
* Revision 1.3 2006/05/02 15:53:06 jorpiell |
... | ... | |
67 | 70 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
68 | 71 |
|
69 | 72 |
/** |
70 |
* This class is used to save a list of servers (using the
|
|
73 |
* This class is used to save a list of servers (using the |
|
71 | 74 |
* Andami persistence model) to the plugins-persistence.xml file. |
72 |
* It has methods to create a set of ServerData objects from an
|
|
73 |
* xml file. It can also save a set of ServerData objects in an
|
|
75 |
* It has methods to create a set of ServerData objects from an |
|
76 |
* xml file. It can also save a set of ServerData objects in an |
|
74 | 77 |
* xml file. |
75 |
*
|
|
78 |
* |
|
76 | 79 |
* @see es.gva.cit.catalogClient.utils.comboserver.ServerData |
77 | 80 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
78 | 81 |
*/ |
... | ... | |
87 | 90 |
* The View Class |
88 | 91 |
* @param sevice Type |
89 | 92 |
* Service type to load |
90 |
*/
|
|
93 |
*/ |
|
91 | 94 |
public ServerDataPersistence(Object pluginClassInstance,String serviceType){ |
92 | 95 |
ps = PluginServices.getPluginServices(pluginClassInstance); |
93 | 96 |
xml = ps.getPersistentXML(); |
94 |
this.serviceType = serviceType;
|
|
97 |
this.serviceType = serviceType; |
|
95 | 98 |
} |
96 | 99 |
|
97 | 100 |
/** |
... | ... | |
102 | 105 |
} |
103 | 106 |
|
104 | 107 |
/** |
105 |
* This method saves an array of ServerData using the Anadami
|
|
108 |
* This method saves an array of ServerData using the Anadami |
|
106 | 109 |
* persistence model |
107 | 110 |
* @param servers |
108 | 111 |
* Array of servers |
... | ... | |
117 | 120 |
} |
118 | 121 |
|
119 | 122 |
/** |
120 |
* This method adds a ServerData using the Anadami
|
|
123 |
* This method adds a ServerData using the Anadami |
|
121 | 124 |
* persistence model. If the server exists just actualizes |
122 |
* the type and subtype fileds and changes the last access
|
|
123 |
* value to the current time.
|
|
125 |
* the type and subtype fileds and changes the last access |
|
126 |
* value to the current time. |
|
124 | 127 |
* @param server |
125 | 128 |
* ServerData |
126 | 129 |
*/ |
... | ... | |
146 | 149 |
newServers[servers.length] = server; |
147 | 150 |
setArrayOfServerData(newServers); |
148 | 151 |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
|
|
152 |
} |
|
153 |
} |
|
153 | 154 |
|
155 |
|
|
156 |
|
|
154 | 157 |
/** |
155 |
* This method returns an array of ServerData objects that
|
|
158 |
* This method returns an array of ServerData objects that |
|
156 | 159 |
* have been saved using the Andami persistence model. |
157 | 160 |
* @return |
158 | 161 |
* String[] |
159 | 162 |
*/ |
160 | 163 |
public ServerData[] getArrayOfServerData(){ |
161 |
ServerData[] servers = new ServerData[xml.getNumChild()];
|
|
162 |
for (int i=0 ; i<xml.getNumChild() ; i++){
|
|
164 |
ServerData[] servers = new ServerData[xml.getChildrenCount()];
|
|
165 |
for (int i=0 ; i<xml.getChildrenCount() ; i++){
|
|
163 | 166 |
servers[i] = xmlToServerData(xml.getChild(i)); |
164 |
}
|
|
167 |
} |
|
165 | 168 |
return servers; |
166 |
} |
|
167 |
|
|
169 |
} |
|
168 | 170 |
|
171 |
|
|
169 | 172 |
/** |
170 | 173 |
* This method creates and returns a new XMLEntity. |
171 | 174 |
* @param server |
... | ... | |
176 | 179 |
public XMLEntity serverDataToXml(ServerData server){ |
177 | 180 |
String dFormat="Y-m-d H:i:s.Z"; |
178 | 181 |
|
179 |
XMLEntity xmlEnt = new XMLEntity();
|
|
182 |
XMLEntity xmlEnt = new XMLEntity(); |
|
180 | 183 |
xmlEnt.putProperty("serverURL",server.getServerAddress()); |
181 | 184 |
xmlEnt.putProperty("added",DateTime.dateToString(server.getAdded(),dFormat)); |
182 | 185 |
xmlEnt.putProperty("lastAccess",DateTime.dateToString(server.getLastAccess(),dFormat)); |
... | ... | |
216 | 219 |
|
217 | 220 |
} |
218 | 221 |
} |
219 |
return new ServerData(serverAddress,added,lastAccess,serviceType,serviceSubType,databaseName);
|
|
220 |
}
|
|
222 |
return new ServerData(serverAddress,added,lastAccess,serviceType,serviceSubType,databaseName); |
|
223 |
} |
|
221 | 224 |
} |
Also available in: Unified diff