You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2009/08/11 15:35:32 UTC
svn commit: r803115 - in /sling/trunk/installer/osgi/installer/src:
main/java/org/apache/sling/osgi/installer/
main/java/org/apache/sling/osgi/installer/impl/
main/java/org/apache/sling/osgi/installer/impl/tasks/
test/java/org/apache/sling/jcr/
Author: bdelacretaz
Date: Tue Aug 11 13:35:31 2009
New Revision: 803115
URL: http://svn.apache.org/viewvc?rev=803115&view=rev
Log:
SLING-1078 - remove some unused or useless classes
Removed:
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallResultCode.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/JcrInstallException.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiResourceProcessor.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/MissingServiceException.java
sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/jcr/
Modified:
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiController.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/Activator.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java
sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/TaskUtilities.java
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiController.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiController.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiController.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/OsgiController.java Tue Aug 11 13:35:31 2009
@@ -31,7 +31,7 @@
* @param uri Unique identifier for the resource
* @param data The data to install
*/
- void scheduleInstallOrUpdate(String uri, InstallableData data) throws IOException, JcrInstallException;
+ void scheduleInstallOrUpdate(String uri, InstallableData data) throws IOException;
/** Schedule uninstallation of resource that was installed via given uri.
* Might be called several times for the same URI - needless calls should
@@ -40,7 +40,7 @@
* @param attributes metadata stored by the OsgiController, will be
* removed after calling this method
*/
- void scheduleUninstall(String uri) throws IOException, JcrInstallException;
+ void scheduleUninstall(String uri) throws IOException;
/** Return the list of uri for resources that have been installed
* by this controller.
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/Activator.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/Activator.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/Activator.java Tue Aug 11 13:35:31 2009
@@ -20,7 +20,6 @@
import java.util.Hashtable;
-import org.apache.sling.osgi.installer.JcrInstallException;
import org.apache.sling.osgi.installer.OsgiController;
import org.apache.sling.osgi.installer.OsgiControllerServices;
import org.osgi.framework.BundleActivator;
@@ -90,9 +89,9 @@
}
/** Complain if value is null */
- static Object checkNotNull(Object value, String what) throws JcrInstallException {
+ static Object checkNotNull(Object value, String what) {
if(value == null) {
- throw new JcrInstallException(what + " is null, cannot activate");
+ throw new IllegalArgumentException(what + " is null, cannot activate");
}
return value;
}
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java Tue Aug 11 13:35:31 2009
@@ -26,7 +26,6 @@
import java.util.TreeSet;
import org.apache.sling.osgi.installer.InstallableData;
-import org.apache.sling.osgi.installer.JcrInstallException;
import org.apache.sling.osgi.installer.OsgiController;
import org.apache.sling.osgi.installer.OsgiControllerServices;
import org.apache.sling.osgi.installer.OsgiControllerStatistics;
@@ -99,13 +98,13 @@
}
- public void scheduleInstallOrUpdate(String uri, InstallableData data) throws IOException, JcrInstallException {
+ public void scheduleInstallOrUpdate(String uri, InstallableData data) throws IOException {
synchronized (tasks) {
tasks.add(getTaskForUri(uri, data));
}
}
- public void scheduleUninstall(String uri) throws IOException, JcrInstallException {
+ public void scheduleUninstall(String uri) throws IOException {
synchronized (tasks) {
tasks.add(getTaskForUri(uri, null));
}
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java Tue Aug 11 13:35:31 2009
@@ -23,7 +23,6 @@
import java.util.Map;
import java.util.jar.Manifest;
-import org.apache.sling.osgi.installer.InstallResultCode;
import org.apache.sling.osgi.installer.InstallableData;
import org.apache.sling.osgi.installer.OsgiControllerServices;
import org.apache.sling.osgi.installer.impl.OsgiControllerImpl;
@@ -82,7 +81,7 @@
}
@Override
- protected InstallResultCode doInstallOrUpdate(OsgiControllerTaskContext tctx, Map<String, Object> attributes) throws Exception {
+ protected boolean doInstallOrUpdate(OsgiControllerTaskContext tctx, Map<String, Object> attributes) throws Exception {
// Check that we have bundle data and manifest
InputStream is = data.adaptTo(InputStream.class);
@@ -121,7 +120,7 @@
final Version installedVersion = new Version((String)(b.getHeaders().get(Constants.BUNDLE_VERSION)));
final Version newBundleVersion = new Version(m.getMainAttributes().getValue(Constants.BUNDLE_VERSION));
if(ignoreNewBundle(b.getSymbolicName(), uri, installedVersion, newBundleVersion)) {
- return InstallResultCode.IGNORED;
+ return false;
}
}
@@ -163,7 +162,7 @@
// and updates where there are no attributes yet
attributes.put(Storage.KEY_BUNDLE_ID, b.getBundleId());
- return updated ? InstallResultCode.UPDATED : InstallResultCode.INSTALLED;
+ return true;
}
/** Decide if new bundle musg be ignored, based on the supplied Versions */
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java Tue Aug 11 13:35:31 2009
@@ -20,7 +20,6 @@
import java.text.DecimalFormat;
-import org.apache.sling.osgi.installer.JcrInstallException;
import org.apache.sling.osgi.installer.impl.EventsCounter;
import org.apache.sling.osgi.installer.impl.OsgiControllerTask;
import org.apache.sling.osgi.installer.impl.OsgiControllerTaskContext;
@@ -107,7 +106,7 @@
}
/** Do not execute this task if waiting for events */
- public boolean isExecutable(OsgiControllerTaskContext tctx) throws JcrInstallException {
+ public boolean isExecutable(OsgiControllerTaskContext tctx) {
final long eventsCount = getEventsCount(tctx.getBundleContext());
final boolean result = eventsCount >= eventsCountForRetrying;
if(!result) {
@@ -120,14 +119,14 @@
}
/** Return current events count */
- protected long getEventsCount(BundleContext bc) throws JcrInstallException {
+ protected long getEventsCount(BundleContext bc) {
final ServiceReference sr = bc.getServiceReference(EventsCounter.class.getName());
if(sr == null) {
- throw new JcrInstallException("EventsCounter service not found");
+ throw new IllegalStateException("EventsCounter service not found");
}
final EventsCounter ec = (EventsCounter)bc.getService(sr);
if(ec == null) {
- throw new JcrInstallException("EventsCounter service not found, although its ServiceReference was found");
+ throw new IllegalStateException("EventsCounter service not found, although its ServiceReference was found");
}
return ec.getTotalEventsCount();
}
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java Tue Aug 11 13:35:31 2009
@@ -23,9 +23,7 @@
import java.util.Dictionary;
import java.util.Map;
-import org.apache.sling.osgi.installer.InstallResultCode;
import org.apache.sling.osgi.installer.InstallableData;
-import org.apache.sling.osgi.installer.JcrInstallException;
import org.apache.sling.osgi.installer.OsgiControllerServices;
import org.apache.sling.osgi.installer.impl.DictionaryReader;
import org.apache.sling.osgi.installer.impl.OsgiControllerTaskContext;
@@ -55,7 +53,7 @@
}
@Override
- protected InstallResultCode doInstallOrUpdate(OsgiControllerTaskContext tctx, Map<String, Object> attributes) throws Exception {
+ protected boolean doInstallOrUpdate(OsgiControllerTaskContext tctx, Map<String, Object> attributes) throws Exception {
// Convert data to a configuration Dictionary
Dictionary dict = data.adaptTo(Dictionary.class);
if(dict == null) {
@@ -71,7 +69,7 @@
}
if (dict == null) {
- throw new JcrInstallException("Null Dictionary for uri=" + uri);
+ throw new IllegalArgumentException("Null Dictionary for uri=" + uri);
}
// Add pseudo-properties
@@ -89,10 +87,10 @@
}
// get or create configuration
- InstallResultCode result = InstallResultCode.UPDATED;
+ boolean created = false;
Configuration config = TaskUtilities.getConfiguration(pid, false, ocs);
if(config == null) {
- result = InstallResultCode.INSTALLED;
+ created = true;
config = TaskUtilities.getConfiguration(pid, true, ocs);
}
if (config.getBundleLocation() != null) {
@@ -101,10 +99,9 @@
config.update(dict);
if(ocs.getLogService() != null) {
ocs.getLogService().log(LogService.LOG_INFO,
- "Configuration " + config.getPid() + " " + (result == InstallResultCode.UPDATED ? "updated" : "created")
- );
+ "Configuration " + config.getPid() + " " + (created ? "created" : "updated"));
}
- return result;
+ return true;
}
@Override
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java Tue Aug 11 13:35:31 2009
@@ -18,11 +18,8 @@
*/
package org.apache.sling.osgi.installer.impl.tasks;
-import static org.apache.sling.osgi.installer.InstallResultCode.IGNORED;
-
import java.util.Map;
-import org.apache.sling.osgi.installer.InstallResultCode;
import org.apache.sling.osgi.installer.InstallableData;
import org.apache.sling.osgi.installer.OsgiControllerServices;
import org.apache.sling.osgi.installer.impl.InstallableDataWrapper;
@@ -106,7 +103,7 @@
// process install
final Map<String, Object> map = context.getStorage().getMap(uri);
- if(doInstallOrUpdate(context, map) != IGNORED) {
+ if(doInstallOrUpdate(context, map)) {
map.put(OsgiControllerImpl.KEY_DIGEST, data.getDigest());
}
context.getStorage().saveToFile();
@@ -137,5 +134,5 @@
protected abstract void doUninstall(OsgiControllerTaskContext ctx, Map<String, Object> attributes) throws Exception;
/** Do the actual install or update */
- protected abstract InstallResultCode doInstallOrUpdate(OsgiControllerTaskContext ctx, Map<String, Object> attributes) throws Exception;
+ protected abstract boolean doInstallOrUpdate(OsgiControllerTaskContext ctx, Map<String, Object> attributes) throws Exception;
}
Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/TaskUtilities.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/TaskUtilities.java?rev=803115&r1=803114&r2=803115&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/TaskUtilities.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/TaskUtilities.java Tue Aug 11 13:35:31 2009
@@ -7,7 +7,6 @@
import org.apache.sling.osgi.installer.InstallableData;
import org.apache.sling.osgi.installer.OsgiControllerServices;
-import org.apache.sling.osgi.installer.impl.MissingServiceException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -89,11 +88,11 @@
/** Get or create configuration */
static Configuration getConfiguration(ConfigurationPid cp, boolean createIfNeeded, OsgiControllerServices ocs)
- throws IOException, InvalidSyntaxException, MissingServiceException
+ throws IOException, InvalidSyntaxException
{
final ConfigurationAdmin configurationAdmin = ocs.getConfigurationAdmin();
if(configurationAdmin == null) {
- throw new MissingServiceException(ConfigurationAdmin.class);
+ throw new IllegalStateException("Missing service: " + ConfigurationAdmin.class.getName());
}
Configuration result = null;