Package org.jboss.cache.config

Examples of org.jboss.cache.config.ConfigurationException


         return root;
      }
      catch (Exception e)
      {
         log.error(e);
         throw new ConfigurationException("Could not parse the config file");
      }
   }
View Full Code Here


      }

      private void logAndThrowException(SAXParseException exception)
      {
         log.error("Configuration warning: " + exception.getMessage());
         throw new ConfigurationException("Incorrect configuration file. Use '-Djbosscache.config.validate=false' to disable validation.", exception);
      }
View Full Code Here

   public Configuration parseFile(String filename)
   {
      InputStream is = new FileLookup().lookupFile(filename);
      if (is == null)
      {
         throw new ConfigurationException("Unable to find config file " + filename + " either in classpath or on the filesystem!");
      }
      return parseStream(is);
   }
View Full Code Here

   private Configuration processElements(boolean ignoreRoot)
   {
      if (!ignoreRoot &&
            (!"jbosscache".equals(root.getLocalName()) || !RootElementBuilder.JBOSSCACHE_CORE_NS.equals(root.getNamespaceURI())))
      {
            throw new ConfigurationException("Expected root element {" + RootElementBuilder.JBOSSCACHE_CORE_NS + "}" + "jbosscache");
      }

      try
      {
         configureLocking(getSingleElement("locking"));
         configureTransaction(getSingleElement("transaction"));
         configureClustering(getSingleElement("clustering"));
         configureSerialization(getSingleElement("serialization"));
         configureInvalidation(getSingleElement("invalidation"));
         configureStartup(getSingleElement("startup"));
         configureShutdown(getSingleElement("shutdown"));
         configureJmxStatistics(getSingleElement("jmxStatistics"));
         configureEviction(getSingleElement("eviction"));
         configureCacheLoaders(getSingleElement("loaders"));
         configureCustomInterceptors(getSingleElement("customInterceptors"));
         configureListeners(getSingleElement("listeners"));
         configureInvocationBatching(getSingleElement("invocationBatching"));
      }
      catch (Exception e)
      {
         throw new ConfigurationException("Unexpected exception while parsing the configuration file", e);
      }
      return config;
   }
View Full Code Here

      else if (mode.startsWith("I"))
         repl = false;

      Element asyncEl = getSingleElementInCoreNS("async", e);
      Element syncEl = getSingleElementInCoreNS("sync", e);
      if (syncEl != null && asyncEl != null) throw new ConfigurationException("Cannot have sync and async elements within the same cluster element!");
      boolean sync = asyncEl == null; // even if both are null, we default to sync
      if (sync)
      {
         config.setCacheMode(repl ? CacheMode.REPL_SYNC : CacheMode.INVALIDATION_SYNC);
         configureSyncMode(syncEl);
View Full Code Here

         {
            config.setListenerAsyncPoolSize(Integer.parseInt(asyncPoolSizeStr));
         }
         catch (NumberFormatException nfe)
         {
            throw new ConfigurationException("Unable to parse the asyncPoolSize attribute of the listeners element.  Was [" + asyncPoolSizeStr + "]");
         }
      }
   }
View Full Code Here

         is.close();
      }
      catch (IOException e)
      {
         log.warn("Unexpected", e);
         throw new ConfigurationException("Exception occured while reading properties from XML document", e);
      }
      return properties;
   }
View Full Code Here

            // this is hugely noisy!
            if (log.isDebugEnabled()) log.debug("Unrecognised attribute " + propName + ".  Please check your configuration.  Ignoring!!");
         }
         catch (Exception e)
         {
            throw new ConfigurationException("Unable to invoke setter " + setter + " on " + objectClass, e);
         }

         boolean setterFound = false;
         // if we get here, we could not find a String or Element setter.
         for (Method m : objectClass.getMethods())
         {
            if (setter.equals(m.getName()))
            {
               Class paramTypes[] = m.getParameterTypes();
               if (paramTypes.length != 1)
               {
                  if (log.isTraceEnabled())
                     log.trace("Rejecting setter " + m + " on class " + objectClass + " due to incorrect number of parameters");
                  continue; // try another param with the same name.                 
               }

               Class parameterType = paramTypes[0];
               PropertyEditor editor = PropertyEditorManager.findEditor(parameterType);
               if (editor == null)
               {
                  throw new ConfigurationException("Couldn't find a property editor for parameter type " + parameterType);
               }

               editor.setAsText((String) attribs.get(propName));

               Object parameter = editor.getValue();
               //if (log.isDebugEnabled()) log.debug("Invoking setter method: " + setter + " with parameter \"" + parameter + "\" of type " + parameter.getClass());

               try
               {
                  m.invoke(target, parameter);
                  setterFound = true;
                  break;
               }
               catch (Exception e)
               {
                  throw new ConfigurationException("Unable to invoke setter " + setter + " on " + objectClass, e);
               }
            }
         }
         if (!setterFound && failOnMissingSetter)
            throw new ConfigurationException("Couldn't find a setter named [" + setter + "] which takes a single parameter, for parameter " + propName + " on class [" + objectClass + "]");
      }
   }
View Full Code Here

   }

   public void startBatch()
   {
      if (!configuration.isInvocationBatchingEnabled())
         throw new ConfigurationException("Invocation batching not enabled in current configuration!  Please use the <invocationBatching /> element.");
      batchContainer.startBatch();
   }
View Full Code Here

   }

   public void endBatch(boolean successful)
   {
      if (!configuration.isInvocationBatchingEnabled())
         throw new ConfigurationException("Invocation batching not enabled in current configuration!  Please use the <invocationBatching /> element.");
      batchContainer.endBatch(successful);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.ConfigurationException

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.