org.alfresco.repo.bulkimport.impl
Class AbstractBulkFilesystemImporter

java.lang.Object
  extended by org.alfresco.repo.bulkimport.impl.AbstractBulkFilesystemImporter
All Implemented Interfaces:
BulkFilesystemImporter, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
MultiThreadedBulkFilesystemImporter

public abstract class AbstractBulkFilesystemImporter
extends java.lang.Object
implements BulkFilesystemImporter, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

Since:
4.0

Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  BehaviourFilter behaviourFilter
           
protected  DirectoryAnalyser directoryAnalyser
           
protected  FileFolderService fileFolderService
           
protected  BulkImportStatusImpl importStatus
           
protected  JobLockService jobLockService
           
protected static org.apache.commons.logging.Log logger
           
protected  org.alfresco.service.cmr.security.PermissionService permissionService
           
protected  RuleService ruleService
           
protected  RetryingTransactionHelper transactionHelper
           
protected  TransactionService transactionService
           
 
Constructor Summary
AbstractBulkFilesystemImporter()
           
 
Method Summary
 void afterPropertiesSet()
           
 void asyncBulkImport(BulkImportParameters bulkImportParameters, NodeImporter nodeImporter)
          Initiates a bulk filesystem import asynchronously i.e.
 void bulkImport(BulkImportParameters bulkImportParameters, NodeImporter nodeImporter)
          Initiates a bulk filesystem import.
protected abstract  void bulkImportImpl(BulkImportParameters bulkImportParameters, NodeImporter nodeImporter, java.lang.String lockToken)
           
protected  java.lang.String getFileName(java.io.File file)
           
protected  java.lang.String getLock(long time)
          Attempts to get the lock.
protected  java.lang.String getLockToken()
           
protected  java.lang.String getRepositoryPath(org.alfresco.service.cmr.repository.NodeRef nodeRef)
           
 BulkImportStatus getStatus()
           
protected  java.lang.String mapToString(java.util.Map map)
           
protected  void refreshLock(java.lang.String lockToken, long time)
          Attempts to get the lock.
protected  void releaseLock(java.lang.String lockToken)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setBehaviourFilter(BehaviourFilter behaviourFilter)
           
 void setDirectoryAnalyser(DirectoryAnalyser directoryAnalyser)
           
 void setFileFolderService(FileFolderService fileFolderService)
           
 void setImportStatus(BulkImportStatusImpl importStatus)
           
 void setJobLockService(JobLockService jobLockService)
           
 void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
           
 void setRuleService(RuleService ruleService)
           
 void setTransactionService(TransactionService transactionService)
           
protected  void validateNodeRefIsWritableSpace(org.alfresco.service.cmr.repository.NodeRef target)
           
 void validateSourceIsReadableDirectory(java.io.File source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

fileFolderService

protected FileFolderService fileFolderService

transactionService

protected TransactionService transactionService

permissionService

protected org.alfresco.service.cmr.security.PermissionService permissionService

transactionHelper

protected RetryingTransactionHelper transactionHelper

ruleService

protected RuleService ruleService

importStatus

protected BulkImportStatusImpl importStatus

directoryAnalyser

protected DirectoryAnalyser directoryAnalyser

jobLockService

protected JobLockService jobLockService

behaviourFilter

protected BehaviourFilter behaviourFilter
Constructor Detail

AbstractBulkFilesystemImporter

public AbstractBulkFilesystemImporter()
Method Detail

setRuleService

public void setRuleService(RuleService ruleService)

setBehaviourFilter

public void setBehaviourFilter(BehaviourFilter behaviourFilter)

setJobLockService

public void setJobLockService(JobLockService jobLockService)

setImportStatus

public void setImportStatus(BulkImportStatusImpl importStatus)

setDirectoryAnalyser

public final void setDirectoryAnalyser(DirectoryAnalyser directoryAnalyser)

setFileFolderService

public void setFileFolderService(FileFolderService fileFolderService)

setTransactionService

public void setTransactionService(TransactionService transactionService)

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)

getStatus

public final BulkImportStatus getStatus()
Specified by:
getStatus in interface BulkFilesystemImporter
Returns:
A status object that describes the current state of the bulk filesystem importer.
See Also:
org.alfresco.extension.bulkfilesystemimport.BulkFilesystemImporter#getStatus()

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

bulkImportImpl

protected abstract void bulkImportImpl(BulkImportParameters bulkImportParameters,
                                       NodeImporter nodeImporter,
                                       java.lang.String lockToken)

getLock

protected java.lang.String getLock(long time)
Attempts to get the lock. If the lock couldn't be taken, then null is returned.

Returns:
Returns the lock token or null

refreshLock

protected void refreshLock(java.lang.String lockToken,
                           long time)
Attempts to get the lock. If it fails, the current transaction is marked for rollback.


releaseLock

protected void releaseLock(java.lang.String lockToken)

mapToString

protected final java.lang.String mapToString(java.util.Map map)

getRepositoryPath

protected final java.lang.String getRepositoryPath(org.alfresco.service.cmr.repository.NodeRef nodeRef)

validateNodeRefIsWritableSpace

protected final void validateNodeRefIsWritableSpace(org.alfresco.service.cmr.repository.NodeRef target)

getFileName

protected java.lang.String getFileName(java.io.File file)

getLockToken

protected java.lang.String getLockToken()

validateSourceIsReadableDirectory

public void validateSourceIsReadableDirectory(java.io.File source)

asyncBulkImport

public void asyncBulkImport(BulkImportParameters bulkImportParameters,
                            NodeImporter nodeImporter)
Description copied from interface: BulkFilesystemImporter
Initiates a bulk filesystem import asynchronously i.e. in a background thread. Note: getStatus().inProgress() must be false prior to calling this method or an Exception will be thrown.

Specified by:
asyncBulkImport in interface BulkFilesystemImporter

bulkImport

public void bulkImport(BulkImportParameters bulkImportParameters,
                       NodeImporter nodeImporter)
Description copied from interface: BulkFilesystemImporter
Initiates a bulk filesystem import. Note: getStatus().inProgress() must be false prior to calling this method or an Exception will be thrown.

Specified by:
bulkImport in interface BulkFilesystemImporter
See Also:
org.alfresco.extension.bulkfilesystemimport.BulkFilesystemImporter#bulkImport(java.io.File, org.alfresco.service.cmr.repository.NodeRef, boolean)

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.