Package org.teiid.query.metadata

Examples of org.teiid.query.metadata.CompositeMetadataStore


      for (Map.Entry<String, Collection<FunctionMethod>> entry : udf.getFunctions().entrySet()) {
        udfs.add(new FunctionTree(entry.getKey(), new UDFSource(entry.getValue()), true));
      }
    }
   
    CompositeMetadataStore compositeStore = new CompositeMetadataStore(stores.getStores());
    for (MetadataStore s:additionalStores) {
      compositeStore.addMetadataStore(s);
      for (Schema schema:s.getSchemas().values()) {
        if (!schema.getFunctions().isEmpty()) {
          udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true));
        }
      }
View Full Code Here


        params.add(RealMetadataFactory.createParameter("end", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
       
        Procedure getUpdated = RealMetadataFactory.createStoredProcedure("GetUpdated", salesforceModel, params, "GetUpdated");
        getUpdated.setResultSet(RealMetadataFactory.createResultSet("rs", new String[] {"updated"}, new String[] {TypeFacility.RUNTIME_NAMES.STRING}));
       
        return new TransformationMetadata(null, new CompositeMetadataStore(store), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
    }   
View Full Code Here

        cols.get(1).setAutoIncremented(true);
        cols.get(1).setNameInSource("ID:SEQUENCE=MYSEQUENCE.nextVal"); //$NON-NLS-1$
        cols.get(2).setNativeType("date"); //$NON-NLS-1$
        RealMetadataFactory.createElements(dual, new String[] {"something"}, new String[] {DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$
       
        CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
        return new TransformationMetadata(null, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
    }
View Full Code Here

        List<Column> cols =RealMetadataFactory.createElements(table, elemNames, elemTypes);
       
        Column obj = cols.get(0);
        obj.setNativeType("uniqueidentifier"); //$NON-NLS-1$
       
        CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
        QueryMetadataInterface metadata = new TransformationMetadata(null, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
       
        TranslationUtility tu = new TranslationUtility(metadata);
        Command command = tu.parseCommand("select max(x) from bar"); //$NON-NLS-1$
        TranslationHelper.helpTestVisitor("SELECT MAX(cast(bar.x as char(36))) FROM bar", trans, command); //$NON-NLS-1$
View Full Code Here

        String schema = FileUtils.getFilenameWithoutExtension(udfFile.getPath());
        methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
        trees = Arrays.asList(new FunctionTree(schema, new UDFSource(methods), true));
      }
      SystemFunctionManager sfm = new SystemFunctionManager();
      vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(getSystem(), imf.getMetadataStore(getSystem().getDatatypes()))), imf.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
      VDB_CACHE.put(vdbURL, vdbmetadata);
      return vdbmetadata;
    } catch (URISyntaxException e) {
      throw new IOException(e);
    } catch (JAXBException e) {
View Full Code Here

        for(int i=1; i<2; i++) {
            cols.get(i).setSearchType(SearchType.Unsearchable);
        }
       
        // Create the facade from the store
        return new TransformationMetadata(null, new CompositeMetadataStore(metadataStore), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
    }   
View Full Code Here

    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

        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

  private TupleSource processSystemQuery(CommandContext context, Command command,
      DQPWorkContext workContext) throws TeiidComponentException, TeiidProcessingException {
    String vdbName = workContext.getVdbName();
    int vdbVersion = workContext.getVdbVersion();
    VDBMetaData vdb = workContext.getVDB();
    CompositeMetadataStore metadata = vdb.getAttachment(TransformationMetadata.class).getMetadataStore();
    TransformationMetadata indexMetadata = vdb.getAttachment(TransformationMetadata.class);
    Collection rows = new ArrayList();
    int oid = 1;
    if (command instanceof Query) {
      Query query = (Query)command;
      UnaryFromClause ufc = (UnaryFromClause)query.getFrom().getClauses().get(0);
      GroupSymbol group = ufc.getGroup();
      if (StringUtil.startsWithIgnoreCase(group.getNonCorrelationName(), CoreConstants.SYSTEM_ADMIN_MODEL)) {
        final SystemAdminTables sysTable = SystemAdminTables.valueOf(group.getNonCorrelationName().substring(CoreConstants.SYSTEM_ADMIN_MODEL.length() + 1).toUpperCase());
        switch (sysTable) {
        case MATVIEWS:
          for (Schema schema : getVisibleSchemas(vdb, metadata)) {
            for (Table table : schema.getTables().values()) {
              if (!table.isMaterialized()) {
                continue;
              }
              String targetSchema = null;
              String matTableName = null;
              String state = null;
              Timestamp updated = null;
              Integer cardinaltity = null;
              Boolean valid = null;
              if (table.getMaterializedTable() == null) {
                TempTableStore globalStore = context.getGlobalTableStore();
                matTableName = RelationalPlanner.MAT_PREFIX+table.getFullName().toUpperCase();
                MatTableInfo info = globalStore.getMatTableInfo(matTableName);
                valid = info.isValid();
                state = info.getState().name();
                updated = info.getUpdateTime()==-1?null:new Timestamp(info.getUpdateTime());
                TempMetadataID id = globalStore.getMetadataStore().getTempGroupID(matTableName);
                if (id != null) {
                  cardinaltity = id.getCardinality();
                }
                //ttl, pref_mem - not part of proper metadata
              } else {
                Table t = table.getMaterializedTable();
                matTableName = t.getName();
                targetSchema = t.getParent().getName();
              }
              rows.add(Arrays.asList(vdbName, schema.getName(), table.getName(), targetSchema, matTableName, valid, state, updated, cardinaltity));
            }
          }
          break;
        case VDBRESOURCES:
          String[] filePaths = indexMetadata.getVDBResourcePaths();
              for (String filePath : filePaths) {
                rows.add(Arrays.asList(filePath, new BlobType(indexMetadata.getVDBResourceAsBlob(filePath))));
              }
          break;
        }
        return new CollectionTupleSource(rows.iterator());
      }
      final SystemTables sysTable = SystemTables.valueOf(group.getNonCorrelationName().substring(CoreConstants.SYSTEM_MODEL.length() + 1).toUpperCase());
      switch (sysTable) {
      case DATATYPES:
        for (Datatype datatype : metadata.getDatatypes()) {
          rows.add(Arrays.asList(datatype.getName(), datatype.isBuiltin(), datatype.isBuiltin(), datatype.getName(), datatype.getJavaClassName(), datatype.getScale(),
              datatype.getLength(), datatype.getNullType().toString(), datatype.isSigned(), datatype.isAutoIncrement(), datatype.isCaseSensitive(), datatype.getPrecisionLength(),
              datatype.getRadix(), datatype.getSearchType().toString(), datatype.getUUID(), datatype.getRuntimeTypeName(), datatype.getBasetypeName(), datatype.getAnnotation(), oid++));
        }
        break;
View Full Code Here

    return createTransformationMetadata(exampleBQTStore(), "bqt")
  }
   

  public static TransformationMetadata createTransformationMetadata(MetadataStore metadataStore, String vdbName) {
    CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
      VDBMetaData vdbMetaData = new VDBMetaData();
      vdbMetaData.setName(vdbName); //$NON-NLS-1$
      vdbMetaData.setVersion(1);
      List<FunctionTree> udfs = new ArrayList<FunctionTree>();
      for (Schema schema : metadataStore.getSchemas().values()) {
View Full Code Here

TOP

Related Classes of org.teiid.query.metadata.CompositeMetadataStore

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.