public abstract class BaseSynchroService extends AbstractSynchroService<BaseSynchroContext>
AbstractSynchroService
.Modifier and Type | Class and Description |
---|---|
class |
BaseSynchroService.FileInfoPathComparator |
Modifier and Type | Field and Description |
---|---|
static Logger |
logger |
static String |
SERVLET_RELATIVE_PATH |
Constructor and Description |
---|
BaseSynchroService(HttpClientService httpClientService,
File baseFolderFile) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyAction(BaseSynchroContext context,
String path,
AbstractSynchroContext.SynchroAction action)
Apply the action required for the path.
|
protected void |
applyActions(BaseSynchroContext context)
Call
#applyAction(AbstractSynchroContext, String, SynchroAction) for each path with a required action. |
protected String |
buildConflictPath(String path) |
File |
buildLocalFile(FileInfo fileInfo) |
File |
buildLocalFile(String relativePath) |
String |
buildURL(String url) |
protected boolean |
copyDistantToLocal(BaseSynchroContext context,
FileInfo distantInfo) |
protected boolean |
copyLocalToDistant(BaseSynchroContext context,
FileInfo localInfo) |
protected boolean |
copyLocalToDistant(BaseSynchroContext context,
FileInfo localInfo,
int retry) |
protected void |
deleteDistantDirectories(BaseSynchroContext context) |
protected boolean |
deleteDistantFile(BaseSynchroContext context,
FileInfo distantInfo) |
protected void |
deleteLocalDirectories(BaseSynchroContext context) |
protected boolean |
deleteLocalFile(BaseSynchroContext context,
FileInfo localInfo) |
File |
getBaseFolderFile() |
String |
getDistantName()
Get the name of the distant side.
|
HttpClientService |
getHttpClientService() |
protected void |
initializeContext(BaseSynchroContext context,
Object previousState)
Initialize the context.
|
boolean |
isManageDeletedFiles() |
boolean |
isRefreshAll() |
boolean |
isSplitBigFiles() |
protected FileInfo |
moveLocalFile(BaseSynchroContext context,
FileInfo localInfo,
String newPath) |
BaseSynchroContext |
newSynchroContext()
Instanciate a context for ONE synchro run.
|
protected void |
onActionsApplied(BaseSynchroContext context)
Called when all actions are applied.
|
protected void |
onFatalException(BaseSynchroContext context,
SynchroFatalException ex)
Called when an
SynchroFatalException is thrown during the synchro process. |
protected void |
onNonFatalException(BaseSynchroContext context,
SynchroNonFatalException ex,
String currentFilePath)
Called when an
SynchroNonFatalException is thrown during the synchro process. |
protected void |
onUncaughtException(BaseSynchroContext context,
Throwable ex)
Called when an exception is thrown during the synchro process.
|
void |
pushContext(String context) |
boolean |
sendCommand(String paramName,
String paramValue) |
void |
sendRefresh() |
void |
setManageDeletedFiles(boolean manageDeletedFiles) |
void |
setRefreshAll(boolean refreshAll) |
void |
setSplitBigFiles(boolean splitBigFiles) |
defineAction, defineActions, getLocalName, onActionsDefined, onShutdown, synchronize
public static Logger logger
public static final String SERVLET_RELATIVE_PATH
public BaseSynchroService(HttpClientService httpClientService, File baseFolderFile)
public boolean isManageDeletedFiles()
public void setManageDeletedFiles(boolean manageDeletedFiles)
public boolean isSplitBigFiles()
public void setSplitBigFiles(boolean splitBigFiles)
public File getBaseFolderFile()
public String getDistantName()
AbstractSynchroService
getDistantName
in class AbstractSynchroService<BaseSynchroContext>
public HttpClientService getHttpClientService()
public BaseSynchroContext newSynchroContext()
AbstractSynchroService
newSynchroContext
in class AbstractSynchroService<BaseSynchroContext>
AbstractSynchroContext
specialized for the current AbstractSynchroService
implementation.protected void initializeContext(BaseSynchroContext context, Object previousState) throws SynchroFatalException
AbstractSynchroService
initializeContext
in class AbstractSynchroService<BaseSynchroContext>
SynchroFatalException
protected void applyActions(BaseSynchroContext context)
AbstractSynchroService
#applyAction(AbstractSynchroContext, String, SynchroAction)
for each path with a required action.applyActions
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
protected void applyAction(BaseSynchroContext context, String path, AbstractSynchroContext.SynchroAction action) throws SynchroNonFatalException
AbstractSynchroService
applyAction
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
SynchroNonFatalException
protected boolean copyLocalToDistant(BaseSynchroContext context, FileInfo localInfo) throws SynchroNonFatalException
SynchroNonFatalException
protected boolean copyLocalToDistant(BaseSynchroContext context, FileInfo localInfo, int retry) throws SynchroNonFatalException
SynchroNonFatalException
protected boolean copyDistantToLocal(BaseSynchroContext context, FileInfo distantInfo) throws SynchroNonFatalException
SynchroNonFatalException
protected boolean deleteLocalFile(BaseSynchroContext context, FileInfo localInfo)
protected void deleteLocalDirectories(BaseSynchroContext context)
protected boolean deleteDistantFile(BaseSynchroContext context, FileInfo distantInfo)
protected void deleteDistantDirectories(BaseSynchroContext context)
protected FileInfo moveLocalFile(BaseSynchroContext context, FileInfo localInfo, String newPath)
public void pushContext(String context)
public void sendRefresh()
protected void onActionsApplied(BaseSynchroContext context)
AbstractSynchroService
onActionsApplied
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
protected void onNonFatalException(BaseSynchroContext context, SynchroNonFatalException ex, String currentFilePath)
AbstractSynchroService
SynchroNonFatalException
is thrown during the synchro process. Only the current file will be skipped.onNonFatalException
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
protected void onFatalException(BaseSynchroContext context, SynchroFatalException ex)
AbstractSynchroService
SynchroFatalException
is thrown during the synchro process. This is fatal for ONE run.onFatalException
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
protected void onUncaughtException(BaseSynchroContext context, Throwable ex)
AbstractSynchroService
onUncaughtException
in class AbstractSynchroService<BaseSynchroContext>
context
- the current AbstractSynchroContext
. Can be null
if the exception is thrown during the call of AbstractSynchroService.newSynchroContext()
.public boolean isRefreshAll()
public void setRefreshAll(boolean refreshAll)
Copyright © 2012-2018. All Rights Reserved.