Package cascading.lingual.catalog

Examples of cascading.lingual.catalog.SchemaCatalog


    }

  @Override
  protected Collection<String> performGetNames( PlatformBroker platformBroker )
    {
    SchemaCatalog catalog = platformBroker.getSchemeCatalog();
    String schemaName = getOptions().getSchemaName();

    getSchemaDefChecked( catalog, schemaName, true );

    return catalog.getTableNames( schemaName );
    }
View Full Code Here


    }

  @Override
  protected Map performShow( PlatformBroker platformBroker )
    {
    SchemaCatalog catalog = platformBroker.getSchemeCatalog();
    String schemaName = getOptions().getSchemaName();
    String tableName = getOptions().getTableName();

    SchemaDef schemaDef = getSchemaDefChecked( catalog, schemaName, true );
    TableDef tableDef = schemaDef.getTableChecked( tableName );
View Full Code Here

    getCatalogService().commitCatalog( getCatalogManager().getSchemaCatalog() );
    }

  protected SchemaCatalogManager loadCatalogManager()
    {
    SchemaCatalog catalog = getCatalogService().openSchemaCatalog();

    boolean performInit = catalog == null;

    if( catalog == null )
      catalog = getCatalogService().createSchemaCatalog( getDefaultProtocol(), getDefaultFormat() );

    SchemaCatalogManager catalogManager = new SchemaCatalogManager( catalog );

    catalogManager.setPlatformBroker( this );

    if( performInit )
      catalogManager.initializeNew(); // initialize defaults for a new catalog and root schema

    if( !getName().equals( catalog.getPlatformName() ) )
      throw new IllegalStateException( "catalog was initialized for: " + catalog.getPlatformName() + ", current running on platform: " + getName() );

    // schema and tables beyond here are not persisted in the catalog
    // they are transient to the session
    // todo: wrap transient catalog data around persistent catalog data
    if( getProperties().containsKey( SCHEMAS_PROP ) )
View Full Code Here

    initCatalog();

    catalog( "--schema", DDL_TEST_SCHEMA, "--add", getSchemaPath( DDL_TEST_SCHEMA ) );

    SchemaCatalog catalog = getSchemaCatalog();
    SchemaCatalogManager schemaCatalogManager = platformBroker.getCatalogManager();

    Protocol defaultProtocol = catalog.getSchemaDef( DDL_TEST_SCHEMA ).findDefaultProtocol();

    DDLParser parser = new DDLParser( schemaCatalogManager, DDL_TEST_SCHEMA, defaultProtocol.toString(), "csv" );

    File testFile = new File( DDL_FILE );

    assertTrue( "test file " + testFile + "not found in " + new File( "" ).getAbsolutePath(), testFile.exists() );

    parser.apply( new File( DDL_FILE ) );

    Set<String> tables = new HashSet<String>( catalog.getTableNames( DDL_TEST_SCHEMA ) );

    assertTrue( Sets.difference( tables, expectedTables ).size() == 0 );

    String jsonFirst = writeObject( catalog );
View Full Code Here

  protected void addTable( String schemaName, String tableName, String identifier, Fields fields, String protocolName, String formatName ) throws Exception
    {
    LingualConnection connection = (LingualConnection) getConnection();

    SchemaCatalogManager catalogManager = connection.getPlatformBroker().getCatalogManager();
    SchemaCatalog schemaCatalog = catalogManager.getSchemaCatalog();

    if( !schemaCatalog.schemaExists( schemaName ) )
      schemaCatalog.addSchemaDef( schemaName, Protocol.getProtocol( protocolName ), Format.getFormat( formatName ), null );

    catalogManager.createTableDefFor( schemaName, tableName, identifier, fields, protocolName, formatName );

    catalogManager.addSchemasTo( connection );
    }
View Full Code Here

    }

  @Override
  protected boolean performRename( PlatformBroker platformBroker )
    {
    SchemaCatalog catalog = platformBroker.getSchemeCatalog();

    return catalog.renameRepository( getOptions().getRepoName(), getOptions().getRenameName() );
    }
View Full Code Here

    }

  @Override
  protected boolean performRemove( PlatformBroker platformBroker )
    {
    SchemaCatalog catalog = platformBroker.getSchemeCatalog();
    String repoName = getOptions().getRepoName();

    catalog.removeRepository( repoName );

    return true;
    }
View Full Code Here

    }

  @Override
  protected Map performShow( PlatformBroker platformBroker )
    {
    SchemaCatalog catalog = platformBroker.getSchemeCatalog();
    String repoName = getOptions().getRepoName();
    Repo repo = catalog.getRepository( repoName );

    if( repo == null )
      return null;

    return new RepoBuilder().format( repo );
View Full Code Here

    }

  private TableDef createTableFor( SchemaCatalogManager catalogManager, Ref head, String identifier )
    {
    String stereotypeName = head.name;
    SchemaCatalog schemaCatalog = catalogManager.getSchemaCatalog();
    Stereotype stereotype = schemaCatalog.getStereoTypeFor( null, head.fields );

    if( stereotype != null )
      stereotypeName = stereotype.getName();
    else
      schemaCatalog.createStereotype( null, stereotypeName, head.fields );

    Protocol protocol = schemaCatalog.getDefaultProtocol();
    Format format = schemaCatalog.getDefaultFormat();

    String tableName = catalogManager.createTableDefFor( null, head.name, identifier, stereotypeName, protocol, format );

    return schemaCatalog.getTableDef( null, tableName );
    }
View Full Code Here

TOP

Related Classes of cascading.lingual.catalog.SchemaCatalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.