@Test public void testProcedures() throws Exception { CouchbaseMetadataProcessor metadataProcessor = new CouchbaseMetadataProcessor(); MetadataFactory mf = new MetadataFactory("vdb", 1, "couchbase", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null); metadataProcessor.addProcedures(mf, null); helpTest("procedures.expected", mf); }
protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) { Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS); getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation")); ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments); Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT); getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation")); param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument); }
CouchbaseMetadataProcessor implements MetadataProcessor<CouchbaseConnection> { protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) { Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS); getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation")); ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments); Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT); getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation")); param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument); } }
CouchbaseMetadataProcessor implements MetadataProcessor<CouchbaseConnection> { protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) { Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS); getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation")); ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments); Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT); getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation")); param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument); }  }
CouchbaseMetadataProcessor implements MetadataProcessor<CouchbaseConnection> { protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) { Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS); getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation")); ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments); Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT); getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation")); param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument); }  @Override void process(MetadataFactory mf, CouchbaseConnection conn); @TranslatorProperty(display = "SampleSize", category = PropertyType.IMPORT, description = "Maximum number of documents per keyspace that should be map") //$NON-NLS-1$ //$NON-NLS-2$ int getSampleSize(); void setSampleSize(int sampleSize); @TranslatorProperty(display = "TypeNameList", category = PropertyType.IMPORT, description = "A comma-separated list of the attributes that the buckets use to specify document types. Each list item must be a bucket name surrounded by back quotes (`), a colon (:), and an attribute name surrounded by back quotes (`).") //$NON-NLS-1$ //$NON-NLS-2$ String getTypeNameList(); void setTypeNameList(String typeNameList); @TranslatorProperty(display = "SampleKeyspaces", category = PropertyType.IMPORT, description = "A comma-separated list of the keyspace names to define which keyspaces that should be map, default map all keyspaces") //$NON-NLS-1$ //$NON-NLS-2$ String getSampleKeyspaces(); void setSampleKeyspaces(String sampleKeyspaces); void setUseDouble(boolean useDouble); }
CouchbaseMetadataProcessor implements MetadataProcessor<CouchbaseConnection> { protected void addProcedures(MetadataFactory metadataFactory, CouchbaseConnection connection) { Procedure getDocuments = metadataFactory.addProcedure(GETDOCUMENTS); getDocuments.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.Annotation")); ProcedureParameter param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocuments); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocuments.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocuments); Procedure getDocument = metadataFactory.addProcedure(GETDOCUMENT); getDocument.setAnnotation(CouchbasePlugin.Util.getString("getDocument.Annotation")); param = metadataFactory.addProcedureParameter(ID, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.id.Annotation")); param = metadataFactory.addProcedureParameter(KEYSPACE, TypeFacility.RUNTIME_NAMES.STRING, Type.In, getDocument); param.setNullType(No_Nulls); param.setAnnotation(CouchbasePlugin.Util.getString("getDocument.keyspace.Annotation")); metadataFactory.addProcedureResultSetColumn(RESULT, TypeFacility.RUNTIME_NAMES.BLOB, getDocument); }  @Override void process(MetadataFactory mf, CouchbaseConnection conn); @TranslatorProperty(display = "SampleSize", category = PropertyType.IMPORT, description = "Maximum number of documents per keyspace that should be map") //$NON-NLS-1$ //$NON-NLS-2$ int getSampleSize(); void setSampleSize(int sampleSize); @TranslatorProperty(display = "TypeNameList", category = PropertyType.IMPORT, description = "A comma-separated list of the attributes that the buckets use to specify document types. Each list item must be a bucket name surrounded by back quotes (`), a colon (:), and an attribute name surrounded by back quotes (`).") //$NON-NLS-1$ //$NON-NLS-2$ String getTypeNameList(); void setTypeNameList(String typeNameList); @TranslatorProperty(display = "SampleKeyspaces", category = PropertyType.IMPORT, description = "A comma-separated list of the keyspace names to define which keyspaces that should be map, default map all keyspaces") //$NON-NLS-1$ //$NON-NLS-2$ String getSampleKeyspaces(); void setSampleKeyspaces(String sampleKeyspaces); void setUseDouble(boolean useDouble); @ExtensionMetadataProperty(applicable = Table.class, datatype = Boolean.class, display = "Is Array Table", description = "Declare whether the table is array table")
    static final String IS_ARRAY_TABLE; @ExtensionMetadataProperty(applicable = Table.class, datatype = String.class, display = "Named Type Pair", description = "Declare the name of typed key/value pair")
    static final String NAMED_TYPE_PAIR; }