use of org.teiid.metadata.Procedure in project teiid by teiid.
the class S3ExecutionFactory method addGetTextFileMethod.
private void addGetTextFileMethod(MetadataFactory metadataFactory) {
Procedure p = metadataFactory.addProcedure(GETTEXTFILE);
// $NON-NLS-1$
p.setAnnotation("Returns text files that match the given path as CLOBs");
// $NON-NLS-1$
ProcedureParameter param = metadataFactory.addProcedureParameter("name", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("The name of the file to return. Currently the patterns like *.<ext> are not supported");
addCommonParameters(metadataFactory, p);
// $NON-NLS-1$
param = metadataFactory.addProcedureParameter("encryption", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("Server side encryption algorithm used");
param.setNullType(NullType.Nullable);
// $NON-NLS-1$
param = metadataFactory.addProcedureParameter("encryptionkey", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("Server side encryption key to decrypt the object");
param.setNullType(NullType.Nullable);
// $NON-NLS-1$
param = metadataFactory.addProcedureParameter("stream", TypeFacility.RUNTIME_NAMES.BOOLEAN, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("If the result should be streamed.");
param.setNullType(NullType.Nullable);
// $NON-NLS-1$
param.setDefaultValue("false");
// $NON-NLS-1$
metadataFactory.addProcedureResultSetColumn("file", TypeFacility.RUNTIME_NAMES.CLOB, p);
// $NON-NLS-1$
metadataFactory.addProcedureResultSetColumn("endpoint", TypeFacility.RUNTIME_NAMES.STRING, p);
// $NON-NLS-1$
metadataFactory.addProcedureResultSetColumn("lastModified", TypeFacility.RUNTIME_NAMES.TIMESTAMP, p);
// $NON-NLS-1$
metadataFactory.addProcedureResultSetColumn("etag", TypeFacility.RUNTIME_NAMES.STRING, p);
// $NON-NLS-1$
metadataFactory.addProcedureResultSetColumn("size", TypeFacility.RUNTIME_NAMES.LONG, p);
}
use of org.teiid.metadata.Procedure in project teiid by teiid.
the class CouchbaseMetadataProcessor method addProcedures.
protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) {
Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS);
// $NON-NLS-1$
getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation"));
ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments);
param.setNullType(No_Nulls);
// $NON-NLS-1$
param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation"));
param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments);
param.setNullType(No_Nulls);
// $NON-NLS-1$
param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation"));
metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments);
Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT);
// $NON-NLS-1$
getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation"));
param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument);
param.setNullType(No_Nulls);
// $NON-NLS-1$
param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation"));
param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument);
param.setNullType(No_Nulls);
// $NON-NLS-1$
param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation"));
metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument);
}
use of org.teiid.metadata.Procedure in project teiid by teiid.
the class FunctionTree method getFunctionProcedures.
public static FunctionTree getFunctionProcedures(Schema schema) {
UDFSource dummySource = new UDFSource(Collections.EMPTY_LIST);
FunctionTree ft = null;
for (Procedure p : schema.getProcedures().values()) {
if (p.isFunction() && p.getQueryPlan() != null) {
if (ft == null) {
ft = new FunctionTree(schema.getName(), dummySource, false);
}
FunctionMethod fm = SQLParserUtil.createFunctionMethod(p);
FunctionDescriptor fd = ft.addFunction(schema.getName(), dummySource, fm, false);
fd.setProcedure(p);
}
}
return ft;
}
use of org.teiid.metadata.Procedure in project teiid by teiid.
the class CompositeMetadataStore method assignOids.
private void assignOids(Schema schema, TreeMap<String, RecordHolder> map) {
addOid(schema, map);
for (Table table : schema.getTables().values()) {
addOid(table, map);
addOids(table.getColumns(), map);
addOids(table.getAllKeys(), map);
}
for (Procedure proc : schema.getProcedures().values()) {
addOid(proc, map);
addOids(proc.getParameters(), map);
if (proc.getResultSet() != null) {
addOids(proc.getResultSet().getColumns(), map);
}
}
for (FunctionMethod func : schema.getFunctions().values()) {
addOid(func, map);
addOids(func.getInputParameters(), map);
addOid(func.getOutputParameter(), map);
}
}
use of org.teiid.metadata.Procedure in project teiid by teiid.
the class CompositeMetadataStore method getStoredProcedure.
public Collection<Procedure> getStoredProcedure(String name) throws TeiidComponentException, QueryMetadataException {
List<Procedure> result = new LinkedList<Procedure>();
int index = name.indexOf(TransformationMetadata.DELIMITER_STRING);
if (index > -1) {
String schemaName = name.substring(0, index);
Schema schema = getSchema(schemaName);
if (schema != null) {
Procedure proc = schema.getProcedures().get(name.substring(index + 1));
if (proc != null) {
result.add(proc);
return result;
}
}
}
// assume it's a partial name
for (Schema schema : getSchemas().values()) {
for (Procedure p : schema.getProcedures().values()) {
if (matchesPartialName(name, p.getName(), schema)) {
result.add(p);
}
}
}
return result;
}
Aggregations