Package org.jboss.cache.config

Examples of org.jboss.cache.config.ConfigurationException


      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


         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

      {
         evictionConfig.setWakeupInterval(getInt(wakeUpInterval));
      }
      else
      {
         throw new ConfigurationException("Missing mandatory attribute wakeUpInterval");
      }

      List<EvictionRegionConfig> evictionRegionConfigs = new LinkedList<EvictionRegionConfig>();
      Element defaultRegion = getSingleElementInCoreNS("default", evictionElement);
View Full Code Here

         {
            algorithm = Util.getInstance(algorithmClass);
         }
         catch (Exception e)
         {
            throw new ConfigurationException("Unable to construct eviction algorithm class [" + algorithmClassName + "]", e);
         }

         try
         {
            algorithmConfig = Util.getInstance(algorithm.getConfigurationClass());
         }
         catch (Exception e)
         {
            throw new RuntimeException("Failed to instantiate eviction algorithm configuration class [" +
                  algorithm.getConfigurationClass() + "]", e);
         }
      }
      else
      {
         if (!isDefault)
         {
            if (defaultRegion == null || defaultRegion.getEvictionAlgorithmConfig() == null)
            {
               throw new MissingPolicyException("There is no Eviction Algorithm Class specified on the region or for the entire cache!");
            }
            else
            {
               try
               {
                  algorithmConfig = defaultRegion.getEvictionAlgorithmConfig().clone();
               }
               catch (CloneNotSupportedException e)
               {
                  throw new ConfigurationException("Unable to clone eviction algorithm configuration from default", e);
               }
            }
         }
      }
View Full Code Here

         {
            // try other setters that may fit later on.  Don't throw this exception though.           
         }
         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

    * Builds the interceptor based on the interceptor class and also sets all its attributes.
    */
   private CommandInterceptor buildCommandInterceptor(Element element)
   {
      String interceptorClass = getAttributeValue(element, "class");
      if (!existsAttribute(interceptorClass)) throw new ConfigurationException("Interceptor class cannot be empty!");
      CommandInterceptor result;
      try
      {
         result = (CommandInterceptor) Util.loadClass(interceptorClass).newInstance();
      }
      catch (Exception e)
      {
         throw new ConfigurationException("CommandInterceptor class is not properly loaded in classloader", e);
      }
      Properties p = XmlConfigHelper.extractProperties(element);
      XmlConfigHelper.setValues(result, p, false, true);
      return result;
   }
View Full Code Here

      if (existsAttribute(ignoreModifications)) iclc.setIgnoreModifications(getBoolean(ignoreModifications));
      String purgeOnStartup = getAttributeValue(indivElement, "purgeOnStartup");
      if (existsAttribute(purgeOnStartup)) iclc.setPurgeOnStartup(getBoolean(purgeOnStartup));
      String clClass = getAttributeValue(indivElement, "class");
      if (!existsAttribute(clClass))
         throw new ConfigurationException("Missing 'class'  attribute for cache loader configuration");
      iclc.setClassName(clClass);
      iclc.setProperties(XmlConfigHelper.readPropertiesContents(indivElement, "properties"));
      CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig ssc = parseSingletonStoreConfig(getSingleElementInCoreNS("singletonStore", indivElement));
      if (ssc != null)
      {
View Full Code Here

      for (int i = 0; i < nodesToPreload.getLength(); i++)
      {
         Element node = (Element) nodesToPreload.item(i);
         String fqn2preload = getAttributeValue(node, "fqn");
         if (!existsAttribute(fqn2preload))
            throw new ConfigurationException("Missing 'fqn' attribute in 'preload' element");
         if (i > 0) result.append(",");
         result.append(fqn2preload);
      }
      //no elements defined for preload so by default load the root
      if (nodesToPreload.getLength() == 0)
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.