java.lang.Object
com.flexstor.flexdbserver.services.asset.ImageConvertService
- All Implemented Interfaces:
- com.flexstor.flexdbserver.services.Service
- public class ImageConvertService
- extends java.lang.Object
- implements com.flexstor.flexdbserver.services.Service
AlchemyConvertService
Invokes the Alchemy utility for the files specified and creates thumbnail images for each of them.
Also obtains display information about the input file.
Different image convert applications can be plugged into this service.
The service requires the following key/value pair lines as output of the command line
application being invoked (this is an example):
Type: JPEG
Mode: Truecolour
Width: 640
Height: 430
BitsPerPixel: 24
DPIX: 72
DPIY: 72
FileSize: 203189
The result must be sent to standard output.
The keys do not required to be with the capitalization shown.
Make sure a colon is used, not an equal sign.
Note that DPIX and DPIY can be substituted with DPCX and DPCY if this values are given in
centimeters rather than inches.
Configurable Properties in roletype_services.config
In/Out Properties for Assets
Attribute |
IN | OUT | Default IN | Default OUT |
ROLE |
  |   | ALL |   |
Highres | X | X |   |   |
Lowres | X | X |   |   |
Thumbnail | X | X |   | X |
Layout | X | X |   |   |
Video |   |   |   |   |
Audio |   |   |   |   |
TYPE |
X | X | ALL |   |
FLAG |
PARENT | X | X |   |   |
CHLDREN | X | X |   | X |
ALL | X | X |   |   |
TEMP_PARENT | X | X |   |   |
TEMP_CHILDREN | X | X |   |   |
TEMP_ALL | X | X |   |   |
configfile: Path to configuration file holding Alchemy related parameters
(optional; defaults to conversion.cfg file for the hot directory).
Legal values: Full path to configuration file
destination: Path for output thumbnail file (optional; defaults to thumbtarget
property in the input control [*.ctl] file).
Legal values: Full path to output directory
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)
"intervaltimer_timeout" :
A user-specified property in roletype_services.config that defines the timeout period for
the watch-dog timer that interrupts the Alchemy process if it hangs.
Data type: int
Legal values: time (seconds)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IDENTIFIER
public static final java.lang.String IDENTIFIER
- See Also:
- Constant Field Values
CONVERT
public static final java.lang.String CONVERT
- See Also:
- Constant Field Values
sVersion
public static java.lang.String sVersion
context
protected com.flexstor.flexdbserver.services.ServiceContext context
fileSeparator
protected java.lang.String fileSeparator
id
protected int id
sThisService
private java.lang.String sThisService
sFormat
private java.lang.String sFormat
sThumbLocation
private java.lang.String sThumbLocation
sThumbServer
private java.lang.String sThumbServer
sThumbName
private java.lang.String sThumbName
sThumbSize
private java.lang.String sThumbSize
sThumbPath
private java.lang.String sThumbPath
sPrimaryFormat
private java.lang.String sPrimaryFormat
sPrimaryDPIX
private java.lang.String sPrimaryDPIX
sPrimaryDPIY
private java.lang.String sPrimaryDPIY
sPrimaryWidth
private java.lang.String sPrimaryWidth
sPrimaryHeight
private java.lang.String sPrimaryHeight
sPrimaryColorDepth
private java.lang.String sPrimaryColorDepth
sPrimaryColorSpace
private java.lang.String sPrimaryColorSpace
sPrimaryFileSize
private java.lang.String sPrimaryFileSize
refConversionOptions
private com.flexstor.flexdbserver.importprocessor.ConversionOptions refConversionOptions
nOemAlchemy
private int nOemAlchemy
sTranslator
private java.lang.String sTranslator
sTargetPath
private java.lang.String sTargetPath
sConfigFile
private java.lang.String sConfigFile
successful
protected boolean successful
bUpdateTargetPath
protected boolean bUpdateTargetPath
sExtType
protected java.lang.String sExtType
refCtlData
protected com.flexstor.common.importprocessor.ImportCtlData refCtlData
refImportData
protected com.flexstor.common.importprocessor.ImportData refImportData
ImageConvertService
public ImageConvertService()
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)
- A data initialization method called at the beginning of the service.
The input argument, ActionData must be cast into its subclass, ConvertData
in order to extract the ConvertService specific data from it.
- Specified by:
initData
in interface com.flexstor.flexdbserver.services.Service
go
public com.flexstor.common.data.ActionResult go()
- The start of the Convert Service.
- Specified by:
go
in interface com.flexstor.flexdbserver.services.Service
convertAsset
protected boolean convertAsset(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData refSourceAsset,
com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData targetAsset)
- Convert & Get Info
buildCompositeDir
protected java.lang.String buildCompositeDir(java.lang.String sLocation,
java.lang.String sRootPath,
java.lang.String sListBasePath)
- Build up the directory from the element & root paths specified.
readCfgFile
private boolean readCfgFile()
processElement
public boolean processElement(java.lang.String sAssetType,
java.lang.String sSourcePath)
convertImage
private boolean convertImage(java.lang.String imagePath,
java.lang.String sAssetType)
- Convert the specified image to a thumbnail
removeOption
private java.lang.String removeOption(java.lang.String sOptions,
java.lang.String sOptionToRemove)
getExtensionType
protected java.lang.String getExtensionType(java.lang.String sInputType)
createDir
protected boolean createDir(com.flexstor.common.io.xfile.FlexXFile xOutputPath)
stringToFloat
private float stringToFloat(java.lang.String theString)
stringToLong
private long stringToLong(java.lang.String theString)
executeConversion
protected boolean executeConversion(java.lang.String[] saCommandLine)
- Do the actual image conversion creating the thumbnail.
getExtensionFrom
protected java.lang.String getExtensionFrom(java.lang.String sPath)
getNameNoPath
protected java.lang.String getNameNoPath(java.lang.String sFullPath)
checkFileType
protected boolean checkFileType(java.lang.String sExtension,
java.lang.String sType)
getRoleId
private int getRoleId(java.lang.String sRole)
hasRole
private com.flexstor.common.data.ejb.disguiserecord.AssetRoleData hasRole(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset)
getFormat
public java.lang.String getFormat()
getThumbLocation
public java.lang.String getThumbLocation()
getThumbServer
public java.lang.String getThumbServer()
getThumbName
public java.lang.String getThumbName()
getThumbSize
public java.lang.String getThumbSize()
getPrimaryFormat
public java.lang.String getPrimaryFormat()
getPrimaryWidth
public java.lang.String getPrimaryWidth()
getPrimaryHeight
public java.lang.String getPrimaryHeight()
getPrimaryDPIX
public java.lang.String getPrimaryDPIX()
getPrimaryDPIY
public java.lang.String getPrimaryDPIY()
getPrimaryColorDepth
public java.lang.String getPrimaryColorDepth()
getPrimaryColorSpace
public java.lang.String getPrimaryColorSpace()
getPrimaryFileSize
public java.lang.String getPrimaryFileSize()