You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2013/05/07 12:25:15 UTC

svn commit: r1479841 [1/3] - in /ace/trunk: org.apache.ace.agent.itest/ org.apache.ace.agent.itest/.settings/ org.apache.ace.agent.itest/resources/ org.apache.ace.agent.itest/src/ org.apache.ace.agent.itest/src/org/ org.apache.ace.agent.itest/src/org/a...

Author: bramk
Date: Tue May  7 10:25:13 2013
New Revision: 1479841

URL: http://svn.apache.org/r1479841
Log:
ACE-347 First drop of redesigned agent

Added:
    ace/trunk/org.apache.ace.agent/
    ace/trunk/org.apache.ace.agent.itest/
    ace/trunk/org.apache.ace.agent.itest/.classpath
    ace/trunk/org.apache.ace.agent.itest/.gitignore
    ace/trunk/org.apache.ace.agent.itest/.project
    ace/trunk/org.apache.ace.agent.itest/.settings/
    ace/trunk/org.apache.ace.agent.itest/.settings/org.eclipse.jdt.core.prefs
    ace/trunk/org.apache.ace.agent.itest/bnd.bnd
    ace/trunk/org.apache.ace.agent.itest/build.xml
    ace/trunk/org.apache.ace.agent.itest/resources/
    ace/trunk/org.apache.ace.agent.itest/resources/twoagentsconfig.properties
    ace/trunk/org.apache.ace.agent.itest/src/
    ace/trunk/org.apache.ace.agent.itest/src/org/
    ace/trunk/org.apache.ace.agent.itest/src/org/apache/
    ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/
    ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/
    ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/
    ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ManagementAgentTest.java
    ace/trunk/org.apache.ace.agent/.classpath
    ace/trunk/org.apache.ace.agent/.project
    ace/trunk/org.apache.ace.agent/.settings/
    ace/trunk/org.apache.ace.agent/.settings/org.eclipse.jdt.core.prefs
    ace/trunk/org.apache.ace.agent/README
    ace/trunk/org.apache.ace.agent/bnd.bnd
    ace/trunk/org.apache.ace.agent/build.xml
    ace/trunk/org.apache.ace.agent/src/
    ace/trunk/org.apache.ace.agent/src/org/
    ace/trunk/org.apache.ace.agent/src/org/apache/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/Constants.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ManagementAgent.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryImpl.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentials.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentialsFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployer.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployerFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTask.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTaskFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceImpl.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentUpdateTask.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentUpdateTaskFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/discovery/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/discovery/PropertyBasedDiscoveryFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/identification/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/identification/IdentifierBasedIdentificationFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/identification/IfconfigIdentification.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/identification/PropertyBasedIdentificationFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/identification/ifconfigBasedIdentificationFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ManagementAgentFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/StaticConfigurationHandler.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogImpl.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogStoreFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogStoreImpl.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogSyncTask.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/logging/LogSyncTaskFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/packageinfo
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/spi/
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/spi/ComponentFactory.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/spi/ComponentFactoryBase.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/spi/OneComponentFactoryBase.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/spi/packageinfo

Added: ace/trunk/org.apache.ace.agent.itest/.classpath
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/.classpath?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/.classpath (added)
+++ ace/trunk/org.apache.ace.agent.itest/.classpath Tue May  7 10:25:13 2013
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="bin" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: ace/trunk/org.apache.ace.agent.itest/.gitignore
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/.gitignore?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/.gitignore (added)
+++ ace/trunk/org.apache.ace.agent.itest/.gitignore Tue May  7 10:25:13 2013
@@ -0,0 +1,2 @@
+/bin/
+/generated/

Added: ace/trunk/org.apache.ace.agent.itest/.project
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/.project?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/.project (added)
+++ ace/trunk/org.apache.ace.agent.itest/.project Tue May  7 10:25:13 2013
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.ace.agent.itest</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>bndtools.core.bndbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>bndtools.core.bndnature</nature>
+	</natures>
+</projectDescription>

Added: ace/trunk/org.apache.ace.agent.itest/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/.settings/org.eclipse.jdt.core.prefs?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/.settings/org.eclipse.jdt.core.prefs (added)
+++ ace/trunk/org.apache.ace.agent.itest/.settings/org.eclipse.jdt.core.prefs Tue May  7 10:25:13 2013
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7

Added: ace/trunk/org.apache.ace.agent.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/bnd.bnd?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/bnd.bnd (added)
+++ ace/trunk/org.apache.ace.agent.itest/bnd.bnd Tue May  7 10:25:13 2013
@@ -0,0 +1,19 @@
+Test-Cases: ${classes;CONCRETE;EXTENDS;junit.framework.TestCase}
+-runbundles: org.mockito.mockito-all,\
+	org.apache.ace.agent;version=latest,\
+	org.apache.ace.test;version=latest,\
+	org.apache.felix.dependencymanager,\
+	osgi.cmpn
+Private-Package: org.apache.ace.agent.itest
+-runee: JavaSE-1.6
+-runvm: -ea
+-runfw: org.apache.felix.framework
+-buildpath: osgi.core;version='[4.2,5)',\
+	osgi.cmpn,\
+	junit.osgi,\
+	org.mockito.mockito-all,\
+	org.apache.ace.agent;version=latest,\
+	org.apache.ace.test;version=latest
+-runsystempackages: sun.reflect
+Import-Package: org.apache.ace.agent,\
+	*
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent.itest/build.xml
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/build.xml?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/build.xml (added)
+++ ace/trunk/org.apache.ace.agent.itest/build.xml Tue May  7 10:25:13 2013
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="project" default="build">
+
+	<!-- -->
+
+	<import file="../cnf/build.xml" />
+</project>

