Return-Path: X-Original-To: apmail-aries-commits-archive@www.apache.org Delivered-To: apmail-aries-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 169AA176BC for ; Tue, 24 Feb 2015 16:33:17 +0000 (UTC) Received: (qmail 14788 invoked by uid 500); 24 Feb 2015 16:33:16 -0000 Delivered-To: apmail-aries-commits-archive@aries.apache.org Received: (qmail 14718 invoked by uid 500); 24 Feb 2015 16:33:16 -0000 Mailing-List: contact commits-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list commits@aries.apache.org Received: (qmail 14707 invoked by uid 99); 24 Feb 2015 16:33:16 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Feb 2015 16:33:16 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 68339AC0051 for ; Tue, 24 Feb 2015 16:33:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1662009 - /aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Date: Tue, 24 Feb 2015 16:33:16 -0000 To: commits@aries.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150224163316.68339AC0051@hades.apache.org> Author: sergeyb Date: Tue Feb 24 16:33:16 2015 New Revision: 1662009 URL: http://svn.apache.org/r1662009 Log: [ARIES-1300] Minor updates to noosgi BlueprintContainerImpl and BlueprintContextListener to make it easier to provide custom namespace handler sets Modified: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Modified: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1662009&r1=1662008&r2=1662009&view=diff ============================================================================== --- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java (original) +++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Tue Feb 24 16:33:16 2015 @@ -18,6 +18,19 @@ */ package org.apache.aries.blueprint.container; +import java.net.URI; +import java.net.URL; +import java.security.AccessControlContext; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; + import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor; import org.apache.aries.blueprint.ExtendedBeanMetadata; import org.apache.aries.blueprint.Processor; @@ -32,16 +45,24 @@ import org.apache.aries.blueprint.servic import org.osgi.service.blueprint.container.ComponentDefinitionException; import org.osgi.service.blueprint.container.Converter; import org.osgi.service.blueprint.container.NoSuchComponentException; -import org.osgi.service.blueprint.reflect.*; +import org.osgi.service.blueprint.reflect.BeanArgument; +import org.osgi.service.blueprint.reflect.BeanMetadata; +import org.osgi.service.blueprint.reflect.BeanProperty; +import org.osgi.service.blueprint.reflect.CollectionMetadata; +import org.osgi.service.blueprint.reflect.ComponentMetadata; +import org.osgi.service.blueprint.reflect.MapEntry; +import org.osgi.service.blueprint.reflect.MapMetadata; +import org.osgi.service.blueprint.reflect.Metadata; +import org.osgi.service.blueprint.reflect.PropsMetadata; +import org.osgi.service.blueprint.reflect.RefMetadata; +import org.osgi.service.blueprint.reflect.ReferenceListener; +import org.osgi.service.blueprint.reflect.RegistrationListener; +import org.osgi.service.blueprint.reflect.ServiceMetadata; +import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata; +import org.osgi.service.blueprint.reflect.Target; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.URI; -import java.net.URL; -import java.security.AccessControlContext; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; - public class BlueprintContainerImpl implements ExtendedBlueprintContainer { private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintContainerImpl.class); @@ -55,7 +76,8 @@ public class BlueprintContainerImpl impl private BlueprintRepository repository; private List processors = new ArrayList(); private Map properties; - + private NamespaceHandlerSet nsHandlerSet; + public BlueprintContainerImpl(ClassLoader loader, List resources) throws Exception { this(loader, resources, null, true); } @@ -65,16 +87,20 @@ public class BlueprintContainerImpl impl } public BlueprintContainerImpl(ClassLoader loader, List resources, Map properties, boolean init) throws Exception { + this(loader, resources, properties, null, init); + } + public BlueprintContainerImpl(ClassLoader loader, List resources, Map properties, + NamespaceHandlerSet nsHandlerSet, boolean init) throws Exception { this.loader = loader; this.converter = new AggregateConverter(this); this.componentDefinitionRegistry = new ComponentDefinitionRegistryImpl(); this.resources = resources; this.properties = properties; + this.nsHandlerSet = nsHandlerSet; if (init) { init(); } } - public String getProperty(String key) { if (properties != null && properties.containsKey(key)) { return properties.get(key); @@ -83,7 +109,7 @@ public class BlueprintContainerImpl impl } protected NamespaceHandlerSet createNamespaceHandlerSet(Set namespaces) { - NamespaceHandlerSet handlerSet = new SimpleNamespaceHandlerSet(); + NamespaceHandlerSet handlerSet = createNamespaceHandlerSet(); // Check namespaces Set unsupported = new LinkedHashSet(); for (URI ns : namespaces) { @@ -97,6 +123,10 @@ public class BlueprintContainerImpl impl return handlerSet; } + protected NamespaceHandlerSet createNamespaceHandlerSet() { + return nsHandlerSet == null ? new SimpleNamespaceHandlerSet() : nsHandlerSet; + } + public void init() throws Exception { init(true); }