org.springframework.extensions.surf.task
Class ImportTask

java.lang.Object
  extended by org.springframework.extensions.surf.task.AbstractTask
      extended by org.springframework.extensions.surf.task.ImportTask
All Implemented Interfaces:
Task

public class ImportTask
extends AbstractTask

Task which can be used to import an archive from a remote location This task was a quick migration from the ScriptImporter bean which was previously used and, as such, does some fairly ridiculous things (like loading the entire byte array into memory). At present, the only archives being distributed are those directly from Alfresco and we know these to be pretty small. Thus, leaving this in for the time being. In short order, however, we should refactor to stream the byte array directly to a temp file on disk.

Author:
muzquiano

Field Summary
protected  Connector alfrescoConnector
           
protected static String DEFAULT_WEBAPP_ID
           
protected static org.apache.commons.logging.Log logger
           
protected  String storeId
           
protected  String url
           
protected  String webappId
           
 
Fields inherited from class org.springframework.extensions.surf.task.AbstractTask
creator, description, endTime, history, id, isCancelled, isError, isFinished, isRunning, isSuccess, name, progress, progressSize, startTime, status, throwable
 
Constructor Summary
ImportTask(String name)
           
 
Method Summary
 void cancel()
          Cancels the task
 void execute()
          Executes the task
 Connector getAlfrescoConnector()
          Gets the "alfresco" endpoint connector.
protected  void post(ZipFile zf, ZipEntry zipEntry, String uri)
           
 void setAlfrescoConnector(Connector alfrescoConnector)
          Sets the "alfresco" endpoint connector
 void setStoreId(String storeId)
          Sets the store id.
 void setUrl(String url)
           
 void setWebappId(String webappId)
           
protected  String writeToTempFile(byte[] array)
          Writes the contents of an array to a temporary file
 
Methods inherited from class org.springframework.extensions.surf.task.AbstractTask
getCreator, getDescription, getEndTime, getHistory, getId, getName, getProgress, getProgressSize, getStartTime, getStatus, getThrowable, increment, isCancelled, isError, isFinished, isRunning, isSuccess, setCreator, setDescription, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

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

DEFAULT_WEBAPP_ID

protected static String DEFAULT_WEBAPP_ID

alfrescoConnector

protected Connector alfrescoConnector

storeId

protected String storeId

webappId

protected String webappId

url

protected String url
Constructor Detail

ImportTask

public ImportTask(String name)
Method Detail

setAlfrescoConnector

public void setAlfrescoConnector(Connector alfrescoConnector)
Sets the "alfresco" endpoint connector

Parameters:
context - the new request context

getAlfrescoConnector

public Connector getAlfrescoConnector()
Gets the "alfresco" endpoint connector.

Returns:
the alfresco connector

setStoreId

public void setStoreId(String storeId)
Sets the store id.

Parameters:
storeId - the new store id

setWebappId

public void setWebappId(String webappId)

setUrl

public void setUrl(String url)

cancel

public void cancel()
Description copied from interface: Task
Cancels the task

Specified by:
cancel in interface Task
Specified by:
cancel in class AbstractTask

execute

public void execute()
             throws Throwable
Description copied from interface: Task
Executes the task

Specified by:
execute in interface Task
Specified by:
execute in class AbstractTask
Throws:
Throwable

post

protected void post(ZipFile zf,
                    ZipEntry zipEntry,
                    String uri)

writeToTempFile

protected String writeToTempFile(byte[] array)
Writes the contents of an array to a temporary file

Parameters:
array -
Returns:


Copyright © 2009 SpringSource, Inc. All Rights Reserved.