mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Swift – SE.S21 Share - DM Remote Store:
- Final code cleanup and javadoc git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28455 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -77,6 +77,7 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
{
|
{
|
||||||
private static final Log logger = LogFactory.getLog(ADMRemoteStore.class);
|
private static final Log logger = LogFactory.getLog(ADMRemoteStore.class);
|
||||||
|
|
||||||
|
// name of the surf config folder
|
||||||
private static final String SURF_CONFIG = "surf-config";
|
private static final String SURF_CONFIG = "surf-config";
|
||||||
|
|
||||||
// patterns used to match site and user specific configuration locations
|
// patterns used to match site and user specific configuration locations
|
||||||
@@ -85,6 +86,7 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
private static final Pattern SITE_PATTERN_1 = Pattern.compile(".*/components/.*\\.site~(.*)~.*");
|
private static final Pattern SITE_PATTERN_1 = Pattern.compile(".*/components/.*\\.site~(.*)~.*");
|
||||||
private static final Pattern SITE_PATTERN_2 = Pattern.compile(".*/pages/site/(.*?)(/.*)?$");
|
private static final Pattern SITE_PATTERN_2 = Pattern.compile(".*/pages/site/(.*?)(/.*)?$");
|
||||||
|
|
||||||
|
// service beans
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private NodeService unprotNodeService;
|
private NodeService unprotNodeService;
|
||||||
private FileFolderService fileFolderService;
|
private FileFolderService fileFolderService;
|
||||||
@@ -143,10 +145,9 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the last modified timestamp for the document.
|
* Gets the last modified timestamp for the document.
|
||||||
*
|
* <p>
|
||||||
* The output will be the last modified date as a long toString().
|
* The output will be the last modified date as a long toString().
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path to an existing document
|
* @param path document path to an existing document
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -177,17 +178,14 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a document.
|
* Gets a document.
|
||||||
*
|
* <p>
|
||||||
* The output will be the document content stream.
|
* The output will be the document content stream.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void getDocument(final WebScriptResponse res, final String store, final String path)
|
protected void getDocument(final WebScriptResponse res, final String store, final String path)
|
||||||
{
|
{
|
||||||
// TODO: could only allow appropriate users to read config docs i.e. site specific...
|
|
||||||
// but currently GET requests need to run unauthenticated before user login occurs.
|
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@SuppressWarnings("synthetic-access")
|
@SuppressWarnings("synthetic-access")
|
||||||
@@ -283,7 +281,6 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
*
|
*
|
||||||
* The output will be either the string "true" or the string "false".
|
* The output will be either the string "true" or the string "false".
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -313,7 +310,6 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
* Create methods are user authenticated, so the creation of site config must be
|
* Create methods are user authenticated, so the creation of site config must be
|
||||||
* allowed for the current user.
|
* allowed for the current user.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
* @param content content of the document to write
|
* @param content content of the document to write
|
||||||
*/
|
*/
|
||||||
@@ -345,9 +341,7 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
/**
|
/**
|
||||||
* Creates multiple XML documents encapsulated in a single one.
|
* Creates multiple XML documents encapsulated in a single one.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
* @param content XML document containing multiple document contents to write
|
||||||
* @param path document path
|
|
||||||
* @param content content of the document to write
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void createDocuments(WebScriptResponse res, String store, InputStream content)
|
protected void createDocuments(WebScriptResponse res, String store, InputStream content)
|
||||||
@@ -361,8 +355,7 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
* Update methods are user authenticated, so the modification of site config must be
|
* Update methods are user authenticated, so the modification of site config must be
|
||||||
* allowed for the current user.
|
* allowed for the current user.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
* @param path document path to update
|
||||||
* @param path document path
|
|
||||||
* @param content content to update the document with
|
* @param content content to update the document with
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -376,19 +369,25 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentWriter writer = contentService.getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
|
try
|
||||||
writer.putContent(content);
|
{
|
||||||
if (logger.isDebugEnabled())
|
ContentWriter writer = contentService.getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
|
||||||
logger.debug("updateDocument: " + fileInfo.toString());
|
writer.putContent(content);
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("updateDocument: " + fileInfo.toString());
|
||||||
|
}
|
||||||
|
catch (AccessDeniedException ae)
|
||||||
|
{
|
||||||
|
res.setStatus(Status.STATUS_UNAUTHORIZED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing document.
|
* Deletes an existing document.
|
||||||
* <p>
|
* <p>
|
||||||
* Delete methods are user authenticated, so the deletion of site config must be
|
* Delete methods are user authenticated, so the deletion of the document must be
|
||||||
* allowed for the current user.
|
* allowed for the current user.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -402,9 +401,16 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nodeService.deleteNode(fileInfo.getNodeRef());
|
try
|
||||||
if (logger.isDebugEnabled())
|
{
|
||||||
logger.debug("deleteDocument: " + fileInfo.toString());
|
this.nodeService.deleteNode(fileInfo.getNodeRef());
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("deleteDocument: " + fileInfo.toString());
|
||||||
|
}
|
||||||
|
catch (AccessDeniedException ae)
|
||||||
|
{
|
||||||
|
res.setStatus(Status.STATUS_UNAUTHORIZED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -413,7 +419,6 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
* The output will be the list of relative document paths found under the path.
|
* The output will be the list of relative document paths found under the path.
|
||||||
* Separated by newline characters.
|
* Separated by newline characters.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
* @param recurse true to peform a recursive list, false for direct children only.
|
* @param recurse true to peform a recursive list, false for direct children only.
|
||||||
*
|
*
|
||||||
@@ -461,7 +466,6 @@ public class ADMRemoteStore extends BaseRemoteStore
|
|||||||
* The output will be the list of relative document paths found under the path that
|
* The output will be the list of relative document paths found under the path that
|
||||||
* match the given file pattern. Separated by newline characters.
|
* match the given file pattern. Separated by newline characters.
|
||||||
*
|
*
|
||||||
* @param store the store id
|
|
||||||
* @param path document path
|
* @param path document path
|
||||||
* @param pattern file pattern to match - allows wildcards e.g. page.*.site.xml
|
* @param pattern file pattern to match - allows wildcards e.g. page.*.site.xml
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user