mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Refactored RemoteStore client (i.e. on web-tier) to use Connector framework for remote operations.
Remote AVM store now expects 'admin' auth level for all operations, and fixed to handle AuthenticationDenied exceptions. Added example config to use remote AVM store as primary lookup location (with fall back to web-app classpath) for model XML files - NOT on by default - as still need to add the avm sitestore to bootstrap/patch. Improvements to web-framework model object caching - use of "sentinel" pattern to cache missing values. Model object persister ordering now maintained as per Spring config order. ModelObjectManager now more aggressively throws out exceptions when errors occur loading model objects. Fix to RendererFactory to be thread safe (!) Other small fixes, clean up and productisation in web-framework. Useful toString() methods added to various classes for debugging. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9471 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2,6 +2,6 @@
|
|||||||
<shortname>Remote AVM Store</shortname>
|
<shortname>Remote AVM Store</shortname>
|
||||||
<description>Remote service mirroring the Store interface - to an AVM store</description>
|
<description>Remote service mirroring the Store interface - to an AVM store</description>
|
||||||
<url>/remotestore/{method}/{path}</url>
|
<url>/remotestore/{method}/{path}</url>
|
||||||
<authentication>none</authentication>
|
<authentication>admin</authentication>
|
||||||
<format default="">argument</format>
|
<format default="">argument</format>
|
||||||
</webscript>
|
</webscript>
|
@@ -2,6 +2,6 @@
|
|||||||
<shortname>Remote AVM Store</shortname>
|
<shortname>Remote AVM Store</shortname>
|
||||||
<description>Remote service mirroring the Store interface - to an AVM store</description>
|
<description>Remote service mirroring the Store interface - to an AVM store</description>
|
||||||
<url>/remotestore/{method}/{path}</url>
|
<url>/remotestore/{method}/{path}</url>
|
||||||
<authentication>none</authentication>
|
<authentication>admin</authentication>
|
||||||
<format default="">argument</format>
|
<format default="">argument</format>
|
||||||
</webscript>
|
</webscript>
|
@@ -31,11 +31,13 @@ import java.net.SocketException;
|
|||||||
|
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.web.scripts.Status;
|
||||||
import org.alfresco.web.scripts.WebScriptException;
|
import org.alfresco.web.scripts.WebScriptException;
|
||||||
import org.alfresco.web.scripts.WebScriptResponse;
|
import org.alfresco.web.scripts.WebScriptResponse;
|
||||||
import org.alfresco.web.scripts.servlet.WebScriptServletResponse;
|
import org.alfresco.web.scripts.servlet.WebScriptServletResponse;
|
||||||
@@ -108,7 +110,11 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
throw new WebScriptException("Unable to locate file: " + avmPath);
|
throw new WebScriptException("Unable to locate file: " + avmPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentReader reader = this.avmService.getContentReader(-1, avmPath);
|
ContentReader reader;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader = this.avmService.getContentReader(-1, avmPath);
|
||||||
|
|
||||||
if (reader == null)
|
if (reader == null)
|
||||||
{
|
{
|
||||||
throw new WebScriptException("No content found for AVM file: " + avmPath);
|
throw new WebScriptException("No content found for AVM file: " + avmPath);
|
||||||
@@ -157,6 +163,11 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
logger.info("Client aborted stream read:\n\tnode: " + avmPath + "\n\tcontent: " + reader);
|
logger.info("Client aborted stream read:\n\tnode: " + avmPath + "\n\tcontent: " + reader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (AccessDeniedException ae)
|
||||||
|
{
|
||||||
|
res.setStatus(Status.STATUS_UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.web.scripts.bean.BaseRemoteStore#hasDocument(org.alfresco.web.scripts.WebScriptResponse, java.lang.String)
|
* @see org.alfresco.repo.web.scripts.bean.BaseRemoteStore#hasDocument(org.alfresco.web.scripts.WebScriptResponse, java.lang.String)
|
||||||
@@ -186,8 +197,15 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
String[] parts = AVMNodeConverter.SplitBase(avmPath);
|
String[] parts = AVMNodeConverter.SplitBase(avmPath);
|
||||||
|
try
|
||||||
|
{
|
||||||
this.avmService.createFile(parts[0], parts[1], content);
|
this.avmService.createFile(parts[0], parts[1], content);
|
||||||
}
|
}
|
||||||
|
catch (AccessDeniedException ae)
|
||||||
|
{
|
||||||
|
res.setStatus(Status.STATUS_UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.web.scripts.bean.BaseRemoteStore#updateDocument(org.alfresco.web.scripts.WebScriptResponse, java.lang.String, java.io.InputStream)
|
* @see org.alfresco.repo.web.scripts.bean.BaseRemoteStore#updateDocument(org.alfresco.web.scripts.WebScriptResponse, java.lang.String, java.io.InputStream)
|
||||||
@@ -202,9 +220,16 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
throw new WebScriptException("Unable to locate file for update: " + avmPath);
|
throw new WebScriptException("Unable to locate file for update: " + avmPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
ContentWriter writer = this.avmService.getContentWriter(avmPath);
|
ContentWriter writer = this.avmService.getContentWriter(avmPath);
|
||||||
writer.putContent(content);
|
writer.putContent(content);
|
||||||
}
|
}
|
||||||
|
catch (AccessDeniedException ae)
|
||||||
|
{
|
||||||
|
res.setStatus(Status.STATUS_UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path root path relative
|
* @param path root path relative
|
||||||
|
Reference in New Issue
Block a user