Merged V2.2 to HEAD

7653: Update and added deployment icons
   7655: Fixed multithreaded test case to handle case where threads can't get started due to lack of available DB connections.
   7657: AR-1903: Text attachments should be treated the same way as other attachments.
   7661: Fixed duplicate index creation for column that is also declared unique
   7662: Additional indexes related to permissions
   7664: Fixed query for specific property types
   7667: Used existing attachable aspect for email attachments - effectively reversing association direction.
   7682: Added AVM Console page to webapp (admin user protected)
   7683: Merged V2.1 to V2.2
      7642: Fix for WCM-949
      7668: Debugging output for getAPath(). Possible partial fix for LazyInitialization errors seen by some customers
      7672: Fixed sub optimal tree pruning in filesystem deployment


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8442 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-06 21:28:43 +00:00
parent ab80624ce0
commit ecb74c1447
19 changed files with 215 additions and 79 deletions

View File

@@ -41,6 +41,8 @@ import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
import org.alfresco.service.cmr.avm.VersionDescriptor;
import org.alfresco.service.cmr.avm.locking.AVMLock;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.namespace.QName;
@@ -48,7 +50,9 @@ import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* An interactive console for the AVM repository.
*
* @author britt
* @author Gavin Cornwell
*/
public class AVMInterpreter
{
@@ -62,6 +66,11 @@ public class AVMInterpreter
*/
private AVMSyncService fSyncService;
/**
* The locking service.
*/
private AVMLockingService fLockingService;
/**
* The reader for interaction.
*/
@@ -83,6 +92,7 @@ public class AVMInterpreter
AVMInterpreter console = new AVMInterpreter();
console.setAvmService((AVMService)context.getBean("AVMService"));
console.setAvmSyncService((AVMSyncService)context.getBean("AVMSyncService"));
console.setAvmLockingService((AVMLockingService)context.getBean("AVMLockingService"));
BulkLoader loader = new BulkLoader();
loader.setAvmService((AVMService)context.getBean("AVMService"));
console.setBulkLoader(loader);
@@ -115,6 +125,15 @@ public class AVMInterpreter
{
fSyncService = syncService;
}
/**
* Set the AVM locking service.
* @param lockService
*/
public void setAvmLockingService(AVMLockingService lockService)
{
fLockingService = lockService;
}
/**
* Set the bulk loader.
@@ -409,6 +428,56 @@ public class AVMInterpreter
out.println(p.getKey() + ": " + p.getValue());
}
}
else if (command[0].equals("descnode"))
{
if (command.length != 3)
{
return "Syntax Error.";
}
String path = command[1];
AVMNodeDescriptor nodeDesc = fService.lookup(Integer.parseInt(command[2]), path);
if (nodeDesc == null)
{
return "Path Not Found.";
}
out.println(nodeDesc.toString());
out.println("isDirectory: " + nodeDesc.isDirectory());
out.println("isFile: " + nodeDesc.isFile());
out.println("isPrimary: " + nodeDesc.isPrimary());
out.println("isOpaque: " + nodeDesc.getOpacity());
out.println("creator: " + nodeDesc.getCreator());
out.println("owner: " + nodeDesc.getOwner());
out.println("lastModifier: " + nodeDesc.getLastModifier());
out.println("created: " + new Date(nodeDesc.getCreateDate()));
out.println("modified: " + new Date(nodeDesc.getModDate()));
out.println("lastAccess: " + new Date(nodeDesc.getAccessDate()));
// get lock information
String lockPath = path.substring(path.indexOf("/"));
String store = path.substring(0, path.indexOf(":"));
String mainStore = store;
if (store.indexOf("--") != -1)
{
mainStore = store.substring(0, store.indexOf("--"));
}
AVMLock lock = fLockingService.getLock(mainStore, lockPath);
out.print("lock: ");
if (lock != null)
{
out.print("store = ");
out.print(lock.getStore());
out.print(", owners = ");
out.println(lock.getOwners());
}
else
{
out.println("No locks found");
}
}
else if (command[0].equals("deletenodeproperty"))
{
if (command.length != 3)

View File

@@ -1534,6 +1534,10 @@ public class AVMRepository
{
throw new AVMNotFoundException("Could not find node: " + desc);
}
if (fgLogger.isDebugEnabled())
{
fgLogger.debug("Getting A Path for: " + desc);
}
List<String> components = new ArrayList<String>();
return recursiveGetAPath(node, components);
}
@@ -1700,11 +1704,19 @@ public class AVMRepository
AVMStore store = fAVMStoreDAO.getByRoot(node);
if (store != null)
{
if (fgLogger.isDebugEnabled())
{
fgLogger.debug("Found path in HEAD of: " + store.getName());
}
return new Pair<Integer, String>(-1, makePath(components, store.getName()));
}
VersionRoot vr = fVersionRootDAO.getByRoot(node);
if (vr != null)
{
if (fgLogger.isDebugEnabled())
{
fgLogger.debug("Found path in version " + vr.getVersionID() + " in: " + vr.getAvmStore().getName());
}
return new Pair<Integer, String>(vr.getVersionID(), makePath(components, vr.getAvmStore().getName()));
}
return null;
@@ -1713,8 +1725,12 @@ public class AVMRepository
for (ChildEntry entry : entries)
{
String name = entry.getKey().getName();
if (fgLogger.isDebugEnabled())
{
fgLogger.debug("Found component: " + name);
}
components.add(name);
Pair<Integer, String> path = recursiveGetAPath(entry.getKey().getParent(), components);
Pair<Integer, String> path = recursiveGetAPath(AVMNodeUnwrapper.Unwrap(entry.getKey().getParent()), components);
if (path != null)
{
return path;

View File

@@ -26,13 +26,16 @@ package org.alfresco.repo.avm;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import org.alfresco.repo.remote.ClientTicketHolder;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
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.security.AuthenticationService;
import org.alfresco.util.Pair;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import junit.framework.TestCase;
@@ -47,22 +50,22 @@ public class AVMTestRemote extends TestCase
* The AVMRemote.
*/
private AVMRemote fAVMRemote;
/**
* The Sync service.
*/
private AVMSyncService fAVMSync;
/**
* The Authentication Service.
*/
private AuthenticationService fAuthService;
/**
* The application context.
*/
private FileSystemXmlApplicationContext fContext;
@Override
protected void setUp() throws Exception
{
@@ -85,7 +88,19 @@ public class AVMTestRemote extends TestCase
}
fContext.close();
}
public void testGetAPath()
throws Exception
{
fAVMRemote.createStore("test2932");
fAVMRemote.createDirectory("test2932:/", "a");
fAVMRemote.createFile("test2932:/a", "foo.txt").close();
AVMNodeDescriptor found = fAVMRemote.lookup(-1, "test2932:/a/foo.txt");
Pair<Integer, String> path = fAVMRemote.getAPath(found);
assertEquals(path.getSecond(), "test2932:/a/foo.txt");
explorePaths("foo--admin:/");
}
/**
* Do a simple hello world test.
*/
@@ -105,7 +120,23 @@ public class AVMTestRemote extends TestCase
fail();
}
}
public void explorePaths(String path)
throws Exception
{
Map<String, AVMNodeDescriptor> listing = fAVMRemote.getDirectoryListing(-1, path);
for (Map.Entry<String, AVMNodeDescriptor> entry : listing.entrySet())
{
Pair<Integer, String> childPath = fAVMRemote.getAPath(entry.getValue());
System.out.println(childPath);
if (entry.getValue().isDirectory())
{
explorePaths(entry.getValue().getPath());
}
}
}
/**
* Test reading and writing.
*/
@@ -118,7 +149,7 @@ public class AVMTestRemote extends TestCase
// Create a directory.
fAVMRemote.createDirectory("test2933:/", "a");
// Write out a file.
OutputStream out =
OutputStream out =
fAVMRemote.createFile("test2933:/a", "foo.txt");
byte [] buff = "This is a plain old text file.\n".getBytes();
out.write(buff);
@@ -126,7 +157,7 @@ public class AVMTestRemote extends TestCase
out.write(buff);
out.close();
// Read back that file.
InputStream in =
InputStream in =
fAVMRemote.getFileInputStream(-1, "test2933:/a/foo.txt");
buff = new byte[1024];
assertEquals(49, in.read(buff));
@@ -171,7 +202,7 @@ public class AVMTestRemote extends TestCase
fail();
}
}
/**
* Test a call that should return null;
*/
@@ -187,7 +218,7 @@ public class AVMTestRemote extends TestCase
fail();
}
}
/**
* Test the sync service.
*/

View File

@@ -94,7 +94,7 @@
it points at (true) or inheriting what it points at from its
container (false). -->
<property name="primaryIndirection"
column="primary_indirection" type="boolean"/>
column="primary_indirection" type="boolean" index="idx_avm_lyr_indn" />
<property name="opacity" column="opacity" type="boolean"/>
<!-- Map of names to DirectoryEntries. -->
</subclass>