Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.flexdbserver.services.checkincheckout
Class CheckInServiceManager  view CheckInServiceManager download CheckInServiceManager.java

java.lang.Object
  extended bycom.flexstor.flexdbserver.services.ServiceManager
      extended bycom.flexstor.flexdbserver.services.checkincheckout.CheckInServiceManager
All Implemented Interfaces:
com.flexstor.common.constants.AssetRolesI, com.flexstor.common.threadmgr.ThreadConsumerI

public class CheckInServiceManager
extends com.flexstor.flexdbserver.services.ServiceManager
implements com.flexstor.common.constants.AssetRolesI

CheckInServiceManager provides functionality to control the sequencial execution of Services during the check-in process


Field Summary
private static int ASSETINFO_REGENERATED
           
private static int ASSETS_CHECKED_IN
          Global States
protected  boolean bContinue
           
protected  boolean bInterrupted
           
protected  com.flexstor.common.gateway.CheckOutCheckInGateway checkInGateway
           
protected  com.flexstor.common.data.ActionData data
           
private static int DATABASE_UPDATED
           
private static int DEFAULTVIEW_COPIED
           
private static int FILES_ROLLED_BACK
           
protected  java.lang.String fileSeparator
           
static java.lang.String IDENTIFIER
           
private static int LOWRES_UPDATED
           
private static int NEW_VERSION_COPIED
           
protected  int nGlobalState
           
private static int NOT_PROCESSED
          Record States
private static int ORIGINAL_MOVED
           
protected  java.lang.String sServerName
           
protected  java.lang.String sTempDir
           
private static int TEMPDIR_CLEANED
           
protected  java.util.Vector vBadRecords
           
protected  java.util.Vector vBadStates
           
protected  java.util.Vector vGoodRecords
           
protected  java.util.Vector vRecords
           
 
Fields inherited from class com.flexstor.flexdbserver.services.ServiceManager
 
Fields inherited from interface com.flexstor.common.constants.AssetRolesI
AUDIO, HIGHRES, LARGEST_ASSET_ROLE, LAYOUT, LOWRES, roles, THUMBNAIL, VIDEO
 
Constructor Summary
CheckInServiceManager(java.lang.String sIdentifier, com.flexstor.common.data.ActionData data, com.flexstor.common.threadmgr.ThreadCallbackI caller)
           
 
Method Summary
private  void checkInAssets(java.util.Vector vGoodRecords)
           
private  void cleanUpTempDir()
           
private  void copyDefaultViewToVersionDir(com.flexstor.common.data.AssetRecordData record)
           
private  void copyNewVersionIntoOriginal(com.flexstor.common.data.AssetRecordData record)
           
 com.flexstor.common.data.ActionResult execute()
          Main loop for sequencial execution of Services.
private  void executeService(java.lang.String sServiceName, com.flexstor.common.data.ActionData data)
           
private  com.flexstor.common.data.AssetRecordData getDefaultViewRecord(com.flexstor.common.data.AssetRecordData record)
           
