Codota Logo
ExpressionContainerConfig
Code IndexAdd Codota to your IDE (free)

How to use
ExpressionContainerConfig
in
org.apache.shindig.config

Best Java code snippets using org.apache.shindig.config.ExpressionContainerConfig (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: org.apache.shindig/shindig-common

@Override
protected BasicContainerConfig getTemporaryConfig(boolean copyValues) {
 ExpressionContainerConfig tmp = new ExpressionContainerConfig(getExpressions());
 if (copyValues) {
  tmp.rawConfig = deepCopyConfig(rawConfig);
  tmp.config = deepCopyConfig(config);
 }
 return tmp;
}
origin: org.apache.shindig/shindig-common

@Override
public Object getProperty(String container, String property) {
 if (property.startsWith("${")) {
  // An expression!
  try {
   ValueExpression expression = expressions.parse(property, Object.class);
   return expression.getValue(createExpressionContext(container));
  } catch (ELException e) {
   return null;
  }
 }
 return super.getProperty(container, property);
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testCommonEnvironmentAddedToAllContainers() throws Exception {
 // We use a JSON Object here to guarantee that we're well formed up front.
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{DEFAULT_CONTAINER, "testContainer"});
 json.put("port", "${SERVER_PORT}");
 json.put("host", "${SERVER_HOST}");
 createConfigForTest(createTemporaryFile(json, ".json").getAbsolutePath());
 assertEquals("8080", config.getString(DEFAULT_CONTAINER, "port"));
 assertEquals("8080", config.getString("testContainer", "port"));
 assertEquals("localhost", config.getString(DEFAULT_CONTAINER, "host"));
 assertEquals("localhost", config.getString("testContainer", "host"));
}
origin: apache/shindig

@Test
public void parseBasicConfig() throws Exception {
 createConfigForTest(createDefaultContainer().getAbsolutePath());
 assertEquals(1, config.getContainers().size());
 for (String container : config.getContainers()) {
  assertEquals(DEFAULT_CONTAINER, container);
 }
 String value = config.getString(DEFAULT_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nested = config.getMap(DEFAULT_CONTAINER, NESTED_KEY);
 String nestedValue = nested.get(NESTED_NAME).toString();
 assertEquals(NESTED_VALUE, nestedValue);
}
origin: org.apache.shindig/shindig-common

@Test
public void parseWithDefaultInheritance() throws Exception {
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{CHILD_CONTAINER});
 json.put(PARENT_KEY, DEFAULT_CONTAINER);
 json.put(ARRAY_NAME, ARRAY_ALT_VALUE);
 // small nested data.
 JSONObject nested = new JSONObject();
 nested.put(NESTED_NAME, NESTED_ALT_VALUE);
 json.put(NESTED_KEY, nested);
 File childFile = createTemporaryFile(json, ".json");
 File parentFile = createDefaultContainer();
 createConfigForTest(childFile.getAbsolutePath() +
   JsonContainerConfigLoader.FILE_SEPARATOR + parentFile.getAbsolutePath());
 String value = config.getString(CHILD_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nestedObj = config.getMap(CHILD_CONTAINER, NESTED_KEY);
 String nestedValue = nestedObj.get(NESTED_NAME).toString();
 assertEquals(NESTED_ALT_VALUE, nestedValue);
 String arrayValue = config.getString(CHILD_CONTAINER, ARRAY_NAME);
 assertEquals(ARRAY_ALT_VALUE, arrayValue);
 // Verify that the parent value wasn't overwritten as well.
 List<String> actual = new ArrayList<String>();
 for (Object val : config.getList(DEFAULT_CONTAINER, ARRAY_NAME)) {
  actual.add(val.toString());
 }
 List<String> expected = Arrays.asList(ARRAY_VALUE);
 assertEquals(expected, actual);
}
origin: org.apache.shindig/shindig-common

@Before
public void setUp() {
 config = new ExpressionContainerConfig(Expressions.forTesting());
}
origin: org.apache.shindig/shindig-common

@Test
public void testNullEntriesOverrideEntriesInParent() throws Exception {
 // We use JSON Objects here to guarantee that we're well formed up front.
 JSONObject parent = new JSONObject("{ 'gadgets.container' : ['default'], features : { osapi : 'foo' }}");
 JSONObject child = new JSONObject("{ 'gadgets.container' : ['child'], features : null}");
 JSONObject grand = new JSONObject("{ 'gadgets.container' : ['grand'], parent : 'child'}");
 createConfigForTest(createTemporaryFile(parent, ".json").getAbsolutePath());
 createConfigForTest(createTemporaryFile(child, ".json").getAbsolutePath());
 createConfigForTest(createTemporaryFile(grand, ".json").getAbsolutePath());
 assertEquals("foo", config.getMap("default", "features").get("osapi"));
 assertNull(config.getProperty("child", "features"));
 assertNull(config.getProperty("grand", "features"));
}
origin: org.apache.shindig/shindig-common

@Test
public void nullEntryEvaluation() throws Exception {
 // We use a JSON Object here to guarantee that we're well formed up front.
 JSONObject json = new JSONObject("{ 'gadgets.container' : ['default'], features : { osapi : null }}");
 createConfigForTest(createTemporaryFile(json, ".json").getAbsolutePath());
 assertNull(config.getMap("default", "features").get("osapi"));
}
origin: org.wso2.org.apache.shindig/shindig-common

protected ELContext createExpressionContext(String container) {
 return getExpressions().newELContext(new ContainerConfigELResolver(this, container));
}
origin: org.apache.shindig/shindig-common

@Test
public void testCommonEnvironmentAddedToAllContainers() throws Exception {
 // We use a JSON Object here to guarantee that we're well formed up front.
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{DEFAULT_CONTAINER, "testContainer"});
 json.put("port", "${SERVER_PORT}");
 json.put("host", "${SERVER_HOST}");
 createConfigForTest(createTemporaryFile(json, ".json").getAbsolutePath());
 assertEquals("8080", config.getString(DEFAULT_CONTAINER, "port"));
 assertEquals("8080", config.getString("testContainer", "port"));
 assertEquals("localhost", config.getString(DEFAULT_CONTAINER, "host"));
 assertEquals("localhost", config.getString("testContainer", "host"));
}
origin: org.apache.shindig/shindig-common

@Test
public void parseBasicConfig() throws Exception {
 createConfigForTest(createDefaultContainer().getAbsolutePath());
 assertEquals(1, config.getContainers().size());
 for (String container : config.getContainers()) {
  assertEquals(DEFAULT_CONTAINER, container);
 }
 String value = config.getString(DEFAULT_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nested = config.getMap(DEFAULT_CONTAINER, NESTED_KEY);
 String nestedValue = nested.get(NESTED_NAME).toString();
 assertEquals(NESTED_VALUE, nestedValue);
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void parseWithDefaultInheritance() throws Exception {
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{CHILD_CONTAINER});
 json.put(PARENT_KEY, DEFAULT_CONTAINER);
 json.put(ARRAY_NAME, ARRAY_ALT_VALUE);
 // small nested data.
 JSONObject nested = new JSONObject();
 nested.put(NESTED_NAME, NESTED_ALT_VALUE);
 json.put(NESTED_KEY, nested);
 File childFile = createTemporaryFile(json, ".json");
 File parentFile = createDefaultContainer();
 createConfigForTest(childFile.getAbsolutePath() +
   JsonContainerConfigLoader.FILE_SEPARATOR + parentFile.getAbsolutePath());
 String value = config.getString(CHILD_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nestedObj = config.getMap(CHILD_CONTAINER, NESTED_KEY);
 String nestedValue = nestedObj.get(NESTED_NAME).toString();
 assertEquals(NESTED_ALT_VALUE, nestedValue);
 String arrayValue = config.getString(CHILD_CONTAINER, ARRAY_NAME);
 assertEquals(ARRAY_ALT_VALUE, arrayValue);
 // Verify that the parent value wasn't overwritten as well.
 List<String> actual = new ArrayList<String>();
 for (Object val : config.getList(DEFAULT_CONTAINER, ARRAY_NAME)) {
  actual.add(val.toString());
 }
 List<String> expected = Arrays.asList(ARRAY_VALUE);
 assertEquals(expected, actual);
}
origin: apache/shindig

@Before
public void setUp() {
 config = new ExpressionContainerConfig(Expressions.forTesting());
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testNullEntriesOverrideEntriesInParent() throws Exception {
 // We use JSON Objects here to guarantee that we're well formed up front.
 JSONObject parent = new JSONObject("{ 'gadgets.container' : ['default'], features : { osapi : 'foo' }}");
 JSONObject child = new JSONObject("{ 'gadgets.container' : ['child'], features : null}");
 JSONObject grand = new JSONObject("{ 'gadgets.container' : ['grand'], parent : 'child'}");
 createConfigForTest(createTemporaryFile(parent, ".json").getAbsolutePath());
 createConfigForTest(createTemporaryFile(child, ".json").getAbsolutePath());
 createConfigForTest(createTemporaryFile(grand, ".json").getAbsolutePath());
 assertEquals("foo", config.getMap("default", "features").get("osapi"));
 assertNull(config.getProperty("child", "features"));
 assertNull(config.getProperty("grand", "features"));
}
origin: apache/shindig

@Test
public void nullEntryEvaluation() throws Exception {
 // We use a JSON Object here to guarantee that we're well formed up front.
 JSONObject json = new JSONObject("{ 'gadgets.container' : ['default'], features : { osapi : null }}");
 createConfigForTest(createTemporaryFile(json, ".json").getAbsolutePath());
 assertNull(config.getMap("default", "features").get("osapi"));
}
origin: org.apache.shindig/shindig-common

protected ELContext createExpressionContext(String container) {
 return getExpressions().newELContext(new ContainerConfigELResolver(this, container));
}
origin: apache/shindig

@Test
public void testCommonEnvironmentAddedToAllContainers() throws Exception {
 // We use a JSON Object here to guarantee that we're well formed up front.
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{DEFAULT_CONTAINER, "testContainer"});
 json.put("port", "${SERVER_PORT}");
 json.put("host", "${SERVER_HOST}");
 createConfigForTest(createTemporaryFile(json, ".json").getAbsolutePath());
 assertEquals("8080", config.getString(DEFAULT_CONTAINER, "port"));
 assertEquals("8080", config.getString("testContainer", "port"));
 assertEquals("localhost", config.getString(DEFAULT_CONTAINER, "host"));
 assertEquals("localhost", config.getString("testContainer", "host"));
}
origin: org.wso2.org.apache.shindig/shindig-common

@Override
protected BasicContainerConfig getTemporaryConfig(boolean copyValues) {
 ExpressionContainerConfig tmp = new ExpressionContainerConfig(getExpressions());
 if (copyValues) {
  tmp.rawConfig = deepCopyConfig(rawConfig);
  tmp.config = deepCopyConfig(config);
 }
 return tmp;
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void parseBasicConfig() throws Exception {
 createConfigForTest(createDefaultContainer().getAbsolutePath());
 assertEquals(1, config.getContainers().size());
 for (String container : config.getContainers()) {
  assertEquals(DEFAULT_CONTAINER, container);
 }
 String value = config.getString(DEFAULT_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nested = config.getMap(DEFAULT_CONTAINER, NESTED_KEY);
 String nestedValue = nested.get(NESTED_NAME).toString();
 assertEquals(NESTED_VALUE, nestedValue);
}
origin: apache/shindig

@Test
public void parseWithDefaultInheritance() throws Exception {
 JSONObject json = new JSONObject();
 json.put(CONTAINER_KEY, new String[]{CHILD_CONTAINER});
 json.put(PARENT_KEY, DEFAULT_CONTAINER);
 json.put(ARRAY_NAME, ARRAY_ALT_VALUE);
 // small nested data.
 JSONObject nested = new JSONObject();
 nested.put(NESTED_NAME, NESTED_ALT_VALUE);
 json.put(NESTED_KEY, nested);
 File childFile = createTemporaryFile(json, ".json");
 File parentFile = createDefaultContainer();
 createConfigForTest(childFile.getAbsolutePath() +
   JsonContainerConfigLoader.FILE_SEPARATOR + parentFile.getAbsolutePath());
 String value = config.getString(CHILD_CONTAINER, TOP_LEVEL_NAME);
 assertEquals(TOP_LEVEL_VALUE, value);
 Map<String, Object> nestedObj = config.getMap(CHILD_CONTAINER, NESTED_KEY);
 String nestedValue = nestedObj.get(NESTED_NAME).toString();
 assertEquals(NESTED_ALT_VALUE, nestedValue);
 String arrayValue = config.getString(CHILD_CONTAINER, ARRAY_NAME);
 assertEquals(ARRAY_ALT_VALUE, arrayValue);
 // Verify that the parent value wasn't overwritten as well.
 List<String> actual = new ArrayList<String>();
 for (Object val : config.getList(DEFAULT_CONTAINER, ARRAY_NAME)) {
  actual.add(val.toString());
 }
 List<String> expected = Arrays.asList(ARRAY_VALUE);
 assertEquals(expected, actual);
}
org.apache.shindig.configExpressionContainerConfig

Javadoc

Represents a container configuration that uses expressions in values. We use a cascading model, so you only have to specify attributes in your config that you actually want to change. String values may use expressions. The variable context defaults to the 'current' container, but parent values may be accessed through the special "parent" property. get* can take either a simple property name (foo), or an EL expression (${foo.bar}).

Most used methods

  • <init>
  • createExpressionContext
  • getContainers
  • getExpressions
  • getList
  • getMap
  • getProperty
  • getString

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • runOnUiThread (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ImageIO (javax.imageio)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now