Package org.apache.excalibur.store

Examples of org.apache.excalibur.store.Store


        // Obtain the fragmentID  (which is simply the filename portion of the source)
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Retrieving fragment " + source + ".");
        }

        Store store = null;
        XMLDeserializer deserializer = null;
        Object fragment = null;
        try {
            store = (Store) this.manager.lookup(Store.TRANSIENT_STORE);
            fragment = store.get(source);
            if (fragment == null) {
                throw new ResourceNotFoundException("Could not find fragment " + source + " in store");
            }

            deserializer = (XMLDeserializer) this.manager.lookup(XMLDeserializer.ROLE);
View Full Code Here


            startGroup("Store Janitor");

            // For each element in StoreJanitor
            Iterator i = this.storeJanitor.iterator();
            while (i.hasNext()) {
                Store store = (Store) i.next();
                startGroup(store.getClass().getName() + " (hash = 0x" + Integer.toHexString(store.hashCode()) + ")");
                int size = 0;
                int empty = 0;
                atts.clear();
                atts.addAttribute(NAMESPACE, "name", "name", "CDATA", "cached");
                super.contentHandler.startElement(NAMESPACE, "value", "value", atts);

                atts.clear();
                Enumeration e = store.keys();
                while (e.hasMoreElements()) {
                    size++;
                    Object key = e.nextElement();
                    Object val = store.get(key);
                    String line;
                    if (val == null) {
                        empty++;
                    } else {
                        line = key + " (class: " + val.getClass().getName() + ")";
View Full Code Here

  public void setup(SourceResolver resolver, Map objectmodel, String src, Parameters parameters)
    throws ProcessingException, SAXException, IOException
  {
    this.resolver = resolver;

    Store store = null;

    try
    {
      this.lexicon = src;

      this.lexiconSource = resolver.resolveURI(this.lexicon);

      // Retrieve the lexical automaton from the transient store
      store = (Store)this.manager.lookup(Store.TRANSIENT_STORE);

      LexicalAutomatonEntry entry = (LexicalAutomatonEntry)store.get(this.lexiconSource.getURI());

      // If the lexicon has changed, rebuild the lexical automaton
      if ((entry==null) || (entry.getValidity()==null) ||
          (entry.getValidity().isValid(this.lexiconSource.getValidity())<=0))
      {
        this.logger.info("(Re)building the automaton from '"+this.lexiconSource.getURI()+"'");

        if (this.lexiconSource.getInputStream()==null)
          throw new ProcessingException("Source '"+this.lexiconSource.getURI()+"' not found");

        LexiconFactory factory = new LexiconFactory();
        SourceUtil.toSAX(this.manager, this.lexiconSource, null, factory);

        Lexicon lexicon = factory.getLexicon();

        LexicalAutomatonBuilder builder =
          new LexicalAutomatonBuilder(lexicon/*, new AvalonLogger(this.logger)*/);

        this.automaton = builder.getLexicalAutomaton();

        this.logger.info("Store automaton into store for '"+this.lexiconSource.getURI()+"'");
        store.store(this.lexiconSource.getURI(),
                    new LexicalAutomatonEntry(this.automaton, this.lexiconSource.getValidity()));
      }
      else
      {
        this.logger.info("Getting automaton from store for '"+this.lexiconSource.getURI()+"'");
View Full Code Here

                            (String)entry.getKey()
                        );
                    }
                    this.serializer.endDocument();

                    Store store = null;
                    String id = Long.toHexString((hashCode()^HashUtil.hash(requestURI)) + fragmentID);
                    try {
                        store = (Store) this.manager.lookup(Store.TRANSIENT_STORE);
                        store.store(id, this.serializer.getSAXFragment());
                    } catch (ServiceException se) {
                        throw new SAXException("Could not lookup for transient store.", se);
                    } catch (IOException ioe) {
                        throw new SAXException("Could not store fragment.", ioe);
                    } finally {
View Full Code Here

                }
                setIndex(0);
            }

            // Delete proportionate elements out of the store as configured.
            Store store = (Store)getStoreList().get(getIndex());
            int limit = calcToFree(store);
            if (getLogger().isDebugEnabled())
            {
                getLogger().debug("Freeing " + limit + " items from store N " + getIndex());
            }
            for (int i=0; i < limit; i++)
            {
                try
                {
                    store.free();
                }
                catch (OutOfMemoryError e)
                {
                    getLogger().error("OutOfMemoryError in freeMemory()");
                }
View Full Code Here

                      Parameters parameters)
                        throws ProcessingException, SAXException,
                               IOException {

        this.resolver = resolver;
        Store store = null;

        try {
            this.lexicon = src;

            this.lexiconSource = resolver.resolveURI(this.lexicon);

            // Retrieve the parser table from the transient store
            store = (Store) this.manager.lookup(Store.TRANSIENT_STORE);
            LexicalAutomatonEntry entry = (LexicalAutomatonEntry) store.get(this.lexiconSource.getURI());

            // If the parser table has changed, rebuild the parser table
            if ((entry==null) || (entry.getValidity()==null) ||
                (entry.getValidity().isValid(this.lexiconSource.getValidity())<=
                 0)) {

                this.logger.info("(Re)building the automaton from '"+
                                 this.lexiconSource.getURI()+"'");

                SAXConfigurationHandler confighandler = new SAXConfigurationHandler();

                if (this.lexiconSource.getInputStream()==null) {
                    throw new ProcessingException("Source '"+
                                                  this.lexiconSource.getURI()+
                                                  "' not found");
                }
                SourceUtil.toSAX(this.manager, this.lexiconSource, null, confighandler);

                Configuration config = confighandler.getConfiguration();
                Lexicon lexicon = LexiconFactory.createLexicon(config);

                LexicalAutomatonBuilder builder = new LexicalAutomatonBuilder(lexicon,
                                                      this.logger);

                this.automaton = builder.getLexicalAutomaton();

                this.logger.info("Store automaton into store for '"+
                                 this.lexiconSource.getURI()+"'");

                store.store(this.lexiconSource.getURI(),
                            new LexicalAutomatonEntry(this.automaton,
                                                      this.lexiconSource.getValidity()));
            } else {
                this.logger.info("Getting automaton from store for '"+
                                 this.lexiconSource.getURI()+"'");
View Full Code Here

                      Parameters parameters)
                        throws ProcessingException, SAXException,
                               IOException {

        this.resolver = resolver;
        Store store = null;

        try {
            this.grammar = src;

            this.grammarSource = resolver.resolveURI(this.grammar);

            // Retrieve the parser automaton from the transient store
            store = (Store) this.manager.lookup(Store.TRANSIENT_STORE);
            ParserAutomatonEntry entry = (ParserAutomatonEntry) store.get(this.grammarSource.getURI());

            // If the parser automaton has changed, rebuild the parser automaton
            if ((entry==null) || (entry.getValidity()==null) ||
                (entry.getValidity().isValid(this.grammarSource.getValidity()))<=
                0) {
                this.logger.info("(Re)building the automaton from '"+
                                 this.grammarSource.getURI()+"'");

                SAXConfigurationHandler confighandler = new SAXConfigurationHandler();

                if (this.grammarSource.getInputStream()==null) {
                    throw new ProcessingException("Source '"+
                                                  this.grammarSource.getURI()+
                                                  "' not found");
                }
                SourceUtil.toSAX(this.manager, this.grammarSource, null, confighandler);

                Configuration config = confighandler.getConfiguration();
                Grammar grammar = GrammarFactory.createGrammar(config);

                ParserAutomatonBuilder builder = new ParserAutomatonBuilder(grammar,
                                                     this.logger);

                this.automaton = builder.getParserAutomaton();

                this.logger.info("Store automaton into store for '"+
                                 this.grammarSource.getURI()+"'");
                store.store(this.grammarSource.getURI(),
                            new ParserAutomatonEntry(this.automaton,
                                                     this.grammarSource.getValidity()));
            } else {
                this.logger.info("Getting automaton from store for '"+
                                 this.grammarSource.getURI()+"'");
View Full Code Here

            // For each Cache Store in Cocoon's StoreJanitor
            Iterator i = this.storeJanitor.iterator();
            while(i.hasNext())
            {
                // get the Cache Store
                Store store = (Store) i.next();

                // Store name is just the className (remove the package info though, just to save space)
                String storeName = store.getClass().getName();
                storeName = storeName.substring(storeName.lastIndexOf(".")+1);

                // display its size information
                cocoon.addLabel(T_COCOON_TRANS_CACHE_SIZE.parameterize(storeName + ", 0x" + Integer.toHexString(store.hashCode())));
                cocoon.addItem(String.valueOf(store.size()));
            }
        }
    }
View Full Code Here

                            (String)entry.getKey()
                        );
                    }
                    this.serializer.endDocument();

                    Store store = null;
                    String id = Long.toHexString((hashCode()^HashUtil.hash(requestURI))+fragmentID);
                    try {
                        store = (Store) this.manager.lookup(Store.TRANSIENT_STORE);

                        store.store(id, this.serializer.getSAXFragment());
                    } catch (ComponentException ce) {
                        throw new SAXException("Could not lookup for transient store.", ce);
                    } catch (IOException ioe) {
                        throw new SAXException("Could not store fragment.", ioe);
                    } finally
View Full Code Here

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

TOP

Related Classes of org.apache.excalibur.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.