Search in sources :

Example 16 with ValueParam

use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.

the class TestInitParamProfile method testFooBarProfiles.

public void testFooBarProfiles() throws Exception {
    Configuration config = getConfiguration("init-param-configuration.xml", "foo", "bar");
    Component component = config.getComponent("Component");
    InitParams initParams = component.getInitParams();
    ValueParam valueParam = initParams.getValueParam("param");
    assertEquals("bar", valueParam.getValue());
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) Configuration(org.exoplatform.container.xml.Configuration) Component(org.exoplatform.container.xml.Component) ValueParam(org.exoplatform.container.xml.ValueParam)

Example 17 with ValueParam

use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.

the class PortalContainerConfig method initName.

/**
 * Initialize the value of the portal container name
 */
private void initName(InitParams params, PortalContainerDefinition def) {
    if (def.getName() == null || def.getName().trim().length() == 0) {
        // The name is empty
        // We first set the default value
        def.setName(DEFAULT_PORTAL_CONTAINER_NAME);
        if (params == null) {
            return;
        }
        final ValueParam vp = params.getValueParam("default.portal.container");
        if (vp != null && vp.getValue().trim().length() > 0) {
            // A name has been defined in the value parameter, thus we use it
            def.setName(Deserializer.resolveVariables(vp.getValue().trim()));
        }
    } else {
        // We ensure that the name doesn't contain any useless characters
        def.setName(def.getName().trim());
    }
}
Also used : ValueParam(org.exoplatform.container.xml.ValueParam)

Example 18 with ValueParam

use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.

the class PortalContainerConfig method initRestContextName.

/**
 * Initialize the value of the rest context name
 */
private void initRestContextName(InitParams params, PortalContainerDefinition def) {
    if (def.getRestContextName() == null || def.getRestContextName().trim().length() == 0) {
        // The rest context name is empty
        // We first set the default value
        def.setRestContextName(DEFAULT_REST_CONTEXT_NAME);
        if (params == null) {
            return;
        }
        final ValueParam vp = params.getValueParam("default.rest.context");
        if (vp != null && vp.getValue().trim().length() > 0) {
            // A rest context name has been defined in the value parameter, thus we use it
            def.setRestContextName(Deserializer.resolveVariables(vp.getValue().trim()));
        }
    } else {
        // We ensure that the rest context name doesn't contain any useless characters
        def.setRestContextName(def.getRestContextName().trim());
    }
}
Also used : ValueParam(org.exoplatform.container.xml.ValueParam)

Example 19 with ValueParam

use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.

the class TestPropertyManagerConfigurator method testFromPropertiesByParam.

public void testFromPropertiesByParam() throws Exception {
    reset();
    URL propertiesURL = TestPropertyManagerConfigurator.class.getResource("property-configurator.properties");
    assertNotNull(propertiesURL);
    System.setProperty("property_2", "property_value_2");
    ValueParam propertiesPathParam = new ValueParam();
    propertiesPathParam.setName("properties.url");
    propertiesPathParam.setValue(propertiesURL.toString());
    InitParams params = new InitParams();
    params.put("properties.url", propertiesPathParam);
    new PropertyConfigurator(params, new ConfigurationManagerImpl(new HashSet<String>()));
    Map<String, String> additions = reset();
    assertEquals("property_value_1", additions.get("property_1"));
    assertEquals("property_value_2", additions.get("property_2"));
    assertEquals("${property_3}", additions.get("property_3"));
    assertEquals("property_value_1-property_value_2", additions.get("property_4"));
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) ValueParam(org.exoplatform.container.xml.ValueParam) ConfigurationManagerImpl(org.exoplatform.container.configuration.ConfigurationManagerImpl) URL(java.net.URL) HashSet(java.util.HashSet)

Example 20 with ValueParam

use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.

the class TestConfigurationXML method assertValueParam.

private void assertValueParam(String expectedValue, Component component, String paramName) {
    InitParams initParams = component.getInitParams();
    assertNotNull(initParams);
    ValueParam valueParam = initParams.getValueParam(paramName);
    assertNotNull(paramName);
    assertEquals(expectedValue, valueParam.getValue());
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) ValueParam(org.exoplatform.container.xml.ValueParam)

Aggregations

ValueParam (org.exoplatform.container.xml.ValueParam)20 InitParams (org.exoplatform.container.xml.InitParams)16 RPCServiceImpl (org.exoplatform.services.rpc.jgv3.RPCServiceImpl)7 RemoteCommand (org.exoplatform.services.rpc.RemoteCommand)5 RPCException (org.exoplatform.services.rpc.RPCException)4 ArrayList (java.util.ArrayList)3 Component (org.exoplatform.container.xml.Component)3 Configuration (org.exoplatform.container.xml.Configuration)3 Serializable (java.io.Serializable)2 DataSource (javax.sql.DataSource)2 DataSourceProvider (org.exoplatform.services.jdbc.DataSourceProvider)2 MemberHasLeftException (org.exoplatform.services.rpc.impl.AbstractRPCService.MemberHasLeftException)2 URL (java.net.URL)1 Connection (java.sql.Connection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 InitialContext (javax.naming.InitialContext)1 ConfigurationManager (org.exoplatform.container.configuration.ConfigurationManager)1