You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:23:00 UTC

[sling-org-apache-sling-commons-osgi] annotated tag org.apache.sling.commons.osgi-2.0.2-incubator created (now 05fe53f)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git.


      at 05fe53f  (tag)
 tagging 4dcf4e624fe7ba0d80def67a48b4865c82572782 (commit)
      by Felix Meschberger
      on Thu Jun 18 09:21:02 2009 +0000

- Log -----------------------------------------------------------------
org.apache.sling.commons.osgi-2.0.2-incubator
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new df63e8f  First steps towards a Prototype of 'Everything is a Resource'
     new 341e8d7  Make OosgiUtil more generic and cleanup imports
     new 8b99d1f  Prevent NPE if the property value is null in toStringArray
     new d93b1e0  Remove adapter stuff from osgi/commons
     new ae3cfac  SLING-197 Merge resource integration concept into trunk
     new 53d562f  Use OSGi core and cmpendium jars from Felix project.
     new 5d64b45  SLING-204 - add svn ignore patterns for intellij
     new 9451bc4  Move licence and notice to top level dir.
     new 2ca28a2  Add incubator disclaimer.
     new 410331b  Write first element in pom in one line (to avoid problems with the maven release plugin) and minor pom fixes.
     new 8866927  Update notice files.
     new 8534b0e  SLING-402 Move osgi/commons to commons/osgi
     new eb6efe5  SLING-402: Move osgi/commons to commons/osgi - correct poms.
     new d353e24  SLING-402: Move osgi/commons to commons/osgi - refactor to commons package.
     new afb619a  Eclude maven-eclipse.xml generated by the maven eclipse plugin.
     new 0665281  SLING-456: Add manifest header parser and junit test.
     new 36986a1  Use new manifest parser in content loader.
     new b1bc9f4  SLING-460: Preserve order of attributes and directives.
     new 554a87f  SLING-442: Clean up exports, imports, dependencies and used plugins.
     new ff7572e  Add method for handling integer properties.
     new 2fb950c  Add method for handling integer properties.
     new 3ac6bd1  SLING-495 - NOTICE files generated using mknotice script
     new c913b91  SLING-495 - NOTICE files updated according to changes in revision 662927
     new 5b61be1  SLING-495 - NOTICE files regenerated with revision 663097 changes
     new 08a1bf1  Use released version of parent pom.
     new a2f82a9  Use released versions (or soon to be released versions).
     new 056094f  [maven-release-plugin] prepare release org.apache.sling.commons.osgi-2.0.0-incubator
     new 078fd76  [maven-release-plugin] prepare for next development iteration
     new 0288d72  Set version to next development version.
     new b65ac41  Fix reference to parent pom.
     new b13381d  SLING-521: Restore more notice files.
     new ddcb4d2  SLING-521: Separate between notice files for bin and src dists.
     new 997457a  SLING-521: Separate between notice files for bin and src dists.
     new 831ffe0  SLING-521: Separate between notice files for bin and src dists.
     new 1e008e6  Change copyright year to 2008.
     new 67f17d9  [maven-release-plugin]  copy for tag org.apache.sling.commons.osgi-2.0.2-incubator
     new 3fa1dbb  Move Sling to new TLP location
     new 4dcf4e6  Move Sling to new TLP location

