public <T extends Resource> ResourceBuilder<T> getBuilder( ResourceIdentifier<T> id ) { ResourceBuilder<T> builder = (ResourceBuilder<T>) map.get( workspace.getResourceMetadata( id.getProvider(), id.getId() ) ); if ( builder == null ) { builder = workspace.prepare( id ); } return builder; }
/** * Adds and completely initializes a synthetic resource from string. * * @param workspace * may not be <code>null</code> * @param providerClass * may not be <code>null</code> * @param id * may not be <code>null</code> * @param content * configuration content, may not be <code>null</code> * @return the initialized resource */ public static <T extends Resource> T activateSynthetic( Workspace workspace, Class<? extends ResourceProvider<T>> providerClass, String id, String content ) { IncorporealResourceLocation<? extends Resource> loc; ResourceIdentifier<T> identifier = new DefaultResourceIdentifier<T>( providerClass, id ); Charset cs = Charset.forName( "UTF-8" ); loc = new IncorporealResourceLocation<T>( content.getBytes( cs ), identifier ); workspace.add( loc ); workspace.prepare( identifier ); return workspace.init( identifier, null ); }
"unknown" ); ws.add( new DefaultResourceLocation<FeatureStore>( new File( storeFile ), identifier ) ); ws.prepare( identifier ); FeatureStore store = ws.init( identifier, null );
ws.initAll(); ws.add( loc ); ws.prepare( id ); SQLFeatureStore fs = (SQLFeatureStore) ws.init( id, null ); String[] sql = DDLCreator.newInstance( fs.getSchema(), fs.getDialect() ).getDDL();
/** * Adds and completely initializes a synthetic resource from an URL. * * @param workspace * may not be <code>null</code> * @param providerClass * may not be <code>null</code> * @param id * may not be <code>null</code> * @param content * configuration content, may not be <code>null</code> * @return the initialized resource */ public static <T extends Resource> T activateFromUrl( Workspace workspace, Class<? extends ResourceProvider<T>> providerClass, String id, URL content ) { IncorporealResourceLocation<? extends Resource> loc; ResourceIdentifier<T> identifier = new DefaultResourceIdentifier<T>( providerClass, id ); try { loc = new IncorporealResourceLocation<T>( IOUtils.toByteArray( content ), identifier ); workspace.add( loc ); workspace.prepare( identifier ); return workspace.init( identifier, null ); } catch ( Exception e ) { throw new ResourceInitException( "Unable to load URL " + content + ": " + e.getLocalizedMessage(), e ); } }
/** * Adds and completely initializes a synthetic resource from file. * * @param workspace * may not be <code>null</code> * @param providerClass * may not be <code>null</code> * @param id * may not be <code>null</code> * @param content * configuration content, may not be <code>null</code> * @return the initialized resource */ public static <T extends Resource> T activateFromFile( Workspace workspace, Class<? extends ResourceProvider<T>> providerClass, String id, File content ) { DefaultResourceLocation<? extends Resource> loc; ResourceIdentifier<T> identifier = new DefaultResourceIdentifier<T>( providerClass, id ); loc = new DefaultResourceLocation<T>( content, identifier ); workspace.add( loc ); workspace.prepare( identifier ); return workspace.init( identifier, null ); }