|
|||||||||
Home >> All >> com >> flexstor >> remote >> [ script overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
com.flexstor.remote.script
Class ScriptService

java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.flexstor.common.services.remote.FlexRemoteService
com.flexstor.remote.script.ScriptService
- All Implemented Interfaces:
- java.rmi.Remote, com.flexstor.common.services.RMIServiceI, java.io.Serializable
- public class ScriptService
- extends com.flexstor.common.services.remote.FlexRemoteService
- implements com.flexstor.common.services.RMIServiceI
- extends com.flexstor.common.services.remote.FlexRemoteService
ScriptService
A remote Service which is used to obtain the data available in the ImportData structure. The data is used to create new Assets (Thumbnail, composite images etc..) and Asset Records in the database. The data can be obtained one of two ways.Configurable properties in roletype_services.config:Input File: This input file is a text file containing the data from the ImportData structure. This file can be read by a script or application which generates new Assets. The script is then required to generate an output file that this Script Service will read to update the ImportData object before it is sent back for a database update.
AppleScript: An Applescript Dictionary is generated for this ScriptService (by way of the ScriptableFrame class). The data stored in the ImportData object can be obtained and manipulated through AppleScript calls. No output file is needed when accessing the data through AppleScript
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 |   |   |
Configurable properties in services.config:
objectname: The remote service class
Legal values: ScriptServiceservername: This is the fully qualified server name or ip address.
Legal values: IE: 200.100.121.56, foo, foo.company.com
scriptname: The name of an application or script which ScriptService should launch
Legal values: any executable
accessmethod: Defines the method used to update the ImportData object
Legal values: applescript, file
serverport: Defines the method used to obtain a reference to this service
Legal values: This must match the port specified for the Remote Asset Server (a command line argument) which will be used to run this service. Default is 1099.
updatemethod: Defines the method used to obtain a reference to this service
Legal values: rmi
max_instances: When set to 1, prevents ScriptService from running more than one instance of your script at time
Legal values: 1 is the recommended value for ScriptService
io_dir: This argument allows the user to define a directory where all files associated with this service can be found. The
.in file is written here by ScriptService. Your script should write the .out file here as well. If this argument is not specified the directory where the RemoteAssetServer was executed from will be used.
Legal values: This argument can be a relative path, or an absolute path.
command_line: Command line arguments can be sent to the executable. Arguments should be delimited by a caret. The value specified in scriptname is always the first argument in the argument array passed to your executable.
Example: scriptname=d:/remote_asset_server/services/myService.exe command_line=/installpath /^-v argv[0] = d:/remote_asset_server/services/myService.exe argv[1] = /installpath/ argv[2] = -v
debug: When set to true a debug log is generated in the current directory (or the directory defined in io_dir).
Legal values: true/false/0-9
Input Data Object
com.flexstor.common.importprocessor.ImportData
Output Data Object
com.flexstor.common.importprocessor.ImportResultThis class needs to extend UnicastRemoteObject so it can be made available through RMI. All methods in this class must throw RemoteException as a result.
RMIServiceI defines some methods that are required for interaction with Flexstor.db
Fields inherited from class java.rmi.server.UnicastRemoteObject |
|
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary | |
ScriptService()
|
Method Summary | |
private void |
addAssetData(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset,
java.util.Hashtable assetData)
|
private void |
addAudioRoleData(com.flexstor.common.data.ejb.disguiserecord.AudioRoleData theRole,
java.util.Hashtable assetData)
|
private void |
addImageRoleData(com.flexstor.common.data.ejb.disguiserecord.ImageRoleData theRole,
java.util.Hashtable assetData)
addImageRoleData Adds Role Data to the hashtable which will be stored in hAssetRecords (inside a ScriptServiceRecord object) |
private void |
addLayoutRoleData(com.flexstor.common.data.ejb.disguiserecord.LayoutRoleData theRole,
java.util.Hashtable assetData)
|
private void |
addVideoRoleData(com.flexstor.common.data.ejb.disguiserecord.VideoRoleData theRole,
java.util.Hashtable assetData)
|
private void |
buildAssetRecords(com.flexstor.common.importprocessor.ImportData impData)
buildAssetRecords Populates the hAssetRecords Hashtable, which is used to write remoteScript.in and also to provide easy access to the Assets data by the ScriptableComponent class (AppleScript) |
boolean |
deleteAsset(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset)
|
void |
displayHash(java.util.Hashtable table)
|
java.lang.String[] |
getCtlOptions()
Gets the [options] section of the .ctl file. |
java.lang.String |
getKey(java.lang.String sLineRead)
Parses the current line returning the key portion. |
java.lang.String |
getValue(java.lang.String sLineRead)
Parses the current line returning the value portion. |
void |
logErrorMessage(java.lang.String text)
Provides FlexError support for Applescripts. |
private void |
processErrorSection(java.util.Hashtable errorSection)
|
boolean |
processSection(java.util.Hashtable hSection,
com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData anAsset)
As data is being read from the output file of a script/application or as data is added through AppleScript calls, A Hashtable is created to hold the data for each new Asset. |
private void |
readOutputFile(java.io.BufferedReader inStream)
|
com.flexstor.common.data.ActionResult |
run(com.flexstor.common.data.ActionData theData,
java.util.Hashtable properties)
run This method is called by Flexstor.db when it wants to start the service. |
private int |
runProcess(java.lang.String[] arguments)
|
void |
setServiceResult(boolean bresult)
|
private void |
updateAudioRoleData(com.flexstor.common.data.ejb.disguiserecord.AudioRoleData theRole,
java.util.Hashtable hSection)
|
private void |
updateImageRoleData(com.flexstor.common.data.ejb.disguiserecord.ImageRoleData theRole,
java.util.Hashtable hSection)
|
private boolean |
updateImportData()
Either reads the output file from the script, and parses the sections and updates the Asset Data OR calls updateComplete in ScriptableComp to make sure it has been called which ensures that all data being updated through applescript gets to where it needs to go. |
private void |
updateLayoutRoleData(com.flexstor.common.data.ejb.disguiserecord.LayoutRoleData theRole,
java.util.Hashtable hSection)
|
private void |
updateVideoRoleData(com.flexstor.common.data.ejb.disguiserecord.VideoRoleData theRole,
java.util.Hashtable hSection)
|
private int |
writeHashtableToOutputStream(java.util.Hashtable hData,
java.io.DataOutputStream outputstream)
|
private int |
writeInputFile()
|
void |
writeToConsole(java.lang.String text)
Allows applescripts to write text to the output console of the Remote Asset Server also write text to the debug log |
private int |
writeToOutputStream(java.io.DataOutputStream outputstream,
java.lang.String data)
|
Methods inherited from class com.flexstor.common.services.remote.FlexRemoteService |
getCompositeDir |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
IDENTIFIER
public static final java.lang.String IDENTIFIER
- See Also:
- Constant Field Values
impData
com.flexstor.common.importprocessor.ImportData impData
sOutputFilePath
java.lang.String sOutputFilePath
sInputFilePath
java.lang.String sInputFilePath
sIOFileDirectory
java.lang.String sIOFileDirectory
sRoleIn
java.lang.String sRoleIn
sTypeIn
java.lang.String sTypeIn
sFlagIn
java.lang.String sFlagIn
secondarysRoleIn
java.lang.String secondarysRoleIn
secondarysTypeIn
java.lang.String secondarysTypeIn
secondarysFlagIn
java.lang.String secondarysFlagIn
sRoleOut
public java.lang.String sRoleOut
sFlagOut
public java.lang.String sFlagOut
sTypeOut
java.lang.String sTypeOut
sErrorMsgs
java.lang.String sErrorMsgs
hAssetRecords
java.util.Hashtable hAssetRecords
sUpdateMethod
java.lang.String sUpdateMethod
scriptableFrame
ScriptableFrame scriptableFrame
sScriptName
java.lang.String sScriptName
bUpdateDatabase
boolean bUpdateDatabase
sVersion
java.lang.String sVersion
nDebug
int nDebug
vUserKeys
java.util.Vector vUserKeys
bServiceSuccess
boolean bServiceSuccess
appServerFileSep
java.lang.String appServerFileSep
Constructor Detail |
ScriptService
public ScriptService() throws java.rmi.RemoteException
Method Detail |
run
public com.flexstor.common.data.ActionResult run(com.flexstor.common.data.ActionData theData, java.util.Hashtable properties) throws java.rmi.RemoteException
- run
This method is called by Flexstor.db when it wants to start the service.
- Specified by:
run
in interfacecom.flexstor.common.services.RMIServiceI
setServiceResult
public void setServiceResult(boolean bresult)
getCtlOptions
public java.lang.String[] getCtlOptions()
- Gets the [options] section of the .ctl file.
This is used by AppleScript, when a text file is written this information appears first
in the file.
runProcess
private int runProcess(java.lang.String[] arguments) throws java.lang.InterruptedException, java.io.IOException
writeInputFile
private int writeInputFile()
buildAssetRecords
private void buildAssetRecords(com.flexstor.common.importprocessor.ImportData impData)
- buildAssetRecords
Populates the hAssetRecords Hashtable, which is used
to write remoteScript.in and also to provide easy access
to the Assets data by the ScriptableComponent class (AppleScript)
addAssetData
private void addAssetData(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset, java.util.Hashtable assetData)
addImageRoleData
private void addImageRoleData(com.flexstor.common.data.ejb.disguiserecord.ImageRoleData theRole, java.util.Hashtable assetData)
- addImageRoleData
Adds Role Data to the hashtable which will be stored in hAssetRecords
(inside a ScriptServiceRecord object)
addLayoutRoleData
private void addLayoutRoleData(com.flexstor.common.data.ejb.disguiserecord.LayoutRoleData theRole, java.util.Hashtable assetData)
addAudioRoleData
private void addAudioRoleData(com.flexstor.common.data.ejb.disguiserecord.AudioRoleData theRole, java.util.Hashtable assetData)
addVideoRoleData
private void addVideoRoleData(com.flexstor.common.data.ejb.disguiserecord.VideoRoleData theRole, java.util.Hashtable assetData)
writeHashtableToOutputStream
private int writeHashtableToOutputStream(java.util.Hashtable hData, java.io.DataOutputStream outputstream)
writeToOutputStream
private int writeToOutputStream(java.io.DataOutputStream outputstream, java.lang.String data)
updateImportData
private boolean updateImportData()
- Either reads the output file from the script, and parses the sections and
updates the Asset Data
OR
calls updateComplete in ScriptableComp to make sure it has been called
which ensures that all data being updated through applescript gets to where
it needs to go.
readOutputFile
private void readOutputFile(java.io.BufferedReader inStream) throws java.io.IOException
getKey
public java.lang.String getKey(java.lang.String sLineRead)
- Parses the current line returning the key portion.
As data is added to a new Asset, it comes in the form of
key value pairs, this method separates the Key from the value
getValue
public java.lang.String getValue(java.lang.String sLineRead)
- Parses the current line returning the value portion.
As data is added to a new Asset, it comes in the form of
key value pairs, this method separates the Key from the value
processSection
public boolean processSection(java.util.Hashtable hSection, com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData anAsset)
- As data is being read from the output file of a script/application
or as data is added through AppleScript calls,
A Hashtable is created to hold the data for each new Asset.
When all the data for an asset has been added, this Hashtable
is sent here to update the ImportData structure.
processErrorSection
private void processErrorSection(java.util.Hashtable errorSection)
updateImageRoleData
private void updateImageRoleData(com.flexstor.common.data.ejb.disguiserecord.ImageRoleData theRole, java.util.Hashtable hSection)
updateLayoutRoleData
private void updateLayoutRoleData(com.flexstor.common.data.ejb.disguiserecord.LayoutRoleData theRole, java.util.Hashtable hSection)
updateVideoRoleData
private void updateVideoRoleData(com.flexstor.common.data.ejb.disguiserecord.VideoRoleData theRole, java.util.Hashtable hSection)
updateAudioRoleData
private void updateAudioRoleData(com.flexstor.common.data.ejb.disguiserecord.AudioRoleData theRole, java.util.Hashtable hSection)
deleteAsset
public boolean deleteAsset(com.flexstor.common.data.ejb.disguiserecord.DisguiseAssetRecordData asset)
logErrorMessage
public void logErrorMessage(java.lang.String text)
- Provides FlexError support for Applescripts.
writes text to Output console, debug log(indirectly),
and to the FlexDBServer error log.
writeToConsole
public void writeToConsole(java.lang.String text)
- Allows applescripts to write text to
the output console of the Remote Asset Server
also write text to the debug log
displayHash
public void displayHash(java.util.Hashtable table)
|
|||||||||
Home >> All >> com >> flexstor >> remote >> [ script overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |