mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
77148: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 73957: ContentStore API cleanup - Removed previously-deprecated ContentStore.getWriter(ContentReader existingContentReader, String newContentUrl) - Removed previously-deprecated getSpaceUsed() - Removed previously-deprecated getTotalSize() - Deprecated optional and unused getUrls() and variants - Clean up of implementations to ignore relevant deprecations, etc git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78004 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -602,7 +602,7 @@ public class ContentUrlConverterPatch extends AbstractPatch
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long totalSize = contentStore.getSpaceUsed();
|
final long totalSize = contentStore.getSpaceTotal();
|
||||||
final MutableLong currentSize = new MutableLong(0L);
|
final MutableLong currentSize = new MutableLong(0L);
|
||||||
|
|
||||||
final MutableInt count = new MutableInt();
|
final MutableInt count = new MutableInt();
|
||||||
|
@@ -78,6 +78,14 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected ContentLimitProvider contentLimitProvider = new NoLimitProvider();
|
protected ContentLimitProvider contentLimitProvider = new NoLimitProvider();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object that prevents abuse of the underlying store(s)
|
||||||
|
*/
|
||||||
|
public void setContentLimitProvider(ContentLimitProvider contentLimitProvider)
|
||||||
|
{
|
||||||
|
this.contentLimitProvider = contentLimitProvider;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits the content URL into its component parts as separated by
|
* Splits the content URL into its component parts as separated by
|
||||||
@@ -119,6 +127,7 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isContentUrlSupported(String contentUrl)
|
public boolean isContentUrlSupported(String contentUrl)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -140,6 +149,7 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean delete(String contentUrl)
|
public boolean delete(String contentUrl)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@@ -148,6 +158,8 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
/**
|
/**
|
||||||
* @see #getUrls(Date, Date, ContentUrlHandler)
|
* @see #getUrls(Date, Date, ContentUrlHandler)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
public final void getUrls(ContentUrlHandler handler) throws ContentIOException
|
public final void getUrls(ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
getUrls(null, null, handler);
|
getUrls(null, null, handler);
|
||||||
@@ -159,6 +171,8 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException always
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@@ -193,6 +207,7 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
* @see #getWriterInternal(ContentReader, String)
|
* @see #getWriterInternal(ContentReader, String)
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ContentWriter getWriter(ContentContext context)
|
public ContentWriter getWriter(ContentContext context)
|
||||||
{
|
{
|
||||||
ContentReader existingContentReader = context.getExistingContentReader();
|
ContentReader existingContentReader = context.getExistingContentReader();
|
||||||
@@ -249,44 +264,18 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ContentContext
|
|
||||||
* @see ContentStore#getWriter(ContentContext)
|
|
||||||
*/
|
|
||||||
public final ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl)
|
|
||||||
{
|
|
||||||
ContentContext ctx = new ContentContext(existingContentReader, newContentUrl);
|
|
||||||
return getWriter(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple implementation that uses the
|
* Simple implementation that uses the
|
||||||
* {@link ContentReader#exists() reader's exists} method as its implementation.
|
* {@link ContentReader#exists() reader's exists} method as its implementation.
|
||||||
* Override this method if a more efficient implementation is possible.
|
* Override this method if a more efficient implementation is possible.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean exists(String contentUrl)
|
public boolean exists(String contentUrl)
|
||||||
{
|
{
|
||||||
ContentReader reader = getReader(contentUrl);
|
ContentReader reader = getReader(contentUrl);
|
||||||
return reader.exists();
|
return reader.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses {@link #getSpaceUsed()}, which is the equivalent method. This method is now
|
|
||||||
* final in order to catch any implementations that should switch over to {@link #getSpaceUsed()}.
|
|
||||||
*/
|
|
||||||
public final long getTotalSize()
|
|
||||||
{
|
|
||||||
return getSpaceUsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns <tt>-1</tt> always
|
|
||||||
*/
|
|
||||||
public long getSpaceUsed()
|
|
||||||
{
|
|
||||||
return -1L;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns <tt>-1</tt> always
|
* @return Returns <tt>-1</tt> always
|
||||||
*/
|
*/
|
||||||
@@ -306,15 +295,11 @@ public abstract class AbstractContentStore implements ContentStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* @return Returns a '.' (period) always
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getRootLocation()
|
public String getRootLocation()
|
||||||
{
|
{
|
||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentLimitProvider(ContentLimitProvider contentLimitProvider)
|
|
||||||
{
|
|
||||||
this.contentLimitProvider = contentLimitProvider;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -251,23 +251,6 @@ public abstract class AbstractRoutingContentStore implements ContentStore
|
|||||||
return ".";
|
return ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses {@link #getSpaceUsed()}, which is the equivalent method. This method is now
|
|
||||||
* final in order to catch any implementations that should switch over to {@link #getSpaceUsed()}.
|
|
||||||
*/
|
|
||||||
public final long getTotalSize()
|
|
||||||
{
|
|
||||||
return getSpaceUsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns <tt>-1</tt> always
|
|
||||||
*/
|
|
||||||
public long getSpaceUsed()
|
|
||||||
{
|
|
||||||
return -1L;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns <tt>-1</tt> always
|
* @return Returns <tt>-1</tt> always
|
||||||
*/
|
*/
|
||||||
@@ -406,6 +389,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
|
|||||||
/**
|
/**
|
||||||
* @see #getUrls(Date, Date, ContentUrlHandler)
|
* @see #getUrls(Date, Date, ContentUrlHandler)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void getUrls(ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
getUrls(null, null, handler);
|
getUrls(null, null, handler);
|
||||||
@@ -416,6 +400,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
|
|||||||
*
|
*
|
||||||
* @see ContentStore#getUrls(Date, Date, ContentUrlHandler)
|
* @see ContentStore#getUrls(Date, Date, ContentUrlHandler)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
List<ContentStore> stores = getAllStores();
|
List<ContentStore> stores = getAllStores();
|
||||||
|
@@ -97,32 +97,7 @@ public interface ContentStore
|
|||||||
public boolean isWriteSupported();
|
public boolean isWriteSupported();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Since 3.3.3 use {@link #getSpaceUsed()}.
|
* Calculates the remaning <i>free</i> space in the underlying store.
|
||||||
* @see #getSpaceFree()
|
|
||||||
* @see #getSpaceTotal()
|
|
||||||
*/
|
|
||||||
public long getTotalSize();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates the total size of <b>stored content</b>, excluding any other data in the underlying
|
|
||||||
* storage.
|
|
||||||
* <p/>
|
|
||||||
* <b>NOTE:</b> Calculating this value can be time-consuming - use sparingly.
|
|
||||||
* <p/>
|
|
||||||
* <b>NOTE:</b> For efficiency, some implementations may provide a guess. If not, this call could
|
|
||||||
* take a long time.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* Returns the total, possibly approximate size (in bytes) of the binary data stored or <tt>-1</tt>
|
|
||||||
* if no size data is available.
|
|
||||||
*
|
|
||||||
* @since 3.3.3
|
|
||||||
* @deprecated This method takes too long to complete in many situations (see ALF-12410).
|
|
||||||
*/
|
|
||||||
public long getSpaceUsed();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calcualates the remaing <i>free</i> space in the underlying store.
|
|
||||||
* <p>
|
* <p>
|
||||||
* <b>NOTE:</b> For efficiency, some implementations may provide a guess.
|
* <b>NOTE:</b> For efficiency, some implementations may provide a guess.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -231,15 +206,6 @@ public interface ContentStore
|
|||||||
*/
|
*/
|
||||||
public ContentWriter getWriter(ContentContext context);
|
public ContentWriter getWriter(ContentContext context);
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut method to {@link #getWriter(ContentContext)}.
|
|
||||||
*
|
|
||||||
* @see #getWriter(ContentContext)
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all URLs for the store, regardless of creation time.
|
* Get all URLs for the store, regardless of creation time.
|
||||||
* @return
|
* @return
|
||||||
@@ -250,7 +216,11 @@ public interface ContentStore
|
|||||||
* if the store is unable to provide the information
|
* if the store is unable to provide the information
|
||||||
*
|
*
|
||||||
* @see #getUrls(Date, Date)
|
* @see #getUrls(Date, Date)
|
||||||
|
*
|
||||||
|
* @deprecated in 5.0. The API is no longer used by Alfresco;
|
||||||
|
* efficient APIs can be provided by the implementations, if required
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void getUrls(ContentUrlHandler handler) throws ContentIOException;
|
public void getUrls(ContentUrlHandler handler) throws ContentIOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,7 +236,11 @@ public interface ContentStore
|
|||||||
* if an error occurs
|
* if an error occurs
|
||||||
* @throws UnsupportedOperationException
|
* @throws UnsupportedOperationException
|
||||||
* if the store is unable to provide the information
|
* if the store is unable to provide the information
|
||||||
|
*
|
||||||
|
* @deprecated in 5.0. The API is no longer used by Alfresco;
|
||||||
|
* efficient APIs can be provided by the implementations, if required
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException;
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,7 +268,9 @@ public interface ContentStore
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @deprecated in 5.0
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface ContentUrlHandler
|
public interface ContentUrlHandler
|
||||||
{
|
{
|
||||||
void handle(String contentUrl);
|
void handle(String contentUrl);
|
||||||
|
@@ -92,81 +92,42 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
|||||||
eventPublisher.publishEvent(new CachingContentStoreCreatedEvent(this));
|
eventPublisher.publishEvent(new CachingContentStoreCreatedEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#isContentUrlSupported(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContentUrlSupported(String contentUrl)
|
public boolean isContentUrlSupported(String contentUrl)
|
||||||
{
|
{
|
||||||
return backingStore.isContentUrlSupported(contentUrl);
|
return backingStore.isContentUrlSupported(contentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#isWriteSupported()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWriteSupported()
|
public boolean isWriteSupported()
|
||||||
{
|
{
|
||||||
return backingStore.isWriteSupported();
|
return backingStore.isWriteSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getTotalSize()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long getTotalSize()
|
|
||||||
{
|
|
||||||
return backingStore.getTotalSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getSpaceUsed()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long getSpaceUsed()
|
|
||||||
{
|
|
||||||
return backingStore.getSpaceUsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getSpaceFree()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public long getSpaceFree()
|
public long getSpaceFree()
|
||||||
{
|
{
|
||||||
return backingStore.getSpaceFree();
|
return backingStore.getSpaceFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getSpaceTotal()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public long getSpaceTotal()
|
public long getSpaceTotal()
|
||||||
{
|
{
|
||||||
return backingStore.getSpaceTotal();
|
return backingStore.getSpaceTotal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getRootLocation()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getRootLocation()
|
public String getRootLocation()
|
||||||
{
|
{
|
||||||
return backingStore.getRootLocation();
|
return backingStore.getRootLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#exists(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(String contentUrl)
|
public boolean exists(String contentUrl)
|
||||||
{
|
{
|
||||||
return backingStore.exists(contentUrl);
|
return backingStore.exists(contentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getReader(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ContentReader getReader(String contentUrl)
|
public ContentReader getReader(String contentUrl)
|
||||||
{
|
{
|
||||||
@@ -284,9 +245,6 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
|||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getWriter(org.alfresco.repo.content.ContentContext)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ContentWriter getWriter(final ContentContext context)
|
public ContentWriter getWriter(final ContentContext context)
|
||||||
{
|
{
|
||||||
@@ -335,28 +293,14 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@SuppressWarnings("deprecation")
|
||||||
* @see org.alfresco.repo.content.ContentStore#getWriter(org.alfresco.service.cmr.repository.ContentReader, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl)
|
|
||||||
{
|
|
||||||
ContentContext ctx = new ContentContext(existingContentReader, newContentUrl);
|
|
||||||
return getWriter(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#getUrls(org.alfresco.repo.content.ContentStore.ContentUrlHandler)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void getUrls(ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
backingStore.getUrls(handler);
|
backingStore.getUrls(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@SuppressWarnings("deprecation")
|
||||||
* @see org.alfresco.repo.content.ContentStore#getUrls(java.util.Date, java.util.Date, org.alfresco.repo.content.ContentStore.ContentUrlHandler)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler)
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler)
|
||||||
throws ContentIOException
|
throws ContentIOException
|
||||||
@@ -364,9 +308,6 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
|
|||||||
backingStore.getUrls(createdAfter, createdBefore, handler);
|
backingStore.getUrls(createdAfter, createdBefore, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.alfresco.repo.content.ContentStore#delete(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delete(String contentUrl)
|
public boolean delete(String contentUrl)
|
||||||
{
|
{
|
||||||
|
@@ -123,7 +123,7 @@ public class FileContentStore
|
|||||||
{
|
{
|
||||||
this(rootDirectoryStr);
|
this(rootDirectoryStr);
|
||||||
setApplicationContext(context);
|
setApplicationContext(context);
|
||||||
publishEvent(context, Collections.EMPTY_MAP);
|
publishEvent(context, Collections.<String, Serializable> emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +138,7 @@ public class FileContentStore
|
|||||||
{
|
{
|
||||||
this(rootDirectory);
|
this(rootDirectory);
|
||||||
setApplicationContext(context);
|
setApplicationContext(context);
|
||||||
publishEvent(context, Collections.EMPTY_MAP);
|
publishEvent(context, Collections.<String, Serializable> emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileContentStore(ApplicationContext context, File rootDirectory, Map<String, Serializable> extendedEventParams)
|
public FileContentStore(ApplicationContext context, File rootDirectory, Map<String, Serializable> extendedEventParams)
|
||||||
@@ -513,6 +513,7 @@ public class FileContentStore
|
|||||||
* the handler
|
* the handler
|
||||||
* @return the urls
|
* @return the urls
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler)
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler)
|
||||||
{
|
{
|
||||||
// recursively get all files within the root
|
// recursively get all files within the root
|
||||||
@@ -533,6 +534,7 @@ public class FileContentStore
|
|||||||
* @param createdBefore only get URLs for content created before this date
|
* @param createdBefore only get URLs for content created before this date
|
||||||
* @return a list of all files within the given directory and all subdirectories
|
* @return a list of all files within the given directory and all subdirectories
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void getUrls(File directory, ContentUrlHandler handler, Date createdAfter, Date createdBefore)
|
private void getUrls(File directory, ContentUrlHandler handler, Date createdAfter, Date createdBefore)
|
||||||
{
|
{
|
||||||
File[] files = directory.listFiles();
|
File[] files = directory.listFiles();
|
||||||
@@ -662,7 +664,7 @@ public class FileContentStore
|
|||||||
// (e.g. for monitoring purposes)
|
// (e.g. for monitoring purposes)
|
||||||
if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext)
|
if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext)
|
||||||
{
|
{
|
||||||
publishEvent(((ContextRefreshedEvent) event).getApplicationContext(), Collections.EMPTY_MAP);
|
publishEvent(((ContextRefreshedEvent) event).getApplicationContext(), Collections.<String, Serializable> emptyMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.content.replication;
|
package org.alfresco.repo.content.replication;
|
||||||
|
|
||||||
|
import org.alfresco.repo.content.ContentContext;
|
||||||
import org.alfresco.repo.content.ContentStore;
|
import org.alfresco.repo.content.ContentStore;
|
||||||
import org.alfresco.repo.content.ContentStore.ContentUrlHandler;
|
import org.alfresco.repo.content.ContentStore.ContentUrlHandler;
|
||||||
import org.alfresco.repo.node.index.IndexRecovery;
|
import org.alfresco.repo.node.index.IndexRecovery;
|
||||||
@@ -41,6 +42,7 @@ import org.quartz.JobExecutionException;
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class ContentStoreReplicator
|
public class ContentStoreReplicator
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(ContentStoreReplicator.class);
|
private static Log logger = LogFactory.getLog(ContentStoreReplicator.class);
|
||||||
@@ -54,6 +56,7 @@ public class ContentStoreReplicator
|
|||||||
public ContentStoreReplicator()
|
public ContentStoreReplicator()
|
||||||
{
|
{
|
||||||
this.busy = false;
|
this.busy = false;
|
||||||
|
logger.warn("DEPRECATION: The ContentStoreReplicator component has been deprecated in 5.0 as it only works against optionally-implemented, deprecated APIs.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,7 +195,8 @@ public class ContentStoreReplicator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// get a writer to the target store - this can fail if the content is there now
|
// get a writer to the target store - this can fail if the content is there now
|
||||||
ContentWriter writer = targetStore.getWriter(null, contentUrl);
|
ContentContext ctx = new ContentContext(null, contentUrl);
|
||||||
|
ContentWriter writer = targetStore.getWriter(ctx);
|
||||||
// get the source reader
|
// get the source reader
|
||||||
ContentReader reader = sourceStore.getReader(contentUrl);
|
ContentReader reader = sourceStore.getReader(contentUrl);
|
||||||
if (!reader.exists())
|
if (!reader.exists())
|
||||||
|
@@ -377,6 +377,7 @@ public class ReplicatingContentStore extends AbstractContentStore
|
|||||||
* Iterates over results as given by the primary store and all secondary stores. It is up to the handler to eliminate
|
* Iterates over results as given by the primary store and all secondary stores. It is up to the handler to eliminate
|
||||||
* duplicates that will occur between the primary and secondary stores.
|
* duplicates that will occur between the primary and secondary stores.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
// add in URLs from primary store
|
// add in URLs from primary store
|
||||||
@@ -399,8 +400,6 @@ public class ReplicatingContentStore extends AbstractContentStore
|
|||||||
/**
|
/**
|
||||||
* Replicates the content upon stream closure. If the thread pool is available,
|
* Replicates the content upon stream closure. If the thread pool is available,
|
||||||
* then the process will be asynchronous.
|
* then the process will be asynchronous.
|
||||||
* <p>
|
|
||||||
|
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
|
@@ -109,6 +109,7 @@ public abstract class AbstractReadOnlyContentStoreTest extends TestCase
|
|||||||
* @return
|
* @return
|
||||||
* Return any valid URL for the store, or <tt>null</tt> if the store is empty.
|
* Return any valid URL for the store, or <tt>null</tt> if the store is empty.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected String getExistingContentUrl()
|
protected String getExistingContentUrl()
|
||||||
{
|
{
|
||||||
ContentStore store = getStore();
|
ContentStore store = getStore();
|
||||||
|
@@ -50,6 +50,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class AbstractWritableContentStoreTest extends AbstractReadOnlyContentStoreTest
|
public abstract class AbstractWritableContentStoreTest extends AbstractReadOnlyContentStoreTest
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(AbstractWritableContentStoreTest.class);
|
private static Log logger = LogFactory.getLog(AbstractWritableContentStoreTest.class);
|
||||||
@@ -98,15 +99,6 @@ public abstract class AbstractWritableContentStoreTest extends AbstractReadOnlyC
|
|||||||
assertTrue("The store cannot be read-only", store.isWriteSupported());
|
assertTrue("The store cannot be read-only", store.isWriteSupported());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Just check that the method doesn't blow up
|
|
||||||
*/
|
|
||||||
public void testSpaceUsed() throws Exception
|
|
||||||
{
|
|
||||||
ContentStore store = getStore();
|
|
||||||
store.getSpaceUsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just checks that the method doesn't blow up
|
* Just checks that the method doesn't blow up
|
||||||
*/
|
*/
|
||||||
|
@@ -212,6 +212,7 @@ public class RoutingContentStoreTest extends AbstractWritableContentStoreTest
|
|||||||
return fileStore.getReader(contentUrl);
|
return fileStore.getReader(contentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
||||||
{
|
{
|
||||||
@@ -239,11 +240,5 @@ public class RoutingContentStoreTest extends AbstractWritableContentStoreTest
|
|||||||
{
|
{
|
||||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getUrls(Date createdAfter, Date createdBefore, ContentUrlHandler handler) throws ContentIOException
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("getUrls not supported");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,12 +34,10 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.alfresco.repo.content.ContentContext;
|
import org.alfresco.repo.content.ContentContext;
|
||||||
import org.alfresco.repo.content.ContentStore;
|
import org.alfresco.repo.content.ContentStore;
|
||||||
import org.alfresco.repo.content.ContentStore.ContentUrlHandler;
|
|
||||||
import org.alfresco.repo.content.caching.quota.QuotaManagerStrategy;
|
import org.alfresco.repo.content.caching.quota.QuotaManagerStrategy;
|
||||||
import org.alfresco.repo.content.caching.quota.UnlimitedQuotaStrategy;
|
import org.alfresco.repo.content.caching.quota.UnlimitedQuotaStrategy;
|
||||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||||
@@ -398,22 +396,6 @@ public class CachingContentStoreTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void delegatedGetTotalSize()
|
|
||||||
{
|
|
||||||
when(backingStore.getTotalSize()).thenReturn(234L);
|
|
||||||
assertEquals(234L, cachingStore.getTotalSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void delegatedGetSpaceUsed()
|
|
||||||
{
|
|
||||||
when(backingStore.getSpaceUsed()).thenReturn(453L);
|
|
||||||
assertEquals(453L, cachingStore.getSpaceUsed());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void delegatedGetSpaceFree()
|
public void delegatedGetSpaceFree()
|
||||||
{
|
{
|
||||||
@@ -449,30 +431,6 @@ public class CachingContentStoreTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void delegatedGetUrls1()
|
|
||||||
{
|
|
||||||
ContentUrlHandler handler = createDummyUrlHandler();
|
|
||||||
|
|
||||||
cachingStore.getUrls(handler);
|
|
||||||
|
|
||||||
verify(backingStore).getUrls(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void delegatedGetUrls2()
|
|
||||||
{
|
|
||||||
ContentUrlHandler handler = createDummyUrlHandler();
|
|
||||||
Date after = new Date(123L);
|
|
||||||
Date before = new Date(456L);
|
|
||||||
|
|
||||||
cachingStore.getUrls(after, before, handler);
|
|
||||||
|
|
||||||
verify(backingStore).getUrls(after, before, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void delegatedDelete()
|
public void delegatedDelete()
|
||||||
{
|
{
|
||||||
@@ -482,23 +440,4 @@ public class CachingContentStoreTest
|
|||||||
when(backingStore.delete("url")).thenReturn(false);
|
when(backingStore.delete("url")).thenReturn(false);
|
||||||
assertFalse(cachingStore.delete("url"));
|
assertFalse(cachingStore.delete("url"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a stub handler - just so we can check it has been passed around correctly.
|
|
||||||
*
|
|
||||||
* @return ContentUrlHandler
|
|
||||||
*/
|
|
||||||
private ContentUrlHandler createDummyUrlHandler()
|
|
||||||
{
|
|
||||||
ContentUrlHandler handler = new ContentUrlHandler()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void handle(String contentUrl)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ import org.springframework.context.support.StaticApplicationContext;
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings({"unused", "deprecation"})
|
||||||
public class ContentStoreReplicatorTest extends TestCase
|
public class ContentStoreReplicatorTest extends TestCase
|
||||||
{
|
{
|
||||||
private static final String SOME_CONTENT = "The No. 1 Ladies' Detective Agency";
|
private static final String SOME_CONTENT = "The No. 1 Ladies' Detective Agency";
|
||||||
|
Reference in New Issue
Block a user