felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1589641 [2/2] - in /felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin: ./ spi/
Date Thu, 24 Apr 2014 08:57:48 GMT
Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
Thu Apr 24 08:57:47 2014
@@ -52,12 +52,27 @@ public class StreamDeploymentPackage ext
         throw new UnsupportedOperationException("Not applicable for stream-based deployment
package");
     }
 
+    public InputStream getCurrentEntryStream() {
+        return new NonCloseableStream(m_input);
+    }
+
+    public AbstractInfo getNextEntry() throws IOException {
+        ZipEntry nextEntry = m_input.getNextJarEntry();
+        if (nextEntry == null) {
+            return null;
+        }
+        String name = nextEntry.getName();
+        m_names.add(name);
+        AbstractInfo abstractInfoByPath = getAbstractInfoByPath(name);
+        return abstractInfoByPath;
+    }
+
     // This only works for those resources that have been read from the stream already, no
guarantees for remainder of stream
     public BundleInfoImpl[] getOrderedBundleInfos() {
         List result = new ArrayList();
 
         // add all bundle resources ordered by location in stream
-        for(Iterator i = m_names.iterator(); i.hasNext();) {
+        for (Iterator i = m_names.iterator(); i.hasNext();) {
             String indexEntry = (String) i.next();
             AbstractInfo bundleInfo = getBundleInfoByPath(indexEntry);
             if (bundleInfo != null) {
@@ -68,7 +83,7 @@ public class StreamDeploymentPackage ext
         // add bundle resources marked missing to the end of the result
         BundleInfoImpl[] bundleInfoImpls = getBundleInfoImpls();
         for (int i = 0; i < bundleInfoImpls.length; i++) {
-            if(bundleInfoImpls[i].isMissing()) {
+            if (bundleInfoImpls[i].isMissing()) {
                 result.add(bundleInfoImpls[i]);
             }
         }
@@ -78,19 +93,4 @@ public class StreamDeploymentPackage ext
     public ResourceInfoImpl[] getOrderedResourceInfos() {
         throw new UnsupportedOperationException("Not applicable for stream-based deployment
package");
     }
-
-    public AbstractInfo getNextEntry() throws IOException {
-        ZipEntry nextEntry = m_input.getNextJarEntry();
-        if (nextEntry == null) {
-            return null;
-        }
-        String name = nextEntry.getName();
-        m_names.add(name);
-        AbstractInfo abstractInfoByPath = getAbstractInfoByPath(name);
-        return abstractInfoByPath;
-    }
-
-    public InputStream getCurrentEntryStream() {
-        return new NonCloseableStream(m_input);
-    }
 }
\ No newline at end of file

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/Utils.java
Thu Apr 24 08:57:47 2014
@@ -90,10 +90,10 @@ public class Utils {
                 return false;
             }
             finally {
-                if (!closeSilently(output)) { 
+                if (!closeSilently(output)) {
                     result = false;
                 }
-                if (!closeSilently(input)) { 
+                if (!closeSilently(input)) {
                     result = false;
                 }
             }
@@ -166,7 +166,7 @@ public class Utils {
                 result.add(path);
             }
             if (!rename(from, to)) {
-                throw new IOException("Could not rename " + from + " to "  + to);
+                throw new IOException("Could not rename " + from + " to " + to);
             }
         }
 
@@ -191,7 +191,8 @@ public class Utils {
         GZIPOutputStream outputStream = new GZIPOutputStream(new FileOutputStream(new File(target,
MANIFEST_NAME)));
         try {
             resultManifest.write(outputStream);
-        } finally {
+        }
+        finally {
             outputStream.close();
         }
         writeIndex(targetIndex, result);
@@ -211,7 +212,7 @@ public class Utils {
             closeSilently(reader);
         }
     }
-    
+
     static boolean closeSilently(Closeable closeable) {
         if (closeable != null) {
             try {

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/AbstractAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/AbstractAction.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/AbstractAction.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/AbstractAction.java
Thu Apr 24 08:57:47 2014
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.felix.deploymentadmin.spi;
 
 /**
@@ -26,8 +25,7 @@ package org.apache.felix.deploymentadmin
  */
 abstract class AbstractAction implements Runnable {
     /**
-     * Runs this action by calling {@link #doRun()} and in case of failure,
-     * {@link #onFailure(Exception)}.
+     * Runs this action by calling {@link #doRun()} and in case of failure, {@link #onFailure(Exception)}.
      */
     public final void run() {
         try {

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/Command.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/Command.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/Command.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/Command.java
Thu Apr 24 08:57:47 2014
@@ -34,7 +34,7 @@ import org.osgi.service.deploymentadmin.
  * and a command that is currently in progress can be signaled to stop it's
  * activities by canceling it.
  */
-public abstract class Command {
+public abstract class Command implements Constants {
 
     private final List m_rollback = new ArrayList();
     private final List m_commit = new ArrayList();
@@ -58,7 +58,7 @@ public abstract class Command {
             if (e instanceof DeploymentException) {
                 throw (DeploymentException) e;
             }
-            throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Command
failed!", e);
+            throw new DeploymentException(CODE_OTHER_ERROR, "Command failed!", e);
         }
     }
 
@@ -169,10 +169,10 @@ public abstract class Command {
      *         bundle, <code>false</code> otherwise.
      */
     static final boolean isFragmentBundle(Bundle bundle) {
-        Object fragmentHost = bundle.getHeaders().get(Constants.FRAGMENT_HOST);
+        Object fragmentHost = bundle.getHeaders().get(FRAGMENT_HOST);
         return fragmentHost != null;
     }
-    
+
     static final void closeSilently(Closeable resource) {
         if (resource != null) {
             try {

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/CommitResourceCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/CommitResourceCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/CommitResourceCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/CommitResourceCommand.java
Thu Apr 24 08:57:47 2014
@@ -46,13 +46,13 @@ public class CommitResourceCommand exten
                 session.getLog().log(LogService.LOG_ERROR, "Preparing commit for resource
processor failed", e);
                 // Check what error code we got...
                 if (e.getCode() == ResourceProcessorException.CODE_PREPARE) {
-                    throw new DeploymentException(DeploymentException.CODE_COMMIT_ERROR,
"Preparing commit for resource processor failed!", e);
+                    throw new DeploymentException(CODE_COMMIT_ERROR, "Preparing commit for
resource processor failed!", e);
                 }
                 throw new DeploymentException(e.getCode(), "Preparing commit for resource
processor failed!", e);
             }
             catch (Exception e) {
                 session.getLog().log(LogService.LOG_ERROR, "Preparing commit for resource
processor failed", e);
-                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Preparing
commit for resource processor failed", e);
+                throw new DeploymentException(CODE_OTHER_ERROR, "Preparing commit for resource
processor failed", e);
             }
         }
         for (ListIterator i = m_processors.listIterator(m_processors.size()); i.hasPrevious();)
{

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DeploymentSessionImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DeploymentSessionImpl.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DeploymentSessionImpl.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DeploymentSessionImpl.java
Thu Apr 24 08:57:47 2014
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.ListIterator;
 
 import org.apache.felix.deploymentadmin.AbstractDeploymentPackage;
+import org.apache.felix.deploymentadmin.Constants;
 import org.apache.felix.deploymentadmin.DeploymentAdminConfig;
 import org.apache.felix.deploymentadmin.DeploymentAdminImpl;
 import org.osgi.framework.Bundle;
@@ -38,7 +39,7 @@ import org.osgi.service.packageadmin.Pac
 /**
  * Represents a running deployment session.
  */
-public class DeploymentSessionImpl implements DeploymentSession {
+public class DeploymentSessionImpl implements DeploymentSession, Constants {
 
     private final AbstractDeploymentPackage m_target;
     private final AbstractDeploymentPackage m_source;
@@ -49,8 +50,7 @@ public class DeploymentSessionImpl imple
     private volatile Command m_currentCommand = null;
     private volatile boolean m_cancelled;
 
-    public DeploymentSessionImpl(AbstractDeploymentPackage source, AbstractDeploymentPackage
target, List commands,
-        DeploymentAdminImpl admin) {
+    public DeploymentSessionImpl(AbstractDeploymentPackage source, AbstractDeploymentPackage
target, List commands, DeploymentAdminImpl admin) {
         m_source = source;
         m_target = target;
         m_commands = commands;
@@ -73,7 +73,7 @@ public class DeploymentSessionImpl imple
             if (m_cancelled) {
                 // previous command did not pick up on cancel
                 rollback(executedCommands);
-                throw new DeploymentException(DeploymentException.CODE_CANCELLED);
+                throw new DeploymentException(CODE_CANCELLED);
             }
             m_currentCommand = (Command) i.next();
             try {

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllBundlesCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllBundlesCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllBundlesCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllBundlesCommand.java
Thu Apr 24 08:57:47 2014
@@ -69,7 +69,8 @@ public class DropAllBundlesCommand exten
                 is = m_target.getBundleStream(m_bundle.getSymbolicName());
                 if (is != null) {
                     m_bundle.update(is);
-                } else {
+                }
+                else {
                     throw new RuntimeException("Unable to get inputstream for bundle '" +
m_bundle.getSymbolicName() + "'");
                 }
             }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllResourcesCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllResourcesCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllResourcesCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropAllResourcesCommand.java
Thu Apr 24 08:57:47 2014
@@ -76,13 +76,13 @@ public class DropAllResourcesCommand ext
             ServiceReference ref = target.getResourceProcessor(path);
             if (ref == null) {
                 log.log(LogService.LOG_ERROR, "Failed to find resource processor for '" +
rpName + "'!");
-                throw new DeploymentException(DeploymentException.CODE_PROCESSOR_NOT_FOUND,
"Failed to find resource processor '" + rpName + "'!");
+                throw new DeploymentException(CODE_PROCESSOR_NOT_FOUND, "Failed to find resource
processor '" + rpName + "'!");
             }
 
             ResourceProcessor resourceProcessor = (ResourceProcessor) context.getService(ref);
             if (resourceProcessor == null) {
                 log.log(LogService.LOG_ERROR, "Failed to find resource processor for '" +
rpName + "'!");
-                throw new DeploymentException(DeploymentException.CODE_PROCESSOR_NOT_FOUND,
"Failed to find resource processor '" + rpName + "'!");
+                throw new DeploymentException(CODE_PROCESSOR_NOT_FOUND, "Failed to find resource
processor '" + rpName + "'!");
             }
 
             try {
@@ -93,7 +93,7 @@ public class DropAllResourcesCommand ext
             }
             catch (Exception e) {
                 log.log(LogService.LOG_ERROR, "Failed to drop all resources for resource
processor '" + rpName + "'!", e);
-                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Failed
to drop all resources for resource processor '" + rpName + "'!", e);
+                throw new DeploymentException(CODE_OTHER_ERROR, "Failed to drop all resources
for resource processor '" + rpName + "'!", e);
             }
         }
     }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropBundleCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropBundleCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropBundleCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/DropBundleCommand.java
Thu Apr 24 08:57:47 2014
@@ -71,7 +71,8 @@ public class DropBundleCommand extends C
                 is = m_target.getBundleStream(m_bundle.getSymbolicName());
                 if (is != null) {
                     m_bundle.update(is);
-                } else {
+                }
+                else {
                     throw new RuntimeException("Unable to get Inputstream for bundle '" +
m_bundle.getSymbolicName() + "'");
                 }
             }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/GetStorageAreaCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/GetStorageAreaCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/GetStorageAreaCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/GetStorageAreaCommand.java
Thu Apr 24 08:57:47 2014
@@ -41,7 +41,7 @@ public class GetStorageAreaCommand exten
         BundleInfo[] infos = target.getBundleInfos();
         for (int i = 0; i < infos.length; i++) {
             if (isCancelled()) {
-                throw new DeploymentException(DeploymentException.CODE_CANCELLED);
+                throw new DeploymentException(CODE_CANCELLED);
             }
             Bundle bundle = target.getBundle(infos[i].getSymbolicName());
             if (bundle != null) {

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/ProcessResourceCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/ProcessResourceCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/ProcessResourceCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/ProcessResourceCommand.java
Thu Apr 24 08:57:47 2014
@@ -75,27 +75,27 @@ public class ProcessResourceCommand exte
             while (!expectedResources.isEmpty()) {
                 AbstractInfo jarEntry = source.getNextEntry();
                 if (jarEntry == null) {
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Expected
more resources in the stream: " + expectedResources.keySet());
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Expected more resources
in the stream: " + expectedResources.keySet());
                 }
 
                 String name = jarEntry.getPath();
 
                 ResourceInfoImpl resourceInfo = (ResourceInfoImpl) expectedResources.remove(name);
                 if (resourceInfo == null) {
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Resource
'" + name + "' is not described in the manifest.");
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Resource '" + name +
"' is not described in the manifest.");
                 }
 
                 ServiceReference ref = source.getResourceProcessor(name);
                 if (ref == null) {
-                    throw new DeploymentException(DeploymentException.CODE_PROCESSOR_NOT_FOUND,
"No resource processor for resource: '" + name + "'");
+                    throw new DeploymentException(CODE_PROCESSOR_NOT_FOUND, "No resource
processor for resource: '" + name + "'");
                 }
                 if (!isValidCustomizer(session, ref)) {
-                    throw new DeploymentException(DeploymentException.CODE_FOREIGN_CUSTOMIZER,
"Resource processor for resource '" + name + "' belongs to foreign deployment package");
+                    throw new DeploymentException(CODE_FOREIGN_CUSTOMIZER, "Resource processor
for resource '" + name + "' belongs to foreign deployment package");
                 }
 
                 ResourceProcessor resourceProcessor = (ResourceProcessor) context.getService(ref);
                 if (resourceProcessor == null) {
-                    throw new DeploymentException(DeploymentException.CODE_PROCESSOR_NOT_FOUND,
"No resource processor for resource: '" + name + "'");
+                    throw new DeploymentException(CODE_PROCESSOR_NOT_FOUND, "No resource
processor for resource: '" + name + "'");
                 }
 
                 try {
@@ -106,18 +106,19 @@ public class ProcessResourceCommand exte
                 }
                 catch (ResourceProcessorException rpe) {
                     if (rpe.getCode() == ResourceProcessorException.CODE_RESOURCE_SHARING_VIOLATION)
{
-                        throw new DeploymentException(DeploymentException.CODE_RESOURCE_SHARING_VIOLATION,
"Sharing violation while processing resource '" + name + "'", rpe);
-                    } else {
-                        throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR,
"Error while processing resource '" + name + "'", rpe);
+                        throw new DeploymentException(CODE_RESOURCE_SHARING_VIOLATION, "Sharing
violation while processing resource '" + name + "'", rpe);
+                    }
+                    else {
+                        throw new DeploymentException(CODE_OTHER_ERROR, "Error while processing
resource '" + name + "'", rpe);
                     }
                 }
             }
         }
         catch (IOException e) {
-            throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Problem
while reading stream", e);
+            throw new DeploymentException(CODE_OTHER_ERROR, "Problem while reading stream",
e);
         }
     }
-    
+
     private boolean isValidCustomizer(DeploymentSessionImpl session, ServiceReference ref)
{
         if (session.getConfiguration().isAllowForeignCustomizers()) {
             // If foreign customizers are allowed, any non-null customizer will do...

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java
Thu Apr 24 08:57:47 2014
@@ -52,7 +52,7 @@ public class SnapshotCommand extends Com
         Map storageAreas = m_getStorageAreaCommand.getStorageAreas();
         for (int i = 0; i < infos.length; i++) {
             if (isCancelled()) {
-                throw new DeploymentException(DeploymentException.CODE_CANCELLED);
+                throw new DeploymentException(CODE_CANCELLED);
             }
 
             String symbolicName = infos[i].getSymbolicName();
@@ -73,7 +73,8 @@ public class SnapshotCommand extends Com
                         session.getLog().log(LogService.LOG_WARNING, "Could not access storage
area of bundle '" + symbolicName + "'!", e);
                         snapshot.delete();
                     }
-                } else {
+                }
+                else {
                     session.getLog().log(LogService.LOG_WARNING, "Could not retrieve storage
area of bundle '" + symbolicName + "', skipping it.");
                 }
             }
@@ -102,7 +103,8 @@ public class SnapshotCommand extends Com
             for (int i = 0; i < childs.length; i++) {
                 storeRecursive(childs[i], new File(path, childs[i].getName()), output);
             }
-        } else {
+        }
+        else {
             InputStream input = null;
             try {
                 input = new FileInputStream(current);
@@ -181,7 +183,8 @@ public class SnapshotCommand extends Com
                 for (ZipEntry entry = input.getNextEntry(); entry != null; entry = input.getNextEntry())
{
                     if (entry.isDirectory()) {
                         (new File(target, entry.getName())).mkdirs();
-                    } else {
+                    }
+                    else {
                         OutputStream output = null;
                         try {
                             output = new FileOutputStream(target);

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartBundleCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartBundleCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartBundleCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartBundleCommand.java
Thu Apr 24 08:57:47 2014
@@ -55,7 +55,8 @@ public class StartBundleCommand extends 
                 if (bundle != null) {
                     if (isFragmentBundle(bundle)) {
                         log.log(LogService.LOG_INFO, "Skipping fragment bundle '" + symbolicName
+ "'");
-                    } else {
+                    }
+                    else {
                         try {
                             bundle.start();
                         }
@@ -63,7 +64,8 @@ public class StartBundleCommand extends 
                             log.log(LogService.LOG_WARNING, "Could not start bundle '" +
symbolicName + "'", be);
                         }
                     }
-                } else {
+                }
+                else {
                     log.log(LogService.LOG_WARNING, "Could not start bundle '" + symbolicName
+ "' because it is not present in the framework");
                 }
             }
@@ -105,12 +107,12 @@ public class StartBundleCommand extends 
                 try {
                     wait(REFRESH_TIMEOUT);
                 }
-                catch (InterruptedException ie) {
-                }
+                catch (InterruptedException ie) {}
                 finally {
                     m_alreadyNotified = false;
                 }
-            } else {
+            }
+            else {
                 // just reset the misted notification variable, this Monitor
                 // object might be reused.
                 m_alreadyNotified = false;

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartCustomizerCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartCustomizerCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartCustomizerCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StartCustomizerCommand.java
Thu Apr 24 08:57:47 2014
@@ -70,7 +70,7 @@ public class StartCustomizerCommand exte
                 bundle.start();
             }
             catch (Exception be) {
-                throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Could
not start customizer bundle '" + bundle.getSymbolicName() + "'", be);
+                throw new DeploymentException(CODE_OTHER_ERROR, "Could not start customizer
bundle '" + bundle.getSymbolicName() + "'", be);
             }
             addRollback(new StopCustomizerRunnable(session, bundle));
         }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StopBundleCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StopBundleCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StopBundleCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/StopBundleCommand.java
Thu Apr 24 08:57:47 2014
@@ -47,8 +47,9 @@ public class StopBundleCommand extends C
         BundleInfo[] bundleInfos = target.getOrderedBundleInfos();
         for (int i = 0; i < bundleInfos.length; i++) {
             if (isCancelled()) {
-                throw new DeploymentException(DeploymentException.CODE_CANCELLED);
+                throw new DeploymentException(CODE_CANCELLED);
             }
+
             String symbolicName = bundleInfos[i].getSymbolicName();
             Bundle bundle = target.getBundle(symbolicName);
             if (bundle != null) {
@@ -57,7 +58,8 @@ public class StopBundleCommand extends C
                 }
                 if (isFragmentBundle(bundle)) {
                     log.log(LogService.LOG_INFO, "Skipping fragment bundle '" + symbolicName
+ "'");
-                } else {
+                }
+                else {
                     addRollback(new StartBundleRunnable(session, bundle));
                     try {
                         bundle.stop();
@@ -66,7 +68,8 @@ public class StopBundleCommand extends C
                         log.log(LogService.LOG_WARNING, "Could not stop bundle '" + symbolicName
+ "'", e);
                     }
                 }
-            } else {
+            }
+            else {
                 log.log(LogService.LOG_WARNING, "Could not stop bundle '" + symbolicName
+ "' because it was not present in the framework");
             }
         }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java?rev=1589641&r1=1589640&r2=1589641&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
Thu Apr 24 08:57:47 2014
@@ -26,7 +26,6 @@ import java.util.Map;
 import org.apache.felix.deploymentadmin.AbstractDeploymentPackage;
 import org.apache.felix.deploymentadmin.AbstractInfo;
 import org.apache.felix.deploymentadmin.BundleInfoImpl;
-import org.apache.felix.deploymentadmin.Constants;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
@@ -60,13 +59,13 @@ public class UpdateCommand extends Comma
             while (!expectedBundles.isEmpty()) {
                 AbstractInfo entry = source.getNextEntry();
                 if (entry == null) {
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Expected
more bundles in the stream: " + expectedBundles.keySet());
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Expected more bundles
in the stream: " + expectedBundles.keySet());
                 }
 
                 String name = entry.getPath();
                 BundleInfoImpl bundleInfo = (BundleInfoImpl) expectedBundles.remove(name);
                 if (bundleInfo == null) {
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Resource
'" + name + "' is not described in the manifest.");
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Resource '" + name +
"' is not described in the manifest.");
                 }
 
                 String bsn = bundleInfo.getSymbolicName();
@@ -76,9 +75,10 @@ public class UpdateCommand extends Comma
                 try {
                     if (bundle == null) {
                         // new bundle, install it
-                        bundle = context.installBundle(Constants.BUNDLE_LOCATION_PREFIX +
bsn, new BundleInputStream(source.getCurrentEntryStream()));
+                        bundle = context.installBundle(BUNDLE_LOCATION_PREFIX + bsn, new
BundleInputStream(source.getCurrentEntryStream()));
                         addRollback(new UninstallBundleRunnable(bundle, log));
-                    } else {
+                    }
+                    else {
                         // existing bundle, update it
                         Version currentVersion = getVersion(bundle);
                         if (!sourceVersion.equals(currentVersion)) {
@@ -91,26 +91,27 @@ public class UpdateCommand extends Comma
                     if (isCancelled()) {
                         return;
                     }
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Could
not install new bundle '" + name + "' (" + bsn + ")", be);
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Could not install new
bundle '" + name + "' (" + bsn + ")", be);
                 }
 
                 if (!bundle.getSymbolicName().equals(bsn)) {
-                    throw new DeploymentException(DeploymentException.CODE_BUNDLE_NAME_ERROR,
"Installed/updated bundle symbolicname (" + bundle.getSymbolicName() + ") do not match what
was installed/updated: " + bsn);
+                    throw new DeploymentException(CODE_BUNDLE_NAME_ERROR, "Installed/updated
bundle symbolicname (" + bundle.getSymbolicName() + ") do not match what was installed/updated:
" + bsn);
                 }
 
                 Version targetVersion = getVersion(bundle);
                 if (!sourceVersion.equals(targetVersion)) {
-                    throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Installed/updated
bundle version (" + targetVersion + ") do not match what was installed/updated: " + sourceVersion
+ ", offending bundle = " + bsn);
+                    throw new DeploymentException(CODE_OTHER_ERROR, "Installed/updated bundle
version (" + targetVersion + ") do not match what was installed/updated: " + sourceVersion
+                        + ", offending bundle = " + bsn);
                 }
             }
         }
         catch (IOException e) {
-            throw new DeploymentException(DeploymentException.CODE_OTHER_ERROR, "Problem
while reading stream", e);
+            throw new DeploymentException(CODE_OTHER_ERROR, "Problem while reading stream",
e);
         }
     }
 
     private Version getVersion(Bundle bundle) {
-        return Version.parseVersion((String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION));
+        return Version.parseVersion((String) bundle.getHeaders().get(BUNDLE_VERSION));
     }
 
     private static class UninstallBundleRunnable extends AbstractAction {
@@ -148,7 +149,8 @@ public class UpdateCommand extends Comma
                 is = m_targetPackage.getBundleStream(m_bundle.getSymbolicName());
                 if (is != null) {
                     m_bundle.update(is);
-                } else {
+                }
+                else {
                     throw new RuntimeException("Unable to get inputstream for bundle " +
m_bundle.getSymbolicName());
                 }
             }



Mime
View raw message