ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1301481 - in /ace/trunk: ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/ ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/ ace-deployment-provider-repositorybased/sr...
Date Fri, 16 Mar 2012 13:08:24 GMT
Author: marrs
Date: Fri Mar 16 13:08:24 2012
New Revision: 1301481

URL: http://svn.apache.org/viewvc?rev=1301481&view=rev
Log:
ACE-63 updated the deployment projects.

Modified:
    ace/trunk/ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/DeploymentProvider.java
    ace/trunk/ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/FileBasedProvider.java
    ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
    ace/trunk/ace-deployment-servlet/src/main/java/org/apache/ace/deployment/servlet/DeploymentServlet.java

Modified: ace/trunk/ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/DeploymentProvider.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/DeploymentProvider.java?rev=1301481&r1=1301480&r2=1301481&view=diff
==============================================================================
--- ace/trunk/ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/DeploymentProvider.java
(original)
+++ ace/trunk/ace-deployment-provider-api/src/main/java/org/apache/ace/deployment/provider/DeploymentProvider.java
Fri Mar 16 13:08:24 2012
@@ -32,10 +32,10 @@ public interface DeploymentProvider {
      * The ArtifactData.hasChanged method will return true for all bundles in this collection
      *
      * @return a collection of bundledata. If there are no bundles in this version, return
an empty list
-     * @throws IllegalArgumentException if the gateway or version do not exist
+     * @throws IllegalArgumentException if the target or version do not exist
      * @throws java.io.IOException If an IOException occurs.
      */
-    public List<ArtifactData> getBundleData(String gatewayId, String version) throws
IllegalArgumentException, IOException;
+    public List<ArtifactData> getBundleData(String targetId, String version) throws
IllegalArgumentException, IOException;
 
     /**
      * This data can be used to generate a fix package. It gives the differences between
the versionFrom and versionTo.
@@ -49,22 +49,22 @@ public interface DeploymentProvider {
      * </ol>
      *
      * @return a list of bundles.
-     * @throws IllegalArgumentException if the gateway, the versionFrom or versionTo do no
exist
+     * @throws IllegalArgumentException if the target, the versionFrom or versionTo do no
exist
      * @throws java.io.IOException If an IOException occurs.
      */
 
-    public List<ArtifactData> getBundleData(String gatewayId, String versionFrom, String
versionTo) throws IllegalArgumentException, IOException;
+    public List<ArtifactData> getBundleData(String targetId, String versionFrom, String
versionTo) throws IllegalArgumentException, IOException;
 
     /**
-     * Returns a list of versions for a specific gateway. The list is sorted in
+     * Returns a list of versions for a specific target. The list is sorted in
      * ascending order, so the latest version is the last one in the list.
      *
-     * @param gatewayId  The id of the gateway for which all available deployment package
+     * @param targetId  The id of the target for which all available deployment package
      *                   versions are being retrieved.
-     * @return All available deployment package versions for a specific gateway. If none
available,
+     * @return All available deployment package versions for a specific target. If none available,
      *         return an empty List.
-     *         If the gateway doesn't exist, an IllegalArgumentException is thrown
+     *         If the target doesn't exist, an IllegalArgumentException is thrown
      * @throws java.io.IOException If an IOException occurs.
      */
-    public List<String> getVersions(String gatewayId) throws IllegalArgumentException,
IOException;
+    public List<String> getVersions(String targetId) throws IllegalArgumentException,
IOException;
 }
\ No newline at end of file

