@Test(groups = { "integration" }) public void testSchema() { Schema schema = facade.schema(); assertNotNull(schema); ObjectClassInfo account = schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME); assertNotNull(account); Set<String> attributeNames = new HashSet<String>(OracleConstants.ALL_ATTRIBUTE_NAMES); for (AttributeInfo info : account.getAttributeInfo()) { for (Iterator<String> i = attributeNames.iterator(); i.hasNext();) { if (info.is(i.next())) { i.remove(); } } } assertThat(attributeNames).isSameAs(Collections.<String> emptySet()); }
public Schema schema() { String dbProductVersion = null; Pair<Integer, Integer> dbVersion = null; ; try { DatabaseMetaData metaData = adminConn.getMetaData(); dbVersion = new Pair<Integer, Integer>(metaData.getDatabaseMajorVersion(), metaData .getDatabaseMinorVersion()); dbProductVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { throw new ConnectorException( "Cannot resolve getMetaData().getDatabaseProductVersion()", e); } boolean express = false; if (dbProductVersion.contains("Express")) { express = true; } Set<AttributeInfo> attrInfoSet = new HashSet<AttributeInfo>(); attrInfoSet.add(AttributeInfoBuilder.build(Name.NAME, String.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.REQUIRED))); attrInfoSet.add(OperationalAttributeInfos.PASSWORD); attrInfoSet.add(OperationalAttributeInfos.PASSWORD_EXPIRED); attrInfoSet.add(OperationalAttributeInfos.ENABLE); attrInfoSet.add(OperationalAttributeInfos.LOCK_OUT); attrInfoSet.add(AttributeInfoBuilder.build( OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, Long.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, Long.class, EnumSet.of(Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, String.class, express ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_ROLES_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PRIVS_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PROFILE_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_QUOTA_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_QUOTA_ATTR_NAME, String.class, !isTempTsQuotaWriteable(dbVersion) ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); SchemaBuilder schemaBld = new SchemaBuilder(OracleConnector.class); schemaBld.defineObjectClass(ObjectClass.ACCOUNT_NAME, attrInfoSet); Schema schema = schemaBld.build(); return schema; }
OracleOperationSchema extends AbstractOracleOperation implements SchemaOp { public Schema schema() { String dbProductVersion = null; Pair<Integer, Integer> dbVersion = null; ; try { DatabaseMetaData metaData = adminConn.getMetaData(); dbVersion = new Pair<Integer, Integer>(metaData.getDatabaseMajorVersion(), metaData .getDatabaseMinorVersion()); dbProductVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { throw new ConnectorException( "Cannot resolve getMetaData().getDatabaseProductVersion()", e); } boolean express = false; if (dbProductVersion.contains("Express")) { express = true; } Set<AttributeInfo> attrInfoSet = new HashSet<AttributeInfo>(); attrInfoSet.add(AttributeInfoBuilder.build(Name.NAME, String.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.REQUIRED))); attrInfoSet.add(OperationalAttributeInfos.PASSWORD); attrInfoSet.add(OperationalAttributeInfos.PASSWORD_EXPIRED); attrInfoSet.add(OperationalAttributeInfos.ENABLE); attrInfoSet.add(OperationalAttributeInfos.LOCK_OUT); attrInfoSet.add(AttributeInfoBuilder.build( OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, Long.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, Long.class, EnumSet.of(Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, String.class, express ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_ROLES_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PRIVS_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PROFILE_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_QUOTA_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_QUOTA_ATTR_NAME, String.class, !isTempTsQuotaWriteable(dbVersion) ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); SchemaBuilder schemaBld = new SchemaBuilder(OracleConnector.class); schemaBld.defineObjectClass(ObjectClass.ACCOUNT_NAME, attrInfoSet); Schema schema = schemaBld.build(); return schema; } }
OracleOperationSchema extends AbstractOracleOperation implements SchemaOp { public Schema schema() { String dbProductVersion = null; Pair<Integer, Integer> dbVersion = null; ; try { DatabaseMetaData metaData = adminConn.getMetaData(); dbVersion = new Pair<Integer, Integer>(metaData.getDatabaseMajorVersion(), metaData .getDatabaseMinorVersion()); dbProductVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { throw new ConnectorException( "Cannot resolve getMetaData().getDatabaseProductVersion()", e); } boolean express = false; if (dbProductVersion.contains("Express")) { express = true; } Set<AttributeInfo> attrInfoSet = new HashSet<AttributeInfo>(); attrInfoSet.add(AttributeInfoBuilder.build(Name.NAME, String.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.REQUIRED))); attrInfoSet.add(OperationalAttributeInfos.PASSWORD); attrInfoSet.add(OperationalAttributeInfos.PASSWORD_EXPIRED); attrInfoSet.add(OperationalAttributeInfos.ENABLE); attrInfoSet.add(OperationalAttributeInfos.LOCK_OUT); attrInfoSet.add(AttributeInfoBuilder.build( OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, Long.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, Long.class, EnumSet.of(Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, String.class, express ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_ROLES_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PRIVS_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PROFILE_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_QUOTA_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_QUOTA_ATTR_NAME, String.class, !isTempTsQuotaWriteable(dbVersion) ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); SchemaBuilder schemaBld = new SchemaBuilder(OracleConnector.class); schemaBld.defineObjectClass(ObjectClass.ACCOUNT_NAME, attrInfoSet); Schema schema = schemaBld.build(); return schema; } OracleOperationSchema(OracleConfiguration cfg, Connection adminConn); }
OracleOperationSchema extends AbstractOracleOperation implements SchemaOp { public Schema schema() { String dbProductVersion = null; Pair<Integer, Integer> dbVersion = null; ; try { DatabaseMetaData metaData = adminConn.getMetaData(); dbVersion = new Pair<Integer, Integer>(metaData.getDatabaseMajorVersion(), metaData .getDatabaseMinorVersion()); dbProductVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { throw new ConnectorException( "Cannot resolve getMetaData().getDatabaseProductVersion()", e); } boolean express = false; if (dbProductVersion.contains("Express")) { express = true; } Set<AttributeInfo> attrInfoSet = new HashSet<AttributeInfo>(); attrInfoSet.add(AttributeInfoBuilder.build(Name.NAME, String.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.REQUIRED))); attrInfoSet.add(OperationalAttributeInfos.PASSWORD); attrInfoSet.add(OperationalAttributeInfos.PASSWORD_EXPIRED); attrInfoSet.add(OperationalAttributeInfos.ENABLE); attrInfoSet.add(OperationalAttributeInfos.LOCK_OUT); attrInfoSet.add(AttributeInfoBuilder.build( OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, Long.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, Long.class, EnumSet.of(Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, String.class, express ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_ROLES_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PRIVS_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PROFILE_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_QUOTA_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_QUOTA_ATTR_NAME, String.class, !isTempTsQuotaWriteable(dbVersion) ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); SchemaBuilder schemaBld = new SchemaBuilder(OracleConnector.class); schemaBld.defineObjectClass(ObjectClass.ACCOUNT_NAME, attrInfoSet); Schema schema = schemaBld.build(); return schema; } OracleOperationSchema(OracleConfiguration cfg, Connection adminConn); Schema schema(); }
OracleOperationSchema extends AbstractOracleOperation implements SchemaOp { public Schema schema() { String dbProductVersion = null; Pair<Integer, Integer> dbVersion = null; ; try { DatabaseMetaData metaData = adminConn.getMetaData(); dbVersion = new Pair<Integer, Integer>(metaData.getDatabaseMajorVersion(), metaData .getDatabaseMinorVersion()); dbProductVersion = metaData.getDatabaseProductVersion(); } catch (SQLException e) { throw new ConnectorException( "Cannot resolve getMetaData().getDatabaseProductVersion()", e); } boolean express = false; if (dbProductVersion.contains("Express")) { express = true; } Set<AttributeInfo> attrInfoSet = new HashSet<AttributeInfo>(); attrInfoSet.add(AttributeInfoBuilder.build(Name.NAME, String.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.REQUIRED))); attrInfoSet.add(OperationalAttributeInfos.PASSWORD); attrInfoSet.add(OperationalAttributeInfos.PASSWORD_EXPIRED); attrInfoSet.add(OperationalAttributeInfos.ENABLE); attrInfoSet.add(OperationalAttributeInfos.LOCK_OUT); attrInfoSet.add(AttributeInfoBuilder.build( OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, Long.class, EnumSet.of( Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, Long.class, EnumSet.of(Flags.NOT_UPDATEABLE, Flags.NOT_CREATABLE))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, String.class, express ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_ROLES_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PRIVS_ATTR_NAME, String.class, EnumSet.of(Flags.MULTIVALUED))); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_PROFILE_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_DEF_TS_QUOTA_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, String.class)); attrInfoSet.add(AttributeInfoBuilder.build(OracleConstants.ORACLE_TEMP_TS_QUOTA_ATTR_NAME, String.class, !isTempTsQuotaWriteable(dbVersion) ? EnumSet.of(Flags.NOT_CREATABLE, Flags.NOT_UPDATEABLE) : null)); SchemaBuilder schemaBld = new SchemaBuilder(OracleConnector.class); schemaBld.defineObjectClass(ObjectClass.ACCOUNT_NAME, attrInfoSet); Schema schema = schemaBld.build(); return schema; } OracleOperationSchema(OracleConfiguration cfg, Connection adminConn); Schema schema();  }