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

Quick Search    Search Deep

com.flexstor.flexdbserver.services.asset
Class DBUpdateService  view DBUpdateService download DBUpdateService.java

java.lang.Object
  extended bycom.flexstor.flexdbserver.services.asset.DBUpdateService
All Implemented Interfaces:
com.flexstor.flexdbserver.services.Service

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

DBUpdateService

Inserts or updates asset information in the database, creating the bucket structure if necessary. The service first calls the DefaultViewService to assign a default displayable asset for each one (if an asset has a default view already assigned, this service will not assign a new one).
This service is usually called during imports (from hot directories, from GUIs and html uploads) and also when regenerating the thumbnail of an asset being checked in. Because of this, the DBUpdate Service can handle the insert and updates of buckets, elements and assets.
The DB Update service delegates all the database operations to the DisguiseRecordPersist bean.
To determine whether an asset needs to be updated or inserted, the bean first looks if the asset has a record id set in the data object; if it does, an update of such asset is performed, otherwise an insert is done.
For buckets and elements the first step is to retrieve from the database its record id based on the meta data set in the data object (NOTE: this operation is performed once outside the DB Update Service- by the Import Processor -and later checked again by the DB Update Service). Later the DisguiseRecordPersist bean will check if a record id has been set for the bucket or element in the data object; if true it will use it to query the database and make sure it is already a row in the table (a record id could be set by some other process without updating the database). If the record id is already in the database an update is performed. In cases where the data object does not contain a record id or when the record id in the data object does not exits in the bucket or element table, an insert is performed.
Updates are performed for buckets and elements only if meta data is available.
NOTE: During a hot directory import to a bucket that already exists in the database, the DisguiseRecordPersist bean updates the row in the database with meta data that is already set. This is done because the import processor adds the sub-directories name as fields in the buckets' data object; later the DisguiseRecordPersist bean checks if there is at least a field in the data object, and if so, uses it to update the bucket.

Configurable Properties in roletype_services.config

explicit_rollback_segment: If enabled, will explicitly allocate a dedicated rollback segment in the database for this transaction (optional; defaults to false).
Legal values: true or false

Input Data Object

com.flexstor.common.importprocessor.ImportData

Output Data Object

com.flexstor.common.importprocessor.ImportResult

Programmable Properties (passed inside data object)

Global Properties (apply to all assets)
bUpdateAssets: Signals whether the assets are for inserting or updating. Set in ImportData.setUpdate( boolean value ) (defaults to false).
Data type: boolean
Legal values: true or false


Field Summary
protected  com.flexstor.flexdbserver.services.ServiceContext context
           
protected  com.flexstor.common.importprocessor.ImportData data
           
protected  int id
           
static java.lang.String IDENTIFIER
           
protected  com.flexstor.common.services.ServiceBrokerI serviceBroker
           
private  java.lang.String sThisService
           
 
Constructor Summary
DBUpdateService()
           
 
Method Summary
 com.flexstor.common.data.ActionResult go()
          Start of the DBUpdateService.
private  com.flexstor.common.importprocessor.ImportResult importAssets()
           
 void initData(com.flexstor.common.data.ActionData actionData)
          Data initialization method called at the beginning of the service.
private  com.flexstor.common.importprocessor.ImportResult setDefaultViewAssets()
           
 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.
 
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

data

protected com.flexstor.common.importprocessor.ImportData data

sThisService

private java.lang.String sThisService

context

protected com.flexstor.flexdbserver.services.ServiceContext context

serviceBroker

protected com.flexstor.common.services.ServiceBrokerI serviceBroker

id

protected int id
Constructor Detail

DBUpdateService

public DBUpdateService()
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 actionData)
Data initialization method called at the beginning of the service.

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

go

public com.flexstor.common.data.ActionResult go()
Start of the DBUpdateService.

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

setDefaultViewAssets

private com.flexstor.common.importprocessor.ImportResult setDefaultViewAssets()

importAssets

private com.flexstor.common.importprocessor.ImportResult importAssets()