Package org.exoplatform.container.xml

Examples of org.exoplatform.container.xml.ObjectParameter


      final List<InetSocketAddress> isaLocations = AddrUtil.getAddresses(locations.getValue());
      this.cache = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<MemcachedClient>()
      {
         public MemcachedClient run() throws IOException
         {
            ObjectParameter op = params.getObjectParam(CONNECTION_FACTORY_CREATOR);
            if (op == null || op.getObject() == null)
            {
               LOG.debug("No connection factory creator has been defined, "
                  + "so we will use the BinaryConnectionFactory by default");
               return new MemcachedClient(new BinaryConnectionFactory(), isaLocations);
            }
            else if (!(op.getObject() instanceof ConnectionFactoryCreator))
            {
               throw new IllegalArgumentException("The parameter '" + CONNECTION_FACTORY_CREATOR
                  + "' must refer to a ConnectionFactoryCreator.");
            }
            else
            {
               return new MemcachedClient(((ConnectionFactoryCreator)op.getObject()).create(), isaLocations);
            }
         }
      });

      ValueParam vp = params.getValueParam(DEFAULT_EXPIRATION_TIMEOUT);
View Full Code Here


         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);
View Full Code Here

      assertPropertyParam("${b_value}", component, "e", "e_b");
      assertPropertyParam("c_external_value", component, "e", "e_c");
      assertPropertyParam("_d_external_value_", component, "e", "e_d");

      //
      ObjectParameter o = component.getInitParams().getObjectParam("f");
      assertNotNull(o);
      Person p = (Person)o.getObject();
      assertNotNull(p);
      assertEquals("a_value", p.address_a);
      assertEquals("${b_value}", p.address_b);
      assertEquals("c_external_value", p.address_c);
      assertEquals("_d_external_value_", p.address_d);
View Full Code Here

      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream(basedir + "/target/configuration.xml"));
   }

   public void testConfigurationService(InitParams params) throws Exception
   {
      ObjectParameter objParam = params.getObjectParam("new.user.configuration");
      objParam.getObject();
   }
View Full Code Here

      {
         nodeType =
            initParams.getValuesParam("nodetype") != null ? initParams.getValueParam("nodetype").getValue()
               : DEFAULT_NODETYPE;

         ObjectParameter param = initParams.getObjectParam("observation.config");
         observationListenerConfiguration = (ObservationListenerConfiguration)param.getObject();
      }
      else
      {
         nodeType = DEFAULT_NODETYPE;
      }
View Full Code Here

    * Create the default {@link PortalContainerDefinition} corresponding to the given parameters
    * @param params the parameter to initialize
    */
   private PortalContainerDefinition create(InitParams params)
   {
      ObjectParameter oDpd = null;
      if (params != null)
      {
         oDpd = params.getObjectParam("default.portal.definition");
      }
      PortalContainerDefinition def = null;
      if (oDpd != null)
      {
         // A default portal definition has been found
         final Object o = oDpd.getObject();
         if (o instanceof PortalContainerDefinition)
         {
            // The nested object is of the right type
            def = (PortalContainerDefinition)o;
         }
View Full Code Here

    * object parameter <i>actions</i> that contains the
    * {@link ActionConfiguration} objects
    */
   public AddActionsPlugin(InitParams params)
   {
      ObjectParameter param = params.getObjectParam("actions");

      if (param != null)
      {
         actionsConfig = (ActionsConfig)param.getObject();
      }
   }
View Full Code Here

   }

   public void testCacheFactory() throws Exception
   {
      InitParams params = new InitParams();
      ObjectParameter param = new ObjectParameter();
      param.setName("NoImpl");
      ExoCacheConfig config = new ExoCacheConfig();
      config.setName(param.getName());
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("KnownImpl");
      config = new ExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache");
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("UnKnownImpl");
      config = new ExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("fakeImpl");
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("UnKnownImplButCorrectFQN");
      config = new ExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("java.lang.String");
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("NoImpl-MyExoCacheConfig");
      config = new MyExoCacheConfig();
      config.setName(param.getName());
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("KnownImpl-MyExoCacheConfig");
      config = new MyExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("org.exoplatform.services.cache.FIFOExoCache");
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("UnKnownImpl-MyExoCacheConfig");
      config = new MyExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("fakeImpl");
      param.setObject(config);
      params.addParameter(param);

      param = new ObjectParameter();
      param.setName("UnKnownImplButCorrectFQN-MyExoCacheConfig");
      config = new MyExoCacheConfig();
      config.setName(param.getName());
      config.setImplementation("java.lang.String");
      param.setObject(config);
      params.addParameter(param);

      CacheService cs = new CacheServiceImpl(params, new MyExoCacheFactory());
      assertTrue("Expected type MyExoCache found " + cs.getCacheInstance("NoImpl").getClass(),
         cs.getCacheInstance("NoImpl") instanceof MyExoCache);
View Full Code Here

    * Create the default {@link PortalContainerDefinition} corresponding to the given parameters
    * @param params the parameter to initialize
    */
   private PortalContainerDefinition create(InitParams params)
   {
      ObjectParameter oDpd = null;
      if (params != null)
      {
         oDpd = params.getObjectParam("default.portal.definition");
      }
      PortalContainerDefinition def = null;
      if (oDpd != null)
      {
         // A default portal definition has been found
         final Object o = oDpd.getObject();
         if (o instanceof PortalContainerDefinition)
         {
            // The nested object is of the right type
            def = (PortalContainerDefinition)o;
         }
View Full Code Here

      {
         nodeType =
            initParams.getValuesParam("nodetype") != null ? initParams.getValueParam("nodetype").getValue()
               : DEFAULT_NODETYPE;

         ObjectParameter param = initParams.getObjectParam("observation.config");
         observationListenerConfiguration = (ObservationListenerConfiguration)param.getObject();
      }
      else
      {
         nodeType = DEFAULT_NODETYPE;
      }
View Full Code Here

TOP

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

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.