Merged V2.1 to HEAD

6418: Allow getLayeringInfo on deleted nodes.
   6419: fixes for submitting of deleted directories and regenerate renditions related fixes.
   6420: Added installs to build
   6421: Build fix for sdk
   6423: WCM-710 - Submit All feature reintroducted to WCM My Modified Files views
   6424: OpenOffice connection is now tested on bootstrap.
   6425: AWC-1446 - Space Selector would show spaces you do not have access to
   6426: WCM-699 - Staging area user assets
   6427: Rollback exceptions now explicitly handled by RetryingTransactionHelper to extract the cause of the exception.
   6428: Fix for AWC-1340
   6429: Fixed transaction boundaries for full index recovery components
   6433: AR-1660 - SMB and SMB2 signature check 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6732 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 21:50:49 +00:00
parent 10b7df662f
commit 4711101687
12 changed files with 138 additions and 27 deletions

View File

@@ -409,6 +409,15 @@
<!-- Startup Message --> <!-- Startup Message -->
<bean id="openOfficeConnectionTester" class="org.alfresco.util.OpenOfficeConnectionTester" >
<property name="connection">
<ref bean="openOfficeConnection" />
</property>
<property name="strict">
<value>false</value>
</property>
</bean>
<bean id="startupLog" class="org.alfresco.repo.descriptor.DescriptorStartupLog"> <bean id="startupLog" class="org.alfresco.repo.descriptor.DescriptorStartupLog">
<property name="descriptorService"> <property name="descriptorService">
<ref local="descriptorComponent"/> <ref local="descriptorComponent"/>

View File

@@ -121,14 +121,6 @@
</bean> </bean>
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" /> <bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
<bean id="openOfficeConnectionTester" class="org.alfresco.util.OpenOfficeConnectionTester" init-method="checkConnection" >
<property name="connection">
<ref bean="openOfficeConnection" />
</property>
<property name="strict">
<value>false</value>
</property>
</bean>
<!-- Metadata Extraction Regisitry --> <!-- Metadata Extraction Regisitry -->
<bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" /> <bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" />

View File

@@ -1365,9 +1365,6 @@
</property> </property>
</bean> </bean>
<!-- LinkValidationService --> <!-- LinkValidationService -->
<!-- Read transaction advisor for link validation service. --> <!-- Read transaction advisor for link validation service. -->
<bean id="linkValidationServiceReadTxnAdvisor" <bean id="linkValidationServiceReadTxnAdvisor"

View File

@@ -266,6 +266,25 @@ public class SMBSrvPacket
return false; return false;
} }
/**
* Check if the SMB packet has an SMB2 signature.
*
* @return boolean True if the packet has an SMB2 signature, else false.
*/
public final boolean isSMB2()
{
// Check for the SMB2 signature block
if (m_smbbuf[SIGNATURE] == (byte) 0xFE && m_smbbuf[SIGNATURE + 1] == 'S' && m_smbbuf[SIGNATURE + 2] == 'M'
&& m_smbbuf[SIGNATURE + 3] == 'B')
return true;
// Not an SMB2 packet
return false;
}
/** /**
* Clear the data byte count * Clear the data byte count
*/ */

View File

@@ -1321,6 +1321,35 @@ public class SMBSrvSession extends SrvSession implements Runnable
continue; continue;
} }
// Check the packet signature if we are in an SMB state
if ( m_state > SMBSrvSessionState.NBSESSREQ)
{
// Check for an SMB2 packet signature
if ( m_smbPkt.isSMB2())
{
// Debug
if ( logger.isDebugEnabled() && hasDebug(DBG_PKTTYPE))
logger.debug("SMB2 request received, ignoring");
continue;
}
// Check the packet signature
if ( m_smbPkt.checkPacketSignature() == false)
{
// Debug
if ( logger.isDebugEnabled() && hasDebug(DBG_PKTTYPE))
logger.debug("Invalid SMB packet signature received, packet ignored");
continue;
}
}
// Store the received data length // Store the received data length
m_smbPkt.setReceivedLength(m_rxlen); m_smbPkt.setReceivedLength(m_rxlen);

View File

