You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ja...@apache.org on 2016/01/27 14:24:04 UTC
svn commit: r1727044 [3/4] - in /ace/trunk: cnf/localrepo/
cnf/localrepo/org.apache.felix.configadmin/
cnf/localrepo/org.apache.felix.deployment.rp.autoconf/
cnf/localrepo/org.apache.felix.deploymentadmin/
cnf/localrepo/org.apache.felix.eventadmin/ cnf...
Modified: ace/trunk/cnf/localrepo/index.xml.sha
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/index.xml.sha?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/cnf/localrepo/index.xml.sha (original)
+++ ace/trunk/cnf/localrepo/index.xml.sha Wed Jan 27 13:24:03 2016
@@ -1 +1 @@
-1010768cf3ae35614a904dc32c127c7485e37690275337838a59a2f04f87b5a4
\ No newline at end of file
+63007a4b76bb7ad193dcb71a3ca751dfa5796eeee681dfaea21086ef84233208
\ No newline at end of file
Added: ace/trunk/cnf/localrepo/org.apache.felix.configadmin/org.apache.felix.configadmin-1.8.8.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.configadmin/org.apache.felix.configadmin-1.8.8.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.configadmin/org.apache.felix.configadmin-1.8.8.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ace/trunk/cnf/localrepo/org.apache.felix.eventadmin/org.apache.felix.eventadmin-1.4.6.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.eventadmin/org.apache.felix.eventadmin-1.4.6.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.eventadmin/org.apache.felix.eventadmin-1.4.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ace/trunk/cnf/localrepo/org.apache.felix.http.jetty/org.apache.felix.http.jetty-3.1.6.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.http.jetty/org.apache.felix.http.jetty-3.1.6.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.http.jetty/org.apache.felix.http.jetty-3.1.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ace/trunk/cnf/localrepo/org.apache.felix.http.servlet-api/org.apache.felix.http.servlet-api-1.1.2.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.http.servlet-api/org.apache.felix.http.servlet-api-1.1.2.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.http.servlet-api/org.apache.felix.http.servlet-api-1.1.2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ace/trunk/cnf/localrepo/org.apache.felix.metatype/org.apache.felix.metatype-1.1.2.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.metatype/org.apache.felix.metatype-1.1.2.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.metatype/org.apache.felix.metatype-1.1.2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ace/trunk/cnf/localrepo/org.apache.felix.prefs/org.apache.felix.prefs-1.0.6.jar
URL: http://svn.apache.org/viewvc/ace/trunk/cnf/localrepo/org.apache.felix.prefs/org.apache.felix.prefs-1.0.6.jar?rev=1727044&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ace/trunk/cnf/localrepo/org.apache.felix.prefs/org.apache.felix.prefs-1.0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: ace/trunk/org.apache.ace.agent.controller.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.controller.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.controller.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.agent.controller.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -6,9 +6,8 @@ Test-Cases: org.apache.ace.agent.itest.C
org.apache.ace.builder;version=latest,\
org.apache.felix.configadmin,\
org.apache.felix.dependencymanager,\
- org.apache.felix.http.jetty,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
org.apache.felix.log,\
- biz.aQute.bnd,\
osgi.cmpn
Private-Package: \
org.apache.ace.range,\
@@ -22,19 +21,18 @@ Private-Package: \
org.apache.felix.deploymentadmin.spi,\
org.osgi.service.event,\
org.osgi.service.log,\
- org.osgi.util.tracker,\
- aQute.*
+ org.osgi.util.tracker
-runee: JavaSE-1.6
-runvm: -ea
-runfw: org.apache.felix.framework;version='[4,5)'
-buildpath: \
- osgi.core;version=4.2,\
+ osgi.core;version=4.3,\
org.apache.ace.agent;version=latest,\
org.apache.ace.builder;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.felix.dependencymanager,\
- org.apache.felix.http.jetty,\
- biz.aQute.bnd,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
+ javax.servlet,\
junit.osgi
-runsystempackages: sun.reflect
-runproperties: \
Modified: ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/BaseAgentControllerTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/BaseAgentControllerTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/BaseAgentControllerTest.java (original)
+++ ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/BaseAgentControllerTest.java Wed Jan 27 13:24:03 2016
@@ -22,6 +22,7 @@ import org.apache.ace.agent.DeploymentHa
import org.apache.ace.builder.DeploymentPackageBuilder;
import org.apache.ace.it.IntegrationTestBase;
import org.apache.ace.test.constants.TestConstants;
+import org.apache.ace.test.utils.FileUtils;
import org.apache.ace.test.utils.NetUtils;
import org.apache.felix.dm.Component;
import org.osgi.framework.Bundle;
@@ -30,9 +31,6 @@ import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.Version;
import org.osgi.service.http.HttpService;
-import aQute.bnd.osgi.Builder;
-import aQute.bnd.osgi.Jar;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -401,28 +399,7 @@ public abstract class BaseAgentControlle
}
protected static File createBundle(String bsn, Version version, String... headers) throws Exception {
- Builder b = new Builder();
-
- try {
- b.setProperty("Bundle-SymbolicName", bsn);
- b.setProperty("Bundle-Version", version.toString());
- for (int i = 0; i < headers.length; i += 2) {
- b.setProperty(headers[i], headers[i + 1]);
- }
- b.setProperty("Include-Resource", "bnd.bnd"); // prevent empty jar bug
-
- Jar jar = b.build();
- jar.getManifest(); // Not sure whether this is needed...
-
- File file = File.createTempFile("testbundle", ".jar");
- file.deleteOnExit();
-
- jar.write(file);
- return file;
- }
- finally {
- b.close();
- }
+ return FileUtils.createEmptyBundle(bsn, version, headers);
}
protected static File createPackage(String name, Version version, File... bundles) throws Exception {
Modified: ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/CustomAgentControllerTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/CustomAgentControllerTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/CustomAgentControllerTest.java (original)
+++ ace/trunk/org.apache.ace.agent.controller.itest/src/org/apache/ace/agent/itest/CustomAgentControllerTest.java Wed Jan 27 13:24:03 2016
@@ -110,9 +110,9 @@ public class CustomAgentControllerTest e
public void start(AgentContext agentContext) throws Exception {
logInfo("Custom controller running...");
- ServiceReference serviceRef = m_bundleContext.getServiceReference(AgentUser.class.getName());
+ ServiceReference<AgentUser> serviceRef = m_bundleContext.getServiceReference(AgentUser.class);
if (serviceRef != null) {
- m_agentUser = (AgentUser) m_bundleContext.getService(serviceRef);
+ m_agentUser = m_bundleContext.getService(serviceRef);
}
else {
throw new IllegalStateException("No agent user service registered?!");
Modified: 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=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.agent.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -5,9 +5,8 @@
org.apache.ace.builder;version=latest,\
org.apache.felix.configadmin,\
org.apache.felix.dependencymanager,\
- org.apache.felix.http.jetty,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
org.apache.felix.log,\
- biz.aQute.bnd,\
osgi.cmpn
-runee: JavaSE-1.7
-runvm: -ea
@@ -18,7 +17,8 @@
org.apache.ace.builder;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.felix.dependencymanager,\
- org.apache.felix.http.jetty,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
+ javax.servlet,\
junit.osgi,\
org.mockito.mockito-all
-runsystempackages: sun.reflect
Modified: ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/AgentDeploymentTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/AgentDeploymentTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/AgentDeploymentTest.java (original)
+++ ace/trunk/org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/AgentDeploymentTest.java Wed Jan 27 13:24:03 2016
@@ -768,10 +768,10 @@ public class AgentDeploymentTest extends
}
private void waitForInstalledVersion(Version version) throws Exception {
- ServiceReference reference = m_bundleContext.getServiceReference(AgentControl.class.getName());
+ ServiceReference<AgentControl> reference = m_bundleContext.getServiceReference(AgentControl.class);
try {
- AgentControl control = (AgentControl) m_bundleContext.getService(reference);
+ AgentControl control = m_bundleContext.getService(reference);
DeploymentHandler deploymentHandler = control.getDeploymentHandler();
int timeout = 100;
Modified: ace/trunk/org.apache.ace.agent.update.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.update.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.update.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.agent.update.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -8,20 +8,9 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;j
org.apache.ace.agent;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.felix.dependencymanager,\
- osgi.cmpn,\
- org.apache.felix.http.jetty,\
- org.apache.ace.deployment.servlet;version=latest,\
- org.apache.ace.deployment.api;version=latest,\
- org.apache.ace.deployment.streamgenerator;version=latest,\
- org.apache.ace.authentication.api;version=latest,\
- org.apache.ace.connectionfactory;version=latest,\
- org.apache.ace.deployment.provider.api;version=latest,\
- org.apache.ace.deployment.provider.filebased;version=latest,\
org.apache.felix.configadmin,\
- org.apache.ace.http.listener;version=latest,\
- biz.aQute.bnd,\
- org.apache.ace.builder;version=latest,\
- org.apache.ace.log.api;version=latest
+ org.apache.felix.http.jetty;version='[2.2,3)',\
+ osgi.cmpn
Private-Package: org.apache.ace.agent.itest
-runee: JavaSE-1.6
-runvm: -ea
@@ -31,8 +20,8 @@ Private-Package: org.apache.ace.agent.it
org.apache.ace.agent;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.felix.dependencymanager,\
- org.apache.felix.http.jetty,\
- biz.aQute.bnd,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
+ javax.servlet,\
junit.osgi,\
org.mockito.mockito-all
-runsystempackages: sun.reflect
Modified: ace/trunk/org.apache.ace.agent.update.itest/src/org/apache/ace/agent/itest/AgentUpdateTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent.update.itest/src/org/apache/ace/agent/itest/AgentUpdateTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent.update.itest/src/org/apache/ace/agent/itest/AgentUpdateTest.java (original)
+++ ace/trunk/org.apache.ace.agent.update.itest/src/org/apache/ace/agent/itest/AgentUpdateTest.java Wed Jan 27 13:24:03 2016
@@ -60,6 +60,30 @@ import org.osgi.service.http.HttpService
* </ul>
*/
public class AgentUpdateTest extends IntegrationTestBase {
+ final class DummyAgentVersionServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ final AgentUpdateOBRServlet servlet = AgentUpdateTest.this.m_servlet;
+ final String path = "/defaultTargetID/org.apache.ace.agent/versions/";
+
+ String pathInfo = req.getPathInfo();
+ if (path.equals(pathInfo)) {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ resp.getWriter().println(servlet.m_currentVersion);
+ resp.getWriter().println(servlet.m_nextVersion);
+ }
+ else if (pathInfo.startsWith(path)) {
+ String version = pathInfo.substring(path.length());
+ resp.sendRedirect("/obr/" + version + ".jar");
+ }
+ else {
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+ }
+
private static class DummyAuditLogServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -84,20 +108,20 @@ public class AgentUpdateTest extends Int
}
}
- private static class AgentUpdateOBRServlet extends HttpServlet {
+ static class AgentUpdateOBRServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
-
- private final String m_currentVersion;
- private final String m_nextVersion;
-
- private Phase m_phase;
- private CountDownLatch m_latch;
-
+
+ final String m_currentVersion;
+ final String m_nextVersion;
+
+ volatile Phase m_phase;
+ volatile CountDownLatch m_latch;
+
public AgentUpdateOBRServlet(Version currentVersion) {
- m_currentVersion = currentVersion.toString();
- // Determine the next version we want to update to...
- m_nextVersion = new Version(currentVersion.getMajor(), currentVersion.getMinor(), currentVersion.getMicro() + 1).toString();
- }
+ m_currentVersion = currentVersion.toString();
+ // Determine the next version we want to update to...
+ m_nextVersion = new Version(currentVersion.getMajor(), currentVersion.getMinor(), currentVersion.getMicro() + 1).toString();
+ }
public synchronized CountDownLatch setPhase(Phase phase, CountDownLatch latch) {
m_phase = phase;
@@ -105,9 +129,9 @@ public class AgentUpdateTest extends Int
System.out.printf("Updating in phase: %s (from v%s to v%s)...%n", phase, m_currentVersion, m_nextVersion);
return latch;
}
-
+
public Version getNextAgentVersion() {
- return new Version(m_nextVersion);
+ return new Version(m_nextVersion);
}
@Override
@@ -121,8 +145,8 @@ public class AgentUpdateTest extends Int
w.println("</repository>");
}
else {
- String currentAgentJAR = m_currentVersion + ".jar";
- String nextAgentJAR = m_nextVersion + ".jar";
+ String currentAgentJAR = m_currentVersion + ".jar";
+ String nextAgentJAR = m_nextVersion + ".jar";
if (path.endsWith(currentAgentJAR)) {
write(getBundle(), m_currentVersion, resp.getOutputStream());
@@ -213,10 +237,10 @@ public class AgentUpdateTest extends Int
while (timeout-- > 0) {
Version agentVersion = getCurrentAgentVersion();
if (agentVersion.equals(m_servlet.getNextAgentVersion())) {
- return;
+ return;
}
- Thread.sleep(200);
+ Thread.sleep(100);
}
fail("Timed out waiting for update with new agent.");
}
@@ -239,9 +263,9 @@ public class AgentUpdateTest extends Int
@Override
protected void configureAdditionalServices() throws Exception {
- // We need to know the *current* version of the agent, as we're trying to get it updated to a later version!
- Version currentAgentVersion = getCurrentAgentVersion();
-
+ // We need to know the *current* version of the agent, as we're trying to get it updated to a later version!
+ Version currentAgentVersion = getCurrentAgentVersion();
+
m_servlet = new AgentUpdateOBRServlet(currentAgentVersion);
String url = String.format("http://localhost:%d/obr", TestConstants.PORT);
@@ -250,6 +274,7 @@ public class AgentUpdateTest extends Int
m_http.registerServlet("/obr", m_servlet, null, null);
m_http.registerServlet("/auditlog", new DummyAuditLogServlet(), null, null);
m_http.registerServlet("/deployment", new DeploymentServlet(), null, null);
+ m_http.registerServlet("/agent", new DummyAgentVersionServlet(), null, null);
NetUtils.waitForURL(url, 200, 10000);
}
@@ -258,6 +283,8 @@ public class AgentUpdateTest extends Int
protected void doTearDown() throws Exception {
m_http.unregister("/obr");
m_http.unregister("/auditlog");
+ m_http.unregister("/deployment");
+ m_http.unregister("/agent");
}
@Override
@@ -268,16 +295,16 @@ public class AgentUpdateTest extends Int
.add(createServiceDependency().setService(HttpService.class).setRequired(true))
};
}
-
+
private Version getCurrentAgentVersion() {
- Bundle agent = null;
- for (Bundle bundle : m_bundleContext.getBundles()) {
- if ("org.apache.ace.agent".equals(bundle.getSymbolicName())) {
- agent = bundle;
- break;
- }
- }
- assertNotNull("Agent bundle not found?!", agent);
- return agent.getVersion();
+ Bundle agent = null;
+ for (Bundle bundle : m_bundleContext.getBundles()) {
+ if ("org.apache.ace.agent".equals(bundle.getSymbolicName())) {
+ agent = bundle;
+ break;
+ }
+ }
+ assertNotNull("Agent bundle not found?!", agent);
+ return agent.getVersion();
}
}
Modified: ace/trunk/org.apache.ace.agent/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.agent/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -33,12 +33,12 @@ Export-Package: org.apache.ace.agent,\
-buildpath: \
${^-buildpath},\
- osgi.core;version=4.2,\
- osgi.cmpn;version=4.2,\
- javax.servlet;version=2.5,\
- org.apache.felix.deploymentadmin;version='[0.9.8,1.0)',\
+ osgi.core;version=4.3,\
+ osgi.cmpn;version=4.3,\
org.easymock,\
+ javax.servlet,\
+ org.apache.felix.http.jetty;version='[2.2,3)',\
+ org.apache.felix.deploymentadmin,\
org.apache.ace.test;version=latest,\
- org.apache.felix.http.jetty;version=2.2.1,\
org.apache.ace.range.api;version=latest,\
org.apache.ace.feedback.common;version=latest
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java Wed Jan 27 13:24:03 2016
@@ -46,6 +46,7 @@ import org.osgi.service.packageadmin.Pac
/**
* Bundle activator for ACE management agent.
*/
+@SuppressWarnings("deprecation")
public class Activator implements BundleActivator, LifecycleCallback {
// managed state
private volatile AgentContextImpl m_agentContext;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java Wed Jan 27 13:24:03 2016
@@ -98,8 +98,10 @@ public class AgentUpdateHandlerImpl exte
InputStream currentBundleVersion = getInputStream(m_bundleContext.getBundle().getVersion(), false /* fixPackage */);
Bundle bundle = m_bundleContext.installBundle("agent-updater", generateBundle());
bundle.start();
- ServiceTracker st = new ServiceTracker(m_bundleContext, m_bundleContext.createFilter("(" + Constants.OBJECTCLASS + "=org.apache.ace.agent.updater.Activator)"), null);
+
+ ServiceTracker<Object, Object> st = new ServiceTracker<>(m_bundleContext, m_bundleContext.createFilter("(" + Constants.OBJECTCLASS + "=org.apache.ace.agent.updater.Activator)"), null);
st.open(true);
+
Object service = st.waitForService(TIMEOUT);
if (service != null) {
Method method = service.getClass().getMethod("update", Bundle.class, InputStream.class, InputStream.class);
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DependencyTrackerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DependencyTrackerImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DependencyTrackerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DependencyTrackerImpl.java Wed Jan 27 13:24:03 2016
@@ -64,19 +64,19 @@ public class DependencyTrackerImpl {
/**
* Represents an actual dependency on an OSGi service.
*/
- private static class ServiceDependency {
+ private static class ServiceDependency<T> {
private final DependencyTrackerImpl m_manager;
private final DependencyCallback m_calback;
- private final ServiceTracker m_tracker;
+ private final ServiceTracker<T, T> m_tracker;
// the actual tracked service...
- private final AtomicReference<Object> m_serviceRef;
+ private final AtomicReference<T> m_serviceRef;
public ServiceDependency(DependencyTrackerImpl manager, String filterString, DependencyCallback callback) throws Exception {
m_manager = manager;
m_calback = callback;
- m_tracker = new ServiceDependencyTracker(this, manager.getBundleContext(), FrameworkUtil.createFilter(filterString));
- m_serviceRef = new AtomicReference<Object>();
+ m_tracker = new ServiceDependencyTracker<T>(this, manager.getBundleContext(), FrameworkUtil.createFilter(filterString));
+ m_serviceRef = new AtomicReference<T>();
}
public Object getService() {
@@ -95,9 +95,9 @@ public class DependencyTrackerImpl {
m_tracker.close();
}
- void changed(ServiceReference ref) {
- Object service = (ref == null) ? null : m_manager.getBundleContext().getService(ref);
- Object oldService;
+ void changed(ServiceReference<T> ref) {
+ T service = (ref == null) ? null : m_manager.getBundleContext().getService(ref);
+ T oldService;
do {
oldService = m_serviceRef.get();
}
@@ -118,18 +118,18 @@ public class DependencyTrackerImpl {
* Tracker customizer that calls AgentContextDependency#changed with the highest matching service whenever something
* changes.
*/
- private static class ServiceDependencyTracker extends ServiceTracker {
- private final CopyOnWriteArrayList<ServiceReference> m_trackedServiceRefs;
+ private static class ServiceDependencyTracker<T> extends ServiceTracker<T, T> {
+ private final CopyOnWriteArrayList<ServiceReference<T>> m_trackedServiceRefs;
private final ServiceDependency m_dependency;
public ServiceDependencyTracker(ServiceDependency dependency, BundleContext context, Filter filter) {
super(context, filter, null);
m_dependency = dependency;
- m_trackedServiceRefs = new CopyOnWriteArrayList<ServiceReference>();
+ m_trackedServiceRefs = new CopyOnWriteArrayList<ServiceReference<T>>();
}
@Override
- public Object addingService(ServiceReference reference) {
+ public T addingService(ServiceReference<T> reference) {
if (m_trackedServiceRefs.addIfAbsent(reference)) {
checkForUpdate();
}
@@ -137,12 +137,12 @@ public class DependencyTrackerImpl {
}
@Override
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<T> reference, T service) {
checkForUpdate();
}
@Override
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<T> reference, T service) {
if (m_trackedServiceRefs.remove(reference)) {
checkForUpdate();
}
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DeploymentHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DeploymentHandlerImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DeploymentHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DeploymentHandlerImpl.java Wed Jan 27 13:24:03 2016
@@ -47,6 +47,7 @@ import org.osgi.service.event.EventAdmin
import org.osgi.service.log.LogService;
import org.osgi.service.packageadmin.PackageAdmin;
+@SuppressWarnings("deprecation")
public class DeploymentHandlerImpl extends UpdateHandlerBase implements DeploymentHandler {
/**
@@ -85,7 +86,7 @@ public class DeploymentHandlerImpl exten
private void invokeExternalEventAdmin(String method, Event event) {
try {
// try to find an EventAdmin service
- ServiceReference[] refs = m_context.getAllServiceReferences(EventAdmin.class.getName(), null);
+ ServiceReference<?>[] refs = m_context.getAllServiceReferences(EventAdmin.class.getName(), null);
if (refs != null && refs.length > 0) {
// if we've found one (or more) we pick the first match
Object svc = m_context.getService(refs[0]);
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/EventsHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/EventsHandlerImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/EventsHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/EventsHandlerImpl.java Wed Jan 27 13:24:03 2016
@@ -39,7 +39,7 @@ public class EventsHandlerImpl extends C
private final CopyOnWriteArrayList<EventListener> m_listeners = new CopyOnWriteArrayList<EventListener>();
private final BundleContext m_bundleContext;
//
- private volatile ServiceTracker m_tracker;
+ private volatile ServiceTracker<EventListener, EventListener> m_tracker;
public EventsHandlerImpl(BundleContext bundleContext) throws Exception {
super("events");
@@ -97,21 +97,21 @@ public class EventsHandlerImpl extends C
@Override
protected void onInit() throws Exception {
- m_tracker = new ServiceTracker(m_bundleContext, EventListener.class.getName(), new ServiceTrackerCustomizer() {
+ m_tracker = new ServiceTracker<>(m_bundleContext, EventListener.class, new ServiceTrackerCustomizer<EventListener, EventListener>() {
@Override
- public Object addingService(ServiceReference reference) {
- Object service = m_bundleContext.getService(reference);
- addListener((EventListener) service);
+ public EventListener addingService(ServiceReference<EventListener> reference) {
+ EventListener service = m_bundleContext.getService(reference);
+ addListener(service);
return service;
}
@Override
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<EventListener> reference, EventListener service) {
}
@Override
- public void removedService(ServiceReference reference, Object service) {
- removeListener((EventListener) service);
+ public void removedService(ServiceReference<EventListener> reference, EventListener service) {
+ removeListener(service);
}
});
m_tracker.open();
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/LoggingHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/LoggingHandlerImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/LoggingHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/LoggingHandlerImpl.java Wed Jan 27 13:24:03 2016
@@ -124,7 +124,7 @@ public class LoggingHandlerImpl extends
*/
private boolean invokeExternalLogService(Levels logLevel, String message, Throwable exception) {
try {
- ServiceReference[] refs = m_context.getAllServiceReferences(LogService.class.getName(), null);
+ ServiceReference<?>[] refs = m_context.getAllServiceReferences(LogService.class.getName(), null);
if (refs != null && refs.length > 0) {
// if we've found one (or more) we pick the first match
Object svc = m_context.getService(refs[0]);
Modified: ace/trunk/org.apache.ace.authentication.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.authentication.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -1,6 +1,6 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-Test-Cases: ${classes;CONCRETE;EXTENDS;org.apache.ace.it.authentication.AuthenticationTestBase}
+Test-Cases: ${classes;CONCRETE;NAMED;*Test}
-buildpath: \
junit.osgi,\
osgi.core;version=6.0.0,\
@@ -29,6 +29,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.felix.configadmin,\
org.apache.felix.eventadmin,\
org.apache.felix.prefs,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.useradmin,\
org.apache.felix.useradmin.filestore,\
@@ -69,11 +70,6 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.ace.feedback.common;version=latest
Private-Package: org.apache.ace.it.authentication
Bundle-Version: 1.0.0
--runrepos: Local,\
- Bndtools Hub,\
- Library Repository,\
- Release,\
- Workspace
Bundle-Name: Apache ACE Authentication itest
Bundle-Category: itest
Bundle-Description: Integration tests for Apache ACE Authentication
Modified: ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java (original)
+++ ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java Wed Jan 27 13:24:03 2016
@@ -148,11 +148,13 @@ public class ObrAuthenticationTest exten
@Override
public void doTearDown() throws Exception {
- FileUtils.removeDirectoryWithContent(m_storeLocation);
- Configuration configuration = getConfiguration(m_authConfigPID);
- if (configuration != null) {
- configuration.delete();
+ if (m_authConfigPID != null) {
+ Configuration configuration = getConfiguration(m_authConfigPID);
+ if (configuration != null) {
+ configuration.delete();
+ }
}
+ FileUtils.removeDirectoryWithContent(m_storeLocation);
}
/**
Modified: ace/trunk/org.apache.ace.authentication/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.authentication/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -6,7 +6,7 @@
osgi.cmpn,\
org.mockito.mockito-all,\
org.apache.felix.dependencymanager,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
bcprov,\
bcpkix,\
org.apache.commons.codec,\
Modified: ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -5,6 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
junit.osgi,\
osgi.core;version=6.0.0,\
osgi.cmpn,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
org.apache.ace.test;version=latest,\
org.apache.ace.http.listener;version=latest,\
@@ -13,7 +14,6 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.ace.discovery.property;version=latest,\
org.apache.ace.identification.api;version=latest,\
org.apache.ace.identification.property;version=latest,\
- javax.servlet,\
org.apache.ace.scheduler.api;version=latest,\
org.apache.ace.deployment.servlet;version=latest,\
org.apache.ace.deployment.provider.filebased;version=latest,\
@@ -30,6 +30,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
org.apache.felix.eventadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.deploymentadmin,\
org.apache.felix.prefs,\
Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java Wed Jan 27 13:24:03 2016
@@ -155,7 +155,7 @@ public abstract class BaseRepositoryAdmi
protected final void addRepository(String instanceName, String customer, String name, boolean isMaster) throws IOException,
InterruptedException, InvalidSyntaxException {
// Publish configuration for a repository instance
- Properties props = new Properties();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put(RepositoryConstants.REPOSITORY_CUSTOMER, customer);
props.put(RepositoryConstants.REPOSITORY_NAME, name);
props.put(RepositoryConstants.REPOSITORY_MASTER, String.valueOf(isMaster));
@@ -305,11 +305,12 @@ public abstract class BaseRepositoryAdmi
// This is a little ugly: we cannot just delete the configuration, since that will result in a
// sharing violation between this bundle and the servlet bundle. In stead, we make the servlet
// use an invalid endpoint.
- Properties propsServlet = new Properties();
+ Dictionary<String, Object> propsServlet = new Hashtable<>();
propsServlet.put(HttpConstants.ENDPOINT, endpoint + "invalid");
propsServlet.put("OBRInstance", "singleOBRServlet");
propsServlet.put("authentication.enabled", "false");
Configuration configServlet = m_configAdmin.getConfiguration("org.apache.ace.obr.servlet");
+
configServlet.update(propsServlet);
URL url = new URL("http://localhost:" + TestConstants.PORT + "/" + endpoint + "/repository.xml");
Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java Wed Jan 27 13:24:03 2016
@@ -20,8 +20,9 @@
package org.apache.ace.it.repositoryadmin;
import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
import java.util.List;
-import java.util.Properties;
import java.util.concurrent.Callable;
import org.apache.ace.client.repository.RepositoryAdmin;
@@ -52,7 +53,7 @@ public class ClientAutomationTest extend
addRepository("deploymentInstance", "apache", "deployment", true);
// configure automation bundle; new configuration properties; bundle will start
- final Properties props = new Properties();
+ final Dictionary<String, Object> props = new Hashtable<>();
props.put("registerTargetFilter", "(id=anotherTarget*)");
props.put("approveTargetFilter", "(id=DO_NOTHING)");
props.put("autoApproveTargetFilter", "(id=anotherTarget*)");
Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/Activator.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/Activator.java (original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/Activator.java Wed Jan 27 13:24:03 2016
@@ -170,7 +170,7 @@ public class Activator extends Dependenc
}
@Override
- public void updated(Dictionary properties) throws ConfigurationException {
+ public void updated(Dictionary<String, ?> properties) throws ConfigurationException {
m_repoConfiguration.update(properties);
}
Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/ChangeNotifierImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/ChangeNotifierImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/ChangeNotifierImpl.java (original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/ChangeNotifierImpl.java Wed Jan 27 13:24:03 2016
@@ -75,6 +75,7 @@ public class ChangeNotifierImpl implemen
return props;
}
+ @SuppressWarnings("unchecked")
public void notifyChanged(String topic, Properties props, boolean internalOnly) {
props = addSession(props);
m_eventAdmin.sendEvent(new Event(m_privateTopicRoot + m_entityRoot + topic, (Dictionary) props));
Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/RepositoryConfigurationImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/RepositoryConfigurationImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/RepositoryConfigurationImpl.java (original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/RepositoryConfigurationImpl.java Wed Jan 27 13:24:03 2016
@@ -183,7 +183,7 @@ final class RepositoryConfigurationImpl
* the dictionary with the new configuration options, can be <code>null</code> in case the default values
* should be used.
*/
- public void update(Dictionary<String, Object> dict) {
+ public void update(Dictionary<String, ?> dict) {
Lock lock = m_lock.writeLock();
lock.lock();
try {
Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java (original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java Wed Jan 27 13:24:03 2016
@@ -365,6 +365,7 @@ public class StatefulTargetRepositoryImp
* A Properties event, already containing some extra properties. If RepositoryObject.EVENT_ENTITY is
* used, it will be overwritten.
*/
+ @SuppressWarnings("unchecked")
void notifyChanged(StatefulTargetObject stoi, String topic, Properties additionalProperties) {
additionalProperties.put(RepositoryObject.EVENT_ENTITY, stoi);
additionalProperties.put(SessionFactory.SERVICE_SID, m_sessionID);
Modified: ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -4,10 +4,10 @@
osgi.core;version=6.0.0,\
osgi.cmpn,\
junit.osgi,\
- javax.servlet,\
com.sun.jersey.client,\
com.sun.jersey.core,\
com.google.gson,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
org.apache.ace.test;version=latest,\
org.apache.ace.http.listener;version=latest,\
@@ -37,6 +37,7 @@
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
org.apache.felix.eventadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.deploymentadmin,\
org.apache.felix.prefs,\
Modified: ace/trunk/org.apache.ace.client.rest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.rest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -4,9 +4,9 @@
${^-buildpath},\
osgi.core;version=6.0.0,\
osgi.cmpn,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
org.apache.ace.client.repository.api;version=latest,\
- javax.servlet,\
com.google.gson;version=1.7.1,\
org.mockito.mockito-all,\
org.apache.felix.gogo.command,\
Modified: ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -21,6 +21,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
-runvm: -ea
-runbundles: org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.prefs,\
osgi.cmpn,\
Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java (original)
+++ ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java Wed Jan 27 13:24:03 2016
@@ -23,11 +23,14 @@ import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -199,11 +202,10 @@ public class Configurator implements Run
* lastModified date has changed.
*/
private void processConfigFile(File configFile, String factoryPid) {
- InputStream in = null;
- try {
- in = new FileInputStream(configFile);
+ try (InputStream in = new FileInputStream(configFile)) {
Properties properties = new Properties();
properties.load(in);
+
String pid = parsePid(configFile);
properties = substVars(properties);
configure(pid, factoryPid, properties);
@@ -211,39 +213,32 @@ public class Configurator implements Run
catch (IOException ex) {
m_log.log(LogService.LOG_ERROR, "Unable to read configuration from file: " + configFile.getAbsolutePath(), ex);
}
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (Exception ex) {
- // Not much we can do
- }
- }
- }
}
private void configure(String pid, String factoryPid, Properties properties) {
try {
Configuration config = getConfiguration(pid, factoryPid);
- Dictionary oldProps = config.getProperties();
- if (!m_reconfig) {
- if (oldProps != null) {
- Enumeration keys = oldProps.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- if (properties.containsKey(key)) {
- properties.put(key, oldProps.get(key));
- m_log.log(LogService.LOG_DEBUG, "Using previously configured value for bundle=" + pid + " key=" + key);
- }
- }
+
+ Dictionary<String, Object> props = config.getProperties();
+ if (props == null) {
+ props = new Hashtable<>();
+ }
+
+ List<String> curKeys = Collections.list(props.keys());
+ for (Object key : properties.keySet()) {
+ if (curKeys.contains(key) && !m_reconfig) {
+ m_log.log(LogService.LOG_DEBUG, "Using previously configured value for bundle=" + pid + " key=" + key);
+ } else {
+ props.put((String) key, properties.get(key));
}
}
+
if (factoryPid != null) {
- properties.put(FACTORY_INSTANCE_KEY, factoryPid + "_" + pid);
+ props.put(FACTORY_INSTANCE_KEY, factoryPid + "_" + pid);
}
- config.update(properties);
- m_log.log(LogService.LOG_DEBUG, "Updated configuration for pid '" + pid + "' (" + properties + ")");
+
+ config.update(props);
+ m_log.log(LogService.LOG_DEBUG, "Updated configuration for pid '" + pid + "' (" + props + ")");
}
catch (IOException ex) {
m_log.log(LogService.LOG_ERROR, "Unable to update configuration for pid '" + pid + "'", ex);
Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java (original)
+++ ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java Wed Jan 27 13:24:03 2016
@@ -178,10 +178,12 @@ public class UpdateUserAdminTask impleme
* the remote repository to remove, cannot be <code>null</code>.
*/
final void removeRepo(Repository remoteRepo) {
- // Ensure the latest version is properly stored...
- saveVersion(m_properties, m_repo.getMostRecentVersion());
-
- m_repo = null;
+ if (m_repo != null) {
+ // Ensure the latest version is properly stored...
+ saveVersion(m_properties, m_repo.getMostRecentVersion());
+
+ m_repo = null;
+ }
}
private File getFile(String name) {
Modified: ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfiguration.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfiguration.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfiguration.java (original)
+++ ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfiguration.java Wed Jan 27 13:24:03 2016
@@ -25,9 +25,9 @@ import org.osgi.service.cm.Configuration
public class MockConfiguration implements Configuration {
private final MockConfigAdmin m_ca;
- private Dictionary m_properties = null;
+ private Dictionary<String, Object> m_properties = null;
private boolean m_isDeleted = false;
-
+
public MockConfiguration(MockConfigAdmin ca) {
m_ca = ca;
}
@@ -49,7 +49,7 @@ public class MockConfiguration implement
return null;
}
- public synchronized Dictionary getProperties() {
+ public synchronized Dictionary<String, Object> getProperties() {
return m_properties;
}
@@ -64,8 +64,9 @@ public class MockConfiguration implement
m_ca.configUpdated(this);
}
- public synchronized void update(Dictionary newConfiguration) throws IOException {
- m_properties = newConfiguration;
+ @SuppressWarnings("unchecked")
+ public synchronized void update(Dictionary<String, ?> newConfiguration) throws IOException {
+ m_properties = (Dictionary<String, Object>) newConfiguration;
m_ca.configUpdated(this);
}
}
Modified: ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -5,7 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
junit.osgi,\
osgi.core;version=6.0.0,\
osgi.cmpn,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
org.apache.ace.test;version=latest,\
org.apache.ace.http.listener;version=latest,\
@@ -28,6 +28,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
org.apache.felix.eventadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.deploymentadmin,\
org.apache.felix.log,\
Modified: ace/trunk/org.apache.ace.deployment/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -4,7 +4,7 @@
${^-buildpath},\
osgi.core;version=6.0.0,\
osgi.cmpn,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
com.vaadin,\
org.apache.ace.authentication.api;version=latest,\
Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/ContentRangeResponseWrapper.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/ContentRangeResponseWrapper.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/ContentRangeResponseWrapper.java (original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/ContentRangeResponseWrapper.java Wed Jan 27 13:24:03 2016
@@ -24,6 +24,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -107,6 +108,16 @@ public class ContentRangeResponseWrapper
public void close() throws IOException {
delegate.close();
}
+
+ @Override
+ public boolean isReady() {
+ return delegate.isReady();
+ }
+
+ @Override
+ public void setWriteListener(WriteListener l) {
+ delegate.setWriteListener(l);
+ }
};
}
Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/DeploymentCheckTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/DeploymentCheckTask.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/DeploymentCheckTask.java (original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/DeploymentCheckTask.java Wed Jan 27 13:24:03 2016
@@ -20,7 +20,7 @@ package org.apache.ace.deployment.task;
import java.net.MalformedURLException;
import java.util.Dictionary;
-import java.util.Properties;
+import java.util.Hashtable;
import org.apache.ace.deployment.service.DeploymentService;
import org.osgi.framework.Version;
@@ -78,10 +78,9 @@ public class DeploymentCheckTask impleme
* @return a new {@link Event} instance, never <code>null</code>.
*/
private Event createEvent(Version localVersion, Version remoteVersion) {
- Properties properties = new Properties();
+ Dictionary<String, Object> properties = new Hashtable<>();
properties.put("deploymentpackage.localversion", ((localVersion == null) ? Version.emptyVersion : localVersion));
properties.put("deploymentpackage.remoteversion", remoteVersion);
-
- return new Event(TOPIC_UPDATE_AVAILABLE, (Dictionary) properties);
+ return new Event(TOPIC_UPDATE_AVAILABLE, properties);
}
}
\ No newline at end of file
Modified: ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java (original)
+++ ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java Wed Jan 27 13:24:03 2016
@@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -444,6 +445,16 @@ public class DeploymentServletTest {
public void write(int b) throws IOException {
m_responseOutputStream.write(b);
}
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener l) {
+ // nop
+ }
};
}
Modified: ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -5,8 +5,8 @@ Bundle-Version: 1.0.0
${^-buildpath},\
osgi.core;version=6.0.0,\
osgi.cmpn,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
- javax.servlet,\
org.apache.ace.gogo;version=latest,\
org.apache.felix.gogo.runtime
Bundle-Activator: org.apache.ace.gogo.servlet.Activator
Modified: ace/trunk/org.apache.ace.http.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.http.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.http.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -13,12 +13,13 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.ace.identification.api;version=latest,\
org.apache.ace.identification.property;version=latest,\
org.apache.ace.log.server.store.api;version=latest,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
org.apache.ace.feedback.common;version=latest
-runfw: org.apache.felix.framework;version='[5.2.0,6)'
-runvm: -ea
-runbundles: osgi.cmpn,\
org.apache.felix.eventadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
Modified: ace/trunk/org.apache.ace.http/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.http/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.http/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -5,5 +5,5 @@
osgi.core;version=6.0.0,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- javax.servlet
+ org.apache.felix.http.servlet-api
-sub: *.bnd
Modified: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/redirector/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/redirector/Activator.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/redirector/Activator.java (original)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/redirector/Activator.java Wed Jan 27 13:24:03 2016
@@ -48,11 +48,13 @@ public class Activator extends Dependenc
public void destroy(BundleContext context, DependencyManager manager) throws Exception {
}
+ @Override
public String getName() {
return "Http Redirector";
}
- public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ @Override
+ public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
Component component = m_servlets.get(pid);
if (component == null) {
component = getDependencyManager().createComponent()
@@ -70,6 +72,7 @@ public class Activator extends Dependenc
}
}
+ @Override
public void deleted(String pid) {
Component component = m_servlets.remove(pid);
if (component != null) {
Modified: ace/trunk/org.apache.ace.location.upnp/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.location.upnp/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.location.upnp/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.location.upnp/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -4,8 +4,8 @@
${^-buildpath},\
osgi.core;version=6.0.0,\
osgi.cmpn,\
- org.apache.felix.dependencymanager,\
- javax.servlet
+ org.apache.felix.http.servlet-api,\
+ org.apache.felix.dependencymanager
Export-Package: org.apache.ace.location
Bundle-Version: 1.0.2
Bundle-Name: Apache ACE Location UPnP
Modified: ace/trunk/org.apache.ace.log.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -21,6 +21,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.felix.eventadmin,\
org.apache.ace.authentication.api;version=latest,\
Modified: ace/trunk/org.apache.ace.log/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -4,7 +4,7 @@
${^-buildpath},\
osgi.core;version=6.0.0,\
osgi.cmpn,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.dependencymanager,\
org.apache.ace.range.api;version=latest,\
org.apache.ace.test;version=latest,\
Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java Wed Jan 27 13:24:03 2016
@@ -28,8 +28,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import org.apache.ace.feedback.Descriptor;
import org.apache.ace.feedback.Event;
@@ -246,6 +248,16 @@ public class LogServletTest {
@Override
public void write(int arg0) throws IOException {
}
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener l) {
+ // nop
+ }
}
private class MockServletInputStream extends ServletInputStream {
@@ -265,5 +277,20 @@ public class LogServletTest {
public void setBytes(byte[] bytes) {
m_bytes = bytes;
}
+
+ @Override
+ public boolean isFinished() {
+ return i >= m_bytes.length;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setReadListener(ReadListener l) {
+ // nop
+ }
}
}
Modified: ace/trunk/org.apache.ace.obr/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.obr/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.obr/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.obr/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -6,7 +6,7 @@
osgi.core;version=6.0.0,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- javax.servlet,\
+ org.apache.felix.http.servlet-api,\
org.apache.ace.authentication.api;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.ace.deployment.provider.api;version=latest,\
Modified: ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java (original)
+++ ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/storage/file/BundleFileStore.java Wed Jan 27 13:24:03 2016
@@ -49,10 +49,10 @@ import org.osgi.service.log.LogService;
* absolute path).
*/
public class BundleFileStore implements BundleStore, ManagedService {
-
- private static int BUFFER_SIZE = 8 * 1024;
private static final String REPOSITORY_XML = "repository.xml";
+ private static int BUFFER_SIZE = 8 * 1024;
+ private final Object m_lock = new Object();
// injected by dependencymanager
private volatile MetadataGenerator m_metadata;
private volatile LogService m_log;
@@ -67,8 +67,9 @@ public class BundleFileStore implements
* If there is a problem synchronizing the meta-data.
*/
public void synchronizeMetadata() throws IOException {
- File dir = m_dir;
- synchronized (REPOSITORY_XML) {
+ synchronized (m_lock) {
+ File dir = m_dir;
+
if (m_dirChecksum == null || !m_dirChecksum.equals(getDirChecksum(dir))) {
m_metadata.generateMetadata(dir);
m_dirChecksum = getDirChecksum(dir);
@@ -80,6 +81,7 @@ public class BundleFileStore implements
if (REPOSITORY_XML.equals(fileName)) {
synchronizeMetadata();
}
+
FileInputStream result = null;
try {
result = new FileInputStream(createFile(fileName));
@@ -87,11 +89,11 @@ public class BundleFileStore implements
catch (FileNotFoundException e) {
// Resource does not exist; notify caller by returning null...
}
+
return result;
}
public String put(InputStream data, String fileName, boolean replace) throws IOException {
-
if (fileName == null) {
fileName = "";
}
@@ -102,21 +104,24 @@ public class BundleFileStore implements
metaData = ResourceMetaData.getArtifactMetaData(fileName);
}
if (metaData == null) {
+ tempFile.delete();
throw new IOException("Not a valid bundle and no filename found (filename = " + fileName + ")");
}
File storeLocation = getResourceFile(metaData);
if (storeLocation == null) {
- throw new IOException("Failed to store resource (filename = " + fileName + ")");
+ tempFile.delete();
+ throw new IOException("Failed to store resource (filename = " + fileName + ")");
}
+
if (storeLocation.exists()) {
- if (replace || compare(storeLocation, tempFile)) {
- m_log.log(LogService.LOG_DEBUG, "Exact same resource already existed in OBR (filename = " + fileName + ")");
- }
- else {
- m_log.log(LogService.LOG_ERROR, "Different resource with same name already existed in OBR (filename = " + fileName + ")");
- return null;
- }
+ if (replace || compare(storeLocation, tempFile)) {
+ m_log.log(LogService.LOG_DEBUG, "Exact same resource already existed in OBR (filename = " + fileName + ")");
+ }
+ else {
+ m_log.log(LogService.LOG_ERROR, "Different resource with same name already existed in OBR (filename = " + fileName + ")");
+ return null;
+ }
}
moveFile(tempFile, storeLocation);
@@ -130,42 +135,49 @@ public class BundleFileStore implements
/** Compares the contents of two files, returns <code>true</code> if they're exactly the same. */
private boolean compare(File first, File second) throws IOException {
- BufferedInputStream bis = new BufferedInputStream(new FileInputStream(first));
- BufferedInputStream bis2 = new BufferedInputStream(new FileInputStream(second));
- int b1, b2;
- try {
- do {
- b1 = bis.read();
- b2 = bis2.read();
- if (b1 != b2) {
- return false;
- }
- }
- while (b1 != -1 && b2 != -1);
- return (b1 == b2);
- }
- finally {
- if (bis != null) {
- try {
- bis.close();
- }
- catch (IOException e) {}
- }
- if (bis2 != null) {
- try {
- bis2.close();
- }
- catch (IOException e) {}
- }
- }
- }
+ BufferedInputStream bis = new BufferedInputStream(new FileInputStream(first));
+ BufferedInputStream bis2 = new BufferedInputStream(new FileInputStream(second));
+ int b1, b2;
+ try {
+ do {
+ b1 = bis.read();
+ b2 = bis2.read();
+ if (b1 != b2) {
+ return false;
+ }
+ }
+ while (b1 != -1 && b2 != -1);
+ return (b1 == b2);
+ }
+ finally {
+ if (bis != null) {
+ try {
+ bis.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ if (bis2 != null) {
+ try {
+ bis2.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ public boolean remove(String fileName) throws IOException {
+ File dir;
+ synchronized (m_lock) {
+ dir = m_dir;
+ }
- public boolean remove(String fileName) throws IOException {
File file = createFile(fileName);
if (file.exists()) {
if (file.delete()) {
// deleting empty parent dirs
- while ((file = file.getParentFile()) != null && !file.equals(m_dir) && file.list().length == 0) {
+ while ((file = file.getParentFile()) != null && !file.equals(dir) && file.list().length == 0) {
file.delete();
}
return true;
@@ -195,8 +207,10 @@ public class BundleFileStore implements
throw new ConfigurationException(OBRFileStoreConstants.FILE_LOCATION_KEY, "Is not a directory: " + newDir);
}
- m_dir = newDir;
- m_dirChecksum = "";
+ synchronized (m_lock) {
+ m_dir = newDir;
+ m_dirChecksum = "";
+ }
}
}
}
@@ -289,7 +303,6 @@ public class BundleFileStore implements
* in case of I/O problems.
*/
private File getResourceFile(ResourceMetaData metaData) throws IOException {
-
File resourceDirectory = getWorkingDir();
String[] dirs = split(metaData.getSymbolicName());
for (int i = 0; i < (dirs.length - 1); i++) {
@@ -311,12 +324,13 @@ public class BundleFileStore implements
}
return new File(resourceDirectory, name);
}
-
+
/**
- * Splits a name into parts, breaking at all dots as long as what's behind the dot resembles a
- * Java package name (ie. it starts with a lowercase character).
+ * Splits a name into parts, breaking at all dots as long as what's behind the dot resembles a Java package name
+ * (ie. it starts with a lowercase character).
*
- * @param name the name to split
+ * @param name
+ * the name to split
* @return an array of parts
*/
public static String[] split(String name) {
@@ -342,7 +356,9 @@ public class BundleFileStore implements
* @return the working directory of this file store.
*/
private File getWorkingDir() {
- return m_dir;
+ synchronized (m_lock) {
+ return m_dir;
+ }
}
/**
Modified: ace/trunk/org.apache.ace.obr/test/org/apache/ace/obr/servlet/BundleServletTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.obr/test/org/apache/ace/obr/servlet/BundleServletTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.obr/test/org/apache/ace/obr/servlet/BundleServletTest.java (original)
+++ ace/trunk/org.apache.ace.obr/test/org/apache/ace/obr/servlet/BundleServletTest.java Wed Jan 27 13:24:03 2016
@@ -31,8 +31,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Random;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -70,12 +72,12 @@ public class BundleServletTest {
public String getScheme() {
return "http";
}
-
+
@SuppressWarnings("unused")
public String getServerName() {
return "localhost";
}
-
+
@SuppressWarnings("unused")
public int getServerPort() {
return 9999;
@@ -100,6 +102,7 @@ public class BundleServletTest {
public ServletInputStream getInputStream() {
return new ServletInputStream() {
int i = 0;
+
@Override
public int read() throws IOException {
if (i == 0) {
@@ -111,6 +114,20 @@ public class BundleServletTest {
}
}
+ @Override
+ public boolean isFinished() {
+ return i > 0;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setReadListener(ReadListener l) {
+ // nop
+ }
};
}
});
@@ -131,6 +148,16 @@ public class BundleServletTest {
m_byteStream.write(s.charAt(i));
}
}
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setWriteListener(WriteListener l) {
+ // nop
+ }
};
}
@@ -252,7 +279,8 @@ public class BundleServletTest {
if (inStream != null) {
inStream.close();
}
- } finally {
+ }
+ finally {
if (outStream != null) {
outStream.close();
}
Modified: ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherRespawnIntegrationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherRespawnIntegrationTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherRespawnIntegrationTest.java (original)
+++ ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherRespawnIntegrationTest.java Wed Jan 27 13:24:03 2016
@@ -25,6 +25,8 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
import java.util.Properties;
import org.apache.ace.it.IntegrationTestBase;
@@ -174,7 +176,7 @@ public class ProcessLauncherRespawnInteg
String.format("-c L=$(cat\\ %1$s\\ |\\ wc\\ -l)\\ &&\\ echo\\ $L\\ >>\\ %1$s\\ &&\\ exit\\ $((%2$d-$L))",
tmpFilename, count);
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "1");
launchConfig.put("executable.name", "/bin/bash");
launchConfig.put("executable.args", args);
@@ -305,7 +307,7 @@ public class ProcessLauncherRespawnInteg
* @throws AssertionFailedError in case the {@link ConfigurationAdmin} service couldn't be
* obtained.
*/
- private String configureFactory(String factoryPid, Properties properties) throws IOException {
+ private String configureFactory(String factoryPid, Dictionary<String, Object> properties) throws IOException {
assertNotNull("Parameter factoryPid cannot be null!", factoryPid);
org.osgi.service.cm.Configuration config = getConfigAdmin().createFactoryConfiguration(factoryPid, null);
Modified: ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherServiceIntegrationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherServiceIntegrationTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherServiceIntegrationTest.java (original)
+++ ace/trunk/org.apache.ace.processlauncher.itest/src/org/apache/ace/processlauncher/itest/ProcessLauncherServiceIntegrationTest.java Wed Jan 27 13:24:03 2016
@@ -26,7 +26,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Dictionary;
import java.util.Hashtable;
-import java.util.Properties;
import org.apache.ace.it.IntegrationTestBase;
import org.apache.ace.processlauncher.LaunchConfiguration;
@@ -61,7 +60,7 @@ public class ProcessLauncherServiceInteg
return;
}
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "2");
launchConfig.put("executable.name", "/bin/sh");
launchConfig.put("executable.args", "-c sleep\\ 1\\ &&\\ exit\\ 1");
@@ -100,7 +99,7 @@ public class ProcessLauncherServiceInteg
return;
}
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "2");
launchConfig.put("executable.name", "/bin/sh");
launchConfig.put("executable.args", "-c sleep\\ 1\\ &&\\ exit\\ 0");
@@ -144,7 +143,7 @@ public class ProcessLauncherServiceInteg
TestProcessStreamListener psl2 = new TestProcessStreamListener();
String filter = registerProcessStreamListener(psl2, "qux", "quu");
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "1");
launchConfig.put("executable.name", "/bin/sh");
launchConfig.put("executable.args", "-c sleep\\ 1\\ &&\\ exit\\ 0");
@@ -194,7 +193,7 @@ public class ProcessLauncherServiceInteg
String filter =
String.format("(&(%s=%s)(qux=quu))", Constants.OBJECTCLASS, ProcessStreamListener.class.getName());
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "1");
launchConfig.put("executable.name", "/bin/sh");
launchConfig.put("executable.args", "-c sleep\\ 1\\ &&\\ exit\\ 0");
@@ -241,7 +240,7 @@ public class ProcessLauncherServiceInteg
TestProcessStreamListener psl = new TestProcessStreamListener();
String filter = registerProcessStreamListener(psl, "foo", "bar");
- Properties launchConfig = new Properties();
+ Dictionary<String, Object> launchConfig = new Hashtable<>();
launchConfig.put("instance.count", "1");
launchConfig.put("executable.name", "/bin/sh");
launchConfig.put("executable.args", "-c sleep\\ 1\\ &&\\ exit\\ 0");
@@ -358,7 +357,7 @@ public class ProcessLauncherServiceInteg
* @throws AssertionFailedError in case the {@link ConfigurationAdmin} service couldn't be
* obtained.
*/
- private String configureFactory(String factoryPid, Properties properties) throws IOException {
+ private String configureFactory(String factoryPid, Dictionary<String, Object> properties) throws IOException {
assertNotNull("Parameter factoryPid cannot be null!", factoryPid);
org.osgi.service.cm.Configuration config = getConfigAdmin().createFactoryConfiguration(factoryPid, null);
Modified: ace/trunk/org.apache.ace.processlauncher/src/org/apache/ace/processlauncher/impl/ProcessLauncherServiceImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.processlauncher/src/org/apache/ace/processlauncher/impl/ProcessLauncherServiceImpl.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.processlauncher/src/org/apache/ace/processlauncher/impl/ProcessLauncherServiceImpl.java (original)
+++ ace/trunk/org.apache.ace.processlauncher/src/org/apache/ace/processlauncher/impl/ProcessLauncherServiceImpl.java Wed Jan 27 13:24:03 2016
@@ -146,7 +146,7 @@ public class ProcessLauncherServiceImpl
* @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String,
* java.util.Dictionary)
*/
- @SuppressWarnings({ "rawtypes" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public final void updated(final String pid, final Dictionary config) throws ConfigurationException {
LaunchConfiguration oldLaunchConfig = null;
LaunchConfiguration newLaunchConfig = null;
Modified: ace/trunk/org.apache.ace.repository.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository.itest/bnd.bnd?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.repository.itest/bnd.bnd Wed Jan 27 13:24:03 2016
@@ -19,6 +19,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
org.apache.felix.dependencymanager,\
org.apache.felix.configadmin,\
org.apache.felix.prefs,\
+ org.apache.felix.http.servlet-api,\
org.apache.felix.http.jetty,\
org.apache.ace.deployment.provider.api;version=latest,\
org.apache.ace.authentication.api;version=latest,\
Modified: ace/trunk/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java?rev=1727044&r1=1727043&r2=1727044&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java (original)
+++ ace/trunk/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java Wed Jan 27 13:24:03 2016
@@ -28,7 +28,8 @@ import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
-import java.util.Properties;
+import java.util.Dictionary;
+import java.util.Hashtable;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -224,7 +225,7 @@ public class RepositoryTest extends Inte
tracker.open();
// Publish configuration for a repository instance
- Properties props = new Properties();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put(REPOSITORY_CUSTOMER, customer);
props.put(REPOSITORY_NAME, name);
props.put(REPOSITORY_BASE_DIR, basedir == null ? "" : basedir);