public void imprt(File dir) throws Exception {
//TODO: this routine needs to be safer about accessing parameters,
// wrapping in null checks
GeoServerFactory factory = geoServer.getFactory();
// services.xml
File servicesFile = new File(dir, "services.xml");
if (!servicesFile.exists()) {
throw new FileNotFoundException(
"Could not find services.xml under:"
+ dir.getAbsolutePath());
}
LegacyServicesReader reader = new LegacyServicesReader();
reader.read(servicesFile);
//
//global
//
GeoServerInfo info = factory.createGlobal();
Map<String,Object> global = reader.global();
//info.setMaxFeatures( get( global, "maxFeatures", Integer.class ) );
info.setVerbose( get( global, "verbose", boolean.class ) );
info.setVerboseExceptions( get( global, "verboseExceptions", boolean.class ) );
info.setNumDecimals( get( global, "numDecimals", int.class, 4 ) );
info.setCharset( (String) global.get( "charSet" ) );
info.setUpdateSequence( get( global, "updateSequence", int.class ) );
info.setOnlineResource( get( global, "onlineResource", String.class ) );
info.setProxyBaseUrl( get( global, "ProxyBaseUrl", String.class ) );
//contact
Map<String,Object> contact = reader.contact();
ContactInfo contactInfo = factory.createContact();
contactInfo.setContactPerson( (String) contact.get( "ContactPerson") );
contactInfo.setContactOrganization( (String) contact.get( "ContactOrganization") );
contactInfo.setContactVoice( (String) contact.get( "ContactVoiceTelephone" ) );
contactInfo.setContactFacsimile( (String) contact.get( "ContactFacsimileTelephone" ) );
contactInfo.setContactPosition( (String) contact.get( "ContactPosition" ) );
contactInfo.setContactEmail( (String) contact.get( "ContactElectronicMailAddress" ) );
contactInfo.setAddress( (String) contact.get( "Address") );
contactInfo.setAddressType( (String) contact.get( "AddressType") );
contactInfo.setAddressCity( (String) contact.get( "City") );
contactInfo.setAddressCountry( (String) contact.get( "Country") );
contactInfo.setAddressState( (String) contact.get( "StateOrProvince") );
contactInfo.setAddressPostalCode( (String) contact.get( "PostCode") );
info.setContact( contactInfo );
//jai
JAIInfo jai = new JAIInfoImpl();
jai.setMemoryCapacity( (Double) value( global.get( "JaiMemoryCapacity"),JAIInfoImpl.DEFAULT_MemoryCapacity ) );
jai.setMemoryThreshold( (Double) value( global.get( "JaiMemoryThreshold"), JAIInfoImpl.DEFAULT_MemoryThreshold) );
jai.setTileThreads( (Integer) value( global.get( "JaiTileThreads"), JAIInfoImpl.DEFAULT_TileThreads ) );
jai.setTilePriority( (Integer) value( global.get( "JaiTilePriority"), JAIInfoImpl.DEFAULT_TilePriority ) );
jai.setImageIOCache( (Boolean) value( global.get( "ImageIOCache" ), JAIInfoImpl.DEFAULT_ImageIOCache) );
jai.setJpegAcceleration( (Boolean) value( global.get( "JaiJPEGNative" ),JAIInfoImpl.DEFAULT_JPEGNative ) );
jai.setPngAcceleration( (Boolean) value( global.get( "JaiPNGNative" ), JAIInfoImpl.DEFAULT_PNGNative) );
jai.setRecycling( (Boolean) value( global.get( "JaiRecycling" ), JAIInfoImpl.DEFAULT_Recycling) );
jai.setAllowNativeMosaic((Boolean) value( global.get( "JaiMosaicNative" ), JAIInfoImpl.DEFAULT_MosaicNative) );
info.setJAI( jai );
geoServer.setGlobal( info );
//logging
LoggingInfo logging = factory.createLogging();
logging.setLevel( (String) global.get( "log4jConfigFile") );
logging.setLocation( (String) global.get( "logLocation") );
if ( global.get( "suppressStdOutLogging" ) != null ) {