Package org.teiid.metadata

Examples of org.teiid.metadata.Procedure


    }
 
  @Override
  public void getMetadata(MetadataFactory metadataFactory,
      WSConnection conn) throws TranslatorException {
    Procedure p = metadataFactory.addProcedure("invoke"); //$NON-NLS-1$
    p.setAnnotation("Invokes a webservice that returns an XML result"); //$NON-NLS-1$

    ProcedureParameter param = metadataFactory.addProcedureParameter("binding", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("The invocation binding (HTTP, SOAP11, SOAP12).  May be set or allowed to default to null to use the default binding."); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);

    param = metadataFactory.addProcedureParameter("action", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("With a SOAP invocation, action sets the SOAPAction.  With HTTP it sets the HTTP Method (GET, POST - default, etc.)."); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);

    //can be one of string, xml, clob
    param = metadataFactory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.XML, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("The XML document or root element that represents the request.  If the ExecutionFactory is configured in with a DefaultServiceMode of MESSAGE, then the SOAP request must contain the entire SOAP message."); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);
   
    param = metadataFactory.addProcedureParameter("endpoint", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("The relative or abolute endpoint to use.  May be set or allowed to default to null to use the default endpoint address."); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);
   
    metadataFactory.addProcedureParameter("result", TypeFacility.RUNTIME_NAMES.XML, Type.ReturnValue, p); //$NON-NLS-1$
   
    p = metadataFactory.addProcedure(INVOKE_HTTP);
    p.setAnnotation("Invokes a webservice that returns an binary result"); //$NON-NLS-1$

    param = metadataFactory.addProcedureParameter("action", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("Sets the HTTP Method (GET, POST - default, etc.)."); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);
View Full Code Here


      String schema, String procName, String definition) {
    Schema s = getSchema(vdbName, vdbVersion, schema);
    if (s == null) {
      return;
    }
    Procedure p = s.getProcedures().get(procName.toUpperCase());
    if (p == null) {
      return;
    }
    DdlPlan.alterProcedureDefinition(this.vdbRepository.getVDB(vdbName, vdbVersion), p, definition);
  }
View Full Code Here

        List<ProcedureParameter> params = new LinkedList<ProcedureParameter>();
        params.add(RealMetadataFactory.createParameter("type", SPParameter.IN, TypeFacility.RUNTIME_NAMES.STRING));
        params.add(RealMetadataFactory.createParameter("start", SPParameter.IN, TypeFacility.RUNTIME_NAMES.TIMESTAMP));
        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

        }
    });
      Mockito.stub(repo.getProcedureDefinition(Mockito.anyString(), Mockito.anyInt(), (Procedure)Mockito.anyObject())).toAnswer(new Answer<String>() {
        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
          Procedure t = (Procedure)invocation.getArguments()[2];
          if (t.getName().equals("proc")) {
            return "create virtual procedure begin select '2011'; end";
          }
          return null;
        }
    });
