Package org.apache.cocoon.components.store

Examples of org.apache.cocoon.components.store.Store


        startGroup(ch, "Store-Janitor");

        // For each element in StoreJanitor
        Iterator i = this.storejanitor.iterator();
        while( i.hasNext() ) {
            Store store = (Store) i.next();
            startGroup(ch, store.getClass().getName()+" (hash = 0x"+Integer.toHexString(store.hashCode())+")" );
            int size = 0;
            int empty = 0;
            atts.addAttribute(namespace, "name", "name", "CDATA", "cached");
            ch.startElement(namespace, "value", "value", atts);
            // For each element in Store
            Enumeration e = store.keys();
            atts.clear();
            while( e.hasMoreElements() ) {
                size++;
                Object key  = e.nextElement();
                Object val  = store.get( key );
                String line = null;
                if( val == null ) {
                    empty++;
        } else {
                    line = key.toString() + " (class: " +
View Full Code Here


        try {
            if (configuration != null && this.getIsAdminProfile(profileID) == false) {
                final String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
                if (storePrefix != null) {
                    final String key = profileID.substring(1);
                    final Store store = this.getProfileStore();
                    if (store.containsKey(key) == true) {
                        result = (Map)store.get(key);
                    }
                }
            }
        } catch (Exception local) {
            // local exceptions are ignored
View Full Code Here

        if (configuration != null
            && type != null
            && type.equals(SunSpot.BUILDTYPE_VALUE_ID) == false) {
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String   currentKey;
                String  deleteGlobal = null;
                String  deleteRole = null;
                String  deleteUser = null;

                if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true ||
                    type.equals(SunSpot.BUILDTYPE_VALUE_GLOBAL) == true) {
                    if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true) {
                        deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false).substring(1);
                    }
                    deleteRole = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteRole = deleteRole.substring(1, deleteRole.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ROLE;
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteUser = deleteUser.substring(1, deleteUser.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ID;
                } else { // role
                    deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ROLE, role, null, false).substring(1);
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ID, role, "a", false);
                    deleteUser = deleteUser.substring(1, deleteUser.length()-1);
                }

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (deleteGlobal != null && currentKey.equals(deleteGlobal) == true) {
                        store.remove(currentKey);
                    } else if (deleteRole != null && currentKey.startsWith(deleteRole) == true) {
                        store.remove(currentKey);
                    } else if (deleteUser != null && currentKey.startsWith(deleteUser) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        } else if (configuration != null && type == null) {
            // clean whole cache
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String currentKey;
                String delete;

                delete = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                delete = delete.substring(1, delete.lastIndexOf(':') + 1);

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (currentKey.startsWith(delete) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        }
View Full Code Here

        try {
            if (configuration != null && this.getIsAdminProfile(profileID) == false) {
                final String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
                if (storePrefix != null) {
                    final String key = profileID.substring(1);
                    final Store store = this.getProfileStore();
                    if (store.containsKey(key) == true) {
                        result = (Map)store.get(key);
                    }
                }
            }
        } catch (Exception local) {
            // local exceptions are ignored
View Full Code Here

        if (configuration != null
            && type != null
            && type.equals(SunSpot.BUILDTYPE_VALUE_ID) == false) {
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String   currentKey;
                String  deleteGlobal = null;
                String  deleteRole = null;
                String  deleteUser = null;

                if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true ||
                    type.equals(SunSpot.BUILDTYPE_VALUE_GLOBAL) == true) {
                    if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true) {
                        deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false).substring(1);
                    }
                    deleteRole = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteRole = deleteRole.substring(1, deleteRole.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ROLE;
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteUser = deleteUser.substring(1, deleteUser.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ID;
                } else { // role
                    deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ROLE, role, null, false).substring(1);
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ID, role, "a", false);
                    deleteUser = deleteUser.substring(1, deleteUser.length()-1);
                }

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (deleteGlobal != null && currentKey.equals(deleteGlobal) == true) {
                        store.remove(currentKey);
                    } else if (deleteRole != null && currentKey.startsWith(deleteRole) == true) {
                        store.remove(currentKey);
                    } else if (deleteUser != null && currentKey.startsWith(deleteUser) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        } else if (configuration != null && type == null) {
            // clean whole cache
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String currentKey;
                String delete;

                delete = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                delete = delete.substring(1, delete.lastIndexOf(':') + 1);

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (currentKey.startsWith(delete) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        }
View Full Code Here

        startGroup(ch, "Store-Janitor");

        // For each element in StoreJanitor
        Iterator i = this.storejanitor.iterator();
        while( i.hasNext() ) {
            Store store = (Store) i.next();
            startGroup(ch, store.getClass().getName()+" (hash = 0x"+Integer.toHexString(store.hashCode())+")" );
            int size = 0;
            int empty = 0;
            atts.addAttribute(namespace, "name", "name", "CDATA", "cached");
            ch.startElement(namespace, "value", "value", atts);
            // For each element in Store
            Enumeration e = store.keys();
            atts.clear();
            while( e.hasMoreElements() ) {
                size++;
                Object key  = e.nextElement();
                Object val  = store.get( key );
                String line = null;
                if( val == null ) {
                    empty++;
    } else {
                    line = key.toString() + " (class: " +
View Full Code Here

        try {
            if (configuration != null && this.getIsAdminProfile(profileID) == false) {
                final String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
                if (storePrefix != null) {
                    final String key = profileID.substring(1);
                    final Store store = this.getProfileStore();
                    if (store.containsKey(key) == true) {
                        result = (Map)store.get(key);
                    }
                }
            }
        } catch (Exception local) {
            // local exceptions are ignored
View Full Code Here

        if (configuration != null
            && type != null
            && type.equals(SunSpot.BUILDTYPE_VALUE_ID) == false) {
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String   currentKey;
                String  deleteGlobal = null;
                String  deleteRole = null;
                String  deleteUser = null;

                if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true ||
                    type.equals(SunSpot.BUILDTYPE_VALUE_GLOBAL) == true) {
                    if (type.equals(SunSpot.BUILDTYPE_VALUE_BASIC) == true) {
                        deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false).substring(1);
                    }
                    deleteRole = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteRole = deleteRole.substring(1, deleteRole.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ROLE;
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                    deleteUser = deleteUser.substring(1, deleteUser.lastIndexOf(':')+1) + SunSpot.BUILDTYPE_VALUE_ID;
                } else { // role
                    deleteGlobal = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ROLE, role, null, false).substring(1);
                    deleteUser = this.getProfileID(SunSpot.BUILDTYPE_VALUE_ID, role, "a", false);
                    deleteUser = deleteUser.substring(1, deleteUser.length()-1);
                }

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (deleteGlobal != null && currentKey.equals(deleteGlobal) == true) {
                        store.remove(currentKey);
                    } else if (deleteRole != null && currentKey.startsWith(deleteRole) == true) {
                        store.remove(currentKey);
                    } else if (deleteUser != null && currentKey.startsWith(deleteUser) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        } else if (configuration != null && type == null) {
            // clean whole cache
            String storePrefix = (String)configuration.get(Constants.CONF_PROFILE_CACHE);
            if (storePrefix != null) {
                Store store = this.getProfileStore();
                Enumeration keys = store.keys();
                String currentKey;
                String delete;

                delete = this.getProfileID(SunSpot.BUILDTYPE_VALUE_GLOBAL, null, null, false);
                delete = delete.substring(1, delete.lastIndexOf(':') + 1);

                while (keys.hasMoreElements() == true) {
                    currentKey = (String)keys.nextElement();
                    if (currentKey.startsWith(delete) == true) {
                        store.remove(currentKey);
                    }
                }
            }
        }
View Full Code Here

     *@param  remove  The number of items to be removed.
     *@return         the remaining count of items, that could not be removed.
     *@since
     */
    private int reduceStoreBy(int remove) {
        Store store = (Store) storelist.get(index);
        int sizeBefore = countSize(store);
        for (int i = 0; i < sizeBefore & remove > 0; i++, remove--) {
            store.free();
        }
        int sizeAfter = countSize(store);
        debug("store index=" + index + ", size before=" + sizeBefore + ",  size after=" + sizeAfter + ", removed=" + (sizeBefore - sizeAfter));
        return remove;
    }
View Full Code Here

        startGroup(ch, "Store-Janitor");

        // For each element in StoreJanitor
        Iterator i = this.storejanitor.iterator();
        while (i.hasNext()) {
            Store store = (Store) i.next();
            startGroup(ch, store.getClass().getName()+" (hash = 0x"+Integer.toHexString(store.hashCode())+")" );
            int size = 0;
            int empty = 0;
            atts.clear();
            atts.addAttribute(namespace, "name", "name", "CDATA", "cached");
            ch.startElement(namespace, "value", "value", atts);
            // For each element in Store
            Enumeration e = store.keys();
            atts.clear();
            while( e.hasMoreElements() ) {
                size++;
                Object key  = e.nextElement();
                Object val  = store.get( key );
                String line = null;
                if (val == null) {
                    empty++;
                } else {
                    line = key + " (class: " + val.getClass().getName() + ")";
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.store.Store

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.