Examples of IndexDefinition


Examples of org.eclipse.persistence.tools.schemaframework.IndexDefinition

    /**
     * INTERNAL:
     * Process the index metadata
     */
    public void process(MetadataDescriptor descriptor, String defaultColumnName) {
        IndexDefinition indexDefinition = new IndexDefinition();
       
        if (m_columnNames.isEmpty() && defaultColumnName != null) {
            indexDefinition.getFields().add(defaultColumnName);
        } else {
            indexDefinition.getFields().addAll(m_columnNames);
        }
       
        // Process the name value.
        if (m_name != null && m_name.length() != 0) {
            indexDefinition.setName(m_name);           
        } else {           
            String name = "INDEX_" + descriptor.getPrimaryTableName();
           
            for (String column : indexDefinition.getFields()) {
                name = name + "_" + column;
            }
           
            indexDefinition.setName(name);
        }
       
        // Process the schema value.
        if (m_schema != null && m_schema.length() != 0) {
            indexDefinition.setQualifier(m_schema);
        } else if (descriptor.getDefaultSchema() != null && descriptor.getDefaultSchema().length() != 0) {
            indexDefinition.setQualifier(descriptor.getDefaultSchema());               
        }
       
        // Process the catalog value.
        if (m_catalog != null && m_catalog.length() != 0) {
            indexDefinition.setQualifier(m_catalog);
        } else if (descriptor.getDefaultCatalog() != null && descriptor.getDefaultCatalog().length() != 0) {
            indexDefinition.setQualifier(descriptor.getDefaultCatalog());               
        }
       
        // Process the unique value.
        if (m_unique != null) {
            indexDefinition.setIsUnique(m_unique);
        }
       
        // Process table value.
        if (m_table == null || m_table.length() == 0) {
            indexDefinition.setTargetTable(descriptor.getPrimaryTable().getQualifiedName());
            descriptor.getPrimaryTable().getIndexes().add(indexDefinition);
        } else if (m_table.equals(descriptor.getPrimaryTable().getQualifiedName()) || m_table.equals(descriptor.getPrimaryTableName())) {
            indexDefinition.setTargetTable(m_table);
            descriptor.getPrimaryTable().getIndexes().add(indexDefinition);
        } else {
            indexDefinition.setTargetTable(m_table);
            boolean found = false;
            for (DatabaseTable databaseTable : descriptor.getClassDescriptor().getTables()) {
                if (m_table.equals(databaseTable.getQualifiedName()) || m_table.equals(databaseTable.getName())) {
                    databaseTable.getIndexes().add(indexDefinition);
                    found = true;
View Full Code Here

Examples of org.eclipse.persistence.tools.schemaframework.IndexDefinition

        if (index != null) {
            m_index = new IndexMetadata(index, getAccessibleObject());
        }
       
        if (m_index != null) {
            IndexDefinition indexDefinition = new IndexDefinition();
            if (m_index.getColumnNames().isEmpty()) {
                indexDefinition.getFields().add(getColumn(MetadataLogger.COLUMN).getName());
            } else {
                indexDefinition.getFields().addAll(m_index.getColumnNames());
            }
            if ((m_index.getName() != null) && (m_index.getName().length() != 0)) {
                indexDefinition.setName(m_index.getName());           
            } else {
                String name = "INDEX_" + getDescriptor().getPrimaryTable().getName();
                for (String column : indexDefinition.getFields()) {
                    name = name + "_" + column;
                }
                indexDefinition.setName(name);
            }
            if ((m_index.getSchema() != null) && (m_index.getSchema().length() != 0)) {
                indexDefinition.setQualifier(m_index.getSchema());
            } else if ((getDescriptor().getDefaultSchema() != null) && (getDescriptor().getDefaultSchema().length() != 0)) {
                indexDefinition.setQualifier(m_index.getSchema());               
            }
            if ((m_index.getCatalog() != null) && (m_index.getCatalog().length() != 0)) {
                indexDefinition.setQualifier(m_index.getCatalog());
            } else if ((getDescriptor().getDefaultCatalog() != null) && (getDescriptor().getDefaultCatalog().length() != 0)) {
                indexDefinition.setQualifier(getDescriptor().getDefaultCatalog());               
            }
            if (m_index.getUnique() != null) {
                indexDefinition.setIsUnique(m_index.getUnique());
            }
            String table = m_index.getTable();
            if ((table == null) || (table.length() == 0)) {
                indexDefinition.setTargetTable(getDescriptor().getPrimaryTable().getQualifiedName());
                getDescriptor().getPrimaryTable().getIndexes().add(indexDefinition);
            } else if (table.equals(getDescriptor().getPrimaryTable().getQualifiedName())
                        || table.equals(getDescriptor().getPrimaryTable().getName())) {
                indexDefinition.setTargetTable(table);
                getDescriptor().getPrimaryTable().getIndexes().add(indexDefinition);
            } else {
                indexDefinition.setTargetTable(table);
                boolean found = false;
                for (DatabaseTable databaseTable : getDescriptor().getClassDescriptor().getTables()) {
                    if (table.equals(databaseTable.getQualifiedName()) || table.equals(databaseTable.getName())) {
                        databaseTable.getIndexes().add(indexDefinition);
                        found = true;
View Full Code Here

Examples of org.eclipse.persistence.tools.schemaframework.IndexDefinition

                m_indexes.add(new IndexMetadata((MetadataAnnotation)eachIndex, getAccessibleObject()));           
            }
        }
       
        for (IndexMetadata indexMetadata : m_indexes) {
            IndexDefinition indexDefinition = new IndexDefinition();
            if ((indexMetadata.getName() != null) && (indexMetadata.getName().length() != 0)) {
                indexDefinition.setName(indexMetadata.getName());           
            } else {
                String name = "INDEX_" + getDescriptor().getPrimaryTable().getName();
                for (String column : indexMetadata.getColumnNames()) {
                    name = name + "_" + column;
                }
                indexDefinition.setName(name);
            }
            if ((indexMetadata.getSchema() != null) && (indexMetadata.getSchema().length() != 0)) {
                indexDefinition.setQualifier(indexMetadata.getSchema());
            } else if ((getDescriptor().getDefaultSchema() != null) && (getDescriptor().getDefaultSchema().length() != 0)) {
                indexDefinition.setQualifier(indexMetadata.getSchema());               
            }
            if ((indexMetadata.getCatalog() != null) && (indexMetadata.getCatalog().length() != 0)) {
                indexDefinition.setQualifier(indexMetadata.getCatalog());
            } else if ((getDescriptor().getDefaultCatalog() != null) && (getDescriptor().getDefaultCatalog().length() != 0)) {
                indexDefinition.setQualifier(getDescriptor().getDefaultCatalog());               
            }
            if (indexMetadata.getUnique() != null) {
                indexDefinition.setIsUnique(indexMetadata.getUnique());
            }
            indexDefinition.getFields().addAll(indexMetadata.getColumnNames());
            String table = indexMetadata.getTable();
            if ((table == null) || (table.length() == 0)) {
                indexDefinition.setTargetTable(getDescriptor().getPrimaryTable().getQualifiedName());
                getDescriptor().getPrimaryTable().getIndexes().add(indexDefinition);
            } else if (table.equals(getDescriptor().getPrimaryTable().getQualifiedName())
                        || table.equals(getDescriptor().getPrimaryTable().getName())) {
                indexDefinition.setTargetTable(table);
                getDescriptor().getPrimaryTable().getIndexes().add(indexDefinition);
            } else {
                indexDefinition.setTargetTable(table);
                boolean found = false;
                for (DatabaseTable databaseTable : getDescriptor().getClassDescriptor().getTables()) {
                    if (table.equals(databaseTable.getQualifiedName()) || table.equals(databaseTable.getName())) {
                        databaseTable.getIndexes().add(indexDefinition);
                        found = true;
View Full Code Here

Examples of org.eclipse.persistence.tools.schemaframework.IndexDefinition

     * INTERNAL:
     * Process the index metadata. This is called from all table metadata.
     * CollectionTable, SecondaryTable, JoinTable, Table, TableGenerator.
     */
    public void process(DatabaseTable table) {
        IndexDefinition indexDefinition = new IndexDefinition();
       
        // Process the column list (comma separated string)
        StringTokenizer st = new StringTokenizer(m_columnList, ",");
        while (st.hasMoreTokens()) {
            indexDefinition.addField(((String) st.nextToken()).trim());
        }
       
        // Process the name value.
        indexDefinition.setName(processName(table, indexDefinition));
       
        // Process the unique value.
        indexDefinition.setIsUnique(isUnique());
       
        // Add the index definition to the table provided.
        indexDefinition.setQualifier(table.getTableQualifier());
        indexDefinition.setTargetTable(table.getQualifiedName());
        table.addIndex(indexDefinition);
    }
View Full Code Here

Examples of org.lilyproject.hbaseindex.IndexDefinition

        this.serializationUtil = new DerefMapSerializationUtil(idGenerator);

        final IndexManager indexManager = new IndexManager(hbaseConfiguration, tableFactory);

        IndexDefinition forwardIndexDef = new IndexDefinition(forwardIndexName(indexName));
        // For the record ID we use a variable length byte array field of which the first two bytes are fixed length
        // The first byte is actually the record identifier byte.
        // The second byte really is the first byte of the record id. We put this in the fixed length part
        // (safely because a record id should at least be a single byte long) because this prevents BCD encoding
        // on the first byte, thus making it easier to configure table splitting based on the original input.
        forwardIndexDef.addVariableLengthByteField("dependant_recordid", 2);
        forwardIndexDef.addByteField("dependant_vtag", DerefMapSerializationUtil.SCHEMA_ID_BYTE_LENGTH);
        forwardDerefIndex = indexManager.getIndex(owningRepoName, forwardIndexDef);

        IndexDefinition backwardIndexDef = new IndexDefinition(backwardIndexName(indexName));
        // Same remark as in the forward index.
        backwardIndexDef.addVariableLengthByteField("dependency_masterrecordid", 2);
        backwardIndexDef.addByteField("dependant_vtag", DerefMapSerializationUtil.SCHEMA_ID_BYTE_LENGTH);
        backwardIndexDef.addVariableLengthByteField("variant_properties_pattern");
        backwardDerefIndex = indexManager.getIndex(owningRepoName, backwardIndexDef);
    }
View Full Code Here

Examples of org.lilyproject.hbaseindex.IndexDefinition

        IndexManager indexMgr = new IndexManager(hbaseConf);

        String indexName = "perftest1";

        IndexDefinition indexDef = new IndexDefinition(indexName);
        indexDef.addStringField("word");
        indexDef.addLongField("number");

        index = indexMgr.getIndex(indexDef);

        initialInserts = OptionUtil.getIntOption(cmd, initialInsertOption, 5000000);
        initialInsertsBatchSize = OptionUtil.getIntOption(cmd, initialInsertBatchOption, 300);
View Full Code Here

Examples of org.lilyproject.hbaseindex.IndexDefinition

        //    entries for a record without having to know the vtags under which they occur
        //  - the sourcefield will often by optional in queries, that's why it comes last

        final int schemaIdByteLength = 16; // see SchemaIdImpl
        {
            IndexDefinition indexDef = new IndexDefinition("links-forward");
            // For the record ID we use a variable length byte array field of which the first two bytes are fixed length
            // The first byte is actually the record identifier byte.
            // The second byte really is the first byte of the record id. We put this in the fixed length part
            // (safely because a record id should at least be a single byte long) because this prevents BCD encoding
            // on the first byte, thus making it easier to configure table splitting based on the original input.
            indexDef.addVariableLengthByteField("source", 2);
            indexDef.addByteField("vtag", schemaIdByteLength);
            indexDef.addByteField("sourcefield", schemaIdByteLength);
            forwardIndex = indexManager.getIndex(indexDef);
        }

        {
            IndexDefinition indexDef = new IndexDefinition("links-backward");
            // Same remark as in the forwardIndex.
            indexDef.addVariableLengthByteField("target", 2);
            indexDef.addByteField("vtag", schemaIdByteLength);
            indexDef.addByteField("sourcefield", schemaIdByteLength);
            backwardIndex = indexManager.getIndex(indexDef);
        }
    }
View Full Code Here

Examples of org.modeshape.jcr.api.index.IndexDefinition

        for (ChildReference ref : indexes.getChildReferences(system)) {
            CachedNode provider = system.getNode(ref);
            Name providerName = provider.getName(system);
            for (ChildReference indexRef : provider.getChildReferences(system)) {
                CachedNode indexDefn = system.getNode(indexRef);
                IndexDefinition defn = readIndexDefinition(indexDefn, providerName);
                if (providerNames.contains(defn.getProviderName())) {
                    defns.add(defn);
                } else {
                    // There is no provider by this name, so mark it as not enabled ...
                    defn = RepositoryIndexDefinition.createFrom(defn, false);
                }
View Full Code Here

Examples of org.modeshape.jcr.api.index.IndexDefinition

        public IndexDefinition getIndex( final String name ) {
            if (name == null) return null;
            final Document doc = getRawIndex(name);
            if (doc == null) return null;
            return new IndexDefinition() {
                private List<IndexColumnDefinition> columns;
                private Map<String, Object> properties;

                @Override
                public String getName() {
View Full Code Here

Examples of org.modeshape.jcr.api.index.IndexDefinition

            };
        }

        protected void validateIndexDefinitions( Problems problems ) {
            for (String indexName : getIndexNames()) {
                IndexDefinition defn = getIndex(indexName);
                // Make sure the index has a valid provider ...
                if (defn.getProviderName() == null) {
                    problems.addError(JcrI18n.indexProviderNameRequired, indexName);
                } else if (!hasIndexProvider(defn.getProviderName())) {
                    problems.addWarning(JcrI18n.indexProviderNameMustMatchProvider, indexName, defn.getProviderName());
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.