View Full Code Here

        if (procedureName == null) {
          procedureName = nameInSource;
        }
      }
      String fullProcedureName = getFullyQualifiedName(procedureCatalog, procedureSchema, procedureName);
      Procedure procedure = metadataFactory.addProcedure(useFullSchemaName?fullProcedureName:procedureName);
      procedure.setNameInSource(getFullyQualifiedName(procedureCatalog, procedureSchema, nameInSource, true));
      ResultSet columns = metadata.getProcedureColumns(catalog, procedureSchema, procedureName, null);
      while (columns.next()) {
        String columnName = columns.getString(4);
        short columnType = columns.getShort(5);
        int sqlType = columns.getInt(6);
View Full Code Here

public class OlapExecutionFactory extends ExecutionFactory<DataSource, Connection> {
  private static final String INVOKE_MDX = "invokeMdx"; //$NON-NLS-1$
 
  @Override
  public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException {
    Procedure p = metadataFactory.addProcedure(INVOKE_MDX);
    p.setAnnotation("Invokes a XMLA webservice with provided MDX query that returns an XML result"); //$NON-NLS-1$

    // mdx query in xml form
    ProcedureParameter param = metadataFactory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
    param.setAnnotation("The MDX query to execute"); //$NON-NLS-1$
    param.setNullType(NullType.Nullable);
View Full Code Here

      throws TeiidComponentException, QueryMetadataException {
    List<Procedure> result = new LinkedList<Procedure>();
    int index = name.indexOf(TransformationMetadata.DELIMITER_STRING);
    if (index > -1) {
      String schema = name.substring(0, index);
      Procedure proc = getSchema(schema).getProcedures().get(name.substring(index + 1));
      if (proc != null) {
        result.add(proc);
            return result;
     
    }
View Full Code Here

     */
    public Procedure createProcedureRecord(final char[] record) {

        final String str = new String(record);
        final List<String> tokens = getStrings(str, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
        final Procedure procRd = new Procedure();

        // Extract the index version information from the record
        int indexVersion = getIndexVersion(record);

        // The tokens are the standard header values
        int tokenIndex = 0;

        // Set the record type
        setRecordHeaderValues(procRd, tokens.get(tokenIndex++), tokens.get(tokenIndex++),
                             tokens.get(tokenIndex++), tokens.get(tokenIndex++),
                             tokens.get(tokenIndex++), tokens.get(tokenIndex++));

        // Set the boolean flags
        char[] booleanValues = (tokens.get(tokenIndex++)).toCharArray();
        // flag indicating if the procedure is a function
        procRd.setFunction(getBooleanValue(booleanValues[0]));
        // flag indicating if the procedure is virtual
        procRd.setVirtual(getBooleanValue(booleanValues[1]));

        // The next token are the UUIDs for the param references
        List<String> uuids = getStrings(tokens.get(tokenIndex++), getListDelimiter(indexVersion));
        List<ProcedureParameter> columns = new ArrayList<ProcedureParameter>(uuids.size());
        for (String uuid : uuids) {
          ProcedureParameter column = new ProcedureParameter();
          column.setUUID(uuid);
      columns.add(column);
    }
        procRd.setParameters(columns);

        // The next token is the UUID of the resultSet object
        String rsId = getObjectValue(tokens.get(tokenIndex++));
        if (rsId != null) {
          ColumnSet cs = new ColumnSet();
          cs.setUUID(rsId);
            procRd.setResultSet(cs);
        }
       
        if (includeProcedureUpdateCount(indexVersion)) {
            procRd.setUpdateCount(Integer.parseInt(tokens.get(tokenIndex++)));
        }
       
    // The next tokens are footer values
    setRecordFooterValues(procRd, tokens, tokenIndex);

View Full Code Here

      }

      @Override
      public void visit(AlterProcedure obj) {
        VDBMetaData vdb = workContext.getVDB();
        Procedure p = (Procedure)obj.getTarget().getMetadataID();
        String sql = obj.getDefinition().toString();
      if (pdm.getMetadataRepository() != null) {
        pdm.getMetadataRepository().setProcedureDefinition(workContext.getVdbName(), workContext.getVdbVersion(), p, sql);
      }
        alterProcedureDefinition(vdb, p, sql);
        if (pdm.getEventDistributor() != null) {
          pdm.getEventDistributor().setProcedureDefinition(workContext.getVdbName(), workContext.getVdbVersion(), p.getParent().getName(), p.getName(), sql);
      }
      }
View Full Code Here

        Call proc = (Call) transUtil.parseCommand(sql.toString());
        return proc.getMetadataObject();
    }

    public void testProcedure1() throws Exception {
        Procedure proc = getProcedure("ConnectorMetadata.TestProc1", 2, CONNECTOR_METADATA_UTILITY);      //$NON-NLS-1$
        assertEquals("Procedure name in source", proc.getNameInSource()); //$NON-NLS-1$
       
        String[] nameInSource = new String[] { "Param name in source", null, null, null }; //$NON-NLS-1$
        ProcedureParameter.Type[] direction = new ProcedureParameter.Type[] { ProcedureParameter.Type.In, ProcedureParameter.Type.Out, ProcedureParameter.Type.InOut, ProcedureParameter.Type.ReturnValue };
        int[] index = new int[] { 1, 2, 3, 4 };
        Class<?>[] type = new Class[] { Integer.class, Long.class, Short.class, java.sql.Date.class };       
View Full Code Here

TOP

Related Classes of org.teiid.metadata.Procedure

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.