ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1531295 - in /ace/trunk: org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/ org.apache.ace.repository/src/org/apache/ace/repository/ org.apache.ace.repository/src/org/apache/ace/repository/ext/ org.apache.ace...
Date Fri, 11 Oct 2013 13:41:35 GMT
Author: marrs
Date: Fri Oct 11 13:41:35 2013
New Revision: 1531295

URL: http://svn.apache.org/r1531295
Log:
ACE-418 Slight change in API and implementation, we no longer create streams of zero bytes
but return null instead.

Modified:
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/Repository.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/BackupRepository.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/CachedRepository.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/FilebasedBackupRepository.java

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
(original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
Fri Oct 11 13:41:35 2013
@@ -209,7 +209,13 @@ public class RepositoryBasedProvider imp
             // ACE-240: allow local/remote repositories to be empty; as the target 
             // might be new & unregistered, it can have no repository yet... 
             input = getRepositoryStream(false /* fail */);
-            List<Version> versionList = getAvailableVersions(input, targetId);
+            List<Version> versionList;
+            if (input == null) {
+            	versionList = Collections.EMPTY_LIST;
+            }
+            else {
+            	versionList = getAvailableVersions(input, targetId);
+            }
             if (versionList.isEmpty()) {
                 m_log.log(LogService.LOG_DEBUG, "No versions found for target: " + targetId);
             }
@@ -416,8 +422,12 @@ public class RepositoryBasedProvider imp
                 throw new IllegalArgumentException("There is no deployment information available.");
             }
         }
-
-        return new GZIPInputStream(result);
+        if (result == null) {
+        	return null;
+        }
+        else {
+        	return new GZIPInputStream(result);
+        }
     }
     
     private boolean isCacheUpToDate() {

Modified: ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/Repository.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/Repository.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/Repository.java (original)
+++ ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/Repository.java Fri
Oct 11 13:41:35 2013
@@ -53,7 +53,7 @@ public interface Repository
      * method as parameter.
      * 
      * @return a stream containing a checkout of the passed in version of
-     *         the repository, or null if the version does not exist
+     *         the repository, or <code>null</code> if the version does not exist
      * @throws java.io.IOException if there is an error reading the version
      * @throws IllegalArgumentException if the version is invalid.
      */

Modified: ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/BackupRepository.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/BackupRepository.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/BackupRepository.java
(original)
+++ ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/BackupRepository.java
Fri Oct 11 13:41:35 2013
@@ -40,7 +40,7 @@ public interface BackupRepository
 
     /**
      * Reads the input stream from the current object. If there is no current version,
-     * an empty stream will be returned.
+     * <code>null</code> will be returned.
      * @return An input stream, from which can be read. Remember to close it.
      * @throws java.io.IOException Will be thrown when there is a problem storing the data.
      */

Modified: ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/CachedRepository.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/CachedRepository.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/CachedRepository.java
(original)
+++ ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/CachedRepository.java
Fri Oct 11 13:41:35 2013
@@ -47,7 +47,7 @@ public interface CachedRepository extend
 
     /**
      * Gets the most recent version of the object. If no current version is available,
-     * and empty stream will be returned.
+     * <code>null</code> will be returned.
      * @param fail Indicates that this method should throw an IOException when no data
      * is available. Setting it to <code>false</code> will make it return an
      * empty stream in that case.

Modified: ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
(original)
+++ ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
Fri Oct 11 13:41:35 2013
@@ -58,14 +58,12 @@ public class CachedRepositoryImpl implem
 
     public InputStream checkout(boolean fail) throws IOException, IllegalArgumentException
{
         m_mostRecentVersion = highestRemoteVersion();
-        if (m_mostRecentVersion == 0) {
+        if (m_mostRecentVersion <= 0) {
             // If there is no remote version, then simply return an empty stream.
             if (fail) {
                 throw new IOException("No version has yet been checked in to the repository.");
             }
-            else {
-                return new ByteArrayInputStream(new byte[0]);
-            }
+            return null;
         }
         return checkout(m_mostRecentVersion);
     }
@@ -108,8 +106,11 @@ public class CachedRepositoryImpl implem
     public InputStream getLocal(boolean fail) throws IllegalArgumentException, IOException
{
         // ACE-240: only fail in case there is no local version available; when mostRecentVersion

         // equals to 0, it means that nothing has been committed locally...
-        if ((m_mostRecentVersion <= 0) && fail) {
-            throw new IOException("No local version available of " + m_local + ", remote
" + m_remote);
+        if (m_mostRecentVersion <= 0) {
+        	if (fail) {
+        		throw new IOException("No local version available of " + m_local + ", remote "
+ m_remote);
+        	}
+        	return null;
         }
         return m_local.read();
     }

Modified: ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/FilebasedBackupRepository.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/FilebasedBackupRepository.java?rev=1531295&r1=1531294&r2=1531295&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/FilebasedBackupRepository.java
(original)
+++ ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/ext/impl/FilebasedBackupRepository.java
Fri Oct 11 13:41:35 2013
@@ -53,7 +53,7 @@ public class FilebasedBackupRepository i
 
     public InputStream read() throws IOException {
         if (!m_current.exists()) {
-            return new ByteArrayInputStream(new byte[0]);
+            return null;
         }
         try {
             return new FileInputStream(m_current);



Mime
View raw message