@@ -1616,7 +1616,7 @@ public class AVMRepository
{ {
throw new AVMNotFoundException("Store not found."); throw new AVMNotFoundException("Store not found.");
} }
Lookup lookup = store.lookup(version, pathParts[1], false, false); Lookup lookup = store.lookup(version, pathParts[1], false, true);
if (lookup == null) if (lookup == null)
{ {
throw new AVMNotFoundException("Path not found."); throw new AVMNotFoundException("Path not found.");

View File

@@ -101,6 +101,34 @@ import org.alfresco.util.Pair;
*/ */
public class AVMServiceTest extends AVMServiceTestBase public class AVMServiceTest extends AVMServiceTestBase
{ {
public void testHeadPathsInLayers()
{
try
{
setupBasicTree();
fService.createStore("user");
fService.createLayeredDirectory("main:/a", "user:/", "a");
fService.createStore("sandbox");
fService.createLayeredDirectory("main:/a", "sandbox:/", "a");
fService.createDirectory("user:/a/b", "newdir");
fService.createFile("user:/a/b/newdir", "bibble.txt").close();
List<AVMDifference> diffs = fSyncService.compare(-1, "user:/a", -1, "sandbox:/a", null);
System.out.println(diffs);
fSyncService.update(diffs, null, false, false, false, false, null, null);
AVMNodeDescriptor dir = fService.lookup(-1, "user:/a/b/newdir");
List<Pair<Integer, String>> paths = fService.getHeadPaths(dir);
System.out.println(paths);
AVMNodeDescriptor file = fService.lookup(-1, "user:/a/b/newdir/bibble.txt");
paths = fService.getHeadPaths(file);
System.out.println(paths);
}
catch (Exception e)
{
e.printStackTrace();
fail();
}
}
/** /**
* Minimal testing of Locking Aware service. * Minimal testing of Locking Aware service.
*/ */

View File

@@ -154,16 +154,27 @@ public class AVMSubmitPackageHandler
private void recursivelyRemoveLocks(final String webProject, final int version, final String path) private void recursivelyRemoveLocks(final String webProject, final int version, final String path)
{ {
LOGGER.debug("removing lock on " + path); LOGGER.debug("removing lock on " + path);
final AVMNodeDescriptor desc = fAVMService.lookup(version, path, true); AVMNodeDescriptor desc = fAVMService.lookup(version, path, true);
if (desc.isFile() || desc.isDeletedFile()) if (desc.isFile() || desc.isDeletedFile())
{ {
fAVMLockingService.removeLock(webProject, path.substring(path.indexOf(":") + 1)); fAVMLockingService.removeLock(webProject, path.substring(path.indexOf(":") + 1));
} }
else else
{ {
for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(version, path, true)) if (desc.isDeletedDirectory())
{ {
this.recursivelyRemoveLocks(webProject, version, child.getPath()); // lookup the previous child and get its contents
final List<AVMNodeDescriptor> history = fAVMService.getHistory(desc, 2);
if (history.size() == 1)
{
return;
}
desc = history.get(1);
}
for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(desc.getVersionID(), desc.getPath(), true))
{
this.recursivelyRemoveLocks(webProject, child.getVersionID(), child.getPath());
} }
} }
} }

View File

@@ -210,7 +210,7 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
return null; return null;
} }
}; };
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true); transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true, true);
// done // done
} }

View File

@@ -277,7 +277,7 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
return null; return null;
} }
}; };
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true); transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true, true);
// done // done
} }
} }

View File

@@ -27,6 +27,7 @@ package org.alfresco.repo.transaction;
import java.sql.BatchUpdateException; import java.sql.BatchUpdateException;
import java.util.Random; import java.util.Random;
import javax.transaction.RollbackException;
import javax.transaction.Status; import javax.transaction.Status;
import javax.transaction.SystemException; import javax.transaction.SystemException;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
@@ -297,8 +298,16 @@ public class RetryingTransactionHelper
throw new AlfrescoRuntimeException("Failure during rollback: " + cb, e1); throw new AlfrescoRuntimeException("Failure during rollback: " + cb, e1);
} }
} }
if (e instanceof RollbackException)
{
lastException = (e.getCause() instanceof RuntimeException) ?
(RuntimeException)e.getCause() : new AlfrescoRuntimeException("Exception in Transaction.", e.getCause());
}
else
{
lastException = (e instanceof RuntimeException) ? lastException = (e instanceof RuntimeException) ?
(RuntimeException)e : new AlfrescoRuntimeException("Unknown Exception in Transaction.", e); (RuntimeException)e : new AlfrescoRuntimeException("Exception in Transaction.", e);
}
// Check if there is a cause for retrying // Check if there is a cause for retrying
Throwable retryCause = extractRetryCause(e); Throwable retryCause = extractRetryCause(e);
if (retryCause != null) if (retryCause != null)

View File

@@ -32,15 +32,15 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil; import org.alfresco.i18n.I18NUtil;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationEvent;
/** /**
* Simple class that checks for the presence of a valid <b>OpenOffice</b> * A bootstrap class that checks for the presence of a valid <b>OpenOffice</b> connection, as provided by the
* connection, as provided by the
* <code>net.sf.jooreports.openoffice.connection.OpenOfficeConnection</code> implementations. * <code>net.sf.jooreports.openoffice.connection.OpenOfficeConnection</code> implementations.
* *
* @author Derek Hulley * @author Derek Hulley
*/ */
public class OpenOfficeConnectionTester public class OpenOfficeConnectionTester extends AbstractLifecycleBean
{ {
private static final String INFO_CONNECTION_VERIFIED = "system.openoffice.info.connection_verified"; private static final String INFO_CONNECTION_VERIFIED = "system.openoffice.info.connection_verified";
private static final String ERR_CONNECTION_FAILED = "system.openoffice.err.connection_failed"; private static final String ERR_CONNECTION_FAILED = "system.openoffice.err.connection_failed";
@@ -73,12 +73,29 @@ public class OpenOfficeConnectionTester
this.strict = strict; this.strict = strict;
} }
/**
* @see #checkConnection()
*/
@Override
protected void onBootstrap(ApplicationEvent event)
{
checkConnection();
}
/**
* Does nothing.
*/
@Override
protected void onShutdown(ApplicationEvent event)
{
}
/** /**
* Perform the actual connection check. If this component is {@link #setStrict(boolean) strict}, * Perform the actual connection check. If this component is {@link #setStrict(boolean) strict},
* then a disconnected {@link #setConnection(OpenOfficeConnection) connection} will result in a * then a disconnected {@link #setConnection(OpenOfficeConnection) connection} will result in a
* runtime exception being generated. * runtime exception being generated.
*/ */
public synchronized void checkConnection() private synchronized void checkConnection()
{ {
PropertyCheck.mandatory(this, "connection", connection); PropertyCheck.mandatory(this, "connection", connection);
String connectedMessage = I18NUtil.getMessage(INFO_CONNECTION_VERIFIED); String connectedMessage = I18NUtil.getMessage(INFO_CONNECTION_VERIFIED);