syntax error near unexpected token `newline' or `$'\r''

Common errors in running an unix shell scripts are 

line 34: syntax error near unexpected token `newline'
line 30: syntax error near unexpected token `$'\r'' 

Solution:

Unix script file name example.sh then the below is the command to fire on machine.

dos2unix example.sh example.sh

So that it removes the hidden Windows Characters from Files.

While editing files on a machine running some form of Windows and uploading them to a Linux server is convenient, it can cause unforeseen complications. 

Windows-based text editors put special characters at the end of lines to denote a line return or newline. 

Normally harmless, some applications on a Linux server cannot understand these characters and can cause the service to not respond correctly. 

There is a simple way to correct this problem: dos2unix.

What do the hidden characters look like?

Below is an example from the example.sh file showing what the hidden characters look like:

;;;;;;;;;;;;;;;;;;;^M
; Resource Limits ;^M
;;;;;;;;;;;;;;;;;;;^M
;^M
max_execution_time = 30^M
max_input_time = 60^M
memory_limit = 32M^M

As said before, these characters will not appear in most Windows text editors, but will appears in Linux command line utilities like cat or vi. Removing them is rather painless. Just run the command dos2unix.

root@host [~]# dos2unix example.sh example.sh

In the above example of the example.sh, it will look something like this:

root@host [~]# dos2unix example.sh example.sh
dos2unix: converting file
example.sh to UNIX format ...

That’s it. If the command has worked correctly, the file in question shouldn’t have any of the hidden characters in it, like the follow:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
;
max_execution_time = 30
max_input_time = 60
memory_limit = 32M

The dos2unix command is a simple way to make sure that files that have been edited and uploaded from a Windows machine to a Linux machine work and behave correctly.



How can create custom process starters in TIBCO AMBW ?

 Custom process starters can also be created.

 The Java Event Source process starter allows to create a custom process starter based on Java code.

 Java Event Source provides the features (such as Sequencing key) of other process starters without the need to write extra code.

 Java Event Source provides an abstract class to extend to create a process starter. The abstract class describes the methods that interact with the process engine. 

Custom code must provide implementation for the methods,

 init(). Called when the process engine starts. Can initialize any resource connections. Specify a Java Global instance on the Advanced tab that initializes resource connections. Java Global instances are loaded and initialized during process engine start up. this.getJavaGlobalInstance() can be executed to obtain the Java Global Instance resource in process starter code.

 onStart(). Called by the process engine to activate the process starter. This method must activate any event notifier or resource observer code. The notifier or observer code can then call the onEvent() method to start a process instance.

 onStop(). Called by the process engine to deactivate the process starter. This method must deactivate any event notifier or resource observer code.

onShutdown(). Called by the process engine when the engine shuts down. The method should release any resources and resource connections and perform any required clean up operations.

Methods already implemented.

onEvent(Object object). Called when a listener or resource observer catches a new event. Input to this is a Java object containing the event data.

getGlobalInstance(). Returns an object reference to the Java Global resource specified on the Advanced tab of the process starter. Useful when initialization code is placed in a Java Global Resource instead of the init() method.

onError(). Throws the exception specified in the input parameter. Used to propagate an error to the TIBCO ActiveMatrix BusinessWorks process instance when a listener or resource observer fails to generate an event.

How to create a Custom palette with Custom activities ?

Creating a Custom palette with Custom activities.

1. Create a Custom palette

    a) Select Palettes > My Palettes > New Palette from TIBCO Designer menu.
    b) Specify a name in the dialog that appears
    c) Custom palette appears in palette panel.

2. Drag and drop custom activity to custom palette.
3. Save the project

Distributing custom palette

1. Locate the file(s) containing the custom palette(s) which, by default, are stored in the location specified in the User Palette Directory foeld of the General User Preferences dialog. The file extension of the custom palette is .mypalette.

2. Copy the .mypalette file to the custom palette directory on the machines to use the custome palette. An installation program may be created to perform this step so that users can easily install the custom palettes.

3. Start TIBCO Designer and click the MyPalettes tab to see the custom palette. If TIBCO Designer is already running, click on Palettes > My Palettes > Reload Palettes from the menu to retrieve the new custom palette.
  • Custom activities behave like any other activity in TIBCO ActiveMatrix BusinessWorks. The name of the Custom Activity and the name of the process definition in which the Custom Activity is included should be unique. If names are the same, input and output schemas are not displayed.
  • Global Variables used in Custom Activity are automatically added to the Global Variable list in the project (if they are not included yet).
  • When tracing is enabled, the trace information for activities executing within a custom activity is written to a log file. 


How to create 'Custom Activity' in Active Matrix Business Works ?

TIBCO BW > General Activities >  "Custom Activity"  Configuration

A process definition can be packaged into a custom activity that hides the implementation details of the process from the user.

Steps for creating a custom activity.

1. Create a folder (uniquely named is strongly recommended)

2. Create a process definition

3. Optionally, create output schema to the process definition Start activity.

4. Implement business logic for process definition.

5. Optionally, specify input schema for the End activity in the process definition and mapping.

6. In the project panel, click on the root node of the project, then select the General Activity palette in the palette panel.

7. Create a Custom Activity resource.

8. Click on Browse button to select the process definition.

9. Click Apply.

10.Take one new process definition to use this Custom Activity resource which is configured in previous steps.

(By drag & drop this configured Custom Activity resource cannot use in new process definition, we need to copy the configured Custom Activity resource and past inside the new process definition)

11.Once this done,then the resource is loaded into the new process definition,so now we can run this process.

Any resources referenced by the process definition in a custom activity are automatically included in the custom activity. 

Dynamically called subprocesses are not known at design time, and therefore are not referenced by the process definition. 

Therefore, dynamically called subprocesses cannot be used by a process definition within a custom activity.

Only process definition that do not have a process starters can be referenced by a custom activity.

Global variables used within the process definitions referenced by custom activities are automatically added to the global variable list of the project when the activity is added to a process definition.

Thus a naming convention for Global variables should be specified.

WSDL or XSD files are not automtically included when the process definition is placed in a custom activity. 

WSDL and XSD files must be made available to any user of custom activity.



  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP