addrEnum = ni.getInetAddresses();
+
+ while ( addrEnum.hasMoreElements() && adapAddr == null) {
+
+ // Get the current address
+
+ InetAddress addr = addrEnum.nextElement();
+ if ( IPAddress.isNumericAddress( addr.getHostAddress()))
+ adapAddr = addr;
+ }
+
+ // Check if we found the IP address to bind to
+
+ if ( adapAddr == null)
+ throw new InvalidConfigurationException( "Adapter " + adapter + " does not have a valid IP address");
+
+ // Return the adapter address
+
+ return adapAddr;
+ }
+
+ private ApplicationContext applicationContext = null;
+
+
+ /* (non-Javadoc)
+ * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
+ */
+ public void onApplicationEvent(ApplicationEvent event)
+ {
+ if (event instanceof ContextRefreshedEvent)
+ {
+ ContextRefreshedEvent refreshEvent = (ContextRefreshedEvent)event;
+ ApplicationContext refreshContext = refreshEvent.getApplicationContext();
+ if (refreshContext != null && refreshContext.equals(applicationContext))
+ {
+ // Initialize the bean
+
+ init();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
+ */
+ public void setApplicationContext(ApplicationContext applicationContext)
+ throws BeansException
+ {
+ this.applicationContext = applicationContext;
+ }
+
+ /**
+ * Return the authentication service
+ *
+ * @return AuthenticationService
+ */
+ protected final AuthenticationService getAuthenticationService()
+ {
+ return m_authenticationService;
+ }
+
+ /**
+ * Return the authentication component
+ *
+ * @return AuthenticationComponent
+ */
+ protected final AuthenticationComponent getAuthenticationComponent()
+ {
+ return m_authenticationComponent;
+ }
+
+ /**
+ * Return the node service
+ *
+ * @return NodeService
+ */
+ protected final NodeService getNodeService()
+ {
+ return m_nodeService;
+ }
+
+ /**
+ * Return the person service
+ *
+ * @return PersonService
+ */
+ protected final PersonService getPersonService()
+ {
+ return m_personService;
+ }
+
+ /**
+ * Return the transaction service
+ *
+ * @return TransactionService
+ */
+ protected final TransactionService getTransactionService()
+ {
+ return m_transactionService;
+ }
+
+ /**
+ * Return the tenant service
+ *
+ * @return TenantService
+ */
+ protected final TenantService getTenantService()
+ {
+ return m_tenantService;
+ }
+
+ /**
+ * Return the search service
+ *
+ * @return SearchService
+ */
+ protected final SearchService getSearchService()
+ {
+ return m_searchService;
+ }
+
+ /**
+ * Return the namespace service
+ *
+ * @return NamespaceService
+ */
+ protected final NamespaceService getNamespaceService()
+ {
+ return m_namespaceService;
+ }
+}
diff --git a/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfo.java b/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfo.java
new file mode 100644
index 0000000000..49ac7ef46d
--- /dev/null
+++ b/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfo.java
@@ -0,0 +1,142 @@
+package org.alfresco.filesys.alfresco;
+
+import net.sf.acegisecurity.Authentication;
+
+import org.alfresco.jlan.server.auth.ClientInfo;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/*
+ * AlfrescoClientInfo.java
+ *
+ * Copyright (c) 2007 Starlasoft. All rights reserved.
+ */
+
+/**
+ * Alfresco Client Information Class
+ *
+ * Contains additional fields used by the Alfresco filesystem drivers.
+ */
+public class AlfrescoClientInfo extends ClientInfo {
+
+ // Authentication token
+
+ private Authentication m_authToken;
+
+ // Authentication ticket, used for web access without having to re-authenticate
+
+ private String m_authTicket;
+
+ // Home folder node
+
+ private NodeRef m_homeNode;
+
+ /**
+ * Default constructor
+ */
+ public AlfrescoClientInfo()
+ {
+ super("", null);
+ }
+
+ /**
+ * Class constructor
+ *
+ * @param user User name
+ * @param pwd Password
+ */
+ public AlfrescoClientInfo(String user, byte[] pwd)
+ {
+ super(user, pwd);
+ }
+
+ /**
+ * Check if the client has an authentication token
+ *
+ * @return boolean
+ */
+ public final boolean hasAuthenticationToken()
+ {
+ return m_authToken != null ? true : false;
+ }
+
+ /**
+ * Return the authentication token
+ *
+ * @return Authentication
+ */
+ public final Authentication getAuthenticationToken()
+ {
+ return m_authToken;
+ }
+
+ /**
+ * Check if the client has an authentication ticket
+ *
+ * @return boolean
+ */
+ public final boolean hasAuthenticationTicket()
+ {
+ return m_authTicket != null ? true : false;
+ }
+
+ /**
+ * Return the authentication ticket
+ *
+ * @return String
+ */
+ public final String getAuthenticationTicket()
+ {
+ return m_authTicket;
+ }
+
+ /**
+ * Check if the client has a home folder node
+ *
+ * @return boolean
+ */
+ public final boolean hasHomeFolder()
+ {
+ return m_homeNode != null ? true : false;
+ }
+
+ /**
+ * Return the home folder node
+ *
+ * @return NodeRef
+ */
+ public final NodeRef getHomeFolder()
+ {
+ return m_homeNode;
+ }
+
+ /**
+ * Set the authentication toekn
+ *
+ * @param token Authentication
+ */
+ public final void setAuthenticationToken(Authentication token)
+ {
+ m_authToken = token;
+ }
+
+ /**
+ * Set the authentication ticket
+ *
+ * @param ticket String
+ */
+ public final void setAuthenticationTicket(String ticket)
+ {
+ m_authTicket = ticket;
+ }
+
+ /**
+ * Set the home folder node
+ *
+ * @param homeNode NodeRef
+ */
+ public final void setHomeFolder(NodeRef homeNode)
+ {
+ m_homeNode = homeNode;
+ }
+
+}
diff --git a/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfoFactory.java b/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfoFactory.java
new file mode 100644
index 0000000000..99d151c047
--- /dev/null
+++ b/source/java/org/alfresco/filesys/alfresco/AlfrescoClientInfoFactory.java
@@ -0,0 +1,40 @@
+package org.alfresco.filesys.alfresco;
+
+import org.alfresco.jlan.server.auth.ClientInfo;
+import org.alfresco.jlan.server.auth.ClientInfoFactory;
+
+/*
+ * AlfrescoClientInfoFactory.java
+ *
+ * Copyright (c) 2007 Starlasoft. All rights reserved.
+ */
+
+/**
+ * Alfresco Client Info Factory Class
+ */
+public class AlfrescoClientInfoFactory implements ClientInfoFactory {
+
+ /**
+ * Class constructor
+ */
+ public AlfrescoClientInfoFactory() {
+
+ // Plug the client info factory in
+
+ ClientInfo.setFactory( this);
+ }
+
+ /**
+ * Create the extended client information object
+ *
+ * @param user String
+ * @param password byte[]
+ * @return ClientInfo
+ */
+ public ClientInfo createInfo(String user, byte[] password) {
+
+ // Return an Alfresco extended client information object
+
+ return new AlfrescoClientInfo( user, password);
+ }
+}
diff --git a/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java b/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
index e13f454004..ce894910e6 100644
--- a/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
+++ b/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
@@ -26,11 +26,14 @@ package org.alfresco.filesys.alfresco;
import java.util.Enumeration;
-import org.alfresco.filesys.server.filesys.*;
-import org.alfresco.filesys.server.pseudo.PseudoFileImpl;
-import org.alfresco.filesys.server.pseudo.PseudoFileInterface;
-import org.alfresco.filesys.server.state.FileStateReaper;
-import org.alfresco.filesys.server.state.FileStateTable;
+import org.alfresco.jlan.server.filesys.DiskDeviceContext;
+import org.alfresco.jlan.server.filesys.DiskInterface;
+import org.alfresco.jlan.server.filesys.FileSystem;
+import org.alfresco.jlan.server.filesys.SrvDiskInfo;
+import org.alfresco.jlan.server.filesys.pseudo.PseudoFileInterface;
+import org.alfresco.filesys.state.FileStateReaper;
+import org.alfresco.filesys.state.FileStateTable;
+
/**
* Alfresco Filesystem Context Class
@@ -125,7 +128,7 @@ public abstract class AlfrescoContext extends DiskDeviceContext
{
// Remove the state table from the reaper
- stateReaper.removeStateTable( getFilesystemName());
+ stateReaper.removeStateTable( getShareName());
m_stateTable = null;
}
else if ( m_stateTable == null)
@@ -136,7 +139,7 @@ public abstract class AlfrescoContext extends DiskDeviceContext
// Register with the file state reaper
- stateReaper.addStateTable( getFilesystemName(), m_stateTable);
+ stateReaper.addStateTable( getShareName(), m_stateTable);
}
// Save the reaper, for deregistering when the filesystem is closed
diff --git a/source/java/org/alfresco/filesys/alfresco/AlfrescoDiskDriver.java b/source/java/org/alfresco/filesys/alfresco/AlfrescoDiskDriver.java
index 8c6efb2160..cf046dae31 100644
--- a/source/java/org/alfresco/filesys/alfresco/AlfrescoDiskDriver.java
+++ b/source/java/org/alfresco/filesys/alfresco/AlfrescoDiskDriver.java
@@ -23,16 +23,24 @@
package org.alfresco.filesys.alfresco;
-import org.alfresco.filesys.server.SrvSession;
-import org.alfresco.filesys.server.filesys.IOControlNotImplementedException;
-import org.alfresco.filesys.server.filesys.IOCtlInterface;
-import org.alfresco.filesys.server.filesys.NetworkFile;
-import org.alfresco.filesys.server.filesys.TreeConnection;
-import org.alfresco.filesys.server.state.FileStateReaper;
-import org.alfresco.filesys.smb.SMBException;
-import org.alfresco.filesys.smb.SMBStatus;
-import org.alfresco.filesys.util.DataBuffer;
+import javax.transaction.Status;
+import javax.transaction.UserTransaction;
+
+import org.alfresco.jlan.server.SrvSession;
+import org.alfresco.jlan.server.filesys.IOControlNotImplementedException;
+import org.alfresco.jlan.server.filesys.IOCtlInterface;
+import org.alfresco.jlan.server.filesys.NetworkFile;
+import org.alfresco.jlan.server.filesys.TransactionalFilesystemInterface;
+import org.alfresco.jlan.server.filesys.TreeConnection;
+import org.alfresco.jlan.smb.SMBException;
+import org.alfresco.jlan.smb.SMBStatus;
+import org.alfresco.jlan.util.DataBuffer;
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.filesys.state.FileStateReaper;
import org.alfresco.service.ServiceRegistry;
+import org.alfresco.service.transaction.TransactionService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Alfresco Disk Driver Base Class
@@ -41,16 +49,24 @@ import org.alfresco.service.ServiceRegistry;
*
* @author gkspencer
*/
-public class AlfrescoDiskDriver implements IOCtlInterface {
+public class AlfrescoDiskDriver implements IOCtlInterface, TransactionalFilesystemInterface {
+ // Logging
+
+ private static final Log logger = LogFactory.getLog(AlfrescoDiskDriver.class);
+
// Service registry for desktop actions
- private ServiceRegistry serviceRegistry;
+ private ServiceRegistry m_serviceRegistry;
// File state reaper
private FileStateReaper m_stateReaper;
-
+
+ // Transaction service
+
+ private TransactionService m_transactionService;
+
/**
* Return the service registry
*
@@ -58,7 +74,7 @@ public class AlfrescoDiskDriver implements IOCtlInterface {
*/
public final ServiceRegistry getServiceRegistry()
{
- return this.serviceRegistry;
+ return m_serviceRegistry;
}
/**
@@ -71,6 +87,16 @@ public class AlfrescoDiskDriver implements IOCtlInterface {
return m_stateReaper;
}
+ /**
+ * Return the transaction service
+ *
+ * @return TransactionService
+ */
+ public final TransactionService getTransactionService()
+ {
+ return m_transactionService;
+ }
+
/**
* Set the service registry
*
@@ -78,7 +104,7 @@ public class AlfrescoDiskDriver implements IOCtlInterface {
*/
public void setServiceRegistry(ServiceRegistry serviceRegistry)
{
- this.serviceRegistry = serviceRegistry;
+ m_serviceRegistry = serviceRegistry;
}
/**
@@ -91,6 +117,14 @@ public class AlfrescoDiskDriver implements IOCtlInterface {
m_stateReaper = stateReaper;
}
+ /**
+ * @param transactionService the transaction service
+ */
+ public void setTransactionService(TransactionService transactionService)
+ {
+ m_transactionService = transactionService;
+ }
+
/**
* Process a filesystem I/O control request
*
@@ -123,4 +157,191 @@ public class AlfrescoDiskDriver implements IOCtlInterface {
else
throw new IOControlNotImplementedException();
}
+
+ /**
+ * Begin a read-only transaction
+ *
+ * @param sess SrvSession
+ */
+ public void beginReadTransaction(SrvSession sess) {
+ beginTransaction( sess, true);
+ }
+
+ /**
+ * Begin a writeable transaction
+ *
+ * @param sess SrvSession
+ */
+ public void beginWriteTransaction(SrvSession sess) {
+ beginTransaction( sess, false);
+ }
+
+ /**
+ * End an active transaction
+ *
+ * @param sess SrvSession
+ * @param tx ThreadLocal