aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1430734 - in /aries/trunk/blueprint: ./ blueprint-noosgi/ blueprint-noosgi/src/ blueprint-noosgi/src/main/ blueprint-noosgi/src/main/java/ blueprint-noosgi/src/main/java/org/ blueprint-noosgi/src/main/java/org/apache/ blueprint-noosgi/src/...
Date Wed, 09 Jan 2013 08:39:40 GMT
Author: gnodet
Date: Wed Jan  9 08:39:40 2013
New Revision: 1430734

URL: http://svn.apache.org/viewvc?rev=1430734&view=rev
Log:
[ARIES-998] Support a subset of blueprint outside OSGi

Added:
    aries/trunk/blueprint/blueprint-noosgi/
    aries/trunk/blueprint/blueprint-noosgi/pom.xml
    aries/trunk/blueprint/blueprint-noosgi/src/
    aries/trunk/blueprint/blueprint-noosgi/src/main/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/GenericType.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiBlueprintRepository.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiRecipeBuilder.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/ExtendedBlueprintContainer.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/BlueprintContainerTest.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Bar.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/CurrencyTypeConverter.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/DateTypeConverter.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Foo.java
    aries/trunk/blueprint/blueprint-noosgi/src/test/resources/
    aries/trunk/blueprint/blueprint-noosgi/src/test/resources/test.xml
Modified:
    aries/trunk/blueprint/pom.xml

