accessing pipeline with Java


is there a way to access the content of the pipeline using Java code?
I think it should be possible, but I couldn’t find any documentation.

Thanks in advance for any answer,


There certainly is a way to do it. The developer guide is pretty good about explaining it, but here’s the simple upfront explanation.

  1. Create java service, declare input and output.
  2. You will need to create an IData pipeline object, instantiate a cursor and grab the first variable as follows: (this is for a write file java process with inputs of fileContents and fileName)

IDataHashCursor idhc = pipeline.getHashCursor();
idhc.first( “fileContents” );
String fileContents = (String) idhc.getValue();
idhc.first( “fileName” );
String fileName = (String) idhc.getValue();

Now you have two inputs. To create an output, it would appear as follows:

  1. Create a separate instance of the IData pipelinecursor:

IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “value”, value);

“value” is the pipeline output variable name.

value without the quotes is the literal value from the java code:

value = String “hello”;

Hope this helps. The guide is pretty good about this and the code can be generated automatically in the Developer.

Review the Integrator Guide, Building Coded Services. It describes how to write Java services and how to interact with the pipeline. You can also review the Creating Client Code if your Java code is not in the Integration Server environment.

Here is a java service contents which shows the contentes of the pipeline. It prints out key and its value.

public static final void showPipelineContents( IData pipeline ) throws ServiceException

System.out.println("**>Pipeline Contents:");
IDataCursor pipelineCursor = pipeline.getCursor();

int i=0;
System.out.println(i+": Key :"+pipelineCursor.getKey());
System.out.println(i+": Value:"+pipelineCursor.getValue());



Hope this is what you were looking for.


As usual Ray is correct, but I have a little nit about the code sample:

  1. It is always best to check the return code for all cursor positioning IDataXxxxCursor calls.

IDataHashCursor idhc = pipeline.getHashCursor();
String fileContents;
if (idhc.first( “fileContents” ))
fileContents = (String) idhc.getValue();


I wouldn’t say that I am right as usual. I’ve been known to be wrong on rare occasion. There are several ways that I have seen to access the pipeline and they all seem to work. The reason I decided to post is that I remember the first time I tried to write my first java service. It was hard and I had no clue. So I try to help.

Here’s the many ways to do this:

Assume input is “filename”

IDataCursor pipelineCursor = pipeline.getCursor();

String filename = IDataUtil.getString( pipelineCursor, “filename” );


#2----- (we used this to close an open file handle)

IDataHashCursor.pipelineCursor = pipeline.getHashCursor();
pipeline.Cursor.first( “filename” );
BufferedReader in = (BufferedReader) pipeline.getValue();

— do some code -----


IdataHashCursor pipelineCursor = pipeline getHashCursor();
pipelineCursor.first( “filename” );
String filename = (String) pipelineCursor.getValue();



IDataCursor pipelineCursor = pipeline.getCursor();
String rawFileName = IDataUtil.getString( pipelineCursor, “rawFileName” );
String FILE_TYPE = IDataUtil.getString( pipelineCursor, “FILE_TYPE” );
String WM_BASE = IDataUtil.getString( pipelineCursor, “WM_BASE” );
String SERVER_ROOT = IDataUtil.getString( pipelineCursor, “SERVER_ROOT” );


All work but use something a little different.


thanks! That was exactly what I was looking for. I couldn’t figure out how to get the name of a variable.

Thanks again,