Modified: ace/trunk/ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/FileBasedProvider.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/FileBasedProvider.java?rev=1301481&r1=1301480&r2=1301481&view=diff
==============================================================================
--- ace/trunk/ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/FileBasedProvider.java
(original)
+++ ace/trunk/ace-deployment-provider-filebased/src/main/java/org/apache/ace/deployment/provider/filebased/FileBasedProvider.java
Fri Mar 16 13:08:24 2012
@@ -48,10 +48,10 @@ import org.osgi.service.cm.ManagedServic
 import org.osgi.service.log.LogService;
 
 /**
- * This class reads data from the filesystem. It contains deployment data in the following
format: <storage dir>/<gateway-name>/<bundle-version>/<jars>
- * example : storage-directory/ storage-directory/gateway-a storage-directory/gateway-a/1.0.0
- * storage-directory/gateway-a/1.0.0/bundle1.jar storage-directory/gateway-a/1.0.0/bundle2.jar
storage-directory/gateway-a/1.1.0
- * storage-directory/gateway-a/1.1.0/bundle2.jar storage-directory/gateway-a/1.1.0/bundle3.jar
The versions are in the
+ * This class reads data from the filesystem. It contains deployment data in the following
format: <storage dir>/<target-name>/<bundle-version>/<jars>
+ * example : storage-directory/ storage-directory/target-a storage-directory/target-a/1.0.0
+ * storage-directory/target-a/1.0.0/bundle1.jar storage-directory/target-a/1.0.0/bundle2.jar
storage-directory/target-a/1.1.0
+ * storage-directory/target-a/1.1.0/bundle2.jar storage-directory/target-a/1.1.0/bundle3.jar
The versions are in the
  * org.osgi.framework.Version format.
  */
 public class FileBasedProvider implements DeploymentProvider, ManagedService {
@@ -66,19 +66,19 @@ public class FileBasedProvider implement
     private final Semaphore m_disk = new Semaphore(1, true);
 
     /**
-     * Get the bundle data from the bundles in the <data dir>/<gateway>/<version>
directory It reads the manifest from all the
+     * Get the bundle data from the bundles in the &lt;data dir&gt;/&lt;target&gt;/&lt;version&gt;
directory It reads the manifest from all the
      * .jar files in that directory. If the manifest cannot be found, This method can only
parse OSGi R4 bundles
      */
-    public List<ArtifactData> getBundleData(String gatewayId, String version) throws
IllegalArgumentException {
-        List<String> versions = getVersions(gatewayId);
+    public List<ArtifactData> getBundleData(String targetId, String version) throws
IllegalArgumentException {
+        List<String> versions = getVersions(targetId);
         if (!versions.contains(version)) {
             throw new IllegalArgumentException("Unknown version " + version + " requested");
         }
-        File gatewayDirectory = new File(m_baseDirectory, gatewayId);
+        File targetDirectory = new File(m_baseDirectory, targetId);
         File versionDirectory;
-        if (gatewayDirectory.isDirectory()) {
-            // gateway has its own folder
-            versionDirectory = findMatchingVersionDirectory(gatewayDirectory, version);
+        if (targetDirectory.isDirectory()) {
+            // target has its own folder
+            versionDirectory = findMatchingVersionDirectory(targetDirectory, version);
         }
         else {
             versionDirectory = findMatchingVersionDirectory(m_defaultDirectory, version);
@@ -204,16 +204,16 @@ public class FileBasedProvider implement
      * like 1 instead of 1.0.0 and alike.
      * So we need to do some crawling to map them.
      *
-     * @param gatewayDirectory store directory
+     * @param targetDirectory store directory
      * @param version          that has been requested.
      *
      * @return the matching folder.
      *
      * @throws IllegalArgumentException if no matching folder has been found. If this happens
something is weirdly wrong.
      */
-    private File findMatchingVersionDirectory(File gatewayDirectory, String version) {
+    private File findMatchingVersionDirectory(File targetDirectory, String version) {
         // first try the direct way:
-        File directTry = new File(gatewayDirectory, version);
+        File directTry = new File(targetDirectory, version);
         if ((directTry != null) && directTry.isDirectory()) {
             return directTry;
         }
@@ -223,10 +223,10 @@ public class FileBasedProvider implement
             requestedVersion = Version.parseVersion(version);
         }
         catch (IllegalArgumentException iae) {
-            throw new IllegalArgumentException("Requested version " + version + " has no
matching folder in store: " + gatewayDirectory.getAbsolutePath());
+            throw new IllegalArgumentException("Requested version " + version + " has no
matching folder in store: " + targetDirectory.getAbsolutePath());
         }
 
-        File[] files = gatewayDirectory.listFiles();
+        File[] files = targetDirectory.listFiles();
         for (int i = 0; i < files.length; i++) {
             File possibleVersionDirectory = files[i];
             if (possibleVersionDirectory.isDirectory()) {
@@ -235,7 +235,7 @@ public class FileBasedProvider implement
                     Version foundVersion = Version.parseVersion(possibleVersionDirectory.getName());
                     // no exception, but is could still be an empty version
                     if ((requestedVersion != null) && requestedVersion.equals(foundVersion))
{
-                        return new File(gatewayDirectory, possibleVersionDirectory.getName());
+                        return new File(targetDirectory, possibleVersionDirectory.getName());
                     }
                 }
                 catch (IllegalArgumentException iae) {
@@ -243,12 +243,12 @@ public class FileBasedProvider implement
                 }
             }
         }
-        throw new IllegalArgumentException("Requested version " + version + " has no matching
folder in store: " + gatewayDirectory.getAbsolutePath());
+        throw new IllegalArgumentException("Requested version " + version + " has no matching
folder in store: " + targetDirectory.getAbsolutePath());
     }
 
-    public List<ArtifactData> getBundleData(String gatewayId, String versionFrom, String
versionTo) throws IllegalArgumentException {
-        List<ArtifactData> dataVersionFrom = getBundleData(gatewayId, versionFrom);
-        List<ArtifactData> dataVersionTo = getBundleData(gatewayId, versionTo);
+    public List<ArtifactData> getBundleData(String targetId, String versionFrom, String
versionTo) throws IllegalArgumentException {
+        List<ArtifactData> dataVersionFrom = getBundleData(targetId, versionFrom);
+        List<ArtifactData> dataVersionTo = getBundleData(targetId, versionTo);
 
         Iterator<ArtifactData> it = dataVersionTo.iterator();
         while (it.hasNext()) {
@@ -277,21 +277,21 @@ public class FileBasedProvider implement
     }
 
     /**
-     * Look in the baseDirectory for the specified gateway. If it exists, get the list of
directories in there and check if they
+     * Look in the baseDirectory for the specified target. If it exists, get the list of
directories in there and check if they
      * conform to the <code>org.osgi.framework.Version</code> format. If it does,
it will be in the list of versions that are
-     * returned. If there are no valid versions, return an empty list. If the gateway cannot
be found, an
+     * returned. If there are no valid versions, return an empty list. If the target cannot
be found, an
      * IllegalArgumentException is thrown. The list will be sorted on version.
      */
     @SuppressWarnings("unchecked")
-    public List<String> getVersions(String gatewayId) throws IllegalArgumentException
{
+    public List<String> getVersions(String targetId) throws IllegalArgumentException
{
         List<Version> versionList = new ArrayList<Version>();
-        File gatewayDirectory = new File(m_baseDirectory.getAbsolutePath(), gatewayId);
-        if (gatewayDirectory.isDirectory()) {
-            getVersions(gatewayId, versionList, gatewayDirectory);
+        File targetDirectory = new File(m_baseDirectory.getAbsolutePath(), targetId);
+        if (targetDirectory.isDirectory()) {
+            getVersions(targetId, versionList, targetDirectory);
         }
         else {
             // try the default
-            getVersions(gatewayId, versionList, m_defaultDirectory);
+            getVersions(targetId, versionList, m_defaultDirectory);
         }
 
         // now sort the list of versions and convert all values to strings.
@@ -307,11 +307,11 @@ public class FileBasedProvider implement
 
     /**
      *
-     * @param gatewayId ID that requested versions
+     * @param targetId ID that requested versions
      * @param versionList where collected versions will be put into.
      * @param base folder to be crawled.
      */
-    private void getVersions(String gatewayId, List<Version> versionList, File base)
{
+    private void getVersions(String targetId, List<Version> versionList, File base)
{
         // ok, it is a directory. Now treat all the subdirectories as seperate versions
         File[] files = base.listFiles();
         for (int i = 0; i < files.length; i++) {
@@ -331,14 +331,13 @@ public class FileBasedProvider implement
             }
         }
         if (files.length == 0) {
-            m_log.log(LogService.LOG_DEBUG, "No versions found for gateway " + gatewayId);
+            m_log.log(LogService.LOG_DEBUG, "No versions found for target: " + targetId);
         }
     }
 
     /**
      * Update the configuration for this bundle. It checks if the basedirectory exists and
is a directory.
      */
-    @SuppressWarnings("unchecked")
     public void updated(Dictionary settings) throws ConfigurationException {
         if (settings != null) {
             String baseDirectoryName = getNotNull(settings, DIRECTORY_NAME, "The base directory
cannot be null");
@@ -364,7 +363,6 @@ public class FileBasedProvider implement
     /**
      * Convenience method for getting settings from a configuration dictionary.
      */
-    @SuppressWarnings("unchecked")
     private String getNotNull(Dictionary settings, String id, String errorMessage) throws
ConfigurationException {
         String result = (String) settings.get(id);
         if (result == null) {

Modified: ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java?rev=1301481&r1=1301480&r2=1301481&view=diff
==============================================================================
--- ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
(original)
+++ ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
Fri Mar 16 13:08:24 2012
@@ -41,9 +41,7 @@ import javax.xml.xpath.XPathExpressionEx
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathVariableResolver;
 
-import org.apache.ace.client.repository.helper.ArtifactHelper;
 import org.apache.ace.client.repository.helper.bundle.BundleHelper;
-import org.apache.ace.client.repository.object.ArtifactObject;
 import org.apache.ace.client.repository.object.DeploymentArtifact;
 import org.apache.ace.deployment.provider.ArtifactData;
 import org.apache.ace.deployment.provider.DeploymentProvider;
@@ -82,11 +80,11 @@ public class RepositoryBasedProvider imp
      */
     private volatile Repository m_directRepository;
 
-    public List<ArtifactData> getBundleData(String gatewayId, String version) throws
IllegalArgumentException, IOException {
-        return getBundleData(gatewayId, null, version);
+    public List<ArtifactData> getBundleData(String targetId, String version) throws
IllegalArgumentException, IOException {
+        return getBundleData(targetId, null, version);
     }
 
-    public List<ArtifactData> getBundleData(String gatewayId, String versionFrom, String
versionTo) throws IllegalArgumentException, IOException {
+    public List<ArtifactData> getBundleData(String targetId, String versionFrom, String
versionTo) throws IllegalArgumentException, IOException {
         try {
             if (versionFrom != null) {
                 Version.parseVersion(versionFrom);
@@ -105,10 +103,10 @@ public class RepositoryBasedProvider imp
         try {
             input = getRepositoryStream();
             if (versionFrom == null) {
-                pairs = getURLDirectivePairs(input, gatewayId, new String[] { versionTo });
+                pairs = getURLDirectivePairs(input, targetId, new String[] { versionTo });
             }
             else {
-                pairs = getURLDirectivePairs(input, gatewayId, new String[] { versionFrom,
versionTo });
+                pairs = getURLDirectivePairs(input, targetId, new String[] { versionFrom,
versionTo });
             }
         }
         catch (IOException ioe) {
@@ -151,15 +149,15 @@ public class RepositoryBasedProvider imp
     }
 
     @SuppressWarnings("unchecked")
-    public List<String> getVersions(String gatewayId) throws IllegalArgumentException,
IOException {
+    public List<String> getVersions(String targetId) throws IllegalArgumentException,
IOException {
         List<String> stringVersionList = new ArrayList<String>();
         InputStream input = null;
 
         try {
             input = getRepositoryStream();
-            List<Version> versionList = getAvailableVersions(input, gatewayId);
+            List<Version> versionList = getAvailableVersions(input, targetId);
             if (versionList.isEmpty()) {
-                m_log.log(LogService.LOG_DEBUG, "No versions found for gateway " + gatewayId);
+                m_log.log(LogService.LOG_DEBUG, "No versions found for target: " + targetId);
             }
             else {
                 // now sort the list of versions and convert all values to strings.
@@ -268,19 +266,19 @@ public class RepositoryBasedProvider imp
     }
 
     /**
-     * Returns the available deployment versions for a gateway
+     * Returns the available deployment versions for a target
      *
      * @param input A dom document representation of the repository
-     * @param gatewayId The gatwayId
+     * @param targetId The target identifier
      * @return A list of available versions
      */
-    private List<Version> getAvailableVersions(InputStream input, String gatewayId)
throws IllegalArgumentException {
+    private List<Version> getAvailableVersions(InputStream input, String targetId)
throws IllegalArgumentException {
         //result list
         List<Version> versionList = new ArrayList<Version>();
         XPathContext context = XPathContext.getInstance();
 
         try {
-            NodeList versions = context.getVersions(gatewayId, input);
+            NodeList versions = context.getVersions(targetId, input);
             if (versions != null) {
                 for (int j = 0; j < versions.getLength(); j++) {
                     Node n = versions.item(j);
@@ -321,16 +319,16 @@ public class RepositoryBasedProvider imp
      * try
      * {
      *     // to get all artifacts of a number of versions:
-     *     context.init(gatewayId, versions, input);
+     *     context.init(targetId, versions, input);
      *
      *     for (int i = 0; i < versions.length; i++)
      *     {
      *         Node version = context.getVersion(i);
      *         // Do work with version
      *     }
-     *     // to get all versions of a number of a gateway:
-     *     NodeList versions = context.getVersions(gatewayId, input);
-     *     // Do wortk with versions
+     *     // to get all versions of a number of a target:
+     *     NodeList versions = context.getVersions(targetId, input);
+     *     // Do work with versions
      * }
      * finally
      * {
@@ -349,7 +347,7 @@ public class RepositoryBasedProvider imp
 
         private final Map<Integer, XPathExpression> m_expressions = new HashMap<Integer,
XPathExpression>();
 
-        private String m_gatewayId;
+        private String m_targetId;
 
         private String[] m_versions;
 
@@ -360,8 +358,8 @@ public class RepositoryBasedProvider imp
         private XPathContext() {
             m_xPath.setXPathVariableResolver(this);
             try {
-                m_attributesExpression = m_xPath.compile("//deploymentversions/deploymentversion/attributes/child::gatewayID[text()=$id]/../child::version[text()=$version]/../../artifacts");
-                m_versionsExpression = m_xPath.compile("//deploymentversions/deploymentversion/attributes/child::gatewayID[text()=$id]/parent::attributes/version/text()");
+                m_attributesExpression = m_xPath.compile("//deploymentversions/deploymentversion/attributes/child::targetID[text()=$id]/../child::version[text()=$version]/../../artifacts");
+                m_versionsExpression = m_xPath.compile("//deploymentversions/deploymentversion/attributes/child::targetID[text()=$id]/parent::attributes/version/text()");
             }
             catch (XPathExpressionException e) {
                 throw new RuntimeException(e);
@@ -391,28 +389,28 @@ public class RepositoryBasedProvider imp
         }
 
         /**
-         * @param gatewayId the id of the gateway
+         * @param targetId the id of the target
          * @param input the stream to read repository from
-         * @return  the versions in the repo for the given gatewayId or null if none
+         * @return  the versions in the repo for the given targetId or null if none
          * @throws javax.xml.xpath.XPathExpressionException in case something goes wrong
          */
-        public NodeList getVersions(String gatewayId, InputStream input) throws XPathExpressionException
{
-            m_gatewayId = gatewayId;
+        public NodeList getVersions(String targetId, InputStream input) throws XPathExpressionException
{
+            m_targetId = targetId;
             return (NodeList) m_versionsExpression.evaluate(new InputSource(input), XPathConstants.NODESET);
         }
 
         /**
-         * @param gatewayId the id of the gateway
+         * @param targetId the id of the target
          * @param versions the versions to return
          * @param input the stream to read repository from
          * @return true if versions can be found, otherwise false
          * @throws javax.xml.xpath.XPathExpressionException if something goes wrong
          */
         @SuppressWarnings("boxing")
-        public boolean init(String gatewayId, String[] versions, InputStream input) throws
XPathExpressionException {
+        public boolean init(String targetId, String[] versions, InputStream input) throws
XPathExpressionException {
             XPathExpression expression = m_expressions.get(versions.length);
             if (expression == null) {
-                StringBuilder versionStatement = new StringBuilder("//deploymentversions/deploymentversion/attributes/child::gatewayID[text()=$id]/following::version[text()=$0");
+                StringBuilder versionStatement = new StringBuilder("//deploymentversions/deploymentversion/attributes/child::targetID[text()=$id]/following::version[text()=$0");
                 for (int i = 1; i < versions.length; i++) {
                     versionStatement.append(" or ").append(".=$").append(i);
                 }
@@ -420,7 +418,7 @@ public class RepositoryBasedProvider imp
                 expression = m_xPath.compile(versionStatement.toString());
                 m_expressions.put(versions.length, expression);
             }
-            m_gatewayId = gatewayId;
+            m_targetId = targetId;
             m_versions = versions;
 
             m_node = (Node) expression.evaluate(new InputSource(input), XPathConstants.NODE);
@@ -443,18 +441,18 @@ public class RepositoryBasedProvider imp
         public void destroy() {
             m_node = null;
             m_version = null;
-            m_gatewayId = null;
+            m_targetId = null;
             m_versions = null;
         }
 
         /**
          * @param name id|version|<version-index>
-         * @return id->gatewayId | version->version | version-index -> versions[version-index]
+         * @return id->targetId | version->version | version-index -> versions[version-index]
          */
         public Object resolveVariable(QName name) {
             String localPart = name.getLocalPart();
             if ("id".equals(localPart)) {
-                return m_gatewayId;
+                return m_targetId;
             }
             else if ("version".equals(localPart)) {
                 return m_version;
@@ -464,26 +462,26 @@ public class RepositoryBasedProvider imp
     }
 
     /**
-     * Helper method to retrieve urls and directives for a gateway-version combination.
+     * Helper method to retrieve urls and directives for a target-version combination.
      *
      * @param input An input stream from which an XML representation of a deployment repository
can be read.
-     * @param gatewayId The gatewayId to be used
+     * @param targetId The target identifier to be used
      * @param versions An array of versions.
      * @return An array of lists of URLDirectivePairs. For each version in <code>versions</code>,
a separate list will be
      *         created; the index of a version in the <code>versions</code> array
is equal to the index of its result in the
      *         result array.
-     * @throws IllegalArgumentException if the gatewayId or versions cannot be found in the
input stream, or if
+     * @throws IllegalArgumentException if the targetId or versions cannot be found in the
input stream, or if
      *         <code>input</code> does not contain an XML stream.
      */
     @SuppressWarnings("unchecked")
-    private List<URLDirectivePair>[] getURLDirectivePairs(InputStream input, String
gatewayId, String[] versions) throws IllegalArgumentException {
+    private List<URLDirectivePair>[] getURLDirectivePairs(InputStream input, String
targetId, String[] versions) throws IllegalArgumentException {
 
         XPathContext context = XPathContext.getInstance();
         List<URLDirectivePair>[] result = new List[versions.length]; //unfortunately,
we cannot use a typed list array.
 
         try {
-            if (!context.init(gatewayId, versions, input)) {
-                m_log.log(LogService.LOG_WARNING, "Versions not found for Gateway: " + gatewayId);
+            if (!context.init(targetId, versions, input)) {
+                m_log.log(LogService.LOG_WARNING, "Versions not found for target: " + targetId);
                 throw new IllegalArgumentException("Versions not found.");
             }
             for (int i = 0; i < versions.length; i++) {
@@ -495,7 +493,7 @@ public class RepositoryBasedProvider imp
                     artifactNode = context.getVersion(i);
                 }
                 catch (XPathExpressionException e) {
-                    m_log.log(LogService.LOG_WARNING, "Version " + versions[i] + " not found
for Gateway: " + gatewayId);
+                    m_log.log(LogService.LOG_WARNING, "Version " + versions[i] + " not found
for target: " + targetId);
                     continue;
                 }
                 NodeList artifacts = artifactNode.getChildNodes();
@@ -586,7 +584,6 @@ public class RepositoryBasedProvider imp
         return result;
     }
 
-    @SuppressWarnings("unchecked")
     public void updated(Dictionary settings) throws ConfigurationException {
         if (settings != null) {
             String url = getNotNull(settings, URL, "DeploymentRepository URL not configured.");
@@ -622,7 +619,6 @@ public class RepositoryBasedProvider imp
     /**
      * Convenience method for getting settings from a configuration dictionary.
      */
-    @SuppressWarnings("unchecked")
     private String getNotNull(Dictionary settings, String id, String errorMessage) throws
ConfigurationException {
         String result = (String) settings.get(id);
         if (result == null) {

Modified: ace/trunk/ace-deployment-servlet/src/main/java/org/apache/ace/deployment/servlet/DeploymentServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-deployment-servlet/src/main/java/org/apache/ace/deployment/servlet/DeploymentServlet.java?rev=1301481&r1=1301480&r2=1301481&view=diff
==============================================================================
--- ace/trunk/ace-deployment-servlet/src/main/java/org/apache/ace/deployment/servlet/DeploymentServlet.java
(original)
+++ ace/trunk/ace-deployment-servlet/src/main/java/org/apache/ace/deployment/servlet/DeploymentServlet.java
Fri Mar 16 13:08:24 2012
@@ -39,8 +39,8 @@ import org.osgi.service.cm.ManagedServic
 import org.osgi.service.log.LogService;
 
 /**
- * The DeploymentServlet class provides in a list of versions available for a gateway and
a stream
- * of data containing the DeploymentPackage (or fix package) for a specific gateway and version.
+ * The DeploymentServlet class provides in a list of versions available for a target and
a stream
+ * of data containing the DeploymentPackage (or fix package) for a specific target and version.
  */
 public class DeploymentServlet extends HttpServlet implements ManagedService {
     private static final long serialVersionUID = 1L;
@@ -56,12 +56,12 @@ public class DeploymentServlet extends H
 
     /**
      * Responds to GET requests sent to this endpoint, the response depends on the requested
path:
-     * <li>http://host/endpoint/gatewayid/versions/ returns a list of versions available
for the specified gateway
-     * <li>http://host/endpoint/gatewayid/versions/x.y.z returns a deployment package
stream for the specified gateway and version
+     * <li>http://host/endpoint/targetid/versions/ returns a list of versions available
for the specified target
+     * <li>http://host/endpoint/targetid/versions/x.y.z returns a deployment package
stream for the specified target and version
      *
      * The status code of the response can be one of the following:
-     * <li><code>HttpServletResponse.SC_BAD_REQUEST</code> - If no gateway
is specified or the request is malformed in a different way.
-     * <li><code>HttpServletResponse.SC_NOT_FOUND</code> - If the specified
gateway or version does not exist.
+     * <li><code>HttpServletResponse.SC_BAD_REQUEST</code> - If no target
is specified or the request is malformed in a different way.
+     * <li><code>HttpServletResponse.SC_NOT_FOUND</code> - If the specified
target or version does not exist.
      * <li><code>HttpServletResponse.SC_INTERNAL_SERVER_ERROR</code> -
If there was a problem processing the request.
      * <li><code>HttpServletResponse.SC_OK</code> - If all went fine
      */
@@ -69,8 +69,8 @@ public class DeploymentServlet extends H
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
IOException {
         try {
             String[] pathElements = verifyAndGetPathElements(request.getPathInfo());
-            String gatewayID = pathElements[1];
-            List<String> versions = getVersions(gatewayID);
+            String targetID = pathElements[1];
+            List<String> versions = getVersions(targetID);
             int numberOfElements = pathElements.length;
 
             if (numberOfElements == 3) {
@@ -78,7 +78,7 @@ public class DeploymentServlet extends H
             }
             else {
                 String version = pathElements[3];
-                handlePackageDelivery(gatewayID, version, versions, request, response);
+                handlePackageDelivery(targetID, version, versions, request, response);
             }
         }
         catch (AceRestException e) {
@@ -89,7 +89,7 @@ public class DeploymentServlet extends H
 
     /**
      * Serve the case where requested path is like:
-     * http://host/endpoint/gatewayid/versions/ returns a list of versions available for
the specified gateway
+     * http://host/endpoint/targetid/versions/ returns a list of versions available for the
specified target
      *
      * @param versions versions to be put into response
      * @param response response object.
@@ -113,7 +113,7 @@ public class DeploymentServlet extends H
         }
     }
 
-    private void handlePackageDelivery(final String gatewayID, final String version, final
List<String> versions, final HttpServletRequest request, final HttpServletResponse response)
throws AceRestException {
+    private void handlePackageDelivery(final String targetID, final String version, final
List<String> versions, final HttpServletRequest request, final HttpServletResponse response)
throws AceRestException {
         ServletOutputStream output = null;
 
         try {
@@ -125,10 +125,10 @@ public class DeploymentServlet extends H
 
             InputStream inputStream;
             if (current != null) {
-                inputStream = m_streamGenerator.getDeploymentPackage(gatewayID, current,
version);
+                inputStream = m_streamGenerator.getDeploymentPackage(targetID, current, version);
             }
             else {
-                inputStream = m_streamGenerator.getDeploymentPackage(gatewayID, version);
+                inputStream = m_streamGenerator.getDeploymentPackage(targetID, version);
             }
 
             if (processor != null) {
@@ -156,12 +156,12 @@ public class DeploymentServlet extends H
         }
     }
 
-    private List<String> getVersions(String gatewayID) throws AceRestException {
+    private List<String> getVersions(String targetID) throws AceRestException {
         try {
-            return m_provider.getVersions(gatewayID);
+            return m_provider.getVersions(targetID);
         }
         catch (IllegalArgumentException iae) {
-            throw new AceRestException(HttpServletResponse.SC_NOT_FOUND, "Unknown gateway
(" + gatewayID + ")");
+            throw new AceRestException(HttpServletResponse.SC_NOT_FOUND, "Unknown target
(" + targetID + ")");
         }
         catch (IOException ioe) {
             m_log.log(LogService.LOG_WARNING, "Error getting available versions.", ioe);
@@ -209,7 +209,6 @@ public class DeploymentServlet extends H
         return "Ace Deployment Servlet Endpoint";
     }
 
-    @SuppressWarnings( "unchecked" )
     public void updated(Dictionary settings) throws ConfigurationException {
         // Nothing needs to be done - handled by DependencyManager
     }



Mime
View raw message