net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamExtensionsConfTable.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamExtensionsConfTable.java

Source

// Description: Java7 in-memory RAM DbIO implementation for ExtensionsConf.

/*
 *   CF Asterisk 11 Configuration Model
 *
 *   Copyright (c) 2013-2014 Mark Sobkow
 *   
 *   This program is available as free software under the GNU GPL v3, or
 *   under a commercial license from Mark Sobkow.  For commercial licensing
 *   details, please contact msobkow@sasktel.net.
 *   
 *   Under the terms of the GPL:
 *   
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *     
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *     
 *      You should have received a copy of the GNU General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *      This source code incorporates modified modules originally licensed
 *      under the Apache 2.0 license by MSS Code Factory including CFSecurity
 *      (net-sourceforge-msscodefactory-2.0-cfsecurity.xml),
 *      CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and
 *      CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the
 *      required models being available as part of the MSS Code Factory 1.11
 *      distribution source and install zips.
 *   
 *      You can download installations of MSS Code Factory 1.11 from
 *      http://msscodefactory.sourceforge.net/
 *   
 * ***********************************************************************
 *
 *   Code manufactured by MSS Code Factory
 */

package net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam;

import java.sql.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.*;
import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.*;

/*
 *   CFAstRamExtensionsConfTable in-memory RAM DbIO implementation
 *   for ExtensionsConf.
 */
public class CFAstRamExtensionsConfTable implements ICFAstExtensionsConfTable {
    private CFAstRamSchema schema;
    private Map<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> dictByPKey = new HashMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff>();
    private SortedMap<CFAstExtensionsConfByExtClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff>> dictByExtClusterIdx = new TreeMap<CFAstExtensionsConfByExtClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff>>();

    public CFAstRamExtensionsConfTable(CFAstRamSchema argSchema) {
        schema = argSchema;
    }

    public void createExtensionsConf(CFAstAuthorization Authorization, CFAstExtensionsConfBuff Buff) {
        schema.getTableConfigurationFile().createConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setClassCode(Buff.getClassCode());
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtensionsConfByExtClusterIdxKey keyExtClusterIdx = schema.getFactoryExtensionsConf()
                .newExtClusterIdxKey();
        keyExtClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

        // Validate unique indexes

        if (dictByPKey.containsKey(pkey)) {
            throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(),
                    "createExtensionsConf", pkey);
        }

        // Validate foreign keys

        {
            boolean allNull = true;
            allNull = false;
            allNull = false;
            if (!allNull) {
                if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredClusterId(), Buff.getRequiredId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "createExtensionsConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Proceed with adding the new record

        dictByPKey.put(pkey, Buff);

        SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> subdictExtClusterIdx;
        if (dictByExtClusterIdx.containsKey(keyExtClusterIdx)) {
            subdictExtClusterIdx = dictByExtClusterIdx.get(keyExtClusterIdx);
        } else {
            subdictExtClusterIdx = new TreeMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff>();
            dictByExtClusterIdx.put(keyExtClusterIdx, subdictExtClusterIdx);
        }
        subdictExtClusterIdx.put(pkey, Buff);

    }

    public CFAstExtensionsConfBuff readDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtensionsConf.readDerived() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(PKey.getRequiredClusterId());
        key.setRequiredId(PKey.getRequiredId());
        CFAstExtensionsConfBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtensionsConfBuff lockDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtensionsConf.readDerived() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(PKey.getRequiredClusterId());
        key.setRequiredId(PKey.getRequiredId());
        CFAstExtensionsConfBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtensionsConfBuff[] readAllDerived(CFAstAuthorization Authorization) {
        final String S_ProcName = "CFAstRamExtensionsConf.readAllDerived() ";
        CFAstExtensionsConfBuff[] retList = new CFAstExtensionsConfBuff[dictByPKey.values().size()];
        Iterator<CFAstExtensionsConfBuff> iter = dictByPKey.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            retList[idx++] = iter.next();
        }
        return (retList);
    }

