/** * @param <T> * @param worker * @param url * must be valid * @return some object from the url * @throws IOException */ public static <T> T retrieve( Worker<T> worker, DURL url ) throws IOException { return worker.work( url.openStream() ); }
if ( schemaFile != null ) { try { StreamSource origSchema = new StreamSource( new DURL( schemaFile.toExternalForm() ).openStream(), schemaFile.toExternalForm() ); URL descUrl = JAXBUtils.class.getResource( "/META-INF/schemas/commons/description/3.4.0/description.xsd" ); URL spatUrl = JAXBUtils.class.getResource( "/META-INF/schemas/commons/spatialmetadata/3.4.0/spatialmetadata.xsd" ); URL layUrl = JAXBUtils.class.getResource( "/META-INF/schemas/layers/base/3.4.0/base.xsd" ); StreamSource desc = new StreamSource( new DURL( descUrl.toExternalForm() ).openStream(), descUrl.toExternalForm() ); List<Source> list = new ArrayList<Source>(); list.add( desc ); if ( spatUrl != null ) { StreamSource spat = new StreamSource( new DURL( spatUrl.toExternalForm() ).openStream(), spatUrl.toExternalForm() ); list.add( spat ); StreamSource lay = new StreamSource( new DURL( layUrl.toExternalForm() ).openStream(), layUrl.toExternalForm() ); list.add( lay );
METADATA_CONFIG_SCHEMA, new DURL( mdurl.toExternalForm() ).openStream(), workspace ) ).getValue() ); } catch ( Exception e ) { CONTROLLER_CONFIG_SCHEMA, new DURL( main.toURI().toURL().toExternalForm() ).openStream(), workspace ) ).getValue() ); } catch ( Exception e ) {
DeegreeCRSStoreConfig config = (DeegreeCRSStoreConfig) unmarshall( CONFIG_JAXB_PACKAGE, CONFIG_SCHEMA, new DURL( configURL.toExternalForm() ).openStream(), workspace ); XMLAdapter adapter = new XMLAdapter();
@Override public CRSStore getCRSStore( URL configURL, Workspace workspace ) throws CRSStoreException { try { PROJ4CRSStoreConfig config = (PROJ4CRSStoreConfig) unmarshall( CONFIG_JAXB_PACKAGE, CONFIG_SCHEMA, new DURL( configURL.toExternalForm() ).openStream(), workspace ); PROJ4CRSStore crsStore = new PROJ4CRSStore( DSTransform.fromSchema( config ) ); ProjFileResource resource = null; XMLAdapter adapter = new XMLAdapter( configURL ); URL fileUrl = adapter.resolve( config.getFile() ); resource = new ProjFileResource( new File( fileUrl.toExternalForm() ) ); crsStore.setResolver( resource ); return crsStore; } catch ( JAXBException e ) { String msg = "Error in proj4 crs store configuration file '" + configURL + "': " + e.getMessage(); LOG.error( msg ); throw new CRSStoreException( msg, e ); } catch ( Exception e ) { String msg = "Error in file declaraition inproj4 crs store configuration file '" + configURL + "': " + e.getMessage(); LOG.error( msg ); throw new CRSStoreException( msg, e ); } }
GMLCRSStoreConfig config = (GMLCRSStoreConfig) unmarshall( CONFIG_JAXB_PACKAGE, CONFIG_SCHEMA, new DURL( configURL.toExternalForm() ).openStream(), workspace );