polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [27/80] [partial] zest-java git commit: First round of changes to move to org.apache.zest namespace.
Date Thu, 30 Jul 2015 19:48:26 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/api/src/test/resources/org/qi4j/api/configuration/MyService.properties
----------------------------------------------------------------------
diff --git a/core/api/src/test/resources/org/qi4j/api/configuration/MyService.properties b/core/api/src/test/resources/org/qi4j/api/configuration/MyService.properties
deleted file mode 100644
index 6ed5ff6..0000000
--- a/core/api/src/test/resources/org/qi4j/api/configuration/MyService.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-
-me = { name : Niclas, address={ street1 : "Henan Lu 555", street2 : "Block 15", city : { cityName : "Shanghai", country : { countryName : "China" } } } }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
new file mode 100644
index 0000000..1e1e0e3
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2009, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Implement this interface to create the root class that
+ * is responsible for assembling your entire application.
+ *
+ * Model introspectors will instantiate this class and call assemble
+ * to create the application, which will then be visited to get
+ * information about its structure.
+ *
+ * Application deployment servers will instantiate this, call assemble,
+ * and then activate the created application, which will be the runtime
+ * instance that forms your application.
+ */
+public interface ApplicationAssembler
+{
+    ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
new file mode 100644
index 0000000..3b8cb80
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Helper base class for application assemblers that
+ * want to either create applications using only one layer/module,
+ * or that wants to create pancake-layered applications.
+ */
+public class ApplicationAssemblerAdapter
+    implements ApplicationAssembler
+{
+    private final Assembler[][][] assemblers;
+
+    protected ApplicationAssemblerAdapter( Assembler assembler )
+    {
+        this.assemblers = new Assembler[][][]{ { { assembler } } };
+    }
+
+    protected ApplicationAssemblerAdapter( Assembler[][][] assemblers )
+    {
+        this.assemblers = assemblers;
+    }
+
+    @Override
+    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException
+    {
+        return applicationFactory.newApplicationAssembly( assemblers );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
new file mode 100644
index 0000000..849f397
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ * Copyright 2012 Paul Merlin.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import org.apache.zest.api.activation.Activator;
+import org.apache.zest.api.structure.Application;
+
+/**
+ * An application assembly. This can be used by Assemblers to programmatically
+ * set the name of the application and create new layers.
+ */
+public interface ApplicationAssembly
+{
+    /**
+     * Create a new layer assembly
+     *
+     * @param name of the new layer
+     *
+     * @return a LayerAssembly instance
+     */
+    LayerAssembly layer( String name );
+
+    /**
+     * Get an assembly for a particular Module. If this is called many times with the same names, then the same module
+     * is affected.
+     *
+     * @param layerName The name of the Layer
+     * @param moduleName The name of the Module to retrieve or create.
+     * @return The ModuleAssembly for the Module.
+     */
+    ModuleAssembly module( String layerName, String moduleName );
+    
+    /**
+     * Get the currently set name of the application
+     *
+     * @return the name of the application
+     */
+    String name();
+
+    /**
+     * Get the currently set mode of the application
+     *
+     * @return the application mode
+     */
+    Application.Mode mode();
+
+    /**
+     * Set the name of the application
+     *
+     * @param name of the application
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setName( String name );
+
+    /**
+     * Set the version of the application. This can be in any format, but
+     * most likely will follow the Dewey format, i.e. x.y.z.
+     *
+     * @param version of the application
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setVersion( String version );
+
+    /**
+     * Set the application mode. This will be set to "production" by default. You can
+     * set the system property "mode" to either "development", "satisfiedBy" or "production"
+     * to explicitly set the mode. If that is not an option, then call this method
+     * during assembly to set the mode. The mode may then be queried by assemblers,
+     * and they may assemble the application differentlly depending on this setting.
+     *
+     * @param mode the application mode
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setMode( Application.Mode mode );
+
+    ApplicationAssembly setMetaInfo( Object info );
+
+    /**
+     * Set the application activators. Activators are executed in order around the
+     * Application activation and passivation.
+     *
+     * @param activators the application activators
+     * @return the assembly
+     */
+    @SuppressWarnings( { "unchecked","varargs" } )
+    ApplicationAssembly withActivators( Class<? extends Activator<Application>>... activators );
+
+    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
new file mode 100644
index 0000000..264fa65
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ *
+ * Licensed  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.zest.bootstrap;
+
+/**
+ * Factory for creating new Zest application assemblies. Typically
+ * you will implement one or more Assemblers, wrap them in an ApplicationAssembler,
+ * which then uses this factory to assemble and create applications.
+ */
+public interface ApplicationAssemblyFactory
+{
+    /**
+     * Create a new application with one layer and one module.
+     *
+     * @param assembler the assembler for the single module
+     *
+     * @return the application instance
+     *
+     * @throws AssemblyException if the application could not be assembled
+     */
+    ApplicationAssembly newApplicationAssembly( Assembler assembler )
+        throws AssemblyException;
+
+    /**
+     * Create a new application with the same amount of layers
+     * as the first array size, with modules according to the second array size,
+     * and then use the third array for assemblers of each module. This gives you
+     * a simple way to create "pancake" layered applications.
+     *
+     * @param assemblers the set of assemblers for the application
+     *
+     * @return the application instance
+     *
+     * @throws AssemblyException if the application could not be assembled
+     */
+    ApplicationAssembly newApplicationAssembly( Assembler[][][] assemblers )
+        throws AssemblyException;
+
+    /**
+     * Create a new ApplicationAssembly that can be used for the above method.
+     *
+     * @return a new ApplicationAssembly
+     */
+    ApplicationAssembly newApplicationAssembly();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
new file mode 100644
index 0000000..471410d
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2009, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+import org.apache.zest.api.structure.ApplicationDescriptor;
+
+/**
+ * Factory for ApplicationModelSPI's. Takes an ApplicationAssembly, executes it,
+ * and builds an application model from it, which can then be instantiated and activated.
+ */
+public interface ApplicationModelFactory
+{
+    ApplicationDescriptor newApplicationModel( ApplicationAssembly assembly )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
new file mode 100644
index 0000000..3a4ffa2
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Set the name of the application
+ */
+public final class ApplicationName
+    implements Assembler
+{
+    private String name;
+
+    public ApplicationName( String name )
+    {
+        this.name = name;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.layer().application().setName( name );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
new file mode 100644
index 0000000..be8126c
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * ModuleAssemblies are configured by Assemblers. This
+ * is the interface you would implement in order to provide
+ * all configuration and additional metainfo that is needed
+ * to instantiate a Zest application.
+ */
+public interface Assembler
+{
+    /**
+     * Assemblers receive a callback to the ModuleAssembly
+     * they are supposed to configure. They can use this
+     * to register objects, composites, services etc. and
+     * the additional metadata that may exist for these
+     * artifacts.
+     * <p>
+     * An Assembler may create new Modules by calling
+     * {@link org.apache.zest.bootstrap.ModuleAssembly#layer()} and
+     * then {@link LayerAssembly#module(String)} (String)}.
+     * This allows an Assembler to bootstrap an entire Layer with
+     * more Modules.
+     * </p>
+     * @param module the Module to assemble
+     *
+     * @throws AssemblyException thrown if the assembler tries to do something illegal
+     */
+    void assemble( ModuleAssembly module )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
new file mode 100644
index 0000000..63e96ed
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Assembler that delegates to a collection of Assemblers.
+ * <p>
+ * Makes it easy to collect and compose assemblers into bigger assemblers.
+ * </p>
+ */
+public final class AssemblerCollection
+    implements Assembler
+{
+    Collection<Assembler> assemblers;
+
+    public AssemblerCollection( Assembler... assemblers )
+    {
+        this.assemblers = Arrays.asList( assemblers );
+    }
+
+    @SafeVarargs
+    public AssemblerCollection( Class<? extends Assembler>... assemblyClasses )
+        throws AssemblyException
+    {
+        assemblers = new ArrayList<>();
+        for( Class<? extends Assembler> assemblyClass : assemblyClasses )
+        {
+            try
+            {
+                Assembler assembler = assemblyClass.newInstance();
+                assemblers.add( assembler );
+            }
+            catch( Exception e )
+            {
+                throw new AssemblyException( "Could not instantiate assembly with class " + assemblyClass.getName(), e );
+            }
+        }
+    }
+
+    public AssemblerCollection( Collection<Assembler> assemblers )
+    {
+        this.assemblers = assemblers;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        for( Assembler assembler : assemblers )
+        {
+            assembler.assemble( module );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
new file mode 100644
index 0000000..d123132
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
@@ -0,0 +1,446 @@
+/*
+ * Copyright 2014 Paul Merlin.
+ *
+ * Licensed  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.zest.bootstrap;
+
+/**
+ * Assembler adapters for common use cases (visibility, identity, configuration).
+ */
+public class Assemblers
+{
+    private Assemblers()
+    {
+    }
+
+    /**
+     * Assembler with Visibility interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Visible<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Visibility.
+         * @param visibility Visibility
+         * @return This Assembler instance
+         */
+        AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility );
+
+        /**
+         * Get Visibility.
+         * <p>Default to {@link org.apache.zest.api.common.Visibility#module}.</p>
+         * @return Visibility
+         */
+        org.apache.zest.api.common.Visibility visibility();
+    }
+
+    /**
+     * Assembler with Identity interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Identifiable<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Identity.
+         * @param identity Identity
+         * @return This Assembler instance
+         */
+        AssemblerType identifiedBy( String identity );
+
+        /**
+         * @return {@literal true} if {@link #identity()} do not return null, {@literal false} otherwise
+         */
+        boolean hasIdentity();
+
+        /**
+         * Get Identity.
+         * <p>Default to {@literal null}.</p>
+         * @return Identity
+         */
+        String identity();
+    }
+
+    /**
+     * Assembler with Configuration interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Configurable<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Configuration Module and Visibility.
+         * @param configModule Configuration Module
+         * @param configVisibility Configuration Visiblity
+         * @return This Assembler instance
+         */
+        AssemblerType withConfig( ModuleAssembly configModule,
+                                  org.apache.zest.api.common.Visibility configVisibility );
+
+        /**
+         * @return {@literal true} if {@link #configModule() ()} do not return null, {@literal false} otherwise
+         */
+        boolean hasConfig();
+
+        /**
+         * Get Configuration Module.
+         * <p>Default to {@literal null}.</p>
+         * @return Configuration Module
+         */
+        ModuleAssembly configModule();
+
+        /**
+         * Get Configuration Visibility.
+         * <p>Default to {@link org.apache.zest.api.common.Visibility#module}.</p>
+         * @return Configuration Visibility
+         */
+        org.apache.zest.api.common.Visibility configVisibility();
+    }
+
+    /**
+     * Assembler with Visibility adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Visibility<AssemblerType>
+        implements Visible<AssemblerType>
+    {
+        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+    }
+
+    /**
+     * Assembler with Identity adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Identity<AssemblerType>
+        implements Identifiable<AssemblerType>
+    {
+        private String identity;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+    }
+
+    /**
+     * Assembler with Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Config<AssemblerType>
+        implements Configurable<AssemblerType>
+    {
+        private ModuleAssembly configModule = null;
+        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.zest.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Visibility and Identity adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityIdentity<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Identifiable<AssemblerType>
+    {
+        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
+        private String identity;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+    }
+
+    /**
+     * Assembler with Visibility and Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityConfig<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
+        private ModuleAssembly configModule = null;
+        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.zest.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Identity and Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class IdentityConfig<AssemblerType>
+        implements Identifiable<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private String identity;
+        private ModuleAssembly configModule = null;
+        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.zest.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Visibility, Identity and Configuation adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityIdentityConfig<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Identifiable<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
+        private String identity;
+        private ModuleAssembly configModule = null;
+        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.zest.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.zest.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
new file mode 100644
index 0000000..aaaac20
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Thrown by ModuleAssembly if the Assembler tries to make an invalid assembly.
+ */
+public class AssemblyException
+    extends Exception
+{
+    public AssemblyException()
+    {
+    }
+
+    public AssemblyException( String string )
+    {
+        super( string );
+    }
+
+    public AssemblyException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+
+    public AssemblyException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
new file mode 100644
index 0000000..69b82e3
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
@@ -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.zest.bootstrap;
+
+import org.apache.zest.api.type.HasTypes;
+import org.apache.zest.functional.Specification;
+import org.apache.zest.functional.Specifications;
+
+/**
+ * Utility specifications for Assemblies.
+ */
+public class AssemblySpecifications
+{
+    public static Specification<HasTypes> types( final Class... types )
+    {
+        return new Specification<HasTypes>()
+        {
+            @Override
+            public boolean satisfiedBy( HasTypes item )
+            {
+
+                for( Class<?> type : item.types() )
+                {
+                    if( Specifications.in( types ).satisfiedBy( type ) )
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
new file mode 100644
index 0000000..cd5a4da
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2009, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Visitor interface to visit the whole or parts of an assembly.
+ * <p>
+ * Implement this interface and call visit() on ApplicationAssembly, LayerAssembly or ModuleAssembly.
+ * </p>
+ * <p>
+ * This can be used to, for example, add metadata to all entities, add concerns on composites, or similar.
+ * </p>
+ */
+public interface AssemblyVisitor<ThrowableType extends Throwable>
+{
+    public void visitApplication( ApplicationAssembly assembly )
+        throws ThrowableType;
+
+    public void visitLayer( LayerAssembly assembly )
+        throws ThrowableType;
+
+    public void visitModule( ModuleAssembly assembly )
+        throws ThrowableType;
+
+    public void visitComposite( TransientDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitEntity( EntityDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitService( ServiceDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitImportedService( ImportedServiceDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitValue( ValueDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitObject( ObjectDeclaration declaration )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
new file mode 100644
index 0000000..69c6d32
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2009, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Base class for assembly visitors. Subclass and override
+ * the particular methods you are interested in.
+ */
+public class AssemblyVisitorAdapter<ThrowableType extends Throwable>
+    implements AssemblyVisitor<ThrowableType>
+{
+    @Override
+    public void visitApplication( ApplicationAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitLayer( LayerAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitModule( ModuleAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitComposite( TransientDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitEntity( EntityDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitService( ServiceDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitImportedService( ImportedServiceDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitValue( ValueDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitObject( ObjectDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
new file mode 100644
index 0000000..5857194
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.zest.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.zest.api.association.Association} information that the runtime can use.
+ */
+public interface AssociationDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
new file mode 100644
index 0000000..018d824
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Thrown by the Zest runtime if a dependency can not be bound.
+ */
+public class BindingException
+    extends Exception
+{
+    public BindingException( String s )
+    {
+        super( s );
+    }
+
+    public BindingException( String s, InvalidInjectionException ex )
+    {
+        super( s, ex );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
new file mode 100644
index 0000000..12da989
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ *
+ * Licensed  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.zest.bootstrap;
+
+/**
+ * This exception is thrown if no ApplicationFactory provider can be found
+ */
+public class BootstrapException
+    extends RuntimeException
+{
+    public BootstrapException( String message )
+    {
+        super( message );
+    }
+
+    public BootstrapException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
new file mode 100644
index 0000000..d8fb7b7
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2008-2011 Rickard Öberg. All rights Reserved.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.CodeSource;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Pattern;
+import org.apache.zest.functional.Function;
+import org.apache.zest.functional.Iterables;
+import org.apache.zest.functional.Specification;
+
+import static org.apache.zest.functional.Iterables.filter;
+import static org.apache.zest.functional.Iterables.flatten;
+import static org.apache.zest.functional.Iterables.flattenIterables;
+import static org.apache.zest.functional.Iterables.iterable;
+import static org.apache.zest.functional.Iterables.map;
+
+/**
+ * Scan classpath for classes that matches given criteria. Useful for automated assemblies with lots of similar classes.
+ */
+public class ClassScanner
+{
+    /**
+     * Get all classes from the same package of the given class, and recursively in all subpackages.
+     * <p>
+     * This only works if the seed class is loaded from a file: URL. Jar files are possible as well. Abstract classes
+     * are not included in the results. For further filtering use e.g. Iterables.filter.
+     * </p>
+     * @param seedClass starting point for classpath scanning
+     *
+     * @return iterable of all concrete classes in the same package as the seedclass, and also all classes in subpackages.
+     */
+    public static Iterable<Class<?>> findClasses( final Class<?> seedClass )
+    {
+        CodeSource codeSource = seedClass.getProtectionDomain().getCodeSource();
+        if( codeSource == null )
+        {
+            return Iterables.empty();
+        }
+
+        URL location = codeSource.getLocation();
+
+        if( !location.getProtocol().equals( "file" ) )
+        {
+            throw new IllegalArgumentException( "Can only enumerate classes from file system locations. URL is:" + location );
+        }
+
+        final File file;
+        try
+        {
+            file = new File( location.toURI().getPath() );
+        }
+        catch( URISyntaxException e )
+        {
+            throw new IllegalArgumentException( "The file location of codebase is invalid. Can not convert to URI. URL is:" + location );
+        }
+
+        if( file.getName().endsWith( ".jar" ) )
+        {
+            try
+            {
+                final String packageName = seedClass.getPackage().getName().replace( '.', '/' );
+
+                JarFile jarFile = new JarFile( file );
+                Iterable<JarEntry> entries = Iterables.iterable( jarFile.entries() );
+                try
+                {
+                    return Iterables.toList( filter( new ValidClass(),
+                                                     map( new Function<JarEntry, Class<?>>()
+                                                     {
+                                                         @Override
+                                                         public Class map( JarEntry jarEntry )
+                                                         {
+                                                             String name = jarEntry.getName();
+                                                             name = name.substring( 0, name.length() - 6 );
+                                                             name = name.replace( '/', '.' );
+                                                             try
+                                                             {
+                                                                 return seedClass.getClassLoader().loadClass( name );
+                                                             }
+                                                             catch( ClassNotFoundException e )
+                                                             {
+                                                                 return null;
+                                                             }
+                                                         }
+                                                     }
+                                                         , filter( new Specification<JarEntry>()
+                                                     {
+                                                         @Override
+                                                         public boolean satisfiedBy( JarEntry jarEntry )
+                                                         {
+                                                             return jarEntry.getName()
+                                                                        .startsWith( packageName ) && jarEntry.getName()
+                                                                 .endsWith( ".class" );
+                                                         }
+                                                     }, entries ) ) ) );
+                }
+                finally
+                {
+                    jarFile.close();
+                }
+            }
+            catch( IOException e )
+            {
+                throw new IllegalArgumentException( "Could not open jar file " + file, e );
+            }
+        }
+        else
+        {
+            final File path = new File( file, seedClass.getPackage().getName().replace( '.', File.separatorChar ) );
+            Iterable<File> files = findFiles( path, new Specification<File>()
+            {
+                @Override
+                public boolean satisfiedBy( File file )
+                {
+                    return file.getName().endsWith( ".class" );
+                }
+            } );
+
+            return filter( new ValidClass(),
+                           map( new Function<File, Class<?>>()
+                           {
+                               @Override
+                               public Class<?> map( File f )
+                               {
+                                   String fileName = f.getAbsolutePath().substring( file.toString().length() + 1 );
+                                   fileName = fileName.replace( File.separatorChar, '.' )
+                                       .substring( 0, fileName.length() - 6 );
+                                   try
+                                   {
+                                       return seedClass.getClassLoader().loadClass( fileName );
+                                   }
+                                   catch( ClassNotFoundException e )
+                                   {
+                                       return null;
+                                   }
+                               }
+                           }, files ) );
+        }
+    }
+
+    /**
+     * Useful specification for filtering classes based on a regular expression matching the class names.
+     * <p>
+     * Example: matches(".*Model") -&gt; match only class names that end with Model
+     * </p>
+     *
+     * @param regex The regular expression to be matched.
+     *
+     * @return regex class name specification
+     */
+    public static Specification<Class<?>> matches( String regex )
+    {
+        final Pattern pattern = Pattern.compile( regex );
+
+        return new Specification<Class<?>>()
+        {
+            @Override
+            public boolean satisfiedBy( Class<?> aClass )
+            {
+                return pattern.matcher( aClass.getName() ).matches();
+            }
+        };
+    }
+
+    private static Iterable<File> findFiles( File directory, final Specification<File> filter )
+    {
+        return flatten( filter( filter, iterable( directory.listFiles() ) ),
+                        flattenIterables( map( new Function<File, Iterable<File>>()
+                        {
+                            @Override
+                            public Iterable<File> map( File file )
+                            {
+                                return findFiles( file, filter );
+                            }
+                        }, filter( new Specification<File>()
+                        {
+                            @Override
+                            public boolean satisfiedBy( File file )
+                            {
+                                return file.isDirectory();
+                            }
+                        }, iterable( directory.listFiles() ) ) ) ) );
+    }
+
+    private static class ValidClass
+        implements Specification<Class<?>>
+    {
+        @Override
+        public boolean satisfiedBy( Class<?> item )
+        {
+            return ( item.isInterface() || !Modifier.isAbstract( item.getModifiers() ) ) && ( !item.isEnum() && !item.isAnonymousClass() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
new file mode 100644
index 0000000..24ec6e4
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
@@ -0,0 +1,28 @@
+/*
+ *  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.zest.bootstrap;
+
+import org.apache.zest.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single ConfigurationComposite in a Module.
+ */
+public interface ConfigurationAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
new file mode 100644
index 0000000..6ca6949
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
@@ -0,0 +1,87 @@
+/*
+ *  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.zest.bootstrap;
+
+import org.apache.zest.api.common.Visibility;
+
+/**
+ * Fluent API for declaring configurations. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#configurations(Class[])}.
+ */
+public interface ConfigurationDeclaration
+{
+    /**
+     * Set additional metainfo for this configuration declaration.
+     *
+     * @param info metainfo that can be retrieved from the CompositeDescriptor.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration setMetaInfo( Object info );
+
+    /**
+     * Set visibility for declared entities.
+     *
+     * @param visibility The {@link Visibility} that this ConfigurationComposite will have.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration visibleIn( Visibility visibility );
+
+    /**
+     * Declare additional concerns for these configurations.
+     *
+     * @param concerns The concerns that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withConcerns( Class<?>... concerns );
+
+    /**
+     * Declare additional side-effects for these configurations.
+     *
+     * @param sideEffects The sideeffects that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withSideEffects( Class<?>... sideEffects );
+
+    /**
+     * Declare additional mixins for these configurations.
+     * <p>
+     * This can be useful to override any default mixins from the configuration interface.
+     * </p>
+     * @param mixins The mixins that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withMixins( Class<?>... mixins );
+
+    /**
+     * Declare additional interfaces for these declared interfaces.
+     * <p>
+     * This can be useful to add types that the Configuration should implement, but
+     * which you do not want to include in the entity interface itself.
+     * </p>
+     * @param types list of interfaces to add
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withTypes( Class<?>... types );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
new file mode 100644
index 0000000..4661417
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2008-2011 Niclas Hedhman. All rights Reserved.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import org.apache.zest.api.Qi4j;
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.ApplicationDescriptor;
+import org.apache.zest.spi.Qi4jSPI;
+
+/**
+ * Main bootstrap class for starting Zest and creating new applications.
+ * <p>
+ * Instantiate this and call one of the factory methods to get started.
+ * </p>
+ * <p>
+ * This class will use the Service Loader mechanism in Java to try to locate a runtime that implements
+ * the Qi4jRuntime interface. This avoids a direct dependency from the bootstrap to the runtime.
+ * </p>
+ */
+public final class Energy4Java
+{
+    private Qi4jRuntime runtime;
+
+    public Energy4Java( RuntimeFactory runtimeFactory )
+    {
+        this( runtimeFactory.createRuntime() );
+    }
+
+    public Energy4Java()
+    {
+        this( new RuntimeFactory.StandaloneApplicationRuntimeFactory().createRuntime() );
+    }
+
+    public Energy4Java( Qi4jRuntime runtime )
+    {
+        if( runtime == null )
+        {
+            throw new BootstrapException( "Can not create Zest without a Zest Runtime." );
+        }
+        this.runtime = runtime;
+    }
+
+    public ApplicationDescriptor newApplicationModel( ApplicationAssembler assembler )
+        throws AssemblyException
+    {
+        ApplicationAssembly assembly = assembler.assemble( runtime.applicationAssemblyFactory() );
+
+        if( assembly == null )
+        {
+            throw new AssemblyException( "Application assembler did not return any ApplicationAssembly" );
+        }
+
+        try
+        {
+            ApplicationModelFactory modelFactory = runtime.applicationModelFactory();
+            return modelFactory.newApplicationModel( assembly );
+        }
+        catch( RuntimeException e )
+        {
+            throw new AssemblyException( "Unable to create Application Model.", e );
+        }
+    }
+
+    public Application newApplication( ApplicationAssembler assembler, Object... importedServiceInstances )
+        throws AssemblyException
+    {
+        ApplicationDescriptor model = newApplicationModel( assembler );
+        return model.newInstance( runtime.spi(), importedServiceInstances );
+    }
+
+    public Qi4jSPI spi()
+    {
+        return runtime.spi();
+    }
+
+    public Qi4j api()
+    {
+        return runtime.spi();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
new file mode 100644
index 0000000..a36d9bf
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
@@ -0,0 +1,29 @@
+/*
+ * 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.zest.bootstrap;
+
+import org.apache.zest.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single EntityComposite in a Module.
+ */
+public interface EntityAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
new file mode 100644
index 0000000..425d802
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import org.apache.zest.api.common.Visibility;
+
+/**
+ * Fluent API for declaring entities. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#entities(Class[])}.
+ */
+public interface EntityDeclaration
+{
+    /**
+     * Set additional metainfo for this entity declaration.
+     *
+     * @param info metainfo that can be retrieved from the EntityDescriptor.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration setMetaInfo( Object info );
+
+    /**
+     * Set visibility for declared entities.
+     *
+     * @param visibility The {@link Visibility} that this EntityComposite will have.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration visibleIn( Visibility visibility );
+
+    /**
+     * Declare additional concerns for these entities.
+     *
+     * @param concerns The concerns that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withConcerns( Class<?>... concerns );
+
+    /**
+     * Declare additional side-effects for these entitites.
+     *
+     * @param sideEffects The sideeffects that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withSideEffects( Class<?>... sideEffects );
+
+    /**
+     * Declare additional mixins for these entities.
+     * <p>
+     * This can be useful to override any default mixins from the entity interface.
+     * </p>
+     * @param mixins The mixins that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withMixins( Class<?>... mixins );
+
+    /**
+     * Declare additional interfaces for these declared interfaces.
+     * <p>
+     * This can be useful to add types that the entities should implement, but
+     * which you do not want to include in the entity interface itself.
+     * </p>
+     * @param types list of interfaces to add
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withTypes( Class<?>... types );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
new file mode 100644
index 0000000..2dfa31b
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
@@ -0,0 +1,29 @@
+/*
+ * 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.zest.bootstrap;
+
+import org.apache.zest.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single imported service in a Module.
+ */
+public interface ImportedServiceAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
new file mode 100644
index 0000000..41cb46c
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ * Copyright 2012, Paul Merlin.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import org.apache.zest.api.activation.Activator;
+import org.apache.zest.api.common.Visibility;
+import org.apache.zest.api.service.ServiceImporter;
+import org.apache.zest.api.service.importer.InstanceImporter;
+import org.apache.zest.api.service.importer.NewObjectImporter;
+import org.apache.zest.api.service.importer.ServiceInstanceImporter;
+import org.apache.zest.api.service.importer.ServiceSelectorImporter;
+
+/**
+ * Fluent API for declaring imported services. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#importedServices(Class[])}.
+ */
+public interface ImportedServiceDeclaration
+{
+    // Convenience constants for common service importers
+    public static final Class<? extends ServiceImporter> INSTANCE = InstanceImporter.class;
+    public static final Class<? extends ServiceImporter> NEW_OBJECT = NewObjectImporter.class;
+    public static final Class<? extends ServiceImporter> SERVICE_SELECTOR = ServiceSelectorImporter.class;
+    public static final Class<? extends ServiceImporter> SERVICE_IMPORTER = ServiceInstanceImporter.class;
+
+    ImportedServiceDeclaration visibleIn( Visibility visibility );
+
+    ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass );
+
+    ImportedServiceDeclaration identifiedBy( String identity );
+
+    ImportedServiceDeclaration taggedWith( String... tags );
+
+    ImportedServiceDeclaration setMetaInfo( Object serviceAttribute );
+    
+    ImportedServiceDeclaration importOnStartup();
+
+    /**
+     * Set the imported service activators. Activators are executed in order around
+     * the ServiceReference activation and passivation.
+     *
+     * @param activators the imported service activators
+     * @return the assembly
+     */    
+    @SuppressWarnings( { "unchecked","varargs" } )
+    ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
new file mode 100644
index 0000000..65225a8
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Thrown by the Zest runtime if a dependency can not be injected.
+ */
+public class InjectionException
+    extends RuntimeException
+{
+    public InjectionException( String s )
+    {
+        super( s );
+    }
+
+    public InjectionException( String s, Throwable throwable )
+    {
+        super( s, throwable );
+    }
+
+    public InjectionException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
new file mode 100644
index 0000000..b0ad552
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
@@ -0,0 +1,36 @@
+/*
+ * 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.zest.bootstrap;
+
+/**
+ * Thrown by the Zest runtime if a dependency injection declaration is invalid.
+ */
+public class InvalidInjectionException
+    extends Exception
+{
+    public InvalidInjectionException( String s )
+    {
+        super( s );
+    }
+
+    public InvalidInjectionException( String s, Throwable throwable )
+    {
+        super( s, throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
new file mode 100644
index 0000000..9b320c3
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2008 Niclas Hedhman. All rights Reserved.
+ * Copyright 2012 Paul Merlin.
+ *
+ * Licensed  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.zest.bootstrap;
+
+import org.apache.zest.api.activation.Activator;
+import org.apache.zest.api.structure.Layer;
+import org.apache.zest.functional.Specification;
+
+/**
+ * Fluid API for declaring a layer in an application. This is obtained by calling {@link ApplicationAssembly#layer(String)}.
+ */
+public interface LayerAssembly
+{
+    /**
+     * Get an assembly for a particular Module. If this is called many times with the same name, then the same module
+     * is affected.
+     *
+     * @param name The name of the Module to retrieve or create.
+     *
+     * @return The ModuleAssembly for the Module.
+     */
+    ModuleAssembly module( String name );
+
+    ApplicationAssembly application();
+
+    String name();
+
+    LayerAssembly setName( String name );
+
+    LayerAssembly setMetaInfo( Object info );
+
+    LayerAssembly uses( LayerAssembly... layerAssembly );
+
+    /**
+     * Set the layer activators. Activators are executed in order around the
+     * Layer activation and passivation.
+     *
+     * @param activators the layer activators
+     * @return the assembly
+     */    
+    @SuppressWarnings( { "unchecked","varargs" } )
+    LayerAssembly withActivators( Class<? extends Activator<Layer>>... activators );
+
+    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType;
+
+    /**
+     * Given a Specification for EntityAssembly's, returns a EntityDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the EntityComposite types of interest.
+     *
+     * @return An EntityDeclaration for the specified EntityComposite types.
+     */
+    EntityDeclaration entities( Specification<? super EntityAssembly> specification );
+
+    /**
+     * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the ServiceComposite types of interest.
+     *
+     * @return An ServiceDeclaration for the specified ServiceComposite types.
+     */
+    ServiceDeclaration services( Specification<? super ServiceAssembly> specification );
+
+    /**
+     * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the TransientComposite types of interest.
+     *
+     * @return An TransientDeclaration for the specified TransientComposite types.
+     */
+    TransientDeclaration transients( Specification<? super TransientAssembly> specification );
+
+    /**
+     * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the ValueComposite types of interest.
+     *
+     * @return An ValueDeclaration for the specified ValueComposite types.
+     */
+    ValueDeclaration values( Specification<? super ValueAssembly> specification );
+
+    /**
+     * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the Object types of interest.
+     *
+     * @return An ObjectDeclaration for the specified Object types.
+     */
+    ObjectDeclaration objects( Specification<? super ObjectAssembly> specification );
+
+    /**
+     * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the Imported Service types of interest.
+     *
+     * @return An ImportedServiceDeclaration for the specified Imported Service types.
+     */
+    ImportedServiceDeclaration importedServices( Specification<? super ImportedServiceAssembly> specification );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
new file mode 100644
index 0000000..f2c6005
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+/**
+ * Set the name of the layer
+ */
+public final class LayerName
+    implements Assembler
+{
+    private final String name;
+
+    public LayerName( String name )
+    {
+        this.name = name;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.layer().setName( name );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/8744a67f/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
new file mode 100644
index 0000000..3b97b2f
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2008, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed 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.zest.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.zest.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.zest.api.association.ManyAssociation} information that the runtime can use.
+ */
+public interface ManyAssociationDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+}
\ No newline at end of file


Mime
View raw message