@Override public Collection<String> getRepositoryNames() { return repositories.keySet(); }
@Override public Collection<Repo> getRepositories() { return repositories.values(); }
public void addTable( String name, String identifier, Stereotype<Protocol, Format> stereotype, Protocol protocol, Format format ) { if( childTables.containsKey( name ) ) throw new IllegalArgumentException( "table named: " + childTables.get( name ).getName() + " already exists in schema: " + getName() ); LOG.debug( "adding table: {}, to schema: {}", name, getName() ); childTables.put( name, new TableDef( this, name, identifier, stereotype, protocol, format ) ); }
public boolean addSchema( String name, Protocol protocol, Format format, String identifier ) { if( childSchemas.containsKey( name ) ) return false; childSchemas.put( name, new SchemaDef( this, name, protocol, format, identifier ) ); return true; }
public boolean removeProviderDef( String providerDefName ) { providers.remove( providerDefName ); return true; }
@Override public Repo getRepository( String repoName ) { return repositories.get( repoName ); }
@Override public int hashCode() { int result = repositories != null ? repositories.hashCode() : 0; result = 31 * result + ( rootSchemaDef != null ? rootSchemaDef.hashCode() : 0 ); return result; } }
public Map<String, Map<String, List<String>>> findProviderFormatProperties( Format format ) { Map<String, Map<String, List<String>>> foundProviders = new HashMap<String, Map<String, List<String>>>(); // parent first, schemes can override providers by name if( !isRoot() ) foundProviders.putAll( getParentSchema().findProviderFormatProperties( format ) ); for( Map.Entry<String, ProviderDef> entry : providers.entrySet() ) { Map<Format, Map<String, List<String>>> properties = entry.getValue().getFormatProperties(); if( properties.containsKey( format ) ) foundProviders.put( entry.getKey(), properties.get( format ) ); } return foundProviders; }
@Override public boolean equals( Object object ) { if( this == object ) return true; if( object == null || !JSONSchemaCatalog.class.isAssignableFrom( object.getClass() ) ) return false; JSONSchemaCatalog that = (JSONSchemaCatalog) object; if( repositories != null ? !repositories.equals( that.repositories ) : that.repositories != null ) return false; if( rootSchemaDef != null ? !rootSchemaDef.equals( that.rootSchemaDef ) : that.rootSchemaDef != null ) return false; return true; }
@Override public void addRepository( Repo repo ) { repositories.put( repo.getRepoName(), repo ); }
public void addProviderDef( ProviderDef providerDef ) { if( providers.containsKey( providerDef.getName() ) ) throw new IllegalArgumentException( "provider named: " + providerDef.getName() + " already exists in schema: " + getName() ); LOG.debug( "adding provider: {}, to schema: {}", providerDef.toString(), getName() ); providers.put( providerDef.getName(), providerDef ); }
@Override public void removeRepository( String repoName ) { repositories.remove( repoName ); }
public SchemaDef getSchema( String schemaName ) { return childSchemas.get( schemaName ); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + ( stereotypes != null ? stereotypes.hashCode() : 0 ); result = 31 * result + ( childSchemas != null ? childSchemas.hashCode() : 0 ); result = 31 * result + ( childTables != null ? childTables.hashCode() : 0 ); result = 31 * result + ( protocolProperties != null ? protocolProperties.hashCode() : 0 ); result = 31 * result + ( formatProperties != null ? formatProperties.hashCode() : 0 ); return result; } }
public Map<String, Map<String, List<String>>> findProviderProtocolProperties( Protocol protocol ) { Map<String, Map<String, List<String>>> foundProviders = new HashMap<String, Map<String, List<String>>>(); // parent first, schemes can override providers by name if( !isRoot() ) foundProviders.putAll( getParentSchema().findProviderProtocolProperties( protocol ) ); for( Map.Entry<String, ProviderDef> entry : providers.entrySet() ) { Map<Protocol, Map<String, List<String>>> properties = entry.getValue().getProtocolProperties(); if( properties.containsKey( protocol ) ) foundProviders.put( entry.getKey(), properties.get( protocol ) ); } return foundProviders; }
@Override public boolean equals( Object object ) { if( this == object ) return true; if( !( object instanceof SchemaDef ) ) return false; if( !super.equals( object ) ) return false; SchemaDef schemaDef = (SchemaDef) object; if( childSchemas != null ? !childSchemas.equals( schemaDef.childSchemas ) : schemaDef.childSchemas != null ) return false; if( childTables != null ? !childTables.equals( schemaDef.childTables ) : schemaDef.childTables != null ) return false; if( formatProperties != null ? !formatProperties.equals( schemaDef.formatProperties ) : schemaDef.formatProperties != null ) return false; if( protocolProperties != null ? !protocolProperties.equals( schemaDef.protocolProperties ) : schemaDef.protocolProperties != null ) return false; if( stereotypes != null ? !stereotypes.equals( schemaDef.stereotypes ) : schemaDef.stereotypes != null ) return false; return true; }
protected Collection<TableDef> getChildTables() { return childTables.values(); }
public boolean removeSchema( String schemaName ) { return childSchemas.remove( schemaName ) != null; }