The 38 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-commons-osgi] 24/38: SLING-495 - NOTICE files regenerated with revision 663097 changes

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 5b61be1980881db68f5355b9982f94d1dd9cf9b7
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jun 4 13:50:29 2008 +0000

    SLING-495 - NOTICE files regenerated with revision 663097 changes
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663098 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 425ccc6..80c41a6 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,5 +6,5 @@ Copyright 2008 The Apache Software Foundation
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 
-Based on source code originally developed by
-Day Software (http://www.day.com/).
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 08/38: Move licence and notice to top level dir.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 9451bc44f897f9994ca1ced594dd8594ab14d5a2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Apr 10 15:23:52 2008 +0000

    Move licence and notice to top level dir.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@646843 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/resources/META-INF/LICENSE => LICENSE | 0
 src/main/resources/META-INF/NOTICE => NOTICE   | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/META-INF/LICENSE b/LICENSE
similarity index 100%
rename from src/main/resources/META-INF/LICENSE
rename to LICENSE
diff --git a/src/main/resources/META-INF/NOTICE b/NOTICE
similarity index 100%
rename from src/main/resources/META-INF/NOTICE
rename to NOTICE

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 35/38: Change copyright year to 2008.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 1e008e6f11f66a47c862cd13236aeca6aafcf8bc
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jun 16 12:08:14 2008 +0000

    Change copyright year to 2008.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@668130 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE                             | 2 +-
 src/main/resources/META-INF/NOTICE | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 3f1222a..5b7d685 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Sling Commons OSGi
-Copyright 2007-2008 The Apache Software Foundation
+Copyright 2008 The Apache Software Foundation
 
 Apache Sling is based on source code originally developed 
 by Day Software (http://www.day.com/).
diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE
index 424fca0..688b491 100644
--- a/src/main/resources/META-INF/NOTICE
+++ b/src/main/resources/META-INF/NOTICE
@@ -1,5 +1,5 @@
 Apache Sling Commons OSGi
-Copyright 2007-2008 The Apache Software Foundation
+Copyright 2008 The Apache Software Foundation
 
 Apache Sling is based on source code originally developed 
 by Day Software (http://www.day.com/).

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 26/38: Use released versions (or soon to be released versions).

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit a2f82a987f4bbfb9022f0512b5f2f981e48ebf1f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 4 15:06:54 2008 +0000

    Use released versions (or soon to be released versions).
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663157 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 6d84b1e..07c49d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.0.0-incubator-SNAPSHOT</version>
+            <version>2.0.0-incubator</version>
         </dependency>
 
         <!-- OSGi Libraries -->

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 04/38: Remove adapter stuff from osgi/commons

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit d93b1e07607fd939ce7f0e307c9778f9d856e7f1
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Jan 17 15:53:48 2008 +0000

    Remove adapter stuff from osgi/commons
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons@612850 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   3 -
 .../apache/sling/osgi/commons/AdapterFactory.java  |  80 ----
 .../apache/sling/osgi/commons/AdapterManager.java  |  52 ---
 .../apache/sling/osgi/commons/SlingAdaptable.java  |  40 --
 .../commons/internal/AdapterFactoryDescriptor.java |  47 ---
 .../internal/AdapterFactoryDescriptorKey.java      |  88 -----
 .../internal/AdapterFactoryDescriptorMap.java      |  39 --
 .../osgi/commons/internal/AdapterManagerImpl.java  | 427 ---------------------
 .../osgi/commons/internal/AdapterManagerTest.java  | 245 ------------
 .../osgi/commons/mock/MockAdapterFactory.java      |  53 ---
 .../apache/sling/osgi/commons/mock/MockBundle.java | 122 ------
 .../osgi/commons/mock/MockComponentContext.java    |  79 ----
 .../osgi/commons/mock/MockServiceReference.java    |  62 ---
 13 files changed, 1337 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4cb2d06..1a60e69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,9 +62,6 @@
                         <Export-Package>
                             org.apache.sling.osgi.commons;version=${pom.version}
                         </Export-Package>
-                        <Private-Package>
-                            org.apache.sling.osgi.commons.internal
-                        </Private-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java b/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java
deleted file mode 100644
index beaabc2..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons;
-
-/**
- * The <code>AdapterFactory</code> interface defines the API for helpers which
- * may be provided to enhance the adaptability of adaptable objects.
- * <p>
- * Implementations of this interface are registered as OSGi services and are
- * used by the {@link AdapterManager} to adapt objects on demand. The
- * <code>AdapterFactory</code> services are not really intended to be used by
- * clients directly.
- */
-public interface AdapterFactory {
-
-    /**
-     * The service name to use when registering implementations of this
-     * interface as services (value is
-     * "org.apache.sling.osgi.commons.AdapterFactory").
-     */
-    static final String SERVICE_NAME = AdapterFactory.class.getName();
-
-    /**
-     * The service registration property listing the fully qualified names of
-     * classes which can be adapted by this adapter factory (value is
-     * "adaptables"). The "adaptable" parameters of the
-     * {@link #getAdapter(Object, Class)} method must be an instance of any of
-     * these classes for this factory to be able to adapt the object.
-     */
-    static final String ADAPTABLE_CLASSES = "adaptables";
-
-    /**
-     * The service registration property listing the fully qualified names of
-     * classes to which this factory can adapt adaptables (value is "adapters").
-     */
-    static final String ADAPTER_CLASSES = "adapters";
-
-    /**
-     * Adapt the given object to the adaptable type. The adaptable object is
-     * guaranteed to be an instance of one of the classes listed in the
-     * {@link #ADAPTABLE_CLASSES} services registration property. The type
-     * parameter is on of the classes listed in the {@link #ADAPTER_CLASSES}
-     * service registration properties.
-     * <p>
-     * This method may return <code>null</code> if the adaptable object may
-     * not be adapted to the adapter (target) type for any reason. In this case,
-     * the implementation should log a message to the log facility noting the
-     * cause for not being able to adapt.
-     * <p>
-     * Note that the <code>adaptable</code> object is not required to
-     * implement the <code>Adaptable</code> interface, though most of the time
-     * this method is called by means of calling the
-     * {@link SlingAdaptable#adaptTo(Class)} method.
-     * 
-     * @param <AdapterType> The generic type of the adapter (target) type.
-     * @param adaptable The object to adapt to the adapter type.
-     * @param type The type to which the object is to be adapted.
-     * @return The adapted object or <code>null</code> if this factory
-     *         instance cannot adapt the object.
-     */
-    <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type);
-
-}
diff --git a/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java b/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java
deleted file mode 100644
index 0a142e9..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons;
-
-/**
- * The <code>AdapterManager</code> defines the service interface for a manager
- * for object adaption. The adapter manager coordinates the registered
- * {@link AdapterFactory} services on behalf of clients wishing to adapt objects
- * to other types. One such client is the {@link SlingAdaptable} class, which
- * uses the implementation of this bundle to adapt "itself".
- * <p>
- * This interface is not intended to be implemented by clients. Rather it is
- * used to define the service API used by the implementation is this bundle.
- */
-public interface AdapterManager {
-
-    /**
-     * Returns an adapter object of the requested <code>AdapterType</code> for
-     * the given <code>adaptable</code> object.
-     * <p>
-     * The <code>adaptable</code> object may be any non-<code>null</code>
-     * object and is not required to implement the <code>Adaptable</code>
-     * interface.
-     * 
-     * @param <AdapterType> The generic type of the adapter (target) type.
-     * @param adaptable The object to adapt to the adapter type.
-     * @param type The type to which the object is to be adapted.
-     * @return The adapted object or <code>null</code> if no factory exists to
-     *         adapt the <code>adaptable</code> to the
-     *         <code>AdapterType</code> or if the <code>adaptable</code>
-     *         cannot be adapted for any other reason.
-     */
-    <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type);
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java b/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java
deleted file mode 100644
index 0705d9c..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons;
-
-import org.apache.sling.api.adapter.Adaptable;
-import org.apache.sling.osgi.commons.internal.AdapterManagerImpl;
-
-/**
- * The <code>SlingAdaptable</code> class is an (abstract) default
- * implementation of the <code>Adaptable</code> interface. It just uses the
- * default {@link AdapterManager} implemented in this bundle to adapt the itself
- * to the requested type.
- * <p>
- * Extensions of this class may overwrite the {@link #adaptTo(Class)} method
- * using their own knowledge of adapters and may call this base class
- * implementation to fall back to an extended adapters.
- */
-public abstract class SlingAdaptable implements Adaptable {
-
-    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
-        return AdapterManagerImpl.getInstance().getAdapter(this, type);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java
deleted file mode 100644
index 1408fe5..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.internal;
-
-import org.apache.sling.osgi.commons.AdapterFactory;
-
-/**
- * The <code>AdapterFactoryDescriptor</code> is an entry in the
- * {@link AdapterFactoryDescriptorMap} conveying the list of adapter (target)
- * types and the respective {@link AdapterFactory}.
- */
-public class AdapterFactoryDescriptor {
-    
-    private AdapterFactory factory;
-
-    private String[] adapters;
-
-    public AdapterFactoryDescriptor(AdapterFactory factory, String[] adapters) {
-        this.factory = factory;
-        this.adapters = adapters;
-    }
-
-    public AdapterFactory getFactory() {
-        return factory;
-    }
-
-    public String[] getAdapters() {
-        return adapters;
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
deleted file mode 100644
index c9f5c64..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.internal;
-
-import org.apache.sling.osgi.commons.OsgiUtil;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-/**
- * The <code>AdapterFactoryDescriptorKey</code> provides the indexing
- * functionality for the {@link AdapterFactoryDescriptorMap}. The key consists
- * of the OSGi <code>service.id</code> of the
- * {@link org.apache.sling.osgi.commons.AdapterFactory} service and the ID of
- * the the bundle providing the service.
- * <p>
- * Sort order among the keys is defined primarily by the bundle id and
- * secondarily by the service id.
- */
-public class AdapterFactoryDescriptorKey implements
-        Comparable<AdapterFactoryDescriptorKey> {
-
-    private long bundleId;
-
-    private long serviceId;
-
-    public AdapterFactoryDescriptorKey(ServiceReference ref) {
-        bundleId = ref.getBundle().getBundleId();
-        serviceId = OsgiUtil.toLong(ref.getProperty(Constants.SERVICE_ID), -1);
-    }
-
-    public int compareTo(AdapterFactoryDescriptorKey o) {
-        if (o.equals(this)) {
-            return 0;
-        }
-
-        // result for differing bundleId
-        if (bundleId < o.bundleId) {
-            return -1;
-        } else if (bundleId > o.bundleId) {
-            return 1;
-        }
-
-        // result for differing serviceId, we do not expect the two
-        // serviceId values to be equal because otherwise the equals
-        // test above would have yielded true
-        if (serviceId < o.serviceId) {
-            return -1;
-        }
-
-        // serviceId is larger than the other object's, we do not expect
-        // the two serviceId values to be equal because otherwise the equals
-        // test above would have yielded true
-        return 1;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == this) {
-            return true;
-        } else if (o instanceof AdapterFactoryDescriptorKey) {
-            AdapterFactoryDescriptorKey oKey = (AdapterFactoryDescriptorKey) o;
-            return bundleId == oKey.bundleId && serviceId == oKey.serviceId;
-        }
-
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return (int) (bundleId * 33 + serviceId);
-    }
-}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java
deleted file mode 100644
index 747feee..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.internal;
-
-import java.util.TreeMap;
-
-/**
- * The <code>AdapterFactoryDescriptorMap</code> is a sorted map of
- * {@link AdapterFactoryDescriptor} instances indexed (and ordered) by their
- * {@link AdapterFactoryDescriptorKey}. This map is used to organize the
- * registered {@link org.apache.sling.osgi.commons.AdapterFactory} services for
- * a given adaptable type.
- * <p>
- * Each entry in the map is a {@link AdapterFactoryDescriptor} thus enabling the
- * registration of multiple factories for the same (adaptable, adapter) type
- * tuple. Of course only the first entry (this is the reason for having a sorted
- * map) for such a given tuple is actually being used. If that first instance is
- * removed the eventual second instance may actually be used instead.
- */
-public class AdapterFactoryDescriptorMap extends
-        TreeMap<AdapterFactoryDescriptorKey, AdapterFactoryDescriptor> {
-
-}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
deleted file mode 100644
index 8cd3a08..0000000
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.internal;
-
-import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTABLE_CLASSES;
-import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTER_CLASSES;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.sling.osgi.commons.AdapterFactory;
-import org.apache.sling.osgi.commons.AdapterManager;
-import org.apache.sling.osgi.commons.OsgiUtil;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.log.LogService;
-
-/**
- * The <code>AdapterManagerImpl</code> class implements the
- * {@link AdapterManager} interface and is registered as a service for that
- * interface to be used by any clients.
- * 
- * @scr.component metatype="no"
- * @scr.property name="service.description" value="Sling Adapter Manager"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.service
- * @scr.reference name="AdapterFactory"
- *                interface="org.apache.sling.osgi.commons.AdapterFactory"
- *                cardinality="0..n" policy="dynamic"
- */
-public class AdapterManagerImpl implements AdapterManager {
-
-    /**
-     * The singleton instance of this manager. This field is set when the
-     * instance is {@link #activate(ComponentContext) activated} and cleared
-     * when the instance is {@link #deactivate(ComponentContext) deactivated}.
-     */
-    private static AdapterManager INSTANCE;
-
-    /**
-     * Returns the instance of this class or <code>null</code> if no activate
-     * yet.
-     */
-    public static AdapterManager getInstance() {
-        return INSTANCE;
-    }
-
-    /** @scr.reference cardinality="0..1" policy="dynamic" */
-    private LogService log;
-
-    /** Whether to debug this class or not */
-    private boolean debug = false;
-
-    /**
-     * The OSGi <code>ComponentContext</code> to retrieve
-     * {@link AdapterFactory} service instances.
-     */
-    private ComponentContext context;
-
-    /**
-     * A list of {@link AdapterFactory} services bound to this manager before
-     * the manager has been activated. These bound services will be accessed as
-     * soon as the manager is being activated.
-     */
-    private List<ServiceReference> boundAdapterFactories = new LinkedList<ServiceReference>();
-
-    /**
-     * A map of {@link AdapterFactoryDescriptorMap} instances. The map is
-     * indexed by the fully qualified class names listed in the
-     * {@link AdapterFactory#ADAPTABLE_CLASSES} property of the
-     * {@link AdapterFactory} services.
-     * 
-     * @see AdapterFactoryDescriptorMap
-     */
-    private Map<String, AdapterFactoryDescriptorMap> factories = new HashMap<String, AdapterFactoryDescriptorMap>();
-
-    /**
-     * Matrix of {@link AdapterFactory} instances primarily indexed by the fully
-     * qualified name of the class to be adapted and secondarily indexed by the
-     * fully qualified name of the class to adapt to (the target class).
-     * <p>
-     * This cache is built on demand by calling the
-     * {@link #getAdapterFactories(Class)} class. It is removed altogether
-     * whenever an adapter factory is registered on unregistered.
-     */
-    private Map<String, Map<String, AdapterFactory>> factoryCache;
-
-    // ---------- AdapterManager interface -------------------------------------
-
-    /**
-     * Returns the adapted <code>adaptable</code> or <code>null</code> if
-     * the object cannot be adapted.
-     */
-    public <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type) {
-
-        // get the adapter factories for the type of adaptable object
-        Map<String, AdapterFactory> factories = getAdapterFactories(adaptable.getClass());
-
-        // get the factory for the target type
-        AdapterFactory factory = factories.get(type.getName());
-
-        // have the factory adapt the adaptable if the factory exists
-        if (factory != null) {
-            if (debug) {
-                log(LogService.LOG_DEBUG, "Using adapter factory " + factory
-                    + " to map " + adaptable + " to " + type, null);
-            }
-
-            return factory.getAdapter(adaptable, type);
-        }
-
-        // no factory has been found, so we cannot adapt
-        if (debug) {
-            log(LogService.LOG_DEBUG, "No adapter factory found to map "
-                + adaptable + " to " + type, null);
-        }
-
-        return null;
-    }
-
-    // ----------- SCR integration ---------------------------------------------
-
-    protected synchronized void activate(ComponentContext context) {
-        this.context = context;
-
-        // register all adapter factories bound before activation
-        for (ServiceReference reference : boundAdapterFactories) {
-            registerAdapterFactory(context, reference);
-        }
-        boundAdapterFactories.clear();
-
-        // final "enable" this manager by setting the instance
-        // do not overwrite the field if already set (this is unexpected
-        // actually)
-        if (AdapterManagerImpl.INSTANCE == null) {
-            AdapterManagerImpl.INSTANCE = this;
-        } else {
-            log(LogService.LOG_WARNING,
-                "Not setting Instance field: Set to another manager "
-                    + AdapterManagerImpl.INSTANCE, null);
-        }
-    }
-
-    /**
-     * @param context Not used
-     */
-    protected synchronized void deactivate(ComponentContext context) {
-        // "disable" the manager by clearing the instance
-        // do not clear the field if not set to this instance
-        if (AdapterManagerImpl.INSTANCE == this) {
-            AdapterManagerImpl.INSTANCE = null;
-        } else {
-            log(LogService.LOG_WARNING,
-                "Not clearing instance field: Set to another manager "
-                    + AdapterManagerImpl.INSTANCE, null);
-        }
-
-        this.context = null;
-    }
-
-    protected synchronized void bindAdapterFactory(ServiceReference reference) {
-        if (context == null) {
-            boundAdapterFactories.add(reference);
-        } else {
-            registerAdapterFactory(context, reference);
-        }
-    }
-
-    protected synchronized void unbindAdapterFactory(ServiceReference reference) {
-        unregisterAdapterFactory(reference);
-    }
-
-    // ---------- unit testing stuff only --------------------------------------
-
-    /**
-     * Returns the active adapter factories of this manager.
-     * <p>
-     * <strong><em>THIS METHOD IS FOR UNIT TESTING ONLY. IT MAY BE REMOVED OR
-     * MODIFIED WITHOUT NOTICE.</em></strong>
-     */
-    Map<String, AdapterFactoryDescriptorMap> getFactories() {
-        return factories;
-    }
-
-    /**
-     * Returns the current adapter factory cache.
-     * <p>
-     * <strong><em>THIS METHOD IS FOR UNIT TESTING ONLY. IT MAY BE REMOVED OR
-     * MODIFIED WITHOUT NOTICE.</em></strong>
-     */
-    Map<String, Map<String, AdapterFactory>> getFactoryCache() {
-        return factoryCache;
-    }
-
-    // ---------- internal -----------------------------------------------------
-
-    private void log(int level, String message, Throwable t) {
-        LogService logger = this.log;
-        if (logger != null) {
-            logger.log(level, message, t);
-        } else {
-            System.out.println(message);
-            if (t != null) {
-                t.printStackTrace(System.out);
-            }
-        }
-    }
-
-    /**
-     * Unregisters the {@link AdapterFactory} referred to by the service
-     * <code>reference</code> from the registry.
-     */
-    private void registerAdapterFactory(ComponentContext context,
-            ServiceReference reference) {
-        String[] adaptables = OsgiUtil.toStringArray(reference.getProperty(ADAPTABLE_CLASSES));
-        String[] adapters = OsgiUtil.toStringArray(reference.getProperty(ADAPTER_CLASSES));
-
-        if (adaptables == null || adaptables.length == 0 || adapters == null
-            || adapters.length == 0) {
-            return;
-        }
-
-        AdapterFactory factory = (AdapterFactory) context.locateService(
-            "AdapterFactory", reference);
-
-        AdapterFactoryDescriptorKey factoryKey = new AdapterFactoryDescriptorKey(
-            reference);
-        AdapterFactoryDescriptor factoryDesc = new AdapterFactoryDescriptor(
-            factory, adapters);
-
-        synchronized (factories) {
-            for (String adaptable : adaptables) {
-                AdapterFactoryDescriptorMap adfMap = factories.get(adaptable);
-                if (adfMap == null) {
-                    adfMap = new AdapterFactoryDescriptorMap();
-                    factories.put(adaptable, adfMap);
-                }
-                adfMap.put(factoryKey, factoryDesc);
-            }
-        }
-
-        // clear the factory cache to force rebuild on next access
-        factoryCache = null;
-    }
-
-    /**
-     * Unregisters the {@link AdapterFactory} referred to by the service
-     * <code>reference</code> from the registry.
-     */
-    private void unregisterAdapterFactory(ServiceReference reference) {
-        boundAdapterFactories.remove(reference);
-
-        String[] adaptables = OsgiUtil.toStringArray(reference.getProperty(ADAPTABLE_CLASSES));
-
-        if (adaptables == null || adaptables.length == 0) {
-            return;
-        }
-
-        AdapterFactoryDescriptorKey factoryKey = new AdapterFactoryDescriptorKey(
-            reference);
-
-        boolean factoriesModified = false;
-        synchronized (factories) {
-            for (String adaptable : adaptables) {
-                AdapterFactoryDescriptorMap adfMap = factories.get(adaptable);
-                if (adfMap != null) {
-                    factoriesModified |= (adfMap.remove(factoryKey) != null);
-                    if (adfMap.isEmpty()) {
-                        factories.remove(adaptable);
-                    }
-                }
-            }
-        }
-
-        // only remove cache if some adapter factories have actually been
-        // removed
-        if (factoriesModified) {
-            factoryCache = null;
-        }
-    }
-
-    /**
-     * Returns a map of {@link AdapterFactory} instances for the given class to
-     * be adapted. The returned map is indexed by the fully qualified name of
-     * the target classes (to adapt to) registered.
-     * 
-     * @param clazz The type of the object for which the registered adapter
-     *            factories are requested
-     * @return The map of adapter factories. If there is no adapter factory
-     *         registered for this type, the returned map is empty.
-     */
-    private Map<String, AdapterFactory> getAdapterFactories(Class<?> clazz) {
-        Map<String, Map<String, AdapterFactory>> cache = factoryCache;
-        if (cache == null) {
-            cache = new HashMap<String, Map<String, AdapterFactory>>();
-            factoryCache = cache;
-        }
-
-        synchronized (cache) {
-            return getAdapterFactories(clazz, cache);
-        }
-    }
-
-    /**
-     * Returns the map of adapter factories index by adapter (target) class name
-     * for the given adaptable <code>clazz</code>. If no adapter exists for
-     * the <code>clazz</code> and empty map is returned.
-     * 
-     * @param clazz The adaptable <code>Class</code> for which to return the
-     *            adapter factory map by target class name.
-     * @param cache The cache of already defined adapter factory mappings
-     * @return The map of adapter factories by target class name. The map may be
-     *         empty if there is no adapter factory for the adaptable
-     *         <code>clazz</code>.
-     */
-    private Map<String, AdapterFactory> getAdapterFactories(Class<?> clazz,
-            Map<String, Map<String, AdapterFactory>> cache) {
-
-        String className = clazz.getName();
-        Map<String, AdapterFactory> entry = cache.get(className);
-        if (entry == null) {
-            // create entry
-            entry = createAdapterFactoryMap(clazz, cache);
-            cache.put(className, entry);
-        }
-
-        return entry;
-    }
-
-    /**
-     * Creates a new target adapter factory map for the given <code>clazz</code>.
-     * First all factories defined to support the adaptable class by
-     * registration are taken. Next all factories for the implemented interfaces
-     * and finally all base class factories are copied. Later adapter factory
-     * entries do NOT overwrite earlier entries.
-     * 
-     * @param clazz The adaptable <code>Class</code> for which to build the
-     *            adapter factory map by target class name.
-     * @param cache The cache of already defined adapter factory mappings
-     * @return The map of adapter factories by target class name. The map may be
-     *         empty if there is no adapter factory for the adaptable
-     *         <code>clazz</code>.
-     */
-    private Map<String, AdapterFactory> createAdapterFactoryMap(Class<?> clazz,
-            Map<String, Map<String, AdapterFactory>> cache) {
-        Map<String, AdapterFactory> afm = new HashMap<String, AdapterFactory>();
-
-        // AdapterFactories for this class
-        AdapterFactoryDescriptorMap afdMap;
-        synchronized (factories) {
-            afdMap = factories.get(clazz.getName());
-        }
-        if (afdMap != null) {
-            for (AdapterFactoryDescriptor afd : afdMap.values()) {
-                String[] adapters = afd.getAdapters();
-                for (String adapter : adapters) {
-                    if (!afm.containsKey(adapter)) {
-                        afm.put(adapter, afd.getFactory());
-                    }
-                }
-            }
-        }
-
-        // AdapterFactories for the interfaces
-        Class<?>[] interfaces = clazz.getInterfaces();
-        for (Class<?> iFace : interfaces) {
-            copyAdapterFactories(afm, iFace, cache);
-        }
-
-        // AdapterFactories for the super class
-        Class<?> superClazz = clazz.getSuperclass();
-        if (superClazz != null) {
-            copyAdapterFactories(afm, superClazz, cache);
-        }
-
-        return afm;
-    }
-
-    /**
-     * Copies all adapter factories for the given <code>clazz</code> from the
-     * <code>cache</code> to the <code>dest</code> map except for those
-     * factories whose target class already exists in the <code>dest</code>
-     * map.
-     * 
-     * @param dest The map of target class name to adapter factory into which
-     *            additional factories are copied. Existing factories are not
-     *            replaced.
-     * @param clazz The adaptable class whose adapter factories are considered
-     *            for adding into <code>dest</code>.
-     * @param cache The adapter factory cache providing the adapter factories
-     *            for <code>clazz</code> to consider for copying into
-     *            <code>dest</code>.
-     */
-    private void copyAdapterFactories(Map<String, AdapterFactory> dest,
-            Class<?> clazz, Map<String, Map<String, AdapterFactory>> cache) {
-
-        // get the adapter factories for the adaptable clazz
-        Map<String, AdapterFactory> scMap = getAdapterFactories(clazz, cache);
-
-        // for each target class copy the entry to dest if dest does
-        // not contain the target class already
-        for (Map.Entry<String, AdapterFactory> entry : scMap.entrySet()) {
-            if (!dest.containsKey(entry.getKey())) {
-                dest.put(entry.getKey(), entry.getValue());
-            }
-        }
-    }
-}
diff --git a/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java b/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java
deleted file mode 100644
index 067ec16..0000000
--- a/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.internal;
-
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.sling.osgi.commons.AdapterFactory;
-import org.apache.sling.osgi.commons.SlingAdaptable;
-import org.apache.sling.osgi.commons.mock.MockBundle;
-import org.apache.sling.osgi.commons.mock.MockComponentContext;
-import org.apache.sling.osgi.commons.mock.MockServiceReference;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.service.component.ComponentContext;
-
-public class AdapterManagerTest extends TestCase {
-
-    private AdapterManagerImpl am;
-    
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        
-        am = new AdapterManagerImpl();
-    }
-    
-    @Override
-    protected void tearDown() throws Exception {
-        if (AdapterManagerImpl.getInstance() == am) {
-            am.deactivate(null); // not correct, but argument unused
-        }
-        
-        super.tearDown();
-    }
-    
-    public void testUnitialized() {
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-    }
-
-    public void testInitialized() {
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-    }
-
-    public void testBindBeforeActivate() {
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        // no cache and no factories yet
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-
-        // this should register the factory
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        // expect the factory, but cache is empty
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-    }
-
-    public void testBindAfterActivate() {
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        // no cache and no factories yet
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        // expect the factory, but cache is empty
-        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
-        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
-        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
-
-        Map<String, AdapterFactoryDescriptorMap> f = am.getFactories();
-        AdapterFactoryDescriptorMap afdm = f.get(TestSlingAdaptable.class.getName());
-        assertNotNull(afdm);
-
-        AdapterFactoryDescriptor afd = afdm.get(new AdapterFactoryDescriptorKey(ref));
-        assertNotNull(afd);
-        assertNotNull(afd.getFactory());
-        assertNotNull(afd.getAdapters());
-        assertEquals(1, afd.getAdapters().length);
-        assertEquals(ITestAdapter.class.getName(), afd.getAdapters()[0]);
-
-        assertNull(f.get(TestSlingAdaptable2.class.getName()));
-    }
-
-    public void testAdaptBase() {
-
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        TestSlingAdaptable data = new TestSlingAdaptable();
-        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
-
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        Object adapter = am.getAdapter(data, ITestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof ITestAdapter);
-    }
-
-    public void testAdaptExtended() {
-
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        TestSlingAdaptable2 data = new TestSlingAdaptable2();
-        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
-
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        Object adapter = am.getAdapter(data, ITestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof ITestAdapter);
-    }
-
-    public void testAdaptBase2() {
-
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        TestSlingAdaptable data = new TestSlingAdaptable();
-        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
-
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 2L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable2.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, TestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        Object adapter = am.getAdapter(data, ITestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof ITestAdapter);
-    }
-
-    public void testAdaptExtended2() {
-
-        ComponentContext cc = new MockComponentContext();
-        am.activate(cc);
-
-        Bundle bundle = new MockBundle(1L);
-        MockServiceReference ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 1L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        ref = new MockServiceReference(bundle);
-        ref.setProperty(Constants.SERVICE_ID, 2L);
-        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable2.class.getName() });
-        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, TestAdapter.class.getName());
-        am.bindAdapterFactory(ref);
-
-        TestSlingAdaptable data = new TestSlingAdaptable();
-        Object adapter = am.getAdapter(data, ITestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof ITestAdapter);
-        adapter = am.getAdapter(data, TestAdapter.class);
-        assertNull(adapter);
-
-        TestSlingAdaptable2 data2 = new TestSlingAdaptable2();
-        adapter = am.getAdapter(data2, ITestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof ITestAdapter);
-        adapter = am.getAdapter(data2, TestAdapter.class);
-        assertNotNull(adapter);
-        assertTrue(adapter instanceof TestAdapter);
-    }
-
-    //---------- Test Adaptable and Adapter Classes ---------------------------
-
-    public static class TestSlingAdaptable extends SlingAdaptable {
-
-    }
-
-    public static class TestSlingAdaptable2 extends TestSlingAdaptable {
-
-    }
-
-    public static interface ITestAdapter {
-
-    }
-
-    public static class TestAdapter {
-
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java
deleted file mode 100644
index e833c96..0000000
--- a/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.mock;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.apache.sling.osgi.commons.AdapterFactory;
-
-public class MockAdapterFactory implements AdapterFactory {
-
-    private static final InvocationHandler NOP_INVOCATION_HANDLER = new InvocationHandler() {
-        public Object invoke(Object proxy, Method method, Object[] args)
-                throws Throwable {
-            return null;
-        }
-    };
-
-    @SuppressWarnings("unchecked")
-    public <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type) {
-
-        try {
-            if (type.isInterface()) {
-                return (AdapterType) Proxy.newProxyInstance(type.getClassLoader(),
-                    new Class[] { type }, NOP_INVOCATION_HANDLER);
-            }
-
-            return type.newInstance();
-        } catch (Exception e) {
-            // ignore
-        }
-
-        return null;
-    }
-}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
deleted file mode 100644
index f6a3523..0000000
--- a/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.mock;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-public class MockBundle implements Bundle {
-
-    private long bundleId;
-
-    public MockBundle(long bundleId) {
-        this.bundleId = bundleId;
-    }
-
-    public long getBundleId() {
-        return bundleId;
-    }
-
-    public Enumeration<?> findEntries(String path, String filePattern,
-            boolean recurse) {
-        return null;
-    }
-
-    public URL getEntry(String name) {
-        return null;
-    }
-
-    public Enumeration<?> getEntryPaths(String path) {
-        return null;
-    }
-
-    public Dictionary<?, ?> getHeaders() {
-        return null;
-    }
-
-    public Dictionary<?, ?> getHeaders(String locale) {
-        return null;
-    }
-
-    public long getLastModified() {
-        return 0;
-    }
-
-    public String getLocation() {
-        return null;
-    }
-
-    public ServiceReference[] getRegisteredServices() {
-        return null;
-    }
-
-    public URL getResource(String name) {
-        return null;
-    }
-
-    public Enumeration<?> getResources(String name) {
-        return null;
-    }
-
-    public ServiceReference[] getServicesInUse() {
-        return null;
-    }
-
-    public int getState() {
-        return 0;
-    }
-
-    public String getSymbolicName() {
-        return null;
-    }
-
-    public boolean hasPermission(Object permission) {
-        return false;
-    }
-
-    public Class<?> loadClass(String name) throws ClassNotFoundException {
-        throw new ClassNotFoundException(name);
-    }
-
-    public void start() {
-
-    }
-
-    public void stop() {
-
-    }
-
-    public void uninstall() {
-
-    }
-
-    public void update() {
-
-    }
-
-    public void update(InputStream in) {
-
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java
deleted file mode 100644
index 159fe44..0000000
--- a/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.mock;
-
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.sling.osgi.commons.AdapterFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.component.ComponentInstance;
-
-public class MockComponentContext implements ComponentContext {
-
-    private Map<ServiceReference, AdapterFactory> services = new HashMap<ServiceReference, AdapterFactory>();
-
-    public Object locateService(String name, ServiceReference reference) {
-        AdapterFactory af = services.get(reference);
-        if (af == null) {
-            af = new MockAdapterFactory();
-            services.put(reference, af);
-        }
-        return af;
-    }
-
-    public void disableComponent(String name) {
-    }
-
-    public void enableComponent(String name) {
-    }
-
-    public BundleContext getBundleContext() {
-        return null;
-    }
-
-    public ComponentInstance getComponentInstance() {
-        return null;
-    }
-
-    public Dictionary<?, ?> getProperties() {
-        return null;
-    }
-
-    public ServiceReference getServiceReference() {
-        return null;
-    }
-
-    public Bundle getUsingBundle() {
-        return null;
-    }
-
-    public Object locateService(String name) {
-        return null;
-    }
-
-    public Object[] locateServices(String name) {
-        return null;
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java
deleted file mode 100644
index e503d96..0000000
--- a/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.osgi.commons.mock;
-
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-public class MockServiceReference implements ServiceReference {
-
-    private Bundle bundle;
-    private Dictionary<String, Object> props;
-
-    public MockServiceReference(Bundle bundle) {
-        this.bundle = bundle;
-        this.props = new Hashtable<String, Object>();
-    }
-
-    public Bundle getBundle() {
-        return bundle;
-    }
-
-    public void setProperty(String key, Object value) {
-        props.put(key, value);
-    }
-
-    public Object getProperty(String key) {
-        return props.get(key);
-    }
-
-    public String[] getPropertyKeys() {
-        return Collections.list(props.keys()).toArray(new String[props.size()]);
-    }
-
-    public Bundle[] getUsingBundles() {
-        return null;
-    }
-
-    public boolean isAssignableTo(Bundle bundle, String className) {
-        return false;
-    }
-
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 05/38: SLING-197 Merge resource integration concept into trunk

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit ae3cfac84bc1959dde076ef5270f98637304d15d
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Fri Jan 25 12:47:20 2008 +0000

    SLING-197 Merge resource integration concept into trunk
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@615211 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 29/38: Set version to next development version.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 0288d720a88e486c37f1f7a4bd024cb694eb0e94
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 4 17:27:58 2008 +0000

    Set version to next development version.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663320 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index ae559a6..41fb6c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.0.0-incubator</version>
+            <version>2.0.1-incubator-SNAPSHOT</version>
         </dependency>
 
         <!-- OSGi Libraries -->

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 06/38: Use OSGi core and cmpendium jars from Felix project.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 53d562ffc1be15fc0c9a84d7b11b5b8e557b0d7b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 28 08:17:53 2008 +0000

    Use OSGi core and cmpendium jars from Felix project.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@615754 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1a60e69..4ded882 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,12 +77,12 @@
 
         <!-- OSGi Libraries -->
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi_R4_core</artifactId>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi_R4_compendium</artifactId>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
         </dependency>
 
         <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 02/38: Make OosgiUtil more generic and cleanup imports

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 341e8d7f0b55793e26a9c33d2b718d409d76392a
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Mon Jan 14 19:23:23 2008 +0000

    Make OosgiUtil more generic and cleanup imports
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons@611900 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/osgi/commons/OsgiUtil.java    | 52 ++++++++++------------
 .../internal/AdapterFactoryDescriptorKey.java      |  2 +-
 .../osgi/commons/internal/AdapterManagerImpl.java  |  7 ++-
 .../apache/sling/osgi/commons/mock/MockBundle.java |  2 -
 4 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
index 49d7e23..724accd 100644
--- a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
@@ -28,7 +28,6 @@ import java.util.Vector;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
 import org.osgi.service.event.EventConstants;
 
 /**
@@ -44,9 +43,8 @@ public class OsgiUtil {
      * by calling <code>Boolean.valueOf</code> on the string value of the
      * property.
      */
-    public static boolean getProperty(ServiceReference reference, String name,
-            boolean defaultValue) {
-        Object propValue = getPropertyObject(reference, name);
+    public static boolean toBoolean(Object propValue, boolean defaultValue) {
+        propValue = toObject(propValue);
         if (propValue instanceof Boolean) {
             return (Boolean) propValue;
         } else if (propValue != null) {
@@ -60,9 +58,8 @@ public class OsgiUtil {
      * Returns the named service reference property as a string or the
      * <code>defaultValue</code> if no such reference property exists.
      */
-    public static String getProperty(ServiceReference reference, String name,
-            String defaultValue) {
-        Object propValue = getPropertyObject(reference, name);
+    public static String toString(Object propValue, String defaultValue) {
+        propValue = toObject(propValue);
         return (propValue != null) ? propValue.toString() : defaultValue;
     }
 
@@ -72,14 +69,13 @@ public class OsgiUtil {
      * the property is not an <code>Integer</code> and cannot be converted to
      * an <code>Integer</code> from the property's string value.
      */
-    public static int getProperty(ServiceReference reference, String name,
-            int defaultValue) {
-        Object propValue = getPropertyObject(reference, name);
-        if (propValue instanceof Integer) {
-            return (Integer) propValue;
+    public static long toLong(Object propValue, long defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Long) {
+            return (Long) propValue;
         } else if (propValue != null) {
             try {
-                return Integer.valueOf(String.valueOf(propValue));
+                return Long.valueOf(String.valueOf(propValue));
             } catch (NumberFormatException nfe) {
                 // don't care, fall through to default value
             }
@@ -94,9 +90,8 @@ public class OsgiUtil {
      * the property is not an <code>Double</code> and cannot be converted to
      * an <code>Double</code> from the property's string value.
      */
-    public static double getProperty(ServiceReference reference, String name,
-            double defaultValue) {
-        Object propValue = getPropertyObject(reference, name);
+    public static double getProperty(Object propValue, double defaultValue) {
+        propValue = toObject(propValue);
         if (propValue instanceof Double) {
             return (Double) propValue;
         } else if (propValue != null) {
@@ -118,9 +113,7 @@ public class OsgiUtil {
      * <code>java.util.Vector</code>, the first vector element is returned.
      * Otherwise <code>null</code> is returned.
      */
-    public static Object getPropertyObject(ServiceReference reference,
-            String name) {
-        Object propValue = reference.getProperty(name);
+    public static Object toObject(Object propValue) {
         if (propValue == null) {
             return null;
         } else if (propValue.getClass().isArray()) {
@@ -143,16 +136,15 @@ public class OsgiUtil {
      * Otherwise (if the property does not exist) <code>null</code> is
      * returned.
      */
-    public static String[] getProperty(ServiceReference reference, String name) {
-        Object propValue = reference.getProperty(name);
+    public static String[] toStringArray(Object propValue) {
         if (propValue instanceof String) {
             // single string
             return new String[] { (String) propValue };
-            
+
         } else if (propValue instanceof String[]) {
             // String[]
             return (String[]) propValue;
-            
+
         } else if (propValue.getClass().isArray()) {
             // other array
             Object[] valueArray = (Object[]) propValue;
@@ -163,7 +155,7 @@ public class OsgiUtil {
                 }
             }
             return values.toArray(new String[values.size()]);
-            
+
         } else if (propValue instanceof Vector) {
             // vector
             Vector<?> valueVector = (Vector<?>) propValue;
@@ -179,7 +171,8 @@ public class OsgiUtil {
         return null;
     }
 
-    public static Event createEvent(Bundle sourceBundle, ServiceReference sourceService, String eventName,
+    public static Event createEvent(Bundle sourceBundle,
+            ServiceReference sourceService, String eventName,
             Map<String, Object> props) {
 
         // get a private copy of the properties
@@ -188,12 +181,15 @@ public class OsgiUtil {
         // service information of this JcrResourceResolverFactoryImpl service
         if (sourceService != null) {
             table.put(EventConstants.SERVICE, sourceService);
-            table.put(EventConstants.SERVICE_ID,
+            table.put(
+                EventConstants.SERVICE_ID,
                 sourceService.getProperty(org.osgi.framework.Constants.SERVICE_ID));
-            table.put(EventConstants.SERVICE_OBJECTCLASS,
+            table.put(
+                EventConstants.SERVICE_OBJECTCLASS,
                 sourceService.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
             if (sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID) != null) {
-                table.put(EventConstants.SERVICE_PID,
+                table.put(
+                    EventConstants.SERVICE_PID,
                     sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID));
             }
         }
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
index d12c9e8..c9f5c64 100644
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
@@ -41,7 +41,7 @@ public class AdapterFactoryDescriptorKey implements
 
     public AdapterFactoryDescriptorKey(ServiceReference ref) {
         bundleId = ref.getBundle().getBundleId();
-        serviceId = OsgiUtil.getProperty(ref, Constants.SERVICE_ID, -1);
+        serviceId = OsgiUtil.toLong(ref.getProperty(Constants.SERVICE_ID), -1);
     }
 
     public int compareTo(AdapterFactoryDescriptorKey o) {
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
index cf0f0e9..8cd3a08 100644
--- a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
@@ -21,7 +21,6 @@ package org.apache.sling.osgi.commons.internal;
 import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTABLE_CLASSES;
 import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTER_CLASSES;
 
-import java.io.PrintStream;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -232,8 +231,8 @@ public class AdapterManagerImpl implements AdapterManager {
      */
     private void registerAdapterFactory(ComponentContext context,
             ServiceReference reference) {
-        String[] adaptables = OsgiUtil.getProperty(reference, ADAPTABLE_CLASSES);
-        String[] adapters = OsgiUtil.getProperty(reference, ADAPTER_CLASSES);
+        String[] adaptables = OsgiUtil.toStringArray(reference.getProperty(ADAPTABLE_CLASSES));
+        String[] adapters = OsgiUtil.toStringArray(reference.getProperty(ADAPTER_CLASSES));
 
         if (adaptables == null || adaptables.length == 0 || adapters == null
             || adapters.length == 0) {
@@ -270,7 +269,7 @@ public class AdapterManagerImpl implements AdapterManager {
     private void unregisterAdapterFactory(ServiceReference reference) {
         boundAdapterFactories.remove(reference);
 
-        String[] adaptables = OsgiUtil.getProperty(reference, ADAPTABLE_CLASSES);
+        String[] adaptables = OsgiUtil.toStringArray(reference.getProperty(ADAPTABLE_CLASSES));
 
         if (adaptables == null || adaptables.length == 0) {
             return;
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
index 13fda4f..f6a3523 100644
--- a/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
+++ b/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
@@ -18,14 +18,12 @@
  */
 package org.apache.sling.osgi.commons.mock;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.Dictionary;
 import java.util.Enumeration;
 
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
 
 public class MockBundle implements Bundle {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 36/38: [maven-release-plugin] copy for tag org.apache.sling.commons.osgi-2.0.2-incubator

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 67f17d977bdc374ad4a2d239386744563ddc581f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jun 17 07:13:36 2008 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.commons.osgi-2.0.2-incubator
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator@668444 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 489ff6c..ef80e9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,21 +23,21 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>2-incubator-SNAPSHOT</version>
+        <version>3-incubator</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
     <artifactId>org.apache.sling.commons.osgi</artifactId>
-    <version>2.0.1-incubator-SNAPSHOT</version>
+    <version>2.0.2-incubator</version>
     <packaging>bundle</packaging>
 
     <name>Sling - Commons OSGi support</name>
     <description>Commons OSGi</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi</developerConnection>
-        <url>http://svn.apache.org/viewvc/incubator/sling/trunk/commons/osgi</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</developerConnection>
+        <url>http://svn.apache.org/viewvc/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</url>
     </scm>
 
     <build>
@@ -61,7 +61,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.0.1-incubator-SNAPSHOT</version>
+            <version>2.0.2-incubator</version>
         </dependency>
 
         <!-- OSGi Libraries -->

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 09/38: Add incubator disclaimer.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 2ca28a2924cafb7112211fbe755b83ddac215717
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 14 12:58:07 2008 +0000

    Add incubator disclaimer.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@647780 13f79535-47bb-0310-9956-ffa450edef68
---
 DISCLAIMER | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/DISCLAIMER b/DISCLAIMER
new file mode 100644
index 0000000..90850c2
--- /dev/null
+++ b/DISCLAIMER
@@ -0,0 +1,7 @@
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 15/38: Eclude maven-eclipse.xml generated by the maven eclipse plugin.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit afb619a7d655a711955672755b41fbbebbbb22e2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon May 5 07:05:56 2008 +0000

    Eclude maven-eclipse.xml generated by the maven eclipse plugin.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@653321 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 07/38: SLING-204 - add svn ignore patterns for intellij

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 5d64b45c9b71f270b28f1a50e89aec495d8bbb2c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Jan 28 08:39:32 2008 +0000

    SLING-204 - add svn ignore patterns for intellij
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@615760 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 25/38: Use released version of parent pom.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 08a1bf154fd1ab72fe8e4e05d6a87200b1b436f4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 4 14:16:40 2008 +0000

    Use released version of parent pom.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663109 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7186dca..6d84b1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>1-incubator-SNAPSHOT</version>
+        <version>1-incubator</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 14/38: SLING-402: Move osgi/commons to commons/osgi - refactor to commons package.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit d353e247e3d3c51f18b217cf0025259f73bc027e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri May 2 16:54:33 2008 +0000

    SLING-402: Move osgi/commons to commons/osgi - refactor to commons package.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@652817 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/{osgi/commons => commons/osgi}/OsgiUtil.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
similarity index 99%
rename from src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
rename to src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index 705b960..d335c50 100644
--- a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.osgi.commons;
+package org.apache.sling.commons.osgi;
 
 import java.util.ArrayList;
 import java.util.Dictionary;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 10/38: Write first element in pom in one line (to avoid problems with the maven release plugin) and minor pom fixes.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 410331b78dcff1cdc135e7aa32ff781ae71869e5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 14 13:43:49 2008 +0000

    Write first element in pom in one line (to avoid problems with the maven release plugin) and minor pom fixes.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@647797 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4ded882..bb3dc39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,9 +17,8 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 03/38: Prevent NPE if the property value is null in toStringArray

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 8b99d1f6173603a922a884aee476e78d57573239
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Tue Jan 15 12:29:31 2008 +0000

    Prevent NPE if the property value is null in toStringArray
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons@612094 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
index 724accd..705b960 100644
--- a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
@@ -137,7 +137,11 @@ public class OsgiUtil {
      * returned.
      */
     public static String[] toStringArray(Object propValue) {
-        if (propValue instanceof String) {
+        if (propValue == null) {
+            // no value at all
+            return null;
+            
+        } else if (propValue instanceof String) {
             // single string
             return new String[] { (String) propValue };
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 21/38: Add method for handling integer properties.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 2fb950ce06418729c0093b30c9fb195fac572386
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue May 27 14:41:02 2008 +0000

    Add method for handling integer properties.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@660537 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index 2b4ca43..0635570 100644
--- a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -90,7 +90,7 @@ public class OsgiUtil {
      * the property is not an <code>Integer</code> and cannot be converted to
      * an <code>Integer</code> from the property's string value.
      */
-    public static long toInteger(Object propValue, int defaultValue) {
+    public static int toInteger(Object propValue, int defaultValue) {
         propValue = toObject(propValue);
         if (propValue instanceof Integer) {
             return (Integer) propValue;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 13/38: SLING-402: Move osgi/commons to commons/osgi - correct poms.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit eb6efe579f3ed50d8080e30c0b97a8dba00b1109
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri May 2 16:53:21 2008 +0000

    SLING-402: Move osgi/commons to commons/osgi - correct poms.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@652814 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE  |  2 +-
 pom.xml | 15 +++++----------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/NOTICE b/NOTICE
index 6b9b1b5..3c38a85 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,4 +1,4 @@
-Apache Sling OSGi Commons
+Apache Sling Commons OSGi
 Copyright 2007-2008 The Apache Software Foundation
 
 Based on source code originally developed by
diff --git a/pom.xml b/pom.xml
index bb3dc39..4ce3675 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 
-    <artifactId>org.apache.sling.osgi.commons</artifactId>
+    <artifactId>org.apache.sling.commons.osgi</artifactId>
     <version>2.0.0-incubator-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
@@ -36,13 +36,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons
+            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons
+            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/commons
+            http://svn.apache.org/viewvc/incubator/sling/trunk/commons/osgi
         </url>
     </scm>
 
@@ -59,7 +59,7 @@
                 <configuration>
                     <instructions>
                         <Export-Package>
-                            org.apache.sling.osgi.commons;version=${pom.version}
+                            org.apache.sling.commons.osgi;version=${pom.version}
                         </Export-Package>
                     </instructions>
                 </configuration>
@@ -83,11 +83,6 @@
             <groupId>org.apache.felix</groupId>
             <artifactId>org.osgi.compendium</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
     </dependencies>
 
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 23/38: SLING-495 - NOTICE files updated according to changes in revision 662927

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit c913b91043e3f86770a374e0412ee1d9af509a5b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Jun 4 08:05:20 2008 +0000

    SLING-495 - NOTICE files updated according to changes in revision 662927
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663025 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/NOTICE b/NOTICE
index 118d4b4..425ccc6 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,13 +1,10 @@
 Apache Sling - Commons OSGi support
-Copyright 2007-2008 The Apache Software Foundation
 
-Based on source code originally developed by
-Day Software (http://www.day.com/).
+Apache Sling
+Copyright 2008 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-See http://www.apache.org/legal/3party.html for the ASF policy on 
-third-party licenses.
 
+Based on source code originally developed by
+Day Software (http://www.day.com/).

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 16/38: SLING-456: Add manifest header parser and junit test.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 0665281fc87719ec715317a35948e807dccf2704
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu May 15 07:10:03 2008 +0000

    SLING-456: Add manifest header parser and junit test.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@656526 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/commons/osgi/ManifestHeader.java  | 309 +++++++++++++++++++++
 .../sling/commons/osgi/ManifestHeaderTest.java     |  89 ++++++
 2 files changed, 398 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
new file mode 100644
index 0000000..f7a7e85
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.osgi;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This is a helper class to parse manifest header entries.
+ */
+public class ManifestHeader {
+
+    /**
+     * A header can have several entries separated by comma.
+     */
+    public interface Entry {
+
+        /**
+         * The value of the entry.
+         */
+        String getValue();
+
+        /**
+         * The attributes specified for this entry.
+         */
+        NameValuePair[] getAttributes();
+
+        /**
+         * The directives for this entry.
+         */
+        NameValuePair[] getDirectives();
+    }
+
+    /** The entries for this header. */
+    private Entry[] entries = new Entry[0];
+
+    /**
+     * Add new entries from parsing.
+     */
+    private void add(Entry[] paths) {
+        if ( paths != null && paths.length > 0 ) {
+            final Entry[] copy = new Entry[this.entries.length + paths.length];
+            System.arraycopy(this.entries, 0, copy, 0, this.entries.length);
+            System.arraycopy(paths, 0, copy, this.entries.length, paths.length);
+            this.entries = copy;
+        }
+    }
+
+    /**
+     * Return the entries for this header.
+     */
+    public Entry[] getEntries() {
+        return this.entries;
+    }
+
+    /**
+     * Directives and attributes are simple name/value pairs.
+     */
+    public final static class NameValuePair {
+
+        private final String name;
+        private final String value;
+
+        public NameValuePair(String name, String value) {
+            this.name = name;
+            this.value = value;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    private static final String CLASS_PATH_SEPARATOR = ",";
+    private static final String PACKAGE_SEPARATOR = ";";
+    private static final String DIRECTIVE_SEPARATOR = ":=";
+    private static final String ATTRIBUTE_SEPARATOR = "=";
+
+    /**
+     * Parse headers
+     * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
+     *            path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
+     */
+    public static ManifestHeader parse(String header) {
+        final ManifestHeader entry = new ManifestHeader();
+
+        if (header != null) {
+            if (header.length() == 0) {
+                throw new IllegalArgumentException("A header cannot be an empty string.");
+            }
+
+            final String[] clauseStrings = parseDelimitedString(header, CLASS_PATH_SEPARATOR);
+            if ( clauseStrings != null ) {
+                for(final String clause : clauseStrings) {
+                    entry.add(parseStandardHeaderClause(clause));
+                }
+            }
+        }
+
+        return (entry.getEntries().length == 0) ? null : entry;
+    }
+
+    /**
+     * Parse a clause
+     * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
+     */
+    private static ManifestHeader.Entry[] parseStandardHeaderClause(String clauseString)
+    throws IllegalArgumentException {
+        // Break string into semi-colon delimited pieces.
+        String[] pieces = parseDelimitedString(clauseString, PACKAGE_SEPARATOR);
+
+        // Count the number of different paths; paths
+        // will not have an '=' in their string. This assumes
+        // that paths come first, before directives and
+        // attributes.
+        int pathCount = 0;
+        for (int pieceIdx = 0; pieceIdx < pieces.length; pieceIdx++) {
+            if (pieces[pieceIdx].indexOf('=') >= 0) {
+                break;
+            }
+            pathCount++;
+        }
+
+        // Error if no paths were specified.
+        if (pathCount == 0) {
+            throw new IllegalArgumentException(
+                "No paths specified in header: " + clauseString);
+        }
+
+        // Create an array of paths.
+        PathImpl[] paths = new PathImpl[pathCount];
+        for(int i=0;i<pathCount;i++) {
+            paths[i] = new PathImpl(pieces[i]);
+        }
+
+        // Parse the directives/attributes.
+        final Map<String, ManifestHeader.NameValuePair> dirsMap = new HashMap<String, ManifestHeader.NameValuePair>();
+        final Map<String, ManifestHeader.NameValuePair> attrsMap = new HashMap<String, ManifestHeader.NameValuePair>();
+
+        int idx = -1;
+        String sep = null;
+        for (int pieceIdx = pathCount; pieceIdx < pieces.length; pieceIdx++) {
+
+            if ((idx = pieces[pieceIdx].indexOf(DIRECTIVE_SEPARATOR)) >= 0) {
+                sep = DIRECTIVE_SEPARATOR;
+            } else if ((idx = pieces[pieceIdx].indexOf(ATTRIBUTE_SEPARATOR)) >= 0) {
+                sep = ATTRIBUTE_SEPARATOR;
+            } else {
+                throw new IllegalArgumentException("Not a directive/attribute: " + clauseString);
+            }
+
+            final String key = pieces[pieceIdx].substring(0, idx).trim();
+            String value = pieces[pieceIdx].substring(idx + sep.length()).trim();
+
+            // Remove quotes, if value is quoted.
+            if (value.startsWith("\"") && value.endsWith("\"")) {
+                value = value.substring(1, value.length() - 1);
+            }
+
+            // Save the directive/attribute in the appropriate array.
+            if (sep.equals(DIRECTIVE_SEPARATOR)) {
+                // Check for duplicates.
+                if (dirsMap.get(key) != null) {
+                    throw new IllegalArgumentException("Duplicate directive: " + key);
+                }
+                dirsMap.put(key, new ManifestHeader.NameValuePair(key, value));
+            } else {
+                // Check for duplicates.
+                if (attrsMap.get(key) != null) {
+                    throw new IllegalArgumentException("Duplicate attribute: " + key);
+                }
+                attrsMap.put(key, new ManifestHeader.NameValuePair(key, value));
+            }
+        }
+        // Create directive array.
+        ManifestHeader.NameValuePair[] dirs =
+            dirsMap.values().toArray(new ManifestHeader.NameValuePair[dirsMap.size()]);
+
+        // Create attribute array.
+        ManifestHeader.NameValuePair[] attrs =
+            attrsMap.values().toArray(new ManifestHeader.NameValuePair[attrsMap.size()]);
+
+        // now set attributes and directives for each path
+        for(int i=0;i<pathCount;i++) {
+            paths[i].init(dirs, attrs);
+        }
+
+        return paths;
+    }
+
+    private static final int CHAR = 1;
+    private static final int DELIMITER = 2;
+    private static final int STARTQUOTE = 4;
+    private static final int ENDQUOTE = 8;
+
+    /**
+     * Parses delimited string and returns an array containing the tokens. This
+     * parser obeys quotes, so the delimiter character will be ignored if it is
+     * inside of a quote. This method assumes that the quote character is not
+     * included in the set of delimiter characters.
+     * @param value the delimited string to parse.
+     * @param delim the characters delimiting the tokens.
+     * @return an array of string tokens or null if there were no tokens.
+     **/
+    private static String[] parseDelimitedString(String value, String delim) {
+        if (value == null) {
+           value = "";
+        }
+
+        final List<String> list = new ArrayList<String>();
+
+        final StringBuffer sb = new StringBuffer();
+
+        int expecting = (CHAR | DELIMITER | STARTQUOTE);
+
+        for (int i = 0; i < value.length(); i++) {
+            char c = value.charAt(i);
+
+            boolean isDelimiter = (delim.indexOf(c) >= 0);
+            boolean isQuote = (c == '"');
+
+            if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+                list.add(sb.toString().trim());
+                sb.delete(0, sb.length());
+                expecting = (CHAR | DELIMITER | STARTQUOTE);
+            } else if (isQuote && ((expecting & STARTQUOTE) > 0)) {
+                sb.append(c);
+                expecting = CHAR | ENDQUOTE;
+            } else if (isQuote && ((expecting & ENDQUOTE) > 0)) {
+                sb.append(c);
+                expecting = (CHAR | STARTQUOTE | DELIMITER);
+            } else if ((expecting & CHAR) > 0) {
+                sb.append(c);
+            } else {
+                throw new IllegalArgumentException("Invalid delimited string: " + value);
+            }
+        }
+
+        if (sb.length() > 0) {
+            list.add(sb.toString().trim());
+        }
+
+        if ( list.size() == 0 ) {
+            return null;
+        }
+        return list.toArray(new String[list.size()]);
+    }
+
+    protected static final class PathImpl implements ManifestHeader.Entry {
+
+        private final String value;
+
+        private NameValuePair[] attributes;
+        private NameValuePair[] directives;
+
+        public PathImpl(final String path) {
+            this.value = path;
+        }
+
+        public void init(NameValuePair[] dirs, NameValuePair[] attrs) {
+            this.directives = dirs;
+            this.attributes = attrs;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getAttributes()
+         */
+        public NameValuePair[] getAttributes() {
+            return this.attributes;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getDirectives()
+         */
+        public NameValuePair[] getDirectives() {
+            return this.directives;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getValue()
+         */
+        public String getValue() {
+            return this.value;
+        }
+
+    }
+}
diff --git a/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
new file mode 100644
index 0000000..da43902
--- /dev/null
+++ b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.osgi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the manifest header parsing.
+ */
+public class ManifestHeaderTest extends TestCase {
+
+    public void testNonExisting() {
+        String header = null;
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertNull(entry);
+    }
+
+    public void testSinglePath() {
+        String header = "something";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals(header, entry.getEntries()[0].getValue());
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+    }
+
+    public void testSeveralPaths() {
+        String header = "one,two,   three    ,\n   four, \n   five";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(5, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+        assertEquals("two", entry.getEntries()[1].getValue());
+        assertEquals(0, entry.getEntries()[1].getAttributes().length);
+        assertEquals(0, entry.getEntries()[1].getDirectives().length);
+        assertEquals("three", entry.getEntries()[2].getValue());
+        assertEquals(0, entry.getEntries()[2].getAttributes().length);
+        assertEquals(0, entry.getEntries()[2].getDirectives().length);
+        assertEquals("four", entry.getEntries()[3].getValue());
+        assertEquals(0, entry.getEntries()[3].getAttributes().length);
+        assertEquals(0, entry.getEntries()[3].getDirectives().length);
+        assertEquals("five", entry.getEntries()[4].getValue());
+        assertEquals(0, entry.getEntries()[4].getAttributes().length);
+        assertEquals(0, entry.getEntries()[4].getDirectives().length);
+    }
+
+    public void testAttributes() {
+        String header = "one;a=1;b=2";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(2, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+        assertEquals("a", entry.getEntries()[0].getAttributes()[0].getName());
+        assertEquals("b", entry.getEntries()[0].getAttributes()[1].getName());
+        assertEquals("1", entry.getEntries()[0].getAttributes()[0].getValue());
+        assertEquals("2", entry.getEntries()[0].getAttributes()[1].getValue());
+    }
+
+    public void testDirectives() {
+        String header = "one;a:=1;b:=2";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(2, entry.getEntries()[0].getDirectives().length);
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals("a", entry.getEntries()[0].getDirectives()[0].getName());
+        assertEquals("b", entry.getEntries()[0].getDirectives()[1].getName());
+        assertEquals("1", entry.getEntries()[0].getDirectives()[0].getValue());
+        assertEquals("2", entry.getEntries()[0].getDirectives()[1].getValue());
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 12/38: SLING-402 Move osgi/commons to commons/osgi

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 8534b0e5e16143843dea5d8d0294ec3465944997
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri May 2 16:48:43 2008 +0000

    SLING-402 Move osgi/commons to commons/osgi
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@652812 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 17/38: Use new manifest parser in content loader.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 36986a1e4a82d9f506f0499d4aad616a487df501
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu May 15 07:30:37 2008 +0000

    Use new manifest parser in content loader.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@656528 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  5 ++++
 .../apache/sling/commons/osgi/ManifestHeader.java  | 29 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 4ce3675..cf0b96b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,6 +83,11 @@
             <groupId>org.apache.felix</groupId>
             <artifactId>org.osgi.compendium</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
index f7a7e85..039bdda 100644
--- a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
+++ b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
@@ -47,7 +47,11 @@ public class ManifestHeader {
          * The directives for this entry.
          */
         NameValuePair[] getDirectives();
-    }
+
+        String getAttributeValue(String name);
+
+        String getDirectiveValue(String name);
+}
 
     /** The entries for this header. */
     private Entry[] entries = new Entry[0];
@@ -305,5 +309,28 @@ public class ManifestHeader {
             return this.value;
         }
 
+        public String getAttributeValue(String name) {
+            String v = null;
+            int index = 0;
+            while ( v == null && index < attributes.length ) {
+                if ( attributes[index].getName().equals(name) ) {
+                    v = attributes[index].getValue();
+                }
+                index++;
+            }
+            return v;
+        }
+
+        public String getDirectiveValue(String name) {
+            String v = null;
+            int index = 0;
+            while ( v == null && index < directives.length ) {
+                if ( directives[index].getName().equals(name) ) {
+                    v = directives[index].getValue();
+                }
+                index++;
+            }
+            return v;
+        }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 18/38: SLING-460: Preserve order of attributes and directives.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit b1bc9f46235f439997daa59b4d92612a51ec9d57
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri May 16 09:12:08 2008 +0000

    SLING-460: Preserve order of attributes and directives.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@656979 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/commons/osgi/ManifestHeader.java  | 30 ++++++++++++++--------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
index 039bdda..72c951b 100644
--- a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
+++ b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
@@ -19,9 +19,9 @@
 package org.apache.sling.commons.osgi;
 
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
+import java.util.Set;
 
 /**
  * This is a helper class to parse manifest header entries.
@@ -106,6 +106,7 @@ public class ManifestHeader {
      * Parse headers
      * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
      *            path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
+     * The returned object maintains the order of entries (paths), directives and attributes.
      */
     public static ManifestHeader parse(String header) {
         final ManifestHeader entry = new ManifestHeader();
@@ -159,9 +160,14 @@ public class ManifestHeader {
             paths[i] = new PathImpl(pieces[i]);
         }
 
-        // Parse the directives/attributes.
-        final Map<String, ManifestHeader.NameValuePair> dirsMap = new HashMap<String, ManifestHeader.NameValuePair>();
-        final Map<String, ManifestHeader.NameValuePair> attrsMap = new HashMap<String, ManifestHeader.NameValuePair>();
+        // Parse the directives/attributes
+        // and keep the order
+        // for simpliefied checking if a directive/attribute is used twice, we keep
+        // two collections: one for the values and one for the names
+        final List<ManifestHeader.NameValuePair> dirsList = new ArrayList<ManifestHeader.NameValuePair>();
+        final Set<String> dirsNames = new HashSet<String>();
+        final List<ManifestHeader.NameValuePair> attrsList = new ArrayList<ManifestHeader.NameValuePair>();
+        final Set<String> attrsNames = new HashSet<String>();
 
         int idx = -1;
         String sep = null;
@@ -186,25 +192,27 @@ public class ManifestHeader {
             // Save the directive/attribute in the appropriate array.
             if (sep.equals(DIRECTIVE_SEPARATOR)) {
                 // Check for duplicates.
-                if (dirsMap.get(key) != null) {
+                if (dirsNames.contains(key)) {
                     throw new IllegalArgumentException("Duplicate directive: " + key);
                 }
-                dirsMap.put(key, new ManifestHeader.NameValuePair(key, value));
+                dirsList.add(new ManifestHeader.NameValuePair(key, value));
+                dirsNames.add(key);
             } else {
                 // Check for duplicates.
-                if (attrsMap.get(key) != null) {
+                if (attrsNames.contains(key)) {
                     throw new IllegalArgumentException("Duplicate attribute: " + key);
                 }
-                attrsMap.put(key, new ManifestHeader.NameValuePair(key, value));
+                attrsList.add(new ManifestHeader.NameValuePair(key, value));
+                attrsNames.add(key);
             }
         }
         // Create directive array.
         ManifestHeader.NameValuePair[] dirs =
-            dirsMap.values().toArray(new ManifestHeader.NameValuePair[dirsMap.size()]);
+            dirsList.toArray(new ManifestHeader.NameValuePair[dirsList.size()]);
 
         // Create attribute array.
         ManifestHeader.NameValuePair[] attrs =
-            attrsMap.values().toArray(new ManifestHeader.NameValuePair[attrsMap.size()]);
+            attrsList.toArray(new ManifestHeader.NameValuePair[attrsList.size()]);
 
         // now set attributes and directives for each path
         for(int i=0;i<pathCount;i++) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 34/38: SLING-521: Separate between notice files for bin and src dists.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 831ffe071d06352c95fe849b9c2b5a057f6d76aa
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jun 13 13:30:32 2008 +0000

    SLING-521: Separate between notice files for bin and src dists.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@667529 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/README.txt b/README.txt
index 2ca762d..5ce8754 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,7 @@
 Apache Sling Commons OSGi
 
-
-WE NEED A LOT MORE HERE!!!!!!!!!!!!!!!!!!
-
+The Commons OSGi library provides utility methods when implementing OSGi related services
+and components.
 
 Disclaimer
 ==========

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 27/38: [maven-release-plugin] prepare release org.apache.sling.commons.osgi-2.0.0-incubator

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 056094f47597d378c438664537ca2b71e4e5e05a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 4 15:13:27 2008 +0000

    [maven-release-plugin] prepare release org.apache.sling.commons.osgi-2.0.0-incubator
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663171 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/pom.xml b/pom.xml
index 07c49d5..bfff28c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,22 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.commons.osgi</artifactId>
-    <version>2.0.0-incubator-SNAPSHOT</version>
+    <version>2.0.0-incubator</version>
     <packaging>bundle</packaging>
 
     <name>Sling - Commons OSGi support</name>
     <description>Commons OSGi</description>
 
     <scm>
-        <connection>
-            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
-        </connection>
-        <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
-        </developerConnection>
-        <url>
-            http://svn.apache.org/viewvc/incubator/sling/trunk/commons/osgi
-        </url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</developerConnection>
+        <url>http://svn.apache.org/viewvc/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 20/38: Add method for handling integer properties.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit ff7572e992ce2776afdd1586e83f23955b69dc4e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue May 27 14:38:31 2008 +0000

    Add method for handling integer properties.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@660533 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/commons/osgi/OsgiUtil.java    | 27 +++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index d335c50..2b4ca43 100644
--- a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -64,10 +64,10 @@ public class OsgiUtil {
     }
 
     /**
-     * Returns the named service reference property as an integer or the
+     * Returns the named service reference property as a long or the
      * <code>defaultValue</code> if no such reference property exists or if
      * the property is not an <code>Integer</code> and cannot be converted to
-     * an <code>Integer</code> from the property's string value.
+     * a <code>Long</code> from the property's string value.
      */
     public static long toLong(Object propValue, long defaultValue) {
         propValue = toObject(propValue);
@@ -85,6 +85,27 @@ public class OsgiUtil {
     }
 
     /**
+     * Returns the named service reference property as an integer or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Integer</code> and cannot be converted to
+     * an <code>Integer</code> from the property's string value.
+     */
+    public static long toInteger(Object propValue, int defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Integer) {
+            return (Integer) propValue;
+        } else if (propValue != null) {
+            try {
+                return Integer.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
      * Returns the named service reference property as a double or the
      * <code>defaultValue</code> if no such reference property exists or if
      * the property is not an <code>Double</code> and cannot be converted to
@@ -140,7 +161,7 @@ public class OsgiUtil {
         if (propValue == null) {
             // no value at all
             return null;
-            
+
         } else if (propValue instanceof String) {
             // single string
             return new String[] { (String) propValue };

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 32/38: SLING-521: Separate between notice files for bin and src dists.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit ddcb4d2a49aed68d2f794b5e807b8362a542e603
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jun 13 10:41:22 2008 +0000

    SLING-521: Separate between notice files for bin and src dists.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@667466 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE                                             |   1 -
 README.txt                                         |  35 ++++
 .../main/resources/META-INF/DISCLAIMER             |   0
 src/main/resources/META-INF/LICENSE                | 202 +++++++++++++++++++++
 NOTICE => src/main/resources/META-INF/NOTICE       |   2 +-
 5 files changed, 238 insertions(+), 2 deletions(-)

diff --git a/NOTICE b/NOTICE
index 73541f0..3f1222a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,4 +6,3 @@ by Day Software (http://www.day.com/).
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..fdeccc6
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,35 @@
+WE NEED A LOT MORE HERE!!!!!!!!!!!!!!!!!!
+
+
+Disclaimer
+==========
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+If you have Maven 2 installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
+
+See the Subversion documentation for other source control features.
diff --git a/DISCLAIMER b/src/main/resources/META-INF/DISCLAIMER
similarity index 100%
rename from DISCLAIMER
rename to src/main/resources/META-INF/DISCLAIMER
diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/src/main/resources/META-INF/NOTICE
similarity index 87%
copy from NOTICE
copy to src/main/resources/META-INF/NOTICE
index 73541f0..424fca0 100644
--- a/NOTICE
+++ b/src/main/resources/META-INF/NOTICE
@@ -6,4 +6,4 @@ by Day Software (http://www.day.com/).
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
+

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 22/38: SLING-495 - NOTICE files generated using mknotice script

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 3ac6bd1120d3e8c72aabeadc665dc3e8b43da5fd
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 3 12:24:26 2008 +0000

    SLING-495 - NOTICE files generated using mknotice script
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@662766 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/NOTICE b/NOTICE
index 3c38a85..118d4b4 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,4 +1,4 @@
-Apache Sling Commons OSGi
+Apache Sling - Commons OSGi support
 Copyright 2007-2008 The Apache Software Foundation
 
 Based on source code originally developed by
@@ -7,3 +7,7 @@ Day Software (http://www.day.com/).
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 Licensed under the Apache License 2.0.
+
+See http://www.apache.org/legal/3party.html for the ASF policy on 
+third-party licenses.
+

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 01/38: First steps towards a Prototype of 'Everything is a Resource'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit df63e8f03c158a39a9eb78a13e8ba075bff1b3d5
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Fri Jan 4 16:41:06 2008 +0000

    First steps towards a Prototype of 'Everything is a Resource'
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons@608914 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  97 +++++
 .../apache/sling/osgi/commons/AdapterFactory.java  |  80 ++++
 .../apache/sling/osgi/commons/AdapterManager.java  |  52 +++
 .../org/apache/sling/osgi/commons/OsgiUtil.java    | 215 +++++++++++
 .../apache/sling/osgi/commons/SlingAdaptable.java  |  40 ++
 .../commons/internal/AdapterFactoryDescriptor.java |  47 +++
 .../internal/AdapterFactoryDescriptorKey.java      |  88 +++++
 .../internal/AdapterFactoryDescriptorMap.java      |  39 ++
 .../osgi/commons/internal/AdapterManagerImpl.java  | 428 +++++++++++++++++++++
 src/main/resources/META-INF/LICENSE                | 202 ++++++++++
 src/main/resources/META-INF/NOTICE                 |   5 +
 .../osgi/commons/internal/AdapterManagerTest.java  | 245 ++++++++++++
 .../osgi/commons/mock/MockAdapterFactory.java      |  53 +++
 .../apache/sling/osgi/commons/mock/MockBundle.java | 124 ++++++
 .../osgi/commons/mock/MockComponentContext.java    |  79 ++++
 .../osgi/commons/mock/MockServiceReference.java    |  62 +++
 16 files changed, 1856 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..4cb2d06
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>1-incubator-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.osgi.commons</artifactId>
+    <version>2.0.0-incubator-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Sling - Commons OSGi support</name>
+    <description>Commons OSGi</description>
+
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons
+        </developerConnection>
+        <url>
+            http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/commons
+        </url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.sling.osgi.commons;version=${pom.version}
+                        </Export-Package>
+                        <Private-Package>
+                            org.apache.sling.osgi.commons.internal
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+
+        <!-- OSGi Libraries -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi_R4_core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi_R4_compendium</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java b/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java
new file mode 100644
index 0000000..beaabc2
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/AdapterFactory.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons;
+
+/**
+ * The <code>AdapterFactory</code> interface defines the API for helpers which
+ * may be provided to enhance the adaptability of adaptable objects.
+ * <p>
+ * Implementations of this interface are registered as OSGi services and are
+ * used by the {@link AdapterManager} to adapt objects on demand. The
+ * <code>AdapterFactory</code> services are not really intended to be used by
+ * clients directly.
+ */
+public interface AdapterFactory {
+
+    /**
+     * The service name to use when registering implementations of this
+     * interface as services (value is
+     * "org.apache.sling.osgi.commons.AdapterFactory").
+     */
+    static final String SERVICE_NAME = AdapterFactory.class.getName();
+
+    /**
+     * The service registration property listing the fully qualified names of
+     * classes which can be adapted by this adapter factory (value is
+     * "adaptables"). The "adaptable" parameters of the
+     * {@link #getAdapter(Object, Class)} method must be an instance of any of
+     * these classes for this factory to be able to adapt the object.
+     */
+    static final String ADAPTABLE_CLASSES = "adaptables";
+
+    /**
+     * The service registration property listing the fully qualified names of
+     * classes to which this factory can adapt adaptables (value is "adapters").
+     */
+    static final String ADAPTER_CLASSES = "adapters";
+
+    /**
+     * Adapt the given object to the adaptable type. The adaptable object is
+     * guaranteed to be an instance of one of the classes listed in the
+     * {@link #ADAPTABLE_CLASSES} services registration property. The type
+     * parameter is on of the classes listed in the {@link #ADAPTER_CLASSES}
+     * service registration properties.
+     * <p>
+     * This method may return <code>null</code> if the adaptable object may
+     * not be adapted to the adapter (target) type for any reason. In this case,
+     * the implementation should log a message to the log facility noting the
+     * cause for not being able to adapt.
+     * <p>
+     * Note that the <code>adaptable</code> object is not required to
+     * implement the <code>Adaptable</code> interface, though most of the time
+     * this method is called by means of calling the
+     * {@link SlingAdaptable#adaptTo(Class)} method.
+     * 
+     * @param <AdapterType> The generic type of the adapter (target) type.
+     * @param adaptable The object to adapt to the adapter type.
+     * @param type The type to which the object is to be adapted.
+     * @return The adapted object or <code>null</code> if this factory
+     *         instance cannot adapt the object.
+     */
+    <AdapterType> AdapterType getAdapter(Object adaptable,
+            Class<AdapterType> type);
+
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java b/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java
new file mode 100644
index 0000000..0a142e9
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/AdapterManager.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons;
+
+/**
+ * The <code>AdapterManager</code> defines the service interface for a manager
+ * for object adaption. The adapter manager coordinates the registered
+ * {@link AdapterFactory} services on behalf of clients wishing to adapt objects
+ * to other types. One such client is the {@link SlingAdaptable} class, which
+ * uses the implementation of this bundle to adapt "itself".
+ * <p>
+ * This interface is not intended to be implemented by clients. Rather it is
+ * used to define the service API used by the implementation is this bundle.
+ */
+public interface AdapterManager {
+
+    /**
+     * Returns an adapter object of the requested <code>AdapterType</code> for
+     * the given <code>adaptable</code> object.
+     * <p>
+     * The <code>adaptable</code> object may be any non-<code>null</code>
+     * object and is not required to implement the <code>Adaptable</code>
+     * interface.
+     * 
+     * @param <AdapterType> The generic type of the adapter (target) type.
+     * @param adaptable The object to adapt to the adapter type.
+     * @param type The type to which the object is to be adapted.
+     * @return The adapted object or <code>null</code> if no factory exists to
+     *         adapt the <code>adaptable</code> to the
+     *         <code>AdapterType</code> or if the <code>adaptable</code>
+     *         cannot be adapted for any other reason.
+     */
+    <AdapterType> AdapterType getAdapter(Object adaptable,
+            Class<AdapterType> type);
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
new file mode 100644
index 0000000..49d7e23
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.service.event.EventConstants;
+
+/**
+ * The <code>OsgiUtil</code> is a utility class providing some usefull utility
+ * methods.
+ */
+public class OsgiUtil {
+
+    /**
+     * Returns the boolean value of the named service reference property or the
+     * <code>defaultValue</code> if no such service reference property exist.
+     * If the service property is not a <code>Boolean</code> it is converted
+     * by calling <code>Boolean.valueOf</code> on the string value of the
+     * property.
+     */
+    public static boolean getProperty(ServiceReference reference, String name,
+            boolean defaultValue) {
+        Object propValue = getPropertyObject(reference, name);
+        if (propValue instanceof Boolean) {
+            return (Boolean) propValue;
+        } else if (propValue != null) {
+            return Boolean.valueOf(String.valueOf(propValue));
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a string or the
+     * <code>defaultValue</code> if no such reference property exists.
+     */
+    public static String getProperty(ServiceReference reference, String name,
+            String defaultValue) {
+        Object propValue = getPropertyObject(reference, name);
+        return (propValue != null) ? propValue.toString() : defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as an integer or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Integer</code> and cannot be converted to
+     * an <code>Integer</code> from the property's string value.
+     */
+    public static int getProperty(ServiceReference reference, String name,
+            int defaultValue) {
+        Object propValue = getPropertyObject(reference, name);
+        if (propValue instanceof Integer) {
+            return (Integer) propValue;
+        } else if (propValue != null) {
+            try {
+                return Integer.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a double or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Double</code> and cannot be converted to
+     * an <code>Double</code> from the property's string value.
+     */
+    public static double getProperty(ServiceReference reference, String name,
+            double defaultValue) {
+        Object propValue = getPropertyObject(reference, name);
+        if (propValue instanceof Double) {
+            return (Double) propValue;
+        } else if (propValue != null) {
+            try {
+                return Double.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a single value. If the
+     * property is neither an array nor a <code>java.util.Vector</code> the
+     * property is returned unmodified. If the property is a non-empty array,
+     * the first array element is returned. If the property is a non-empty
+     * <code>java.util.Vector</code>, the first vector element is returned.
+     * Otherwise <code>null</code> is returned.
+     */
+    public static Object getPropertyObject(ServiceReference reference,
+            String name) {
+        Object propValue = reference.getProperty(name);
+        if (propValue == null) {
+            return null;
+        } else if (propValue.getClass().isArray()) {
+            Object[] prop = (Object[]) propValue;
+            return prop.length > 0 ? prop[0] : null;
+        } else if (propValue instanceof Vector) {
+            Vector<?> prop = (Vector<?>) propValue;
+            return prop.isEmpty() ? null : prop.get(0);
+        } else {
+            return propValue;
+        }
+    }
+
+    /**
+     * Returns the named service reference property as an array of Strings. If
+     * the property is a scalar value its string value is returned as a single
+     * element array. If the property is an array, the elements are converted to
+     * String objects and returned as an array. If the property is a vector, the
+     * vector elements are converted to String objects and returned as an array.
+     * Otherwise (if the property does not exist) <code>null</code> is
+     * returned.
+     */
+    public static String[] getProperty(ServiceReference reference, String name) {
+        Object propValue = reference.getProperty(name);
+        if (propValue instanceof String) {
+            // single string
+            return new String[] { (String) propValue };
+            
+        } else if (propValue instanceof String[]) {
+            // String[]
+            return (String[]) propValue;
+            
+        } else if (propValue.getClass().isArray()) {
+            // other array
+            Object[] valueArray = (Object[]) propValue;
+            List<String> values = new ArrayList<String>(valueArray.length);
+            for (Object value : valueArray) {
+                if (value != null) {
+                    values.add(value.toString());
+                }
+            }
+            return values.toArray(new String[values.size()]);
+            
+        } else if (propValue instanceof Vector) {
+            // vector
+            Vector<?> valueVector = (Vector<?>) propValue;
+            List<String> values = new ArrayList<String>(valueVector.size());
+            for (Object value : valueVector) {
+                if (value != null) {
+                    values.add(value.toString());
+                }
+            }
+            return values.toArray(new String[values.size()]);
+        }
+
+        return null;
+    }
+
+    public static Event createEvent(Bundle sourceBundle, ServiceReference sourceService, String eventName,
+            Map<String, Object> props) {
+
+        // get a private copy of the properties
+        Dictionary<String, Object> table = new Hashtable<String, Object>(props);
+
+        // service information of this JcrResourceResolverFactoryImpl service
+        if (sourceService != null) {
+            table.put(EventConstants.SERVICE, sourceService);
+            table.put(EventConstants.SERVICE_ID,
+                sourceService.getProperty(org.osgi.framework.Constants.SERVICE_ID));
+            table.put(EventConstants.SERVICE_OBJECTCLASS,
+                sourceService.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
+            if (sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID) != null) {
+                table.put(EventConstants.SERVICE_PID,
+                    sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID));
+            }
+        }
+
+        // source bundle information (if available)
+        if (sourceBundle != null) {
+            table.put(EventConstants.BUNDLE_SYMBOLICNAME,
+                sourceBundle.getSymbolicName());
+        }
+
+        // timestamp the event
+        table.put(EventConstants.TIMESTAMP,
+            new Long(System.currentTimeMillis()));
+
+        // create the event
+        return new Event(eventName, table);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java b/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java
new file mode 100644
index 0000000..0705d9c
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/SlingAdaptable.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons;
+
+import org.apache.sling.api.adapter.Adaptable;
+import org.apache.sling.osgi.commons.internal.AdapterManagerImpl;
+
+/**
+ * The <code>SlingAdaptable</code> class is an (abstract) default
+ * implementation of the <code>Adaptable</code> interface. It just uses the
+ * default {@link AdapterManager} implemented in this bundle to adapt the itself
+ * to the requested type.
+ * <p>
+ * Extensions of this class may overwrite the {@link #adaptTo(Class)} method
+ * using their own knowledge of adapters and may call this base class
+ * implementation to fall back to an extended adapters.
+ */
+public abstract class SlingAdaptable implements Adaptable {
+
+    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
+        return AdapterManagerImpl.getInstance().getAdapter(this, type);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java
new file mode 100644
index 0000000..1408fe5
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptor.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.internal;
+
+import org.apache.sling.osgi.commons.AdapterFactory;
+
+/**
+ * The <code>AdapterFactoryDescriptor</code> is an entry in the
+ * {@link AdapterFactoryDescriptorMap} conveying the list of adapter (target)
+ * types and the respective {@link AdapterFactory}.
+ */
+public class AdapterFactoryDescriptor {
+    
+    private AdapterFactory factory;
+
+    private String[] adapters;
+
+    public AdapterFactoryDescriptor(AdapterFactory factory, String[] adapters) {
+        this.factory = factory;
+        this.adapters = adapters;
+    }
+
+    public AdapterFactory getFactory() {
+        return factory;
+    }
+
+    public String[] getAdapters() {
+        return adapters;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
new file mode 100644
index 0000000..d12c9e8
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorKey.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.internal;
+
+import org.apache.sling.osgi.commons.OsgiUtil;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The <code>AdapterFactoryDescriptorKey</code> provides the indexing
+ * functionality for the {@link AdapterFactoryDescriptorMap}. The key consists
+ * of the OSGi <code>service.id</code> of the
+ * {@link org.apache.sling.osgi.commons.AdapterFactory} service and the ID of
+ * the the bundle providing the service.
+ * <p>
+ * Sort order among the keys is defined primarily by the bundle id and
+ * secondarily by the service id.
+ */
+public class AdapterFactoryDescriptorKey implements
+        Comparable<AdapterFactoryDescriptorKey> {
+
+    private long bundleId;
+
+    private long serviceId;
+
+    public AdapterFactoryDescriptorKey(ServiceReference ref) {
+        bundleId = ref.getBundle().getBundleId();
+        serviceId = OsgiUtil.getProperty(ref, Constants.SERVICE_ID, -1);
+    }
+
+    public int compareTo(AdapterFactoryDescriptorKey o) {
+        if (o.equals(this)) {
+            return 0;
+        }
+
+        // result for differing bundleId
+        if (bundleId < o.bundleId) {
+            return -1;
+        } else if (bundleId > o.bundleId) {
+            return 1;
+        }
+
+        // result for differing serviceId, we do not expect the two
+        // serviceId values to be equal because otherwise the equals
+        // test above would have yielded true
+        if (serviceId < o.serviceId) {
+            return -1;
+        }
+
+        // serviceId is larger than the other object's, we do not expect
+        // the two serviceId values to be equal because otherwise the equals
+        // test above would have yielded true
+        return 1;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        } else if (o instanceof AdapterFactoryDescriptorKey) {
+            AdapterFactoryDescriptorKey oKey = (AdapterFactoryDescriptorKey) o;
+            return bundleId == oKey.bundleId && serviceId == oKey.serviceId;
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) (bundleId * 33 + serviceId);
+    }
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java
new file mode 100644
index 0000000..747feee
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterFactoryDescriptorMap.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.internal;
+
+import java.util.TreeMap;
+
+/**
+ * The <code>AdapterFactoryDescriptorMap</code> is a sorted map of
+ * {@link AdapterFactoryDescriptor} instances indexed (and ordered) by their
+ * {@link AdapterFactoryDescriptorKey}. This map is used to organize the
+ * registered {@link org.apache.sling.osgi.commons.AdapterFactory} services for
+ * a given adaptable type.
+ * <p>
+ * Each entry in the map is a {@link AdapterFactoryDescriptor} thus enabling the
+ * registration of multiple factories for the same (adaptable, adapter) type
+ * tuple. Of course only the first entry (this is the reason for having a sorted
+ * map) for such a given tuple is actually being used. If that first instance is
+ * removed the eventual second instance may actually be used instead.
+ */
+public class AdapterFactoryDescriptorMap extends
+        TreeMap<AdapterFactoryDescriptorKey, AdapterFactoryDescriptor> {
+
+}
diff --git a/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
new file mode 100644
index 0000000..cf0f0e9
--- /dev/null
+++ b/src/main/java/org/apache/sling/osgi/commons/internal/AdapterManagerImpl.java
@@ -0,0 +1,428 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.internal;
+
+import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTABLE_CLASSES;
+import static org.apache.sling.osgi.commons.AdapterFactory.ADAPTER_CLASSES;
+
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.sling.osgi.commons.AdapterFactory;
+import org.apache.sling.osgi.commons.AdapterManager;
+import org.apache.sling.osgi.commons.OsgiUtil;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * The <code>AdapterManagerImpl</code> class implements the
+ * {@link AdapterManager} interface and is registered as a service for that
+ * interface to be used by any clients.
+ * 
+ * @scr.component metatype="no"
+ * @scr.property name="service.description" value="Sling Adapter Manager"
+ * @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * @scr.service
+ * @scr.reference name="AdapterFactory"
+ *                interface="org.apache.sling.osgi.commons.AdapterFactory"
+ *                cardinality="0..n" policy="dynamic"
+ */
+public class AdapterManagerImpl implements AdapterManager {
+
+    /**
+     * The singleton instance of this manager. This field is set when the
+     * instance is {@link #activate(ComponentContext) activated} and cleared
+     * when the instance is {@link #deactivate(ComponentContext) deactivated}.
+     */
+    private static AdapterManager INSTANCE;
+
+    /**
+     * Returns the instance of this class or <code>null</code> if no activate
+     * yet.
+     */
+    public static AdapterManager getInstance() {
+        return INSTANCE;
+    }
+
+    /** @scr.reference cardinality="0..1" policy="dynamic" */
+    private LogService log;
+
+    /** Whether to debug this class or not */
+    private boolean debug = false;
+
+    /**
+     * The OSGi <code>ComponentContext</code> to retrieve
+     * {@link AdapterFactory} service instances.
+     */
+    private ComponentContext context;
+
+    /**
+     * A list of {@link AdapterFactory} services bound to this manager before
+     * the manager has been activated. These bound services will be accessed as
+     * soon as the manager is being activated.
+     */
+    private List<ServiceReference> boundAdapterFactories = new LinkedList<ServiceReference>();
+
+    /**
+     * A map of {@link AdapterFactoryDescriptorMap} instances. The map is
+     * indexed by the fully qualified class names listed in the
+     * {@link AdapterFactory#ADAPTABLE_CLASSES} property of the
+     * {@link AdapterFactory} services.
+     * 
+     * @see AdapterFactoryDescriptorMap
+     */
+    private Map<String, AdapterFactoryDescriptorMap> factories = new HashMap<String, AdapterFactoryDescriptorMap>();
+
+    /**
+     * Matrix of {@link AdapterFactory} instances primarily indexed by the fully
+     * qualified name of the class to be adapted and secondarily indexed by the
+     * fully qualified name of the class to adapt to (the target class).
+     * <p>
+     * This cache is built on demand by calling the
+     * {@link #getAdapterFactories(Class)} class. It is removed altogether
+     * whenever an adapter factory is registered on unregistered.
+     */
+    private Map<String, Map<String, AdapterFactory>> factoryCache;
+
+    // ---------- AdapterManager interface -------------------------------------
+
+    /**
+     * Returns the adapted <code>adaptable</code> or <code>null</code> if
+     * the object cannot be adapted.
+     */
+    public <AdapterType> AdapterType getAdapter(Object adaptable,
+            Class<AdapterType> type) {
+
+        // get the adapter factories for the type of adaptable object
+        Map<String, AdapterFactory> factories = getAdapterFactories(adaptable.getClass());
+
+        // get the factory for the target type
+        AdapterFactory factory = factories.get(type.getName());
+
+        // have the factory adapt the adaptable if the factory exists
+        if (factory != null) {
+            if (debug) {
+                log(LogService.LOG_DEBUG, "Using adapter factory " + factory
+                    + " to map " + adaptable + " to " + type, null);
+            }
+
+            return factory.getAdapter(adaptable, type);
+        }
+
+        // no factory has been found, so we cannot adapt
+        if (debug) {
+            log(LogService.LOG_DEBUG, "No adapter factory found to map "
+                + adaptable + " to " + type, null);
+        }
+
+        return null;
+    }
+
+    // ----------- SCR integration ---------------------------------------------
+
+    protected synchronized void activate(ComponentContext context) {
+        this.context = context;
+
+        // register all adapter factories bound before activation
+        for (ServiceReference reference : boundAdapterFactories) {
+            registerAdapterFactory(context, reference);
+        }
+        boundAdapterFactories.clear();
+
+        // final "enable" this manager by setting the instance
+        // do not overwrite the field if already set (this is unexpected
+        // actually)
+        if (AdapterManagerImpl.INSTANCE == null) {
+            AdapterManagerImpl.INSTANCE = this;
+        } else {
+            log(LogService.LOG_WARNING,
+                "Not setting Instance field: Set to another manager "
+                    + AdapterManagerImpl.INSTANCE, null);
+        }
+    }
+
+    /**
+     * @param context Not used
+     */
+    protected synchronized void deactivate(ComponentContext context) {
+        // "disable" the manager by clearing the instance
+        // do not clear the field if not set to this instance
+        if (AdapterManagerImpl.INSTANCE == this) {
+            AdapterManagerImpl.INSTANCE = null;
+        } else {
+            log(LogService.LOG_WARNING,
+                "Not clearing instance field: Set to another manager "
+                    + AdapterManagerImpl.INSTANCE, null);
+        }
+
+        this.context = null;
+    }
+
+    protected synchronized void bindAdapterFactory(ServiceReference reference) {
+        if (context == null) {
+            boundAdapterFactories.add(reference);
+        } else {
+            registerAdapterFactory(context, reference);
+        }
+    }
+
+    protected synchronized void unbindAdapterFactory(ServiceReference reference) {
+        unregisterAdapterFactory(reference);
+    }
+
+    // ---------- unit testing stuff only --------------------------------------
+
+    /**
+     * Returns the active adapter factories of this manager.
+     * <p>
+     * <strong><em>THIS METHOD IS FOR UNIT TESTING ONLY. IT MAY BE REMOVED OR
+     * MODIFIED WITHOUT NOTICE.</em></strong>
+     */
+    Map<String, AdapterFactoryDescriptorMap> getFactories() {
+        return factories;
+    }
+
+    /**
+     * Returns the current adapter factory cache.
+     * <p>
+     * <strong><em>THIS METHOD IS FOR UNIT TESTING ONLY. IT MAY BE REMOVED OR
+     * MODIFIED WITHOUT NOTICE.</em></strong>
+     */
+    Map<String, Map<String, AdapterFactory>> getFactoryCache() {
+        return factoryCache;
+    }
+
+    // ---------- internal -----------------------------------------------------
+
+    private void log(int level, String message, Throwable t) {
+        LogService logger = this.log;
+        if (logger != null) {
+            logger.log(level, message, t);
+        } else {
+            System.out.println(message);
+            if (t != null) {
+                t.printStackTrace(System.out);
+            }
+        }
+    }
+
+    /**
+     * Unregisters the {@link AdapterFactory} referred to by the service
+     * <code>reference</code> from the registry.
+     */
+    private void registerAdapterFactory(ComponentContext context,
+            ServiceReference reference) {
+        String[] adaptables = OsgiUtil.getProperty(reference, ADAPTABLE_CLASSES);
+        String[] adapters = OsgiUtil.getProperty(reference, ADAPTER_CLASSES);
+
+        if (adaptables == null || adaptables.length == 0 || adapters == null
+            || adapters.length == 0) {
+            return;
+        }
+
+        AdapterFactory factory = (AdapterFactory) context.locateService(
+            "AdapterFactory", reference);
+
+        AdapterFactoryDescriptorKey factoryKey = new AdapterFactoryDescriptorKey(
+            reference);
+        AdapterFactoryDescriptor factoryDesc = new AdapterFactoryDescriptor(
+            factory, adapters);
+
+        synchronized (factories) {
+            for (String adaptable : adaptables) {
+                AdapterFactoryDescriptorMap adfMap = factories.get(adaptable);
+                if (adfMap == null) {
+                    adfMap = new AdapterFactoryDescriptorMap();
+                    factories.put(adaptable, adfMap);
+                }
+                adfMap.put(factoryKey, factoryDesc);
+            }
+        }
+
+        // clear the factory cache to force rebuild on next access
+        factoryCache = null;
+    }
+
+    /**
+     * Unregisters the {@link AdapterFactory} referred to by the service
+     * <code>reference</code> from the registry.
+     */
+    private void unregisterAdapterFactory(ServiceReference reference) {
+        boundAdapterFactories.remove(reference);
+
+        String[] adaptables = OsgiUtil.getProperty(reference, ADAPTABLE_CLASSES);
+
+        if (adaptables == null || adaptables.length == 0) {
+            return;
+        }
+
+        AdapterFactoryDescriptorKey factoryKey = new AdapterFactoryDescriptorKey(
+            reference);
+
+        boolean factoriesModified = false;
+        synchronized (factories) {
+            for (String adaptable : adaptables) {
+                AdapterFactoryDescriptorMap adfMap = factories.get(adaptable);
+                if (adfMap != null) {
+                    factoriesModified |= (adfMap.remove(factoryKey) != null);
+                    if (adfMap.isEmpty()) {
+                        factories.remove(adaptable);
+                    }
+                }
+            }
+        }
+
+        // only remove cache if some adapter factories have actually been
+        // removed
+        if (factoriesModified) {
+            factoryCache = null;
+        }
+    }
+
+    /**
+     * Returns a map of {@link AdapterFactory} instances for the given class to
+     * be adapted. The returned map is indexed by the fully qualified name of
+     * the target classes (to adapt to) registered.
+     * 
+     * @param clazz The type of the object for which the registered adapter
+     *            factories are requested
+     * @return The map of adapter factories. If there is no adapter factory
+     *         registered for this type, the returned map is empty.
+     */
+    private Map<String, AdapterFactory> getAdapterFactories(Class<?> clazz) {
+        Map<String, Map<String, AdapterFactory>> cache = factoryCache;
+        if (cache == null) {
+            cache = new HashMap<String, Map<String, AdapterFactory>>();
+            factoryCache = cache;
+        }
+
+        synchronized (cache) {
+            return getAdapterFactories(clazz, cache);
+        }
+    }
+
+    /**
+     * Returns the map of adapter factories index by adapter (target) class name
+     * for the given adaptable <code>clazz</code>. If no adapter exists for
+     * the <code>clazz</code> and empty map is returned.
+     * 
+     * @param clazz The adaptable <code>Class</code> for which to return the
+     *            adapter factory map by target class name.
+     * @param cache The cache of already defined adapter factory mappings
+     * @return The map of adapter factories by target class name. The map may be
+     *         empty if there is no adapter factory for the adaptable
+     *         <code>clazz</code>.
+     */
+    private Map<String, AdapterFactory> getAdapterFactories(Class<?> clazz,
+            Map<String, Map<String, AdapterFactory>> cache) {
+
+        String className = clazz.getName();
+        Map<String, AdapterFactory> entry = cache.get(className);
+        if (entry == null) {
+            // create entry
+            entry = createAdapterFactoryMap(clazz, cache);
+            cache.put(className, entry);
+        }
+
+        return entry;
+    }
+
+    /**
+     * Creates a new target adapter factory map for the given <code>clazz</code>.
+     * First all factories defined to support the adaptable class by
+     * registration are taken. Next all factories for the implemented interfaces
+     * and finally all base class factories are copied. Later adapter factory
+     * entries do NOT overwrite earlier entries.
+     * 
+     * @param clazz The adaptable <code>Class</code> for which to build the
+     *            adapter factory map by target class name.
+     * @param cache The cache of already defined adapter factory mappings
+     * @return The map of adapter factories by target class name. The map may be
+     *         empty if there is no adapter factory for the adaptable
+     *         <code>clazz</code>.
+     */
+    private Map<String, AdapterFactory> createAdapterFactoryMap(Class<?> clazz,
+            Map<String, Map<String, AdapterFactory>> cache) {
+        Map<String, AdapterFactory> afm = new HashMap<String, AdapterFactory>();
+
+        // AdapterFactories for this class
+        AdapterFactoryDescriptorMap afdMap;
+        synchronized (factories) {
+            afdMap = factories.get(clazz.getName());
+        }
+        if (afdMap != null) {
+            for (AdapterFactoryDescriptor afd : afdMap.values()) {
+                String[] adapters = afd.getAdapters();
+                for (String adapter : adapters) {
+                    if (!afm.containsKey(adapter)) {
+                        afm.put(adapter, afd.getFactory());
+                    }
+                }
+            }
+        }
+
+        // AdapterFactories for the interfaces
+        Class<?>[] interfaces = clazz.getInterfaces();
+        for (Class<?> iFace : interfaces) {
+            copyAdapterFactories(afm, iFace, cache);
+        }
+
+        // AdapterFactories for the super class
+        Class<?> superClazz = clazz.getSuperclass();
+        if (superClazz != null) {
+            copyAdapterFactories(afm, superClazz, cache);
+        }
+
+        return afm;
+    }
+
+    /**
+     * Copies all adapter factories for the given <code>clazz</code> from the
+     * <code>cache</code> to the <code>dest</code> map except for those
+     * factories whose target class already exists in the <code>dest</code>
+     * map.
+     * 
+     * @param dest The map of target class name to adapter factory into which
+     *            additional factories are copied. Existing factories are not
+     *            replaced.
+     * @param clazz The adaptable class whose adapter factories are considered
+     *            for adding into <code>dest</code>.
+     * @param cache The adapter factory cache providing the adapter factories
+     *            for <code>clazz</code> to consider for copying into
+     *            <code>dest</code>.
+     */
+    private void copyAdapterFactories(Map<String, AdapterFactory> dest,
+            Class<?> clazz, Map<String, Map<String, AdapterFactory>> cache) {
+
+        // get the adapter factories for the adaptable clazz
+        Map<String, AdapterFactory> scMap = getAdapterFactories(clazz, cache);
+
+        // for each target class copy the entry to dest if dest does
+        // not contain the target class already
+        for (Map.Entry<String, AdapterFactory> entry : scMap.entrySet()) {
+            if (!dest.containsKey(entry.getKey())) {
+                dest.put(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+}
diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..0a17b94
--- /dev/null
+++ b/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,5 @@
+Apache Sling OSGi Commons
+Copyright 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java b/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java
new file mode 100644
index 0000000..067ec16
--- /dev/null
+++ b/src/test/java/org/apache/sling/osgi/commons/internal/AdapterManagerTest.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.internal;
+
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.sling.osgi.commons.AdapterFactory;
+import org.apache.sling.osgi.commons.SlingAdaptable;
+import org.apache.sling.osgi.commons.mock.MockBundle;
+import org.apache.sling.osgi.commons.mock.MockComponentContext;
+import org.apache.sling.osgi.commons.mock.MockServiceReference;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentContext;
+
+public class AdapterManagerTest extends TestCase {
+
+    private AdapterManagerImpl am;
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        am = new AdapterManagerImpl();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        if (AdapterManagerImpl.getInstance() == am) {
+            am.deactivate(null); // not correct, but argument unused
+        }
+        
+        super.tearDown();
+    }
+    
+    public void testUnitialized() {
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+    }
+
+    public void testInitialized() {
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+    }
+
+    public void testBindBeforeActivate() {
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        // no cache and no factories yet
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+
+        // this should register the factory
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        // expect the factory, but cache is empty
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+    }
+
+    public void testBindAfterActivate() {
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        // no cache and no factories yet
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        // expect the factory, but cache is empty
+        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
+        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
+        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
+
+        Map<String, AdapterFactoryDescriptorMap> f = am.getFactories();
+        AdapterFactoryDescriptorMap afdm = f.get(TestSlingAdaptable.class.getName());
+        assertNotNull(afdm);
+
+        AdapterFactoryDescriptor afd = afdm.get(new AdapterFactoryDescriptorKey(ref));
+        assertNotNull(afd);
+        assertNotNull(afd.getFactory());
+        assertNotNull(afd.getAdapters());
+        assertEquals(1, afd.getAdapters().length);
+        assertEquals(ITestAdapter.class.getName(), afd.getAdapters()[0]);
+
+        assertNull(f.get(TestSlingAdaptable2.class.getName()));
+    }
+
+    public void testAdaptBase() {
+
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        TestSlingAdaptable data = new TestSlingAdaptable();
+        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
+
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        Object adapter = am.getAdapter(data, ITestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof ITestAdapter);
+    }
+
+    public void testAdaptExtended() {
+
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        TestSlingAdaptable2 data = new TestSlingAdaptable2();
+        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
+
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        Object adapter = am.getAdapter(data, ITestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof ITestAdapter);
+    }
+
+    public void testAdaptBase2() {
+
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        TestSlingAdaptable data = new TestSlingAdaptable();
+        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
+
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 2L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable2.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, TestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        Object adapter = am.getAdapter(data, ITestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof ITestAdapter);
+    }
+
+    public void testAdaptExtended2() {
+
+        ComponentContext cc = new MockComponentContext();
+        am.activate(cc);
+
+        Bundle bundle = new MockBundle(1L);
+        MockServiceReference ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 1L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        ref = new MockServiceReference(bundle);
+        ref.setProperty(Constants.SERVICE_ID, 2L);
+        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable2.class.getName() });
+        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, TestAdapter.class.getName());
+        am.bindAdapterFactory(ref);
+
+        TestSlingAdaptable data = new TestSlingAdaptable();
+        Object adapter = am.getAdapter(data, ITestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof ITestAdapter);
+        adapter = am.getAdapter(data, TestAdapter.class);
+        assertNull(adapter);
+
+        TestSlingAdaptable2 data2 = new TestSlingAdaptable2();
+        adapter = am.getAdapter(data2, ITestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof ITestAdapter);
+        adapter = am.getAdapter(data2, TestAdapter.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof TestAdapter);
+    }
+
+    //---------- Test Adaptable and Adapter Classes ---------------------------
+
+    public static class TestSlingAdaptable extends SlingAdaptable {
+
+    }
+
+    public static class TestSlingAdaptable2 extends TestSlingAdaptable {
+
+    }
+
+    public static interface ITestAdapter {
+
+    }
+
+    public static class TestAdapter {
+
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java
new file mode 100644
index 0000000..e833c96
--- /dev/null
+++ b/src/test/java/org/apache/sling/osgi/commons/mock/MockAdapterFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.mock;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.apache.sling.osgi.commons.AdapterFactory;
+
+public class MockAdapterFactory implements AdapterFactory {
+
+    private static final InvocationHandler NOP_INVOCATION_HANDLER = new InvocationHandler() {
+        public Object invoke(Object proxy, Method method, Object[] args)
+                throws Throwable {
+            return null;
+        }
+    };
+
+    @SuppressWarnings("unchecked")
+    public <AdapterType> AdapterType getAdapter(Object adaptable,
+            Class<AdapterType> type) {
+
+        try {
+            if (type.isInterface()) {
+                return (AdapterType) Proxy.newProxyInstance(type.getClassLoader(),
+                    new Class[] { type }, NOP_INVOCATION_HANDLER);
+            }
+
+            return type.newInstance();
+        } catch (Exception e) {
+            // ignore
+        }
+
+        return null;
+    }
+}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
new file mode 100644
index 0000000..13fda4f
--- /dev/null
+++ b/src/test/java/org/apache/sling/osgi/commons/mock/MockBundle.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.mock;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+
+public class MockBundle implements Bundle {
+
+    private long bundleId;
+
+    public MockBundle(long bundleId) {
+        this.bundleId = bundleId;
+    }
+
+    public long getBundleId() {
+        return bundleId;
+    }
+
+    public Enumeration<?> findEntries(String path, String filePattern,
+            boolean recurse) {
+        return null;
+    }
+
+    public URL getEntry(String name) {
+        return null;
+    }
+
+    public Enumeration<?> getEntryPaths(String path) {
+        return null;
+    }
+
+    public Dictionary<?, ?> getHeaders() {
+        return null;
+    }
+
+    public Dictionary<?, ?> getHeaders(String locale) {
+        return null;
+    }
+
+    public long getLastModified() {
+        return 0;
+    }
+
+    public String getLocation() {
+        return null;
+    }
+
+    public ServiceReference[] getRegisteredServices() {
+        return null;
+    }
+
+    public URL getResource(String name) {
+        return null;
+    }
+
+    public Enumeration<?> getResources(String name) {
+        return null;
+    }
+
+    public ServiceReference[] getServicesInUse() {
+        return null;
+    }
+
+    public int getState() {
+        return 0;
+    }
+
+    public String getSymbolicName() {
+        return null;
+    }
+
+    public boolean hasPermission(Object permission) {
+        return false;
+    }
+
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+        throw new ClassNotFoundException(name);
+    }
+
+    public void start() {
+
+    }
+
+    public void stop() {
+
+    }
+
+    public void uninstall() {
+
+    }
+
+    public void update() {
+
+    }
+
+    public void update(InputStream in) {
+
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java
new file mode 100644
index 0000000..159fe44
--- /dev/null
+++ b/src/test/java/org/apache/sling/osgi/commons/mock/MockComponentContext.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.mock;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.sling.osgi.commons.AdapterFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.ComponentInstance;
+
+public class MockComponentContext implements ComponentContext {
+
+    private Map<ServiceReference, AdapterFactory> services = new HashMap<ServiceReference, AdapterFactory>();
+
+    public Object locateService(String name, ServiceReference reference) {
+        AdapterFactory af = services.get(reference);
+        if (af == null) {
+            af = new MockAdapterFactory();
+            services.put(reference, af);
+        }
+        return af;
+    }
+
+    public void disableComponent(String name) {
+    }
+
+    public void enableComponent(String name) {
+    }
+
+    public BundleContext getBundleContext() {
+        return null;
+    }
+
+    public ComponentInstance getComponentInstance() {
+        return null;
+    }
+
+    public Dictionary<?, ?> getProperties() {
+        return null;
+    }
+
+    public ServiceReference getServiceReference() {
+        return null;
+    }
+
+    public Bundle getUsingBundle() {
+        return null;
+    }
+
+    public Object locateService(String name) {
+        return null;
+    }
+
+    public Object[] locateServices(String name) {
+        return null;
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java b/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java
new file mode 100644
index 0000000..e503d96
--- /dev/null
+++ b/src/test/java/org/apache/sling/osgi/commons/mock/MockServiceReference.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.commons.mock;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+public class MockServiceReference implements ServiceReference {
+
+    private Bundle bundle;
+    private Dictionary<String, Object> props;
+
+    public MockServiceReference(Bundle bundle) {
+        this.bundle = bundle;
+        this.props = new Hashtable<String, Object>();
+    }
+
+    public Bundle getBundle() {
+        return bundle;
+    }
+
+    public void setProperty(String key, Object value) {
+        props.put(key, value);
+    }
+
+    public Object getProperty(String key) {
+        return props.get(key);
+    }
+
+    public String[] getPropertyKeys() {
+        return Collections.list(props.keys()).toArray(new String[props.size()]);
+    }
+
+    public Bundle[] getUsingBundles() {
+        return null;
+    }
+
+    public boolean isAssignableTo(Bundle bundle, String className) {
+        return false;
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 38/38: Move Sling to new TLP location

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 4dcf4e624fe7ba0d80def67a48b4865c82572782
Merge: 3fa1dbb 67f17d9
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Jun 18 09:21:02 2009 +0000

    Move Sling to new TLP location
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator@785979 13f79535-47bb-0310-9956-ffa450edef68


-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 19/38: SLING-442: Clean up exports, imports, dependencies and used plugins.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 554a87fe81bd7f3cbf5dbf75a60310f42d1cde7b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon May 26 14:43:58 2008 +0000

    SLING-442: Clean up exports, imports, dependencies and used plugins.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@660202 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index cf0b96b..7186dca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,10 +50,6 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <extensions>true</extensions>
                 <configuration>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 31/38: SLING-521: Restore more notice files.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit b13381d3577096f0a29b1b984c8da00e00a240cc
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jun 10 14:28:07 2008 +0000

    SLING-521: Restore more notice files.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@666121 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/NOTICE b/NOTICE
index 80c41a6..73541f0 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,10 +1,9 @@
-Apache Sling - Commons OSGi support
+Apache Sling Commons OSGi
+Copyright 2007-2008 The Apache Software Foundation
 
-Apache Sling
-Copyright 2008 The Apache Software Foundation
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-
-Apache Sling is based on source code originally developed 
-by Day Software (http://www.day.com/).
+Licensed under the Apache License 2.0.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 30/38: Fix reference to parent pom.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit b65ac419c33c6f39d26967d2f702c792e26f7db7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jun 5 05:51:38 2008 +0000

    Fix reference to parent pom.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663458 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 41fb6c6..489ff6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>1-incubator</version>
+        <version>2-incubator-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 37/38: Move Sling to new TLP location

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 3fa1dbb851a750364813f57ffb45033f15d9c864
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Jun 18 09:21:02 2009 +0000

    Move Sling to new TLP location
    
    git-svn-id: https://svn.eu.apache.org/repos/asf/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator@785979 13f79535-47bb-0310-9956-ffa450edef68
---
 LICENSE                                            | 202 ++++++++++++
 NOTICE                                             |   8 +
 README.txt                                         |  37 +++
 pom.xml                                            |  83 +++++
 .../apache/sling/commons/osgi/ManifestHeader.java  | 344 +++++++++++++++++++++
 .../org/apache/sling/commons/osgi/OsgiUtil.java    | 236 ++++++++++++++
 src/main/resources/META-INF/DISCLAIMER             |   7 +
 src/main/resources/META-INF/LICENSE                | 202 ++++++++++++
 src/main/resources/META-INF/NOTICE                 |   9 +
 .../sling/commons/osgi/ManifestHeaderTest.java     |  89 ++++++
 10 files changed, 1217 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..5b7d685
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,8 @@
+Apache Sling Commons OSGi
+Copyright 2008 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..5ce8754
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,37 @@
+Apache Sling Commons OSGi
+
+The Commons OSGi library provides utility methods when implementing OSGi related services
+and components.
+
+Disclaimer
+==========
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+If you have Maven 2 installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi
+
+See the Subversion documentation for other source control features.
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..ef80e9d
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>3-incubator</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.commons.osgi</artifactId>
+    <version>2.0.2-incubator</version>
+    <packaging>bundle</packaging>
+
+    <name>Sling - Commons OSGi support</name>
+    <description>Commons OSGi</description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</developerConnection>
+        <url>http://svn.apache.org/viewvc/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.2-incubator</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.sling.commons.osgi;version=${pom.version}
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.0.2-incubator</version>
+        </dependency>
+
+        <!-- OSGi Libraries -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
new file mode 100644
index 0000000..72c951b
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/osgi/ManifestHeader.java
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.osgi;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This is a helper class to parse manifest header entries.
+ */
+public class ManifestHeader {
+
+    /**
+     * A header can have several entries separated by comma.
+     */
+    public interface Entry {
+
+        /**
+         * The value of the entry.
+         */
+        String getValue();
+
+        /**
+         * The attributes specified for this entry.
+         */
+        NameValuePair[] getAttributes();
+
+        /**
+         * The directives for this entry.
+         */
+        NameValuePair[] getDirectives();
+
+        String getAttributeValue(String name);
+
+        String getDirectiveValue(String name);
+}
+
+    /** The entries for this header. */
+    private Entry[] entries = new Entry[0];
+
+    /**
+     * Add new entries from parsing.
+     */
+    private void add(Entry[] paths) {
+        if ( paths != null && paths.length > 0 ) {
+            final Entry[] copy = new Entry[this.entries.length + paths.length];
+            System.arraycopy(this.entries, 0, copy, 0, this.entries.length);
+            System.arraycopy(paths, 0, copy, this.entries.length, paths.length);
+            this.entries = copy;
+        }
+    }
+
+    /**
+     * Return the entries for this header.
+     */
+    public Entry[] getEntries() {
+        return this.entries;
+    }
+
+    /**
+     * Directives and attributes are simple name/value pairs.
+     */
+    public final static class NameValuePair {
+
+        private final String name;
+        private final String value;
+
+        public NameValuePair(String name, String value) {
+            this.name = name;
+            this.value = value;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    private static final String CLASS_PATH_SEPARATOR = ",";
+    private static final String PACKAGE_SEPARATOR = ";";
+    private static final String DIRECTIVE_SEPARATOR = ":=";
+    private static final String ATTRIBUTE_SEPARATOR = "=";
+
+    /**
+     * Parse headers
+     * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
+     *            path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
+     * The returned object maintains the order of entries (paths), directives and attributes.
+     */
+    public static ManifestHeader parse(String header) {
+        final ManifestHeader entry = new ManifestHeader();
+
+        if (header != null) {
+            if (header.length() == 0) {
+                throw new IllegalArgumentException("A header cannot be an empty string.");
+            }
+
+            final String[] clauseStrings = parseDelimitedString(header, CLASS_PATH_SEPARATOR);
+            if ( clauseStrings != null ) {
+                for(final String clause : clauseStrings) {
+                    entry.add(parseStandardHeaderClause(clause));
+                }
+            }
+        }
+
+        return (entry.getEntries().length == 0) ? null : entry;
+    }
+
+    /**
+     * Parse a clause
+     * Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
+     */
+    private static ManifestHeader.Entry[] parseStandardHeaderClause(String clauseString)
+    throws IllegalArgumentException {
+        // Break string into semi-colon delimited pieces.
+        String[] pieces = parseDelimitedString(clauseString, PACKAGE_SEPARATOR);
+
+        // Count the number of different paths; paths
+        // will not have an '=' in their string. This assumes
+        // that paths come first, before directives and
+        // attributes.
+        int pathCount = 0;
+        for (int pieceIdx = 0; pieceIdx < pieces.length; pieceIdx++) {
+            if (pieces[pieceIdx].indexOf('=') >= 0) {
+                break;
+            }
+            pathCount++;
+        }
+
+        // Error if no paths were specified.
+        if (pathCount == 0) {
+            throw new IllegalArgumentException(
+                "No paths specified in header: " + clauseString);
+        }
+
+        // Create an array of paths.
+        PathImpl[] paths = new PathImpl[pathCount];
+        for(int i=0;i<pathCount;i++) {
+            paths[i] = new PathImpl(pieces[i]);
+        }
+
+        // Parse the directives/attributes
+        // and keep the order
+        // for simpliefied checking if a directive/attribute is used twice, we keep
+        // two collections: one for the values and one for the names
+        final List<ManifestHeader.NameValuePair> dirsList = new ArrayList<ManifestHeader.NameValuePair>();
+        final Set<String> dirsNames = new HashSet<String>();
+        final List<ManifestHeader.NameValuePair> attrsList = new ArrayList<ManifestHeader.NameValuePair>();
+        final Set<String> attrsNames = new HashSet<String>();
+
+        int idx = -1;
+        String sep = null;
+        for (int pieceIdx = pathCount; pieceIdx < pieces.length; pieceIdx++) {
+
+            if ((idx = pieces[pieceIdx].indexOf(DIRECTIVE_SEPARATOR)) >= 0) {
+                sep = DIRECTIVE_SEPARATOR;
+            } else if ((idx = pieces[pieceIdx].indexOf(ATTRIBUTE_SEPARATOR)) >= 0) {
+                sep = ATTRIBUTE_SEPARATOR;
+            } else {
+                throw new IllegalArgumentException("Not a directive/attribute: " + clauseString);
+            }
+
+            final String key = pieces[pieceIdx].substring(0, idx).trim();
+            String value = pieces[pieceIdx].substring(idx + sep.length()).trim();
+
+            // Remove quotes, if value is quoted.
+            if (value.startsWith("\"") && value.endsWith("\"")) {
+                value = value.substring(1, value.length() - 1);
+            }
+
+            // Save the directive/attribute in the appropriate array.
+            if (sep.equals(DIRECTIVE_SEPARATOR)) {
+                // Check for duplicates.
+                if (dirsNames.contains(key)) {
+                    throw new IllegalArgumentException("Duplicate directive: " + key);
+                }
+                dirsList.add(new ManifestHeader.NameValuePair(key, value));
+                dirsNames.add(key);
+            } else {
+                // Check for duplicates.
+                if (attrsNames.contains(key)) {
+                    throw new IllegalArgumentException("Duplicate attribute: " + key);
+                }
+                attrsList.add(new ManifestHeader.NameValuePair(key, value));
+                attrsNames.add(key);
+            }
+        }
+        // Create directive array.
+        ManifestHeader.NameValuePair[] dirs =
+            dirsList.toArray(new ManifestHeader.NameValuePair[dirsList.size()]);
+
+        // Create attribute array.
+        ManifestHeader.NameValuePair[] attrs =
+            attrsList.toArray(new ManifestHeader.NameValuePair[attrsList.size()]);
+
+        // now set attributes and directives for each path
+        for(int i=0;i<pathCount;i++) {
+            paths[i].init(dirs, attrs);
+        }
+
+        return paths;
+    }
+
+    private static final int CHAR = 1;
+    private static final int DELIMITER = 2;
+    private static final int STARTQUOTE = 4;
+    private static final int ENDQUOTE = 8;
+
+    /**
+     * Parses delimited string and returns an array containing the tokens. This
+     * parser obeys quotes, so the delimiter character will be ignored if it is
+     * inside of a quote. This method assumes that the quote character is not
+     * included in the set of delimiter characters.
+     * @param value the delimited string to parse.
+     * @param delim the characters delimiting the tokens.
+     * @return an array of string tokens or null if there were no tokens.
+     **/
+    private static String[] parseDelimitedString(String value, String delim) {
+        if (value == null) {
+           value = "";
+        }
+
+        final List<String> list = new ArrayList<String>();
+
+        final StringBuffer sb = new StringBuffer();
+
+        int expecting = (CHAR | DELIMITER | STARTQUOTE);
+
+        for (int i = 0; i < value.length(); i++) {
+            char c = value.charAt(i);
+
+            boolean isDelimiter = (delim.indexOf(c) >= 0);
+            boolean isQuote = (c == '"');
+
+            if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+                list.add(sb.toString().trim());
+                sb.delete(0, sb.length());
+                expecting = (CHAR | DELIMITER | STARTQUOTE);
+            } else if (isQuote && ((expecting & STARTQUOTE) > 0)) {
+                sb.append(c);
+                expecting = CHAR | ENDQUOTE;
+            } else if (isQuote && ((expecting & ENDQUOTE) > 0)) {
+                sb.append(c);
+                expecting = (CHAR | STARTQUOTE | DELIMITER);
+            } else if ((expecting & CHAR) > 0) {
+                sb.append(c);
+            } else {
+                throw new IllegalArgumentException("Invalid delimited string: " + value);
+            }
+        }
+
+        if (sb.length() > 0) {
+            list.add(sb.toString().trim());
+        }
+
+        if ( list.size() == 0 ) {
+            return null;
+        }
+        return list.toArray(new String[list.size()]);
+    }
+
+    protected static final class PathImpl implements ManifestHeader.Entry {
+
+        private final String value;
+
+        private NameValuePair[] attributes;
+        private NameValuePair[] directives;
+
+        public PathImpl(final String path) {
+            this.value = path;
+        }
+
+        public void init(NameValuePair[] dirs, NameValuePair[] attrs) {
+            this.directives = dirs;
+            this.attributes = attrs;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getAttributes()
+         */
+        public NameValuePair[] getAttributes() {
+            return this.attributes;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getDirectives()
+         */
+        public NameValuePair[] getDirectives() {
+            return this.directives;
+        }
+
+        /**
+         * @see org.apache.sling.commons.osgi.ManifestHeader.Entry#getValue()
+         */
+        public String getValue() {
+            return this.value;
+        }
+
+        public String getAttributeValue(String name) {
+            String v = null;
+            int index = 0;
+            while ( v == null && index < attributes.length ) {
+                if ( attributes[index].getName().equals(name) ) {
+                    v = attributes[index].getValue();
+                }
+                index++;
+            }
+            return v;
+        }
+
+        public String getDirectiveValue(String name) {
+            String v = null;
+            int index = 0;
+            while ( v == null && index < directives.length ) {
+                if ( directives[index].getName().equals(name) ) {
+                    v = directives[index].getValue();
+                }
+                index++;
+            }
+            return v;
+        }
+    }
+}
diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
new file mode 100644
index 0000000..0635570
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.osgi;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventConstants;
+
+/**
+ * The <code>OsgiUtil</code> is a utility class providing some usefull utility
+ * methods.
+ */
+public class OsgiUtil {
+
+    /**
+     * Returns the boolean value of the named service reference property or the
+     * <code>defaultValue</code> if no such service reference property exist.
+     * If the service property is not a <code>Boolean</code> it is converted
+     * by calling <code>Boolean.valueOf</code> on the string value of the
+     * property.
+     */
+    public static boolean toBoolean(Object propValue, boolean defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Boolean) {
+            return (Boolean) propValue;
+        } else if (propValue != null) {
+            return Boolean.valueOf(String.valueOf(propValue));
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a string or the
+     * <code>defaultValue</code> if no such reference property exists.
+     */
+    public static String toString(Object propValue, String defaultValue) {
+        propValue = toObject(propValue);
+        return (propValue != null) ? propValue.toString() : defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a long or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Integer</code> and cannot be converted to
+     * a <code>Long</code> from the property's string value.
+     */
+    public static long toLong(Object propValue, long defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Long) {
+            return (Long) propValue;
+        } else if (propValue != null) {
+            try {
+                return Long.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as an integer or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Integer</code> and cannot be converted to
+     * an <code>Integer</code> from the property's string value.
+     */
+    public static int toInteger(Object propValue, int defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Integer) {
+            return (Integer) propValue;
+        } else if (propValue != null) {
+            try {
+                return Integer.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a double or the
+     * <code>defaultValue</code> if no such reference property exists or if
+     * the property is not an <code>Double</code> and cannot be converted to
+     * an <code>Double</code> from the property's string value.
+     */
+    public static double getProperty(Object propValue, double defaultValue) {
+        propValue = toObject(propValue);
+        if (propValue instanceof Double) {
+            return (Double) propValue;
+        } else if (propValue != null) {
+            try {
+                return Double.valueOf(String.valueOf(propValue));
+            } catch (NumberFormatException nfe) {
+                // don't care, fall through to default value
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * Returns the named service reference property as a single value. If the
+     * property is neither an array nor a <code>java.util.Vector</code> the
+     * property is returned unmodified. If the property is a non-empty array,
+     * the first array element is returned. If the property is a non-empty
+     * <code>java.util.Vector</code>, the first vector element is returned.
+     * Otherwise <code>null</code> is returned.
+     */
+    public static Object toObject(Object propValue) {
+        if (propValue == null) {
+            return null;
+        } else if (propValue.getClass().isArray()) {
+            Object[] prop = (Object[]) propValue;
+            return prop.length > 0 ? prop[0] : null;
+        } else if (propValue instanceof Vector) {
+            Vector<?> prop = (Vector<?>) propValue;
+            return prop.isEmpty() ? null : prop.get(0);
+        } else {
+            return propValue;
+        }
+    }
+
+    /**
+     * Returns the named service reference property as an array of Strings. If
+     * the property is a scalar value its string value is returned as a single
+     * element array. If the property is an array, the elements are converted to
+     * String objects and returned as an array. If the property is a vector, the
+     * vector elements are converted to String objects and returned as an array.
+     * Otherwise (if the property does not exist) <code>null</code> is
+     * returned.
+     */
+    public static String[] toStringArray(Object propValue) {
+        if (propValue == null) {
+            // no value at all
+            return null;
+
+        } else if (propValue instanceof String) {
+            // single string
+            return new String[] { (String) propValue };
+
+        } else if (propValue instanceof String[]) {
+            // String[]
+            return (String[]) propValue;
+
+        } else if (propValue.getClass().isArray()) {
+            // other array
+            Object[] valueArray = (Object[]) propValue;
+            List<String> values = new ArrayList<String>(valueArray.length);
+            for (Object value : valueArray) {
+                if (value != null) {
+                    values.add(value.toString());
+                }
+            }
+            return values.toArray(new String[values.size()]);
+
+        } else if (propValue instanceof Vector) {
+            // vector
+            Vector<?> valueVector = (Vector<?>) propValue;
+            List<String> values = new ArrayList<String>(valueVector.size());
+            for (Object value : valueVector) {
+                if (value != null) {
+                    values.add(value.toString());
+                }
+            }
+            return values.toArray(new String[values.size()]);
+        }
+
+        return null;
+    }
+
+    public static Event createEvent(Bundle sourceBundle,
+            ServiceReference sourceService, String eventName,
+            Map<String, Object> props) {
+
+        // get a private copy of the properties
+        Dictionary<String, Object> table = new Hashtable<String, Object>(props);
+
+        // service information of this JcrResourceResolverFactoryImpl service
+        if (sourceService != null) {
+            table.put(EventConstants.SERVICE, sourceService);
+            table.put(
+                EventConstants.SERVICE_ID,
+                sourceService.getProperty(org.osgi.framework.Constants.SERVICE_ID));
+            table.put(
+                EventConstants.SERVICE_OBJECTCLASS,
+                sourceService.getProperty(org.osgi.framework.Constants.OBJECTCLASS));
+            if (sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID) != null) {
+                table.put(
+                    EventConstants.SERVICE_PID,
+                    sourceService.getProperty(org.osgi.framework.Constants.SERVICE_PID));
+            }
+        }
+
+        // source bundle information (if available)
+        if (sourceBundle != null) {
+            table.put(EventConstants.BUNDLE_SYMBOLICNAME,
+                sourceBundle.getSymbolicName());
+        }
+
+        // timestamp the event
+        table.put(EventConstants.TIMESTAMP,
+            new Long(System.currentTimeMillis()));
+
+        // create the event
+        return new Event(eventName, table);
+    }
+
+}
diff --git a/src/main/resources/META-INF/DISCLAIMER b/src/main/resources/META-INF/DISCLAIMER
new file mode 100644
index 0000000..90850c2
--- /dev/null
+++ b/src/main/resources/META-INF/DISCLAIMER
@@ -0,0 +1,7 @@
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
\ No newline at end of file
diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..688b491
--- /dev/null
+++ b/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,9 @@
+Apache Sling Commons OSGi
+Copyright 2008 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
new file mode 100644
index 0000000..da43902
--- /dev/null
+++ b/src/test/java/org/apache/sling/commons/osgi/ManifestHeaderTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.osgi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the manifest header parsing.
+ */
+public class ManifestHeaderTest extends TestCase {
+
+    public void testNonExisting() {
+        String header = null;
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertNull(entry);
+    }
+
+    public void testSinglePath() {
+        String header = "something";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals(header, entry.getEntries()[0].getValue());
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+    }
+
+    public void testSeveralPaths() {
+        String header = "one,two,   three    ,\n   four, \n   five";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(5, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+        assertEquals("two", entry.getEntries()[1].getValue());
+        assertEquals(0, entry.getEntries()[1].getAttributes().length);
+        assertEquals(0, entry.getEntries()[1].getDirectives().length);
+        assertEquals("three", entry.getEntries()[2].getValue());
+        assertEquals(0, entry.getEntries()[2].getAttributes().length);
+        assertEquals(0, entry.getEntries()[2].getDirectives().length);
+        assertEquals("four", entry.getEntries()[3].getValue());
+        assertEquals(0, entry.getEntries()[3].getAttributes().length);
+        assertEquals(0, entry.getEntries()[3].getDirectives().length);
+        assertEquals("five", entry.getEntries()[4].getValue());
+        assertEquals(0, entry.getEntries()[4].getAttributes().length);
+        assertEquals(0, entry.getEntries()[4].getDirectives().length);
+    }
+
+    public void testAttributes() {
+        String header = "one;a=1;b=2";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(2, entry.getEntries()[0].getAttributes().length);
+        assertEquals(0, entry.getEntries()[0].getDirectives().length);
+        assertEquals("a", entry.getEntries()[0].getAttributes()[0].getName());
+        assertEquals("b", entry.getEntries()[0].getAttributes()[1].getName());
+        assertEquals("1", entry.getEntries()[0].getAttributes()[0].getValue());
+        assertEquals("2", entry.getEntries()[0].getAttributes()[1].getValue());
+    }
+
+    public void testDirectives() {
+        String header = "one;a:=1;b:=2";
+        final ManifestHeader entry = ManifestHeader.parse(header);
+        assertEquals(1, entry.getEntries().length);
+        assertEquals("one", entry.getEntries()[0].getValue());
+        assertEquals(2, entry.getEntries()[0].getDirectives().length);
+        assertEquals(0, entry.getEntries()[0].getAttributes().length);
+        assertEquals("a", entry.getEntries()[0].getDirectives()[0].getName());
+        assertEquals("b", entry.getEntries()[0].getDirectives()[1].getName());
+        assertEquals("1", entry.getEntries()[0].getDirectives()[0].getValue());
+        assertEquals("2", entry.getEntries()[0].getDirectives()[1].getValue());
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 33/38: SLING-521: Separate between notice files for bin and src dists.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 997457a2fd4d36f209785e50da22f94287355c65
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jun 13 10:58:09 2008 +0000

    SLING-521: Separate between notice files for bin and src dists.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@667471 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.txt b/README.txt
index fdeccc6..2ca762d 100644
--- a/README.txt
+++ b/README.txt
@@ -1,3 +1,6 @@
+Apache Sling Commons OSGi
+
+
 WE NEED A LOT MORE HERE!!!!!!!!!!!!!!!!!!
 
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 11/38: Update notice files.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 88669273b429786a2b0d62f7bea59b05632cb816
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 14 16:05:27 2008 +0000

    Update notice files.
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/osgi/commons@647874 13f79535-47bb-0310-9956-ffa450edef68
---
 NOTICE | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/NOTICE b/NOTICE
index 0a17b94..6b9b1b5 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,9 @@
 Apache Sling OSGi Commons
-Copyright 2007 The Apache Software Foundation
+Copyright 2007-2008 The Apache Software Foundation
+
+Based on source code originally developed by
+Day Software (http://www.day.com/).
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-osgi] 28/38: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 078fd76c56f183005d93ce889635d5c5006eb438
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jun 4 15:13:36 2008 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi@663173 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index bfff28c..ae559a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
     </parent>
 
     <artifactId>org.apache.sling.commons.osgi</artifactId>
-    <version>2.0.0-incubator</version>
+    <version>2.0.1-incubator-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Sling - Commons OSGi support</name>
     <description>Commons OSGi</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</developerConnection>
-        <url>http://svn.apache.org/viewvc/incubator/sling/tags/org.apache.sling.commons.osgi-2.0.0-incubator</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/osgi</developerConnection>
+        <url>http://svn.apache.org/viewvc/incubator/sling/trunk/commons/osgi</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.