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

Quick Search    Search Deep

com.flexstor.flexdbserver.services.linkupdate
Class LinkUpdateService  view LinkUpdateService download LinkUpdateService.java

java.lang.Object
  extended bycom.flexstor.flexdbserver.services.linkupdate.LinkUpdateService
All Implemented Interfaces:
com.flexstor.flexdbserver.services.Service

public class LinkUpdateService
extends java.lang.Object
implements com.flexstor.flexdbserver.services.Service

LinkUpdateService

The Link Update Service run during the import of new assets into FLEXSTOR.db containing links to other assets in the database. The service is intended to be a generic service that can be used in any import or output process.
This service provides the following functions:

1) Checks to see if the files contained in the import data object are already in the system.
Checking is done by filename only. Check is done for assets already cataloged.
2) Updates ImportData to reflect the results of the operation above: creates new elements
for new assets, if required, and updates asset information for existing assets; or remove
those elements for which one of the links could not be found.
3) For files not already in the system, processes a failure using FLEXdbServer standard error
handling mechanism and possibly send an email to an assigned user indicating that some of
the files are not present.

The following rules apply when defining arguments:

- Properties defined in roletype_services.config override properties already defined in services.config.
- Properties defined in either custom_process.xml or FLEXsi xml overrides properties already defined in services.config.


If run as an import service, this service must be defined in the pre-services section of the control file after both the Typer and RoleAssign services have been invoked. This convention guarantees that assets of different types, linked to other assets in the data object, are processed together, before the splitting of the data object by type and role.

Input Data Object

com.flexstor.common.data.ActionData or com.flexstor.common.importprocessor.ImportData

Output Data Object

com.flexstor.common.data.ActionResult containing a com.flexstor.common.importprocessor.ImportData object.

Configurable Properties (in services.config or roletype_services.config) and
Programmable Properties (passed inside data object )

Global Properties (apply to all assets)

inrole: The role of the assets to be linked to the primary parent asset.
Data type: String
Legal values: One of the following: HIGHRES, LOWRES, THUMBNAIL, LAYOUT, AUDIO, VIDEO or ALL

intype: The type of the assets to be linked to the primary parent asset.
Data type: String
Legal values: A type as defined in typerdat.txt

inflag: The flag of the assets to be linked to the primary parent asset.
Data type: String
Legal values: One of the following: PARENT, TEMP_PARENT, CHILDREN, TEMP_CHILDREN, ALL, TEMP_ALL

disguiseList: Disguises in which to check for the existence of a file. If multiple disguises are specified they are checked in the order in which they are listed.
Data type: String
Legal values: comma-separated list of disguise labels or ids

createNewElement: If this flag is set to true and an asset is not found in the system
(but is part of the current ImportData object) a new element is created and the asset
imported as a primary asset; the linked assets will then be a logical link to this asset
in the database. If the flag is set to false the asset is removed from the ImportData
object and added to the error list. If the flag is set to false and the failing asset is
a child asset then the entire element is removed and placed in a error state. This assures
that only complete collections are imported into the system.
Data type: boolean
Legal values: true or false


Field Summary
private  boolean bCreateNewElement
           
private  boolean bIsImportData
           
protected  com.flexstor.flexdbserver.services.ServiceContext context
           
protected  java.lang.String fileSeparator
           
protected  int id
           
static java.lang.String IDENTIFIER
           
private  com.flexstor.common.importprocessor.ImportData importData
           
private  java.lang.String sDisguiseList
           
private  java.util.Set sFailedParent
           
private  java.lang.String sThisService
           
 
Constructor Summary
LinkUpdateService()
           
 
Method Summary
private  com.flexstor.common.importprocessor.ImportData createImportData(com.flexstor.common.data.ActionData data)
          Creates a ImportData object based on the ActionData object passed in the argument
private  java.util.Vector getImportAssets()
          Returns a Vector with the DisguiseAssetRecordData objects in the ImportData object
private  com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData getPrimaryParent(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset)
           
 com.flexstor.common.data.ActionResult go()
          This methods carries the load of the business logic for the service.
 void initData(com.flexstor.common.data.ActionData data)
          A data initialization method called at the beginning of the service.
