diff --git a/config/alfresco/public-services-context.xml b/config/alfresco/public-services-context.xml
index 7fed014300..fa3f1ae1da 100644
--- a/config/alfresco/public-services-context.xml
+++ b/config/alfresco/public-services-context.xml
@@ -815,6 +815,8 @@
getSystemStore
revert
setGuid
+ setEncoding
+ setMimeType
diff --git a/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java b/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
index 78820a4dcb..535e4437c0 100644
--- a/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
+++ b/source/java/org/alfresco/repo/avm/AVMRemoteLocal.java
@@ -504,4 +504,20 @@ public class AVMRemoteLocal implements AVMRemote
{
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);
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java b/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
index a34888fe30..9068038c82 100644
--- a/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
+++ b/source/java/org/alfresco/repo/avm/AVMRemoteTransportService.java
@@ -1027,4 +1027,22 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
fAuthService.validate(ticket);
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);
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/AVMRepository.java b/source/java/org/alfresco/repo/avm/AVMRepository.java
index 7c39cae7a1..8c0bad1b79 100644
--- a/source/java/org/alfresco/repo/avm/AVMRepository.java
+++ b/source/java/org/alfresco/repo/avm/AVMRepository.java
@@ -2566,4 +2566,54 @@ public class AVMRepository
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);
+ }
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
index 6557a988c9..a20764fe47 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
@@ -1473,4 +1473,30 @@ public class AVMServiceImpl implements AVMService
AlfrescoTransactionSupport.bindListener(fTransactionListener);
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);
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTest.java b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
index f1223b5a30..bcad2ab7d3 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceTest.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
@@ -65,6 +65,7 @@ import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncException;
import org.alfresco.service.cmr.model.FileFolderService;
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.NodeRef;
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());
assertEquals(fService.lookup(-1, "main:/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();
report = depService.deployDifference(-1, "main:/a", "localhost", 50500, "admin", "admin", "target:/a", false, false, true, null);
System.out.println(report);
diff --git a/source/java/org/alfresco/repo/avm/AVMStore.java b/source/java/org/alfresco/repo/avm/AVMStore.java
index f6eb592b3d..62cd983ce8 100644
--- a/source/java/org/alfresco/repo/avm/AVMStore.java
+++ b/source/java/org/alfresco/repo/avm/AVMStore.java
@@ -479,4 +479,18 @@ public interface AVMStore
* @param 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);
}
diff --git a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
index 7d6ec8f1ef..688eab1598 100644
--- a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
@@ -1472,4 +1472,42 @@ public class AVMStoreImpl implements AVMStore, Serializable
AVMNode node = lPath.getCurrentNode();
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);
+ }
}
diff --git a/source/java/org/alfresco/repo/avm/PlainFileNode.java b/source/java/org/alfresco/repo/avm/PlainFileNode.java
index 00a1cf878f..49f63390a6 100644
--- a/source/java/org/alfresco/repo/avm/PlainFileNode.java
+++ b/source/java/org/alfresco/repo/avm/PlainFileNode.java
@@ -6,4 +6,15 @@ package org.alfresco.repo.avm;
*/
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);
}
diff --git a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
index c6afc8732b..d683e83772 100644
--- a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
@@ -304,7 +304,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
* Set the character encoding.
* @param encoding The encoding to set.
*/
- protected void setEncoding(String encoding)
+ public void setEncoding(String encoding)
{
fEncoding = encoding;
}
@@ -354,7 +354,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
* Set the Mime Type of the content.
* @param mimeType The Mime Type to set.
*/
- protected void setMimeType(String mimeType)
+ public void setMimeType(String mimeType)
{
fMimeType = mimeType;
}
diff --git a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
index d4c62e1a92..1f2a76aee9 100644
--- a/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
+++ b/source/java/org/alfresco/repo/deploy/DeploymentServiceImpl.java
@@ -58,6 +58,7 @@ import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.remote.AVMRemote;
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.namespace.QName;
import org.alfresco.util.Pair;
@@ -492,6 +493,12 @@ public class DeploymentServiceImpl implements DeploymentService
remote.addAspect(dst.getPath(), aspect);
}
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());
+ }
}
/**
diff --git a/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java b/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
index c49303bed1..c2d21b600a 100644
--- a/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
+++ b/source/java/org/alfresco/repo/remote/AVMRemoteImpl.java
@@ -518,4 +518,20 @@ public class AVMRemoteImpl implements AVMRemote
{
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);
+ }
}
diff --git a/source/java/org/alfresco/service/cmr/avm/AVMService.java b/source/java/org/alfresco/service/cmr/avm/AVMService.java
index 836ad1f13e..55086e6d20 100644
--- a/source/java/org/alfresco/service/cmr/avm/AVMService.java
+++ b/source/java/org/alfresco/service/cmr/avm/AVMService.java
@@ -1216,4 +1216,18 @@ public interface AVMService
* @param guid The GUID to set.
*/
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);
}
diff --git a/source/java/org/alfresco/service/cmr/remote/AVMRemote.java b/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
index 1fbafebd6c..9b65a4e839 100644
--- a/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
+++ b/source/java/org/alfresco/service/cmr/remote/AVMRemote.java
@@ -475,4 +475,18 @@ public interface AVMRemote
* @param guid The 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);
}
diff --git a/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java b/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
index 6e1eb5a7b3..f020fc0dcd 100644
--- a/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
+++ b/source/java/org/alfresco/service/cmr/remote/AVMRemoteTransport.java
@@ -488,4 +488,18 @@ public interface AVMRemoteTransport
* @param guid The GUID to set.
*/
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);
}