protected  com.flexstor.common.data.ActionResult getResultObjectOnAbnormalEnding()
          This method need to be implemented for all subclasses to return the proper result object if the execution of the service manager ends abnormally (due to a non-catch exception inside the service manager.
private  boolean hasLowres(com.flexstor.common.data.AssetRecordData record)
           
private  boolean isInterrupted()
          Check if another thread request this thread to be interrupted.
private  void moveOriginalToVersionsDir(com.flexstor.common.data.AssetRecordData record)
           
private  void regenerateAssetsInfo(java.util.Vector vGoodRecords)
           
private  void rollBackDefaultView(boolean bProcessRecord, java.util.Vector vRecords, com.flexstor.common.data.AssetRecordData record)
           
private  void rollBackFiles(java.util.Vector vBadRecords, java.util.Vector vBadStates)
           
private  void rollBackLowres(boolean bProcessRecord, java.util.Vector vOriginals, java.util.Vector vVersions, com.flexstor.common.data.AssetRecordData record)
           
private  void rollBackOriginal(boolean bProcessRecord, java.util.Vector vRecords, java.util.Vector vLowres, com.flexstor.common.data.AssetRecordData record)
           
private  boolean setStatusToInProgress()
          Set the status in the database to in-progress
private  void updateDatabase(java.util.Vector vGoodRecords, java.util.Vector vBadRecords)
           
private  void updateLowres(com.flexstor.common.data.AssetRecordData record)
          This method regenerates the lowres file for a highres.
 
Methods inherited from class com.flexstor.flexdbserver.services.ServiceManager
abortManager, doService, doService, getResult, processService, startManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final java.lang.String IDENTIFIER
See Also:
Constant Field Values

NOT_PROCESSED

private static final int NOT_PROCESSED
Record States

See Also:
Constant Field Values

ORIGINAL_MOVED

private static final int ORIGINAL_MOVED
See Also:
Constant Field Values

NEW_VERSION_COPIED

private static final int NEW_VERSION_COPIED
See Also:
Constant Field Values

LOWRES_UPDATED

private static final int LOWRES_UPDATED
See Also:
Constant Field Values

DEFAULTVIEW_COPIED

private static final int DEFAULTVIEW_COPIED
See Also:
Constant Field Values

ASSETS_CHECKED_IN

private static final int ASSETS_CHECKED_IN
Global States

See Also:
Constant Field Values

ASSETINFO_REGENERATED

private static final int ASSETINFO_REGENERATED
See Also:
Constant Field Values

DATABASE_UPDATED

private static final int DATABASE_UPDATED
See Also:
Constant Field Values

FILES_ROLLED_BACK

private static final int FILES_ROLLED_BACK
See Also:
Constant Field Values

TEMPDIR_CLEANED

private static final int TEMPDIR_CLEANED
See Also:
Constant Field Values

sServerName

protected java.lang.String sServerName

data

protected com.flexstor.common.data.ActionData data

vRecords

protected java.util.Vector vRecords

vGoodRecords

protected java.util.Vector vGoodRecords

vBadRecords

protected java.util.Vector vBadRecords

vBadStates

protected java.util.Vector vBadStates

bContinue

protected boolean bContinue

bInterrupted

protected boolean bInterrupted

nGlobalState

protected int nGlobalState

fileSeparator

protected java.lang.String fileSeparator

sTempDir

protected java.lang.String sTempDir

checkInGateway

protected com.flexstor.common.gateway.CheckOutCheckInGateway checkInGateway
Constructor Detail

CheckInServiceManager

public CheckInServiceManager(java.lang.String sIdentifier,
                             com.flexstor.common.data.ActionData data,
                             com.flexstor.common.threadmgr.ThreadCallbackI caller)
Method Detail

execute

public com.flexstor.common.data.ActionResult execute()
                                              throws java.lang.InterruptedException
Main loop for sequencial execution of Services.


isInterrupted

private boolean isInterrupted()
Check if another thread request this thread to be interrupted.


getResultObjectOnAbnormalEnding

protected com.flexstor.common.data.ActionResult getResultObjectOnAbnormalEnding()
Description copied from class: com.flexstor.flexdbserver.services.ServiceManager
This method need to be implemented for all subclasses to return the proper result object if the execution of the service manager ends abnormally (due to a non-catch exception inside the service manager.


setStatusToInProgress

private boolean setStatusToInProgress()
                               throws com.flexstor.common.gateway.exceptions.TransactionFailedException
Set the status in the database to in-progress


moveOriginalToVersionsDir

private void moveOriginalToVersionsDir(com.flexstor.common.data.AssetRecordData record)

copyNewVersionIntoOriginal

private void copyNewVersionIntoOriginal(com.flexstor.common.data.AssetRecordData record)

updateLowres

private void updateLowres(com.flexstor.common.data.AssetRecordData record)
                   throws com.flexstor.common.gateway.exceptions.TransactionFailedException
This method regenerates the lowres file for a highres. For this, we first query the database to find out if this asset has a lowres child; if it does, then we call the LowresService to recreate the lowres asset. NOTE: The service takes as input the highres asset, not the lowres child.


copyDefaultViewToVersionDir

private void copyDefaultViewToVersionDir(com.flexstor.common.data.AssetRecordData record)
                                  throws com.flexstor.common.gateway.exceptions.TransactionFailedException

rollBackFiles

private void rollBackFiles(java.util.Vector vBadRecords,
                           java.util.Vector vBadStates)

rollBackOriginal

private void rollBackOriginal(boolean bProcessRecord,
                              java.util.Vector vRecords,
                              java.util.Vector vLowres,
                              com.flexstor.common.data.AssetRecordData record)

rollBackLowres

private void rollBackLowres(boolean bProcessRecord,
                            java.util.Vector vOriginals,
                            java.util.Vector vVersions,
                            com.flexstor.common.data.AssetRecordData record)

rollBackDefaultView

private void rollBackDefaultView(boolean bProcessRecord,
                                 java.util.Vector vRecords,
                                 com.flexstor.common.data.AssetRecordData record)

regenerateAssetsInfo

private void regenerateAssetsInfo(java.util.Vector vGoodRecords)

checkInAssets

private void checkInAssets(java.util.Vector vGoodRecords)
                    throws com.flexstor.common.gateway.exceptions.TransactionFailedException

updateDatabase

private void updateDatabase(java.util.Vector vGoodRecords,
                            java.util.Vector vBadRecords)
                     throws com.flexstor.common.gateway.exceptions.TransactionFailedException

cleanUpTempDir

private void cleanUpTempDir()

executeService

private void executeService(java.lang.String sServiceName,
                            com.flexstor.common.data.ActionData data)

getDefaultViewRecord

private com.flexstor.common.data.AssetRecordData getDefaultViewRecord(com.flexstor.common.data.AssetRecordData record)

hasLowres

private boolean hasLowres(com.flexstor.common.data.AssetRecordData record)