Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Constants.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Constants.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Constants.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Constants.java
 Sat Apr 14 01:09:09 2018
@@ -27,29 +27,10 @@ public class Constants {
        public static final String CDI10_URI = 
"http://www.osgi.org/xmlns/cdi/v1.0.0";;
        public static final Set<String> CDI_URIS = 
Sets.immutableHashSet(CDI10_URI);
 
-       public static final String ARRAY_ELEMENT = "array";
-       public static final String CARDINALITY_ATTRIBUTE = "cardinality";
+       public static final String BEAN_ELEMENT = "bean";
        public static final String CLASS_ATTRIBUTE = "class";
-       public static final String COMPONENT_ELEMENT = "component";
-       public static final String CONFIGURATION_ELEMENT = "configuration";
-       public static final String CONFIGURATION_PID_ATTRIBUTE = 
"configuration-pid";
-       public static final String CONFIGURATION_POLICY_ATTRIBUTE = 
"configuration-policy";
-       public static final String INTERFACE_ATTRIBUTE = "interface";
-       public static final String LIST_ELEMENT = "list";
        public static final String NAME_ATTRIBUTE = "name";
-       public static final String POLICY_ATTRIBUTE = "policy";
-       public static final String POLICY_OPTION_ATTRIBUTE = "policy-option";
-       public static final String PROPERTY_ELEMENT = "property";
-       public static final String PROVIDE_ELEMENT = "provide";
-       public static final String REFERENCE_ELEMENT = "reference";
-       public static final String SCOPE_ATTRIBUTE= "scope";
-       public static final String SERVICE_ATTRIBUTE = "service";
-       public static final String SERVICE_SCOPE_ATTRIBUTE = "service-scope";
-       public static final String SET_ELEMENT = "set";
-       public static final String TARGET_ATTRIBUTE = "target";
-       public static final String TYPE_ATTRIBUTE = "type";
-       public static final String VALUE_ATTRIBUTE = "value";
-       public static final String VALUE_ELEMENT = "value";
-       public static final String VALUE_TYPE_ATTRIBUTE = "value-type";
+       public static final String QUALIFIER_BLACKLIST_ELEMENT = 
"qualifier-blacklist";
+       public static final String QUALIFIER_ELEMENT = "qualifier";
 
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBeansHandler.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBeansHandler.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBeansHandler.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBeansHandler.java
 Sat Apr 14 01:09:09 2018
@@ -14,34 +14,22 @@
 
 package org.apache.aries.cdi.container.internal.model;
 
-import static 
org.apache.aries.cdi.container.internal.model.Constants.ARRAY_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.CLASS_ATTRIBUTE;
+import static 
org.apache.aries.cdi.container.internal.model.Constants.BEAN_ELEMENT;
 import static 
org.apache.aries.cdi.container.internal.model.Constants.CDI10_URI;
 import static org.apache.aries.cdi.container.internal.model.Constants.CDI_URIS;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.COMPONENT_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.CONFIGURATION_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.INTERFACE_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.LIST_ELEMENT;
+import static 
org.apache.aries.cdi.container.internal.model.Constants.CLASS_ATTRIBUTE;
 import static 
org.apache.aries.cdi.container.internal.model.Constants.NAME_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.PROPERTY_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.PROVIDE_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.REFERENCE_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.SERVICE_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.SET_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.TYPE_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.VALUE_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.VALUE_ELEMENT;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.VALUE_TYPE_ATTRIBUTE;
+import static 
org.apache.aries.cdi.container.internal.model.Constants.QUALIFIER_ELEMENT;
 
 import java.net.URL;
-import java.util.Formatter;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import 
org.apache.aries.cdi.container.internal.configuration.ConfigurationModel;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
+import org.apache.aries.cdi.container.internal.component.OSGiBean;
+import org.apache.aries.cdi.container.internal.exception.BeanElementException;
+import 
org.apache.aries.cdi.container.internal.exception.BlacklistQualifierException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.Attributes;
@@ -56,148 +44,51 @@ public class OSGiBeansHandler extends De
        }
 
        public BeansModel createBeansModel() {
-               return new BeansModel(_components, _beanDescriptorURLs);
-       }
-
-       @Override
-       public void characters(char[] c, int start, int length) {
-               if (_propertySB == null) {
-                       return;
-               }
-
-               _propertySB.append(c, start, length);
+               return new BeansModel(_beans, _qualifierBlackList, _errors, 
_beanDescriptorURLs);
        }
 
        @Override
        public void startElement(String uri, String localName, String qName, 
Attributes attributes) throws SAXException {
-               if (matches(ARRAY_ELEMENT, uri, localName) && (_propertyValue 
== null)) {
-                       _collectionType = CollectionType.ARRAY;
-               }
-               if (matches(COMPONENT_ELEMENT, uri, localName)) {
-                       try {
-                               Class<?> clazz = _classLoader.loadClass(
-                                       Model.getValue(CDI10_URI, 
CLASS_ATTRIBUTE, attributes));
+               if (matches(BEAN_ELEMENT, uri, localName)) {
+                       String className = Model.getValue(CDI10_URI, 
CLASS_ATTRIBUTE, attributes);
 
-                               _componentModel = new 
ComponentModel.Builder(clazz).attributes(attributes);
-                       }
-                       catch (ClassNotFoundException cnfe) {
-                               if (_log.isErrorEnabled()) {
-                                       _log.error("CDIe - {}", 
cnfe.getMessage(), cnfe);
-                               }
-                       }
-               }
-               if (matches(CONFIGURATION_ELEMENT, uri, localName)) {
                        try {
-                               Class<?> clazz = _classLoader.loadClass(
-                                       Model.getValue(CDI10_URI, 
TYPE_ATTRIBUTE, attributes));
+                               Class<?> clazz = 
_classLoader.loadClass(className);
 
-                               _componentModel.configuration(new 
ConfigurationModel.Builder(clazz).attributes(attributes).build());
+                               _beanModel = new OSGiBean.Builder(clazz);
                        }
-                       catch (ClassNotFoundException cnfe) {
-                               if (_log.isErrorEnabled()) {
-                                       _log.error("CDIe - {}", 
cnfe.getMessage(), cnfe);
-                               }
+                       catch (ReflectiveOperationException roe) {
+                               _errors.add(
+                                       new BeanElementException(
+                                               "Error loading bean class from 
element: " + className,
+                                               roe));
                        }
                }
-               if (matches(LIST_ELEMENT, uri, localName) && (_propertyValue == 
null)) {
-                       _collectionType = CollectionType.LIST;
-               }
-               if (matches(PROPERTY_ELEMENT, uri, localName)) {
-                       _propertyName = 
attributes.getValue(NAME_ATTRIBUTE).trim();
-                       _propertyType = 
attributes.getValue(VALUE_TYPE_ATTRIBUTE);
-                       if (_propertyType == null) {
-                               _propertyType = "String";
-                       }
-                       String value = attributes.getValue(uri, 
VALUE_ATTRIBUTE);
-                       if (value != null) {
-                               _propertyValue = value.trim();
-                       }
-                       else {
-                               _propertySB = new StringBuilder();
-                       }
-               }
-               if (matches(PROVIDE_ELEMENT, uri, localName)) {
-                       String value = 
attributes.getValue(INTERFACE_ATTRIBUTE).trim();
-                       _componentModel.provide(value);
-               }
-               if (matches(REFERENCE_ELEMENT, uri, localName)) {
-                       try {
-                               Class<?> clazz = _classLoader.loadClass(
-                                       Model.getValue(CDI10_URI, 
SERVICE_ATTRIBUTE, attributes));
+               if (matches(QUALIFIER_ELEMENT, uri, localName)) {
+                       String className = Model.getValue(CDI10_URI, 
NAME_ATTRIBUTE, attributes);
 
-                               _referenceModel = new 
ReferenceModel.Builder(attributes).service(clazz).build();
+                       try {
+                               _qualifier = _classLoader.loadClass(className);
                        }
-                       catch (ClassNotFoundException cnfe) {
-                               if (_log.isErrorEnabled()) {
-                                       _log.error("CDIe - {}", 
cnfe.getMessage(), cnfe);
-                               }
+                       catch (ReflectiveOperationException roe) {
+                               _errors.add(
+                                       new BlacklistQualifierException(
+                                               "Error loading blacklisted 
qualifier from element: " + className,
+                                               roe));
                        }
                }
-               if (matches(SET_ELEMENT, uri, localName) && (_propertyValue == 
null)) {
-                       _collectionType = CollectionType.SET;
-               }
-               if (matches(VALUE_ELEMENT, uri, localName) && (_collectionType 
!= null)) {
-                       _propertySB = new StringBuilder();
-               }
        }
 
        @Override
        public void endElement(String uri, String localName, String qName) 
throws SAXException {
-               if (matches(ARRAY_ELEMENT, uri, localName)) {
-                       _collectionType = null;
-               }
-               if (matches(COMPONENT_ELEMENT, uri, localName)) {
-                       ComponentModel componentModel = _componentModel.build();
-                       
_components.put(componentModel.getBeanClass().getName(), componentModel);
-                       _componentModel = null;
-               }
-               if (matches(LIST_ELEMENT, uri, localName)) {
-                       _collectionType = null;
-               }
-               if (matches(PROPERTY_ELEMENT, uri, localName)) {
-                       if ((_propertyValue == null) && (_propertySB != null)) {
-                               _propertyValue = _propertySB.toString().trim();
-                       }
-                       if (_propertyValue != null) {
-                               try (Formatter f = new Formatter()) {
-                                       f.format("%s:%s=%s", _propertyName, 
_propertyType, _propertyValue);
-                                       _componentModel.property(f.toString());
-                               }
-                       }
-                       _propertySB = null;
-                       _propertyName = null;
-                       _propertyType = null;
-                       _propertyValue = null;
-               }
-               if (matches(REFERENCE_ELEMENT, uri, localName)) {
-                       _componentModel.reference(_referenceModel);
-                       _referenceModel = null;
-               }
-               if (matches(SET_ELEMENT, uri, localName)) {
-                       _collectionType = null;
-               }
-               if (matches(VALUE_ELEMENT, uri, localName) && (_collectionType 
!= null)) {
-                       StringBuilder sb = new StringBuilder();
-                       sb.append(_propertyName);
-                       sb.append(":");
-                       if (_collectionType == CollectionType.LIST) {
-                               sb.append("List<");
-                               sb.append(_propertyType);
-                               sb.append(">");
-                       }
-                       else if (_collectionType == CollectionType.SET) {
-                               sb.append("Set<");
-                               sb.append(_propertyType);
-                               sb.append(">");
-                       }
-                       else {
-                               sb.append(_propertyType);
-                       }
-                       sb.append("=");
-                       sb.append(_propertySB.toString().trim());
-
-                       _componentModel.property(sb.toString());
-                       _propertySB = null;
+               if (matches(BEAN_ELEMENT, uri, localName)) {
+                       OSGiBean osgiBean = _beanModel.build();
+                       _beans.put(osgiBean.getBeanClass().getName(), osgiBean);
+                       _beanModel = null;
+               }
+               if (matches(QUALIFIER_ELEMENT, uri, localName) && (_qualifier 
!= null)) {
+                       _qualifierBlackList.add(_qualifier);
+                       _qualifier = null;
                }
        }
 
@@ -208,22 +99,15 @@ public class OSGiBeansHandler extends De
                return false;
        }
 
-       enum CollectionType {
-               ARRAY, LIST, SET
-       }
-
        private final static Logger _log = LoggerFactory.getLogger(
                OSGiBeansHandler.class);
 
        private final ClassLoader _classLoader;
-       private final Map<String, ComponentModel> _components = new HashMap<>();
+       private final Map<String, OSGiBean> _beans = new HashMap<>();
        private final List<URL> _beanDescriptorURLs;
-       private String _propertyName;
-       private StringBuilder _propertySB;
-       private String _propertyType;
-       private String _propertyValue;
-       private CollectionType _collectionType;
-       private ReferenceModel _referenceModel;
-       private ComponentModel.Builder _componentModel;
+       private OSGiBean.Builder _beanModel;
+       private List<Throwable> _errors = new ArrayList<>();
+       private Class<?> _qualifier;
+       private final List<Class<?>> _qualifierBlackList = new ArrayList<>();
 
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ObserverMethodAnnotated.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ObserverMethodAnnotated.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ObserverMethodAnnotated.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ObserverMethodAnnotated.java
 Sat Apr 14 01:09:09 2018
@@ -9,11 +9,11 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.ObserverMethod;
 
 import org.apache.aries.cdi.container.internal.util.Sets;
-import org.osgi.service.cdi.annotations.ServiceEvent;
+import org.osgi.service.cdi.reference.ReferenceEvent;
 
 public class ObserverMethodAnnotated implements Annotated {
 
-       public ObserverMethodAnnotated(ObserverMethod<ServiceEvent<?>> 
observerMethod) {
+       public ObserverMethodAnnotated(ObserverMethod<ReferenceEvent<?>> 
observerMethod) {
                _observerMethod = observerMethod;
                _qualifiers = _observerMethod.getObservedQualifiers();
        }
@@ -67,7 +67,7 @@ public class ObserverMethodAnnotated imp
                return null;
        }
 
-       private final ObserverMethod<ServiceEvent<?>> _observerMethod;
+       private final ObserverMethod<ReferenceEvent<?>> _observerMethod;
        private final Set<Annotation> _qualifiers;
 
 }
\ No newline at end of file

Added: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceEventImpl.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceEventImpl.java?rev=1829114&view=auto
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceEventImpl.java
 (added)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceEventImpl.java
 Sat Apr 14 01:09:09 2018
@@ -0,0 +1,151 @@
+/**
+ * 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.aries.cdi.container.internal.model;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.function.Consumer;
+
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cdi.reference.ReferenceEvent;
+import org.osgi.service.cdi.reference.ReferenceServiceObjects;
+
+public class ReferenceEventImpl<T> implements ReferenceEvent<T> {
+
+       public static enum Event { ADDING, MODIFIED, REMOVED }
+
+       private final T _t;
+       private final ReferenceEventImpl.Event _event;
+
+       public ReferenceEventImpl(T t, ReferenceEventImpl.Event event) {
+               _t = t;
+               _event = event;
+       }
+
+       @Override
+       public void onAdding(Consumer<T> action) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onAddingServiceReference(Consumer<ServiceReference<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onAddingServiceObjects(Consumer<ReferenceServiceObjects<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onAddingProperties(Consumer<Map<String, ?>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onAddingTuple(Consumer<Entry<Map<String, ?>, T>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onUpdate(Consumer<T> action) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onUpdateServiceReference(Consumer<ServiceReference<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onUpdateServiceObjects(Consumer<ReferenceServiceObjects<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onUpdateProperties(Consumer<Map<String, ?>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onUpdateTuple(Consumer<Entry<Map<String, ?>, T>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onRemove(Consumer<T> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onRemoveServiceReference(Consumer<ServiceReference<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onRemoveServiceObjects(Consumer<ReferenceServiceObjects<T>> 
consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onRemoveProperties(Consumer<Map<String, ?>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void onRemoveTuple(Consumer<Entry<Map<String, ?>, T>> consumer) {
+               // TODO Auto-generated method stub
+
+       }
+
+//     @Override
+//     public ServiceEvent<T> adding(Consumer<T> consumer) {
+//             if (_event == Event.ADDING) {
+//                     consumer.accept(_t);
+//             };
+//             return this;
+//     }
+//
+//     @Override
+//     public ServiceEvent<T> modified(Consumer<T> consumer) {
+//             if (_event == Event.MODIFIED) {
+//                     consumer.accept(_t);
+//             }
+//             return this;
+//     }
+//
+//     @Override
+//     public ServiceEvent<T> removed(Consumer<T> consumer) {
+//             if (_event == Event.REMOVED) {
+//                     consumer.accept(_t);
+//             }
+//             return this;
+//     }
+
+}
\ No newline at end of file

Copied: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Init.java
 (from r1828903, 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Init.java)
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Init.java?p2=aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Init.java&p1=aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Init.java&r1=1828903&r2=1829114&rev=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Init.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Init.java
 Sat Apr 14 01:09:09 2018
@@ -26,9 +26,9 @@ import org.osgi.framework.wiring.BundleW
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class Phase_Init implements Phase {
+public class Init implements Phase {
 
-       public Phase_Init(Bundle bundle, ContainerState containerState) {
+       public Init(Bundle bundle, ContainerState containerState) {
                _containerState = containerState;
 
                BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
@@ -80,7 +80,7 @@ public class Phase_Init implements Phase
                }
        }
 
-       private static final Logger _log = 
LoggerFactory.getLogger(Phase_Init.class);
+       private static final Logger _log = LoggerFactory.getLogger(Init.class);
 
        private final ContainerState _containerState;
        private volatile Phase _extensionPhase;

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Configuration.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Configuration.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Configuration.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Configuration.java
 Sat Apr 14 01:09:09 2018
@@ -14,26 +14,12 @@
 
 package org.apache.aries.cdi.container.internal.phase;
 
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.Consumer;
 
 import javax.enterprise.inject.spi.Extension;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import 
org.apache.aries.cdi.container.internal.configuration.ConfigurationCallback;
-import 
org.apache.aries.cdi.container.internal.configuration.ConfigurationManagedService;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
 import org.jboss.weld.bootstrap.spi.Metadata;
-import org.osgi.framework.Constants;
-import org.osgi.service.cdi.CdiEvent;
-import org.osgi.service.cdi.annotations.Configuration;
-import org.osgi.service.cdi.annotations.ConfigurationPolicy;
 
 public class Phase_Configuration implements Phase {
 
@@ -41,13 +27,25 @@ public class Phase_Configuration impleme
                ContainerState containerState,
                Collection<Metadata<Extension>> extensions) {
 
-               _containerState = containerState;
-               _extensions = extensions;
+//             _containerState = containerState;
+//             _extensions = extensions;
+//
+//             _componentModels = 
_containerState.beansModel().getComponentModels();
+       }
+
+       @Override
+       public void close() {
+               // TODO Auto-generated method stub
 
-               _componentModels = 
_containerState.beansModel().getComponentModels();
        }
 
        @Override
+       public void open() {
+               // TODO Auto-generated method stub
+
+       }
+
+/*     @Override
        public void close() {
                _lock.lock();
 
@@ -224,4 +222,4 @@ public class Phase_Configuration impleme
        private final Collection<Metadata<Extension>> _extensions;
        private final Lock _lock = new ReentrantLock();
        private volatile Phase _nextPhase;
-}
\ No newline at end of file
+*/}
\ No newline at end of file

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Extension.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Extension.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Extension.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Extension.java
 Sat Apr 14 01:09:09 2018
@@ -14,36 +14,12 @@
 
 package org.apache.aries.cdi.container.internal.phase;
 
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.enterprise.inject.spi.Extension;
-
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.extension.ExtensionDependency;
-import org.apache.aries.cdi.container.internal.extension.ExtensionMetadata;
-import org.jboss.weld.bootstrap.spi.Metadata;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.service.cdi.CdiConstants;
-import org.osgi.service.cdi.CdiEvent;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class Phase_Extension implements Phase {
 
        public Phase_Extension(ContainerState containerState) {
-               _containerState = containerState;
+/*             _containerState = containerState;
                _bundleContext = _containerState.bundle().getBundleContext();
 
                BundleWiring bundleWiring = 
_containerState.bundle().adapt(BundleWiring.class);
@@ -52,9 +28,21 @@ public class Phase_Extension implements
                _extensions = new 
ConcurrentSkipListMap<>(Comparator.reverseOrder());
 
                
_containerState.setExtensionDependencies(_extensionDependencies);
+*/     }
+
+       @Override
+       public void close() {
+               // TODO Auto-generated method stub
+
        }
 
        @Override
+       public void open() {
+               // TODO Auto-generated method stub
+
+       }
+
+/*     @Override
        public void close() {
                if (_extensionTracker != null) {
                        _extensionTracker.close();
@@ -197,5 +185,5 @@ public class Phase_Extension implements
                }
 
        }
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Publish.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Publish.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Publish.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Publish.java
 Sat Apr 14 01:09:09 2018
@@ -18,14 +18,8 @@ import java.util.Collection;
 
 import javax.enterprise.inject.spi.Extension;
 
-import org.apache.aries.cdi.container.internal.container.ContainerBootstrap;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.jboss.weld.bootstrap.WeldBootstrap;
 import org.jboss.weld.bootstrap.spi.Metadata;
-import org.osgi.service.cdi.CdiEvent;
-import org.osgi.service.cdi.annotations.ServiceScope;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class Phase_Publish implements Phase {
 
@@ -33,11 +27,23 @@ public class Phase_Publish implements Ph
                ContainerState containerState,
                Collection<Metadata<Extension>> extensions) {
 
-               _containerState = containerState;
+/*             _containerState = containerState;
                _extensions = extensions;
+*/     }
+
+       @Override
+       public void close() {
+               // TODO Auto-generated method stub
+
        }
 
        @Override
+       public void open() {
+               // TODO Auto-generated method stub
+
+       }
+
+/*     @Override
        public void close() {
                _containerState.serviceRegistrator().close();
                _containerState.beanManagerRegistrator().close();
@@ -99,5 +105,5 @@ public class Phase_Publish implements Ph
        private volatile ContainerBootstrap _cb;
        private final ContainerState _containerState;
        private final Collection<Metadata<Extension>> _extensions;
-
+*/
 }
\ No newline at end of file

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Reference.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Reference.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Reference.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/phase/Phase_Reference.java
 Sat Apr 14 01:09:09 2018
@@ -15,25 +15,11 @@
 package org.apache.aries.cdi.container.internal.phase;
 
 import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.Consumer;
 
 import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ObserverMethod;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.reference.ReferenceCallback;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
 import org.jboss.weld.bootstrap.spi.Metadata;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.service.cdi.CdiEvent;
-import org.osgi.service.cdi.annotations.ServiceEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class Phase_Reference implements Phase {
 
@@ -41,13 +27,25 @@ public class Phase_Reference implements
                ContainerState containerState,
                Collection<Metadata<Extension>> extensions) {
 
-               _containerState = containerState;
+/*             _containerState = containerState;
                _extensions = extensions;
 
                _componentModels = 
_containerState.beansModel().getComponentModels();
+*/     }
+
+       @Override
+       public void close() {
+               // TODO Auto-generated method stub
+
        }
 
        @Override
+       public void open() {
+               // TODO Auto-generated method stub
+
+       }
+
+/*     @Override
        public void close() {
                _lock.lock();
 
@@ -185,5 +183,5 @@ public class Phase_Reference implements
        private final Collection<Metadata<Extension>> _extensions;
        private final Lock _lock = new ReentrantLock(true);
        private volatile Phase _nextPhase;
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceBean.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceBean.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceBean.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceBean.java
 Sat Apr 14 01:09:09 2018
@@ -29,16 +29,15 @@ import javax.enterprise.inject.spi.Decor
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.inject.Named;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
+import org.apache.aries.cdi.container.internal.component.OSGiBean;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
 
 public class ReferenceBean implements Bean<Object> {
 
        public ReferenceBean(
                ContainerState containerState,
                ReferenceModel referenceModel,
-               ComponentModel componentModel,
+               OSGiBean componentModel,
                InjectionPoint injectionPoint,
                BeanManager beanManager) {
 
@@ -72,7 +71,7 @@ public class ReferenceBean implements Be
 
        @Override
        public Class<?> getBeanClass() {
-               return _referenceModel.getBeanClass();
+               return null; // TODO _referenceModel.getBeanClass();
        }
 
        @Override
@@ -102,7 +101,7 @@ public class ReferenceBean implements Be
 
        @Override
        public Set<Type> getTypes() {
-               return _referenceModel.getTypes();
+               return null; // TODO _referenceModel.getTypes();
        }
 
        @Override
@@ -112,7 +111,7 @@ public class ReferenceBean implements Be
 
        @Override
        public boolean isNullable() {
-               return _referenceModel.getCardinality() == 
ReferenceCardinality.OPTIONAL ? true : false;
+               return false;//_referenceModel.getCardinality() == 
ReferenceCardinality.OPTIONAL ? true : false;
        }
 
        @Override
@@ -129,13 +128,13 @@ public class ReferenceBean implements Be
        private Object _getInjectedInstance() {
                Map<String, ReferenceCallback> map = 
_containerState.referenceCallbacks().get(_componentModel);
 
-               ReferenceCallback referenceCallback = 
map.get(_referenceModel.getName());
+//             ReferenceCallback referenceCallback = 
map.get(_referenceModel.getName());
 
-               return referenceCallback.tracked().values().iterator().next();
+               return null; // TODO 
referenceCallback.tracked().values().iterator().next();
        }
 
        private final BeanManager _beanManager;
-       private final ComponentModel _componentModel;
+       private final OSGiBean _componentModel;
        private final ContainerState _containerState;
        private final InjectionPoint _injectionPoint;
        private final String _name;

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceCallback.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceCallback.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceCallback.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceCallback.java
 Sat Apr 14 01:09:09 2018
@@ -14,39 +14,30 @@
 
 package org.apache.aries.cdi.container.internal.reference;
 
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.Consumer;
-
-import javax.enterprise.inject.spi.ObserverMethod;
-
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.model.Context;
-import org.apache.aries.cdi.container.internal.model.ServiceEventImpl;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
-import org.osgi.service.cdi.annotations.ServiceEvent;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 public class ReferenceCallback implements ServiceTrackerCustomizer<Object, 
Object> {
 
-       public static class Builder {
+       @Override
+       public Object addingService(ServiceReference<Object> reference) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void modifiedService(ServiceReference<Object> reference, Object 
service) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void removedService(ServiceReference<Object> reference, Object 
service) {
+               // TODO Auto-generated method stub
+
+       }
+
+/*     public static class Builder {
 
                public Builder(Context context) {
                        this(null, null, context);
@@ -182,7 +173,7 @@ public class ReferenceCallback implement
                        else {
                                _tracked.put(reference, object);
 
-                               observer().ifPresent(o -> 
o.notify(event(object, ServiceEventImpl.Event.ADDING)));
+                               observer().ifPresent(o -> 
o.notify(event(object, ReferenceEventImpl.Event.ADDING)));
                        }
 
                        _onAdd.ifPresent(f -> f.accept(this));
@@ -204,7 +195,7 @@ public class ReferenceCallback implement
                                entry -> {
                                        _tracked.put(entry.getKey(), 
entry.getValue());
 
-                                       observer().ifPresent(o -> 
o.notify(event(entry.getValue(), ServiceEventImpl.Event.ADDING)));
+                                       observer().ifPresent(o -> 
o.notify(event(entry.getValue(), ReferenceEventImpl.Event.ADDING)));
 
                                        return true;
                                }
@@ -251,7 +242,7 @@ public class ReferenceCallback implement
                                else {
                                        _tracked.put(reference, object);
 
-                                       observer().ifPresent(o -> 
o.notify(event(object, ServiceEventImpl.Event.MODIFIED)));
+                                       observer().ifPresent(o -> 
o.notify(event(object, ReferenceEventImpl.Event.MODIFIED)));
                                }
                        }
 
@@ -275,7 +266,7 @@ public class ReferenceCallback implement
                        else {
                                final Object instance = 
_tracked.remove(reference);
 
-                               observer().ifPresent(o -> 
o.notify(event(instance, ServiceEventImpl.Event.REMOVED)));
+                               observer().ifPresent(o -> 
o.notify(event(instance, ReferenceEventImpl.Event.REMOVED)));
                        }
 
                        _onRemove.ifPresent(f -> f.accept(this));
@@ -285,8 +276,8 @@ public class ReferenceCallback implement
                }
        }
 
-       <T> ServiceEvent<T> event(T t, ServiceEventImpl.Event event) {
-               return new ServiceEventImpl<T>(t, event);
+       <T> ServiceEvent<T> event(T t, ReferenceEventImpl.Event event) {
+               return new ReferenceEventImpl<T>(t, event);
        }
 
        public boolean resolved() {
@@ -404,5 +395,5 @@ public class ReferenceCallback implement
                private List<String> _keys;
 
        }
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel.java
 Sat Apr 14 01:09:09 2018
@@ -14,273 +14,138 @@
 
 package org.apache.aries.cdi.container.internal.reference;
 
-import static org.apache.aries.cdi.container.internal.model.Model.*;
 import static org.apache.aries.cdi.container.internal.util.Reflection.cast;
-import static java.lang.String.format;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.CARDINALITY_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.CDI10_URI;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.NAME_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.POLICY_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.POLICY_OPTION_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.SCOPE_ATTRIBUTE;
-import static 
org.apache.aries.cdi.container.internal.model.Constants.TARGET_ATTRIBUTE;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
+import java.lang.reflect.Member;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.WildcardType;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Named;
+import javax.inject.Provider;
 
 import org.apache.aries.cdi.container.internal.model.CollectionType;
 import org.apache.aries.cdi.container.internal.util.Conversions;
 import org.apache.aries.cdi.container.internal.util.Maps;
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.apache.aries.cdi.container.internal.util.Types;
 import org.osgi.framework.Constants;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceObjects;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.cdi.annotations.Greedy;
 import org.osgi.service.cdi.annotations.Reference;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
-import org.osgi.service.cdi.annotations.ReferencePolicy;
-import org.osgi.service.cdi.annotations.ReferencePolicyOption;
-import org.osgi.service.cdi.annotations.ReferenceScope;
-import org.osgi.service.cdi.annotations.ServiceEvent;
+import org.osgi.service.cdi.reference.ReferenceServiceObjects;
+import org.osgi.service.cdi.runtime.dto.template.MaximumCardinality;
+import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
+import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO.Policy;
+import 
org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO.PolicyOption;
 import org.osgi.util.converter.TypeReference;
-import org.xml.sax.Attributes;
 
 public class ReferenceModel {
 
        public static class Builder {
 
-               public Builder(Attributes attributes) {
-                       _cardinality = _cardinality(attributes);
-                       _name = _name(attributes);
-                       _option = _option(attributes);
-                       _policy = _policy(attributes);
-                       _scope = _scope(attributes);
-                       _target = _target(attributes);
-               }
-
-               public Builder(Set<Annotation> qualifiers) {
-                       _qualifiers = qualifiers;
-                       Reference reference = getQualifier(_qualifiers, 
Reference.class);
-                       if (reference != null) {
-                               _cardinality = reference.cardinality();
-                               _name = reference.name();
-                               _option = reference.policyOption();
-                               _policy = reference.policy();
-                               _scope = reference.scope();
-                               _service = reference.service();
-                               _target = reference.target();
-                       }
-               }
-
                public ReferenceModel build() {
-                       if ((_annotated == null) && (_service == null)) {
-                               throw new IllegalArgumentException(
-                                       "Either injectionPoint or service must 
be set!");
-                       }
+                       return new ReferenceModel(_annotated, _member, 
_qualifiers, _type, _referenceClass);
+               }
 
-                       if (_annotated == null) {
-                               _annotated = new ReferenceAnnotated(_service);
-                       }
+               public Builder injectionPoint(InjectionPoint injectionPoint) {
+                       _annotated = injectionPoint.getAnnotated();
+                       _member = injectionPoint.getMember();
+                       _qualifiers = injectionPoint.getQualifiers();
+                       _type = injectionPoint.getType();
 
-                       Type type = upwrapCDITypes(_annotated.getBaseType());
+                       if (_annotated instanceof AnnotatedParameter) {
+                               AnnotatedParameter<?> parameter = 
(AnnotatedParameter<?>)_annotated;
 
-                       _policy = calculatePolicy(_policy);
-                       _option = calculatePolicyOption(_option);
-                       _scope = calculateScope(_scope);
-                       Multiplicity multiplicity = 
calculateMultiplicity(_annotated.getBaseType());// we need the pure type to 
check "Instance"
-                       _cardinality = calculateCardinality(_cardinality, 
multiplicity, type);
-                       CollectionType collectionType = 
calculateCollectionType(type);
-                       Class<?> beanClass = calculateBeanClass(type);
-                       _service = calculateServiceClass(_service, 
_cardinality, collectionType, type, _annotated);
-                       _name = calculateName(_name, _service, _annotated);
+                               _referenceClass = 
parameter.getDeclaringCallable().getDeclaringType().getJavaClass();
+                       }
+                       if (_annotated instanceof AnnotatedField) {
+                               AnnotatedField<?> field = 
(AnnotatedField<?>)_annotated;
 
-                       return new ReferenceModel(_service, _cardinality, 
_name, _policy, _option, _target, _scope, _qualifiers, beanClass, type, 
collectionType);
-               }
+                               _referenceClass = 
field.getDeclaringType().getJavaClass();
+                       }
 
-               public Builder cardinality(ReferenceCardinality cardinality) {
-                       _cardinality = cardinality;
                        return this;
                }
 
-               public Builder annotated(Annotated annotated) {
-                       _annotated = annotated;
-                       return this;
-               }
+               private Annotated _annotated;
+               private Member _member;
+               private Set<Annotation> _qualifiers;
+               private Class<?> _referenceClass;
+               private Type _type;
 
-               public Builder name(String name) {
-                       _name = name;
-                       return this;
-               }
+       }
 
-               public Builder option(ReferencePolicyOption option) {
-                       _option = option;
-                       return this;
-               }
+       public static enum Scope {
+               BUNDLE, PROTOTYPE, SINGLETON
+       }
 
-               public Builder policy(ReferencePolicy policy) {
-                       _policy = policy;
-                       return this;
-               }
+       private ReferenceModel(
+               Annotated annotated,
+               Member member,
+               Set<Annotation> qualifiers,
+               Type type,
+               Class<?> referenceClass) {
 
-               public Builder scope(ReferenceScope scope) {
-                       _scope = scope;
-                       return this;
-               }
+               _annotated = annotated;
+               _member = member;
+               _qualifiers = qualifiers;
+               _injectionPointType = type;
+               _referenceClass = referenceClass;
 
-               public Builder service(Class<?> service) {
-                       _service = service;
-                       return this;
-               }
+               calculateServiceType(_injectionPointType);
 
-               public Builder target(String target) {
-                       _target = target;
-                       return this;
-               }
+               Reference reference = _annotated.getAnnotation(Reference.class);
 
-               @SuppressWarnings("unchecked")
-               private static <T extends Annotation> T getQualifier(
-                       Set<Annotation> qualifiers, Class<T> clazz) {
-                       for (Annotation annotation : qualifiers) {
-                               if 
(clazz.isAssignableFrom(annotation.annotationType())) {
-                                       return (T)annotation;
-                               }
+               if ((reference != null) && (reference.value() != null) && 
(reference.value() != Object.class)) {
+                       if (!_serviceType.isAssignableFrom(reference.value())) {
+                               throw new IllegalArgumentException(
+                                       "The service type specified in 
@Reference (" + reference.value() +
+                                               ") is not compatible with the 
type calculated from the injection point: " +
+                                                       _serviceType);
                        }
-                       return null;
+                       _serviceType = reference.value();
                }
 
-               private ReferenceCardinality _cardinality;
-               private Annotated _annotated;
-               private String _name;
-               private ReferencePolicyOption _option;
-               private ReferencePolicy _policy;
-               private Set<Annotation> _qualifiers;
-               private ReferenceScope _scope;
-               private Class<?> _service;
-               private String _target;
+               Type rawType = _injectionPointType;
 
-       }
+               if (rawType instanceof ParameterizedType) {
+                       ParameterizedType pt = cast(_injectionPointType);
 
-       private ReferenceModel(
-               Class<?> service,
-               ReferenceCardinality cardinality,
-               String name,
-               ReferencePolicy policy,
-               ReferencePolicyOption option,
-               String target,
-               ReferenceScope scope,
-               Set<Annotation> qualifiers,
-               Class<?> beanClass,
-               Type injectionPointType,
-               CollectionType collectionType) {
-
-               _service = service;
-               _cardinality = cardinality;
-               _name = name;
-               _policy = policy;
-               _option = option;
-               _target = target;
-               _scope = scope;
-               _qualifiers = new LinkedHashSet<>();
-               if (qualifiers != null) {
-                       _qualifiers.addAll(qualifiers);
+                       rawType = pt.getRawType();
                }
-               _beanClass = beanClass;
-               _injectionPointType = injectionPointType;
-               _collectionType = collectionType;
 
-               _types = Sets.immutableHashSet(_injectionPointType, 
Object.class);
-       }
+               _beanClass = cast(rawType);
 
-       @Override
-       public int hashCode() {
-               final int prime = 31;
-               int result = 1;
-               result = prime * result + ((_beanClass == null) ? 0 : 
_beanClass.hashCode());
-               result = prime * result + ((_cardinality == null) ? 0 : 
_cardinality.hashCode());
-               result = prime * result + ((_name == null) ? 0 : 
_name.hashCode());
-               result = prime * result + ((_option == null) ? 0 : 
_option.hashCode());
-               result = prime * result + ((_policy == null) ? 0 : 
_policy.hashCode());
-               result = prime * result + ((_scope == null) ? 0 : 
_scope.hashCode());
-               result = prime * result + ((_service == null) ? 0 : 
_service.hashCode());
-               result = prime * result + ((_target == null) ? 0 : 
_target.hashCode());
-               return result;
-       }
+               _name = calculateName(_serviceType, _annotated);
 
-       @Override
-       public boolean equals(Object obj) {
-               if (this == obj)
-                       return true;
-               if (obj == null)
-                       return false;
-               if (getClass() != obj.getClass())
-                       return false;
-               ReferenceModel other = (ReferenceModel) obj;
-               if (_beanClass == null) {
-                       if (other._beanClass != null)
-                               return false;
-               } else if (!_beanClass.equals(other._beanClass))
-                       return false;
-               if (_cardinality != other._cardinality)
-                       return false;
-               if (_name == null) {
-                       if (other._name != null)
-                               return false;
-               } else if (!_name.equals(other._name))
-                       return false;
-               if (_option != other._option)
-                       return false;
-               if (_policy != other._policy)
-                       return false;
-               if (_scope != other._scope)
-                       return false;
-               if (_service == null) {
-                       if (other._service != null)
-                               return false;
-               } else if (!_service.equals(other._service))
-                       return false;
-               if (_target == null) {
-                       if (other._target != null)
-                               return false;
-               } else if (!_target.equals(other._target))
-                       return false;
-               return true;
-       }
-
-       public boolean found() {
-               return _found.get();
+               if (_annotated.isAnnotationPresent(Greedy.class)) {
+                       _greedy = true;
+               }
        }
 
-       public void found(boolean found) {
-               _found.set(found);
+       public Annotated getAnnotated() {
+               return _annotated;
        }
 
        public Class<?> getBeanClass() {
                return _beanClass;
        }
 
-       public ReferenceCardinality getCardinality() {
-               return _cardinality;
-       }
-
        public CollectionType getCollectionType() {
                return _collectionType;
        }
@@ -293,43 +158,43 @@ public class ReferenceModel {
                return _name;
        }
 
-       public ReferencePolicy getPolicy() {
-               return _policy;
-       }
-
-       public ReferencePolicyOption getPolicyOption() {
-               return _option;
+       public Member getMember() {
+               return _member;
        }
 
        public Set<Annotation> getQualifiers() {
                return _qualifiers;
        }
 
-       public ReferenceScope getScope() {
-               return _scope;
-       }
-
-       public Class<?> getServiceClass() {
-               return _service;
+       public Class<?> getServiceType() {
+               return _serviceType;
        }
 
        public String getTarget() {
-               return _target;
+               return _targetFilter;
        }
 
        public Set<Type> getTypes() {
-               return _types;
+               return null; // TODO _types;
+       }
+
+       public boolean dynamic() {
+               return _dynamic;
        }
 
-       public void setQualifiers(Set<Annotation> qualifiers) {
-               _qualifiers.clear();
-               _qualifiers.addAll(qualifiers);
+       public boolean optional() {
+               return _optional;
+       }
+
+       public boolean unary() {
+               return _multiplicity == MaximumCardinality.ONE;
        }
 
        @Override
        public String toString() {
                if (_string == null) {
-                       _string = String.format("reference[name='%s', 
service='%s', scope='%s', target='%s']", _name, _service, _scope, _target);
+                       //_string = String.format("reference[name='%s', 
service='%s', scope='%s', target='%s']", _name, _service, _scope, _target);
+                       _string = super.toString();
                }
                return _string;
        }
@@ -337,7 +202,7 @@ public class ReferenceModel {
        public static String buildFilter(
                        Class<?> serviceType,
                        String target,
-                       ReferenceScope scope,
+                       Scope scope,
                        Set<Annotation> qualifiers)
                throws InvalidSyntaxException {
 
@@ -349,27 +214,13 @@ public class ReferenceModel {
                sb.append(serviceType.getName());
                sb.append(")");
 
-               if (scope == ReferenceScope.PROTOTYPE) {
+               if (scope == Scope.PROTOTYPE) {
                        sb.append("(");
                        sb.append(Constants.SERVICE_SCOPE);
                        sb.append("=");
                        sb.append(Constants.SCOPE_PROTOTYPE);
                        sb.append(")");
                }
-               else if (scope == ReferenceScope.SINGLETON) {
-                       sb.append("(");
-                       sb.append(Constants.SERVICE_SCOPE);
-                       sb.append("=");
-                       sb.append(Constants.SCOPE_SINGLETON);
-                       sb.append(")");
-               }
-               else if (scope == ReferenceScope.BUNDLE) {
-                       sb.append("(");
-                       sb.append(Constants.SERVICE_SCOPE);
-                       sb.append("=");
-                       sb.append(Constants.SCOPE_BUNDLE);
-                       sb.append(")");
-               }
 
                String targetFilter = target == null ? "" : target;
 
@@ -400,344 +251,398 @@ public class ReferenceModel {
                return sb.toString();
        }
 
-       private static Class<?> calculateBeanClass(Type type) {
-               if (type instanceof ParameterizedType) {
-                       ParameterizedType pType = (ParameterizedType)type;
-
-                       type = pType.getRawType();
-               }
-               else if (type instanceof WildcardType) {
-                       throw new IllegalArgumentException(
-                               "Cannot use a wildcard as the bean: " + type);
-               }
+//     private static Class<?> calculateBeanClass(Type type) {
+//             if (type instanceof ParameterizedType) {
+//                     ParameterizedType pType = (ParameterizedType)type;
+//
+//                     type = pType.getRawType();
+//             }
+//             else if (type instanceof WildcardType) {
+//                     throw new IllegalArgumentException(
+//                             "Cannot use a wildcard as the bean: " + type);
+//             }
+//
+//             return cast(type);
+//     }
+
+//     private static CollectionType calculateCollectionType(Type type) {
+//             if (type instanceof ParameterizedType) {
+//                     ParameterizedType parameterizedType = cast(type);
+//
+//                     Type rawType = parameterizedType.getRawType();
+//
+//                     if ((List.class == cast(rawType)) ||
+//                             
Collection.class.isAssignableFrom(cast(rawType))) {
+//
+//                             Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
+//
+//                             return 
calculateCollectionType(actualTypeArguments[0]);
+//                     }
+//                     else if (Map.class == cast(rawType)) {
+//                             Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
+//
+//                             Type first = actualTypeArguments[0];
+//                             Type second = actualTypeArguments[1];
+//
+//                             if (!(first instanceof ParameterizedType) &&
+//                                     
String.class.isAssignableFrom(cast(first))) {
+//
+//                                     if ((!(second instanceof 
ParameterizedType) && (second == Object.class)) ||
+//                                             (second instanceof 
WildcardType)) {
+//
+//                                             return 
CollectionType.PROPERTIES;
+//                                     }
+//                             }
+//                     }
+//                     else if (Map.Entry.class == cast(rawType)) {
+//                             return CollectionType.TUPLE;
+//                     }
+//                     else if (ServiceObjects.class == cast(rawType)) {
+//                             return CollectionType.SERVICEOBJECTS;
+//                     }
+//                     else if (ServiceReference.class == cast(rawType)) {
+//                             return CollectionType.REFERENCE;
+//                     }
+//             }
+//             else if (Map.Entry.class == cast(type)) {
+//                     return CollectionType.TUPLE;
+//             }
+//             else if (ServiceObjects.class == cast(type)) {
+//                     return CollectionType.SERVICEOBJECTS;
+//             }
+//             else if (ServiceReference.class == cast(type)) {
+//                     return CollectionType.REFERENCE;
+//             }
+//
+//             return CollectionType.SERVICE;
+//     }
+
+//     private static ReferenceCardinality calculateCardinality(
+//             ReferenceCardinality cardinality, Multiplicity multiplicity, 
Type type) {
+//
+//             if ((multiplicity == Multiplicity.UNARY) &&
+//                     ((cardinality == ReferenceCardinality.AT_LEAST_ONE) || 
(cardinality == ReferenceCardinality.MULTIPLE))) {
+//
+//                     throw new IllegalArgumentException(
+//                             format(
+//                                     "Unary injection point type %s cannot 
be defined by multiple cardinality %s",
+//                                     type, cardinality));
+//             }
+//             else if ((multiplicity == Multiplicity.MULTIPLE) &&
+//                             ((cardinality == ReferenceCardinality.OPTIONAL) 
|| (cardinality == ReferenceCardinality.MANDATORY))) {
+//
+//                     throw new IllegalArgumentException(
+//                             format(
+//                                     "Multiple injection point type %s 
cannot be defined by unary cardinality %s",
+//                                     type, cardinality));
+//             }
+//
+//             if ((cardinality == null) || (cardinality == 
ReferenceCardinality.DEFAULT)) {
+//                     switch(multiplicity) {
+//                             case MULTIPLE:
+//                                     return ReferenceCardinality.MULTIPLE;
+//                             case UNARY:
+//                                     return ReferenceCardinality.MANDATORY;
+//                     }
+//             }
+//
+//             return cardinality;
+//     }
+
+//     private static Multiplicity calculateMultiplicity(Type type) {
+//             if (type instanceof ParameterizedType) {
+//                     ParameterizedType parameterizedType = cast(type);
+//
+//                     Type rawType = parameterizedType.getRawType();
+//
+//                     if ((Instance.class == cast(rawType)) ||
+//                             
Collection.class.isAssignableFrom(cast(rawType)) ||
+//                             ServiceEvent.class == cast(rawType)) {
+//
+//                             return Multiplicity.MULTIPLE;
+//                     }
+//             }
+//
+//             return Multiplicity.UNARY;
+//     }
 
-               return cast(type);
-       }
+       private String calculateName(Class<?> service, Annotated annotated) {
+               Named named = annotated.getAnnotation(Named.class);
 
-       private static CollectionType calculateCollectionType(Type type) {
-               if (type instanceof ParameterizedType) {
-                       ParameterizedType parameterizedType = cast(type);
+               if (named != null) {
+                       if (named.value() == null | named.value().equals("")) {
+                               throw new IllegalArgumentException(
+                                       "It's illegal to specify @Name without 
specifying a value with @Reference: " +
+                                               annotated);
+                       }
+                       return named.value();
+               }
 
-                       Type rawType = parameterizedType.getRawType();
+               String prefix = _referenceClass.getName() + ".";
 
-                       if ((List.class == cast(rawType)) ||
-                               
Collection.class.isAssignableFrom(cast(rawType))) {
+               if (annotated instanceof AnnotatedParameter) {
+                       AnnotatedParameter<?> parameter = 
(AnnotatedParameter<?>)annotated;
 
-                               Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
+                       AnnotatedCallable<?> declaringCallable = 
parameter.getDeclaringCallable();
 
-                               return 
calculateCollectionType(actualTypeArguments[0]);
+                       if (declaringCallable instanceof AnnotatedConstructor) {
+                               return prefix + "new" + parameter.getPosition();
                        }
-                       else if (Map.class == cast(rawType)) {
-                               Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
-
-                               Type first = actualTypeArguments[0];
-                               Type second = actualTypeArguments[1];
+                       else {
+                               AnnotatedMethod<?> method = 
(AnnotatedMethod<?>)declaringCallable;
 
-                               if (!(first instanceof ParameterizedType) &&
-                                       
String.class.isAssignableFrom(cast(first))) {
+                               return prefix + 
method.getJavaMember().getName() + parameter.getPosition();
+                       }
+               }
+               else {
+                       AnnotatedField<?> annotatedField = 
(AnnotatedField<?>)annotated;
 
-                                       if ((!(second instanceof 
ParameterizedType) && (second == Object.class)) ||
-                                               (second instanceof 
WildcardType)) {
+                       return prefix + 
annotatedField.getJavaMember().getName();
+               }
+       }
 
-                                               return 
CollectionType.PROPERTIES;
-                                       }
-                               }
+       private void calculateServiceType(Type type) {
+               if (!(type instanceof ParameterizedType)) {
+                       if (!(type instanceof Class)) {
+                               throw new IllegalArgumentException(
+                                       "The service type must not be generic: 
" + type);
                        }
-                       else if (Map.Entry.class == cast(rawType)) {
-                               return CollectionType.TUPLE;
+                       else if (Map.class == cast(type)) {
+                               throw new IllegalArgumentException(
+                                       "Map must specify a generic type 
arguments: " + type);
                        }
-                       else if (ServiceObjects.class == cast(rawType)) {
-                               return CollectionType.SERVICEOBJECTS;
+                       else if (Map.Entry.class == cast(type)) {
+                               throw new IllegalArgumentException(
+                                       "Map.Entry must specify a generic type 
arguments: " + type);
                        }
-                       else if (ServiceReference.class == cast(rawType)) {
-                               return CollectionType.REFERENCE;
+                       else if (ReferenceServiceObjects.class == cast(type)) {
+                               throw new IllegalArgumentException(
+                                       "ReferenceServiceObjects must specify a 
generic type argument: " + type);
+                       }
+                       else if (ServiceReference.class == cast(type)) {
+                               throw new IllegalArgumentException(
+                                       "ServiceReference must specify a 
generic type argument: " + type);
                        }
-               }
-               else if (Map.Entry.class == cast(type)) {
-                       return CollectionType.TUPLE;
-               }
-               else if (ServiceObjects.class == cast(type)) {
-                       return CollectionType.SERVICEOBJECTS;
-               }
-               else if (ServiceReference.class == cast(type)) {
-                       return CollectionType.REFERENCE;
-               }
 
-               return CollectionType.SERVICE;
-       }
+                       _serviceType = cast(type);
 
-       private static ReferenceCardinality calculateCardinality(
-               ReferenceCardinality cardinality, Multiplicity multiplicity, 
Type type) {
+                       return;
+               }
 
-               if ((multiplicity == Multiplicity.UNARY) &&
-                       ((cardinality == ReferenceCardinality.AT_LEAST_ONE) || 
(cardinality == ReferenceCardinality.MULTIPLE))) {
+               ParameterizedType parameterizedType = cast(type);
 
-                       throw new IllegalArgumentException(
-                               format(
-                                       "Unary injection point type %s cannot 
be defined by multiple cardinality %s",
-                                       type, cardinality));
-               }
-               else if ((multiplicity == Multiplicity.MULTIPLE) &&
-                               ((cardinality == ReferenceCardinality.OPTIONAL) 
|| (cardinality == ReferenceCardinality.MANDATORY))) {
+               Type rawType = parameterizedType.getRawType();
 
+               if (Instance.class == cast(rawType)) {
                        throw new IllegalArgumentException(
-                               format(
-                                       "Multiple injection point type %s 
cannot be defined by unary cardinality %s",
-                                       type, cardinality));
+                               "Instance<T> is not supported with @Reference: 
" + type);
                }
 
-               if ((cardinality == null) || (cardinality == 
ReferenceCardinality.DEFAULT)) {
-                       switch(multiplicity) {
-                               case MULTIPLE:
-                                       return ReferenceCardinality.MULTIPLE;
-                               case UNARY:
-                                       return ReferenceCardinality.MANDATORY;
-                       }
-               }
-
-               return cardinality;
-       }
-
-       private static Multiplicity calculateMultiplicity(Type type) {
-               if (type instanceof ParameterizedType) {
-                       ParameterizedType parameterizedType = cast(type);
+               if ((!_dynamic) && (Provider.class == cast(rawType))) {
+                       _dynamic = true;
 
-                       Type rawType = parameterizedType.getRawType();
+                       
calculateServiceType(parameterizedType.getActualTypeArguments()[0]);
 
-                       if ((Instance.class == cast(rawType)) ||
-                               
Collection.class.isAssignableFrom(cast(rawType)) ||
-                               ServiceEvent.class == cast(rawType)) {
-
-                               return Multiplicity.MULTIPLE;
-                       }
+                       return;
                }
 
-               return Multiplicity.UNARY;
-       }
+               if ((!_optional) && (Optional.class == cast(rawType))) {
+                       _optional = true;
 
-       public static String calculateName(String name, Class<?> service, 
Annotated annotated) {
-               if ((name != null) && (name.length() > 0)) {
-                       return name;
-               }
-
-               if (annotated != null) {
-                       if (annotated instanceof AnnotatedParameter) {
-                               AnnotatedParameter<?> annotatedParameter = 
(AnnotatedParameter<?>)annotated;
-
-                               return Types.getName(service) + 
annotatedParameter.getPosition();
-                       }
-                       if (annotated instanceof AnnotatedField) {
-                               AnnotatedField<?> annotatedField = 
(AnnotatedField<?>)annotated;
+                       
calculateServiceType(parameterizedType.getActualTypeArguments()[0]);
 
-                               return annotatedField.getJavaMember().getName();
-                       }
+                       return;
                }
 
-               return Types.getName(service);
-       }
+               if ((_multiplicity == MaximumCardinality.ONE) &&
+                       ((Collection.class == cast(rawType)) ||
+                       (Iterable.class == cast(rawType)) ||
+                       (List.class == cast(rawType)))) {
 
-       private static ReferencePolicy calculatePolicy(ReferencePolicy policy) {
-               if ((policy == null) || (policy == ReferencePolicy.DEFAULT)) {
-                       return ReferencePolicy.STATIC;
-               }
+                       _optional = true;
+                       _multiplicity = MaximumCardinality.MANY;
 
-               return policy;
-       }
+                       
calculateServiceType(parameterizedType.getActualTypeArguments()[0]);
 
-       private static ReferencePolicyOption 
calculatePolicyOption(ReferencePolicyOption option) {
-               if ((option == null) || (option == 
ReferencePolicyOption.DEFAULT)) {
-                       return ReferencePolicyOption.RELUCTANT;
+                       return;
                }
 
-               return option;
-       }
-
-       private static ReferenceScope calculateScope(ReferenceScope scope) {
-               if ((scope == null) || (scope == ReferenceScope.DEFAULT)) {
-                       return ReferenceScope.DEFAULT;
-               }
-
-               return scope;
-       }
-
-       private static Class<?> calculateServiceClass(Type injectionPointType) {
-               Type type = injectionPointType;
-
-               if (!(type instanceof ParameterizedType)) {
-                       return cast(type);
-               }
+               Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
 
-               ParameterizedType parameterizedType = cast(type);
+               Type argument = actualTypeArguments[0];
 
-               Type rawType = parameterizedType.getRawType();
+               if (Map.class == cast(rawType)) {
+                       if (String.class != cast(argument)) {
+                               throw new IllegalArgumentException(
+                                       "Maps of properties must use the form 
Map<String, (? | Object)>: " + type);
+                       }
 
-               if ((List.class == cast(rawType)) ||
-                       Collection.class.isAssignableFrom(cast(rawType))) {
+                       argument = actualTypeArguments[1];
 
-                       Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
+                       if ((Object.class != cast(argument)) &&
+                               (!(argument instanceof WildcardType))) {
 
-                       type = actualTypeArguments[0];
+                               throw new IllegalArgumentException(
+                                       "Maps of properties must use the form 
Map<String, (? | Object)>: " + type);
+                       }
 
-                       if (type instanceof ParameterizedType) {
-                               parameterizedType = (ParameterizedType)type;
+                       _collectionType = CollectionType.PROPERTIES;
 
-                               rawType = parameterizedType.getRawType();
-                       }
-                       else if ((type instanceof WildcardType) ||
-                                       
Map.Entry.class.isAssignableFrom(cast(type))) {
+                       Reference reference = 
_annotated.getAnnotation(Reference.class);
 
-                               return null;
-                       }
-                       else {
-                               rawType = type;
+                       if ((reference == null) || (reference.value() == null)) 
{
+                               throw new IllegalArgumentException(
+                                       "Maps of properties must specify 
service type with @Reference.value(): " + argument);
                        }
-               }
 
-               if (!Map.Entry.class.isAssignableFrom(cast(rawType)) &&
-                       !ServiceObjects.class.isAssignableFrom(cast(rawType)) &&
-                       
!ServiceReference.class.isAssignableFrom(cast(rawType))) {
+                       _serviceType = reference.value();
 
-                       return cast(rawType);
+                       return;
                }
 
-               Type[] actualTypeArguments = 
parameterizedType.getActualTypeArguments();
-
-               Type argument = actualTypeArguments[0];
-
-               if (Map.Entry.class.isAssignableFrom(cast(rawType))) {
+               if (Map.Entry.class == cast(rawType)) {
                        if (!checkKey(argument)) {
                                throw new IllegalArgumentException(
-                                       "Tuples must have a key of type 
Map<String, [? or Object]>: " + argument);
+                                       "Tuples must have a key of type 
Map<String, (? | Object)>: " + argument);
                        }
 
                        argument = actualTypeArguments[1];
-               }
-
-               if (argument instanceof ParameterizedType) {
-                       ParameterizedType parameterizedType1 = cast(argument);
 
-                       return cast(parameterizedType1.getRawType());
-               }
-               else if (argument instanceof WildcardType) {
-                       WildcardType wildcardType = (WildcardType)argument;
+                       if (!(argument instanceof Class)) {
+                               throw new IllegalArgumentException(
+                                       "The service type must not be generic: 
" + argument);
+                       }
 
-                       if ((wildcardType.getUpperBounds().length == 1)) {
-                               argument = wildcardType.getUpperBounds()[0];
+                       _collectionType = CollectionType.TUPLE;
 
-                               if (Object.class.equals(argument)) {
-                                       return null;
-                               }
-                               else if (argument instanceof Class) {
-                                       return cast(argument);
-                               }
-                       }
+                       _serviceType = cast(argument);
 
-                       throw new IllegalArgumentException(
-                               "@Reference cannot use nested parameterized 
types or multiple upper bounds: " + injectionPointType);
+                       return;
                }
 
-               return cast(argument);
-       }
-
-       private static Class<?> calculateServiceClass(
-               Class<?> service, ReferenceCardinality cardinality, 
CollectionType collectionType, Type injectionPointType, Annotated annotated) {
+               if (ReferenceServiceObjects.class == cast(rawType)) {
+                       _collectionType = CollectionType.SERVICEOBJECTS;
 
-               Class<?> calculatedServiceClass = 
calculateServiceClass(injectionPointType);
+                       calculateServiceType(argument);
 
-               if ((service == null) || (service == Object.class)) {
-                       if (calculatedServiceClass == null) {
-                               throw new IllegalArgumentException(
-                                       "Could not determine the service type 
from @Reference on annotated " +
-                                               annotated);
-                       }
+                       return;
+               }
 
-                       switch(collectionType) {
-                               case PROPERTIES:
-                                       if (calculatedServiceClass == 
Map.class) {
-                                               throw new 
IllegalArgumentException(
-                                                       "A @Reference cannot 
bind service properties to a Map<String, Object> without " +
-                                                               "specifying the 
@Reference.service property: " + annotated);
-                                       }
-                                       break;
-                               case REFERENCE:
-                                       if (calculatedServiceClass == 
ServiceReference.class) {
-                                               throw new 
IllegalArgumentException(
-                                                       "A @Reference cannot 
bind a ServiceReference without specifying either the " +
-                                                               
"@Reference.service property or a generic type argument (e.g. 
ServiceReference<Foo>: " +
-                                                                       
annotated);
-                                       }
-                                       break;
-                               case SERVICEOBJECTS:
-                                       if      (calculatedServiceClass == 
ServiceObjects.class) {
-                                               throw new 
IllegalArgumentException(
-                                                       "A @Reference cannot 
bind a ServiceObjects without specifying either the " +
-                                                               
"@Reference.service property or a generic type argument (e.g. 
ServiceObjects<Foo>: " +
-                                                                       
annotated);
-                                       }
-                                       break;
-                               case TUPLE:
-                                       if (calculatedServiceClass == 
Map.Entry.class) {
-                                               throw new 
IllegalArgumentException(
-                                                       "A @Reference cannot 
bind a Map.Entry without specifying either the " +
-                                                               
"@Reference.service property or a generic type argument (e.g. 
Map.Entry<Map<String, Object>, Foo>: " +
-                                                                       
annotated);
-                                       }
-                                       break;
-                               default:
-                       }
-
-                       return calculatedServiceClass;
-               }
-
-               switch(collectionType) {
-                       case PROPERTIES:
-                               if 
(Map.class.isAssignableFrom(calculatedServiceClass)) {
-                                       return service;
-                               }
-                               break;
-                       case REFERENCE:
-                               if ((calculatedServiceClass == null) ||
-                                       
ServiceReference.class.isAssignableFrom(calculatedServiceClass)) {
-                                       return service;
-                               }
-                               break;
-                       case SERVICEOBJECTS:
-                               if ((calculatedServiceClass == null) ||
-                                       
ServiceObjects.class.isAssignableFrom(calculatedServiceClass)) {
-                                       return service;
-                               }
-                               break;
-                       case TUPLE:
-                               if ((calculatedServiceClass != null) &&
-                                       
Map.Entry.class.isAssignableFrom(calculatedServiceClass)) {
-
-                                       if (!checkKey(calculatedServiceClass)) {
-                                               throw new 
IllegalArgumentException(
-                                                       "Tuples must have a key 
of type Map<String, [? or Object]>: " + calculatedServiceClass);
-                                       }
+               if (ServiceReference.class == cast(rawType)) {
+                       _collectionType = CollectionType.REFERENCE;
 
-                                       return service;
-                               }
-                               else if ((calculatedServiceClass == null) ||
-                                       
calculatedServiceClass.isAssignableFrom(service)) {
+                       calculateServiceType(argument);
 
-                                       return service;
-                               }
-                               break;
-                       case SERVICE:
-                               if (((calculatedServiceClass == null) &&
-                                               ((cardinality == 
ReferenceCardinality.MULTIPLE) ||
-                                               (cardinality == 
ReferenceCardinality.AT_LEAST_ONE))) ||
-                                       ((calculatedServiceClass != null) &&
-                                               
calculatedServiceClass.isAssignableFrom(service))) {
-                                       return service;
-                               }
+                       return;
                }
 
-               throw new IllegalArgumentException(
-                       "@Reference.service " + service + " is not compatible 
with annotated " + annotated);
+               _serviceType = cast(rawType);
+
+               if (_serviceType.getTypeParameters().length > 0) {
+                       throw new IllegalArgumentException(
+                               "Illegal service type: " + argument);
+               }
        }
 
+//     private static Class<?> calculateServiceClass(
+//             Class<?> service, ReferenceCardinality cardinality, 
CollectionType collectionType, Type injectionPointType, Annotated annotated) {
+//
+//             Class<?> calculatedServiceClass = 
calculateServiceClass(injectionPointType);
+//
+//             if ((service == null) || (service == Object.class)) {
+//                     if (calculatedServiceClass == null) {
+//                             throw new IllegalArgumentException(
+//                                     "Could not determine the service type 
from @Reference on annotated " +
+//                                             annotated);
+//                     }
+//
+//                     switch(collectionType) {
+//                             case PROPERTIES:
+//                                     if (calculatedServiceClass == 
Map.class) {
+//                                             throw new 
IllegalArgumentException(
+//                                                     "A @Reference cannot 
bind service properties to a Map<String, Object> without " +
+//                                                             "specifying the 
@Reference.service property: " + annotated);
+//                                     }
+//                                     break;
+//                             case REFERENCE:
+//                                     if (calculatedServiceClass == 
ServiceReference.class) {
+//                                             throw new 
IllegalArgumentException(
+//                                                     "A @Reference cannot 
bind a ServiceReference without specifying either the " +
+//                                                             
"@Reference.service property or a generic type argument (e.g. 
ServiceReference<Foo>: " +
+//                                                                     
annotated);
+//                                     }
+//                                     break;
+//                             case SERVICEOBJECTS:
+//                                     if      (calculatedServiceClass == 
ServiceObjects.class) {
+//                                             throw new 
IllegalArgumentException(
+//                                                     "A @Reference cannot 
bind a ServiceObjects without specifying either the " +
+//                                                             
"@Reference.service property or a generic type argument (e.g. 
ServiceObjects<Foo>: " +
+//                                                                     
annotated);
+//                                     }
+//                                     break;
+//                             case TUPLE:
+//                                     if (calculatedServiceClass == 
Map.Entry.class) {
+//                                             throw new 
IllegalArgumentException(
+//                                                     "A @Reference cannot 
bind a Map.Entry without specifying either the " +
+//                                                             
"@Reference.service property or a generic type argument (e.g. 
Map.Entry<Map<String, Object>, Foo>: " +
+//                                                                     
annotated);
+//                                     }
+//                                     break;
+//                             default:
+//                     }
+//
+//                     return calculatedServiceClass;
+//             }
+//
+//             switch(collectionType) {
+//                     case PROPERTIES:
+//                             if 
(Map.class.isAssignableFrom(calculatedServiceClass)) {
+//                                     return service;
+//                             }
+//                             break;
+//                     case REFERENCE:
+//                             if ((calculatedServiceClass == null) ||
+//                                     
ServiceReference.class.isAssignableFrom(calculatedServiceClass)) {
+//                                     return service;
+//                             }
+//                             break;
+//                     case SERVICEOBJECTS:
+//                             if ((calculatedServiceClass == null) ||
+//                                     
ServiceObjects.class.isAssignableFrom(calculatedServiceClass)) {
+//                                     return service;
+//                             }
+//                             break;
+//                     case TUPLE:
+//                             if ((calculatedServiceClass != null) &&
+//                                     
Map.Entry.class.isAssignableFrom(calculatedServiceClass)) {
+//
+//                                     if (!checkKey(calculatedServiceClass)) {
+//                                             throw new 
IllegalArgumentException(
+//                                                     "Tuples must have a key 
of type Map<String, [? or Object]>: " + calculatedServiceClass);
+//                                     }
+//
+//                                     return service;
+//                             }
+//                             else if ((calculatedServiceClass == null) ||
+//                                     
calculatedServiceClass.isAssignableFrom(service)) {
+//
+//                                     return service;
+//                             }
+//                             break;
+//                     case SERVICE:
+//                             if (((calculatedServiceClass == null) &&
+//                                             ((cardinality == 
ReferenceCardinality.MULTIPLE) ||
+//                                             (cardinality == 
ReferenceCardinality.AT_LEAST_ONE))) ||
+//                                     ((calculatedServiceClass != null) &&
+//                                             
calculatedServiceClass.isAssignableFrom(service))) {
+//                                     return service;
+//                             }
+//             }
+//
+//             throw new IllegalArgumentException(
+//                     "@Reference.service " + service + " is not compatible 
with annotated " + annotated);
+//     }
+
        // check the key type to make sure it complies with Map<String, ?> OR 
Map<String, Object>
        private static boolean checkKey(Type mapEntryType) {
                if (!(mapEntryType instanceof ParameterizedType)) {
@@ -766,105 +671,51 @@ public class ReferenceModel {
                return true;
        }
 
-       private static ReferenceCardinality _cardinality(Attributes attributes) 
{
-               return ReferenceCardinality.get(
-                       getValue(CDI10_URI, CARDINALITY_ATTRIBUTE, attributes, 
ReferenceCardinality.DEFAULT.toString()));
-       }
-
-       private static String _name(Attributes attributes) {
-               return getValue(CDI10_URI, NAME_ATTRIBUTE, attributes);
+//     private static Type upwrapCDITypes(Type type) {
+//             if (type instanceof ParameterizedType) {
+//                     ParameterizedType pType = (ParameterizedType)type;
+//
+//                     Type rawType = pType.getRawType();
+//
+//                     if (Instance.class == Reflection.cast(rawType) ||
+//                             ServiceEvent.class == Reflection.cast(rawType)) 
{
+//
+//                             type = pType.getActualTypeArguments()[0];
+//                     }
+//             }
+//
+//             return type;
+//     }
+
+       public ReferenceTemplateDTO toDTO() {
+               ReferenceTemplateDTO dto = new ReferenceTemplateDTO();
+               dto.maximumCardinality = _multiplicity;
+               dto.minimumCardinality = (_multiplicity == 
MaximumCardinality.ONE) ? (_optional?0:1) : (0);
+               dto.name = _name;
+               dto.policy = (_dynamic) ? Policy.DYNAMIC : Policy.STATIC;
+               dto.policyOption = (_greedy) ? PolicyOption.GREEDY: 
PolicyOption.RELUCTANT;
+               dto.targetFilter = _targetFilter;
+               dto.serviceType = _serviceType.getName();
+               return dto;
        }
 
-       private static ReferencePolicyOption _option(Attributes attributes) {
-               return ReferencePolicyOption.get(
-                       getValue(CDI10_URI, POLICY_OPTION_ATTRIBUTE, 
attributes, ReferencePolicyOption.DEFAULT.toString()));
-       }
-
-       private static ReferencePolicy _policy(Attributes attributes) {
-               return ReferencePolicy.get(
-                       getValue(CDI10_URI, POLICY_ATTRIBUTE, attributes, 
ReferencePolicy.DEFAULT.toString()));
-       }
-
-       private static ReferenceScope _scope(Attributes attributes) {
-               return ReferenceScope.get(getValue(
-                       CDI10_URI, SCOPE_ATTRIBUTE, attributes, 
ReferenceScope.DEFAULT.toString()));
-       }
-
-       private static String _target(Attributes attributes) {
-               return getValue(CDI10_URI, TARGET_ATTRIBUTE, attributes);
-       }
-
-       private static Type upwrapCDITypes(Type type) {
-               if (type instanceof ParameterizedType) {
-                       ParameterizedType pType = (ParameterizedType)type;
-
-                       Type rawType = pType.getRawType();
-
-                       if (Instance.class == cast(rawType) ||
-                               ServiceEvent.class == cast(rawType)) {
-
-                               type = pType.getActualTypeArguments()[0];
-                       }
-               }
-
-               return type;
-       }
+       private static final String _emptyFilter = "";
 
        private static final TypeReference<Map<String, String>> _mapType = new 
TypeReference<Map<String, String>>(){};
 
-       private final Class<?> _beanClass;
-       private final ReferenceCardinality _cardinality;
-       private final CollectionType _collectionType;
-       private final AtomicBoolean _found = new AtomicBoolean();
+       private final Annotated _annotated;
+       private Class<?> _beanClass;
+       private CollectionType _collectionType = CollectionType.SERVICE;
+       private boolean _dynamic = false;
+       private boolean _greedy = false;
        private final Type _injectionPointType;
-       private final String _name;
-       private final ReferencePolicyOption _option;
-       private final ReferencePolicy _policy;
+       private final Member _member;
+       private MaximumCardinality _multiplicity = MaximumCardinality.ONE;
+       private String _name;
+       private boolean _optional = false;
        private final Set<Annotation> _qualifiers;
-       private final ReferenceScope _scope;
-       private final Class<?> _service;
+       private Class<?> _referenceClass;
+       private Class<?> _serviceType;
        private String _string;
-       private final String _target;
-       private final Set<Type> _types;
-
-       private static class ReferenceAnnotated implements Annotated {
-
-               public ReferenceAnnotated(Class<?> service) {
-                       _service = service;
-               }
-
-               @Override
-               public <T extends Annotation> T getAnnotation(Class<T> 
annotationType) {
-                       return null;
-               }
-
-               @Override
-               public Set<Annotation> getAnnotations() {
-                       return Collections.emptySet();
-               }
-
-               @Override
-               public <T extends Annotation> Set<T> getAnnotations(Class<T> 
annotationType) {
-                       return null;
-               }
-
-               @Override
-               public Type getBaseType() {
-                       return _service;
-               }
-
-               @Override
-               public Set<Type> getTypeClosure() {
-                       return Sets.hashSet(_service);
-               }
-
-               @Override
-               public boolean isAnnotationPresent(Class<? extends Annotation> 
annotationType) {
-                       return false;
-               }
-
-               private final Class<?> _service;
-
-       }
-
+       private String _targetFilter = _emptyFilter;
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/service/ServiceDeclaration.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/service/ServiceDeclaration.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/service/ServiceDeclaration.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/service/ServiceDeclaration.java
 Sat Apr 14 01:09:09 2018
@@ -16,17 +16,11 @@ package org.apache.aries.cdi.container.i
 
 import static org.apache.aries.cdi.container.internal.util.Reflection.cast;
 
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.stream.Collectors;
-
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import org.apache.aries.cdi.container.internal.component.ComponentProperties;
+import org.apache.aries.cdi.container.internal.component.OSGiBean;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.util.Types;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.PrototypeServiceFactory;
 import org.osgi.framework.ServiceFactory;
@@ -36,7 +30,7 @@ public class ServiceDeclaration {
 
        public ServiceDeclaration(
                ContainerState containerState,
-               ComponentModel componentModel,
+               OSGiBean componentModel,
                Bean<?> bean,
                CreationalContext<?> creationalContext) {
 
@@ -48,7 +42,7 @@ public class ServiceDeclaration {
 
                Object instance = null;
 
-               if (_componentModel.getServiceScope() == 
ServiceScope.SINGLETON) {
+/*             if (_componentModel.getServiceScope() == 
ServiceScope.SINGLETON) {
                        instance = new SingletonScopeWrapper();
                }
                else if (_componentModel.getServiceScope() == 
ServiceScope.BUNDLE) {
@@ -57,11 +51,11 @@ public class ServiceDeclaration {
                else if (_componentModel.getServiceScope() == 
ServiceScope.PROTOTYPE) {
                        instance = new PrototypeScopeWrapper();
                }
-
+*/
                _instance = instance;
        }
 
-       public String[] getClassNames() {
+/*     public String[] getClassNames() {
                return Arrays.stream(
                        Types.types(_componentModel, 
_componentModel.getBeanClass(), _containerState.classLoader())
                ).map(
@@ -80,12 +74,12 @@ public class ServiceDeclaration {
        public ServiceScope getScope() {
                return _componentModel.getServiceScope();
        }
-
+*/
        public Object getServiceInstance() {
                return _instance;
        }
 
-       public Dictionary<String, ?> getServiceProperties() {
+/*     public Dictionary<String, ?> getServiceProperties() {
                return new ComponentProperties().bean(
                        _bean
                ).componentModel(
@@ -94,9 +88,9 @@ public class ServiceDeclaration {
                        _containerState
                ).build();
        }
-
+*/
        private final Bean<?> _bean;
-       private final ComponentModel _componentModel;
+       private final OSGiBean _componentModel;
        private final ContainerState _containerState;
        private final CreationalContext<?> _creationalContext;
        private final Object _instance;

Modified: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Types.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Types.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Types.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Types.java
 Sat Apr 14 01:09:09 2018
@@ -17,12 +17,9 @@ package org.apache.aries.cdi.container.i
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.enterprise.inject.spi.InjectionPoint;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -88,7 +85,7 @@ public class Types {
                return type.getTypeName();
        }
 
-       public static Class<?>[] types(
+/*     public static Class<?>[] types(
                ComponentModel componentModel, Class<?> beanClass, ClassLoader 
classLoader) {
 
                List<Class<?>> classes = new ArrayList<>();
@@ -125,7 +122,7 @@ public class Types {
 
                return classes.toArray(new Class[0]);
        }
-
+*/
        public static final Logger _log = LoggerFactory.getLogger(Types.class);
 
 }
\ No newline at end of file

Added: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/Component.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/Component.java?rev=1829114&view=auto
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/Component.java
 (added)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/Component.java
 Sat Apr 14 01:09:09 2018
@@ -0,0 +1,19 @@
+package org.apache.aries.cdi.container.internal.v2.component;
+
+import org.osgi.service.cdi.runtime.dto.ComponentDTO;
+import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
+import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
+import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
+
+public interface Component {
+
+       void addConfiguration(ConfigurationTemplateDTO dto);
+
+       void addReference(ReferenceTemplateDTO dto);
+
+       ComponentDTO getSnapshot();
+
+       ComponentTemplateDTO getTemplate();
+
+
+}

Added: 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/ContainerComponent.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/ContainerComponent.java?rev=1829114&view=auto
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/ContainerComponent.java
 (added)
+++ 
aries/trunk/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/v2/component/ContainerComponent.java
 Sat Apr 14 01:09:09 2018
@@ -0,0 +1,56 @@
+package org.apache.aries.cdi.container.internal.v2.component;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.osgi.service.cdi.runtime.dto.ComponentDTO;
+import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
+import org.osgi.service.cdi.runtime.dto.template.ConfigurationPolicy;
+import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
+import org.osgi.service.cdi.runtime.dto.template.MaximumCardinality;
+import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
+
+public class ContainerComponent implements Component {
+
+       public ContainerComponent(String containerId) {
+               _snapshot = new ComponentDTO();
+               _snapshot.template = new ComponentTemplateDTO();
+               _snapshot.template.activations = new CopyOnWriteArrayList<>();
+               _snapshot.template.configurations = new 
CopyOnWriteArrayList<>();
+
+               ConfigurationTemplateDTO factoryConfig = new 
ConfigurationTemplateDTO();
+               factoryConfig.componentConfiguration = true;
+               factoryConfig.maximumCardinality = MaximumCardinality.ONE;
+               factoryConfig.pid = containerId;
+               factoryConfig.policy = ConfigurationPolicy.OPTIONAL;
+
+               _snapshot.template.configurations.add(factoryConfig);
+               _snapshot.template.name = containerId;
+               _snapshot.template.references = new CopyOnWriteArrayList<>();
+               _snapshot.template.type = ComponentTemplateDTO.Type.CONTAINER;
+       }
+
+       @Override
+       public void addConfiguration(ConfigurationTemplateDTO dto) {
+               if (dto == null) return;
+               _snapshot.template.configurations.add(dto);
+       }
+
+       @Override
+       public void addReference(ReferenceTemplateDTO dto) {
+               if (dto == null) return;
+               _snapshot.template.references.add(dto);
+       }
+
+       @Override
+       public ComponentDTO getSnapshot() {
+               return _snapshot; // TODO make safe copy using converter
+       }
+
+       @Override
+       public ComponentTemplateDTO getTemplate() {
+               return _snapshot.template; // TODO make safe copy using 
converter
+       }
+
+       private final ComponentDTO _snapshot;
+
+}


Reply via email to