SLING-4514: Generating OSGI configs from content and starting services using osgi services

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1641561 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/distribution/agent/DistributionAgent.java b/src/main/java/org/apache/sling/distribution/agent/DistributionAgent.java
index b3f19e3..8b62cf3 100644
--- a/src/main/java/org/apache/sling/distribution/agent/DistributionAgent.java
+++ b/src/main/java/org/apache/sling/distribution/agent/DistributionAgent.java
@@ -25,7 +25,6 @@
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.distribution.communication.DistributionRequest;
 import org.apache.sling.distribution.communication.DistributionResponse;
-import org.apache.sling.distribution.component.DistributionComponent;
 import org.apache.sling.distribution.queue.DistributionQueue;
 
 /**
@@ -36,7 +35,7 @@
  * other instances.
  */
 @ProviderType
-public interface DistributionAgent extends DistributionComponent {
+public interface DistributionAgent {
 
     /**
      * retrieves the names of the queues for this agent.
diff --git a/src/main/java/org/apache/sling/distribution/agent/DistributionRequestAuthorizationStrategy.java b/src/main/java/org/apache/sling/distribution/agent/DistributionRequestAuthorizationStrategy.java
index c74f164..791076e 100644
--- a/src/main/java/org/apache/sling/distribution/agent/DistributionRequestAuthorizationStrategy.java
+++ b/src/main/java/org/apache/sling/distribution/agent/DistributionRequestAuthorizationStrategy.java
@@ -23,13 +23,12 @@
 import aQute.bnd.annotation.ConsumerType;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.distribution.communication.DistributionRequest;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * Strategy for authorizing requests
  */
 @ConsumerType
-public interface DistributionRequestAuthorizationStrategy extends DistributionComponent {
+public interface DistributionRequestAuthorizationStrategy {
 
     /**
      * @param resourceResolver   a {@link org.apache.sling.api.resource.ResourceResolver} representing the calling 'user'
diff --git a/src/main/java/org/apache/sling/distribution/component/DistributionComponent.java b/src/main/java/org/apache/sling/distribution/component/DistributionComponent.java
deleted file mode 100644
index 2e5145b..0000000
--- a/src/main/java/org/apache/sling/distribution/component/DistributionComponent.java
+++ /dev/null
@@ -1,31 +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.distribution.component;
-
-import aQute.bnd.annotation.ConsumerType;
-
-/**
- * Marker interface for Sling Distribution components like: {@link org.apache.sling.distribution.agent.DistributionAgent}s,
- * {@link org.apache.sling.distribution.trigger.DistributionTrigger}s, {@link org.apache.sling.distribution.packaging.DistributionPackageExporter}s
- * and {@link org.apache.sling.distribution.packaging.DistributionPackageImporter}s.
- */
-@ConsumerType
-public interface DistributionComponent {
-
-}
diff --git a/src/main/java/org/apache/sling/distribution/component/DistributionComponentFactory.java b/src/main/java/org/apache/sling/distribution/component/DistributionComponentFactory.java
deleted file mode 100644
index bddb97e..0000000
--- a/src/main/java/org/apache/sling/distribution/component/DistributionComponentFactory.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.distribution.component;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.Map;
-
-import aQute.bnd.annotation.ConsumerType;
-import aQute.bnd.annotation.ProviderType;
-
-/**
- * factory for {@link DistributionComponent}s.
- * A client should register a component factory if it has custom implementations of distribution components.
- * As components are hierarchical a factory can delegate the creation of its sub components to another factory.
- */
-@ConsumerType
-public interface DistributionComponentFactory {
-
-
-    /**
-     * create a {@link DistributionComponent}
-     *
-     * @param type              the {@link java.lang.Class} of the component to be created
-     * @param properties        the properties to be supplied for the initialization of the component
-     * @param <ComponentType>   the actual type of the {@link DistributionComponent}
-     *                          to be created
-     * @param subComponentFactory   the factory to be called for creating sub components
-     * @return a {@link DistributionComponent} of the specified type initialized with given properties or {@code null}
-     * if that could not be created
-     */
-    @CheckForNull
-    <ComponentType extends DistributionComponent> ComponentType createComponent(@Nonnull java.lang.Class<ComponentType> type,
-                                                                               @Nonnull Map<String, Object> properties,
-                                                                               @Nullable DistributionComponentFactory subComponentFactory);
-}
diff --git a/src/main/java/org/apache/sling/distribution/component/DistributionComponentProvider.java b/src/main/java/org/apache/sling/distribution/component/DistributionComponentProvider.java
deleted file mode 100644
index 5f9218e..0000000
--- a/src/main/java/org/apache/sling/distribution/component/DistributionComponentProvider.java
+++ /dev/null
@@ -1,48 +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.distribution.component;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import aQute.bnd.annotation.ProviderType;
-
-/**
- * provider for already existing {@link DistributionComponent}s
- */
-@ProviderType
-public interface DistributionComponentProvider {
-
-    /**
-     * Retrieves an already existing component by name.
-     * If {@code null} is passed as componentName then a default component is returned.
-     *
-     * @param type            the {@link java.lang.Class} of the component to be retrieved
-     * @param componentName   the component name
-     * @param <ComponentType> the actual type of the {@link DistributionComponent}
-     *                        to be retrieved
-     * @return the {@link DistributionComponent} of the specified type,
-     * with the specified name, or {@code null} if such a {@link DistributionComponent}
-     * doesn't exist
-     */
-    @CheckForNull
-    <ComponentType extends DistributionComponent> ComponentType getComponent(@Nonnull java.lang.Class<ComponentType> type,
-                                                                            @Nullable String componentName);
-}
diff --git a/src/main/java/org/apache/sling/distribution/component/ManagedDistributionComponent.java b/src/main/java/org/apache/sling/distribution/component/ManagedDistributionComponent.java
deleted file mode 100644
index dd25a75..0000000
--- a/src/main/java/org/apache/sling/distribution/component/ManagedDistributionComponent.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.distribution.component;
-
-import aQute.bnd.annotation.ConsumerType;
-
-/**
- * A managed {@link DistributionComponent} is a component which requires explicit
- * initialization and releasing of its underlying (and implementation specific) resources.
- */
-@ConsumerType
-public interface ManagedDistributionComponent extends DistributionComponent {
-
-    /**
-     * Enable the component
-     */
-    void enable();
-
-    /**
-     * Disable the component
-     */
-    void disable();
-
-}
diff --git a/src/main/java/org/apache/sling/distribution/component/package-info.java b/src/main/java/org/apache/sling/distribution/component/package-info.java
deleted file mode 100644
index d50ff91..0000000
--- a/src/main/java/org/apache/sling/distribution/component/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-
-@Version("0.1.0")
-package org.apache.sling.distribution.component;
-
-import aQute.bnd.annotation.Version;
-
diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java
index 8525abf..a5e0c13 100644
--- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java
+++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java
@@ -26,7 +26,6 @@
 import aQute.bnd.annotation.ConsumerType;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.distribution.communication.DistributionRequest;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * A {@link DistributionPackageExporter ) is responsible of exporting
@@ -38,7 +37,7 @@
  * executing an HTTP request to another Sling instance exposing already created packages (for remotely changed resources).
  */
 @ConsumerType
-public interface DistributionPackageExporter extends DistributionComponent {
+public interface DistributionPackageExporter {
 
     /**
      * Exports the {@link DistributionPackage}s built from the
diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java
index 46b4092..a97b215 100644
--- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java
+++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java
@@ -24,14 +24,13 @@
 
 import aQute.bnd.annotation.ConsumerType;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * A {@link DistributionPackageImporter} is responsible for importing
  * {@link DistributionPackage}s into the resource tree.
  */
 @ConsumerType
-public interface DistributionPackageImporter extends DistributionComponent {
+public interface DistributionPackageImporter {
 
     /**
      * Imports the given distribution package into the underlying system
diff --git a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueDispatchingStrategy.java b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueDispatchingStrategy.java
index 79a0f1f..4f58255 100644
--- a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueDispatchingStrategy.java
+++ b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueDispatchingStrategy.java
@@ -22,7 +22,6 @@
 import java.util.List;
 
 import aQute.bnd.annotation.ConsumerType;
-import org.apache.sling.distribution.component.DistributionComponent;
 import org.apache.sling.distribution.packaging.DistributionPackage;
 
 /**
@@ -34,7 +33,7 @@
  * (one for each queue) for a certain package.
  */
 @ConsumerType
-public interface DistributionQueueDispatchingStrategy extends DistributionComponent {
+public interface DistributionQueueDispatchingStrategy {
     String DEFAULT_QUEUE_NAME = "default";
 
     /**
diff --git a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueProvider.java b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueProvider.java
index 722c014..31f754b 100644
--- a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueProvider.java
+++ b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueProvider.java
@@ -21,13 +21,12 @@
 import javax.annotation.Nonnull;
 
 import aQute.bnd.annotation.ConsumerType;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * A provider for {@link DistributionQueue}s
  */
 @ConsumerType
-public interface DistributionQueueProvider extends DistributionComponent {
+public interface DistributionQueueProvider {
 
     /**
      * provide a named queue for the given agent
diff --git a/src/main/java/org/apache/sling/distribution/transport/authentication/TransportAuthenticationProvider.java b/src/main/java/org/apache/sling/distribution/transport/authentication/TransportAuthenticationProvider.java
index 5225a1f..a956dc3 100644
--- a/src/main/java/org/apache/sling/distribution/transport/authentication/TransportAuthenticationProvider.java
+++ b/src/main/java/org/apache/sling/distribution/transport/authentication/TransportAuthenticationProvider.java
@@ -19,7 +19,6 @@
 package org.apache.sling.distribution.transport.authentication;
 
 import aQute.bnd.annotation.ConsumerType;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * A {@link org.apache.sling.distribution.transport.authentication.TransportAuthenticationProvider} is responsible for
@@ -29,7 +28,7 @@
  *
  */
 @ConsumerType
-public interface TransportAuthenticationProvider<A, T> extends DistributionComponent {
+public interface TransportAuthenticationProvider<A, T> {
 
     /**
      * Check if this provider is able to authenticate objects belonging to given 'authenticable' class.
diff --git a/src/main/java/org/apache/sling/distribution/trigger/DistributionTrigger.java b/src/main/java/org/apache/sling/distribution/trigger/DistributionTrigger.java
index f24dca2..5525a7f 100644
--- a/src/main/java/org/apache/sling/distribution/trigger/DistributionTrigger.java
+++ b/src/main/java/org/apache/sling/distribution/trigger/DistributionTrigger.java
@@ -21,7 +21,6 @@
 import javax.annotation.Nonnull;
 
 import aQute.bnd.annotation.ConsumerType;
-import org.apache.sling.distribution.component.DistributionComponent;
 
 /**
  * A {@link DistributionTrigger} is responsible to trigger
@@ -31,7 +30,7 @@
  * {@link DistributionRequestHandler} can be registered into the same trigger.
  */
 @ConsumerType
-public interface DistributionTrigger extends DistributionComponent {
+public interface DistributionTrigger {
 
     /**
      * register a request handler to be triggered and returns a corresponding registration id