You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2011/10/05 10:26:49 UTC
svn commit: r1179099 - in /aries/trunk/blueprint: blueprint-core/
blueprint-core/src/main/java/org/apache/aries/blueprint/container/
blueprint-core/src/main/java/org/apache/aries/blueprint/ext/
blueprint-core/src/main/java/org/apache/aries/blueprint/ex...
Author: timothyjward
Date: Wed Oct 5 08:26:48 2011
New Revision: 1179099
URL: http://svn.apache.org/viewvc?rev=1179099&view=rev
Log:
ARIES-727: Improve Evaluator support in blueprint ext namespace
Added:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyEvaluator.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlExpressionParser.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlPropertyEvaluator.java
aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext-1.2.xsd
Removed:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/JexlExpressionParser.java
Modified:
aries/trunk/blueprint/blueprint-core/pom.xml
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/ExtNamespaceHandler.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyPlaceholder.java
aries/trunk/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml
aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/ext/PropertyPlaceholderTest.java
aries/trunk/blueprint/blueprint-itests/pom.xml
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java
aries/trunk/blueprint/blueprint-parser/pom.xml
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedServiceReferenceMetadata.java
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/ServiceReferenceMetadataImpl.java
aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml
Modified: aries/trunk/blueprint/blueprint-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/pom.xml?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-core/pom.xml Wed Oct 5 08:26:48 2011
@@ -57,6 +57,7 @@
org.apache.aries.blueprint.annotation.service;resolution:=optional,
org.apache.aries.quiesce.manager;version="[0.2,1.0)";resolution:=optional,
org.apache.aries.quiesce.participant;version="[0.2,1.0)";resolution:=optional,
+ org.apache.commons.jexl2;resolution:=optional,
*
</aries.osgi.import>
<aries.osgi.private.pkg />
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java Wed Oct 5 08:26:48 2011
@@ -46,6 +46,7 @@ import org.apache.aries.blueprint.di.Rec
import org.apache.aries.blueprint.utils.BundleDelegatingClassLoader;
import org.apache.aries.blueprint.utils.ReflectionUtils;
import org.apache.aries.proxy.UnableToProxyException;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
@@ -120,8 +121,8 @@ public abstract class AbstractServiceRef
// Synchronized block on references so that service events won't interfere with initial references tracking
// though this may not be sufficient because we don't control ordering of those events
synchronized (references) {
- blueprintContainer.getBundleContext().addServiceListener(this, getOsgiFilter());
- ServiceReference[] references = blueprintContainer.getBundleContext().getServiceReferences(null, getOsgiFilter());
+ getBundleContextForServiceLookup().addServiceListener(this, getOsgiFilter());
+ ServiceReference[] references = getBundleContextForServiceLookup().getServiceReferences(null, getOsgiFilter());
if (references != null) {
for (ServiceReference reference : references) {
this.references.add(reference);
@@ -140,7 +141,7 @@ public abstract class AbstractServiceRef
public void stop() {
if (started.compareAndSet(true, false)) {
synchronized (references) {
- blueprintContainer.getBundleContext().removeServiceListener(this);
+ getBundleContextForServiceLookup().removeServiceListener(this);
doStop();
for (Iterator<ServiceReference> it = references.iterator(); it.hasNext();) {
ServiceReference ref = it.next();
@@ -233,6 +234,8 @@ public abstract class AbstractServiceRef
if (!interfaces.iterator().hasNext()) {
return new Object();
} else {
+ //We don't use the #getBundleContextForServiceLookup() method here, the bundle requesting the proxy is the
+ //blueprint client, not the context of the lookup
return BlueprintExtender.getProxyManager().createDelegatingProxy(blueprintContainer.getBundleContext().getBundle(), interfaces, dispatcher, null);
}
}
@@ -297,6 +300,17 @@ public abstract class AbstractServiceRef
return null;
}
+ protected BundleContext getBundleContextForServiceLookup() {
+ if (metadata instanceof ExtendedServiceReferenceMetadata && ((ExtendedServiceReferenceMetadata) metadata).getRuntimeInterface() != null) {
+ BundleContext context = ((ExtendedServiceReferenceMetadata) metadata).getBundleContext();
+ if(context != null) {
+ return context;
+ }
+ }
+
+ return blueprintContainer.getBundleContext();
+ }
+
protected void setSatisfied(boolean s) {
// This check will ensure an atomic comparision and set
// so that it will only be true if the value actually changed
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java Wed Oct 5 08:26:48 2011
@@ -196,7 +196,7 @@ public class ReferenceListRecipe extends
throw new ServiceUnavailableException("Service is unavailable", getOsgiFilter());
}
if (service == null) {
- service = blueprintContainer.getService(reference);
+ service = getBundleContextForServiceLookup().getService(reference);
}
return service;
}
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java Wed Oct 5 08:26:48 2011
@@ -141,7 +141,7 @@ public class ReferenceRecipe extends Abs
LOGGER.debug("Binding reference {} to {}", getName(), ref);
synchronized (monitor) {
if (trackedServiceReference != null) {
- blueprintContainer.getBundleContext().ungetService(trackedServiceReference);
+ getBundleContextForServiceLookup().ungetService(trackedServiceReference);
}
trackedServiceReference = ref;
trackedService = null;
@@ -155,7 +155,7 @@ public class ReferenceRecipe extends Abs
synchronized (monitor) {
if (trackedServiceReference != null) {
unbind(trackedServiceReference, proxy);
- blueprintContainer.getBundleContext().ungetService(trackedServiceReference);
+ getBundleContextForServiceLookup().ungetService(trackedServiceReference);
trackedServiceReference = null;
trackedService = null;
monitor.notifyAll();
@@ -167,6 +167,7 @@ public class ReferenceRecipe extends Abs
synchronized (monitor) {
if (isStarted() && trackedServiceReference == null && metadata.getTimeout() > 0
&& metadata.getAvailability() == ServiceReferenceMetadata.AVAILABILITY_MANDATORY) {
+ //Here we want to get the blueprint bundle itself, so don't use #getBundleContextForServiceLookup()
blueprintContainer.getEventDispatcher().blueprintEvent(new BlueprintEvent(BlueprintEvent.WAITING, blueprintContainer.getBundleContext().getBundle(), blueprintContainer.getExtenderBundle(), new String[] { getOsgiFilter() }));
monitor.wait(metadata.getTimeout());
}
@@ -198,7 +199,7 @@ public class ReferenceRecipe extends Abs
} else {
if (trackedService == null) {
- trackedService = blueprintContainer.getService(trackedServiceReference);
+ trackedService = getBundleContextForServiceLookup().getService(trackedServiceReference);
}
if (trackedService == null) {
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/ExtNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/ExtNamespaceHandler.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/ExtNamespaceHandler.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/ExtNamespaceHandler.java Wed Oct 5 08:26:48 2011
@@ -36,6 +36,7 @@ import org.apache.aries.blueprint.mutabl
import org.apache.aries.blueprint.mutable.MutableReferenceMetadata;
import org.apache.aries.blueprint.mutable.MutableServiceReferenceMetadata;
import org.apache.aries.blueprint.mutable.MutableValueMetadata;
+import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.ComponentDefinitionException;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.BeanProperty;
@@ -68,7 +69,8 @@ public class ExtNamespaceHandler impleme
public static final String BLUEPRINT_NAMESPACE = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
public static final String BLUEPRINT_EXT_NAMESPACE_V1_0 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
public static final String BLUEPRINT_EXT_NAMESPACE_V1_1 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0";
-
+ public static final String BLUEPRINT_EXT_NAMESPACE_V1_2 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0";
+
public static final String PROPERTY_PLACEHOLDER_ELEMENT = "property-placeholder";
public static final String DEFAULT_PROPERTIES_ELEMENT = "default-properties";
public static final String PROPERTY_ELEMENT = "property";
@@ -80,6 +82,7 @@ public class ExtNamespaceHandler impleme
public static final String PLACEHOLDER_SUFFIX_ATTRIBUTE = "placeholder-suffix";
public static final String DEFAULTS_REF_ATTRIBUTE = "defaults-ref";
public static final String IGNORE_MISSING_LOCATIONS_ATTRIBUTE = "ignore-missing-locations";
+ public static final String EVALUATOR_ATTRIBUTE = "evaluator";
public static final String SYSTEM_PROPERTIES_ATTRIBUTE = "system-properties";
public static final String SYSTEM_PROPERTIES_NEVER = "never";
@@ -101,12 +104,20 @@ public class ExtNamespaceHandler impleme
private static final Logger LOGGER = LoggerFactory.getLogger(ExtNamespaceHandler.class);
private int idCounter;
+
+ private BundleContext ctx;
+ public void setBundleContext(BundleContext bc) {
+ this.ctx = bc;
+ }
+
public URL getSchemaLocation(String namespace) {
if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(namespace)) {
return getClass().getResource("blueprint-ext.xsd");
} else if (BLUEPRINT_EXT_NAMESPACE_V1_1.equals(namespace)) {
return getClass().getResource("blueprint-ext-1.1.xsd");
+ } else if (BLUEPRINT_EXT_NAMESPACE_V1_2.equals(namespace)) {
+ return getClass().getResource("blueprint-ext-1.2.xsd");
} else {
return null;
}
@@ -247,6 +258,10 @@ public class ExtNamespaceHandler impleme
if (systemProperties != null) {
metadata.addProperty("systemProperties", createValue(context, systemProperties));
}
+ String evaluator = element.hasAttribute(EVALUATOR_ATTRIBUTE) ? element.getAttribute(EVALUATOR_ATTRIBUTE) : null;
+ if (evaluator != null) {
+ metadata.addProperty("evaluator", createReference(context, evaluator));
+ }
// Parse elements
List<String> locations = new ArrayList<String>();
NodeList nl = element.getChildNodes();
@@ -255,7 +270,8 @@ public class ExtNamespaceHandler impleme
if (node instanceof Element) {
Element e = (Element) node;
if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())) {
+ || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
+ || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())) {
if (nodeNameEquals(e, DEFAULT_PROPERTIES_ELEMENT)) {
if (defaultsRef != null) {
throw new ComponentDefinitionException("Only one of " + DEFAULTS_REF_ATTRIBUTE + " attribute or " + DEFAULT_PROPERTIES_ELEMENT + " element is allowed");
@@ -285,7 +301,8 @@ public class ExtNamespaceHandler impleme
if (node instanceof Element) {
Element e = (Element) node;
if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())) {
+ || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
+ || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())) {
if (nodeNameEquals(e, PROPERTY_ELEMENT)) {
BeanProperty prop = context.parseElement(BeanProperty.class, enclosingComponent, e);
props.addEntry(createValue(context, prop.getName(), String.class.getName()), prop.getValue());
@@ -340,6 +357,15 @@ public class ExtNamespaceHandler impleme
m.setComponentId(value);
return m;
}
+
+ private MutableReferenceMetadata createReference(ParserContext context, String value) {
+ MutableReferenceMetadata m = context.createMetadata(MutableReferenceMetadata.class);
+ // use the class instance directly rather than loading the class from the specified the interface name.
+ m.setRuntimeInterface(PropertyEvaluator.class);
+ m.setFilter("(org.apache.aries.blueprint.ext.evaluator.name=" + value + ")");
+ m.setBundleContext(ctx);
+ return m;
+ }
private static CollectionMetadata createList(ParserContext context, List<String> list) {
MutableCollectionMetadata m = context.createMetadata(MutableCollectionMetadata.class);
Added: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyEvaluator.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyEvaluator.java?rev=1179099&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyEvaluator.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyEvaluator.java Wed Oct 5 08:26:48 2011
@@ -0,0 +1,8 @@
+package org.apache.aries.blueprint.ext;
+
+import java.util.Dictionary;
+
+
+public interface PropertyEvaluator {
+ public String evaluate(String expression, Dictionary<String, String> properties);
+}
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyPlaceholder.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyPlaceholder.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyPlaceholder.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/PropertyPlaceholder.java Wed Oct 5 08:26:48 2011
@@ -21,11 +21,11 @@ package org.apache.aries.blueprint.ext;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,8 +50,8 @@ public class PropertyPlaceholder extends
private List<URL> locations;
private boolean ignoreMissingLocations;
private SystemProperties systemProperties = SystemProperties.fallback;
- private transient JexlExpressionParser jexlParser;
-
+ private PropertyEvaluator evaluator = null;
+
public Map getDefaultProperties() {
return defaultProperties;
}
@@ -84,6 +84,14 @@ public class PropertyPlaceholder extends
this.systemProperties = systemProperties;
}
+ public PropertyEvaluator getEvaluator() {
+ return evaluator;
+ }
+
+ public void setEvaluator(PropertyEvaluator evaluator) {
+ this.evaluator = evaluator;
+ }
+
public void init() throws Exception {
properties = new Properties();
if (locations != null) {
@@ -145,98 +153,51 @@ public class PropertyPlaceholder extends
@Override
protected String retrieveValue(String expression) {
LOGGER.debug("Retrieving Value from expression: {}", expression);
- String result = super.retrieveValue(expression);
- if (result == null){
- try {
- Class.forName("org.apache.commons.jexl2.JexlEngine");
- JexlExpressionParser parser = getJexlParser();
- try {
- Object obj = parser.evaluate(expression);
- if (obj!=null) {
- result = obj.toString();
- }
- } catch (Exception e) {
- LOGGER.info("Could not evaluate expression: {}", expression);
- LOGGER.info("Exception:", e);
- }
- } catch (ClassNotFoundException e) {
- LOGGER.info("Could not evaluate expression: {}", expression);
- LOGGER.info("Exception:", e);
- }
- }
- return result;
- }
-
- private synchronized JexlExpressionParser getJexlParser() {
- if (jexlParser == null) {
- jexlParser = new JexlExpressionParser(toMap());
- }
- return jexlParser;
- }
-
- private Map<String, Object> toMap() {
- return new Map<String, Object>() {
- @Override
- public boolean containsKey(Object o) {
- return getProperty((String) o) != null;
- }
-
- @Override
- public Object get(Object o) {
- return getProperty((String) o);
- }
-
- // following are not important
- @Override
- public Object put(String s, Object o) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int size() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isEmpty() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean containsValue(Object o) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object remove(Object o) {
- throw new UnsupportedOperationException();
- }
+ if (evaluator == null) {
+ return super.retrieveValue(expression);
+ } else {
+ return evaluator.evaluate(expression, new Dictionary<String, String>(){
+ @Override
+ public String get(Object key) {
+ return getProperty((String) key);
+ }
- @Override
- public void putAll(Map<? extends String, ? extends Object> map) {
- throw new UnsupportedOperationException();
- }
+ // following are not important
+ @Override
+ public String put(String key, String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Enumeration<String> elements() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void clear() {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public Enumeration<String> keys() {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public Set<String> keySet() {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public String remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public Collection<Object> values() {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public int size() {
+ throw new UnsupportedOperationException();
+ }
+
+ });
+ }
- @Override
- public Set<Entry<String, Object>> entrySet() {
- throw new UnsupportedOperationException();
- }
- };
}
+
+
}
Added: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlExpressionParser.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlExpressionParser.java?rev=1179099&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlExpressionParser.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlExpressionParser.java Wed Oct 5 08:26:48 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.aries.blueprint.ext.evaluator.jexl;
+
+import java.util.Map;
+
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.JexlEngine;
+import org.apache.commons.jexl2.MapContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev: 907189 $ $Date: 2010-02-06 16:01:43 +0800 (Sat, 06 Feb 2010) $
+ */
+public class JexlExpressionParser {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JexlExpressionParser.class);
+
+ protected final JexlContext context;
+ private final JexlEngine engine;
+
+ public JexlExpressionParser(final Map<String, Object> vars) {
+ if (vars == null) {
+ throw new IllegalArgumentException("vars: " + vars);
+ }
+ engine = new JexlEngine();
+ context = new MapContext(vars);
+
+ LOGGER.trace("Using variables: {}", vars);
+ }
+
+ public Object evaluate(final String expression) throws Exception {
+ if (expression == null) {
+ throw new IllegalArgumentException("expression: " + expression);
+ }
+
+ LOGGER.trace("Evaluating expression: {}", expression);
+ return engine.createExpression(expression).evaluate(context);
+
+ }
+
+}
Added: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlPropertyEvaluator.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlPropertyEvaluator.java?rev=1179099&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlPropertyEvaluator.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/evaluator/jexl/JexlPropertyEvaluator.java Wed Oct 5 08:26:48 2011
@@ -0,0 +1,109 @@
+package org.apache.aries.blueprint.ext.evaluator.jexl;
+
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.blueprint.ext.PropertyEvaluator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JexlPropertyEvaluator implements PropertyEvaluator {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(JexlPropertyEvaluator.class);
+
+ private JexlExpressionParser jexlParser;
+ private Dictionary<String, String> properties;
+
+ @Override
+ public String evaluate(String expression, Dictionary<String, String> properties) {
+ JexlExpressionParser parser = getJexlParser();
+ this.properties = properties;
+
+ Object obj;
+ try {
+ obj = parser.evaluate(expression);
+ if (obj!=null) {
+ return obj.toString();
+ }
+ } catch (Exception e) {
+ LOGGER.info("Could not evaluate expression: {}", expression);
+ LOGGER.info("Exception:", e);
+ }
+
+ return null;
+ }
+
+ private synchronized JexlExpressionParser getJexlParser() {
+ if (jexlParser == null) {
+ jexlParser = new JexlExpressionParser(toMap());
+ }
+ return jexlParser;
+ }
+
+ private Map<String, Object> toMap() {
+ return new Map<String, Object>() {
+ @Override
+ public boolean containsKey(Object o) {
+ return properties.get(o) != null;
+ }
+
+ @Override
+ public Object get(Object o) {
+ return properties.get(o);
+ }
+
+ // following are not important
+ @Override
+ public Object put(String s, Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int size() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean containsValue(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Object remove(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends Object> map) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set<String> keySet() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<Object> values() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set<Entry<String, Object>> entrySet() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
Modified: aries/trunk/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml Wed Oct 5 08:26:48 2011
@@ -25,10 +25,20 @@
<array>
<value>http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0</value>
<value>http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0</value>
+ <value>http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0</value>
</array>
</entry>
</service-properties>
- <bean class="org.apache.aries.blueprint.ext.ExtNamespaceHandler"/>
+ <bean class="org.apache.aries.blueprint.ext.ExtNamespaceHandler">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </bean>
</service>
+ <service interface="org.apache.aries.blueprint.ext.PropertyEvaluator">
+ <service-properties>
+ <entry key="org.apache.aries.blueprint.ext.evaluator.name" value="jexl" />
+ </service-properties>
+ <bean class="org.apache.aries.blueprint.ext.evaluator.jexl.JexlPropertyEvaluator"/>
+ </service>
+
</blueprint>
Added: aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext-1.2.xsd
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext-1.2.xsd?rev=1179099&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext-1.2.xsd (added)
+++ aries/trunk/blueprint/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext-1.2.xsd Wed Oct 5 08:26:48 2011
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<xsd:schema xmlns="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0" xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0" version="1.0.0">
+
+ <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0"/>
+
+ <!-- property placeholder -->
+
+ <xsd:element name="property-placeholder" type="TpropertyPlaceholder"/>
+
+ <xsd:complexType name="TpropertyPlaceholder">
+ <xsd:complexContent>
+ <xsd:extension base="bp:Tcomponent">
+ <xsd:sequence>
+ <!-- nested properties declaration -->
+ <xsd:element maxOccurs="1" minOccurs="0" name="default-properties" type="TdefaultProperties"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="location" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute default="${" name="placeholder-prefix" type="xsd:string" use="optional"/>
+ <xsd:attribute default="}" name="placeholder-suffix" type="xsd:string" use="optional"/>
+ <xsd:attribute name="defaults-ref" type="bp:Tidref" use="optional"/>
+ <xsd:attribute default="false" name="ignore-missing-locations" type="xsd:boolean" use="optional"/>
+ <xsd:attribute default="fallback" name="system-properties" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="never"/>
+ <xsd:enumeration value="fallback"/>
+ <xsd:enumeration value="override"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="evaluator" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="TdefaultProperties">
+ <xsd:sequence maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="property" type="bp:Tproperty"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- proxy method -->
+
+ <xsd:attribute default="default" name="proxy-method">
+ <xsd:simpleType>
+ <xsd:restriction>
+ <xsd:simpleType>
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="default"/>
+ <xsd:enumeration value="classes"/>
+ <xsd:enumeration value="greedy"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+ <xsd:minLength value="1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <!-- role -->
+
+ <xsd:attribute name="role">
+ <xsd:simpleType>
+ <xsd:restriction>
+ <xsd:simpleType>
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="processor"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <!-- CM property placeholder extenstion -->
+
+ <xsd:element name="location" type="xsd:string"/>
+ <xsd:attribute default="false" name="ignore-missing-locations" type="xsd:boolean"/>
+ <xsd:attribute default="fallback" name="system-properties">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="never"/>
+ <xsd:enumeration value="fallback"/>
+ <xsd:enumeration value="override"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <xsd:attribute default="false" name="field-injection" type="xsd:boolean"/>
+
+ <!-- Default reference bean -->
+ <xsd:attribute name="default" type="bp:Tidref"/>
+
+</xsd:schema>
Modified: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/ext/PropertyPlaceholderTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/ext/PropertyPlaceholderTest.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/ext/PropertyPlaceholderTest.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/ext/PropertyPlaceholderTest.java Wed Oct 5 08:26:48 2011
@@ -52,17 +52,17 @@ public class PropertyPlaceholderTest ext
assertEquals("say hello world", sut.getStringValue());
}
- @Test
- public void evaluateStringProps() {
- sut = makeProperty("${prop1+prop2}");
- assertEquals("helloworld", sut.getStringValue());
- }
-
- @Test
- public void evaluateIntProps() {
- sut = makeProperty("${prop3+prop4}");
- assertEquals("30", sut.getStringValue());
- }
+// @Test
+// public void evaluateStringProps() {
+// sut = makeProperty("${prop1+prop2}");
+// assertEquals("helloworld", sut.getStringValue());
+// }
+//
+// @Test
+// public void evaluateIntProps() {
+// sut = makeProperty("${prop3+prop4}");
+// assertEquals("30", sut.getStringValue());
+// }
Modified: aries/trunk/blueprint/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/pom.xml?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-itests/pom.xml Wed Oct 5 08:26:48 2011
@@ -191,7 +191,12 @@
<type>bundle</type>
<scope>compile</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
+ <version>2.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java Wed Oct 5 08:26:48 2011
@@ -20,6 +20,7 @@ package org.apache.aries.blueprint.itest
import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
@@ -114,6 +115,7 @@ public class BlueprintContainer2BTCustom
return testOptions(
paxLogging("DEBUG"),
Helper.blueprintBundles(false),
+// vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
equinox().version("3.5.0")
);
}
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java Wed Oct 5 08:26:48 2011
@@ -20,6 +20,7 @@ package org.apache.aries.blueprint.itest
import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
@@ -111,6 +112,7 @@ public class BlueprintContainerBTCustomi
return testOptions(
paxLogging("DEBUG"),
Helper.blueprintBundles(),
+// vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
equinox().version("3.5.1")
);
}
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java Wed Oct 5 08:26:48 2011
@@ -68,6 +68,7 @@ public class Helper {
"org.apache.aries/org.apache.aries.util",
"org.apache.aries.proxy/org.apache.aries.proxy",
"asm/asm-all",
+ "org.apache.commons/commons-jexl",
"org.osgi/org.osgi.compendium"),
((startBlueprint) ? mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint") :
Modified: aries/trunk/blueprint/blueprint-parser/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/pom.xml?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-parser/pom.xml Wed Oct 5 08:26:48 2011
@@ -46,6 +46,11 @@
<artifactId>org.apache.aries.blueprint.api</artifactId>
<version>0.3</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedServiceReferenceMetadata.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedServiceReferenceMetadata.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/ExtendedServiceReferenceMetadata.java Wed Oct 5 08:26:48 2011
@@ -16,6 +16,7 @@
*/
package org.apache.aries.blueprint;
+import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
/**
@@ -32,5 +33,7 @@ public interface ExtendedServiceReferenc
int getProxyMethod();
Class getRuntimeInterface();
+
+ BundleContext getBundleContext();
}
Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java Wed Oct 5 08:26:48 2011
@@ -21,6 +21,7 @@ package org.apache.aries.blueprint.mutab
import org.apache.aries.blueprint.ExtendedServiceReferenceMetadata;
import org.osgi.service.blueprint.reflect.ReferenceListener;
import org.osgi.service.blueprint.reflect.Target;
+import org.osgi.framework.BundleContext;
/**
* A mutable version of the <code>ServiceReferenceMetadata</code> that allows modifications.
@@ -48,4 +49,6 @@ public interface MutableServiceReference
void setFilter(String filter);
void setRuntimeInterface(Class clazz);
+
+ void setBundleContext(BundleContext bc);
}
Modified: aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/ServiceReferenceMetadataImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/ServiceReferenceMetadataImpl.java?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/ServiceReferenceMetadataImpl.java (original)
+++ aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/reflect/ServiceReferenceMetadataImpl.java Wed Oct 5 08:26:48 2011
@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.aries.blueprint.mutable.MutableServiceReferenceMetadata;
+import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.ReferenceListener;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
import org.osgi.service.blueprint.reflect.Target;
@@ -41,6 +42,7 @@ public abstract class ServiceReferenceMe
protected Collection<ReferenceListener> referenceListeners;
protected int proxyMethod;
protected Class runtimeInterface;
+ protected BundleContext bundleContext;
public ServiceReferenceMetadataImpl() {
}
@@ -134,4 +136,12 @@ public abstract class ServiceReferenceMe
public void setRuntimeInterface(Class runtimeInterface) {
this.runtimeInterface = runtimeInterface;
}
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public void setBundleContext(BundleContext ctx) {
+ this.bundleContext = ctx;
+ }
}
Modified: aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1179099&r1=1179098&r2=1179099&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml (original)
+++ aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml Wed Oct 5 08:26:48 2011
@@ -16,7 +16,7 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0"
+ xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0"
default-availability="optional">
<type-converters>
@@ -30,9 +30,11 @@
<ext:property-placeholder placeholder-prefix="$["
placeholder-suffix="]" ignore-missing-locations="true"
- system-properties="override">
+ system-properties="override" evaluator="jexl">
<ext:default-properties>
<ext:property name="name" value="value" />
+ <ext:property name="a" value="Hello " />
+ <ext:property name="b" value="FooBar" />
</ext:default-properties>
<ext:location>file:///url</ext:location>
</ext:property-placeholder>
@@ -82,8 +84,8 @@
</bean>
<bean id="bar" class="org.apache.aries.blueprint.sample.Bar">
- <property name="value">
- <value>Hello FooBar</value>
+ <property name="value" value="$[a+b]">
+ <!--value>Hello FooBar</value-->
</property>
<property name="context" ref="blueprintBundleContext" />
<property name="list">