001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.studio.apacheds;
021
022
023 import java.io.File;
024 import java.io.FileInputStream;
025 import java.io.FileOutputStream;
026 import java.io.IOException;
027 import java.io.InputStream;
028 import java.io.OutputStream;
029 import java.net.URL;
030
031 import org.apache.directory.studio.apacheds.configuration.model.ServerConfiguration;
032 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
033 import org.apache.directory.studio.apacheds.configuration.model.v153.ServerXmlIOV153;
034 import org.apache.directory.studio.apacheds.configuration.model.v154.ServerXmlIOV154;
035 import org.apache.directory.studio.apacheds.model.Server;
036 import org.eclipse.core.runtime.FileLocator;
037 import org.eclipse.core.runtime.IPath;
038 import org.eclipse.core.runtime.Path;
039 import org.eclipse.jface.dialogs.IDialogConstants;
040 import org.eclipse.jface.dialogs.MessageDialog;
041
042
043 /**
044 * This class contains helpful methods.
045 *
046 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
047 * @version $Rev$, $Date$
048 */
049 public class ApacheDsPluginUtils
050 {
051 private static final String RESOURCES = "resources";
052 private static final String LIBS = "libs";
053 private static final String SERVERS = "servers";
054 /** The name of the libraries folder */
055 private static final String LIBRARIES_FOLDER_NAME = "libs";
056 private static final String APACHEDS = "apacheds";
057
058 /** The line separator */
059 public static final String LINE_SEPARATOR = System.getProperty( "line.separator" );
060
061
062 /**
063 * Verifies that the libraries folder exists and contains the jar files
064 * needed to launch the server.
065 *
066 * @param server
067 * the server
068 */
069 public static void verifyLibrariesFolder( Server server )
070 {
071 IPath stateLocationPath = ApacheDsPlugin.getDefault().getStateLocation();
072
073 // Libraries folder
074 IPath librariesFolderPath = stateLocationPath.append( LIBRARIES_FOLDER_NAME );
075 File librariesFolder = new File( librariesFolderPath.toOSString() );
076 if ( !librariesFolder.exists() )
077 {
078 librariesFolder.mkdir();
079 }
080
081 // Specific Apache DS folder
082 IPath apacheDsFolderPath = librariesFolderPath.append( APACHEDS + "-" + server.getVersion() );
083 File apacheDsFolder = new File( apacheDsFolderPath.toOSString() );
084 if ( !apacheDsFolder.exists() )
085 {
086 apacheDsFolder.mkdir();
087 }
088
089 // Jar libraries
090 for ( String apachedsLibraryFilename : getApacheDsLibraries( server ) )
091 {
092 IPath apachedsLibraryPath = apacheDsFolderPath.append( apachedsLibraryFilename );
093 File apachedsLibrary = new File( apachedsLibraryPath.toOSString() );
094 if ( !apachedsLibrary.exists() )
095 {
096 try
097 {
098 copyLibrary( apachedsLibraryFilename, apachedsLibrary, server );
099 }
100 catch ( IOException e )
101 {
102 ApacheDsPluginUtils.reportError( "An error occurred when copying the library '"
103 + apachedsLibraryFilename + "' to the location '" + apachedsLibrary.getAbsolutePath()
104 + "'.\n\n" + e.getMessage() );
105 }
106 }
107 }
108 }
109
110
111 /**
112 * Gets an array containing the names of the Apache DS libraries, according
113 * to the given server.
114 *
115 * @param server
116 * the server
117 * @return
118 * an array containing the names of the Apache DS libraries, according
119 * to the given server
120 */
121 public static String[] getApacheDsLibraries( Server server )
122 {
123 if ( server != null )
124 {
125 switch ( server.getVersion() )
126 {
127 case VERSION_1_5_4:
128 // TODO modify this
129 return new String[]
130 { "antlr-2.7.7.jar", "xbean-spring-3.3.jar", "apacheds-bootstrap-extract-1.5.4.jar",
131 "apacheds-bootstrap-partition-1.5.4.jar", "apacheds-core-1.5.4.jar",
132 "apacheds-core-avl-1.5.4.jar", "apacheds-core-constants-1.5.4.jar",
133 "apacheds-core-cursor-1.5.4.jar", "apacheds-core-entry-1.5.4.jar",
134 "apacheds-core-shared-1.5.4.jar", "apacheds-jdbm-1.5.4.jar",
135 "apacheds-jdbm-store-1.5.4.jar", "apacheds-kerberos-shared-1.5.4.jar",
136 "apacheds-launcher-1.2.0.jar", "apacheds-protocol-changepw-1.5.4.jar",
137 "apacheds-protocol-dns-1.5.4.jar", "apacheds-protocol-kerberos-1.5.4.jar",
138 "apacheds-protocol-ldap-1.5.4.jar", "apacheds-protocol-ntp-1.5.4.jar",
139 "apacheds-protocol-shared-1.5.4.jar", "apacheds-schema-bootstrap-1.5.4.jar",
140 "apacheds-schema-extras-1.5.4.jar", "apacheds-schema-registries-1.5.4.jar",
141 "apacheds-server-jndi-1.5.4.jar", "apacheds-server-xml-1.5.4.jar",
142 "apacheds-utils-1.5.4.jar", "apacheds-xbean-spring-1.5.4.jar",
143 "apacheds-xdbm-base-1.5.4.jar", "apacheds-xdbm-search-1.5.4.jar",
144 "apacheds-xdbm-tools-1.5.4.jar", "commons-cli-1.1.jar", "commons-collections-3.2.jar",
145 "commons-daemon-1.0.1.jar", "commons-lang-2.3.jar", "daemon-bootstrappers-1.1.4.jar",
146 "jcl104-over-slf4j-1.4.3.jar", "log4j-1.2.14.jar", "mina-core-1.1.6.jar",
147 "mina-filter-ssl-1.1.6.jar", "shared-asn1-0.9.12.jar", "shared-asn1-codec-0.9.12.jar",
148 "shared-bouncycastle-reduced-0.9.12.jar", "shared-ldap-0.9.12.jar",
149 "shared-ldap-constants-0.9.12.jar", "slf4j-api-1.4.3.jar", "slf4j-log4j12-1.4.3.jar",
150 "spring-beans-2.0.6.jar", "spring-context-2.0.6.jar", "spring-core-2.0.6.jar" };
151 case VERSION_1_5_3:
152 return new String[]
153 { "antlr-2.7.7.jar", "apacheds-bootstrap-extract-1.5.3.jar",
154 "apacheds-bootstrap-partition-1.5.3.jar", "apacheds-btree-base-1.5.3.jar",
155 "apacheds-core-1.5.3.jar", "apacheds-core-constants-1.5.3.jar",
156 "apacheds-core-entry-1.5.3.jar", "apacheds-core-shared-1.5.3.jar",
157 "apacheds-jdbm-1.5.3.jar", "apacheds-jdbm-store-1.5.3.jar",
158 "apacheds-kerberos-shared-1.5.3.jar", "apacheds-launcher-1.2.0.jar",
159 "apacheds-protocol-changepw-1.5.3.jar", "apacheds-protocol-dns-1.5.3.jar",
160 "apacheds-protocol-kerberos-1.5.3.jar", "apacheds-protocol-ldap-1.5.3.jar",
161 "apacheds-protocol-ntp-1.5.3.jar", "apacheds-protocol-shared-1.5.3.jar",
162 "apacheds-schema-bootstrap-1.5.3.jar", "apacheds-schema-extras-1.5.3.jar",
163 "apacheds-schema-registries-1.5.3.jar", "apacheds-server-jndi-1.5.3.jar",
164 "apacheds-server-xml-1.5.3.jar", "apacheds-utils-1.5.3.jar",
165 "apacheds-xbean-spring-1.5.3.jar", "commons-cli-1.1.jar", "commons-collections-3.2.jar",
166 "commons-daemon-1.0.1.jar", "commons-lang-2.3.jar", "daemon-bootstrappers-1.1.3.jar",
167 "jcl104-over-slf4j-1.4.3.jar", "log4j-1.2.14.jar", "mina-core-1.1.6.jar",
168 "mina-filter-ssl-1.1.6.jar", "shared-asn1-0.9.11.jar", "shared-asn1-codec-0.9.11.jar",
169 "shared-bouncycastle-reduced-0.9.11.jar", "shared-ldap-0.9.11.jar",
170 "shared-ldap-constants-0.9.11.jar", "slf4j-api-1.4.3.jar", "slf4j-log4j12-1.4.3.jar",
171 "spring-beans-2.0.6.jar", "spring-context-2.0.6.jar", "spring-core-2.0.6.jar",
172 "xbean-spring-3.3.jar" };
173 };
174 }
175
176 return new String[0];
177 }
178
179
180 /**
181 * Copy the given library.
182 *
183 * @param library
184 * the name of the library
185 * @param destination
186 * the destination
187 * @param server
188 * the server
189 * @throws IOException
190 * if an error occurrs when copying the jar file
191 */
192 private static void copyLibrary( String library, File destination, Server server ) throws IOException
193 {
194 // Getting he URL of the library within the bundle
195 URL libraryUrl = FileLocator.find( ApacheDsPlugin.getDefault().getBundle(), new Path( RESOURCES
196 + IPath.SEPARATOR + LIBS + IPath.SEPARATOR + APACHEDS + "-" + server.getVersion().toString()
197 + IPath.SEPARATOR + library ), null );
198
199 // Creating the input and output streams
200 InputStream libraryInputStream = libraryUrl.openStream();
201 FileOutputStream libraryOutputStream = new FileOutputStream( destination );
202
203 // Copying the library
204 copyFile( libraryInputStream, libraryOutputStream );
205
206 // Closing the streams
207 libraryInputStream.close();
208 libraryOutputStream.close();
209 }
210
211
212 /**
213 * Copies a file from the given streams.
214 *
215 * @param inputStream
216 * the input stream
217 * @param outputStream
218 * the output stream
219 * @throws IOException
220 * if an error occurs when copying the file
221 */
222 private static void copyFile( InputStream inputStream, OutputStream outputStream ) throws IOException
223 {
224 byte[] buf = new byte[1024];
225 int i = 0;
226 while ( ( i = inputStream.read( buf ) ) != -1 )
227 {
228 outputStream.write( buf, 0, i );
229 }
230 }
231
232
233 /**
234 * Get the path to the Apache DS libraries folder.
235 *
236 * @param server
237 * the server
238 * @return
239 * the path to the Apache DS libraries folder
240 */
241 public static IPath getApacheDsLibrariesFolder( Server server )
242 {
243 return ApacheDsPlugin.getDefault().getStateLocation().append( LIBRARIES_FOLDER_NAME ).append(
244 APACHEDS + "-" + server.getVersion() );
245 }
246
247
248 /**
249 * Get the path to the Apache DS servers folder.
250 *
251 * @return
252 * the path to the Apache DS server folder
253 */
254 public static IPath getApacheDsServersFolder()
255 {
256 return ApacheDsPlugin.getDefault().getStateLocation().append( SERVERS );
257 }
258
259
260 /**
261 * Creates a new server folder for the given id.
262 *
263 * @param id
264 * the id of the server
265 */
266 public static void createNewServerFolder( String id )
267 {
268 // Checking if the Apache DS servers folder exists
269 checkApacheDsServersFolder();
270
271 // Creating the server folder
272 IPath serverFolderPath = getApacheDsServersFolder().append( id );
273 File serverFolder = new File( serverFolderPath.toOSString() );
274 serverFolder.mkdir();
275
276 // Creating the server sub folders
277 File confFolder = new File( serverFolder, "conf" );
278 confFolder.mkdir();
279 File serverSocketFolder = new File( serverFolder, "serverSocket" );
280 serverSocketFolder.mkdir();
281 new File( serverFolder, "ldif" ).mkdir();
282 new File( serverFolder, "log" ).mkdir();
283 new File( serverFolder, "partitions" ).mkdir();
284
285 // Copying default configuration files
286 try
287 {
288 // Creating log4j.properties file
289 File log4jPropertiesFile = new File( confFolder, "log4j.properties" );
290 createServersLog4jPropertiesFile( new FileOutputStream( log4jPropertiesFile ), 1024, getServerLogsLevel(), // Setting 1024 as default port
291 getServerLogsPattern() );
292
293 // Copying server.xml file
294 File serverXmlFile = new File( confFolder, "server.xml" );
295 copyConfigurationFile( "server-1.5.4.xml", serverXmlFile );
296
297 // Creating log4j.properties file to the serverSocket folder
298 File log4jPropertiesServerSocketFile = new File( serverSocketFolder, "log4j.properties" );
299 createServerSocketLog4jPropertiesFile( new FileOutputStream( log4jPropertiesServerSocketFile ), id );
300 }
301 catch ( IOException e )
302 {
303 ApacheDsPluginUtils
304 .reportError( "An error occurred when copying the default configuration files to the server's folder '"
305 + serverFolder.getAbsolutePath() + "'.\n\n" + e.getMessage() );
306 }
307 }
308
309
310 /**
311 * Create the log4j.properties file for the server.
312 *
313 * @param os
314 * the {@link OutputStream} to write to
315 * @param port
316 * the port
317 * @param logsLevel
318 * the logs level
319 * @param logsLevel
320 * the logs pattern
321 * @throws IOException
322 * if an error occurs when writing to the file
323 */
324 public static void createServersLog4jPropertiesFile( OutputStream os, int port, String logsLevel, String logsPattern )
325 throws IOException
326 {
327 // Creating the file content in a StringBuffer
328 StringBuffer sb = new StringBuffer();
329 sb.append( "#############################################################################" ).append( "\n" );
330 sb.append( "# Licensed to the Apache Software Foundation (ASF) under one or more" ).append( "\n" );
331 sb.append( "# contributor license agreements. See the NOTICE file distributed with" ).append( "\n" );
332 sb.append( "# this work for additional information regarding copyright ownership." ).append( "\n" );
333 sb.append( "# The ASF licenses this file to You under the Apache License, Version 2.0" ).append( "\n" );
334 sb.append( "# (the \"License\"); you may not use this file except in compliance with" ).append( "\n" );
335 sb.append( "# the License. You may obtain a copy of the License at" ).append( "\n" );
336 sb.append( "#" ).append( "\n" );
337 sb.append( "# http://www.apache.org/licenses/LICENSE-2.0" ).append( "\n" );
338 sb.append( "#" ).append( "\n" );
339 sb.append( "# Unless required by applicable law or agreed to in writing, software" ).append( "\n" );
340 sb.append( "# distributed under the License is distributed on an \"AS IS\" BASIS," ).append( "\n" );
341 sb.append( "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." ).append( "\n" );
342 sb.append( "# See the License for the specific language governing permissions and" ).append( "\n" );
343 sb.append( "# limitations under the License." ).append( "\n" );
344 sb.append( "#############################################################################" ).append( "\n" );
345 sb.append( "log4j.rootCategory=" + logsLevel + ", socketAppender, rollingFileAppender" ).append( "\n" );
346 sb.append( "" ).append( "\n" );
347 sb.append( "# The Socket Appender (used to send the logs to Apache Directory Studio)" ).append( "\n" );
348 sb.append( "log4j.appender.socketAppender=org.apache.log4j.net.SocketAppender" ).append( "\n" );
349 sb.append( "log4j.appender.socketAppender.RemoteHost=localhost" ).append( "\n" );
350 sb.append( "log4j.appender.socketAppender.Port=" ).append( port ).append( "\n" );
351 sb.append( "" ).append( "\n" );
352 sb.append( "# The Rolling File Appender" ).append( "\n" );
353 sb.append( "log4j.appender.rollingFileAppender=org.apache.log4j.RollingFileAppender" ).append( "\n" );
354 sb.append( "log4j.appender.rollingFileAppender.File=${apacheds.log.dir}/apacheds-rolling.log" ).append( "\n" );
355 sb.append( "log4j.appender.rollingFileAppender.MaxFileSize=1024KB" ).append( "\n" );
356 sb.append( "log4j.appender.rollingFileAppender.MaxBackupIndex=5" ).append( "\n" );
357 sb.append( "log4j.appender.rollingFileAppender.layout=org.apache.log4j.PatternLayout" ).append( "\n" );
358 sb.append( "log4j.appender.rollingFileAppender.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n" )
359 .append( "\n" );
360 sb.append( "" ).append( "\n" );
361 sb.append( "# with these we'll not get innundated when switching to DEBUG" ).append( "\n" );
362 sb.append( "log4j.logger.org.apache.directory.shared.ldap.name=WARN" ).append( "\n" );
363 sb.append( "log4j.logger.org.springframework=WARN" ).append( "\n" );
364 sb.append( "log4j.logger.org.apache.directory.shared.codec=WARN" ).append( "\n" );
365 sb.append( "log4j.logger.org.apache.directory.shared.asn1=WARN" ).append( "\n" );
366
367 // Writing the content to the file
368 os.write( sb.toString().getBytes() );
369 }
370
371
372 /**
373 * Create the log4j.properties file for the server socket logger.
374 *
375 * @param os
376 * the {@link OutputStream} to write to
377 * @param id
378 * the id of the server
379 * @throws IOException
380 * if an error occurs when writing to the file
381 */
382 private static void createServerSocketLog4jPropertiesFile( OutputStream os, String id ) throws IOException
383 {
384 // Creating the file content in a StringBuffer
385 StringBuffer sb = new StringBuffer();
386 sb.append( "#############################################################################" ).append( "\n" );
387 sb.append( "# Licensed to the Apache Software Foundation (ASF) under one or more" ).append( "\n" );
388 sb.append( "# contributor license agreements. See the NOTICE file distributed with" ).append( "\n" );
389 sb.append( "# this work for additional information regarding copyright ownership." ).append( "\n" );
390 sb.append( "# The ASF licenses this file to You under the Apache License, Version 2.0" ).append( "\n" );
391 sb.append( "# (the \"License\"); you may not use this file except in compliance with" ).append( "\n" );
392 sb.append( "# the License. You may obtain a copy of the License at" ).append( "\n" );
393 sb.append( "#" ).append( "\n" );
394 sb.append( "# http://www.apache.org/licenses/LICENSE-2.0" ).append( "\n" );
395 sb.append( "#" ).append( "\n" );
396 sb.append( "# Unless required by applicable law or agreed to in writing, software" ).append( "\n" );
397 sb.append( "# distributed under the License is distributed on an \"AS IS\" BASIS," ).append( "\n" );
398 sb.append( "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." ).append( "\n" );
399 sb.append( "# See the License for the specific language governing permissions and" ).append( "\n" );
400 sb.append( "# limitations under the License." ).append( "\n" );
401 sb.append( "#############################################################################" ).append( "\n" );
402 sb.append( "log4j.rootCategory=ALL, studioConsoleAppender" ).append( "\n" );
403 sb.append( "" ).append( "\n" );
404 sb.append( "# Studio Console Appender (identified with the server id)" ).append( "\n" );
405 sb.append( "log4j.appender.studioConsoleAppender=org.apache.directory.studio.apacheds.StudioConsoleAppender" )
406 .append( "\n" );
407 sb.append( "log4j.appender.studioConsoleAppender.ServerId=" ).append( id ).append( "\n" );
408 sb.append( "log4j.appender.studioConsoleAppender.layout=org.apache.log4j.PatternLayout" ).append( "\n" );
409 sb.append( "" ).append( "\n" );
410 sb.append( "# Hiding logs from log4j" ).append( "\n" );
411 sb.append( "log4j.logger.org.apache.log4j.net.SocketServer=OFF" ).append( "\n" );
412 sb.append( "log4j.logger.org.apache.log4j.net.SocketNode=OFF" ).append( "\n" );
413
414 // Writing the content to the file
415 os.write( sb.toString().getBytes() );
416 }
417
418
419 /**
420 * Copies a configuration file.
421 *
422 * @param inputFilename
423 * the filename
424 * @param ouputFile
425 * the output file
426 * @throws IOException
427 * if an error occurs when copying
428 */
429 private static void copyConfigurationFile( String inputFilename, File ouputFile ) throws IOException
430 {
431 // Getting he URL of the file within the bundle
432 URL inputFilenameUrl = FileLocator.find( ApacheDsPlugin.getDefault().getBundle(), new Path( RESOURCES
433 + IPath.SEPARATOR + "conf" + IPath.SEPARATOR + inputFilename ), null );
434
435 // Creating the input and output streams
436 InputStream inputStream = inputFilenameUrl.openStream();
437 OutputStream outputStream = new FileOutputStream( ouputFile );
438
439 // Copying the file
440 copyFile( inputStream, outputStream );
441
442 // Closing the streams
443 inputStream.close();
444 outputStream.close();
445 }
446
447
448 /**
449 * Verifies that the Apache DS server folder exists.
450 * If it does not exists, it creates it.
451 */
452 private static void checkApacheDsServersFolder()
453 {
454 File apacheDsserversFolder = new File( getApacheDsServersFolder().toOSString() );
455 if ( !apacheDsserversFolder.exists() )
456 {
457 apacheDsserversFolder.mkdir();
458 }
459 }
460
461
462 /**
463 * Gets the server logs level.
464 *
465 * @return
466 * the server logs level
467 */
468 public static String getServerLogsLevel()
469 {
470 String level = ApacheDsPlugin.getDefault().getPreferenceStore().getString(
471 ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL );
472 if ( ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL_DEBUG.equalsIgnoreCase( level ) )
473 {
474 return "DEBUG";
475 }
476 else if ( ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL_INFO.equalsIgnoreCase( level ) )
477 {
478 return "INFO";
479 }
480 else if ( ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL_WARN.equalsIgnoreCase( level ) )
481 {
482 return "WARN";
483 }
484 else if ( ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL_ERROR.equalsIgnoreCase( level ) )
485 {
486 return "ERROR";
487 }
488 else if ( ApacheDsPluginConstants.PREFS_SERVER_LOGS_LEVEL_FATAL.equalsIgnoreCase( level ) )
489 {
490 return "FATAL";
491 }
492
493 return "";
494 }
495
496
497 /**
498 * Gets the server logs pattern.
499 *
500 * @return
501 * the server logs pattern
502 */
503 public static String getServerLogsPattern()
504 {
505 return ApacheDsPlugin.getDefault().getPreferenceStore().getString(
506 ApacheDsPluginConstants.PREFS_SERVER_LOGS_PATTERN );
507 }
508
509
510 /**
511 * Reports an error.
512 *
513 * @param message
514 * the message
515 */
516 public static void reportError( String message )
517 {
518
519 MessageDialog dialog = new MessageDialog( ApacheDsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
520 .getShell(), "Error!", null, message, MessageDialog.ERROR, new String[]
521 { IDialogConstants.OK_LABEL }, MessageDialog.OK );
522 dialog.open();
523 }
524
525 /**
526 * Gets the server configuration.
527 *
528 * @param server
529 * the server
530 * @return
531 * the associated server configuration
532 * @throws ServerXmlIOException
533 * @throws ServerXmlIOException
534 * @throws IOException
535 */
536 public static ServerConfiguration getServerConfiguration( Server server ) throws ServerXmlIOException, IOException
537 {
538 InputStream fis = new FileInputStream( new File( ApacheDsPluginUtils.getApacheDsServersFolder().append(
539 server.getId() ).append( "conf" ).append( "server.xml" ).toOSString() ) );
540
541 // Parsing and returning the server configuration
542 switch ( server.getVersion() )
543 {
544 case VERSION_1_5_4:
545 ServerXmlIOV154 serverXmlIOV154 = new ServerXmlIOV154();
546 return serverXmlIOV154.parse( fis );
547 case VERSION_1_5_3:
548 ServerXmlIOV153 serverXmlIOV153 = new ServerXmlIOV153();
549 return serverXmlIOV153.parse( fis );
550 }
551
552 // No corresponding reader has been found, we return null
553 return null;
554 }
555 }