Package org.exoplatform.container.xml

Examples of org.exoplatform.container.xml.Configuration


   @Managed
   @ManagedDescription("The configuration of the container in XML format.")
   public String getConfigurationXML()
   {
      Configuration config = getConfiguration();
      if (config == null)
      {
         log.warn("The configuration of the RootContainer could not be found");
         return null;
      }
      return config.toXML();
   }
View Full Code Here


   private void dynamicReload()
   {
      final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
      final Properties currentSystemProperties = System.getProperties();
      boolean hasChanged = false;
      Configuration newConfig = null;
      try
      {
         Thread.currentThread().setContextClassLoader(loadingCL);
         hasChanged = true;
         System.setProperties(loadingSystemProperties);
         ConfigurationManager cm = loadConfigurationManager(this, false);
         if (cm != null)
         {
            newConfig = cm.getConfiguration();
         }
      }
      catch (Exception e)
      {
         if (LOG.isDebugEnabled())
         {
            LOG.debug("Could not load the new configuration of the root container", e);
         }
      }
      finally
      {
         if (hasChanged)
         {
            Thread.currentThread().setContextClassLoader(currentClassLoader);
            System.setProperties(currentSystemProperties);
         }
      }
      if (newConfig == null)
      {
         // We have no way to know if the configuration of the root container has changed so
         // we reload everything
         LOG.info("The new configuration of the root container could not be loaded,"
            + " thus everything will be reloaded");
         reload();
         return;
      }
      Configuration currentConfig = getConfiguration();
      if (currentConfig == null)
      {
         // We have no way to know if the configuration of the root container has changed so
         // we reload everything
         LOG.info("The current configuration of the root container could not be loaded," +
                  " thus everything will be reloaded");
         reload();
         return;
      }
      if (newConfig.getCurrentSize() != currentConfig.getCurrentSize()
         || newConfig.getCurrentHash() != currentConfig.getCurrentHash())
      {
         // The root container has changed so we reload everything
         LOG.info("The configuration of the root container has changed," +
                  " thus everything will be reloaded");
         reload();
View Full Code Here

         service.addConfiguration("file:" + overrideConf);
      }
      service.processRemoveConfiguration();
      if (PropertyManager.isDevelopping())
      {
         Configuration conf = service.getConfiguration();
         if (conf != null)
         {
            conf.keepCurrentState();
         }
      }
      return service;
   }
View Full Code Here

    */
   @Managed
   @ManagedDescription("The configuration of the container in XML format.")
   public String getConfigurationXML()
   {
      Configuration config = getConfiguration();
      if (config == null)
      {
         LOG.warn("The configuration of the RootContainer could not be found");
         return null;
      }
      return config.toXML();
   }
View Full Code Here

      assertNotNull(is);
      try
      {
         IBindingFactory bfact = BindingDirectory.getFactory(XMLObject.class);
         IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
         Configuration conf =
            (Configuration)uctx.unmarshalDocument(is, null);

         assertNotNull(conf);
         Iterator it = conf.getContainerLifecyclePluginIterator();
         assertNotNull(it);
         assertTrue(it.hasNext());
         ContainerLifecyclePlugin conlp = (ContainerLifecyclePlugin)it.next();
         assertEquals("container-lifecycle-plugin-type", conlp.getType());
         assertNotNull(conlp.getInitParams());
         assertEquals("container-lifecycle-plugin-value-param-value", (conlp.getInitParams().getValueParam("container-lifecycle-plugin-value-param-name")).getValue());
         it = conf.getComponentLifecyclePluginIterator();
         assertNotNull(it);
         assertTrue(it.hasNext());        
         ComponentLifecyclePlugin comlp = (ComponentLifecyclePlugin)it.next();
         assertEquals("component-lifecycle-plugin", comlp.getType());
         ManageableComponents mc = comlp.getManageableComponents();
         assertNotNull(mc);
         assertEquals("manageable-components-component-type", mc.getComponentsType().get(0));
         ValuesParam valuesParam = comlp.getInitParams().getValuesParam("component-lifecycle-plugin-values-param-name");
         assertNotNull(valuesParam);
         assertNotNull(valuesParam.getValues());
         assertTrue(valuesParam.getValues().contains("component-lifecycle-plugin-values-param-value1"));
         assertTrue(valuesParam.getValues().contains("component-lifecycle-plugin-values-param-value2"));
         Component c = conf.getComponent("component-key1");
         assertNotNull(c);
         assertEquals("component-type1", c.getType());
         PropertiesParam propertiesParam = c.getInitParams().getPropertiesParam("component-key1-properties-param-name");
         assertNotNull(propertiesParam);
         assertEquals("component-key1-properties-param-prop-value", propertiesParam.getProperty("component-key1-properties-param-prop-name"));
         c = conf.getComponent("component-type2");
         assertNotNull(c);
         ObjectParameter objectParameter = c.getInitParams().getObjectParam("component-key2-object-param-name");
         assertNotNull(objectParameter);
         MyObject o = (MyObject)objectParameter.getObject();
         assertNotNull(o);
         assertEquals("string-value", o.field1);
         assertEquals(1, o.field2);
         assertEquals(1l, o.field3);
         assertEquals(1d, o.field4);
         assertEquals(true, o.field5);
         assertNotNull(o.field6);
         assertEquals("entry-value", o.field6.get("entry-name"));
         assertNotNull(o.field7);
         assertTrue(o.field7.contains("string-value"));
         assertNotNull(o.field8);
         assertEquals(1, o.field8[0]);
         List list = c.getComponentPlugins();
         assertNotNull(list);
         assertFalse(list.isEmpty());
         ComponentPlugin cp = (ComponentPlugin)list.get(0);
         assertEquals("component-plugins-name", cp.getName());
         assertEquals("set-method-name", cp.getSetMethod());
         assertEquals("component-plugins-type", cp.getType());
         assertEquals(1, cp.getPriority());
         it = conf.getExternalComponentPluginsIterator();
         assertNotNull(it);
         assertTrue(it.hasNext());        
         ExternalComponentPlugins ecps = (ExternalComponentPlugins)it.next();
         assertEquals("target-component-name", ecps.getTargetComponent());
         list = ecps.getComponentPlugins();
         assertNotNull(list);
         assertFalse(list.isEmpty());
         cp = (ComponentPlugin)list.get(0);
         assertEquals("component-plugins-name", cp.getName());
         assertEquals("set-method-name", cp.getSetMethod());
         assertEquals("component-plugins-type", cp.getType());
         assertEquals(1, cp.getPriority());
         list = conf.getImports();
         assertNotNull(list);
         assertFalse(list.isEmpty());
         assertEquals("import-value", list.get(0));
         list = conf.getRemoveConfiguration();
         assertNotNull(list);
         assertFalse(list.isEmpty());
         assertEquals("remove-configuration-value", list.get(0));
      }
      finally