    public CFAstExtensionsConfBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByClusterIdx() ";
        CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile()
                .readDerivedByClusterIdx(Authorization, ClusterId);
        if (buffList == null) {
            return (null);
        } else {
            CFAstConfigurationFileBuff buff;
            ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstExtensionsConfBuff)) {
                    filteredList.add((CFAstExtensionsConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
        }
    }

    public CFAstExtensionsConfBuff[] readDerivedByHostIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByHostIdx() ";
        CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile()
                .readDerivedByHostIdx(Authorization, ClusterId, HostNodeId);
        if (buffList == null) {
            return (null);
        } else {
            CFAstConfigurationFileBuff buff;
            ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
            for (int idx = 0; idx < buffList.length; idx++) {
                buff = buffList[idx];
                if ((buff != null) && (buff instanceof CFAstExtensionsConfBuff)) {
                    filteredList.add((CFAstExtensionsConfBuff) buff);
                }
            }
            return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
        }
    }

    public CFAstExtensionsConfBuff readDerivedByUNameIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId, String FileFullName) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByUNameIdx() ";
        CFAstConfigurationFileBuff buff = schema.getTableConfigurationFile().readDerivedByUNameIdx(Authorization,
                ClusterId, HostNodeId, FileFullName);
        if (buff == null) {
            return (null);
        } else if (buff instanceof CFAstExtensionsConfBuff) {
            return ((CFAstExtensionsConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtensionsConfBuff[] readDerivedByExtClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamExtensionsConf.readDerivedByExtClusterIdx() ";
        CFAstExtensionsConfByExtClusterIdxKey key = schema.getFactoryExtensionsConf().newExtClusterIdxKey();
        key.setRequiredClusterId(ClusterId);

        CFAstExtensionsConfBuff[] recArray;
        if (dictByExtClusterIdx.containsKey(key)) {
            SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> subdictExtClusterIdx = dictByExtClusterIdx
                    .get(key);
            recArray = new CFAstExtensionsConfBuff[subdictExtClusterIdx.size()];
            Iterator<CFAstExtensionsConfBuff> iter = subdictExtClusterIdx.values().iterator();
            int idx = 0;
            while (iter.hasNext()) {
                recArray[idx++] = iter.next();
            }
        } else {
            recArray = new CFAstExtensionsConfBuff[0];
        }
        return (recArray);
    }

    public CFAstExtensionsConfBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) {
        final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByIdIdx() ";
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(ClusterId);
        key.setRequiredId(Id);

        CFAstExtensionsConfBuff buff;
        if (dictByPKey.containsKey(key)) {
            buff = dictByPKey.get(key);
        } else {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtensionsConfBuff readBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtensionsConf.readBuff() ";
        CFAstExtensionsConfBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("CEXT"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtensionsConfBuff lockBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) {
        final String S_ProcName = "CFAstRamExtensionsConf.readBuff() ";
        CFAstExtensionsConfBuff buff = readDerived(Authorization, PKey);
        if ((buff != null) && (!buff.getClassCode().equals("CEXT"))) {
            buff = null;
        }
        return (buff);
    }

    public CFAstExtensionsConfBuff[] readAllBuff(CFAstAuthorization Authorization) {
        final String S_ProcName = "CFAstRamExtensionsConf.readAllBuff() ";
        CFAstExtensionsConfBuff buff;
        ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
        CFAstExtensionsConfBuff[] buffList = readAllDerived(Authorization);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CEXT")) {
                filteredList.add(buff);
            }
        }
        return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
    }

    public CFAstExtensionsConfBuff readBuffByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByIdIdx() ";
        CFAstConfigurationFileBuff buff = readDerivedByIdIdx(Authorization, ClusterId, Id);
        if ((buff != null) && buff.getClassCode().equals("CONF")) {
            return ((CFAstExtensionsConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtensionsConfBuff[] readBuffByClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByClusterIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
        CFAstConfigurationFileBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CONF")) {
                filteredList.add((CFAstExtensionsConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
    }

    public CFAstExtensionsConfBuff[] readBuffByHostIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByHostIdx() ";
        CFAstConfigurationFileBuff buff;
        ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
        CFAstConfigurationFileBuff[] buffList = readDerivedByHostIdx(Authorization, ClusterId, HostNodeId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CONF")) {
                filteredList.add((CFAstExtensionsConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
    }

    public CFAstExtensionsConfBuff readBuffByUNameIdx(CFAstAuthorization Authorization, long ClusterId,
            long HostNodeId, String FileFullName) {
        final String S_ProcName = "CFAstRamConfigurationFile.readBuffByUNameIdx() ";
        CFAstConfigurationFileBuff buff = readDerivedByUNameIdx(Authorization, ClusterId, HostNodeId, FileFullName);
        if ((buff != null) && buff.getClassCode().equals("CONF")) {
            return ((CFAstExtensionsConfBuff) buff);
        } else {
            return (null);
        }
    }

    public CFAstExtensionsConfBuff[] readBuffByExtClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        final String S_ProcName = "CFAstRamExtensionsConf.readBuffByExtClusterIdx() ";
        CFAstExtensionsConfBuff buff;
        ArrayList<CFAstExtensionsConfBuff> filteredList = new ArrayList<CFAstExtensionsConfBuff>();
        CFAstExtensionsConfBuff[] buffList = readDerivedByExtClusterIdx(Authorization, ClusterId);
        for (int idx = 0; idx < buffList.length; idx++) {
            buff = buffList[idx];
            if ((buff != null) && buff.getClassCode().equals("CEXT")) {
                filteredList.add((CFAstExtensionsConfBuff) buff);
            }
        }
        return (filteredList.toArray(new CFAstExtensionsConfBuff[0]));
    }

    public void updateExtensionsConf(CFAstAuthorization Authorization, CFAstExtensionsConfBuff Buff) {
        schema.getTableConfigurationFile().updateConfigurationFile(Authorization, Buff);
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtensionsConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(),
                    "updateExtensionsConf", "Existing record not found", "ExtensionsConf", pkey);
        }
        CFAstExtensionsConfByExtClusterIdxKey existingKeyExtClusterIdx = schema.getFactoryExtensionsConf()
                .newExtClusterIdxKey();
        existingKeyExtClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

        CFAstExtensionsConfByExtClusterIdxKey newKeyExtClusterIdx = schema.getFactoryExtensionsConf()
                .newExtClusterIdxKey();
        newKeyExtClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

        // Check unique indexes

        // Validate foreign keys

        {
            boolean allNull = true;

            if (allNull) {
                if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization,
                        Buff.getRequiredClusterId(), Buff.getRequiredId())) {
                    throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(),
                            "updateExtensionsConf", "Superclass", "SuperClass", "ConfigurationFile", null);
                }
            }
        }

        // Update is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> subdict;

        dictByPKey.remove(pkey);
        dictByPKey.put(pkey, Buff);

        subdict = dictByExtClusterIdx.get(existingKeyExtClusterIdx);
        if (subdict != null) {
            subdict.remove(pkey);
        }
        if (dictByExtClusterIdx.containsKey(newKeyExtClusterIdx)) {
            subdict = dictByExtClusterIdx.get(newKeyExtClusterIdx);
        } else {
            subdict = new TreeMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff>();
            dictByExtClusterIdx.put(newKeyExtClusterIdx, subdict);
        }
        subdict.put(pkey, Buff);

    }

    public void deleteExtensionsConf(CFAstAuthorization Authorization, CFAstExtensionsConfBuff Buff) {
        final String S_ProcName = "CFAstRamExtensionsConfTable.deleteExtensionsConf() ";
        CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey();
        pkey.setRequiredClusterId(Buff.getRequiredClusterId());
        pkey.setRequiredId(Buff.getRequiredId());
        CFAstExtensionsConfBuff existing = dictByPKey.get(pkey);
        if (existing == null) {
            return;
        }
        if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
            throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(),
                    "deleteExtensionsConf", pkey);
        }
        CFAstExtensionsConfByExtClusterIdxKey keyExtClusterIdx = schema.getFactoryExtensionsConf()
                .newExtClusterIdxKey();
        keyExtClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

        // Validate reverse foreign keys

        // Delete is valid

        SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> subdict;

        dictByPKey.remove(pkey);

        subdict = dictByExtClusterIdx.get(keyExtClusterIdx);
        subdict.remove(pkey);

        schema.getTableConfigurationFile().deleteConfigurationFile(Authorization, Buff);
    }

    public void deleteExtensionsConfByExtClusterIdx(CFAstAuthorization Authorization, long argClusterId) {
        CFAstExtensionsConfByExtClusterIdxKey key = schema.getFactoryExtensionsConf().newExtClusterIdxKey();
        key.setRequiredClusterId(argClusterId);
        deleteExtensionsConfByExtClusterIdx(Authorization, key);
    }

    public void deleteExtensionsConfByExtClusterIdx(CFAstAuthorization Authorization,
            CFAstExtensionsConfByExtClusterIdxKey argKey) {
        CFAstExtensionsConfBuff cur;
        LinkedList<CFAstExtensionsConfBuff> matchSet = new LinkedList<CFAstExtensionsConfBuff>();
        Iterator<CFAstExtensionsConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtensionsConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtensionsConf(Authorization, cur);
        }
    }

    public void deleteExtensionsConfByIdIdx(CFAstAuthorization Authorization, long argClusterId, long argId) {
        CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredId(argId);
        deleteExtensionsConfByIdIdx(Authorization, key);
    }

    public void deleteExtensionsConfByIdIdx(CFAstAuthorization Authorization, CFAstConfigurationFilePKey argKey) {
        CFAstExtensionsConfBuff cur;
        LinkedList<CFAstExtensionsConfBuff> matchSet = new LinkedList<CFAstExtensionsConfBuff>();
        Iterator<CFAstExtensionsConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtensionsConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtensionsConf(Authorization, cur);
        }
    }

    public void deleteExtensionsConfByClusterIdx(CFAstAuthorization Authorization, long argClusterId) {
        CFAstConfigurationFileByClusterIdxKey key = schema.getFactoryConfigurationFile().newClusterIdxKey();
        key.setRequiredClusterId(argClusterId);
        deleteExtensionsConfByClusterIdx(Authorization, key);
    }

    public void deleteExtensionsConfByClusterIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByClusterIdxKey argKey) {
        CFAstExtensionsConfBuff cur;
        LinkedList<CFAstExtensionsConfBuff> matchSet = new LinkedList<CFAstExtensionsConfBuff>();
        Iterator<CFAstExtensionsConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtensionsConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtensionsConf(Authorization, cur);
        }
    }

    public void deleteExtensionsConfByHostIdx(CFAstAuthorization Authorization, long argClusterId,
            long argHostNodeId) {
        CFAstConfigurationFileByHostIdxKey key = schema.getFactoryConfigurationFile().newHostIdxKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredHostNodeId(argHostNodeId);
        deleteExtensionsConfByHostIdx(Authorization, key);
    }

    public void deleteExtensionsConfByHostIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByHostIdxKey argKey) {
        CFAstExtensionsConfBuff cur;
        LinkedList<CFAstExtensionsConfBuff> matchSet = new LinkedList<CFAstExtensionsConfBuff>();
        Iterator<CFAstExtensionsConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtensionsConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtensionsConf(Authorization, cur);
        }
    }

    public void deleteExtensionsConfByUNameIdx(CFAstAuthorization Authorization, long argClusterId,
            long argHostNodeId, String argFileFullName) {
        CFAstConfigurationFileByUNameIdxKey key = schema.getFactoryConfigurationFile().newUNameIdxKey();
        key.setRequiredClusterId(argClusterId);
        key.setRequiredHostNodeId(argHostNodeId);
        key.setRequiredFileFullName(argFileFullName);
        deleteExtensionsConfByUNameIdx(Authorization, key);
    }

    public void deleteExtensionsConfByUNameIdx(CFAstAuthorization Authorization,
            CFAstConfigurationFileByUNameIdxKey argKey) {
        CFAstExtensionsConfBuff cur;
        LinkedList<CFAstExtensionsConfBuff> matchSet = new LinkedList<CFAstExtensionsConfBuff>();
        Iterator<CFAstExtensionsConfBuff> values = dictByPKey.values().iterator();
        while (values.hasNext()) {
            cur = values.next();
            if (argKey.equals(cur)) {
                matchSet.add(cur);
            }
        }
        Iterator<CFAstExtensionsConfBuff> iterMatch = matchSet.iterator();
        while (iterMatch.hasNext()) {
            cur = iterMatch.next();
            deleteExtensionsConf(Authorization, cur);
        }
    }

    public CFAstCursor openExtensionsConfCursorAll(CFAstAuthorization Authorization) {
        CFAstCursor cursor = new CFAstRamExtensionsConfCursor(Authorization, schema, dictByPKey.values());
        return (cursor);
    }

    public CFAstCursor openExtensionsConfCursorByExtClusterIdx(CFAstAuthorization Authorization, long ClusterId) {
        CFAstCursor cursor;
        CFAstExtensionsConfByExtClusterIdxKey key = schema.getFactoryExtensionsConf().newExtClusterIdxKey();
        key.setRequiredClusterId(ClusterId);

        if (dictByExtClusterIdx.containsKey(key)) {
            SortedMap<CFAstConfigurationFilePKey, CFAstExtensionsConfBuff> subdictExtClusterIdx = dictByExtClusterIdx
                    .get(key);
            cursor = new CFAstRamExtensionsConfCursor(Authorization, schema, subdictExtClusterIdx.values());
        } else {
            cursor = new CFAstRamExtensionsConfCursor(Authorization, schema,
                    new ArrayList<CFAstExtensionsConfBuff>());
        }
        return (cursor);
    }

    public void closeExtensionsConfCursor(CFAstCursor Cursor) {
        // Cursor.DataReader.Close();
    }

    public CFAstExtensionsConfBuff nextExtensionsConfCursor(CFAstCursor Cursor) {
        CFAstRamExtensionsConfCursor cursor = (CFAstRamExtensionsConfCursor) Cursor;
        CFAstExtensionsConfBuff rec = cursor.getCursor().next();
        cursor.setRowIdx(cursor.getRowIdx() + 1);
        return (rec);
    }

    public CFAstExtensionsConfBuff prevExtensionsConfCursor(CFAstCursor Cursor) {
        int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1;
        CFAstExtensionsConfBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextExtensionsConfCursor(Cursor);
        }
        return (rec);
    }

    public CFAstExtensionsConfBuff firstExtensionsConfCursor(CFAstCursor Cursor) {
        int targetRowIdx = 1;
        CFAstExtensionsConfBuff rec = null;
        Cursor.reset();
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextExtensionsConfCursor(Cursor);
        }
        return (rec);
    }

    public CFAstExtensionsConfBuff lastExtensionsConfCursor(CFAstCursor Cursor) {
        throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(),
                "lastExtensionsConfCursor");
    }

    public CFAstExtensionsConfBuff nthExtensionsConfCursor(CFAstCursor Cursor, int Idx) {
        int targetRowIdx = Idx;
        CFAstExtensionsConfBuff rec = null;
        if (Cursor.getRowIdx() >= targetRowIdx) {
            Cursor.reset();
        }
        while (Cursor.getRowIdx() < targetRowIdx) {
            rec = nextExtensionsConfCursor(Cursor);
        }
        return (rec);
    }

    public void releasePreparedStatements() {
    }
}