All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geoserver.config.util.ServiceLoader Maven / Gradle / Ivy

The newest version!
package org.geoserver.config.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.geoserver.catalog.MetadataLinkInfo;
import org.geoserver.catalog.util.ReaderUtils;
import org.geoserver.config.GeoServer;
import org.geoserver.config.ServiceInfo;
import org.vfny.geoserver.global.MetaDataLink;
import org.w3c.dom.Element;

/**
 * Extension point for loading services from the services.xml file.
 * 

* Instances of this class are registered in a spring context: *

 * <bean id="org.geoserver.wfs.WFSLoader"/>
 * 
*

* * @author Justin Deoliveira, The Open Planning Project * */ public abstract class ServiceLoader { /** * Creates the service configuration object. * * @param reader The services.xml reader. * */ abstract public ServiceInfo load( LegacyServicesReader reader, GeoServer geoServer ) throws Exception; /** * Reads all the common attributes from the service info class. *

* This method is intended to be called by subclasses after creating an * instance of ServiceInfo. Example: *

     *   // read properties
     *   Map props = reader.wfs();
     *   
     *   // create config object
     *   WFSInfo wfs = new WFSInfoImpl();
     *   
     *   //load common properties
     *   load( wfs, reader );
     * 
     *   //load wfs specific properties
     *   wfs.setServiceLevel( map.get( "serviceLevel") );
     *   ...
     * 
*

*/ protected void load( ServiceInfo service, Map properties, GeoServer gs) throws Exception { service.setEnabled( (Boolean) properties.get( "enabled") ); service.setName( (String) properties.get( "name") ); service.setTitle( (String) properties.get( "title") ); service.setAbstract( (String) properties.get( "abstract") ); Map metadataLink = (Map) properties.get("metadataLink"); if ( metadataLink != null ) { MetadataLinkInfo ml = gs.getCatalog().getFactory().createMetadataLink(); ml.setAbout( (String) metadataLink.get( "about" ) ); ml.setMetadataType( (String) metadataLink.get( "metadataType" ) ); ml.setType( (String) metadataLink.get( "type" ) ); service.setMetadataLink( ml ); } List keywords = (List) properties.get( "keywords" ); if ( keywords != null ) { service.getKeywords().addAll( keywords ); } service.setOnlineResource( (String) properties.get( "onlineResource" ) ); service.setFees( (String) properties.get( "fees" ) ); service.setAccessConstraints( (String) properties.get( "accessConstraints" ) ); service.setCiteCompliant((Boolean)properties.get( "citeConformanceHacks")); service.setMaintainer((String)properties.get( "maintainer" ) ); service.setSchemaBaseURL((String)properties.get("SchemaBaseUrl")); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy