Class JavaObjectSource

java.lang.Object
com.bea.wli.sb.sources.JavaObjectSource
All Implemented Interfaces:
Source, Serializable

public class JavaObjectSource extends Object implements Source, Serializable
A JavaObjectSource represents payload carried by the services that support OSB service binding type: Messaging Type : Java.

The objects that comprise this payload will be registered in pipeline java object repository by the binding layer and their contents will be visible in message context variables through <ctx:java-content ref='jcid:xyz' xmlns:ctx="http://www.bea.com/wli/sb/context" /> XML elements. Here, ref points to a unique id with which the object is stored within the java object repository.

Example:

Let's assume, we have an inbound service with binding type: Messaging Type : java. When a transport invocation occurs and a JavaObjectSource is composed by the inbound endpoint with a single object say Obj1, the message payload in the pipeline will be represented as:

 <ctx:java-content ref='key1' xmlns:ctx="http://www.bea.com/wli/sb/context" />
 

In this example, the pipeline java object repository will contain:

key1 --> Obj1 .

See Also:
  • Constructor Details

    • JavaObjectSource

      public JavaObjectSource(Object... args)
      Creates an instance of JavaObjectSource given a sequence of objects. Each object is expected to implement java.io.Serializable interface.
      Parameters:
      args - the sequence of objects to be registered in pipeline java object repository.
  • Method Details

    • writeTo

      public void writeTo(OutputStream os, TransformOptions options) throws IOException, TransformException
      Writes the contents of this source by wrapping OutputStream argument with java.io.ObjectOutputStream and serializing all objects into it.
      Specified by:
      writeTo in interface Source
      Parameters:
      os - the OutputStream to which serialized content will be written
      options - TransformOptions used to affect the serialization
      Throws:
      IOException
      TransformException
    • getInputStream

      public InputStream getInputStream(TransformOptions options) throws IOException, TransformException
      Returns an input stream that contains serialized representation of all objects in this source. The result of this method should be wrapped with java.io.ObjectInputStream in order to read individual objects
      Specified by:
      getInputStream in interface Source
      Parameters:
      options - Options used to affect the serialization
      Returns:
      a InputStream for retrieving the serialized content
      Throws:
      IOException
      TransformException
    • getObjects

      public Object[] getObjects()
      Returns all the objects in this source.
      Returns:
      all the objects in this source or empty array if no objects are available with this source