Added: ace/trunk/org.apache.ace.agent.itest/resources/twoagentsconfig.properties
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/resources/twoagentsconfig.properties?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/resources/twoagentsconfig.properties (added)
+++ ace/trunk/org.apache.ace.agent.itest/resources/twoagentsconfig.properties Tue May  7 10:25:13 2013
@@ -0,0 +1,49 @@
+
+#
+# Basic single Management Agent
+
+agents=007,009
+serverurl=http://localhost:8080
+logstores=auditlog
+#logstores.auditlog.sync=false
+
+authentication.baseURL=http://localhost:8080
+
+#
+# Multiple agents example - All configuration properties can be scoped to agent identifier
+# to overrule default.
+#
+# agents=target-1,target-2
+# serverurl=http://localhost:8080
+# logstores=auditlog
+# target-2.serverurl=http://otherhost:8080
+# target-2.logstores=auditlog
+
+#
+# Component factories - Used to instantiate the the agent service components. These
+# are instantiated by the management agent factory when a new agent is configured and
+# may be specified per agent. All classes MUST be on the bundle classpath.
+#
+# No need to specify default list
+factories= org.apache.ace.agent.identification.IdentifierBasedIdentificationFactory, \
+   	org.apache.ace.agent.discovery.PropertyBasedDiscoveryFactory,\
+   	org.apache.ace.agent.logging.LogFactory,\
+	org.apache.ace.agent.logging.LogStoreFactory,\
+	org.apache.ace.agent.logging.LogSyncTaskFactory,\
+	org.apache.ace.agent.deployment.DeploymentServiceFactory,\
+	org.apache.ace.agent.deployment.DeploymentAdminDeployerFactory,\
+	org.apache.ace.agent.deployment.DeploymentCheckTaskFactory,\
+	org.apache.ace.agent.deployment.DeploymentUpdateTaskFactory,\
+	org.apache.ace.agent.connection.ConnectionFactoryFactory
+
+#
+# Extension activators - Additional extension activators to be started at startup. These 
+# are handled by the static configuration handler once, before configuring agents, and 
+# can not be changed at runtime. All classes MUST be on the bundle classpath.
+#
+# No need to specify default list
+activators= org.apache.ace.connectionfactory.impl.Activator, \
+	org.apache.ace.scheduler.Activator,\
+	org.apache.felix.deploymentadmin.Activator,\
+	org.apache.ace.consolelogger.Activator
+	
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ManagementAgentTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ManagementAgentTest.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ManagementAgentTest.java (added)
+++ ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ManagementAgentTest.java Tue May  7 10:25:13 2013
@@ -0,0 +1,152 @@
+/*
+ * 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.ace.agent.itest;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import junit.framework.Assert;
+
+import org.apache.ace.agent.ManagementAgent;
+import org.apache.ace.it.IntegrationTestBase;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.osgi.service.deploymentadmin.DeploymentAdmin;
+
+/**
+ * Integration test for Management Agent Configuration
+ * 
+ */
+public class ManagementAgentTest extends IntegrationTestBase {
+
+    /**
+     * One basic agent using CM API
+     * 
+     */
+    public void testSimpleAgentConfiguration() throws Exception {
+
+        assertAgentDown("007");
+        
+        // agent factory should be up
+        ManagedServiceFactory factory = getService(ManagedServiceFactory.class, "(" + Constants.SERVICE_PID + "=" + org.apache.ace.agent.Constants.FACTORY_PID + ")");
+        Assert.assertNotNull(factory);
+
+        // configure an agent
+        Dictionary<String, String> config = new Hashtable<String, String>();
+        config.put("agent", "007");
+        config.put("serverurl", "http://localhost:8080");
+        config.put("logstores", "auditlog");
+        factory.updated("test", config);
+
+        assertAgentUp("007");
+
+        factory.deleted("test");
+
+        assertAgentDown("007");
+    }
+
+    /**
+     * Two basic agents using static config
+     * 
+     */
+    public void testTwoAgentsConfigurationFile() throws Exception {
+
+        assertAgentDown("007");
+        assertAgentDown("009");
+
+        System.setProperty(org.apache.ace.agent.Constants.FACTORY_PID, "resources/twoagentsconfig.properties");
+        restartBundle("org.apache.ace.agent");
+
+        assertAgentUp("007");
+        assertAgentUp("009");
+
+        System.setProperty(org.apache.ace.agent.Constants.FACTORY_PID, "");
+        restartBundle("org.apache.ace.agent");
+
+        assertAgentDown("007");
+        assertAgentDown("009");
+    }
+
+    private void assertAgentUp(String agentId) throws InvalidSyntaxException {
+
+        String agentFilter = "(agent=" + agentId + ")";
+
+        ManagementAgent agent = getService(ManagementAgent.class, agentFilter);
+        assertNotNull(agent);
+
+        ServiceReference[] references = m_bundleContext.getAllServiceReferences("org.apache.ace.identification.Identification", "(agent=007)");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences("org.apache.ace.discovery.Discovery", agentFilter);
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences("org.apache.ace.deployment.Deployment", agentFilter);
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences("org.apache.ace.deployment.service.DeploymentService", agentFilter);
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences("org.apache.ace.log.Log", "(&" + agentFilter + "(name=auditlog))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences("org.apache.ace.log.target.store.LogStore", "(&" + agentFilter + "(name=auditlog))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences(Runnable.class.getName(), "(&" + agentFilter + "(name=auditlog))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences(Runnable.class.getName(), "(&" + agentFilter + "(taskName=DeploymentUpdateTask))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences(Runnable.class.getName(), "(&" + agentFilter + "(taskName=DeploymentCheckTask))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+
+        references = m_bundleContext.getAllServiceReferences(Runnable.class.getName(), "(&" + agentFilter + "(taskName=LogSyncTask)(name=auditlog))");
+        assertNotNull(references);
+        assertEquals(1, references.length);
+    }
+
+    private void assertAgentDown(String agentId) throws InvalidSyntaxException {
+        String agentFilter = "(agent=" + agentId + ")";
+        ServiceReference[] references = m_bundleContext.getAllServiceReferences(ManagementAgent.class.getName(), agentFilter);
+        assertNull(references);
+    }
+
+    private void restartBundle(String bsn) throws BundleException {
+        for (Bundle bundle : m_bundleContext.getBundles()) {
+            if (bundle.getSymbolicName().equals(bsn)) {
+                bundle.stop();
+                bundle.start();
+            }
+        }
+    }
+}

Added: ace/trunk/org.apache.ace.agent/.classpath
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/.classpath?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/.classpath (added)
+++ ace/trunk/org.apache.ace.agent/.classpath Tue May  7 10:25:13 2013
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: ace/trunk/org.apache.ace.agent/.project
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/.project?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/.project (added)
+++ ace/trunk/org.apache.ace.agent/.project Tue May  7 10:25:13 2013
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.ace.agent</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>bndtools.core.bndbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>bndtools.core.bndnature</nature>
+	</natures>
+</projectDescription>

Added: ace/trunk/org.apache.ace.agent/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/.settings/org.eclipse.jdt.core.prefs?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/.settings/org.eclipse.jdt.core.prefs (added)
+++ ace/trunk/org.apache.ace.agent/.settings/org.eclipse.jdt.core.prefs Tue May  7 10:25:13 2013
@@ -0,0 +1,71 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning

Added: ace/trunk/org.apache.ace.agent/README
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/README?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/README (added)
+++ ace/trunk/org.apache.ace.agent/README Tue May  7 10:25:13 2013
@@ -0,0 +1,19 @@
+Management Agent redesign (ACE-347)
+
+
+Notes:
+
+* Switched to factory SPI approach for pluggability/extensions.
+* Removed export package atributes / cleaned up bundle contents.
+* Assembled most target specific business logic code in project.
+* Supports configuration through single config file (as well as CM api).
+* Supports clean multiple agent configuration (if we want to keep it).
+ 
+ TODOs:
+ 
+ * Cleanup assembled code and parent projects
+ * More config options
+ * More (i)testing
+ * Create launcher project
+ * Create run-agent project
+ * Replace ace executor with a executorservice
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/bnd.bnd?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/bnd.bnd (added)
+++ ace/trunk/org.apache.ace.agent/bnd.bnd Tue May  7 10:25:13 2013
@@ -0,0 +1,85 @@
+Bundle-Activator: org.apache.ace.agent.impl.Activator
+Bundle-Version: 1.0.0
+
+-buildpath: osgi.core,\
+	osgi.cmpn,\
+	org.apache.felix.dependencymanager,\
+	org.apache.felix.deploymentadmin,\
+	org.apache.ace.connectionfactory;version=latest,\
+	org.apache.ace.consolelogger;version=latest,\
+	org.apache.ace.log.target;version=latest,\
+	org.apache.ace.log.target.store.impl;version=latest,\
+	org.apache.ace.range.api;version=latest,\
+	org.apache.ace.log.api;version=latest,\
+	org.apache.ace.log.listener;version=latest,\
+	org.apache.ace.discovery.api;version=latest,\
+	org.apache.ace.discovery.property;version=latest,\
+	org.apache.ace.identification.api;version=latest,\
+	org.apache.ace.identification.property;version=latest,\
+	org.apache.ace.deployment.api;version=latest,\
+	org.apache.ace.deployment.deploymentadmin;version=latest,\
+	org.apache.ace.deployment.task.base;version=latest,\
+	org.apache.ace.deployment.task;version=latest,\
+	org.apache.ace.scheduler.impl;version=latest,\
+	commons-codec;version=1.4,\
+	org.apache.ace.scheduler.api;version=latest
+
+#
+# Embedding all required api and implementation packages to ensure that the
+# Management Agent can run in any plain vanilla framework.
+#	
+Private-Package: org.apache.ace.agent.connection,\
+	org.apache.felix.dm,\
+	org.apache.felix.dm.tracker,\
+	org.apache.felix.dm.tracker,\
+	org.apache.ace.agent.spi,\
+	org.osgi.service.log,\
+	org.osgi.service.useradmin,\
+	org.apache.ace.agent,\
+	org.apache.ace.agent.spi,\
+	org.apache.ace.deployment,\
+	org.apache.ace.log.util,\
+	org.apache.ace.deployment.service,\
+	org.apache.ace.discovery,\
+	org.apache.ace.identification,\
+	org.apache.ace.log,\
+	org.apache.ace.log.target.store,\
+	org.apache.ace.log.target.task,\
+	org.apache.ace.range,\
+	org.apache.ace.scheduler,\
+	org.apache.ace.agent.identification,\
+	org.apache.ace.consolelogger,\
+	org.apache.ace.connectionfactory.impl,\
+	org.apache.ace.connectionfactory,\
+	org.apache.ace.agent.logging,\
+	org.apache.ace.agent.impl,\
+	org.apache.ace.agent.deployment,\
+	org.apache.ace.agent.discovery,\
+	org.apache.ace.log.target,\
+	org.apache.felix.dm.impl,\
+	org.apache.felix.dm.impl.dependencies,\
+	org.apache.felix.dm.impl.index,\
+	org.apache.felix.dm.impl.metatype,\
+	org.apache.felix.deploymentadmin;-split-package:=first,\
+	org.apache.felix.deploymentadmin.spi;-split-package:=first,\
+	org.osgi.service.metatype;-split-package:=first,\
+	org.osgi.util.tracker;-split-package:=first,\
+	org.apache.commons.codec;-split-package:=first,\
+	org.apache.commons.codec.binary;-split-package:=first
+	
+# 
+# Exporting deploymentadmin and (some) compendium services so resource processors 
+# can wire up to the management agent. As bnd will generate the appropriate imports
+# this should not lead to any conflicts with deployment packages.
+#
+# We could consider exposing all compendium packages by default in this way?
+#
+Export-Package: org.osgi.service.deploymentadmin;version=1.0;-split-package:=first,\
+	org.osgi.service.deploymentadmin.spi;version=1.0;-split-package:=first,\
+	org.osgi.service.event;version=1.2,\
+	org.osgi.service.cm;version=1.3,\
+	org.apache.ace.agent
+    
+# 
+#
+Import-Package:	*
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent/build.xml
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/build.xml?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/build.xml (added)
+++ ace/trunk/org.apache.ace.agent/build.xml Tue May  7 10:25:13 2013
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="project" default="build"> 
+	<import file="../cnf/build.xml"/>
+</project>

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/Constants.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/Constants.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/Constants.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/Constants.java Tue May  7 10:25:13 2013
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ace.agent;
+
+/**
+ * Compile time constants for the bundle. Only located in the API package for development time visbility.
+ * 
+ */
+public interface Constants {
+
+    String FACTORY_PID = "org.apache.ace.managementagent.factory";
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ManagementAgent.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ManagementAgent.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ManagementAgent.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/ManagementAgent.java Tue May  7 10:25:13 2013
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ace.agent;
+
+/**
+ * TODO implement or remove? The question is whether we want to expose a single API to the rest of the environment to
+ * allow client bundles to do deploy/log stuff.
+ * 
+ */
+public interface ManagementAgent {
+
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryFactory.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryFactory.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryFactory.java Tue May  7 10:25:13 2013
@@ -0,0 +1,82 @@
+/*
+ * 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.ace.agent.connection;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.ace.agent.connection.UrlCredentialsFactory.MissingValueException;
+import org.apache.ace.agent.spi.OneComponentFactoryBase;
+import org.apache.ace.connectionfactory.ConnectionFactory;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.log.LogService;
+
+/**
+ * Creates a {@link ConnectionFactory} service component with a {@link ConnectionFactoryImpl} implementation.
+ * 
+ */
+public class ConnectionFactoryFactory extends OneComponentFactoryBase {
+
+    // FIXME This could all be much nicer if we can refactor connectionfactory code some more. Note that at present this
+    // only support one credential mapping per agent.
+    private final static String[] AUTH_PROPERTIES = new String[] {
+        UrlCredentialsFactory.KEY_AUTH_BASE_URL,
+        UrlCredentialsFactory.KEY_AUTH_KEYSTORE_FILE,
+        UrlCredentialsFactory.KEY_AUTH_KEYSTORE_PASS,
+        UrlCredentialsFactory.KEY_AUTH_TRUSTSTORE_FILE,
+        UrlCredentialsFactory.KEY_AUTH_TRUSTSTORE_PASS,
+        UrlCredentialsFactory.KEY_AUTH_TYPE,
+        UrlCredentialsFactory.KEY_AUTH_USER_NAME,
+        UrlCredentialsFactory.KEY_AUTH_USER_PASSWORD };
+
+    @Override
+    public Component createComponent(BundleContext context, DependencyManager manager, LogService logService, Map<String, String> configuration) throws ConfigurationException {
+
+        Properties properties = getAgentproperties(configuration);
+        properties.put("impl.type", "jdk");
+
+        String baseUrl = configuration.get(UrlCredentialsFactory.KEY_AUTH_BASE_URL);
+        UrlCredentials credentials = null;
+        if (baseUrl != null && !"".equals(baseUrl)) {
+            Dictionary<String, String> urlCredentials = new Hashtable<String, String>();
+            for (String authProp : AUTH_PROPERTIES) {
+                if (configuration.get(authProp) != null) {
+                    urlCredentials.put(authProp, configuration.get(authProp));
+                }
+            }
+
+            try {
+                credentials = UrlCredentialsFactory.getCredentials(urlCredentials);
+            }
+            catch (MissingValueException e) {
+                throw new ConfigurationException("authorization", e.getMessage(), e);
+            }
+        }
+
+        return manager.createComponent()
+            .setInterface(ConnectionFactory.class.getName(), properties)
+            .setImplementation(new ConnectionFactoryImpl(credentials))
+            .add(manager.createServiceDependency().setService(LogService.class).setRequired(false));
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryImpl.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryImpl.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/ConnectionFactoryImpl.java Tue May  7 10:25:13 2013
@@ -0,0 +1,256 @@
+/*
+ * 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.ace.agent.connection;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+
+import org.apache.ace.agent.connection.UrlCredentials.AuthType;
+import org.apache.ace.agent.connection.UrlCredentialsFactory.MissingValueException;
+import org.apache.ace.connectionfactory.ConnectionFactory;
+import org.apache.commons.codec.binary.Base64;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.osgi.service.useradmin.User;
+
+// FIXME This is a temporary modified copy of the org.apache.ace.connectionfactory.impl because it is private and does not
+// expose a convenient api for non CM configuration.
+//
+// * added a constructor with credential param
+
+/**
+ * Provides a default implementation for {@link ConnectionFactory} based on the standard <code>java.net</code>
+ * implementation of {@link URLConnection}.
+ */
+public class ConnectionFactoryImpl implements ConnectionFactory, ManagedServiceFactory {
+
+    public static final String FACTORY_PID = "org.apache.ace.connectionfactory";
+
+    private static final String HTTP_HEADER_AUTHORIZATION = "Authorization";
+
+    private final Map<String /* config PID */, UrlCredentials> m_credentialMapping;
+
+    /**
+     * Creates a new {@link ConnectionFactoryImpl}.
+     */
+    public ConnectionFactoryImpl() {
+        m_credentialMapping = new HashMap<String, UrlCredentials>();
+    }
+
+    public ConnectionFactoryImpl(UrlCredentials credentials) {
+        m_credentialMapping = new HashMap<String, UrlCredentials>();
+        if (credentials != null) {
+            m_credentialMapping.put("static", credentials);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public URLConnection createConnection(URL url) throws IOException {
+        if (url == null) {
+            throw new IllegalArgumentException("URL cannot be null!");
+        }
+
+        URLConnection conn = url.openConnection();
+
+        UrlCredentials creds = getCredentials(url);
+        if (creds != null) {
+            supplyCredentials(conn, creds);
+        }
+
+        return conn;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public URLConnection createConnection(URL url, User user) throws IOException {
+        if (url == null) {
+            throw new IllegalArgumentException("URL cannot be null!");
+        }
+        if (user == null) {
+            throw new IllegalArgumentException("User cannot be null!");
+        }
+
+        URLConnection conn = url.openConnection();
+
+        UrlCredentials creds = getCredentials(url);
+        if (creds != null) {
+            // TODO apply user!
+            supplyCredentials(conn, creds);
+        }
+
+        return conn;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleted(String pid) {
+        synchronized (m_credentialMapping) {
+            m_credentialMapping.remove(pid);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return "HTTP Connection Factory";
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void updated(String pid, Dictionary properties) throws ConfigurationException {
+        UrlCredentials creds;
+        synchronized (m_credentialMapping) {
+            creds = m_credentialMapping.get(pid);
+        }
+
+        try {
+            creds = UrlCredentialsFactory.getCredentials(properties);
+
+            synchronized (m_credentialMapping) {
+                m_credentialMapping.put(pid, creds);
+            }
+        }
+        catch (MissingValueException e) {
+            throw new ConfigurationException(e.getProperty(), e.getMessage());
+        }
+    }
+
+    /**
+     * Returns the credentials to access the given URL.
+     * 
+     * @param url
+     *            the URL to find the credentials for, cannot be <code>null</code>.
+     * @return a {@link UrlCredentials} instance for the given URL, or <code>null</code> if none were found, or if none
+     *         were necessary.
+     */
+    final UrlCredentials getCredentials(URL url) {
+        Collection<UrlCredentials> creds;
+        synchronized (m_credentialMapping) {
+            creds = new ArrayList<UrlCredentials>(m_credentialMapping.values());
+        }
+
+        for (UrlCredentials c : creds) {
+            if (c.matches(url)) {
+                return c;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the authorization header for HTTP Basic Authentication.
+     * 
+     * @param values
+     *            the credential values to supply, cannot be <code>null</code> and should be an array of two elements.
+     * @return a string that denotes the basic authentication header ("Basic " + encoded credentials), never
+     *         <code>null</code>.
+     */
+    final String getBasicAuthCredentials(Object[] values) {
+        if ((values == null) || values.length < 2) {
+            throw new IllegalArgumentException("Insufficient credentials passed: expected 2 values!");
+        }
+
+        StringBuilder sb = new StringBuilder();
+        if (values[0] instanceof String) {
+            sb.append((String) values[0]);
+        }
+        else if (values[0] instanceof byte[]) {
+            sb.append(new String((byte[]) values[0]));
+        }
+        sb.append(':');
+        if (values[1] instanceof String) {
+            sb.append((String) values[1]);
+        }
+        else if (values[1] instanceof byte[]) {
+            sb.append(new String((byte[]) values[1]));
+        }
+
+        return "Basic " + new String(Base64.encodeBase64(sb.toString().getBytes()));
+    }
+
+    /**
+     * Applies basic authentication to the given connection, if it is a {@link HttpURLConnection}.
+     * 
+     * @param conn
+     *            the connection to apply basic authentication to;
+     * @param values
+     *            the credentials to apply.
+     */
+    private void applyBasicAuthentication(URLConnection conn, Object[] values) {
+        if (conn instanceof HttpURLConnection) {
+            conn.setRequestProperty(HTTP_HEADER_AUTHORIZATION, getBasicAuthCredentials(values));
+        }
+    }
+
+    /**
+     * Applies the use of client certificates to the given connection, if it a {@link HttpsURLConnection}.
+     * 
+     * @param conn
+     *            the connection to apply client certs to;
+     * @param values
+     *            the credentials to apply.
+     */
+    private void applyClientCertificate(URLConnection conn, Object[] values) {
+        if (conn instanceof HttpsURLConnection) {
+            ((HttpsURLConnection) conn).setSSLSocketFactory(((SSLContext) values[0]).getSocketFactory());
+        }
+    }
+
+    /**
+     * Supplies the actual credentials to the given {@link URLConnection}.
+     * 
+     * @param conn
+     *            the connection to supply the credentials to, cannot be <code>null</code>;
+     * @param urlCreds
+     *            the URL credentials to supply, cannot be <code>null</code>.
+     * @throws IOException
+     *             in case of I/O problems.
+     */
+    private void supplyCredentials(URLConnection conn, UrlCredentials urlCreds) throws IOException {
+        final AuthType type = urlCreds.getType();
+        final Object[] creds = urlCreds.getCredentials();
+
+        if (AuthType.BASIC.equals(type)) {
+            applyBasicAuthentication(conn, creds);
+        }
+        else if (AuthType.CLIENT_CERT.equals(type)) {
+            applyClientCertificate(conn, creds);
+        }
+        else if (!AuthType.NONE.equals(type)) {
+            throw new IllegalArgumentException("Unknown authentication type: " + type);
+        }
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentials.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentials.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentials.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentials.java Tue May  7 10:25:13 2013
@@ -0,0 +1,149 @@
+/*
+ * 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.ace.agent.connection;
+
+import java.net.URL;
+import java.util.Arrays;
+
+//FIXME This is a temporary modified copy of the org.apache.ace.connectionfactory.impl because it is private and does not
+//expose a convenient api for non CM configuration.
+
+/**
+ * Small container for holding URL credentials.
+ */
+final class UrlCredentials {
+
+    static enum AuthType {
+        /** Indicates no authentication. */
+        NONE,
+        /** Indicates basic HTTP authentication. */
+        BASIC,
+        /** Indicates the use of client certificates. */
+        CLIENT_CERT;
+    }
+
+    private final AuthType m_type;
+    private final URL m_baseURL;
+    private final Object[] m_credentials;
+
+    /**
+     * Creates a new, anonymous, {@link UrlCredentials} instance.
+     * 
+     * @param baseURL the base URL for which to apply the credentials, cannot be <code>null</code>.
+     */
+    public UrlCredentials(URL baseURL) {
+        this(AuthType.NONE, baseURL);
+    }
+
+    /**
+     * Creates a new {@link UrlCredentials} instance.
+     * 
+     * @param type the authentication type to use for the authentication of the URL, cannot be <code>null</code>;
+     * @param baseURL the base URL for which to apply the credentials, cannot be <code>null</code>;
+     * @param credentials the credentials to use, cannot be <code>null</code>, but may be empty.
+     */
+    public UrlCredentials(AuthType type, URL baseURL, Object... credentials) {
+        if (type == null) {
+            throw new IllegalArgumentException("Type cannot be null!");
+        }
+        if (baseURL == null) {
+            throw new IllegalArgumentException("BaseURL cannot be null!");
+        }
+        m_type = type;
+        m_baseURL = baseURL;
+        m_credentials = (credentials == null) ? new Object[0] : credentials.clone();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        UrlCredentials other = (UrlCredentials) obj;
+        if (m_type != other.m_type) {
+            return false;
+        }
+        if (!m_baseURL.equals(other.m_baseURL)) {
+            return false;
+        }
+        if (!Arrays.equals(m_credentials, other.m_credentials)) {
+            return false;
+        }
+        return true;
+    }
+    
+    /**
+     * Returns whether or not the given URL can be mapped to our own base URL.
+     * 
+     * @param url the URL to map, may be <code>null</code> in which case <code>false</code> will be returned.
+     * @return <code>true</code> if the given URL maps to our base URL, <code>false</code> otherwise.
+     */
+    public boolean matches(URL url) {
+        if (url == null) {
+            return false;
+        }
+        
+        String baseURL = m_baseURL.toExternalForm();
+        return url.toExternalForm().startsWith(baseURL);
+    }
+
+    /**
+     * Returns the credentials for a URL.
+     * 
+     * @return the credentials, never <code>null</code>.
+     */
+    public Object[] getCredentials() {
+        return m_credentials.clone();
+    }
+
+    /**
+     * Returns the authentication type.
+     * 
+     * @return the type of authentication to use.
+     */
+    public AuthType getType() {
+        return m_type;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((m_type == null) ? 0 : m_type.hashCode());
+        result = prime * result + ((m_baseURL == null) ? 0 : m_baseURL.hashCode());
+        result = prime * result + Arrays.hashCode(m_credentials);
+        return result;
+    }
+
+    /**
+     * @return the base URL these credentials apply to, cannot be <code>null</code>.
+     */
+    final URL getBaseURL() {
+        return m_baseURL;
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentialsFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentialsFactory.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentialsFactory.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/connection/UrlCredentialsFactory.java Tue May  7 10:25:13 2013
@@ -0,0 +1,299 @@
+/*
+ * 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.ace.agent.connection;
+
+import java.io.Closeable;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.SecureRandom;
+import java.util.Dictionary;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+
+import org.apache.ace.agent.connection.UrlCredentials.AuthType;
+
+//FIXME This is a temporary modified copy of the org.apache.ace.connectionfactory.impl because it is private and does not
+//expose a convenient api for non CM configuration.
+
+/**
+ * Provides a helper class for obtaining access credentials from a dictionary.
+ */
+final class UrlCredentialsFactory {
+
+    public static final class MissingValueException extends RuntimeException {
+        private final String m_property;
+
+        /**
+         * @param property
+         *            the name of the missing property;
+         * @param message
+         *            the message explaining the missing property.
+         */
+        public MissingValueException(String property) {
+            this(property, "No value for " + property + " given!");
+        }
+
+        /**
+         * @param property
+         *            the name of the missing property;
+         * @param message
+         *            the message explaining the missing property.
+         */
+        public MissingValueException(String property, String message) {
+            super(message);
+            m_property = property;
+        }
+
+        /**
+         * Returns the name of the missing property.
+         * 
+         * @return the property name, never <code>null</code>.
+         */
+        public String getProperty() {
+            return m_property;
+        }
+    }
+
+    public static final String KEY_AUTH_BASE_URL = "authentication.baseURL";
+    public static final String KEY_AUTH_TYPE = "authentication.type";
+    public static final String KEY_AUTH_USER_NAME = "authentication.user.name";
+    public static final String KEY_AUTH_USER_PASSWORD = "authentication.user.password";
+    public static final String KEY_AUTH_KEYSTORE_FILE = "authentication.keystore.file";
+    public static final String KEY_AUTH_KEYSTORE_PASS = "authentication.keystore.storepass";
+    public static final String KEY_AUTH_TRUSTSTORE_FILE = "authentication.truststore.file";
+    public static final String KEY_AUTH_TRUSTSTORE_PASS = "authentication.truststore.storepass";
+
+    /**
+     * Not used.
+     */
+    private UrlCredentialsFactory() {
+        // Nop
+    }
+
+    /**
+     * @param props
+     *            the properties to take the access credentials from.
+     * @throws MissingValueException
+     *             in case the given properties is missing values.
+     */
+    public static UrlCredentials getCredentials(Dictionary props) throws MissingValueException {
+        return getCredentials(props, "");
+    }
+
+    /**
+     * @param props
+     *            the properties to take the access credentials from;
+     * @param prefix
+     *            the prefix to use to lookup the correct values in the given dictionary.
+     * @throws MissingValueException
+     *             in case the given properties is missing values.
+     */
+    public static UrlCredentials getCredentials(Dictionary props, String prefix) throws MissingValueException {
+        if (props == null) {
+            throw new IllegalArgumentException("Properties cannot be null!");
+        }
+        if (prefix == null) {
+            throw new IllegalArgumentException("Prefix cannot be null!");
+        }
+
+        AuthType type;
+        URL baseURL;
+        Object[] creds;
+
+        String baseUrlValue = getStringProperty(props, prefix.concat(KEY_AUTH_BASE_URL));
+        if (baseUrlValue == null) {
+            throw new MissingValueException(KEY_AUTH_BASE_URL);
+        }
+
+        try {
+            baseURL = new URL(baseUrlValue);
+        }
+        catch (MalformedURLException e) {
+            throw new MissingValueException(KEY_AUTH_BASE_URL, "Invalid base URL!");
+        }
+
+        String authType = getStringProperty(props, prefix.concat(KEY_AUTH_TYPE), "none");
+        try {
+            type = AuthType.valueOf(authType.toUpperCase());
+        }
+        catch (Exception e) {
+            throw new IllegalArgumentException("Unsupported authentication type: " + authType);
+        }
+
+        if (AuthType.NONE.equals(type)) {
+            creds = new Object[0];
+        }
+        else if (AuthType.BASIC.equals(type)) {
+            String userName = getStringProperty(props, prefix.concat(KEY_AUTH_USER_NAME));
+            if (userName == null) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_USER_NAME));
+            }
+
+            String password = getStringProperty(props, prefix.concat(KEY_AUTH_USER_PASSWORD));
+            if (password == null) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_USER_PASSWORD));
+            }
+
+            creds = new Object[] { userName, password };
+        }
+        else if (AuthType.CLIENT_CERT.equals(type)) {
+            String keystoreFile = getStringProperty(props, prefix.concat(KEY_AUTH_KEYSTORE_FILE));
+            String keystorePass = getStringProperty(props, prefix.concat(KEY_AUTH_KEYSTORE_PASS));
+            if ((keystoreFile != null) && (keystorePass == null)) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_KEYSTORE_PASS));
+            }
+            if ((keystoreFile == null) && (keystorePass != null)) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_KEYSTORE_FILE));
+            }
+
+            String truststoreFile = getStringProperty(props, prefix.concat(KEY_AUTH_TRUSTSTORE_FILE));
+            String truststorePass = getStringProperty(props, prefix.concat(KEY_AUTH_TRUSTSTORE_PASS));
+            if ((truststoreFile != null) && (truststorePass == null)) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_TRUSTSTORE_PASS));
+            }
+            if ((truststoreFile == null) && (truststorePass != null)) {
+                throw new MissingValueException(prefix.concat(KEY_AUTH_TRUSTSTORE_FILE));
+            }
+
+            if ((keystoreFile == null) && (truststoreFile == null)) {
+                try {
+                    // No configuration given; use the system-wide defaults...
+                    creds = new Object[] { SSLContext.getDefault() };
+                }
+                catch (Exception e) {
+                    throw new IllegalArgumentException("Failed to obtain SSL context!", e);
+                }
+            }
+            else {
+                try {
+                    KeyManager[] keyManagers = getKeyManagerFactory(keystoreFile, keystorePass);
+                    TrustManager[] trustManagers = getTrustManagerFactory(truststoreFile, truststorePass);
+
+                    SSLContext context = SSLContext.getInstance("TLS");
+                    context.init(keyManagers, trustManagers, new SecureRandom());
+
+                    creds = new Object[] { context };
+                }
+                catch (Exception e) {
+                    throw new IllegalArgumentException("Failed to load keystore!", e);
+                }
+            }
+        }
+        else {
+            throw new IllegalArgumentException("Invalid/unhandled authentication type: " + authType);
+        }
+
+        return new UrlCredentials(type, baseURL, creds);
+    }
+
+    private static String getStringProperty(Dictionary dict, String key) {
+        Object value = dict.get(key);
+        if (value instanceof String) {
+            return (String) value;
+        }
+        else if (value instanceof byte[]) {
+            return new String((byte[]) value);
+        }
+        return null;
+    }
+
+    private static String getStringProperty(Dictionary dict, String key, String defaultValue) {
+        String value = getStringProperty(dict, key);
+        return (value == null) ? defaultValue : value;
+    }
+
+    /**
+     * @param keystoreFile
+     * @param storePass
+     * @return
+     * @throws IOException
+     * @throws GeneralSecurityException
+     */
+    private static KeyManager[] getKeyManagerFactory(String keystoreFile, String storePass) throws IOException, GeneralSecurityException {
+        if (keystoreFile == null) {
+            return null;
+        }
+
+        InputStream keyInput = null;
+        try {
+            KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+            KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+
+            keyInput = new FileInputStream(keystoreFile);
+
+            keyStore.load(keyInput, storePass.toCharArray());
+
+            keyManagerFactory.init(keyStore, storePass.toCharArray());
+            return keyManagerFactory.getKeyManagers();
+        }
+        finally {
+            closeSafely(keyInput);
+        }
+    }
+
+    /**
+     * @param truststoreFile
+     * @param storePass
+     * @return
+     * @throws IOException
+     * @throws GeneralSecurityException
+     */
+    private static TrustManager[] getTrustManagerFactory(String truststoreFile, String storePass) throws IOException, GeneralSecurityException {
+        if (truststoreFile == null) {
+            return null;
+        }
+
+        InputStream trustInput = null;
+        try {
+            TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+            KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+
+            trustInput = new FileInputStream(truststoreFile);
+
+            trustStore.load(trustInput, storePass.toCharArray());
+
+            trustManagerFactory.init(trustStore);
+            return trustManagerFactory.getTrustManagers();
+        }
+        finally {
+            closeSafely(trustInput);
+        }
+    }
+
+    private static void closeSafely(Closeable resource) {
+        try {
+            if (resource != null) {
+                resource.close();
+            }
+        }
+        catch (IOException e) {
+            // Ignore; nothing we can/will do...
+        }
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployer.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployer.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployer.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployer.java Tue May  7 10:25:13 2013
@@ -0,0 +1,60 @@
+/*
+ * 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.ace.agent.deployment;
+
+import java.io.InputStream;
+import org.apache.ace.deployment.Deployment;
+import org.osgi.framework.Version;
+import org.osgi.service.deploymentadmin.DeploymentAdmin;
+import org.osgi.service.deploymentadmin.DeploymentPackage;
+import org.osgi.service.log.LogService;
+
+/**
+ * Implementation of the <code>DeploymentService</code> interface that uses the <code>DeploymentAdmin</code>
+ * to deploy components.
+ */
+public class DeploymentAdminDeployer implements Deployment {
+    private volatile LogService m_log; /* will be injected by dependencymanager */
+    private volatile DeploymentAdmin m_admin; /* will be injected by dependencymanager */
+
+    public String getName(Object object) throws IllegalArgumentException {
+        if (!(object instanceof DeploymentPackage)) {
+            throw new IllegalArgumentException("Argument is not a DeploymentPackage");
+        }
+        return ((DeploymentPackage) object).getName();
+    }
+
+    public Version getVersion(Object object) throws IllegalArgumentException {
+        if (!(object instanceof DeploymentPackage)) {
+            throw new IllegalArgumentException("Argument is not a DeploymentPackage");
+        }
+        return ((DeploymentPackage) object).getVersion();
+    }
+
+    public Object install(InputStream inputStream) throws Exception {
+        DeploymentPackage deploymentPackage = m_admin.installDeploymentPackage(inputStream);
+        m_log.log(LogService.LOG_INFO, "Deployment Package installed: name=" + deploymentPackage.getName() + " version=" + deploymentPackage.getVersion());
+        return deploymentPackage;
+    }
+
+    public Object[] list() {
+        // DeploymentAdmin spec says this call should never return null
+        return m_admin.listDeploymentPackages();
+    }
+}
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployerFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployerFactory.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployerFactory.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentAdminDeployerFactory.java Tue May  7 10:25:13 2013
@@ -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.ace.agent.deployment;
+
+import java.util.Map;
+
+import org.apache.ace.agent.spi.OneComponentFactoryBase;
+import org.apache.ace.deployment.Deployment;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.deploymentadmin.DeploymentAdmin;
+import org.osgi.service.log.LogService;
+
+/**
+ * Creates a {@link Deployment} service component with a {@link DeploymentAdminDeployer} implementation.
+ * 
+ */
+public class DeploymentAdminDeployerFactory extends OneComponentFactoryBase {
+
+    @Override
+    public Component createComponent(BundleContext context, DependencyManager manager, LogService logService, Map<String, String> configuration) throws ConfigurationException {
+
+        return manager.createComponent()
+            .setInterface(Deployment.class.getName(), getAgentproperties(configuration))
+            .setImplementation(DeploymentAdminDeployer.class)
+            .add(manager.createServiceDependency().setService(DeploymentAdmin.class).setRequired(true))
+            .add(manager.createServiceDependency().setService(LogService.class).setRequired(false));
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTask.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTask.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTask.java Tue May  7 10:25:13 2013
@@ -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.ace.agent.deployment;
+
+import java.net.MalformedURLException;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.ace.deployment.service.DeploymentService;
+import org.osgi.framework.Version;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.service.log.LogService;
+
+//FIXME This is a of the org.apache.ace.deployment it is private and may be better located here.
+
+/**
+ * Task that checks for a new version and sends out an event if there is a new version. It does not actually
+ * download or install it.
+ */
+public class DeploymentCheckTask implements Runnable {
+
+    private static final String TOPIC_UPDATE_AVAILABLE = "org/apache/ace/deployment/UPDATEAVAILABLE";
+
+    private volatile LogService m_log;
+    private volatile EventAdmin m_eventAdmin;
+    private volatile DeploymentService m_service;
+
+    /**
+     * When run a check is made if a higher version is available on the remote. If so, send out an event.
+     */
+    public void run() {
+        try {
+            Version localVersion = m_service.getHighestLocalVersion();
+            Version remoteVersion = m_service.getHighestRemoteVersion();
+
+            if (remoteVersion == null) {
+                // expected if there's no discovered ps or relay server
+                // ACE-220: lower log level; not of real interest...
+                m_log.log(LogService.LOG_DEBUG, "Highest remote: unknown / Highest local: " + localVersion);
+                return;
+            }
+
+            // ACE-220: lower log level; not of real interest...
+            m_log.log(LogService.LOG_DEBUG, "Highest remote: " + remoteVersion + " / Highest local: " + localVersion);
+
+            if ((remoteVersion != null) && ((localVersion == null) || (remoteVersion.compareTo(localVersion) > 0))) {
+                m_eventAdmin.postEvent(createEvent(localVersion, remoteVersion));
+            }
+        }
+        catch (MalformedURLException e) {
+            m_log.log(LogService.LOG_ERROR, "Error creating endpoint url", e);
+        }
+        catch (Exception e) {
+            m_log.log(LogService.LOG_ERROR, "Error checking for update", e);
+        }
+    }
+
+    /**
+     * Creates an event for notifying listeners that a new version can be installed.
+     * 
+     * @param localVersion the highest local version;
+     * @param remoteVersion the higest remote version.
+     * @return a new {@link Event} instance, never <code>null</code>.
+     */
+    private Event createEvent(Version localVersion, Version remoteVersion) {
+        Properties properties = new Properties();
+        properties.put("deploymentpackage.localversion", ((localVersion == null) ? Version.emptyVersion : localVersion));
+        properties.put("deploymentpackage.remoteversion", remoteVersion);
+
+        return new Event(TOPIC_UPDATE_AVAILABLE, (Dictionary) properties);
+    }
+}
\ No newline at end of file

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTaskFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTaskFactory.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTaskFactory.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentCheckTaskFactory.java Tue May  7 10:25:13 2013
@@ -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.ace.agent.deployment;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.ace.agent.spi.OneComponentFactoryBase;
+import org.apache.ace.deployment.service.DeploymentService;
+import org.apache.ace.scheduler.constants.SchedulerConstants;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.log.LogService;
+
+/**
+ * Creates a executor whiteboard {@link Runnable} service component with a {@link DeploymentCheckTask} implementation.
+ * 
+ */
+public class DeploymentCheckTaskFactory extends OneComponentFactoryBase {
+
+    @Override
+    public Component createComponent(BundleContext context, DependencyManager manager, LogService logService, Map<String, String> configuration) throws ConfigurationException {
+
+        Properties properties = getAgentproperties(configuration);
+        properties.put(SchedulerConstants.SCHEDULER_NAME_KEY, DeploymentCheckTask.class.getSimpleName());
+        properties.put(SchedulerConstants.SCHEDULER_DESCRIPTION_KEY, "Task that checks for updates of artifacts installed on this target with the server.");
+        properties.put(SchedulerConstants.SCHEDULER_RECIPE, 2000);
+
+        return manager.createComponent()
+            .setInterface(Runnable.class.getName(), properties)
+            .setImplementation(new DeploymentCheckTask())
+            .add(manager.createServiceDependency().setService(DeploymentService.class, getAgentFilter(configuration, null)).setRequired(true))
+            .add(manager.createServiceDependency().setService(LogService.class).setRequired(false));
+    }
+}

Added: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceFactory.java?rev=1479841&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceFactory.java (added)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/deployment/DeploymentServiceFactory.java Tue May  7 10:25:13 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.ace.agent.deployment;
+
+import java.util.Map;
+
+import org.apache.ace.agent.spi.OneComponentFactoryBase;
+import org.apache.ace.connectionfactory.ConnectionFactory;
+import org.apache.ace.deployment.Deployment;
+import org.apache.ace.deployment.service.DeploymentService;
+import org.apache.ace.discovery.Discovery;
+import org.apache.ace.identification.Identification;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.service.log.LogService;
+
+/**
+ * Creates a {@link DeploymentService} service component with a {@link DeploymentServiceImpl} implementation.
+ * 
+ */
+public class DeploymentServiceFactory extends OneComponentFactoryBase {
+
+    @Override
+    public Component createComponent(BundleContext context, DependencyManager manager, LogService logService, Map<String, String> configuration) throws ConfigurationException {
+
+        return manager.createComponent()
+            .setInterface(DeploymentService.class.getName(), getAgentproperties(configuration))
+            .setImplementation(new DeploymentServiceImpl())
+            .add(manager.createServiceDependency().setService(Identification.class, getAgentFilter(configuration, null)).setRequired(true))
+            .add(manager.createServiceDependency().setService(Discovery.class, getAgentFilter(configuration, null)).setRequired(true))
+            .add(manager.createServiceDependency().setService(Deployment.class, getAgentFilter(configuration, null)).setRequired(true))
+            .add(manager.createServiceDependency().setService(ConnectionFactory.class, getAgentFilter(configuration, null)).setRequired(true))
+            .add(manager.createServiceDependency().setService(EventAdmin.class).setRequired(false))
+            .add(manager.createServiceDependency().setService(LogService.class).setRequired(false));
+    }
+}