mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-23 18:05:32 +00:00
Added setEncoding, setMimeType to AVMService and AVMRemote interfaces.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5678 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
0e51d23b29
commit
5f8ffb9e51
@ -815,6 +815,8 @@
|
|||||||
<value>getSystemStore</value>
|
<value>getSystemStore</value>
|
||||||
<value>revert</value>
|
<value>revert</value>
|
||||||
<value>setGuid</value>
|
<value>setGuid</value>
|
||||||
|
<value>setEncoding</value>
|
||||||
|
<value>setMimeType</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -504,4 +504,20 @@ public class AVMRemoteLocal implements AVMRemote
|
|||||||
{
|
{
|
||||||
fService.setGuid(path, guid);
|
fService.setGuid(path, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemote#setEncoding(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding)
|
||||||
|
{
|
||||||
|
fService.setEncoding(path, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemote#setMimeType(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType)
|
||||||
|
{
|
||||||
|
fService.setMimeType(path, mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1027,4 +1027,22 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
|
|||||||
fAuthService.validate(ticket);
|
fAuthService.validate(ticket);
|
||||||
fAVMService.setGuid(path, guid);
|
fAVMService.setGuid(path, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemoteTransport#setEncoding(java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setEncoding(String ticket, String path, String encoding)
|
||||||
|
{
|
||||||
|
fAuthService.validate(ticket);
|
||||||
|
fAVMService.setEncoding(path, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemoteTransport#setMimeType(java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setMimeType(String ticket, String path, String mimeType)
|
||||||
|
{
|
||||||
|
fAuthService.validate(ticket);
|
||||||
|
fAVMService.setMimeType(path, mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2566,4 +2566,54 @@ public class AVMRepository
|
|||||||
fLookupCount.set(null);
|
fLookupCount.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encoding on a node.
|
||||||
|
* @param path
|
||||||
|
* @param encoding
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding)
|
||||||
|
{
|
||||||
|
fLookupCount.set(1);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String [] pathParts = SplitPath(path);
|
||||||
|
AVMStore store = getAVMStoreByName(pathParts[0]);
|
||||||
|
if (store == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Store Not Found: " + pathParts[0]);
|
||||||
|
}
|
||||||
|
fLookupCache.onWrite(pathParts[0]);
|
||||||
|
store.setEncoding(pathParts[1], encoding);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
fLookupCount.set(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type on a node.
|
||||||
|
* @param path
|
||||||
|
* @param encoding
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType)
|
||||||
|
{
|
||||||
|
fLookupCount.set(1);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String [] pathParts = SplitPath(path);
|
||||||
|
AVMStore store = getAVMStoreByName(pathParts[0]);
|
||||||
|
if (store == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Store Not Found: " + pathParts[0]);
|
||||||
|
}
|
||||||
|
fLookupCache.onWrite(pathParts[0]);
|
||||||
|
store.setMimeType(pathParts[1], mimeType);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
fLookupCount.set(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1473,4 +1473,30 @@ public class AVMServiceImpl implements AVMService
|
|||||||
AlfrescoTransactionSupport.bindListener(fTransactionListener);
|
AlfrescoTransactionSupport.bindListener(fTransactionListener);
|
||||||
fAVMRepository.setGuid(path, guid);
|
fAVMRepository.setGuid(path, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.avm.AVMService#setEncoding(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding)
|
||||||
|
{
|
||||||
|
if (path == null || encoding == null)
|
||||||
|
{
|
||||||
|
throw new AVMBadArgumentException("Illegal Null Argument.");
|
||||||
|
}
|
||||||
|
AlfrescoTransactionSupport.bindListener(fTransactionListener);
|
||||||
|
fAVMRepository.setEncoding(path, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.avm.AVMService#setMimeType(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType)
|
||||||
|
{
|
||||||
|
if (path == null || mimeType == null)
|
||||||
|
{
|
||||||
|
throw new AVMBadArgumentException("Illegal Null Argument.");
|
||||||
|
}
|
||||||
|
AlfrescoTransactionSupport.bindListener(fTransactionListener);
|
||||||
|
fAVMRepository.setMimeType(path, mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ import org.alfresco.service.cmr.avmsync.AVMDifference;
|
|||||||
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.remote.RepoRemote;
|
import org.alfresco.service.cmr.remote.RepoRemote;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@ -151,6 +152,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fService.lookup(-1, "target:/a/b/c/foo").getGuid());
|
fService.lookup(-1, "target:/a/b/c/foo").getGuid());
|
||||||
assertEquals(fService.lookup(-1, "main:/a/b/c/bar").getGuid(),
|
assertEquals(fService.lookup(-1, "main:/a/b/c/bar").getGuid(),
|
||||||
fService.lookup(-1, "target:/a/b/c/bar").getGuid());
|
fService.lookup(-1, "target:/a/b/c/bar").getGuid());
|
||||||
|
ContentData srcCD = fService.getContentDataForRead(-1, "main:/a/b/c/foo");
|
||||||
|
ContentData dstCD = fService.getContentDataForRead(-1, "target:/a/b/c/foo");
|
||||||
|
assertEquals(srcCD.getMimetype(), dstCD.getMimetype());
|
||||||
fService.createFile("main:/a/b", "biz").close();
|
fService.createFile("main:/a/b", "biz").close();
|
||||||
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, true, null);
|
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, true, null);
|
||||||
System.out.println(report);
|
System.out.println(report);
|
||||||
|
@ -479,4 +479,18 @@ public interface AVMStore
|
|||||||
* @param guid
|
* @param guid
|
||||||
*/
|
*/
|
||||||
public void setGuid(String path, String guid);
|
public void setGuid(String path, String guid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encoding of a file.
|
||||||
|
* @param path
|
||||||
|
* @param encoding
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type of a file.
|
||||||
|
* @param path
|
||||||
|
* @param mimeType
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType);
|
||||||
}
|
}
|
||||||
|
@ -1472,4 +1472,42 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
AVMNode node = lPath.getCurrentNode();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
node.setGuid(guid);
|
node.setGuid(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMStore#setEncoding(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding)
|
||||||
|
{
|
||||||
|
Lookup lPath = lookup(-1, path, true, false);
|
||||||
|
if (lPath == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Path not found: " + path);
|
||||||
|
}
|
||||||
|
AVMNode node = lPath.getCurrentNode();
|
||||||
|
if (node.getType() != AVMNodeType.PLAIN_FILE)
|
||||||
|
{
|
||||||
|
throw new AVMWrongTypeException("Not a File: " + path);
|
||||||
|
}
|
||||||
|
PlainFileNode file = (PlainFileNode)node;
|
||||||
|
file.setEncoding(encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.avm.AVMStore#setMimeType(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType)
|
||||||
|
{
|
||||||
|
Lookup lPath = lookup(-1, path, true, false);
|
||||||
|
if (lPath == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Path not found: " + path);
|
||||||
|
}
|
||||||
|
AVMNode node = lPath.getCurrentNode();
|
||||||
|
if (node.getType() != AVMNodeType.PLAIN_FILE)
|
||||||
|
{
|
||||||
|
throw new AVMWrongTypeException("Not a File: " + path);
|
||||||
|
}
|
||||||
|
PlainFileNode file = (PlainFileNode)node;
|
||||||
|
file.setMimeType(mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,15 @@ package org.alfresco.repo.avm;
|
|||||||
*/
|
*/
|
||||||
interface PlainFileNode extends FileNode
|
interface PlainFileNode extends FileNode
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Set the encoding of this file.
|
||||||
|
* @param encoding
|
||||||
|
*/
|
||||||
|
public void setEncoding(String encoding);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type of this file.
|
||||||
|
* @param mimeType
|
||||||
|
*/
|
||||||
|
public void setMimeType(String mimeType);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
* Set the character encoding.
|
* Set the character encoding.
|
||||||
* @param encoding The encoding to set.
|
* @param encoding The encoding to set.
|
||||||
*/
|
*/
|
||||||
protected void setEncoding(String encoding)
|
public void setEncoding(String encoding)
|
||||||
{
|
{
|
||||||
fEncoding = encoding;
|
fEncoding = encoding;
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
* Set the Mime Type of the content.
|
* Set the Mime Type of the content.
|
||||||
* @param mimeType The Mime Type to set.
|
* @param mimeType The Mime Type to set.
|
||||||
*/
|
*/
|
||||||
protected void setMimeType(String mimeType)
|
public void setMimeType(String mimeType)
|
||||||
{
|
{
|
||||||
fMimeType = mimeType;
|
fMimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ import org.alfresco.service.cmr.avmsync.AVMDifference;
|
|||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.remote.AVMRemote;
|
import org.alfresco.service.cmr.remote.AVMRemote;
|
||||||
import org.alfresco.service.cmr.remote.AVMRemoteTransport;
|
import org.alfresco.service.cmr.remote.AVMRemoteTransport;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
@ -492,6 +493,12 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
remote.addAspect(dst.getPath(), aspect);
|
remote.addAspect(dst.getPath(), aspect);
|
||||||
}
|
}
|
||||||
remote.setGuid(dst.getPath(), src.getGuid());
|
remote.setGuid(dst.getPath(), src.getGuid());
|
||||||
|
if (src.isFile())
|
||||||
|
{
|
||||||
|
ContentData contData = fAVMService.getContentDataForRead(version, src.getPath());
|
||||||
|
remote.setEncoding(dst.getPath(), contData.getEncoding());
|
||||||
|
remote.setMimeType(dst.getPath(), contData.getMimetype());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -518,4 +518,20 @@ public class AVMRemoteImpl implements AVMRemote
|
|||||||
{
|
{
|
||||||
fTransport.setGuid(fTicketHolder.getTicket(), path, guid);
|
fTransport.setGuid(fTicketHolder.getTicket(), path, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemote#setEncoding(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding)
|
||||||
|
{
|
||||||
|
fTransport.setEncoding(fTicketHolder.getTicket(), path, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.remote.AVMRemote#setMimeType(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType)
|
||||||
|
{
|
||||||
|
fTransport.setMimeType(fTicketHolder.getTicket(), path, mimeType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1216,4 +1216,18 @@ public interface AVMService
|
|||||||
* @param guid The GUID to set.
|
* @param guid The GUID to set.
|
||||||
*/
|
*/
|
||||||
public void setGuid(String path, String guid);
|
public void setGuid(String path, String guid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param mimeType The mime type.
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encoding.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param encoding The encoding.
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding);
|
||||||
}
|
}
|
||||||
|
@ -475,4 +475,18 @@ public interface AVMRemote
|
|||||||
* @param guid The GUID.
|
* @param guid The GUID.
|
||||||
*/
|
*/
|
||||||
public void setGuid(String path, String guid);
|
public void setGuid(String path, String guid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param mimeType The mime type.
|
||||||
|
*/
|
||||||
|
public void setMimeType(String path, String mimeType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encoding.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param encoding The encoding.
|
||||||
|
*/
|
||||||
|
public void setEncoding(String path, String encoding);
|
||||||
}
|
}
|
||||||
|
@ -488,4 +488,18 @@ public interface AVMRemoteTransport
|
|||||||
* @param guid The GUID to set.
|
* @param guid The GUID to set.
|
||||||
*/
|
*/
|
||||||
public void setGuid(String ticket, String path, String guid);
|
public void setGuid(String ticket, String path, String guid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mime type.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param mimeType The mime type.
|
||||||
|
*/
|
||||||
|
public void setMimeType(String ticket, String path, String mimeType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encoding.
|
||||||
|
* @param path The path of the file.
|
||||||
|
* @param encoding The encoding.
|
||||||
|
*/
|
||||||
|
public void setEncoding(String ticket, String path, String encoding);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user