Added: aries/trunk/blueprint/blueprint-noosgi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/pom.xml?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/pom.xml (added)
+++ aries/trunk/blueprint/blueprint-noosgi/pom.xml Wed Jan  9 08:39:40 2013
@@ -0,0 +1,185 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries</groupId>
+        <artifactId>java5-parent</artifactId>
+        <version>1.0.0</version>
+        <relativePath />
+    </parent>
+
+    <groupId>org.apache.aries.blueprint</groupId>
+    <artifactId>org.apache.aries.blueprint.noosgi</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Apache Aries Blueprint no-OSGI</name>
+    <description>
+        This jar contains everything needed to run Blueprint outside OSGi.
+    </description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-cm</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-cm</developerConnection>
+        <url>http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm</url>
+    </scm>
+
+    <properties>
+        <blueprint.api.version>1.0.0</blueprint.api.version>
+        <blueprint.core.version>1.0.0</blueprint.core.version>
+        <blueprint.parser.version>1.0.0</blueprint.parser.version>
+        <proxy.impl.version>1.0.0</proxy.impl.version>
+    </properties>
+
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <blueprint.api.version>1.0.1-SNAPSHOT</blueprint.api.version>
+                <blueprint.core.version>1.0.1-SNAPSHOT</blueprint.core.version>
+                <blueprint.parser.version>1.0.1-SNAPSHOT</blueprint.parser.version>
+            </properties>
+        </profile>
+    </profiles>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.api</artifactId>
+            <version>${blueprint.api.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-parser</artifactId>
+            <version>${blueprint.parser.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.core</artifactId>
+            <version>${blueprint.core.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.aries.quiesce</groupId>
+                    <artifactId>org.apache.aries.quiesce.api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.aries</groupId>
+                    <artifactId>org.apache.aries.util</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--
+        <dependency>
+            <groupId>org.apache.aries.proxy</groupId>
+            <artifactId>org.apache.aries.proxy.impl</artifactId>
+            <version>${proxy.impl.version}</version>
+        </dependency>
+        -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.5.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <version>1.5.11</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <filters>
+                                <filter>
+                                    <artifact>org.apache.aries.blueprint:org.apache.aries.blueprint.core</artifact>
+                                    <excludes>
+                                        <exclude>org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/BlueprintContainerImpl*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/BlueprintEventDispatcher*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/BlueprintExtender*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/BlueprintQuiesceParticipant*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/BlueprintThreadFactory*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/GenericType*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/NamespaceHandlerRegistry*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/ParserServiceImpl*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/QuiesceInterceptor*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/ReferenceListRecipe*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/ReferenceRecipe*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/SatisfiableRecipe*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/container/ServiceRecipe*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder$LateBindingValueMetadata.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.class</exclude>
+                                        <!--
+                                        <exclude>org/apache/aries/blueprint/mutable/MutableReference*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/mutable/MutableRegistrationListener.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/mutable/MutableService*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/reflect/Reference*.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/reflect/Service*.class</exclude>
+                                        -->
+                                        <exclude>org/apache/aries/blueprint/services/ExtendedBlueprintContainer.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/namespace/**</exclude>
+                                        <!--
+                                          - Check if we can exclude proxy
+                                        <exclude>org/apache/aries/blueprint/proxy/**</exclude>
+                                        -->
+                                        <exclude>org/apache/aries/blueprint/utils/ServiceListener.class</exclude>
+                                        <exclude>org/apache/aries/blueprint/utils/threading/**</exclude>
+                                    </excludes>
+                                </filter>
+                                <filter>
+                                    <artifact>org.apache.aries.proxy:org.apache.aries.proxy.api</artifact>
+                                    <excludes>
+                                        <exclude>org/apache/aries/proxy/weavinghook/**</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                            <createSourcesJar>${createSourcesJar}</createSourcesJar>
+                            <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,331 @@
+/*
+ * 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.container;
+
+import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor;
+import org.apache.aries.blueprint.ExtendedBeanMetadata;
+import org.apache.aries.blueprint.Processor;
+import org.apache.aries.blueprint.di.Recipe;
+import org.apache.aries.blueprint.di.Repository;
+import org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl;
+import org.apache.aries.blueprint.parser.Parser;
+import org.apache.aries.blueprint.reflect.MetadataUtil;
+import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.NoSuchComponentException;
+import org.osgi.service.blueprint.reflect.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessControlContext;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class BlueprintContainerImpl implements ExtendedBlueprintContainer {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintContainerImpl.class);
+
+    private final ClassLoader loader;
+    private final List<URL> resources;
+    private final AggregateConverter converter;
+    private final ComponentDefinitionRegistryImpl componentDefinitionRegistry;
+    private final AtomicBoolean destroyed = new AtomicBoolean(false);
+    private final IdSpace tempRecipeIdSpace = new IdSpace();
+    private BlueprintRepository repository;
+    private List<Processor> processors = new ArrayList<Processor>();
+
+    public BlueprintContainerImpl(ClassLoader loader, List<URL> resources) throws Exception {
+        this(loader, resources,  true);
+    }
+
+    public BlueprintContainerImpl(ClassLoader loader, List<URL> resources, boolean init) throws Exception {
+        this.loader = loader;
+        this.converter = new AggregateConverter(this);
+        this.componentDefinitionRegistry = new ComponentDefinitionRegistryImpl();
+        this.resources = resources;
+        if (init) {
+            init();
+        }
+    }
+
+    public void init() throws Exception {
+        // Parse xml resources
+        Parser parser = new Parser();
+        parser.parse(getResources());
+        // Create handler set
+        SimpleNamespaceHandlerSet handlerSet = new SimpleNamespaceHandlerSet();
+        // Check namespaces
+        Set<URI> namespaces = parser.getNamespaces();
+        Set<URI> unsupported = new LinkedHashSet<URI>();
+        for (URI ns : namespaces) {
+            if (!handlerSet.getNamespaces().contains(ns)) {
+                unsupported.add(ns);
+            }
+        }
+        if (unsupported.size() > 0) {
+            throw new IllegalArgumentException("Unsupported namespaces: " + unsupported.toString());
+        }
+        // Validate
+        parser.validate(handlerSet.getSchema());
+        // Populate
+        parser.populate(handlerSet, componentDefinitionRegistry);
+        // Create repository
+        repository = new NoOsgiRecipeBuilder(this, tempRecipeIdSpace).createRepository();
+        // Processors handling
+        processTypeConverters();
+        processProcessors();
+        // Instantiate eager singletons
+        instantiateEagerComponents();
+    }
+
+    public void destroy() {
+        repository.destroy();
+    }
+
+    public List<URL> getResources() {
+        return resources;
+    }
+
+    public Converter getConverter() {
+        return converter;
+    }
+
+    public Class loadClass(String name) throws ClassNotFoundException {
+        return loader.loadClass(name);
+    }
+
+    public AccessControlContext getAccessControlContext() {
+        return null;
+    }
+
+    public ComponentDefinitionRegistryImpl getComponentDefinitionRegistry() {
+        return componentDefinitionRegistry;
+    }
+
+    public <T extends Processor> List<T> getProcessors(Class<T> clazz) {
+        List<T> p = new ArrayList<T>();
+        for (Processor processor : processors) {
+            if (clazz.isInstance(processor)) {
+                p.add(clazz.cast(processor));
+            }
+        }
+        return p;
+    }
+
+    public Set<String> getComponentIds() {
+        return new LinkedHashSet<String>(componentDefinitionRegistry.getComponentDefinitionNames());
+    }
+
+    public Object getComponentInstance(String id) {
+        if (repository == null || destroyed.get()) {
+            throw new NoSuchComponentException(id);
+        }
+        try {
+            LOGGER.debug("Instantiating component {}", id);
+            return repository.create(id);
+        } catch (NoSuchComponentException e) {
+            throw e;
+        } catch (ComponentDefinitionException e) {
+            throw e;
+        } catch (Throwable t) {
+            throw new ComponentDefinitionException("Cound not create component instance for " + id, t);
+        }
+    }
+
+    public ComponentMetadata getComponentMetadata(String id) {
+        ComponentMetadata metadata = componentDefinitionRegistry.getComponentDefinition(id);
+        if (metadata == null) {
+            throw new NoSuchComponentException(id);
+        }
+        return metadata;
+    }
+
+    public <T extends ComponentMetadata> Collection<T> getMetadata(Class<T> clazz) {
+        Collection<T> metadatas = new ArrayList<T>();
+        for (String name : componentDefinitionRegistry.getComponentDefinitionNames()) {
+            ComponentMetadata component = componentDefinitionRegistry.getComponentDefinition(name);
+            getMetadata(clazz, component, metadatas);
+        }
+        metadatas = Collections.unmodifiableCollection(metadatas);
+        return metadatas;
+    }
+
+    public BlueprintRepository getRepository() {
+        return repository;
+    }
+
+    private <T extends ComponentMetadata> void getMetadata(Class<T> clazz, Metadata component, Collection<T> metadatas) {
+        if (component == null) {
+            return;
+        }
+        if (clazz.isInstance(component)) {
+            metadatas.add(clazz.cast(component));
+        }
+        if (component instanceof BeanMetadata) {
+            getMetadata(clazz, ((BeanMetadata) component).getFactoryComponent(), metadatas);
+            for (BeanArgument arg : ((BeanMetadata) component).getArguments()) {
+                getMetadata(clazz, arg.getValue(), metadatas);
+            }
+            for (BeanProperty prop : ((BeanMetadata) component).getProperties()) {
+                getMetadata(clazz, prop.getValue(), metadatas);
+            }
+        }
+        if (component instanceof CollectionMetadata) {
+            for (Metadata m : ((CollectionMetadata) component).getValues()) {
+                getMetadata(clazz, m, metadatas);
+            }
+        }
+        if (component instanceof MapMetadata) {
+            for (MapEntry m : ((MapMetadata) component).getEntries()) {
+                getMetadata(clazz, m.getKey(), metadatas);
+                getMetadata(clazz, m.getValue(), metadatas);
+            }
+        }
+        if (component instanceof PropsMetadata) {
+            for (MapEntry m : ((PropsMetadata) component).getEntries()) {
+                getMetadata(clazz, m.getKey(), metadatas);
+                getMetadata(clazz, m.getValue(), metadatas);
+            }
+        }
+        if (component instanceof ServiceReferenceMetadata) {
+            for (ReferenceListener l : ((ServiceReferenceMetadata) component).getReferenceListeners()) {
+                getMetadata(clazz, l.getListenerComponent(), metadatas);
+            }
+        }
+        if (component instanceof ServiceMetadata) {
+            getMetadata(clazz, ((ServiceMetadata) component).getServiceComponent(), metadatas);
+            for (MapEntry m : ((ServiceMetadata) component).getServiceProperties()) {
+                getMetadata(clazz, m.getKey(), metadatas);
+                getMetadata(clazz, m.getValue(), metadatas);
+            }
+            for (RegistrationListener l : ((ServiceMetadata) component).getRegistrationListeners()) {
+                getMetadata(clazz, l.getListenerComponent(), metadatas);
+            }
+        }
+    }
+
+    private void processTypeConverters() throws Exception {
+        List<String> typeConverters = new ArrayList<String>();
+        for (Target target : componentDefinitionRegistry.getTypeConverters()) {
+            if (target instanceof ComponentMetadata) {
+                typeConverters.add(((ComponentMetadata) target).getId());
+            } else if (target instanceof RefMetadata) {
+                typeConverters.add(((RefMetadata) target).getComponentId());
+            } else {
+                throw new ComponentDefinitionException("Unexpected metadata for type converter: " + target);
+            }
+        }
+
+        Map<String, Object> objects = repository.createAll(typeConverters, Arrays.<Class<?>>asList(Converter.class));
+        for (String name : typeConverters) {
+            Object obj = objects.get(name);
+            if (obj instanceof Converter) {
+                converter.registerConverter((Converter) obj);
+            } else {
+                throw new ComponentDefinitionException("Type converter " + obj + " does not implement the " + Converter.class.getName() + " interface");
+            }
+        }
+    }
+
+    private void processProcessors() throws Exception {
+        // Instantiate ComponentDefinitionRegistryProcessor and BeanProcessor
+        for (BeanMetadata bean : getMetadata(BeanMetadata.class)) {
+            if (bean instanceof ExtendedBeanMetadata && !((ExtendedBeanMetadata) bean).isProcessor()) {
+                continue;
+            }
+
+            Class clazz = null;
+            if (bean instanceof ExtendedBeanMetadata) {
+                clazz = ((ExtendedBeanMetadata) bean).getRuntimeClass();
+            }
+            if (clazz == null && bean.getClassName() != null) {
+                clazz = loadClass(bean.getClassName());
+            }
+            if (clazz == null) {
+                continue;
+            }
+
+            if (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) {
+                Object obj = repository.create(bean.getId(), Arrays.<Class<?>>asList(ComponentDefinitionRegistryProcessor.class));
+                ((ComponentDefinitionRegistryProcessor) obj).process(componentDefinitionRegistry);
+            } else if (Processor.class.isAssignableFrom(clazz)) {
+                Object obj = repository.create(bean.getId(), Arrays.<Class<?>>asList(Processor.class));
+                this.processors.add((Processor) obj);
+            } else {
+                continue;
+            }
+            updateUninstantiatedRecipes();
+        }
+    }
+    private void updateUninstantiatedRecipes() {
+        Repository tmpRepo = new NoOsgiRecipeBuilder(this, tempRecipeIdSpace).createRepository();
+
+        LOGGER.debug("Updating blueprint repository");
+
+        for (String name : repository.getNames()) {
+            if (repository.getInstance(name) == null) {
+                LOGGER.debug("Removing uninstantiated recipe {}", new Object[] { name });
+                repository.removeRecipe(name);
+            } else {
+                LOGGER.debug("Recipe {} is already instantiated", new Object[] { name });
+            }
+        }
+
+        for (String name : tmpRepo.getNames()) {
+            if (repository.getInstance(name) == null) {
+                LOGGER.debug("Adding new recipe {}", new Object[] { name });
+                Recipe r = tmpRepo.getRecipe(name);
+                if (r != null) {
+                    repository.putRecipe(name, r);
+                }
+            } else {
+                LOGGER.debug("Recipe {} is already instantiated and cannot be updated", new Object[] { name });
+            }
+        }
+    }
+
+    protected void instantiateEagerComponents() {
+        List<String> components = new ArrayList<String>();
+        for (String name : componentDefinitionRegistry.getComponentDefinitionNames()) {
+            ComponentMetadata component = componentDefinitionRegistry.getComponentDefinition(name);
+            boolean eager = component.getActivation() == ComponentMetadata.ACTIVATION_EAGER;
+            if (component instanceof BeanMetadata) {
+                BeanMetadata local = (BeanMetadata) component;
+                eager &= MetadataUtil.isSingletonScope(local);
+            }
+            if (eager) {
+                components.add(name);
+            }
+        }
+        LOGGER.debug("Instantiating components: {}", components);
+        try {
+            repository.createAll(components);
+        } catch (ComponentDefinitionException e) {
+            throw e;
+        } catch (Throwable t) {
+            throw new ComponentDefinitionException("Unable to instantiate components", t);
+        }
+    }
+
+
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/GenericType.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/GenericType.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/GenericType.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/GenericType.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,230 @@
+/**
+ *
+ * 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.container;
+
+import org.apache.aries.blueprint.di.ExecutionContext;
+import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+import java.lang.reflect.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * XXXX: Currently, in case of arrays getActualTypeArgument(0) returns something similar to what
+ * Class.getComponentType() does for arrays.  I don't think this is quite right since getActualTypeArgument()
+ * should return the given parameterized type not the component type. Need to check this behavior with the spec.
+ */
+public class GenericType extends ReifiedType {
+
+    private static final GenericType[] EMPTY = new GenericType[0];
+
+    private static final Map<String, Class> primitiveClasses = new HashMap<String, Class>();
+
+    static {
+        primitiveClasses.put("int", int.class);
+        primitiveClasses.put("short", short.class);
+        primitiveClasses.put("long", long.class);
+        primitiveClasses.put("byte", byte.class);
+        primitiveClasses.put("char", char.class);
+        primitiveClasses.put("float", float.class);
+        primitiveClasses.put("double", double.class);
+        primitiveClasses.put("boolean", boolean.class);
+    }
+
+    private GenericType[] parameters;
+
+    public GenericType(Type type) {
+        this(getConcreteClass(type), parametersOf(type));
+    }
+
+    public GenericType(Class clazz, GenericType... parameters) {
+        super(clazz);
+        this.parameters = parameters;
+    }
+
+    public static GenericType parse(String rawType, final Object loader) throws ClassNotFoundException, IllegalArgumentException {
+        final String type = rawType.trim();
+        // Check if this is an array
+        if (type.endsWith("[]")) {
+            GenericType t = parse(type.substring(0, type.length() - 2), loader);
+            return new GenericType(Array.newInstance(t.getRawClass(), 0).getClass(), t);
+        }
+        // Check if this is a generic
+        int genericIndex = type.indexOf('<');
+        if (genericIndex > 0) {
+            if (!type.endsWith(">")) {
+                throw new IllegalArgumentException("Can not load type: " + type);
+            }
+            GenericType base = parse(type.substring(0, genericIndex), loader);
+            String[] params = type.substring(genericIndex + 1, type.length() - 1).split(",");
+            GenericType[] types = new GenericType[params.length];
+            for (int i = 0; i < params.length; i++) {
+                types[i] = parse(params[i], loader);
+            }
+            return new GenericType(base.getRawClass(), types);
+        }
+        // Primitive
+        if (primitiveClasses.containsKey(type)) {
+            return new GenericType(primitiveClasses.get(type));
+        }
+        // Class
+        if (loader instanceof ClassLoader) {
+            return new GenericType(((ClassLoader) loader).loadClass(type));
+        } else if (loader instanceof ExecutionContext) {
+            return new GenericType(((ExecutionContext) loader).loadClass(type));
+        } else if (loader instanceof ExtendedBlueprintContainer) {
+            return new GenericType(((ExtendedBlueprintContainer) loader).loadClass(type));
+        } else {
+            throw new IllegalArgumentException("Unsupported loader: " + loader);
+        }
+    }
+
+    @Override
+    public ReifiedType getActualTypeArgument(int i) {
+        if (parameters.length == 0) {
+            return super.getActualTypeArgument(i);
+        }
+        return parameters[i];
+    }
+
+    @Override
+    public int size() {
+        return parameters.length;
+    }
+
+    @Override
+    public String toString() {
+        Class cl = getRawClass();
+        if (cl.isArray()) {
+            if (parameters.length > 0) {
+                return parameters[0].toString() + "[]";
+            } else {
+                return cl.getComponentType().getName() + "[]";
+            }
+        }
+        if (parameters.length > 0) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(cl.getName());
+            sb.append("<");
+            for (int i = 0; i < parameters.length; i++) {
+                if (i > 0) {
+                    sb.append(",");
+                }
+                sb.append(parameters[i].toString());
+            }
+            sb.append(">");
+            return sb.toString();
+        }
+        return cl.getName();
+    }
+
+    public boolean equals(Object object) {
+        if (!(object instanceof GenericType)) {
+            return false;
+        }
+        GenericType other = (GenericType) object;
+        if (getRawClass() != other.getRawClass()) {
+            return false;
+        }
+        if (parameters == null) {
+            return (other.parameters == null);
+        } else {
+            if (other.parameters == null) {
+                return false;
+            }
+            if (parameters.length != other.parameters.length) {
+                return false;
+            }
+            for (int i = 0; i < parameters.length; i++) {
+                if (!parameters[i].equals(other.parameters[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    static GenericType[] parametersOf(Type type) {
+        if (type instanceof Class) {
+            Class clazz = (Class) type;
+            if (clazz.isArray()) {
+                GenericType t = new GenericType(clazz.getComponentType());
+                if (t.size() > 0) {
+                    return new GenericType[] { t };
+                } else {
+                    return EMPTY;
+                }
+            } else {
+                return EMPTY;
+            }
+        }
+        if (type instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) type;
+            Type [] parameters = pt.getActualTypeArguments();
+            GenericType[] gts = new GenericType[parameters.length];
+            for ( int i =0; i<gts.length; i++) {
+                gts[i] = new GenericType(parameters[i]);
+            }
+            return gts;
+        }
+        if (type instanceof GenericArrayType) {
+            return new GenericType[] { new GenericType(((GenericArrayType) type).getGenericComponentType()) };
+        }
+        if (type instanceof WildcardType) {
+            return EMPTY;
+        }
+        if (type instanceof TypeVariable) {
+            return EMPTY;
+        }
+        throw new IllegalStateException();
+    }
+
+    static Class<?> getConcreteClass(Type type) {
+        Type ntype = collapse(type);
+        if ( ntype instanceof Class )
+            return (Class<?>) ntype;
+
+        if ( ntype instanceof ParameterizedType )
+            return getConcreteClass(collapse(((ParameterizedType)ntype).getRawType()));
+
+        throw new RuntimeException("Unknown type " + type );
+    }
+
+    static Type collapse(Type target) {
+        if (target instanceof Class || target instanceof ParameterizedType ) {
+            return target;
+        } else if (target instanceof TypeVariable) {
+            return collapse(((TypeVariable<?>) target).getBounds()[0]);
+        } else if (target instanceof GenericArrayType) {
+            Type t = collapse(((GenericArrayType) target)
+                    .getGenericComponentType());
+            while ( t instanceof ParameterizedType )
+                t = collapse(((ParameterizedType)t).getRawType());
+            return Array.newInstance((Class<?>)t, 0).getClass();
+        } else if (target instanceof WildcardType) {
+            WildcardType wct = (WildcardType) target;
+            if (wct.getLowerBounds().length == 0)
+                return collapse(wct.getUpperBounds()[0]);
+            else
+                return collapse(wct.getLowerBounds()[0]);
+        }
+        throw new RuntimeException("Huh? " + target);
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiBlueprintRepository.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiBlueprintRepository.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiBlueprintRepository.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiBlueprintRepository.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.container;
+
+import org.apache.aries.blueprint.di.CollectionRecipe;
+import org.apache.aries.blueprint.di.IdRefRecipe;
+import org.apache.aries.blueprint.di.Recipe;
+import org.apache.aries.blueprint.di.RefRecipe;
+import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+
+public class NoOsgiBlueprintRepository extends BlueprintRepository {
+
+    public NoOsgiBlueprintRepository(ExtendedBlueprintContainer container) {
+        super(container);
+    }
+
+    @Override
+    public void validate() {
+        for (Recipe recipe : getAllRecipes()) {
+            // Check that references are satisfied
+            String ref = null;
+            if (recipe instanceof RefRecipe) {
+                ref = ((RefRecipe) recipe).getIdRef();
+            } else if (recipe instanceof IdRefRecipe) {
+                ref = ((IdRefRecipe) recipe).getIdRef();
+            }
+            if (ref != null && getRecipe(ref) == null) {
+                throw new ComponentDefinitionException("Unresolved ref/idref to component: " + ref);
+            }
+        }
+    }
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiRecipeBuilder.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiRecipeBuilder.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiRecipeBuilder.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/NoOsgiRecipeBuilder.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,261 @@
+/*
+ * 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.container;
+
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.ExtendedBeanMetadata;
+import org.apache.aries.blueprint.PassThroughMetadata;
+import org.apache.aries.blueprint.di.*;
+import org.apache.aries.blueprint.ext.ComponentFactoryMetadata;
+import org.apache.aries.blueprint.ext.DependentComponentFactoryMetadata;
+import org.apache.aries.blueprint.reflect.MetadataUtil;
+import org.apache.aries.blueprint.utils.ServiceListener;
+import org.osgi.service.blueprint.reflect.*;
+
+import java.util.*;
+
+public class NoOsgiRecipeBuilder {
+
+    private final Set<String> names = new HashSet<String>();
+    private final BlueprintContainerImpl blueprintContainer;
+    private final ComponentDefinitionRegistry registry;
+    private final IdSpace recipeIdSpace;
+
+    public NoOsgiRecipeBuilder(BlueprintContainerImpl blueprintContainer, IdSpace recipeIdSpace) {
+        this.recipeIdSpace = recipeIdSpace;
+        this.blueprintContainer = blueprintContainer;
+        this.registry = blueprintContainer.getComponentDefinitionRegistry();
+    }
+
+    public BlueprintRepository createRepository() {
+        BlueprintRepository repository = new NoOsgiBlueprintRepository(blueprintContainer);
+        // Create component recipes
+        for (String name : registry.getComponentDefinitionNames()) {
+            ComponentMetadata component = registry.getComponentDefinition(name);
+            Recipe recipe = createRecipe(component);
+            repository.putRecipe(recipe.getName(), recipe);
+        }
+        repository.validate();
+        return repository;
+    }
+
+    public Recipe createRecipe(ComponentMetadata component) {
+
+        // Custom components should be handled before built-in ones
+        // in case we have a custom component that also implements a built-in metadata
+
+        if (component instanceof DependentComponentFactoryMetadata) {
+            return createDependentComponentFactoryMetadata((DependentComponentFactoryMetadata) component);
+        } else if (component instanceof ComponentFactoryMetadata) {
+            return createComponentFactoryMetadata((ComponentFactoryMetadata) component);
+        } else if (component instanceof BeanMetadata) {
+            return createBeanRecipe((BeanMetadata) component);
+        } else if (component instanceof ServiceMetadata) {
+            throw new IllegalArgumentException("OSGi services are not supported");
+        } else if (component instanceof ReferenceMetadata) {
+            throw new IllegalArgumentException("OSGi references are not supported");
+        } else if (component instanceof ReferenceListMetadata) {
+            throw new IllegalArgumentException("OSGi references are not supported");
+        } else if (component instanceof PassThroughMetadata) {
+            return createPassThroughRecipe((PassThroughMetadata) component);
+        } else {
+            throw new IllegalStateException("Unsupported component type " + component.getClass());
+        }
+    }
+
+    private Recipe createComponentFactoryMetadata(ComponentFactoryMetadata metadata) {
+        return new ComponentFactoryRecipe<ComponentFactoryMetadata>(
+                metadata.getId(), metadata, blueprintContainer, getDependencies(metadata));
+    }
+
+    private Recipe createDependentComponentFactoryMetadata(DependentComponentFactoryMetadata metadata) {
+        return new DependentComponentFactoryRecipe(
+                metadata.getId(), metadata, blueprintContainer, getDependencies(metadata));
+    }
+
+    private List<Recipe> getDependencies(ComponentMetadata metadata) {
+        List<Recipe> deps = new ArrayList<Recipe>();
+        for (String name : metadata.getDependsOn()) {
+            deps.add(new RefRecipe(getName(null), name));
+        }
+        return deps;
+    }
+
+    private Recipe createPassThroughRecipe(PassThroughMetadata passThroughMetadata) {
+        return new PassThroughRecipe(getName(passThroughMetadata.getId()),
+                passThroughMetadata.getObject());
+    }
+
+    private Object getBeanClass(BeanMetadata beanMetadata) {
+        if (beanMetadata instanceof ExtendedBeanMetadata) {
+            ExtendedBeanMetadata extBeanMetadata = (ExtendedBeanMetadata) beanMetadata;
+            if (extBeanMetadata.getRuntimeClass() != null) {
+                return extBeanMetadata.getRuntimeClass();
+            }
+        }
+        return beanMetadata.getClassName();
+    }
+
+    private boolean allowsFieldInjection(BeanMetadata beanMetadata) {
+        if (beanMetadata instanceof ExtendedBeanMetadata) {
+            return ((ExtendedBeanMetadata) beanMetadata).getFieldInjection();
+        }
+        return false;
+    }
+
+    private BeanRecipe createBeanRecipe(BeanMetadata beanMetadata) {
+        BeanRecipe recipe = new BeanRecipe(
+                getName(beanMetadata.getId()),
+                blueprintContainer,
+                getBeanClass(beanMetadata),
+                allowsFieldInjection(beanMetadata));
+        // Create refs for explicit dependencies
+        recipe.setExplicitDependencies(getDependencies(beanMetadata));
+        recipe.setPrototype(MetadataUtil.isPrototypeScope(beanMetadata) || MetadataUtil.isCustomScope(beanMetadata));
+        recipe.setInitMethod(beanMetadata.getInitMethod());
+        recipe.setDestroyMethod(beanMetadata.getDestroyMethod());
+        recipe.setInterceptorLookupKey(beanMetadata);
+        List<BeanArgument> beanArguments = beanMetadata.getArguments();
+        if (beanArguments != null && !beanArguments.isEmpty()) {
+            boolean hasIndex = (beanArguments.get(0).getIndex() >= 0);
+            if (hasIndex) {
+                List<BeanArgument> beanArgumentsCopy = new ArrayList<BeanArgument>(beanArguments);
+                Collections.sort(beanArgumentsCopy, MetadataUtil.BEAN_COMPARATOR);
+                beanArguments = beanArgumentsCopy;
+            }
+            List<Object> arguments = new ArrayList<Object>();
+            List<String> argTypes = new ArrayList<String>();
+            for (BeanArgument argument : beanArguments) {
+                Recipe value = getValue(argument.getValue(), null);
+                arguments.add(value);
+                argTypes.add(argument.getValueType());
+            }
+            recipe.setArguments(arguments);
+            recipe.setArgTypes(argTypes);
+            recipe.setReorderArguments(!hasIndex);
+        }
+        recipe.setFactoryMethod(beanMetadata.getFactoryMethod());
+        if (beanMetadata.getFactoryComponent() != null) {
+            recipe.setFactoryComponent(getValue(beanMetadata.getFactoryComponent(), null));
+        }
+        for (BeanProperty property : beanMetadata.getProperties()) {
+            Recipe value = getValue(property.getValue(), null);
+            recipe.setProperty(property.getName(), value);
+        }
+        return recipe;
+    }
+
+    private Recipe createRecipe(RegistrationListener listener) {
+        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, ServiceListener.class, false);
+        recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
+        if (listener.getRegistrationMethod() != null) {
+            recipe.setProperty("registerMethod", listener.getRegistrationMethod());
+        }
+        if (listener.getUnregistrationMethod() != null) {
+            recipe.setProperty("unregisterMethod", listener.getUnregistrationMethod());
+        }
+        recipe.setProperty("blueprintContainer", blueprintContainer);
+        return recipe;
+    }
+
+    private Recipe createRecipe(ReferenceListener listener) {
+        BeanRecipe recipe = new BeanRecipe(getName(null), blueprintContainer, AbstractServiceReferenceRecipe.Listener.class, false);
+        recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
+        recipe.setProperty("metadata", listener);
+        recipe.setProperty("blueprintContainer", blueprintContainer);
+        return recipe;
+    }
+
+    private Recipe getValue(Metadata v, Object groupingType) {
+        if (v instanceof NullMetadata) {
+            return null;
+        } else if (v instanceof ComponentMetadata) {
+            return createRecipe((ComponentMetadata) v);
+        } else if (v instanceof ValueMetadata) {
+            ValueMetadata stringValue = (ValueMetadata) v;
+            Object type = stringValue.getType();
+            type = (type == null) ? groupingType : type;
+            ValueRecipe vr = new ValueRecipe(getName(null), stringValue, type);
+            return vr;
+        } else if (v instanceof RefMetadata) {
+            // TODO: make it work with property-placeholders?
+            String componentName = ((RefMetadata) v).getComponentId();
+            RefRecipe rr = new RefRecipe(getName(null), componentName);
+            return rr;
+        } else if (v instanceof CollectionMetadata) {
+            CollectionMetadata collectionMetadata = (CollectionMetadata) v;
+            Class<?> cl = collectionMetadata.getCollectionClass();
+            String type = collectionMetadata.getValueType();
+            if (cl == Object[].class) {
+                ArrayRecipe ar = new ArrayRecipe(getName(null), type);
+                for (Metadata lv : collectionMetadata.getValues()) {
+                    ar.add(getValue(lv, type));
+                }
+                return ar;
+            } else {
+                CollectionRecipe cr = new CollectionRecipe(getName(null), cl != null ? cl : ArrayList.class, type);
+                for (Metadata lv : collectionMetadata.getValues()) {
+                    cr.add(getValue(lv, type));
+                }
+                return cr;
+            }
+        } else if (v instanceof MapMetadata) {
+            return createMapRecipe((MapMetadata) v);
+        } else if (v instanceof PropsMetadata) {
+            PropsMetadata mapValue = (PropsMetadata) v;
+            MapRecipe mr = new MapRecipe(getName(null), Properties.class, String.class, String.class);
+            for (MapEntry entry : mapValue.getEntries()) {
+                Recipe key = getValue(entry.getKey(), String.class);
+                Recipe val = getValue(entry.getValue(), String.class);
+                mr.put(key, val);
+            }
+            return mr;
+        } else if (v instanceof IdRefMetadata) {
+            // TODO: make it work with property-placeholders?
+            String componentName = ((IdRefMetadata) v).getComponentId();
+            IdRefRecipe rnr = new IdRefRecipe(getName(null), componentName);
+            return rnr;
+        } else {
+            throw new IllegalStateException("Unsupported value: " + v.getClass().getName());
+        }
+    }
+
+    private MapRecipe createMapRecipe(MapMetadata mapValue) {
+        String keyType = mapValue.getKeyType();
+        String valueType = mapValue.getValueType();
+        MapRecipe mr = new MapRecipe(getName(null), HashMap.class, keyType, valueType);
+        for (MapEntry entry : mapValue.getEntries()) {
+            Recipe key = getValue(entry.getKey(), keyType);
+            Recipe val = getValue(entry.getValue(), valueType);
+            mr.put(key, val);
+        }
+        return mr;
+    }
+
+    private String getName(String name) {
+        if (name == null) {
+            do {
+                name = "#recipe-" + recipeIdSpace.nextId();
+            } while (names.contains(name) || registry.containsComponentDefinition(name));
+        }
+        names.add(name);
+        return name;
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,85 @@
+/*
+ * 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.container;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ext.impl.ExtNamespaceHandler;
+import org.apache.aries.blueprint.parser.NamespaceHandlerSet;
+import org.xml.sax.SAXException;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.IOException;
+import java.net.URI;
+import java.util.*;
+
+public class SimpleNamespaceHandlerSet implements NamespaceHandlerSet {
+
+    public static final URI EXT_1_2_NAMESPACE = URI.create("http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0");
+
+    private Set<URI> namespaces;
+    private Schema schema;
+
+    public SimpleNamespaceHandlerSet() {
+        this.namespaces = new LinkedHashSet<URI>();
+        this.namespaces.add(EXT_1_2_NAMESPACE);
+    }
+
+    public Set<URI> getNamespaces() {
+        return Collections.unmodifiableSet(namespaces);
+    }
+
+    public boolean isComplete() {
+        return true;
+    }
+
+    public NamespaceHandler getNamespaceHandler(URI uri) {
+        if (EXT_1_2_NAMESPACE.equals(uri)) {
+            return new ExtNamespaceHandler();
+        }
+        return null;
+    }
+
+    public Schema getSchema() throws SAXException, IOException {
+        if (schema == null) {
+            final List<StreamSource> schemaSources = new ArrayList<StreamSource>();
+            schemaSources.add(new StreamSource(getClass().getResourceAsStream("/org/apache/aries/blueprint/blueprint.xsd")));
+            schemaSources.add(new StreamSource(getClass().getResourceAsStream("/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.2.xsd")));
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            schema = schemaFactory.newSchema(schemaSources.toArray(new Source[schemaSources.size()]));
+        }
+        return schema;
+    }
+
+    public void addListener(Listener listener) {
+        throw new IllegalStateException();
+    }
+
+    public void removeListener(Listener listener) {
+        throw new IllegalStateException();
+    }
+
+    public void destroy() {
+        schema = null;
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/AbstractPropertyPlaceholder.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,357 @@
+/**
+ * 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;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor;
+import org.apache.aries.blueprint.PassThroughMetadata;
+import org.apache.aries.blueprint.mutable.MutableBeanArgument;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutableBeanProperty;
+import org.apache.aries.blueprint.mutable.MutableCollectionMetadata;
+import org.apache.aries.blueprint.mutable.MutableMapEntry;
+import org.apache.aries.blueprint.mutable.MutableMapMetadata;
+import org.apache.aries.blueprint.mutable.MutablePropsMetadata;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.reflect.BeanArgument;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.BeanProperty;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.MapMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.NonNullMetadata;
+import org.osgi.service.blueprint.reflect.PropsMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract class for property placeholders.
+ *
+ * @version $Rev: 1211548 $, $Date: 2011-12-07 17:26:22 +0000 (Wed, 07 Dec 2011) $
+ */
+public abstract class AbstractPropertyPlaceholder implements ComponentDefinitionRegistryProcessor {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractPropertyPlaceholder.class);
+
+    private String placeholderPrefix = "${";
+    private String placeholderSuffix = "}";
+    private Pattern pattern;
+
+    private LinkedList<String> processingStack = new LinkedList<String>();
+
+    public String getPlaceholderPrefix() {
+        return placeholderPrefix;
+    }
+
+    public void setPlaceholderPrefix(String placeholderPrefix) {
+        this.placeholderPrefix = placeholderPrefix;
+    }
+
+    public String getPlaceholderSuffix() {
+        return placeholderSuffix;
+    }
+
+    public void setPlaceholderSuffix(String placeholderSuffix) {
+        this.placeholderSuffix = placeholderSuffix;
+    }
+
+    public void process(ComponentDefinitionRegistry registry) throws ComponentDefinitionException {
+        try {
+            for (String name : registry.getComponentDefinitionNames()) {
+                processMetadata(registry.getComponentDefinition(name));
+            }
+        } finally {
+            processingStack.clear();
+        }
+    }
+
+    protected Metadata processMetadata(Metadata metadata) {
+        try {
+            if (metadata instanceof BeanMetadata) {
+                BeanMetadata bmd = (BeanMetadata) metadata;
+                processingStack.add("Bean named " + bmd.getId() + "->");
+                return processBeanMetadata(bmd);
+            } else if (metadata instanceof CollectionMetadata) {
+                CollectionMetadata cmd = (CollectionMetadata) metadata;
+                processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
+                return processCollectionMetadata(cmd);
+            } else if (metadata instanceof MapMetadata) {
+                processingStack.add("Map->");
+                return processMapMetadata((MapMetadata) metadata);
+            } else if (metadata instanceof PropsMetadata) {
+                processingStack.add("Properties->");
+                return processPropsMetadata((PropsMetadata) metadata);
+            } else if (metadata instanceof ValueMetadata) {
+                processingStack.add("Value->");
+                return processValueMetadata((ValueMetadata) metadata);
+            } else {
+                processingStack.add("Unknown Metadata " + metadata + "->");
+                return metadata;
+            }
+        } finally {
+            processingStack.removeLast();
+        }
+    }
+
+    protected Metadata processBeanMetadata(BeanMetadata component) {
+        for (BeanArgument arg :  component.getArguments()) {
+
+            try {
+                processingStack.add(
+                        "Argument index " + arg.getIndex() + " and value type " + arg.getValueType() + "->");
+                if(arg instanceof MutableBeanArgument) {
+                    ((MutableBeanArgument) arg).setValue(processMetadata(arg.getValue()));
+                } else {
+                    //Say that we can't change this argument, but continue processing
+                    //If the value is mutable then we may be ok!
+                    printWarning(arg, "Constructor Argument");
+                    processMetadata(arg.getValue());
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+        for (BeanProperty prop : component.getProperties()) {
+
+            try {
+                processingStack.add("Property named " + prop.getName() + "->");
+                if(prop instanceof MutableBeanProperty) {
+                    ((MutableBeanProperty) prop).setValue(processMetadata(prop.getValue()));
+                } else {
+                    //Say that we can't change this property, but continue processing
+                    //If the value is mutable then we may be ok!
+                    printWarning(prop, "Injection Property");
+                    processMetadata(prop.getValue());
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+
+        Target factoryComponent = component.getFactoryComponent();
+        if(factoryComponent != null) {
+
+            try {
+
+                if(component instanceof MutableBeanMetadata) {
+                    processingStack.add("Factory Component->");
+                    ((MutableBeanMetadata) component).setFactoryComponent(
+                            (Target) processMetadata(factoryComponent));
+                } else {
+                    printWarning(component, "Factory Component");
+                    processingStack.add("Factory Component->");
+                    processMetadata(factoryComponent);
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+
+        return component;
+    }
+
+    protected Metadata processPropsMetadata(PropsMetadata metadata) {
+
+        List<MapEntry> entries = new ArrayList<MapEntry>(metadata.getEntries());
+        if(!!! entries.isEmpty()) {
+
+            try {
+                if(metadata instanceof MutablePropsMetadata) {
+                    processingStack.add("Properties->");
+                    MutablePropsMetadata mpm = (MutablePropsMetadata) metadata;
+
+                    for (MapEntry entry : entries) {
+                        mpm.removeEntry(entry);
+                    }
+                    for (MapEntry entry : processMapEntries(entries)) {
+                        mpm.addEntry(entry);
+                    }
+                } else {
+                    printWarning(metadata, "Properties");
+                    processingStack.add("Properties->");
+                    processMapEntries(entries);
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+        return metadata;
+    }
+
+    protected Metadata processMapMetadata(MapMetadata metadata) {
+        List<MapEntry> entries = new ArrayList<MapEntry>(metadata.getEntries());
+        if(!!! entries.isEmpty()) {
+
+            try {
+                if(metadata instanceof MutableMapMetadata) {
+                    processingStack.add("Map->");
+                    MutableMapMetadata mmm = (MutableMapMetadata) metadata;
+
+                    for (MapEntry entry : entries) {
+                        mmm.removeEntry(entry);
+                    }
+                    for (MapEntry entry : processMapEntries(entries)) {
+                        mmm.addEntry(entry);
+                    }
+                } else {
+                    printWarning(metadata, "Map");
+                    processingStack.add("Map->");
+                    processMapEntries(entries);
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+        return metadata;
+    }
+
+    protected List<MapEntry> processMapEntries(List<MapEntry> entries) {
+        for (MapEntry entry : entries) {
+            try {
+                processingStack.add("Map Entry Key: " + entry.getKey() + " Value: " + entry.getValue() + "->" );
+
+                if(entry instanceof MutableMapEntry) {
+                    ((MutableMapEntry) entry).setKey((NonNullMetadata) processMetadata(entry.getKey()));
+                    ((MutableMapEntry) entry).setValue(processMetadata(entry.getValue()));
+                } else {
+                    printWarning(entry, "Map Entry");
+                    processMetadata(entry.getKey());
+                    processMetadata(entry.getValue());
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+        return entries;
+    }
+
+    protected Metadata processCollectionMetadata(CollectionMetadata metadata) {
+
+        List<Metadata> values = new ArrayList<Metadata>(metadata.getValues());
+        if(!!! values.isEmpty()) {
+
+            try {
+                if(metadata instanceof MutableCollectionMetadata) {
+                    processingStack.add("Collection type: " + metadata.getValueType() + "->");
+                    MutableCollectionMetadata mcm = (MutableCollectionMetadata) metadata;
+
+                    for (Metadata value : values) {
+                        mcm.removeValue(value);
+                    }
+                    for (Metadata value : values) {
+                        mcm.addValue(processMetadata(value));
+                    }
+                } else {
+                    printWarning(metadata, "Collection type: " + metadata.getValueType());
+                    processingStack.add("Collection type: " + metadata.getValueType() + "->");
+                    for (Metadata value : values) {
+                        processMetadata(value);
+                    }
+                }
+            } finally {
+                processingStack.removeLast();
+            }
+        }
+        return metadata;
+    }
+
+    protected Metadata processValueMetadata(ValueMetadata metadata) {
+
+        return new LateBindingValueMetadata(metadata);
+    }
+
+    private void printWarning(Object immutable, String processingType) {
+        StringBuilder sb = new StringBuilder("The property placeholder processor for ");
+        sb.append(placeholderPrefix).append(',').append(" ").append(placeholderSuffix)
+                .append(" found an immutable ").append(processingType)
+                .append(" at location ");
+
+        for(String s : processingStack) {
+            sb.append(s);
+        }
+
+        sb.append(". This may prevent properties, beans, or other items referenced by this component from being properly processed.");
+
+        LOGGER.info(sb.toString());
+    }
+
+    protected String retrieveValue(String expression) {
+        return getProperty(expression);
+    }
+
+    protected String processString(String str) {
+        // TODO: we need to handle escapes on the prefix / suffix
+        Matcher matcher = getPattern().matcher(str);
+        while (matcher.find()) {
+            String rep = retrieveValue(matcher.group(1));
+            if (rep != null) {
+                str = str.replace(matcher.group(0), rep);
+                matcher.reset(str);
+            }
+        }
+        return str;
+    }
+
+    protected String getProperty(String val) {
+        return null;
+    }
+
+    protected Pattern getPattern() {
+        if (pattern == null) {
+            pattern = Pattern.compile("\\Q" + placeholderPrefix + "\\E(.+?)\\Q" + placeholderSuffix + "\\E");
+        }
+        return pattern;
+    }
+
+    public class LateBindingValueMetadata implements ValueMetadata {
+
+        private final ValueMetadata metadata;
+        private boolean retrieved;
+        private String retrievedValue;
+
+        public LateBindingValueMetadata(ValueMetadata metadata) {
+            this.metadata = metadata;
+        }
+
+        public String getStringValue() {
+            if (!retrieved) {
+                String v = metadata.getStringValue();
+                LOGGER.debug("Before process: {}", v);
+                retrievedValue = processString(v);
+                LOGGER.debug("After process: {}", retrievedValue);
+
+                retrieved = true;
+            }
+            return retrievedValue;
+        }
+
+        public String getType() {
+            return metadata.getType();
+        }
+    }
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/ExtendedBlueprintContainer.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/ExtendedBlueprintContainer.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/ExtendedBlueprintContainer.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/services/ExtendedBlueprintContainer.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.services;
+
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.Processor;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.container.Converter;
+
+import java.security.AccessControlContext;
+import java.util.List;
+
+public interface ExtendedBlueprintContainer extends BlueprintContainer {
+
+    Converter getConverter();
+
+    Class loadClass(String name) throws ClassNotFoundException;
+
+    AccessControlContext getAccessControlContext();
+
+    ComponentDefinitionRegistry getComponentDefinitionRegistry();
+
+    <T extends Processor> List<T> getProcessors(Class<T> type);
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/BlueprintContainerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/BlueprintContainerTest.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/BlueprintContainerTest.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/BlueprintContainerTest.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+import org.apache.aries.blueprint.container.BlueprintContainerImpl;
+import org.apache.aries.blueprint.sample.Foo;
+import org.junit.Test;
+
+import java.net.URL;
+import java.util.Arrays;
+
+import static org.junit.Assert.*;
+
+public class BlueprintContainerTest {
+
+    @Test
+    public void testSimple() throws Exception {
+        URL url = getClass().getClassLoader().getResource("test.xml");
+        BlueprintContainerImpl container = new BlueprintContainerImpl(getClass().getClassLoader(), Arrays.asList(url));
+
+        Foo foo = (Foo) container.getComponentInstance("foo");
+        assertNotNull(foo);
+        assertEquals(5, foo.getA());
+        assertEquals(-1, foo.getB());
+
+        container.destroy();
+    }
+
+    public static void main(String[] args) throws Exception {
+        URL url = BlueprintContainerTest.class.getClassLoader().getResource("test.xml");
+        BlueprintContainerImpl container = new BlueprintContainerImpl(BlueprintContainerTest.class.getClassLoader(), Arrays.asList(url));
+        System.out.println(container.getComponentInstance("foo"));
+        container.destroy();
+    }
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Bar.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Bar.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Bar.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Bar.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,46 @@
+/**
+ *  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.sample;
+
+import java.util.List;
+
+public class Bar {
+    
+    private String value;
+    private List list;
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String s) {
+        value = s;
+    }
+
+    public List getList() {
+        return list;
+    }
+
+    public void setList(List l) {
+        list = l;
+    }
+
+    public String toString() {
+        return hashCode() + ": " + value + " " + list;
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/CurrencyTypeConverter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/CurrencyTypeConverter.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/CurrencyTypeConverter.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/CurrencyTypeConverter.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,34 @@
+/**
+ *  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.sample;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+import java.util.Currency;
+
+public class CurrencyTypeConverter implements Converter {
+
+    public boolean canConvert(Object fromValue, ReifiedType toType) {
+        return Currency.class.isAssignableFrom(toType.getRawClass());
+    }
+
+    public Object convert(Object source, ReifiedType toType) throws Exception {
+        return Currency.getInstance(source.toString());
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/DateTypeConverter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/DateTypeConverter.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/DateTypeConverter.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/DateTypeConverter.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,42 @@
+/**
+ *  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.sample;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DateTypeConverter implements Converter {
+
+    DateFormat dateFormat;
+    
+    public void setFormat(String format) {
+        dateFormat = new SimpleDateFormat(format);
+    }
+    
+    public Object convert(Object source, ReifiedType toType) throws Exception {
+        return dateFormat.parse(source.toString());
+    }
+
+    public boolean canConvert(Object fromValue, ReifiedType toType) {
+        return Date.class.isAssignableFrom(toType.getRawClass());
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Foo.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Foo.java?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Foo.java (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/java/org.apache.aries.blueprint/sample/Foo.java Wed Jan  9 08:39:40 2013
@@ -0,0 +1,107 @@
+/**
+ *  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.sample;
+
+import java.io.Serializable;
+import java.util.Currency;
+import java.util.Date;
+import java.util.Map;
+
+public class Foo implements Serializable {
+    
+    private int a;
+    private int b;
+    private Bar bar;
+    private Currency currency;
+    private Date date;
+
+    public boolean initialized;
+    public boolean destroyed;
+    private Map<String, Object> props;
+
+    public int getA() {
+        return a;
+    }
+
+    public void setA(int i) {
+        a = i;
+    }
+
+    public int getB() {
+        return b;
+    }
+
+    public void setB(int i) {
+        b = i;
+    }
+
+    public Bar getBar() {
+        return bar;
+    }
+
+    public void setBar(Bar b) {
+        bar = b;
+    }
+
+    public Currency getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(Currency c) {
+        currency = c;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date d) {
+        date = d;
+    }
+
+    public String toString() {
+        return a + " " + b + " " + bar + " " + currency + " " + date;
+    }
+
+    public void init() {
+        System.out.println("======== Initializing Foo =========");
+        initialized = true;
+    }
+
+    public void destroy() {
+        System.out.println("======== Destroying Foo =========");
+        destroyed = true;
+    }
+
+    public boolean isInitialized() {
+        return initialized;
+    }
+
+    public boolean isDestroyed() {
+        return destroyed;
+    }
+
+    public void update(Map<String,Object> props) {
+        this.props = props;
+    }
+
+    public Map<String, Object> getProps() {
+        return props;
+    }
+
+}
+

Added: aries/trunk/blueprint/blueprint-noosgi/src/test/resources/test.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/test/resources/test.xml?rev=1430734&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/test/resources/test.xml (added)
+++ aries/trunk/blueprint/blueprint-noosgi/src/test/resources/test.xml Wed Jan  9 08:39:40 2013
@@ -0,0 +1,69 @@
+<?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.
+-->
+<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.2.0"
+           default-availability="optional">
+
+    <type-converters>
+        <bean id="converter1" class="org.apache.aries.blueprint.sample.DateTypeConverter">
+            <property name="format" value="yyyy.MM.dd" />
+        </bean>
+        <bean id="converter2"
+              class="org.apache.aries.blueprint.sample.CurrencyTypeConverter" />
+
+    </type-converters>
+
+    <ext:property-placeholder placeholder-prefix="$["
+                              placeholder-suffix="]" ignore-missing-locations="true"
+                              system-properties="override">
+        <ext:default-properties>
+            <ext:property name="name" value="value" />
+            <ext:property name="a" value="Hello " />
+            <ext:property name="b" value="FooBar" />
+            <ext:property name="key.b" value="-1" />
+        </ext:default-properties>
+        <ext:location>file:///url</ext:location>
+    </ext:property-placeholder>
+
+    <bean id="foo" class="org.apache.aries.blueprint.sample.Foo"
+          init-method="init" destroy-method="destroy">
+        <property name="a" value="5" />
+        <property name="b" value="$[key.b]" />
+        <property name="bar" ref="bar" />
+        <property name="currency">
+            <value>PLN</value>
+        </property>
+        <property name="date">
+            <value>2009.04.17</value>
+        </property>
+    </bean>
+
+    <bean id="bar" class="org.apache.aries.blueprint.sample.Bar">
+        <property name="value" value="$[a]$[b]">
+            <!--value>Hello FooBar</value-->
+        </property>
+        <property name="list">
+            <list>
+                <value>a list element</value>
+                <value type="java.lang.Integer">5</value>
+            </list>
+        </property>
+    </bean>
+
+</blueprint>
+

Modified: aries/trunk/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/pom.xml?rev=1430734&r1=1430733&r2=1430734&view=diff
==============================================================================
--- aries/trunk/blueprint/pom.xml (original)
+++ aries/trunk/blueprint/pom.xml Wed Jan  9 08:39:40 2013
@@ -45,6 +45,7 @@
         <module>blueprint-bundle</module>
         <module>blueprint-compatibility</module>
         <module>blueprint-core-compatibility</module>
+        <module>blueprint-noosgi</module>
         <module>blueprint-jexl-evaluator</module>
         <module>blueprint-sample</module>
         <module>blueprint-annotation-api</module>



Mime
View raw message