Package org.teiid.metadata

Examples of org.teiid.metadata.MetadataFactory


  private TransformationMetadata exampleTransformationMetadata()
      throws TranslatorException {
    Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
        datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
    MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
    mf.addProcedure("y"); //$NON-NLS-1$
   
    Table t = mf.addTable("foo");
    mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
   
    MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
    mf1.addProcedure("y"); //$NON-NLS-1$
   
    Table table = mf1.addTable("doc");
    table.setSchemaPaths(Arrays.asList("../../x.xsd"));
    table.setResourcePath("/a/b/doc.xmi");
   
    HashMap<String, Resource> resources = new HashMap<String, Resource>();
    resources.put("/x.xsd", new Resource(Mockito.mock(VirtualFile.class), true));
   
    CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
   
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("vdb");
    vdb.setVersion(1);
   
View Full Code Here


  }
 
  @Test public void testAmbiguousTableWithPrivateModel() throws Exception {
    Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
        datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
    MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
    mf.addTable("y"); //$NON-NLS-1$
    MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
    mf1.addTable("y"); //$NON-NLS-1$
    CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
   
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("foo");
    vdb.setVersion(1);
   
View Full Code Here

      }
      return sb.toString();
    }
   
    public MetadataStore getMetadata(String modelName, Map<String, Datatype> datatypes, Properties importProperties) throws TranslatorException {
    MetadataFactory factory = new MetadataFactory(modelName, datatypes, importProperties);
    Object connectionFactory = getConnectionFactory();
    Object connection = executionFactory.getConnection(connectionFactory);
    Object unwrapped = null;
   
    if (connection instanceof WrappedConnection) {
      try {
        unwrapped = ((WrappedConnection)connection).unwrap();
      } catch (ResourceException e) {
        throw new TranslatorException(QueryPlugin.Util.getString("failed_to_unwrap_connection")); //$NON-NLS-1$
     
    }
   
    try {
      executionFactory.getMetadata(factory, (unwrapped == null) ? connection:unwrapped);
    } finally {
      executionFactory.closeConnection(connection, connectionFactory);
    }
    return factory.getMetadataStore();
  }   
View Full Code Here

@SuppressWarnings("nls")
public class TestDymamicImportedMetaData {

  private MetadataFactory getMetadata(Properties importProperties, Connection conn)
      throws TranslatorException {
    MetadataFactory mf = createMetadataFactory("test", importProperties);
     
      TeiidExecutionFactory tef = new TeiidExecutionFactory();
      tef.getMetadata(mf, conn);
      return mf;
  }
View Full Code Here

  }

  private MetadataFactory createMetadataFactory(String schema, Properties importProperties) {
    VDBRepository vdbRepository = new VDBRepository();
      vdbRepository.setSystemStore(VDBMetadataFactory.getSystem());
      return new MetadataFactory(schema, vdbRepository.getBuiltinDatatypes(), importProperties);
  }
View Full Code Here

      server.deployVDB("vdb", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb");
      Connection conn = server.createConnection("jdbc:teiid:vdb"); //$NON-NLS-1$
     
      Properties importProperties = new Properties();
      importProperties.setProperty("importer.importProcedures", Boolean.TRUE.toString());
      MetadataFactory mf = getMetadata(importProperties, conn);
      Procedure p = mf.getMetadataStore().getSchemas().get("TEST").getProcedures().get("VDB.SYS.GETXMLSCHEMAS");
      assertEquals(1, p.getResultSet().getColumns().size());
    }
View Full Code Here

      assertEquals(1, p.getResultSet().getColumns().size());
    }
   
    @Test public void testDuplicatException() throws Exception {
      FakeServer server = new FakeServer();
      MetadataFactory mf = createMetadataFactory("x", new Properties());
      MetadataFactory mf1 = createMetadataFactory("y", new Properties());
     
      Table dup = mf.addTable("dup");
      Table dup1 = mf1.addTable("dup");
     
      mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
      mf1.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup1);
     
      MetadataStore ms = mf.getMetadataStore();
      ms.addSchema(mf1.getMetadataStore().getSchemas().values().iterator().next());
     
      server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
      Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
     
      Properties importProperties = new Properties();
View Full Code Here

TOP

Related Classes of org.teiid.metadata.MetadataFactory

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.