mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Refactoring of the pseudo file/desktop action code to allow use by AVM and repo filesystem drivers.
Added virtualization view to the AVM filesystem driver that shows all stores and versions using a single shared filesystem. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4443 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
351
source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
Normal file
351
source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alfresco Filesystem Context Class
|
||||||
|
*
|
||||||
|
* <p>Contains per filesystem context.
|
||||||
|
*
|
||||||
|
* @author GKSpencer
|
||||||
|
*/
|
||||||
|
public abstract class AlfrescoContext extends DiskDeviceContext
|
||||||
|
{
|
||||||
|
// File state table and associated file state reaper
|
||||||
|
|
||||||
|
private FileStateTable m_stateTable;
|
||||||
|
private FileStateReaper m_stateReaper;
|
||||||
|
|
||||||
|
// URL pseudo file web path prefix (server/port/webapp) and link file name
|
||||||
|
|
||||||
|
private String m_urlPathPrefix;
|
||||||
|
private String m_urlFileName;
|
||||||
|
|
||||||
|
// Pseudo file interface
|
||||||
|
|
||||||
|
private PseudoFileInterface m_pseudoFileInterface;
|
||||||
|
|
||||||
|
// Desktop actions
|
||||||
|
|
||||||
|
private DesktopActionTable m_desktopActions;
|
||||||
|
|
||||||
|
// I/O control handler
|
||||||
|
|
||||||
|
private IOControlHandler m_ioHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param filesysName String
|
||||||
|
* @param devName String
|
||||||
|
*/
|
||||||
|
public AlfrescoContext(String filesysName, String devName)
|
||||||
|
{
|
||||||
|
super(filesysName, devName);
|
||||||
|
|
||||||
|
// Default the filesystem to look like an 80Gb sized disk with 90% free space
|
||||||
|
|
||||||
|
setDiskInformation(new SrvDiskInfo(2560000, 64, 512, 2304000));
|
||||||
|
|
||||||
|
// Set parameters
|
||||||
|
|
||||||
|
setFilesystemAttributes(FileSystem.CasePreservedNames + FileSystem.UnicodeOnDisk +
|
||||||
|
FileSystem.CaseSensitiveSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the filesystem type, either FileSystem.TypeFAT or FileSystem.TypeNTFS.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String getFilesystemType()
|
||||||
|
{
|
||||||
|
return FileSystem.TypeNTFS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the file state table is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasStateTable()
|
||||||
|
{
|
||||||
|
return m_stateTable != null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file state table
|
||||||
|
*
|
||||||
|
* @return FileStateTable
|
||||||
|
*/
|
||||||
|
public final FileStateTable getStateTable()
|
||||||
|
{
|
||||||
|
return m_stateTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the file state table
|
||||||
|
*
|
||||||
|
* @param ena boolean
|
||||||
|
* @param stateReaper FileStateReaper
|
||||||
|
*/
|
||||||
|
public final void enableStateTable(boolean ena, FileStateReaper stateReaper)
|
||||||
|
{
|
||||||
|
if ( ena == false)
|
||||||
|
{
|
||||||
|
// Remove the state table from the reaper
|
||||||
|
|
||||||
|
stateReaper.removeStateTable( getFilesystemName());
|
||||||
|
m_stateTable = null;
|
||||||
|
}
|
||||||
|
else if ( m_stateTable == null)
|
||||||
|
{
|
||||||
|
// Create the file state table
|
||||||
|
|
||||||
|
m_stateTable = new FileStateTable();
|
||||||
|
|
||||||
|
// Register with the file state reaper
|
||||||
|
|
||||||
|
stateReaper.addStateTable( getFilesystemName(), m_stateTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the reaper, for deregistering when the filesystem is closed
|
||||||
|
|
||||||
|
m_stateReaper = stateReaper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the pseudo file interface is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasPseudoFileInterface()
|
||||||
|
{
|
||||||
|
return m_pseudoFileInterface != null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the pseudo file interface
|
||||||
|
*
|
||||||
|
* @return PseudoFileInterface
|
||||||
|
*/
|
||||||
|
public final PseudoFileInterface getPseudoFileInterface()
|
||||||
|
{
|
||||||
|
return m_pseudoFileInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the pseudo file interface for this filesystem
|
||||||
|
*/
|
||||||
|
public final void enabledPseudoFileInterface()
|
||||||
|
{
|
||||||
|
if ( m_pseudoFileInterface == null)
|
||||||
|
m_pseudoFileInterface = new PseudoFileImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if there are desktop actins configured
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasDesktopActions()
|
||||||
|
{
|
||||||
|
return m_desktopActions != null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the desktop actions table
|
||||||
|
*
|
||||||
|
* @return DesktopActionTable
|
||||||
|
*/
|
||||||
|
public final DesktopActionTable getDesktopActions()
|
||||||
|
{
|
||||||
|
return m_desktopActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the count of desktop actions
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public final int numberOfDesktopActions()
|
||||||
|
{
|
||||||
|
return m_desktopActions != null ? m_desktopActions.numberOfActions() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a desktop action
|
||||||
|
*
|
||||||
|
* @param action DesktopAction
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean addDesktopAction(DesktopAction action)
|
||||||
|
{
|
||||||
|
// Check if the desktop actions table has been created
|
||||||
|
|
||||||
|
if ( m_desktopActions == null)
|
||||||
|
{
|
||||||
|
m_desktopActions = new DesktopActionTable();
|
||||||
|
|
||||||
|
// Enable pseudo files
|
||||||
|
|
||||||
|
enabledPseudoFileInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the action
|
||||||
|
|
||||||
|
return m_desktopActions.addAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if custom I/O control handling is enabled for this filesystem
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasIOHandler()
|
||||||
|
{
|
||||||
|
return m_ioHandler != null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the custom I/O control handler
|
||||||
|
*
|
||||||
|
* @return IOControlHandler
|
||||||
|
*/
|
||||||
|
public final IOControlHandler getIOHandler()
|
||||||
|
{
|
||||||
|
return m_ioHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the URL pseudo file is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasURLFile()
|
||||||
|
{
|
||||||
|
if ( m_urlPathPrefix != null && m_urlFileName != null)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the URL pseudo file path prefix
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public final String getURLPrefix()
|
||||||
|
{
|
||||||
|
return m_urlPathPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the URL pseudo file name
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public final String getURLFileName()
|
||||||
|
{
|
||||||
|
return m_urlFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the URL path prefix
|
||||||
|
*
|
||||||
|
* @param urlPrefix String
|
||||||
|
*/
|
||||||
|
public final void setURLPrefix(String urlPrefix)
|
||||||
|
{
|
||||||
|
m_urlPathPrefix = urlPrefix;
|
||||||
|
|
||||||
|
if ( urlPrefix != null)
|
||||||
|
enabledPseudoFileInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the URL pseudo file name
|
||||||
|
*
|
||||||
|
* @param urlFileName String
|
||||||
|
*/
|
||||||
|
public final void setURLFileName(String urlFileName)
|
||||||
|
{
|
||||||
|
m_urlFileName = urlFileName;
|
||||||
|
|
||||||
|
if ( urlFileName != null)
|
||||||
|
enabledPseudoFileInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the desktop actions
|
||||||
|
*
|
||||||
|
* @param desktopActions DesktopActionTable
|
||||||
|
* @param filesysDriver DiskInterface
|
||||||
|
*/
|
||||||
|
public final void setDesktopActions(DesktopActionTable desktopActions, DiskInterface filesysDriver)
|
||||||
|
{
|
||||||
|
// Enumerate the desktop actions and add to this filesystem
|
||||||
|
|
||||||
|
Enumeration<String> names = desktopActions.enumerateActionNames();
|
||||||
|
|
||||||
|
while ( names.hasMoreElements())
|
||||||
|
{
|
||||||
|
addDesktopAction( desktopActions.getAction(names.nextElement()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are desktop actions then create the custom I/O control handler
|
||||||
|
|
||||||
|
if ( numberOfDesktopActions() > 0)
|
||||||
|
{
|
||||||
|
// Create the custom I/O control handler
|
||||||
|
|
||||||
|
m_ioHandler = createIOHandler( filesysDriver);
|
||||||
|
if ( m_ioHandler != null)
|
||||||
|
m_ioHandler.initialize(( AlfrescoDiskDriver) filesysDriver, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the I/O control handler for this filesystem type
|
||||||
|
*
|
||||||
|
* @param filesysDriver DiskInterface
|
||||||
|
* @return IOControlHandler
|
||||||
|
*/
|
||||||
|
protected abstract IOControlHandler createIOHandler( DiskInterface filesysDriver);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the filesystem context
|
||||||
|
*/
|
||||||
|
public void CloseContext() {
|
||||||
|
|
||||||
|
// Deregister the file state table from the reaper
|
||||||
|
|
||||||
|
if ( m_stateTable != null)
|
||||||
|
enableStateTable( false, m_stateReaper);
|
||||||
|
|
||||||
|
// Call the base class
|
||||||
|
|
||||||
|
super.CloseContext();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 org.alfresco.service.ServiceRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alfresco Disk Driver Base Class
|
||||||
|
*
|
||||||
|
* <p>Provides common code to the Alfresco filesystem implementations.
|
||||||
|
*
|
||||||
|
* @author gkspencer
|
||||||
|
*/
|
||||||
|
public class AlfrescoDiskDriver implements IOCtlInterface {
|
||||||
|
|
||||||
|
// Service registry for desktop actions
|
||||||
|
|
||||||
|
private ServiceRegistry serviceRegistry;
|
||||||
|
|
||||||
|
// File state reaper
|
||||||
|
|
||||||
|
private FileStateReaper m_stateReaper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the service registry
|
||||||
|
*
|
||||||
|
* @return ServiceRegistry
|
||||||
|
*/
|
||||||
|
public final ServiceRegistry getServiceRegistry()
|
||||||
|
{
|
||||||
|
return this.serviceRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file state reaper
|
||||||
|
*
|
||||||
|
* @return FileStateReaper
|
||||||
|
*/
|
||||||
|
public final FileStateReaper getStateReaper()
|
||||||
|
{
|
||||||
|
return m_stateReaper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the service registry
|
||||||
|
*
|
||||||
|
* @param serviceRegistry
|
||||||
|
*/
|
||||||
|
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||||
|
{
|
||||||
|
this.serviceRegistry = serviceRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the file state reaper
|
||||||
|
*
|
||||||
|
* @param stateReaper FileStateReaper
|
||||||
|
*/
|
||||||
|
public final void setStateReaper(FileStateReaper stateReaper)
|
||||||
|
{
|
||||||
|
m_stateReaper = stateReaper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process a filesystem I/O control request
|
||||||
|
*
|
||||||
|
* @param sess Server session
|
||||||
|
* @param tree Tree connection.
|
||||||
|
* @param ctrlCode I/O control code
|
||||||
|
* @param fid File id
|
||||||
|
* @param dataBuf I/O control specific input data
|
||||||
|
* @param isFSCtrl true if this is a filesystem control, or false for a device control
|
||||||
|
* @param filter if bit0 is set indicates that the control applies to the share root handle
|
||||||
|
* @return DataBuffer
|
||||||
|
* @exception IOControlNotImplementedException
|
||||||
|
* @exception SMBException
|
||||||
|
*/
|
||||||
|
public DataBuffer processIOControl(SrvSession sess, TreeConnection tree, int ctrlCode, int fid, DataBuffer dataBuf,
|
||||||
|
boolean isFSCtrl, int filter)
|
||||||
|
throws IOControlNotImplementedException, SMBException
|
||||||
|
{
|
||||||
|
// Validate the file id
|
||||||
|
|
||||||
|
NetworkFile netFile = tree.findFile(fid);
|
||||||
|
if ( netFile == null || netFile.isDirectory() == false)
|
||||||
|
throw new SMBException(SMBStatus.NTErr, SMBStatus.NTInvalidParameter);
|
||||||
|
|
||||||
|
// Check if the I/O control handler is enabled
|
||||||
|
|
||||||
|
AlfrescoContext ctx = (AlfrescoContext) tree.getContext();
|
||||||
|
if ( ctx.hasIOHandler())
|
||||||
|
return ctx.getIOHandler().processIOControl( sess, tree, ctrlCode, fid, dataBuf, isFSCtrl, filter);
|
||||||
|
else
|
||||||
|
throw new IOControlNotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@@ -24,16 +24,10 @@ import java.net.URL;
|
|||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
|
||||||
import org.alfresco.config.ConfigElement;
|
import org.alfresco.config.ConfigElement;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
|
||||||
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.LocalPseudoFile;
|
import org.alfresco.filesys.server.pseudo.LocalPseudoFile;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -112,8 +106,8 @@ public abstract class DesktopAction {
|
|||||||
|
|
||||||
// Filesystem driver and context
|
// Filesystem driver and context
|
||||||
|
|
||||||
private ContentDiskDriver m_contentDriver;
|
private AlfrescoDiskDriver m_filesysDriver;
|
||||||
private ContentContext m_contentContext;
|
private AlfrescoContext m_filesysContext;
|
||||||
|
|
||||||
// Webapp URL
|
// Webapp URL
|
||||||
|
|
||||||
@@ -225,23 +219,23 @@ public abstract class DesktopAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the content filesystem driver
|
* Return the filesystem driver
|
||||||
*
|
*
|
||||||
* @return ContentDiskDriver
|
* @return AlfrescoDiskDriver
|
||||||
*/
|
*/
|
||||||
public final ContentDiskDriver getDriver()
|
public final AlfrescoDiskDriver getDriver()
|
||||||
{
|
{
|
||||||
return m_contentDriver;
|
return m_filesysDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the filesystem context
|
* Return the filesystem context
|
||||||
*
|
*
|
||||||
* @return ContentContext
|
* @return AlfrescoContext
|
||||||
*/
|
*/
|
||||||
public final ContentContext getContext()
|
public final AlfrescoContext getContext()
|
||||||
{
|
{
|
||||||
return m_contentContext;
|
return m_filesysContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,6 +248,16 @@ public abstract class DesktopAction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the service registry
|
||||||
|
*
|
||||||
|
* @return ServiceRegistry
|
||||||
|
*/
|
||||||
|
public final ServiceRegistry getServiceRegistry()
|
||||||
|
{
|
||||||
|
return m_filesysDriver.getServiceRegistry();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if debug output is enabled
|
* Check if debug output is enabled
|
||||||
*
|
*
|
||||||
@@ -313,13 +317,13 @@ public abstract class DesktopAction {
|
|||||||
{
|
{
|
||||||
// Save the filesystem device and I/O handler
|
// Save the filesystem device and I/O handler
|
||||||
|
|
||||||
if ( fileSys.getDiskInterface() instanceof ContentDiskDriver)
|
if ( fileSys.getContext() instanceof AlfrescoContext)
|
||||||
{
|
{
|
||||||
m_contentDriver = (ContentDiskDriver) fileSys.getDiskInterface();
|
m_filesysDriver = (AlfrescoDiskDriver) fileSys.getDiskInterface();
|
||||||
m_contentContext = (ContentContext) fileSys.getDiskContext();
|
m_filesysContext = (AlfrescoContext) fileSys.getDiskContext();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new DesktopActionException("Desktop action requires content filesystem driver");
|
throw new DesktopActionException("Desktop action requires an Alfresco filesystem driver");
|
||||||
|
|
||||||
// Check for standard config values
|
// Check for standard config values
|
||||||
|
|
||||||
@@ -463,77 +467,6 @@ public abstract class DesktopAction {
|
|||||||
public abstract DesktopResponse runAction(DesktopParams params)
|
public abstract DesktopResponse runAction(DesktopParams params)
|
||||||
throws DesktopActionException;
|
throws DesktopActionException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the CIFS helper
|
|
||||||
*
|
|
||||||
* @return CifsHelper
|
|
||||||
*/
|
|
||||||
protected final CifsHelper getCifsHelper()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getCifsHelper();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the transaction service
|
|
||||||
*
|
|
||||||
* @return TransactionService
|
|
||||||
*/
|
|
||||||
protected final TransactionService getTransactionService()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getTransactionService();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the node service
|
|
||||||
*
|
|
||||||
* @return NodeService
|
|
||||||
*/
|
|
||||||
protected final NodeService getNodeService()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getNodeService();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the content service
|
|
||||||
*
|
|
||||||
* @return ContentService
|
|
||||||
*/
|
|
||||||
public final ContentService getContentService()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getContentService();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the namespace service
|
|
||||||
*
|
|
||||||
* @return NamespaceService
|
|
||||||
*/
|
|
||||||
public final NamespaceService getNamespaceService()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getNamespaceService();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the search service
|
|
||||||
*
|
|
||||||
* @return SearchService
|
|
||||||
*/
|
|
||||||
public final SearchService getSearchService()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getSearchService();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the service registry
|
|
||||||
*
|
|
||||||
* @return ServiceRegistry
|
|
||||||
*/
|
|
||||||
public final ServiceRegistry getServiceRegistry()
|
|
||||||
{
|
|
||||||
return m_contentDriver.getServiceRegistry();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the action attributes
|
* Set the action attributes
|
||||||
*
|
*
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desktop Action Exception Class
|
* Desktop Action Exception Class
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
@@ -14,7 +14,7 @@
|
|||||||
* language governing permissions and limitations under the
|
* language governing permissions and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@@ -14,7 +14,7 @@
|
|||||||
* language governing permissions and limitations under the
|
* language governing permissions and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@@ -14,7 +14,7 @@
|
|||||||
* language governing permissions and limitations under the
|
* language governing permissions and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
@@ -14,7 +14,7 @@
|
|||||||
* language governing permissions and limitations under the
|
* language governing permissions and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import org.alfresco.filesys.smb.NTIOCtl;
|
import org.alfresco.filesys.smb.NTIOCtl;
|
||||||
|
|
@@ -15,11 +15,9 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.alfresco;
|
||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.IOCtlInterface;
|
import org.alfresco.filesys.server.filesys.IOCtlInterface;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I/O Control Handler Interface
|
* I/O Control Handler Interface
|
||||||
@@ -31,9 +29,8 @@ public interface IOControlHandler extends IOCtlInterface
|
|||||||
/**
|
/**
|
||||||
* Initialize the I/O control handler
|
* Initialize the I/O control handler
|
||||||
*
|
*
|
||||||
*
|
* @param filesysDriver AlfrescoDiskDriver
|
||||||
* @param contentDriver ContentDiskDriver
|
* @param filesysContext AlfrescoContext
|
||||||
* @param contentContext ContentContext
|
|
||||||
*/
|
*/
|
||||||
public void initialize( ContentDiskDriver contentDriver, ContentContext contentContext);
|
public void initialize( AlfrescoDiskDriver filesysDriver, AlfrescoContext filesysContext);
|
||||||
}
|
}
|
@@ -17,11 +17,10 @@
|
|||||||
|
|
||||||
package org.alfresco.filesys.avm;
|
package org.alfresco.filesys.avm;
|
||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.DiskDeviceContext;
|
import org.alfresco.filesys.alfresco.AlfrescoContext;
|
||||||
|
import org.alfresco.filesys.alfresco.IOControlHandler;
|
||||||
|
import org.alfresco.filesys.server.filesys.DiskInterface;
|
||||||
import org.alfresco.filesys.server.filesys.FileSystem;
|
import org.alfresco.filesys.server.filesys.FileSystem;
|
||||||
import org.alfresco.filesys.server.filesys.SrvDiskInfo;
|
|
||||||
import org.alfresco.filesys.server.state.FileStateReaper;
|
|
||||||
import org.alfresco.filesys.server.state.FileStateTable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVM Filesystem Context Class
|
* AVM Filesystem Context Class
|
||||||
@@ -30,7 +29,7 @@ import org.alfresco.filesys.server.state.FileStateTable;
|
|||||||
*
|
*
|
||||||
* @author GKSpencer
|
* @author GKSpencer
|
||||||
*/
|
*/
|
||||||
public class AVMContext extends DiskDeviceContext {
|
public class AVMContext extends AlfrescoContext {
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
//
|
//
|
||||||
@@ -43,14 +42,18 @@ public class AVMContext extends DiskDeviceContext {
|
|||||||
private String m_storePath;
|
private String m_storePath;
|
||||||
private int m_version = VERSION_HEAD;
|
private int m_version = VERSION_HEAD;
|
||||||
|
|
||||||
// File state table and associated file state reaper
|
// Flag to indicate if the virtualization view is enabled
|
||||||
|
//
|
||||||
|
// The first set of folders then map to the stores and the second layer map to the versions with
|
||||||
|
// paths below.
|
||||||
|
|
||||||
private FileStateTable m_stateTable;
|
private boolean m_virtualView;
|
||||||
private FileStateReaper m_stateReaper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
|
* <p>Construct a context for a normal view onto a single store/version within AVM.
|
||||||
|
*
|
||||||
* @param filesysName String
|
* @param filesysName String
|
||||||
* @param storePath String
|
* @param storePath String
|
||||||
* @param version int
|
* @param version int
|
||||||
@@ -68,15 +71,22 @@ public class AVMContext extends DiskDeviceContext {
|
|||||||
// Set the store version to use
|
// Set the store version to use
|
||||||
|
|
||||||
m_version = version;
|
m_version = version;
|
||||||
|
}
|
||||||
|
|
||||||
// Default the filesystem to look like an 80Gb sized disk with 90% free space
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* <p>Construct a context for a virtualization view onto all stores/versions within AVM.
|
||||||
|
*
|
||||||
|
* @param filesysName String
|
||||||
|
*/
|
||||||
|
public AVMContext( String filesysName)
|
||||||
|
{
|
||||||
|
super( filesysName, "VirtualView");
|
||||||
|
|
||||||
setDiskInformation(new SrvDiskInfo(2560000, 64, 512, 2304000));
|
// Enable the virtualization view
|
||||||
|
|
||||||
// Set filesystem parameters
|
m_virtualView = true;
|
||||||
|
|
||||||
setFilesystemAttributes(FileSystem.CasePreservedNames + FileSystem.UnicodeOnDisk +
|
|
||||||
FileSystem.CaseSensitiveSearch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,69 +119,34 @@ public class AVMContext extends DiskDeviceContext {
|
|||||||
return m_version;
|
return m_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the virtualization view is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isVirtualizationView()
|
||||||
|
{
|
||||||
|
return m_virtualView;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the filesystem context
|
* Close the filesystem context
|
||||||
*/
|
*/
|
||||||
public void CloseContext() {
|
public void CloseContext() {
|
||||||
|
|
||||||
// Deregister the file state table from the reaper
|
|
||||||
|
|
||||||
if ( m_stateTable != null)
|
|
||||||
enableStateTable( false, m_stateReaper);
|
|
||||||
|
|
||||||
// Call the base class
|
// Call the base class
|
||||||
|
|
||||||
super.CloseContext();
|
super.CloseContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the file state table is enabled
|
* Create the I/O control handler for this filesystem type
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @param filesysDriver DiskInterface
|
||||||
|
* @return IOControlHandler
|
||||||
*/
|
*/
|
||||||
public final boolean hasStateTable()
|
protected IOControlHandler createIOHandler( DiskInterface filesysDriver)
|
||||||
{
|
{
|
||||||
return m_stateTable != null ? true : false;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the file state table
|
|
||||||
*
|
|
||||||
* @return FileStateTable
|
|
||||||
*/
|
|
||||||
public final FileStateTable getStateTable()
|
|
||||||
{
|
|
||||||
return m_stateTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/disable the file state table
|
|
||||||
*
|
|
||||||
* @param ena boolean
|
|
||||||
* @param stateReaper FileStateReaper
|
|
||||||
*/
|
|
||||||
public final void enableStateTable(boolean ena, FileStateReaper stateReaper)
|
|
||||||
{
|
|
||||||
if ( ena == false)
|
|
||||||
{
|
|
||||||
// Remove the state table from the reaper
|
|
||||||
|
|
||||||
stateReaper.removeStateTable( getFilesystemName());
|
|
||||||
m_stateTable = null;
|
|
||||||
}
|
|
||||||
else if ( m_stateTable == null)
|
|
||||||
{
|
|
||||||
// Create the file state table
|
|
||||||
|
|
||||||
m_stateTable = new FileStateTable();
|
|
||||||
|
|
||||||
// Register with the file state reaper
|
|
||||||
|
|
||||||
stateReaper.addStateTable( getFilesystemName(), m_stateTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the reaper, for deregistering when the filesystem is closed
|
|
||||||
|
|
||||||
m_stateReaper = stateReaper;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,6 @@ import org.alfresco.filesys.server.filesys.NetworkFile;
|
|||||||
import org.alfresco.filesys.smb.SeekType;
|
import org.alfresco.filesys.smb.SeekType;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@@ -36,11 +36,12 @@ public class AVMPath {
|
|||||||
|
|
||||||
// Version id string for the head version
|
// Version id string for the head version
|
||||||
|
|
||||||
private static final String VersionNameHead = "Head";
|
public static final String VersionNameHead = "Head";
|
||||||
|
|
||||||
// AVM path seperator
|
// AVM path seperator
|
||||||
|
|
||||||
public static final char AVM_SEPERATOR = '/';
|
public static final char AVM_SEPERATOR = '/';
|
||||||
|
public static final String AVM_SEPERATOR_STR = "/";
|
||||||
|
|
||||||
// Store name
|
// Store name
|
||||||
|
|
||||||
@@ -58,9 +59,18 @@ public class AVMPath {
|
|||||||
|
|
||||||
private String m_avmPath;
|
private String m_avmPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
|
public AVMPath()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
|
* <p>Construct an AVM path for the virtualization view, with store and version folders
|
||||||
|
*
|
||||||
* @param shrPath String
|
* @param shrPath String
|
||||||
*/
|
*/
|
||||||
public AVMPath(String shrPath)
|
public AVMPath(String shrPath)
|
||||||
@@ -70,6 +80,22 @@ public class AVMPath {
|
|||||||
parsePath( shrPath);
|
parsePath( shrPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* <p>Construct an AVM path for a standard view onto a store/version
|
||||||
|
*
|
||||||
|
* @param storeName String
|
||||||
|
* @param version int
|
||||||
|
* @param path String
|
||||||
|
*/
|
||||||
|
public AVMPath(String storeName, int version, String path)
|
||||||
|
{
|
||||||
|
// Parse the path
|
||||||
|
|
||||||
|
parsePath( storeName, version, path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the store name
|
* Return the store name
|
||||||
*
|
*
|
||||||
@@ -100,6 +126,28 @@ public class AVMPath {
|
|||||||
return m_version;
|
return m_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the version as a string
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public final String getVersionString()
|
||||||
|
{
|
||||||
|
if ( m_version == -1)
|
||||||
|
return VersionNameHead;
|
||||||
|
return "" + m_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there is a share relative path
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean hasRelativePath()
|
||||||
|
{
|
||||||
|
return m_path != null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the share relative path
|
* Return the share relative path
|
||||||
*
|
*
|
||||||
@@ -127,22 +175,54 @@ public class AVMPath {
|
|||||||
*/
|
*/
|
||||||
public final boolean isValid()
|
public final boolean isValid()
|
||||||
{
|
{
|
||||||
return m_storeName == null ? false : true;
|
return m_storeName == null && m_path == null ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the path
|
* Check if the path is to a pseudo folder in the virtualization view
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isPseudoPath()
|
||||||
|
{
|
||||||
|
return m_version == InvalidVersionId || m_path == null ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the path is the root path
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isRootPath()
|
||||||
|
{
|
||||||
|
if ( m_path != null && m_path.equals( FileName.DOS_SEPERATOR_STR))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the path, for the virtualization view onto all stores/versions
|
||||||
*
|
*
|
||||||
* @param path String
|
* @param path String
|
||||||
*/
|
*/
|
||||||
private final void parsePath( String path)
|
public final void parsePath( String path)
|
||||||
{
|
{
|
||||||
|
// Clear current settings
|
||||||
|
|
||||||
|
m_storeName = null;
|
||||||
|
m_version = InvalidVersionId;
|
||||||
|
m_path = null;
|
||||||
|
m_avmPath = null;
|
||||||
|
|
||||||
// Split the path
|
// Split the path
|
||||||
|
|
||||||
String[] paths = FileName.splitAllPaths(path);
|
String[] paths = FileName.splitAllPaths(path);
|
||||||
|
|
||||||
if ( paths == null || paths.length == 0)
|
if ( paths == null || paths.length == 0)
|
||||||
|
{
|
||||||
|
m_path = FileName.DOS_SEPERATOR_STR;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the store name
|
// Set the store name
|
||||||
|
|
||||||
@@ -204,11 +284,78 @@ public class AVMPath {
|
|||||||
pathStr.append( ":");
|
pathStr.append( ":");
|
||||||
pathStr.append( m_path.replace( FileName.DOS_SEPERATOR, AVM_SEPERATOR));
|
pathStr.append( m_path.replace( FileName.DOS_SEPERATOR, AVM_SEPERATOR));
|
||||||
|
|
||||||
|
m_avmPath = pathStr.toString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Share relative path is the root of the share
|
||||||
|
|
||||||
|
m_path = FileName.DOS_SEPERATOR_STR;
|
||||||
|
|
||||||
|
// Build the AVM path
|
||||||
|
|
||||||
|
StringBuilder pathStr = new StringBuilder();
|
||||||
|
|
||||||
|
pathStr.append( m_storeName);
|
||||||
|
pathStr.append( ":/");
|
||||||
|
|
||||||
m_avmPath = pathStr.toString();
|
m_avmPath = pathStr.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the path, to generate a path for a single store/version
|
||||||
|
*
|
||||||
|
* @param storeName String
|
||||||
|
* @param version int
|
||||||
|
* @param path String
|
||||||
|
*/
|
||||||
|
public final void parsePath( String storeName, int version, String path)
|
||||||
|
{
|
||||||
|
// Clear current settings
|
||||||
|
|
||||||
|
m_storeName = null;
|
||||||
|
m_version = InvalidVersionId;
|
||||||
|
m_path = null;
|
||||||
|
m_avmPath = null;
|
||||||
|
|
||||||
|
// Set the store/version
|
||||||
|
|
||||||
|
m_storeName = storeName;
|
||||||
|
m_version = version;
|
||||||
|
|
||||||
|
// Save the relative path
|
||||||
|
|
||||||
|
m_path = path;
|
||||||
|
|
||||||
|
// Build the store path
|
||||||
|
|
||||||
|
StringBuilder avmPath = new StringBuilder();
|
||||||
|
avmPath.append( m_storeName);
|
||||||
|
|
||||||
|
if ( storeName.indexOf( ":") == -1)
|
||||||
|
avmPath.append( ":");
|
||||||
|
|
||||||
|
if ( path == null || path.length() == 0)
|
||||||
|
{
|
||||||
|
avmPath.append( AVM_SEPERATOR);
|
||||||
|
|
||||||
|
// Set the share relative path as the root path
|
||||||
|
|
||||||
|
m_path = FileName.DOS_SEPERATOR_STR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( path.startsWith( FileName.DOS_SEPERATOR_STR) == false)
|
||||||
|
avmPath.append( AVM_SEPERATOR);
|
||||||
|
|
||||||
|
avmPath.append( path.replace( FileName.DOS_SEPERATOR, AVM_SEPERATOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_avmPath = avmPath.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the AVM path details as a string
|
* Return the AVM path details as a string
|
||||||
*
|
*
|
||||||
|
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
package org.alfresco.filesys.avm;
|
package org.alfresco.filesys.avm;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.SortedMap;
|
|
||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.FileAttribute;
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
import org.alfresco.filesys.server.filesys.FileInfo;
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
import org.alfresco.filesys.server.filesys.SearchContext;
|
import org.alfresco.filesys.server.filesys.SearchContext;
|
||||||
|
@@ -29,9 +29,7 @@ import org.alfresco.filesys.server.core.ShareMapper;
|
|||||||
import org.alfresco.filesys.server.core.ShareType;
|
import org.alfresco.filesys.server.core.ShareType;
|
||||||
import org.alfresco.filesys.server.core.SharedDevice;
|
import org.alfresco.filesys.server.core.SharedDevice;
|
||||||
import org.alfresco.filesys.server.core.SharedDeviceList;
|
import org.alfresco.filesys.server.core.SharedDeviceList;
|
||||||
import org.alfresco.filesys.server.filesys.DiskDeviceContext;
|
|
||||||
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
||||||
import org.alfresco.filesys.server.filesys.SrvDiskInfo;
|
|
||||||
import org.alfresco.filesys.util.StringList;
|
import org.alfresco.filesys.util.StringList;
|
||||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
@@ -0,0 +1,282 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.filesys.avm;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
|
import org.alfresco.filesys.server.filesys.SearchContext;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFileList;
|
||||||
|
import org.alfresco.filesys.util.WildCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo File List Search Context Class
|
||||||
|
*
|
||||||
|
* <p>Returns files from a pseudo file list for a wildcard search.
|
||||||
|
*
|
||||||
|
* @author gkspencer
|
||||||
|
*/
|
||||||
|
public class PseudoFileListSearchContext extends SearchContext {
|
||||||
|
|
||||||
|
// Pseudo file list and current index
|
||||||
|
|
||||||
|
private PseudoFileList m_fileList;
|
||||||
|
private int m_fileIdx;
|
||||||
|
|
||||||
|
// File attributes
|
||||||
|
|
||||||
|
private int m_attrib;
|
||||||
|
|
||||||
|
// Optional wildcard filter
|
||||||
|
|
||||||
|
private WildCard m_filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param fileList PseudoFileList
|
||||||
|
* @param attrib int
|
||||||
|
* @param filter WildCard
|
||||||
|
*/
|
||||||
|
public PseudoFileListSearchContext( PseudoFileList fileList, int attrib, WildCard filter)
|
||||||
|
{
|
||||||
|
m_attrib = attrib;
|
||||||
|
m_filter = filter;
|
||||||
|
m_fileList = fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if there are more files for the active search.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean hasMoreFiles()
|
||||||
|
{
|
||||||
|
return m_fileIdx < m_fileList.numberOfFiles() ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file information for the next file in the active search. Returns false if the search
|
||||||
|
* is complete.
|
||||||
|
*
|
||||||
|
* @param info FileInfo to return the file information.
|
||||||
|
* @return true if the file information is valid, else false
|
||||||
|
*/
|
||||||
|
public boolean nextFileInfo(FileInfo info)
|
||||||
|
{
|
||||||
|
// Check if there is another file record to return
|
||||||
|
|
||||||
|
if ( m_fileIdx >= m_fileList.numberOfFiles())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Search for the next valid file
|
||||||
|
|
||||||
|
boolean foundMatch = false;
|
||||||
|
PseudoFile curFile = null;
|
||||||
|
|
||||||
|
while (foundMatch == false && m_fileIdx < m_fileList.numberOfFiles())
|
||||||
|
{
|
||||||
|
// Get the next file from the list
|
||||||
|
|
||||||
|
curFile = m_fileList.getFileAt( m_fileIdx++);
|
||||||
|
|
||||||
|
// Check if the file name matches the search pattern
|
||||||
|
|
||||||
|
if ( m_filter != null)
|
||||||
|
{
|
||||||
|
// Check if the current file matches the wildcard pattern
|
||||||
|
|
||||||
|
if ( m_filter.matchesPattern(curFile.getFileName()) == true)
|
||||||
|
{
|
||||||
|
// Check if the file matches the search attributes
|
||||||
|
|
||||||
|
if (FileAttribute.hasAttribute(m_attrib, FileAttribute.Directory) &&
|
||||||
|
curFile.isDirectory())
|
||||||
|
{
|
||||||
|
|
||||||
|
// Found a match
|
||||||
|
|
||||||
|
foundMatch = true;
|
||||||
|
}
|
||||||
|
else if ( curFile.isFile())
|
||||||
|
{
|
||||||
|
|
||||||
|
// Found a match
|
||||||
|
|
||||||
|
foundMatch = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we found a match
|
||||||
|
|
||||||
|
if ( foundMatch == false)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get the next file from the list
|
||||||
|
|
||||||
|
if ( ++m_fileIdx < m_fileList.numberOfFiles())
|
||||||
|
curFile = m_fileList.getFileAt( m_fileIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
foundMatch = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found a match then fill in the file information
|
||||||
|
|
||||||
|
if ( foundMatch)
|
||||||
|
{
|
||||||
|
// Fill in the file information
|
||||||
|
|
||||||
|
info.setFileName( curFile.getFileName());
|
||||||
|
|
||||||
|
// Get the file information from the pseudo file
|
||||||
|
|
||||||
|
FileInfo pfInfo = curFile.getFileInfo();
|
||||||
|
|
||||||
|
if ( curFile.isFile())
|
||||||
|
{
|
||||||
|
info.setFileSize( pfInfo.getSize());
|
||||||
|
info.setAllocationSize( pfInfo.getAllocationSize());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
info.setFileSize( 0L);
|
||||||
|
|
||||||
|
info.setAccessDateTime( pfInfo.getAccessDateTime());
|
||||||
|
info.setCreationDateTime( pfInfo.getCreationDateTime());
|
||||||
|
info.setModifyDateTime( pfInfo.getModifyDateTime());
|
||||||
|
|
||||||
|
// Build the file attributes
|
||||||
|
|
||||||
|
int attr = pfInfo.getFileAttributes();
|
||||||
|
|
||||||
|
if ( pfInfo.isHidden() == false &&
|
||||||
|
curFile.getFileName().startsWith( ".") ||
|
||||||
|
curFile.getFileName().equalsIgnoreCase( "Desktop.ini") ||
|
||||||
|
curFile.getFileName().equalsIgnoreCase( "Thumbs.db"))
|
||||||
|
attr += FileAttribute.Hidden;
|
||||||
|
|
||||||
|
info.setFileAttributes( attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indicate if the file information is valid
|
||||||
|
|
||||||
|
return foundMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file name of the next file in the active search. Returns null is the search is
|
||||||
|
* complete.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String nextFileName()
|
||||||
|
{
|
||||||
|
// Check if there is another file record to return
|
||||||
|
|
||||||
|
// Find the next matching file name
|
||||||
|
|
||||||
|
while ( m_fileIdx < m_fileList.numberOfFiles()) {
|
||||||
|
|
||||||
|
// Check if the current file name matches the search pattern
|
||||||
|
|
||||||
|
String fname = m_fileList.getFileAt( m_fileIdx++).getFileName();
|
||||||
|
|
||||||
|
if ( m_filter.matchesPattern(fname))
|
||||||
|
return fname;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No more matching file names
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the total number of file entries for this search if known, else return -1
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int numberOfEntries()
|
||||||
|
{
|
||||||
|
return m_fileList.numberOfFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the resume id for the current file/directory in the search.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getResumeId()
|
||||||
|
{
|
||||||
|
return m_fileIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restart a search at the specified resume point.
|
||||||
|
*
|
||||||
|
* @param resumeId Resume point id.
|
||||||
|
* @return true if the search can be restarted, else false.
|
||||||
|
*/
|
||||||
|
public boolean restartAt(int resumeId)
|
||||||
|
{
|
||||||
|
// Range check the resume id
|
||||||
|
|
||||||
|
int resId = resumeId - 1;
|
||||||
|
|
||||||
|
if ( resId < 0 || resId >= m_fileList.numberOfFiles())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Reset the current file index
|
||||||
|
|
||||||
|
m_fileIdx = resId;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restart the current search at the specified file.
|
||||||
|
*
|
||||||
|
* @param info File to restart the search at.
|
||||||
|
* @return true if the search can be restarted, else false.
|
||||||
|
*/
|
||||||
|
public boolean restartAt(FileInfo info)
|
||||||
|
{
|
||||||
|
// Search backwards from the current file
|
||||||
|
|
||||||
|
int curFileIdx = m_fileIdx;
|
||||||
|
|
||||||
|
if (m_fileIdx >= m_fileList.numberOfFiles())
|
||||||
|
{
|
||||||
|
m_fileIdx = m_fileList.numberOfFiles() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( m_fileIdx > 0) {
|
||||||
|
|
||||||
|
// Check if the current file is the required search restart point
|
||||||
|
|
||||||
|
if ( m_fileList.getFileAt( m_fileIdx).getFileName().equals( info.getFileName()))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
m_fileIdx--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Failed to find the restart file
|
||||||
|
|
||||||
|
m_fileIdx = curFileIdx;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
81
source/java/org/alfresco/filesys/avm/StorePseudoFile.java
Normal file
81
source/java/org/alfresco/filesys/avm/StorePseudoFile.java
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.filesys.avm;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileName;
|
||||||
|
import org.alfresco.filesys.server.filesys.NetworkFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFolderNetworkFile;
|
||||||
|
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store Pseudo File Class
|
||||||
|
*
|
||||||
|
* <p>Represents an AVM store as a folder.
|
||||||
|
*
|
||||||
|
* @author gkspencer
|
||||||
|
*/
|
||||||
|
public class StorePseudoFile extends PseudoFile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param storeDesc AVMStoreDescriptor
|
||||||
|
*/
|
||||||
|
public StorePseudoFile( AVMStoreDescriptor storeDesc)
|
||||||
|
{
|
||||||
|
super( storeDesc.getName(), FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
|
// Create static file information from the store details
|
||||||
|
|
||||||
|
FileInfo fInfo = new FileInfo( storeDesc.getName(), 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
fInfo.setCreationDateTime( storeDesc.getCreateDate());
|
||||||
|
|
||||||
|
setFileInfo( fInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a network file for reading/writing the pseudo file
|
||||||
|
*
|
||||||
|
* @param netPath String
|
||||||
|
* @return NetworkFile
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NetworkFile getFile(String netPath) {
|
||||||
|
|
||||||
|
// Split the path to get the name
|
||||||
|
|
||||||
|
String[] paths = FileName.splitPath( netPath);
|
||||||
|
|
||||||
|
// Create a network file for the folder
|
||||||
|
|
||||||
|
return new PseudoFolderNetworkFile( paths[1], netPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file information for the pseudo file
|
||||||
|
*
|
||||||
|
* @return FileInfo
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo() {
|
||||||
|
return getInfo();
|
||||||
|
}
|
||||||
|
}
|
98
source/java/org/alfresco/filesys/avm/VersionPseudoFile.java
Normal file
98
source/java/org/alfresco/filesys/avm/VersionPseudoFile.java
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.filesys.avm;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileName;
|
||||||
|
import org.alfresco.filesys.server.filesys.NetworkFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFolderNetworkFile;
|
||||||
|
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version Pseudo File Class
|
||||||
|
*
|
||||||
|
* <p>Represents an AVM store version as a folder.
|
||||||
|
*
|
||||||
|
* @author gkspencer
|
||||||
|
*/
|
||||||
|
public class VersionPseudoFile extends PseudoFile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param name String
|
||||||
|
*/
|
||||||
|
public VersionPseudoFile( String name)
|
||||||
|
{
|
||||||
|
super( name, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
|
// Create static file information from the store details
|
||||||
|
|
||||||
|
FileInfo fInfo = new FileInfo( name, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
|
setFileInfo( fInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param name String
|
||||||
|
* @param verDesc VersionDescriptor
|
||||||
|
*/
|
||||||
|
public VersionPseudoFile( String name, VersionDescriptor verDesc)
|
||||||
|
{
|
||||||
|
super( name, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
|
||||||
|
// Create static file information from the store details
|
||||||
|
|
||||||
|
FileInfo fInfo = new FileInfo( name, 0L, FileAttribute.Directory + FileAttribute.ReadOnly);
|
||||||
|
fInfo.setCreationDateTime( verDesc.getCreateDate());
|
||||||
|
|
||||||
|
setFileInfo( fInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a network file for reading/writing the pseudo file
|
||||||
|
*
|
||||||
|
* @param netPath String
|
||||||
|
* @return NetworkFile
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NetworkFile getFile(String netPath) {
|
||||||
|
|
||||||
|
// Split the path to get the name
|
||||||
|
|
||||||
|
String[] paths = FileName.splitPath( netPath);
|
||||||
|
|
||||||
|
// Create a network file for the folder
|
||||||
|
|
||||||
|
return new PseudoFolderNetworkFile( paths[1], netPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file information for the pseudo file
|
||||||
|
*
|
||||||
|
* @return FileInfo
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FileInfo getFileInfo() {
|
||||||
|
return getInfo();
|
||||||
|
}
|
||||||
|
}
|
@@ -40,6 +40,9 @@ import org.alfresco.config.ConfigElement;
|
|||||||
import org.alfresco.config.ConfigLookupContext;
|
import org.alfresco.config.ConfigLookupContext;
|
||||||
import org.alfresco.config.ConfigService;
|
import org.alfresco.config.ConfigService;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopActionException;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopActionTable;
|
||||||
import org.alfresco.filesys.avm.AVMContext;
|
import org.alfresco.filesys.avm.AVMContext;
|
||||||
import org.alfresco.filesys.avm.AVMDiskDriver;
|
import org.alfresco.filesys.avm.AVMDiskDriver;
|
||||||
import org.alfresco.filesys.avm.AVMShareMapper;
|
import org.alfresco.filesys.avm.AVMShareMapper;
|
||||||
@@ -72,9 +75,6 @@ import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
|||||||
import org.alfresco.filesys.smb.ServerType;
|
import org.alfresco.filesys.smb.ServerType;
|
||||||
import org.alfresco.filesys.smb.TcpipSMB;
|
import org.alfresco.filesys.smb.TcpipSMB;
|
||||||
import org.alfresco.filesys.smb.server.repo.ContentContext;
|
import org.alfresco.filesys.smb.server.repo.ContentContext;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopActionException;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopActionTable;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.HomeShareMapper;
|
import org.alfresco.filesys.smb.server.repo.HomeShareMapper;
|
||||||
import org.alfresco.filesys.util.IPAddress;
|
import org.alfresco.filesys.util.IPAddress;
|
||||||
import org.alfresco.filesys.util.StringList;
|
import org.alfresco.filesys.util.StringList;
|
||||||
@@ -1810,6 +1810,7 @@ public class ServerConfiguration extends AbstractLifecycleBean
|
|||||||
// Create the new share for the store
|
// Create the new share for the store
|
||||||
|
|
||||||
AVMContext avmContext = new AVMContext( storeName, storeName + ":/", AVMContext.VERSION_HEAD);
|
AVMContext avmContext = new AVMContext( storeName, storeName + ":/", AVMContext.VERSION_HEAD);
|
||||||
|
avmContext.enableStateTable( true, avmDriver.getStateReaper());
|
||||||
|
|
||||||
// Create the shared filesystem
|
// Create the shared filesystem
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public class LocalPseudoFile extends PseudoFile
|
|||||||
{
|
{
|
||||||
// Check if the file information is valid
|
// Check if the file information is valid
|
||||||
|
|
||||||
if ( m_fileInfo == null) {
|
if ( getInfo() == null) {
|
||||||
|
|
||||||
// Get the file details
|
// Get the file details
|
||||||
|
|
||||||
@@ -76,23 +76,25 @@ public class LocalPseudoFile extends PseudoFile
|
|||||||
{
|
{
|
||||||
// Create the file information
|
// Create the file information
|
||||||
|
|
||||||
m_fileInfo = new FileInfo( getFileName(), localFile.length(), getAttributes());
|
FileInfo fInfo = new FileInfo( getFileName(), localFile.length(), getAttributes());
|
||||||
|
|
||||||
// Set the file creation/modification times
|
// Set the file creation/modification times
|
||||||
|
|
||||||
m_fileInfo.setModifyDateTime( localFile.lastModified());
|
fInfo.setModifyDateTime( localFile.lastModified());
|
||||||
m_fileInfo.setCreationDateTime( _creationDateTime);
|
fInfo.setCreationDateTime( _creationDateTime);
|
||||||
m_fileInfo.setChangeDateTime( _creationDateTime);
|
fInfo.setChangeDateTime( _creationDateTime);
|
||||||
|
|
||||||
// Set the allocation size, round up the actual length
|
// Set the allocation size, round up the actual length
|
||||||
|
|
||||||
m_fileInfo.setAllocationSize(( localFile.length() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
fInfo.setAllocationSize(( localFile.length() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
||||||
|
|
||||||
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the file information
|
// Return the file information
|
||||||
|
|
||||||
return m_fileInfo;
|
return getInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -40,10 +40,6 @@ public class MemoryNetworkFile extends NetworkFile
|
|||||||
|
|
||||||
private byte[] m_data;
|
private byte[] m_data;
|
||||||
|
|
||||||
// End of file flag
|
|
||||||
|
|
||||||
private boolean m_eof;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
@@ -64,7 +60,6 @@ public class MemoryNetworkFile extends NetworkFile
|
|||||||
// Set the file size
|
// Set the file size
|
||||||
|
|
||||||
setFileSize( m_data.length);
|
setFileSize( m_data.length);
|
||||||
m_eof = false;
|
|
||||||
|
|
||||||
// Set the creation and modification date/times
|
// Set the creation and modification date/times
|
||||||
|
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.FileInfo;
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
import org.alfresco.filesys.server.filesys.NetworkFile;
|
import org.alfresco.filesys.server.filesys.NetworkFile;
|
||||||
@@ -55,26 +55,28 @@ public class MemoryPseudoFile extends PseudoFile
|
|||||||
{
|
{
|
||||||
// Check if the file information is valid
|
// Check if the file information is valid
|
||||||
|
|
||||||
if ( m_fileInfo == null) {
|
if ( getInfo() == null) {
|
||||||
|
|
||||||
// Create the file information
|
// Create the file information
|
||||||
|
|
||||||
m_fileInfo = new FileInfo( getFileName(), m_data != null ? m_data.length : 0, getAttributes());
|
FileInfo fInfo = new FileInfo( getFileName(), m_data != null ? m_data.length : 0, getAttributes());
|
||||||
|
|
||||||
// Set the file creation/modification times
|
// Set the file creation/modification times
|
||||||
|
|
||||||
m_fileInfo.setCreationDateTime( _creationDateTime);
|
fInfo.setCreationDateTime( _creationDateTime);
|
||||||
m_fileInfo.setModifyDateTime( _creationDateTime);
|
fInfo.setModifyDateTime( _creationDateTime);
|
||||||
m_fileInfo.setChangeDateTime( _creationDateTime);
|
fInfo.setChangeDateTime( _creationDateTime);
|
||||||
|
|
||||||
// Set the allocation size, round up the actual length
|
// Set the allocation size, round up the actual length
|
||||||
|
|
||||||
m_fileInfo.setAllocationSize(( m_fileInfo.getSize() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
fInfo.setAllocationSize(( fInfo.getSize() + 512L) & 0xFFFFFFFFFFFFFE00L);
|
||||||
|
|
||||||
|
setFileInfo( fInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the file information
|
// Return the file information
|
||||||
|
|
||||||
return m_fileInfo;
|
return getInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@@ -15,9 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.FileAttribute;
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
import org.alfresco.filesys.server.filesys.FileInfo;
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
@@ -47,7 +45,7 @@ public abstract class PseudoFile
|
|||||||
|
|
||||||
// File information, used for file information/folder searches
|
// File information, used for file information/folder searches
|
||||||
|
|
||||||
protected FileInfo m_fileInfo;
|
private FileInfo m_fileInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
@@ -91,6 +89,46 @@ public abstract class PseudoFile
|
|||||||
return m_fileFlags;
|
return m_fileFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the pseudo file is a file
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isFile()
|
||||||
|
{
|
||||||
|
return (m_fileFlags & FileAttribute.Directory) != 0 ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the pseudo file is a folder
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isDirectory()
|
||||||
|
{
|
||||||
|
return (m_fileFlags & FileAttribute.Directory) != 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the pseudo file is read-only
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isReadOnly()
|
||||||
|
{
|
||||||
|
return (m_fileFlags & FileAttribute.ReadOnly) != 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the pseudo file is hidden
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public final boolean isHidden()
|
||||||
|
{
|
||||||
|
return (m_fileFlags & FileAttribute.Hidden) != 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the file information for the pseudo file
|
* Return the file information for the pseudo file
|
||||||
*
|
*
|
||||||
@@ -106,6 +144,26 @@ public abstract class PseudoFile
|
|||||||
*/
|
*/
|
||||||
public abstract NetworkFile getFile(String netPath);
|
public abstract NetworkFile getFile(String netPath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the file information
|
||||||
|
*
|
||||||
|
* @param fileInfo FileInfo
|
||||||
|
*/
|
||||||
|
protected final void setFileInfo( FileInfo finfo)
|
||||||
|
{
|
||||||
|
m_fileInfo = finfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file information
|
||||||
|
*
|
||||||
|
* @return FileInfo
|
||||||
|
*/
|
||||||
|
protected final FileInfo getInfo()
|
||||||
|
{
|
||||||
|
return m_fileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the pseudo file as a string
|
* Return the pseudo file as a string
|
||||||
*
|
*
|
@@ -14,33 +14,36 @@
|
|||||||
* language governing permissions and limitations under the
|
* language governing permissions and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopActionTable;
|
||||||
import org.alfresco.filesys.server.SrvSession;
|
import org.alfresco.filesys.server.SrvSession;
|
||||||
import org.alfresco.filesys.server.filesys.FileName;
|
import org.alfresco.filesys.server.filesys.FileName;
|
||||||
import org.alfresco.filesys.server.filesys.TreeConnection;
|
import org.alfresco.filesys.server.filesys.TreeConnection;
|
||||||
|
import org.alfresco.filesys.server.pseudo.MemoryPseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFileInterface;
|
||||||
import org.alfresco.filesys.server.state.FileState;
|
import org.alfresco.filesys.server.state.FileState;
|
||||||
import org.alfresco.filesys.smb.server.SMBSrvSession;
|
import org.alfresco.filesys.smb.server.SMBSrvSession;
|
||||||
import org.alfresco.filesys.smb.server.repo.ContentContext;
|
import org.alfresco.filesys.smb.server.repo.ContentContext;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopActionTable;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content Filesystem Driver Pseudo File Implementation
|
* Alfresco Filesystem Driver Pseudo File Implementation
|
||||||
*
|
*
|
||||||
* <p>Pseudo file implementation for the content disk driver.
|
* <p>Pseudo file implementation for the Alfresco filesystem drivers.
|
||||||
*
|
*
|
||||||
* @author gkspencer
|
* @author gkspencer
|
||||||
*/
|
*/
|
||||||
public class ContentPseudoFileImpl implements PseudoFileInterface
|
public class PseudoFileImpl implements PseudoFileInterface
|
||||||
{
|
{
|
||||||
// Logging
|
// Logging
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(ContentPseudoFileImpl.class);
|
private static final Log logger = LogFactory.getLog(PseudoFileImpl.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the specified path refers to a pseudo file
|
* Check if the specified path refers to a pseudo file
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import org.alfresco.filesys.server.SrvSession;
|
import org.alfresco.filesys.server.SrvSession;
|
||||||
import org.alfresco.filesys.server.filesys.TreeConnection;
|
import org.alfresco.filesys.server.filesys.TreeConnection;
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.server.filesys.AccessDeniedException;
|
||||||
|
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||||
|
import org.alfresco.filesys.server.filesys.NetworkFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo Folder Network File Class
|
||||||
|
*
|
||||||
|
* <p>Represents an open pseudo folder.
|
||||||
|
*
|
||||||
|
* @author gkspencer
|
||||||
|
*/
|
||||||
|
public class PseudoFolderNetworkFile extends NetworkFile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param name String
|
||||||
|
*/
|
||||||
|
public PseudoFolderNetworkFile(String name)
|
||||||
|
{
|
||||||
|
super( name);
|
||||||
|
|
||||||
|
setAttributes( FileAttribute.Directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param name String
|
||||||
|
* @param relPath String
|
||||||
|
*/
|
||||||
|
public PseudoFolderNetworkFile(String name, String relPath)
|
||||||
|
{
|
||||||
|
super( name);
|
||||||
|
|
||||||
|
setFullName( relPath);
|
||||||
|
setAttributes( FileAttribute.Directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the network file.
|
||||||
|
*/
|
||||||
|
public void closeFile() throws java.io.IOException
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current file position.
|
||||||
|
*
|
||||||
|
* @return long
|
||||||
|
*/
|
||||||
|
public long currentPosition()
|
||||||
|
{
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush the file.
|
||||||
|
*
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public void flushFile() throws IOException
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the end of file has been reached.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isEndOfFile() throws java.io.IOException
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the file.
|
||||||
|
*
|
||||||
|
* @param createFlag boolean
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public void openFile(boolean createFlag) throws java.io.IOException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read from the file.
|
||||||
|
*
|
||||||
|
* @param buf byte[]
|
||||||
|
* @param len int
|
||||||
|
* @param pos int
|
||||||
|
* @param fileOff long
|
||||||
|
* @return Length of data read.
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public int readFile(byte[] buf, int len, int pos, long fileOff) throws java.io.IOException
|
||||||
|
{
|
||||||
|
throw new AccessDeniedException( "Attempt to read/write folder file");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seek to the specified file position.
|
||||||
|
*
|
||||||
|
* @param pos long
|
||||||
|
* @param typ int
|
||||||
|
* @return long
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public long seekFile(long pos, int typ) throws IOException
|
||||||
|
{
|
||||||
|
throw new AccessDeniedException( "Attempt to read/write folder file");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncate the file
|
||||||
|
*
|
||||||
|
* @param siz long
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public void truncateFile(long siz) throws IOException
|
||||||
|
{
|
||||||
|
throw new AccessDeniedException( "Attempt to read/write folder file");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a block of data to the file.
|
||||||
|
*
|
||||||
|
* @param buf byte[]
|
||||||
|
* @param len int
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public void writeFile(byte[] buf, int len, int pos) throws java.io.IOException
|
||||||
|
{
|
||||||
|
throw new AccessDeniedException( "Attempt to read/write folder file");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a block of data to the file.
|
||||||
|
*
|
||||||
|
* @param buf byte[]
|
||||||
|
* @param len int
|
||||||
|
* @param pos int
|
||||||
|
* @param offset long
|
||||||
|
* @exception IOException
|
||||||
|
*/
|
||||||
|
public void writeFile(byte[] buf, int len, int pos, long offset) throws java.io.IOException
|
||||||
|
{
|
||||||
|
throw new AccessDeniedException( "Attempt to read/write folder file");
|
||||||
|
}
|
||||||
|
}
|
@@ -15,7 +15,7 @@
|
|||||||
* License.
|
* License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.filesys.smb.server.repo.pseudo;
|
package org.alfresco.filesys.server.pseudo;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -26,8 +26,8 @@ import org.alfresco.filesys.smb.SeekType;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pseudo File Network File Class
|
* Pseudo File Network File Class
|
||||||
* <p>
|
*
|
||||||
* Represents an open pseudo file and provides access to the file data.
|
* <p>Represents an open pseudo file and provides access to the file data.
|
||||||
*
|
*
|
||||||
* @author gkspencer
|
* @author gkspencer
|
||||||
*/
|
*/
|
@@ -22,9 +22,9 @@ import org.alfresco.filesys.locking.LockConflictException;
|
|||||||
import org.alfresco.filesys.locking.NotLockedException;
|
import org.alfresco.filesys.locking.NotLockedException;
|
||||||
import org.alfresco.filesys.server.filesys.FileOpenParams;
|
import org.alfresco.filesys.server.filesys.FileOpenParams;
|
||||||
import org.alfresco.filesys.server.filesys.FileStatus;
|
import org.alfresco.filesys.server.filesys.FileStatus;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFileList;
|
||||||
import org.alfresco.filesys.smb.SharingMode;
|
import org.alfresco.filesys.smb.SharingMode;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFileList;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@@ -16,13 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo;
|
package org.alfresco.filesys.smb.server.repo;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import org.alfresco.filesys.alfresco.AlfrescoContext;
|
||||||
|
import org.alfresco.filesys.alfresco.IOControlHandler;
|
||||||
import org.alfresco.filesys.server.filesys.*;
|
import org.alfresco.filesys.server.filesys.*;
|
||||||
import org.alfresco.filesys.server.state.FileStateReaper;
|
|
||||||
import org.alfresco.filesys.server.state.FileStateTable;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.ContentPseudoFileImpl;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFileInterface;
|
|
||||||
import org.alfresco.service.cmr.repository.*;
|
import org.alfresco.service.cmr.repository.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +28,7 @@ import org.alfresco.service.cmr.repository.*;
|
|||||||
*
|
*
|
||||||
* @author GKSpencer
|
* @author GKSpencer
|
||||||
*/
|
*/
|
||||||
public class ContentContext extends DiskDeviceContext
|
public class ContentContext extends AlfrescoContext
|
||||||
{
|
{
|
||||||
// Store and root path
|
// Store and root path
|
||||||
|
|
||||||
@@ -43,28 +39,6 @@ public class ContentContext extends DiskDeviceContext
|
|||||||
|
|
||||||
private NodeRef m_rootNodeRef;
|
private NodeRef m_rootNodeRef;
|
||||||
|
|
||||||
// File state table and associated file state reaper
|
|
||||||
|
|
||||||
private FileStateTable m_stateTable;
|
|
||||||
private FileStateReaper m_stateReaper;
|
|
||||||
|
|
||||||
// URL pseudo file web path prefix (server/port/webapp) and link file name
|
|
||||||
|
|
||||||
private String m_urlPathPrefix;
|
|
||||||
private String m_urlFileName;
|
|
||||||
|
|
||||||
// Pseudo file interface
|
|
||||||
|
|
||||||
private PseudoFileInterface m_pseudoFileInterface;
|
|
||||||
|
|
||||||
// Desktop actions
|
|
||||||
|
|
||||||
private DesktopActionTable m_desktopActions;
|
|
||||||
|
|
||||||
// I/O control handler
|
|
||||||
|
|
||||||
private IOControlHandler m_ioHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
@@ -81,10 +55,6 @@ public class ContentContext extends DiskDeviceContext
|
|||||||
m_rootPath = rootPath;
|
m_rootPath = rootPath;
|
||||||
|
|
||||||
m_rootNodeRef = rootNodeRef;
|
m_rootNodeRef = rootNodeRef;
|
||||||
|
|
||||||
// Create the file state table
|
|
||||||
|
|
||||||
m_stateTable = new FileStateTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,263 +97,24 @@ public class ContentContext extends DiskDeviceContext
|
|||||||
return m_rootNodeRef;
|
return m_rootNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the file state table is enabled
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean hasStateTable()
|
|
||||||
{
|
|
||||||
return m_stateTable != null ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the file state table
|
|
||||||
*
|
|
||||||
* @return FileStateTable
|
|
||||||
*/
|
|
||||||
public final FileStateTable getStateTable()
|
|
||||||
{
|
|
||||||
return m_stateTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable/disable the file state table
|
|
||||||
*
|
|
||||||
* @param ena boolean
|
|
||||||
* @param stateReaper FileStateReaper
|
|
||||||
*/
|
|
||||||
public final void enableStateTable(boolean ena, FileStateReaper stateReaper)
|
|
||||||
{
|
|
||||||
if ( ena == false)
|
|
||||||
{
|
|
||||||
// Remove the state table from the reaper
|
|
||||||
|
|
||||||
stateReaper.removeStateTable( getFilesystemName());
|
|
||||||
m_stateTable = null;
|
|
||||||
}
|
|
||||||
else if ( m_stateTable == null)
|
|
||||||
{
|
|
||||||
// Create the file state table
|
|
||||||
|
|
||||||
m_stateTable = new FileStateTable();
|
|
||||||
|
|
||||||
// Register with the file state reaper
|
|
||||||
|
|
||||||
stateReaper.addStateTable( getFilesystemName(), m_stateTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the reaper, for deregistering when the filesystem is closed
|
|
||||||
|
|
||||||
m_stateReaper = stateReaper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the pseudo file interface is enabled
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean hasPseudoFileInterface()
|
|
||||||
{
|
|
||||||
return m_pseudoFileInterface != null ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the pseudo file interface
|
|
||||||
*
|
|
||||||
* @return PseudoFileInterface
|
|
||||||
*/
|
|
||||||
public final PseudoFileInterface getPseudoFileInterface()
|
|
||||||
{
|
|
||||||
return m_pseudoFileInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the pseudo file interface for this filesystem
|
|
||||||
*/
|
|
||||||
public final void enabledPseudoFileInterface()
|
|
||||||
{
|
|
||||||
if ( m_pseudoFileInterface == null)
|
|
||||||
m_pseudoFileInterface = new ContentPseudoFileImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if there are desktop actins configured
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean hasDesktopActions()
|
|
||||||
{
|
|
||||||
return m_desktopActions != null ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the desktop actions table
|
|
||||||
*
|
|
||||||
* @return DesktopActionTable
|
|
||||||
*/
|
|
||||||
public final DesktopActionTable getDesktopActions()
|
|
||||||
{
|
|
||||||
return m_desktopActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the count of desktop actions
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public final int numberOfDesktopActions()
|
|
||||||
{
|
|
||||||
return m_desktopActions != null ? m_desktopActions.numberOfActions() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a desktop action
|
|
||||||
*
|
|
||||||
* @param action DesktopAction
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean addDesktopAction(DesktopAction action)
|
|
||||||
{
|
|
||||||
// Check if the desktop actions table has been created
|
|
||||||
|
|
||||||
if ( m_desktopActions == null)
|
|
||||||
{
|
|
||||||
m_desktopActions = new DesktopActionTable();
|
|
||||||
|
|
||||||
// Enable pseudo files
|
|
||||||
|
|
||||||
enabledPseudoFileInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the action
|
|
||||||
|
|
||||||
return m_desktopActions.addAction(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if custom I/O control handling is enabled for this filesystem
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean hasIOHandler()
|
|
||||||
{
|
|
||||||
return m_ioHandler != null ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the custom I/O control handler
|
|
||||||
*
|
|
||||||
* @return IOControlHandler
|
|
||||||
*/
|
|
||||||
public final IOControlHandler getIOHandler()
|
|
||||||
{
|
|
||||||
return m_ioHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the URL pseudo file is enabled
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public final boolean hasURLFile()
|
|
||||||
{
|
|
||||||
if ( m_urlPathPrefix != null && m_urlFileName != null)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the URL pseudo file path prefix
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public final String getURLPrefix()
|
|
||||||
{
|
|
||||||
return m_urlPathPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the URL pseudo file name
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public final String getURLFileName()
|
|
||||||
{
|
|
||||||
return m_urlFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the URL path prefix
|
|
||||||
*
|
|
||||||
* @param urlPrefix String
|
|
||||||
*/
|
|
||||||
public final void setURLPrefix(String urlPrefix)
|
|
||||||
{
|
|
||||||
m_urlPathPrefix = urlPrefix;
|
|
||||||
|
|
||||||
if ( urlPrefix != null)
|
|
||||||
enabledPseudoFileInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the URL pseudo file name
|
|
||||||
*
|
|
||||||
* @param urlFileName String
|
|
||||||
*/
|
|
||||||
public final void setURLFileName(String urlFileName)
|
|
||||||
{
|
|
||||||
m_urlFileName = urlFileName;
|
|
||||||
|
|
||||||
if ( urlFileName != null)
|
|
||||||
enabledPseudoFileInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the desktop actions
|
|
||||||
*
|
|
||||||
* @param desktopActions DesktopActionTable
|
|
||||||
* @param filesysDriver DiskInterface
|
|
||||||
*/
|
|
||||||
public final void setDesktopActions(DesktopActionTable desktopActions, DiskInterface filesysDriver)
|
|
||||||
{
|
|
||||||
// Enumerate the desktop actions and add to this filesystem
|
|
||||||
|
|
||||||
Enumeration<String> names = desktopActions.enumerateActionNames();
|
|
||||||
|
|
||||||
while ( names.hasMoreElements())
|
|
||||||
{
|
|
||||||
addDesktopAction( desktopActions.getAction(names.nextElement()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are desktop actions then create the custom I/O control handler
|
|
||||||
|
|
||||||
if ( numberOfDesktopActions() > 0)
|
|
||||||
{
|
|
||||||
// Access the filesystem driver
|
|
||||||
|
|
||||||
ContentDiskDriver contentDriver = (ContentDiskDriver) filesysDriver;
|
|
||||||
|
|
||||||
// Create the custom I/O control handler
|
|
||||||
|
|
||||||
m_ioHandler = new ContentIOControlHandler();
|
|
||||||
m_ioHandler.initialize(contentDriver, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the filesystem context
|
* Close the filesystem context
|
||||||
*/
|
*/
|
||||||
public void CloseContext() {
|
public void CloseContext() {
|
||||||
|
|
||||||
// Deregister the file state table from the reaper
|
|
||||||
|
|
||||||
if ( m_stateTable != null)
|
|
||||||
enableStateTable( false, m_stateReaper);
|
|
||||||
|
|
||||||
// Call the base class
|
// Call the base class
|
||||||
|
|
||||||
super.CloseContext();
|
super.CloseContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the I/O control handler for this filesystem type
|
||||||
|
*
|
||||||
|
* @param filesysDriver DiskInterface
|
||||||
|
* @return IOControlHandler
|
||||||
|
*/
|
||||||
|
protected IOControlHandler createIOHandler( DiskInterface filesysDriver)
|
||||||
|
{
|
||||||
|
return new ContentIOControlHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ import javax.transaction.UserTransaction;
|
|||||||
|
|
||||||
import org.alfresco.config.ConfigElement;
|
import org.alfresco.config.ConfigElement;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
|
||||||
import org.alfresco.filesys.server.SrvSession;
|
import org.alfresco.filesys.server.SrvSession;
|
||||||
import org.alfresco.filesys.server.core.DeviceContext;
|
import org.alfresco.filesys.server.core.DeviceContext;
|
||||||
import org.alfresco.filesys.server.core.DeviceContextException;
|
import org.alfresco.filesys.server.core.DeviceContextException;
|
||||||
@@ -38,30 +39,21 @@ import org.alfresco.filesys.server.filesys.FileName;
|
|||||||
import org.alfresco.filesys.server.filesys.FileOpenParams;
|
import org.alfresco.filesys.server.filesys.FileOpenParams;
|
||||||
import org.alfresco.filesys.server.filesys.FileSharingException;
|
import org.alfresco.filesys.server.filesys.FileSharingException;
|
||||||
import org.alfresco.filesys.server.filesys.FileStatus;
|
import org.alfresco.filesys.server.filesys.FileStatus;
|
||||||
import org.alfresco.filesys.server.filesys.FileSystem;
|
|
||||||
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.NetworkFile;
|
||||||
import org.alfresco.filesys.server.filesys.SearchContext;
|
import org.alfresco.filesys.server.filesys.SearchContext;
|
||||||
import org.alfresco.filesys.server.filesys.SrvDiskInfo;
|
|
||||||
import org.alfresco.filesys.server.filesys.TreeConnection;
|
import org.alfresco.filesys.server.filesys.TreeConnection;
|
||||||
|
import org.alfresco.filesys.server.pseudo.MemoryNetworkFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFileInterface;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoFileList;
|
||||||
|
import org.alfresco.filesys.server.pseudo.PseudoNetworkFile;
|
||||||
import org.alfresco.filesys.server.state.FileState;
|
import org.alfresco.filesys.server.state.FileState;
|
||||||
import org.alfresco.filesys.server.state.FileStateReaper;
|
|
||||||
import org.alfresco.filesys.server.state.FileState.FileStateStatus;
|
import org.alfresco.filesys.server.state.FileState.FileStateStatus;
|
||||||
import org.alfresco.filesys.smb.SMBException;
|
|
||||||
import org.alfresco.filesys.smb.SMBStatus;
|
|
||||||
import org.alfresco.filesys.smb.SharingMode;
|
import org.alfresco.filesys.smb.SharingMode;
|
||||||
import org.alfresco.filesys.smb.server.SMBSrvSession;
|
import org.alfresco.filesys.smb.server.SMBSrvSession;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.MemoryNetworkFile;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFileInterface;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFileList;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoNetworkFile;
|
|
||||||
import org.alfresco.filesys.util.DataBuffer;
|
|
||||||
import org.alfresco.filesys.util.WildCard;
|
import org.alfresco.filesys.util.WildCard;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
|
||||||
import org.alfresco.service.cmr.lock.NodeLockedException;
|
import org.alfresco.service.cmr.lock.NodeLockedException;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -83,7 +75,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterface
|
||||||
{
|
{
|
||||||
// Logging
|
// Logging
|
||||||
|
|
||||||
@@ -112,14 +104,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
private AuthenticationComponent authComponent;
|
private AuthenticationComponent authComponent;
|
||||||
private AuthenticationService authService;
|
private AuthenticationService authService;
|
||||||
|
|
||||||
// Service registry for desktop actions
|
|
||||||
|
|
||||||
private ServiceRegistry serviceRegistry;
|
|
||||||
|
|
||||||
// File state reaper
|
|
||||||
|
|
||||||
private FileStateReaper m_stateReaper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
@@ -199,26 +183,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
return this.searchService;
|
return this.searchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the service registry
|
|
||||||
*
|
|
||||||
* @return ServiceRegistry
|
|
||||||
*/
|
|
||||||
public final ServiceRegistry getServiceRegistry()
|
|
||||||
{
|
|
||||||
return this.serviceRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the file state reaper
|
|
||||||
*
|
|
||||||
* @return FileStateReaper
|
|
||||||
*/
|
|
||||||
public final FileStateReaper getStateReaper()
|
|
||||||
{
|
|
||||||
return m_stateReaper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param contentService the content service
|
* @param contentService the content service
|
||||||
*/
|
*/
|
||||||
@@ -269,16 +233,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the service registry
|
|
||||||
*
|
|
||||||
* @param serviceRegistry
|
|
||||||
*/
|
|
||||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
|
||||||
{
|
|
||||||
this.serviceRegistry = serviceRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the authentication component
|
* Set the authentication component
|
||||||
*
|
*
|
||||||
@@ -299,16 +253,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
this.authService = authService;
|
this.authService = authService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the file state reaper
|
|
||||||
*
|
|
||||||
* @param stateReaper FileStateReaper
|
|
||||||
*/
|
|
||||||
public final void setStateReaper(FileStateReaper stateReaper)
|
|
||||||
{
|
|
||||||
m_stateReaper = stateReaper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse and validate the parameter string and create a device context object for this instance
|
* Parse and validate the parameter string and create a device context object for this instance
|
||||||
* of the shared device. The same DeviceInterface implementation may be used for multiple
|
* of the shared device. The same DeviceInterface implementation may be used for multiple
|
||||||
@@ -419,15 +363,6 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
// Create the context
|
// Create the context
|
||||||
|
|
||||||
context = new ContentContext(name, storeValue, rootPath, rootNodeRef);
|
context = new ContentContext(name, storeValue, rootPath, rootNodeRef);
|
||||||
|
|
||||||
// Default the filesystem to look like an 80Gb sized disk with 90% free space
|
|
||||||
|
|
||||||
context.setDiskInformation(new SrvDiskInfo(2560000, 64, 512, 2304000));
|
|
||||||
|
|
||||||
// Set parameters
|
|
||||||
|
|
||||||
context.setFilesystemAttributes(FileSystem.CasePreservedNames + FileSystem.UnicodeOnDisk +
|
|
||||||
FileSystem.CaseSensitiveSearch);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -2198,37 +2133,4 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
|||||||
{
|
{
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a filesystem I/O control request
|
|
||||||
*
|
|
||||||
* @param sess Server session
|
|
||||||
* @param tree Tree connection.
|
|
||||||
* @param ctrlCode I/O control code
|
|
||||||
* @param fid File id
|
|
||||||
* @param dataBuf I/O control specific input data
|
|
||||||
* @param isFSCtrl true if this is a filesystem control, or false for a device control
|
|
||||||
* @param filter if bit0 is set indicates that the control applies to the share root handle
|
|
||||||
* @return DataBuffer
|
|
||||||
* @exception IOControlNotImplementedException
|
|
||||||
* @exception SMBException
|
|
||||||
*/
|
|
||||||
public DataBuffer processIOControl(SrvSession sess, TreeConnection tree, int ctrlCode, int fid, DataBuffer dataBuf,
|
|
||||||
boolean isFSCtrl, int filter)
|
|
||||||
throws IOControlNotImplementedException, SMBException
|
|
||||||
{
|
|
||||||
// Validate the file id
|
|
||||||
|
|
||||||
NetworkFile netFile = tree.findFile(fid);
|
|
||||||
if ( netFile == null || netFile.isDirectory() == false)
|
|
||||||
throw new SMBException(SMBStatus.NTErr, SMBStatus.NTInvalidParameter);
|
|
||||||
|
|
||||||
// Check if the I/O control handler is enabled
|
|
||||||
|
|
||||||
ContentContext ctx = (ContentContext) tree.getContext();
|
|
||||||
if ( ctx.hasIOHandler())
|
|
||||||
return ctx.getIOHandler().processIOControl( sess, tree, ctrlCode, fid, dataBuf, isFSCtrl, filter);
|
|
||||||
else
|
|
||||||
throw new IOControlNotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,15 @@ package org.alfresco.filesys.smb.server.repo;
|
|||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.alfresco.AlfrescoContext;
|
||||||
|
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopActionTable;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopTarget;
|
||||||
|
import org.alfresco.filesys.alfresco.IOControl;
|
||||||
|
import org.alfresco.filesys.alfresco.IOControlHandler;
|
||||||
import org.alfresco.filesys.server.SrvSession;
|
import org.alfresco.filesys.server.SrvSession;
|
||||||
import org.alfresco.filesys.server.auth.ClientInfo;
|
import org.alfresco.filesys.server.auth.ClientInfo;
|
||||||
import org.alfresco.filesys.server.filesys.IOControlNotImplementedException;
|
import org.alfresco.filesys.server.filesys.IOControlNotImplementedException;
|
||||||
@@ -28,7 +37,6 @@ import org.alfresco.filesys.smb.SMBException;
|
|||||||
import org.alfresco.filesys.smb.SMBStatus;
|
import org.alfresco.filesys.smb.SMBStatus;
|
||||||
import org.alfresco.filesys.smb.server.repo.CifsHelper;
|
import org.alfresco.filesys.smb.server.repo.CifsHelper;
|
||||||
import org.alfresco.filesys.smb.server.repo.ContentDiskDriver;
|
import org.alfresco.filesys.smb.server.repo.ContentDiskDriver;
|
||||||
import org.alfresco.filesys.smb.server.repo.IOControlHandler;
|
|
||||||
import org.alfresco.filesys.util.DataBuffer;
|
import org.alfresco.filesys.util.DataBuffer;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
@@ -69,13 +77,13 @@ public class ContentIOControlHandler implements IOControlHandler
|
|||||||
/**
|
/**
|
||||||
* Initalize the I/O control handler
|
* Initalize the I/O control handler
|
||||||
*
|
*
|
||||||
* @param contentDriver ContentDiskDriver
|
* @param filesysDriver AlfrescoDiskDriver
|
||||||
* @param contentContext ContentContext
|
* @param context AlfrescoContext
|
||||||
*/
|
*/
|
||||||
public void initialize( ContentDiskDriver contentDriver, ContentContext contentContext)
|
public void initialize( AlfrescoDiskDriver filesysDriver, AlfrescoContext context)
|
||||||
{
|
{
|
||||||
this.contentDriver = contentDriver;
|
this.contentDriver = (ContentDiskDriver) filesysDriver;
|
||||||
this.contentContext = contentContext;
|
this.contentContext = (ContentContext) context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -21,8 +21,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.alfresco.filesys.server.filesys.FileInfo;
|
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||||
import org.alfresco.filesys.server.filesys.SearchContext;
|
import org.alfresco.filesys.server.filesys.SearchContext;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
|
import org.alfresco.filesys.server.pseudo.PseudoFile;
|
||||||
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFileList;
|
import org.alfresco.filesys.server.pseudo.PseudoFileList;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@@ -20,15 +20,17 @@ import java.io.Serializable;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopTarget;
|
||||||
import org.alfresco.filesys.server.filesys.FileName;
|
import org.alfresco.filesys.server.filesys.FileName;
|
||||||
import org.alfresco.filesys.server.filesys.NotifyChange;
|
import org.alfresco.filesys.server.filesys.NotifyChange;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopParams;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopTarget;
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||||
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.transaction.TransactionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check In/Out Desktop Action Class
|
* Check In/Out Desktop Action Class
|
||||||
@@ -75,9 +77,14 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
|||||||
if ( params.numberOfTargetNodes() == 0)
|
if ( params.numberOfTargetNodes() == 0)
|
||||||
return new DesktopResponse(StsSuccess);
|
return new DesktopResponse(StsSuccess);
|
||||||
|
|
||||||
|
// Get required services
|
||||||
|
|
||||||
|
TransactionService transService = getServiceRegistry().getTransactionService();
|
||||||
|
NodeService nodeService = getServiceRegistry().getNodeService();
|
||||||
|
|
||||||
// Start a transaction
|
// Start a transaction
|
||||||
|
|
||||||
params.getSession().beginTransaction(getTransactionService(), false);
|
params.getSession().beginTransaction( transService, false);
|
||||||
|
|
||||||
// Process the list of target nodes
|
// Process the list of target nodes
|
||||||
|
|
||||||
@@ -91,7 +98,7 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
|||||||
|
|
||||||
// Check if the node is a working copy
|
// Check if the node is a working copy
|
||||||
|
|
||||||
if ( getNodeService().hasAspect( target.getNode(), ContentModel.ASPECT_WORKING_COPY))
|
if ( nodeService.hasAspect( target.getNode(), ContentModel.ASPECT_WORKING_COPY))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -144,11 +151,11 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
|||||||
{
|
{
|
||||||
// Check if the file is locked
|
// Check if the file is locked
|
||||||
|
|
||||||
if ( getNodeService().hasAspect( target.getNode(), ContentModel.ASPECT_LOCKABLE)) {
|
if ( nodeService.hasAspect( target.getNode(), ContentModel.ASPECT_LOCKABLE)) {
|
||||||
|
|
||||||
// Get the lock type
|
// Get the lock type
|
||||||
|
|
||||||
String lockTypeStr = (String) getNodeService().getProperty( target.getNode(), ContentModel.PROP_LOCK_TYPE);
|
String lockTypeStr = (String) nodeService.getProperty( target.getNode(), ContentModel.PROP_LOCK_TYPE);
|
||||||
if ( lockTypeStr != null) {
|
if ( lockTypeStr != null) {
|
||||||
response.setStatus(StsError, "Checkout failed, file is locked");
|
response.setStatus(StsError, "Checkout failed, file is locked");
|
||||||
return response;
|
return response;
|
||||||
@@ -161,7 +168,7 @@ public class CheckInOutDesktopAction extends DesktopAction {
|
|||||||
|
|
||||||
// Get the working copy file name
|
// Get the working copy file name
|
||||||
|
|
||||||
String workingCopyName = (String) getNodeService().getProperty( workingCopyNode, ContentModel.PROP_NAME);
|
String workingCopyName = (String) nodeService.getProperty( workingCopyNode, ContentModel.PROP_NAME);
|
||||||
|
|
||||||
// Check out was successful, pack the working copy name
|
// Check out was successful, pack the working copy name
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.filesys.smb.server.repo.desk;
|
package org.alfresco.filesys.smb.server.repo.desk;
|
||||||
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopParams;
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command Line Desktop Action Class
|
* Command Line Desktop Action Class
|
||||||
|
@@ -18,9 +18,9 @@ package org.alfresco.filesys.smb.server.repo.desk;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopParams;
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Echo Desktop Action Class
|
* Echo Desktop Action Class
|
||||||
|
@@ -29,13 +29,14 @@ import java.util.Map;
|
|||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.alfresco.config.ConfigElement;
|
import org.alfresco.config.ConfigElement;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopActionException;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopActionException;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopParams;
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
|
|
||||||
import org.alfresco.service.cmr.repository.ScriptException;
|
import org.alfresco.service.cmr.repository.ScriptException;
|
||||||
import org.alfresco.service.cmr.repository.ScriptService;
|
import org.alfresco.service.cmr.repository.ScriptService;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Javascript Desktop Action Class
|
* Javascript Desktop Action Class
|
||||||
@@ -272,7 +273,8 @@ public class JavaScriptDesktopAction extends DesktopAction {
|
|||||||
|
|
||||||
// Start a transaction
|
// Start a transaction
|
||||||
|
|
||||||
params.getSession().beginTransaction(getTransactionService(), false);
|
TransactionService transService = getServiceRegistry().getTransactionService();
|
||||||
|
params.getSession().beginTransaction( transService, false);
|
||||||
|
|
||||||
// Access the script service
|
// Access the script service
|
||||||
|
|
||||||
@@ -291,7 +293,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
|
|||||||
|
|
||||||
// Start a transaction
|
// Start a transaction
|
||||||
|
|
||||||
params.getSession().beginTransaction(getTransactionService(), false);
|
params.getSession().beginTransaction( transService, false);
|
||||||
|
|
||||||
// Run the script
|
// Run the script
|
||||||
|
|
||||||
|
@@ -19,9 +19,10 @@ package org.alfresco.filesys.smb.server.repo.desk;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopAction;
|
import org.alfresco.filesys.alfresco.DesktopAction;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopParams;
|
import org.alfresco.filesys.alfresco.DesktopParams;
|
||||||
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
|
import org.alfresco.filesys.alfresco.DesktopResponse;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL Desktop Action Class
|
* URL Desktop Action Class
|
||||||
|
Reference in New Issue
Block a user