private  void logError(java.lang.String sErrorMsg)
           
private  void logFailedAssets(java.util.Vector vUnmatched, java.lang.String sErrorMsg)
          Log error including full path to unavailable assets Send an email to the user specified in the argument indicating that the new record could not be created because one of its link is not already in the system.
private  void removeElement(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData parent)
           
private  void removePrimaryParents(java.util.Vector vUnmatched)
          For each asset in the unmatched list, find its primary parent and remove it from the ImportData object.
 void setServiceContext(com.flexstor.flexdbserver.services.ServiceContext context)
          Calls before the service is initialized (before initData is called) to pass information about the environment in which the service is running.
private  void updateImportData(java.util.Vector vAssets)
          After the search, the asset records are already updated with the server, location and filename of its match.
private  int[] validateDisguises(java.lang.String sDisguiseList)
          Takes the disguiseList argument (from the services.config, *.ctl or roletype_services.config), parses it and validates each disguise (label or id) against the database list.
 
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

context

protected com.flexstor.flexdbserver.services.ServiceContext context

id

protected int id

fileSeparator

protected java.lang.String fileSeparator

importData

private com.flexstor.common.importprocessor.ImportData importData

sThisService

private java.lang.String sThisService

bIsImportData

private boolean bIsImportData

bCreateNewElement

private boolean bCreateNewElement

sFailedParent

private java.util.Set sFailedParent

sDisguiseList

private java.lang.String sDisguiseList
Constructor Detail

LinkUpdateService

public LinkUpdateService()
Method Detail

setServiceContext

public void setServiceContext(com.flexstor.flexdbserver.services.ServiceContext context)
Calls before the service is initialized (before initData is called) to pass information about the environment in which the service is running. This environment consists of information about the properties set for the service in one of these files (services.config, roletype_services.config, or *.ctl), plus methods to access other information such as an instance of the service broker to invoke other services, the transaction id for the service, file separator character and local path for the installation directory and configuration directory.

Specified by:
setServiceContext in interface com.flexstor.flexdbserver.services.Service

initData

public void initData(com.flexstor.common.data.ActionData data)
Description copied from interface: com.flexstor.flexdbserver.services.Service
A data initialization method called at the beginning of the service. Not business logic, relevant to the functionality of the service, should be added here, other than initializing some variables, etc.

Specified by:
initData in interface com.flexstor.flexdbserver.services.Service

go

public com.flexstor.common.data.ActionResult go()
Description copied from interface: com.flexstor.flexdbserver.services.Service
This methods carries the load of the business logic for the service.

Specified by:
go in interface com.flexstor.flexdbserver.services.Service

createImportData

private com.flexstor.common.importprocessor.ImportData createImportData(com.flexstor.common.data.ActionData data)
Creates a ImportData object based on the ActionData object passed in the argument


getImportAssets

private java.util.Vector getImportAssets()
Returns a Vector with the DisguiseAssetRecordData objects in the ImportData object


validateDisguises

private int[] validateDisguises(java.lang.String sDisguiseList)
Takes the disguiseList argument (from the services.config, *.ctl or roletype_services.config), parses it and validates each disguise (label or id) against the database list. Return only those that passed validation; for failed ones, log an error.


updateImportData

private void updateImportData(java.util.Vector vAssets)
After the search, the asset records are already updated with the server, location and filename of its match. What is left for this method to do is go through the primary parents and make sure their path is also updated (if CreateNewElement is true) or they are removed from the ImportData object (if CreateNewElement is false)


removePrimaryParents

private void removePrimaryParents(java.util.Vector vUnmatched)
For each asset in the unmatched list, find its primary parent and remove it from the ImportData object.


removeElement

private void removeElement(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData parent)

getPrimaryParent

private com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData getPrimaryParent(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset)

logFailedAssets

private void logFailedAssets(java.util.Vector vUnmatched,
                             java.lang.String sErrorMsg)
Log error including full path to unavailable assets Send an email to the user specified in the argument indicating that the new record could not be created because one of its link is not already in the system.


logError

private void logError(java.lang.String sErrorMsg)