Storage Adapter

The Storage adapter gives Sterling B2B Integrator the ability to read and write payloads that are stored in the B2B Advanced Communications storage subsystem.

Overview

Table 1. Storage adapter overview. The following table provides an overview of the Storage adapter:
System Name StorageAdapter
Graphical Process Modeler (GPM) category All Services
Description

This adapter allows document data that are used in business process to be transferred to B2B Advanced Communications storage. This adapter enables payload data from B2B Advanced Communications storage to be used in business processes in Sterling B2B Integrator. You can delete documents from B2B Advanced Communications storage that is stored by business processes.

Important: If you are using this adapter to access a remote CIFS file location (Windows shared folders), you must start Sterling B2B Integrator as a network user. This network user must be a member of a local administrator group and must have appropriate permissions on the CIFS folder on the remote machine.
Business usage Other B2B Advanced Communications components use the Storage component to persist payload data. Sterling B2B Integrator uses this adapter to retrieve data from Storage and persist data to Storage. The data is processed through Sterling B2B Integrator business processes and is used by B2B Advanced Communications components.
Usage example This adapter runs in a Sterling B2B Integrator business process. A business process uses this adapter to save the primary document into B2B Advanced Communications Storage.
Preconfigured? No. Since this adapter must be deployed in a container JVM, you must set up a container before you configure a B2B Advanced Communications Storage adapter.
Requires third-party files? No. All required components are shipped with the product.
Platform availability All platforms that are supported by the application
Related services None
Application requirements This adapter requires that a B2B Advanced Communications Storage server is deployed. This adapter can be deployed only in a Sterling B2B Integrator adapter container. You must set up at least one adapter container before you configure this adapter. This adapter can be used in a group.
Initiates business processes? No
Invocation Yes. This adapter can be started anywhere inside a business process.
Business process context considerations None
Returned status values None
Restrictions
  • This adapter depends on an OSGi bundle that is deployed in Sterling B2B Integrator adapter container. The bundle name starts with megstorage_bundle.
Persistence level None
Testing considerations By turning on system debug, the system.log then contains debug message from the adapter. Before you use this adapter in a business process, verify following conditions:
  1. Ensure that the megstorage_bundle_xxx.jar file is deployed inside the adapter container OSGi Container. The osgiManager list command displays all bundles that are deployed in a node and their status. Ensure this megstorage_bundle_xxx.jar, where xxx is the version number, is active.
  2. Ensure B2B Advanced Communications Storage server is up running.
  3. Ensure Storage Adapter is set up correctly.

Implementing the Storage adapter

To implement this adapter, create an instance in Sterling B2B Integrator and set the parameters.

Configuring the Storage adapter

The following parameters apply to the Storage adapter:

Parameter Description
ParentDirectory This value is the parent directory of the storage bucket directories. Required.
bucketName The name of the storage bucket. Optional.
Passphrase The passphrase for the storage key derivation. Required.

Parameters passed from business process to adapter

Field Description
Action The storage action. Possible values are:
  • putData - persist primary document plus metadata if it exists to storage
  • getData - get payload from storage as primary document and metadata in process data if it exists
  • deleteData - delete data from storage server that is based on dataId
  • putDataOnly - put primary document only into storage
  • getDataOnly - get data from storage as primary document
  • getMetaDataOnly - get only metadata for a specific dataId
Required.
DataId The DataId to get data from B2B Advanced Communications storage or delete data from B2B Advanced Communications storage. putData returns this value to business process. Required for getData or deleteData action.
MetaData

All metadata. Used with putData.

PrimaryDocument The primary document inside business process. Required for putData action.

Parameters passed from adapter to business process

Field Description
DataId The GUID referenced in B2B Advanced Communications storage. This parameter is returned for putData action and used to retrieve or delete data in B2B Advanced Communications storage. Required for putData action.
PrimaryDocument Document object. This value is returned by getData action from B2B Advanced Communications Storage. Required for getData action.

Example business process

This example is a sample business process of using B2B Advanced Communications Storage adapter. The business process performs the following steps:
  1. Collects file from /collect directory
  2. Calls Storage Adapter to store the data into B2B Advanced Communications Storage
  3. Retrieves data from B2B Advanced Communications Storage
  4. Uses File System adapter to extract the data into file system
<process name="MEGStorageAdapterSample">
    <sequence>
          <operation name="collect">
            <participant name="FileSystemAdapter"/>
            <output message="xout">
                <assign to="Action">FS_COLLECT</assign>
                <assign to="collectionFolder">/collect</assign>
                <assign to="bootstrap">false</assign>
                <assign to="useSubFolders">false</assign>
                <assign to="deleteAfterCollect">false</assign>
                <assign to="." from="*"/>
            </output>
            <input message="xin">
                <assign to="." from="*"/>
            </input>
        </operation>

        <!-- save collected document into meg storage -->
        <operation name="SaveData">
            <participant name="MEGStorageAdapter"/>
            <output message="Xout">
                <assign to="Action">putData</assign>
                <assign to="." from="*"></assign>
            </output>
            <input message="Xin">
                <assign to="." from="*"></assign>
            </input>
        </operation>

        <!-- retrieve data from the storage -->
        <operation name="RetrieveData">
            <participant name="MEGStorageAdapter"/>
            <output message="Xout">
                <assign to="Action">getData</assign>
                <assign to="DataId" from="/ProcessData/DataId/text()"></assign>
            </output>
            <input message="Xin">
                <assign to="." from="*"></assign>
            </input>
        </operation>

        <!-- fsa extract the retrieved data -->
        <operation name="extract">
            <participant name="FileSystemAdapter"/>
            <output message="xout">
                <assign to="PrimaryDocument" 
                        from="/ProcessData/PrimaryDocument/@SCIObjectID"/>
                <assign to="Action">FS_EXTRACT</assign>
                <assign to="extractionFolder">/extract</assign>
                <assign to="assignFilename">true</assign>
                <assign to="assignedFilename">storedData.dat</assign>
            </output>
            <input message="xin">
                <assign to="." from="*"/>
            </input>
        </operation>
    </sequence>
</process>

For deleteData action:

<process name="TestMEGStorageAdapterDeleteData">
    <sequence>
        <operation name="SaveData">
             <participant name="myMEGStorageAdapter"/>
                 <output message="Xout">
                     <assign to="Action">putData</assign>
                     <assign to="." from="*"></assign>
                </output>
               <input message="Xin">
                      <assign to="." from="*"></assign>
              </input>
       </operation>

       <!-- delete data from the storage -->
        <operation name="DeleteData">
               <participant name="myMEGStorageAdapter"/>
               <output message="Xout">
                   <assign to="Action">deleteData</assign>
                  <assign to="DataId" from="/ProcessData/DataId/text()"></assign>
              </output>
             <input message="Xin">
               <assign to="." from="*"></assign>
           </input>
        </operation>
    </sequence>
</process>

To get metadata for a payload from:

<process name="TestStorageAdapterGetMetaData">
    <sequence>
        <operation name="SaveData">
             <participant name="myStorageAdapter"/>
                 <output message="Xout">
                     <assign to="Action">putData</assign>
                     <assign to="MetaData">/ProcessData/MetaData</assign>
                     <assign to="." from="*"></assign>
                </output>
               <input message="Xin">
                      <assign to="." from="*"></assign>
              </input>
       </operation>
        <operation name="getMetaData">
               <participant name="myStorageAdapter"/>
               <output message="Xout">
                   <assign to="Action">getMetaDataOnly</assign>
                  <assign to="DataId" from="/ProcessData/DataId/text()"></assign>
              </output>
             <input message="Xin">
               <assign to="." from="*"></assign>
           </input>
        </operation>
    </sequence>
</process>

The output of metadata for a dataId is in ProcessData and is similar to the following example:

<MetaData>
    <size>3027</size>
    <expiryDate>Fri, 26 Oct 2014 15:05:37 GMT</expiryDate>
    <md5Digest>RHuJKvi63Snvkpp9N1fl3Q==</md5Digest>
    <contentType>application/octet-stream</contentType>
    <domain/>
    <filename/>
    <charset/>
   <MetaData>

To set metadata when the business process is saving a document:

<process name="TestStorageAdapterSaveDatawithMetaData">
    <sequence>
       <assign to="MetaData/filename">inputData.dat</assign>
        <assign to="MetaData/contentType">text/html</assign>
        <assign to="MetaData/charset">UTF-8</assign>
        <assign to="MetaData/domain">testDomain</assign>
                
        <!-- persist the data into the storage, deployed in node1AC1 -->
        <operation name="SaveData">
            <participant name="TestStorageAdapter"/>
             <output message="Xout">
                <assign to="Action">putData</assign>
                <assign to="MetaData">/ProcessData/MetaData</assign>
                <assign to="." from="*"></assign>
            </output>
            <input message="Xin">
                <assign to="." from="*"></assign>
            </input>
        </operation>
    </sequence>
</process>