private static ModelBackend<?> getModelBackend( CommandLine line ) throws UnsupportedOperationException, DatasourceException { String id = "1"; if ( workspace.getResource( ConnectionProviderProvider.class, id ) == null ) { ResourceLocation<ConnectionProvider> loc = getSyntheticProvider( id, line.getOptionValue( DB_HOST ), line.getOptionValue( OPT_DB_USER ), line.getOptionValue( OPT_DB_PASS ) ); workspace.getLocationHandler().addExtraResource( loc ); } return ModelBackend.getInstance( id, null ); }
@Override public void find() { LOG.info( "--------------------------------------------------------------------------------" ); LOG.info( "Scanning for {}.", metadata.getName() ); LOG.info( "--------------------------------------------------------------------------------" ); List<ResourceLocation<T>> list = workspace.getLocationHandler().findResourceLocations( metadata ); read( list ); Iterator<ResourceProvider<T>> iter = nsToProvider.values().iterator(); while ( iter.hasNext() ) { ResourceProvider<T> prov = iter.next(); try { for ( ResourceMetadata<T> md : prov.getAdditionalResources( workspace ) ) { // only overrides if the resource has not been overridden if ( !metadataMap.containsKey( md.getIdentifier() ) ) { metadataMap.put( md.getIdentifier(), md ); } } } catch ( Exception e ) { LOG.error( "Unable to obtain additional resources from {}: {}", prov.getClass().getSimpleName(), e.getLocalizedMessage() ); LOG.trace( "Stack trace:", e ); } } }
private static ModelBackend<?> getModelBackend( CommandLine line ) throws UnsupportedOperationException, DatasourceException { String id = "1"; if ( workspace.getResource( ConnectionProviderProvider.class, id ) == null ) { ResourceLocation<ConnectionProvider> loc = getSyntheticProvider( id, line.getOptionValue( DB_HOST ), line.getOptionValue( OPT_DB_USER ), line.getOptionValue( OPT_DB_PASS ) ); workspace.getLocationHandler().addExtraResource( loc ); } return ModelBackend.getInstance( id, null ); }
line.getOptionValue( OPT_DB_USER ), line.getOptionValue( OPT_DB_PASS ) ); workspace.getLocationHandler().addExtraResource( loc );
ResourceLocation<ConnectionProvider> loc = ConnectionProviderUtils.getSyntheticProvider( db_id, con, user, pass ); workspace.getLocationHandler().addExtraResource( loc ); workspace.initAll(); connProvider = workspace.getResource( ConnectionProviderProvider.class, db_id );
ResourceLocation<ConnectionProvider> loc = ConnectionProviderUtils.getSyntheticProvider( id, dbURL, user, pass ); workspace.getLocationHandler().addExtraResource( loc );
file.mkdir(); Workspace workspace = new DefaultWorkspace( file ); workspace.getLocationHandler().addExtraResource( ConnectionProviderUtils.getSyntheticProvider( "style", url, user, pass ) );
/** * Simple importer for SE files, with hardcoded 'configtool' on localhost. * * @param args * @throws XMLStreamException * @throws FactoryConfigurationError * @throws IOException */ public static void main( String[] args ) throws XMLStreamException, FactoryConfigurationError, IOException { Style style = new SymbologyParser( true ).parse( XMLInputFactory.newInstance().createXMLStreamReader( new FileInputStream( args[0] ) ) ); Workspace workspace = new DefaultWorkspace( new File( "nonexistant" ) ); ResourceLocation<ConnectionProvider> loc = ConnectionProviderUtils.getSyntheticProvider( "configtool", "jdbc:postgresql://localhost/configtool", "postgres", "postgres" ); workspace.getLocationHandler().addExtraResource( loc ); workspace.initAll(); if ( style.isSimple() ) { new PostgreSQLWriter( "configtool", "schematest", workspace ).write( style, null ); } else { new PostgreSQLWriter( "configtool", "schematest", workspace ).write( new FileInputStream( args[0] ), style.getName() ); } workspace.destroy(); }
user, pass ); workspace.startup(); workspace.getLocationHandler().addExtraResource( loc ); workspace.initAll();