View Full Code Here

      //
      String projectdir = System.getProperty("basedir");
      IBindingFactory bfact = BindingDirectory.getFactory(XMLObject.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Configuration conf =
         (Configuration)uctx.unmarshalDocument(new FileInputStream(projectdir
            + "/src/test/resources/test-resolved-property.xml"), null);

      assertNotNull(conf);

      //
      Component component = conf.getComponent("component");
      assertNotNull(component);

      //
      assertValueParam("a_value", component, "a");
      assertValueParam("${b_value}", component, "b");
View Full Code Here

    */
   @Managed
   @ManagedDescription("The configuration of the container in XML format.")
   public String getConfigurationXML()
   {
      Configuration conf = getConfiguration();
      if (conf == null)
      {
         LOG.warn("The configuration of the PortalContainer could not be found");
         return null;
      }
      Configuration result = Configuration.merge(((ExoContainer)parent).getConfiguration(), conf);
      if (result == null)
      {
         LOG.warn("The configurations could not be merged");
         return null;
      }
      return result.toXML();
   }
View Full Code Here

   private void dynamicReload()
   {
      final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
      final Properties currentSystemProperties = System.getProperties();
      boolean hasChanged = false;
      Configuration newConfig = null;
      try
      {
         Thread.currentThread().setContextClassLoader(loadingCL);
         hasChanged = true;
         System.setProperties(loadingSystemProperties);
         ConfigurationManager cm = loadConfigurationManager(this, false);
         if (cm != null)
         {
            newConfig = cm.getConfiguration();
         }
      }
      catch (Exception e)
      {
         if (LOG.isDebugEnabled())
         {
            LOG.debug("Could not load the new configuration of the root container", e);
         }
      }
      finally
      {
         if (hasChanged)
         {
            Thread.currentThread().setContextClassLoader(currentClassLoader);
            System.setProperties(currentSystemProperties);
         }
      }
      if (newConfig == null)
      {
         // We have no way to know if the configuration of the root container has changed so
         // we reload everything
         LOG.info("The new configuration of the root container could not be loaded,"
            + " thus everything will be reloaded");
         reload();
         return;
      }
      Configuration currentConfig = getConfiguration();
      if (currentConfig == null)
      {
         // We have no way to know if the configuration of the root container has changed so
         // we reload everything
         LOG.info("The current configuration of the root container could not be loaded," +
                  " thus everything will be reloaded");
         reload();
         return;
      }
      if (newConfig.getCurrentSize() != currentConfig.getCurrentSize()
         || newConfig.getCurrentHash() != currentConfig.getCurrentHash())
      {
         // The root container has changed so we reload everything
         LOG.info("The configuration of the root container has changed," +
                  " thus everything will be reloaded");
         reload();
View Full Code Here

         service.addConfiguration("file:" + overrideConf);
      }
      service.processRemoveConfiguration();
      if (PropertyManager.isDevelopping())
      {
         Configuration conf = service.getConfiguration();
         if (conf != null)
         {
            conf.keepCurrentState();
         }
      }
      return service;
   }
View Full Code Here

    */
   @Managed
   @ManagedDescription("The configuration of the container in XML format.")
   public String getConfigurationXML()
   {
      Configuration config = getConfiguration();
      if (config == null)
      {
         LOG.warn("The configuration of the RootContainer could not be found");
         return null;
      }
      return config.toXML();
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.container.xml.Configuration

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.