Package com.mobixess.jodb.core.index

Examples of com.mobixess.jodb.core.index.JODBIndexingRootAgent


        long offset = getIndexingRootAgentOffset();
        return (JODBIndexingRootAgent) getObjectForOffset(offset, Integer.MAX_VALUE);
    }
   
    public void ensureIndexVersion(long version) throws IOException{
        JODBIndexingRootAgent indexingRootAgent = getIndexingRootAgent();
        if(version!=indexingRootAgent.getVersion()){
            long offset = getIndexingRootAgentOffset();
            TransactionUtils.launchObject(this, offset, null, Integer.MAX_VALUE);
        }
    }
View Full Code Here


                }
            }
           
            if(typeConstraint != null){
                //boolean useIndexDataFromIterator = false;
                JODBIndexingRootAgent indexingRootAgent = _session.getIndexingRootAgent();
                ClassDescriptor classDescriptor = _session.getDescriptorForClass((Class)typeConstraint.getObject());
                JODBIndexingAgent indexingAgent = null;
                if(sortDataCache!=null){
                    //lookup indexing data to optimize query
                    SortNodeRecord[] sortRecords = sortDataCache.getSortNodes();
                    int fieldId = classDescriptor.getFieldIDForName(sortRecords[0]._fullPath);
                    if(fieldId!=-1){
                        indexingAgent = indexingRootAgent.getIndexingAgent(fieldId, base);
                        if(indexingAgent!=null){
                            indexIterator = indexingAgent.getIndexIterator(sortRecords[0]._orderAscending);
                            indexedNode = _descendants.get(sortRecords[0]._fullPath);
                            skipConventionalSorting = sortRecords.length == 1;
                        }
                    }
                }
                if(indexIterator == null){
                    //search first index
                    Iterator<String> descendants = _descendants.keySet().iterator();
                    while (descendants.hasNext() && indexIterator == null) {
                        String next = descendants.next();
                        Field field = classDescriptor.getFieldForName(next);
                        if(field==null){
                            continue;
                        }
                        indexingAgent = indexingRootAgent.getIndexingAgent(field, base);
                        if(indexingAgent!=null){
                            indexIterator = indexingAgent.getIndexIterator(true);
                            indexedNode = _descendants.get(next);
                        }
                    }
View Full Code Here

     * @throws IllegalClassTypeException
     */
    public static void assembleTransactionData(JODBOperationContext context, TransactionContainer tContainer) throws IOException, IllegalClassTypeException{
        if(tContainer.isAgentsMode()){
            //make sure the root agent processed first
            JODBIndexingRootAgent indexingRootAgent = context.getIndexingRootAgent();
            if(tContainer.getHandleForObject(indexingRootAgent)!=null){
                assembleTransactionDataForObject(context, indexingRootAgent, tContainer);
            }
        }
        Map<Object, TransactionHandle> transactionObjects = tContainer.getTransactionObjects();
View Full Code Here

        if(rootObjectType.isArray()){
            rootObjectClassID = base.getOrSetClassTypeSubstitutionID(rootObjectType.getComponentType().getName());
        }else{
            rootObjectClassID = base.getOrSetClassTypeSubstitutionID(rootObjectType.getName());
            indexes = TransactionUtils.getObjectDataContainerCache().pullVector();
            JODBIndexingRootAgent indexingAgent = context.getIndexingRootAgent();
            indexingAgent.getAgentsForClassId(indexes, rootObjectClassID);
            if(indexes.size() == 0){
                //no indexes for this class
                TransactionUtils.getObjectDataContainerCache().pushVector(indexes);
                indexes = null;
            }
View Full Code Here

            //
        }

        public void onCommitStarted(Object objectToBeCommited, JODBSession session) {
            try {
                JODBIndexingRootAgent agent = session.getIndexingRootAgent();
                JODBIndexingAgent indexingAgent = agent.getIndexingAgent(_indexingField, session.getBase());
               
                System.err.println("Commit started for object ");
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
View Full Code Here

    /*package*/void init(File file) throws IOException {
        initIoBase(file);
        _session = new JODBSession(_base);
        _transactionContainer = new TransactionContainer(_session, null);
        if(_base.isNewDatabase()){
            JODBIndexingRootAgent agent = new JODBIndexingRootAgent();
            try {
                _transactionContainer.enableAgentMode();
                _transactionContainer.set(agent, Integer.MAX_VALUE);
            } catch (IllegalClassTypeException e) {
                throw new JodbIOException(e);
View Full Code Here

        Field field = clazz.getDeclaredField(fieldName);
        configureIndex(field, enable);
    }
   
    public JODBIndexingAgent getIndexingAgent(Field field) throws IOException{
        JODBIndexingRootAgent indexingRootAgent = _session.getIndexingRootAgent();
        return indexingRootAgent.getIndexingAgent(field, _base);
    }
View Full Code Here

   
    public void configureIndex(Field field, boolean enable) throws IOException{
        if(!_transactionContainer.isEmpty()){
            throw new IllegalStateException("Cannot create index with transaction in progress");
        }
        JODBIndexingRootAgent indexingRootAgent = _session.getIndexingRootAgent();
        JODBIndexingAgent indexingAgent = indexingRootAgent.getIndexingAgent(field, _base);
        if((indexingAgent!=null && enable)|| (indexingAgent == null && !enable) ){
            return;
        }
       
        IOTicket writeTicket = _base.getIOTicket(true, true);
        try{
            JODBOperationContext context = new JODBOperationContext(_session, writeTicket, null, _transactionContainer, indexingRootAgent);
            writeTicket.lock(true);
           
            if(!enable){
                indexingRootAgent.removeAgent(field, context);
                return;
            }
           
            indexingAgent = indexingRootAgent.enableIndex(field, context );
           
            _base.applyTransaction(_transactionContainer, _session, writeTicket, indexingRootAgent, this);
           
        }finally {
            writeTicket.unlock();//should be already released in "applyTransaction()", just to play safe
View Full Code Here

                syntheticComparator = (Comparator) instantiateSyntheticPredicate(session, comparator, syntheticComparatorClass);
                //(Comparator) session.getDescriptorForClass(syntheticComparatorClass).newInstance();
            }
           
            //int[] predicateSubjectFields = loader.getPredicateSubjectFields();
            JODBIndexingRootAgent indexingRootAgent = session.getIndexingRootAgent();
            JODBIndexingAgent indexingAgent = null;
            Iterator<Integer> predicateSubjectAccessedFields = loader.getAccessedPredicateSubjectFields();
            while (predicateSubjectAccessedFields.hasNext() && indexingAgent == null) {
                indexingAgent = indexingRootAgent.getIndexingAgent(predicateSubjectAccessedFields.next(), session.getBase());
            }
            ByteBuffer indexDataBuffer = null;
            int indexField = -1;
            IndexDataIterator indexIterator = null;
            if(indexingAgent!=null){
View Full Code Here

        try {

           
            Class predicateSubjectClass = loader.getPredicateSubjectClass();

            JODBIndexingRootAgent indexingRootAgent = session.getIndexingRootAgent();
            JODBIndexingAgent indexingAgent = null;
            Iterator<Integer> predicateSubjectAccessedFields = loader.getAccessedPredicateSubjectFields();
            if(predicateSubjectAccessedFields != null){
                while (predicateSubjectAccessedFields.hasNext() && indexingAgent == null) {//TODO may be useless if analysis incomplete
                    Integer fieldId = predicateSubjectAccessedFields.next();
                    if(fieldId!=null){
                        indexingAgent = indexingRootAgent.getIndexingAgent(fieldId, session.getBase());
                    }
                }
            }

            IndexDataIterator indexIterator = null;
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.core.index.JODBIndexingRootAgent

Copyright © 2018 www.massapicom. 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.