use of org.teiid.metadata.ProcedureParameter 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.ProcedureParameter 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.ProcedureParameter in project teiid by teiid.
the class DirectQueryMetadataRepository method loadMetadata.
@Override
public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException {
if (executionFactory != null && executionFactory.supportsDirectQueryProcedure() && factory.getSchema().getProcedure(executionFactory.getDirectQueryProcedureName()) == null) {
Procedure p = factory.addProcedure(executionFactory.getDirectQueryProcedureName());
// $NON-NLS-1$
p.setAnnotation("Invokes translator with a native query that returns results in an array of values");
// $NON-NLS-1$
ProcedureParameter param = factory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("The native query to execute");
param.setNullType(NullType.No_Nulls);
// $NON-NLS-1$
param = factory.addProcedureParameter("variable", TypeFacility.RUNTIME_NAMES.OBJECT, Type.In, p);
// $NON-NLS-1$
param.setAnnotation("Any number of varaibles; usage will vary by translator");
param.setNullType(NullType.Nullable);
param.setVarArg(true);
// $NON-NLS-1$
factory.addProcedureResultSetColumn("tuple", DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(TypeFacility.RUNTIME_TYPES.OBJECT)), p);
}
}
use of org.teiid.metadata.ProcedureParameter in project teiid by teiid.
the class ODataSchemaBuilder method allowedProcedure.
private static boolean allowedProcedure(Procedure proc) {
// any number of in, but can have only one LOB if lob is present
// only *one* result, or resultset allowed
int inouts = 0;
int lobs = 0;
int outs = 0;
for (ProcedureParameter pp : proc.getParameters()) {
if (pp.getType().equals(ProcedureParameter.Type.Out)) {
continue;
}
if (pp.getType().equals(ProcedureParameter.Type.In) || pp.getType().equals(ProcedureParameter.Type.InOut)) {
inouts++;
if (DataTypeManager.isLOB(pp.getRuntimeType())) {
lobs++;
}
} else if (pp.getType().equals(ProcedureParameter.Type.ReturnValue)) {
outs++;
}
}
if (proc.getResultSet() != null) {
for (Column c : proc.getResultSet().getColumns()) {
if (DataTypeManager.isLOB(c.getRuntimeType())) {
return false;
}
}
outs++;
}
if (outs > 1) {
return false;
}
if (inouts > 1 && lobs >= 1) {
return false;
}
return true;
}
use of org.teiid.metadata.ProcedureParameter in project teiid by teiid.
the class ProcedureSQLBuilder method visit.
private void visit(EdmReturnType returnType) {
if (hasResultSet()) {
// this is complex type
this.procedureReturn = new ProcedureReturn(returnType, null, true);
} else {
// must not be null
ProcedureParameter parameter = getReturnParameter();
Class<?> teiidType = DataTypeManager.getDataTypeClass(parameter.getRuntimeType());
Integer sqlType = JDBCSQLTypeInfo.getSQLType(DataTypeManager.getDataTypeName(teiidType));
this.procedureReturn = new ProcedureReturn(returnType, sqlType, false);
}
}
Aggregations