Example for InterpretCommand Activity
<Activity Name="InterpretCommand"> <Start /> <Action>InterpretCommand</Action> <Description lang="en">Compute the enterprise-specific directory to store the export JAR file.</Description> <Parameter direction="in" eval="xpath" type="string" name="EnterpriseShortName" source="/Message/Header/MessageHeader[@origin='Receiver']/Enter prise/PartyID/ShortName/text()">inDoc</Parameter> <Parameter direction="out" name="ExportFileDirectory" type="string" eval="variable">ExportFileDirectory</Parameter> <Script format="bsh"> <![CDATA[ ExportFileDirectory = EnterpriseShortName + "/metadata/export/data"; </Script> </Activity>
You can also use this activity to run a shell script. The following is an example:
<Activity Name="PurgeFilesThroughShellScript"> <Action>InterpretCommand</Action> <Description lang="en">Delete the files associated with purged data</Description> <Parameter direction="in" eval="variable" type="string" name="purgefilepath">relativepath</Parameter> <Parameter direction="in" eval="constant" type="string" name="shellscriptname">deletepurgefiles.sh</Parameter> <Script format="bsh"> <![CDATA[ java.lang.String envPath =com.tibco.mdm.infrastructure.EnvUtil.getDirEnvironmentVaria ble(com.tibco.mdm.infrastructure.IMqEnvVars.MQ_HOME); java.lang.String commondirpath = com.tibco.mdm.infrastructure.EnvUtil.getDirEnvironmentVariable (com.tibco.mdm.infrastructure.IMqEnvVars.MQ_COMMON_DIR); envPath = envPath + "bin" ; java.lang.String absolutepathfile = commondirpath + purgefilepath ; java.lang.String executescriptstring = " sh " + shellscriptname + " " + absolutepathfile ; java.lang.Runtime runtime = java.lang.Runtime.getRuntime() ; try { java.lang.Process child = runtime.exec(executescriptstring , null, new java.io.File(envPath)); // child.waitFor(); } catch (java.io.IOException e) { com.tibco.mdm.infrastructure.error.MqException me = new com.tibco.mdm.infrastructure.error.MqException(com.tibco.mdm.infrastructure.MqErrorCodes.IOERROR, e); me.setArg(com.tibco.mdm.infrastructure.MqErrorCodes.FILE NAME, envPath ); throw me; } catch (java.lang.InterruptedException e) { com.tibco.mdm.infrastructure.logging.MqLog.log("Interpr etCommand", com.tibco.mdm.infrastructure.logging.MqLog.WARNING, "Interupted purge delete ."); } finally { } </Script> </Activity>
Copyright © Cloud Software Group, Inc. All rights reserved.