FcsClient

The FcsClient is the client side library that you use to implement the client side of the FCS.

This page discusses:

InputStreamSource_3 Interface

FcsClient users must implement the InputStreamSource_3 interface. This interface follows an "Iterator" pattern by accessing files from a list one at a time. The FcsClient calls next() to indicate that the next file is being operated on, and then calls reset() to move the current file pointer to the beginning of the list.

The InputStreamSource_3 interface is an enhanced version of the InputStreamSource_2 interface.

InputStreamSource_2 Interface:

package com.matrixone.client.fcs;
import java.io.IOException;
import java.io.InputStream;

public interface InputStreamSource_2 {
    /**
    * get the next item to be processed
    */
    public InputStream getInputStream() throws IOException;

    /**
    get the next file name to be processed
    */
    public String getFileName();
    public boolean hasNext();
    public hasNext();
    public String getFormat();

    /**
    * @return
    */
    public long getFileSize();
    public void next();
    public void reset();
}

InputStreamSource_3 includes an extra method called getCorelationID(), which adds a fourth option to the list of ways you can pair items in the Business Object Proxy (BOP) list and the actual files, using the correlation ID as the key.

  • Ordered (that is: 1st to 1st, 2nd to 2nd, etc.)
  • By unique filenames
  • By unique filenames and format
  • By correlation ID

InputStreamSource_3 Interface:

package com.matrixone.client.fcs;
import java.io.IOException;
import java.io.InputStream;

public interface InputStreamSource_3 extends 
InputStreamSource_2 {
    public String getCorelationID();
}

The InputStreamSource_3 interface is easier to use than the InputStreamSource_2 interface. The latter is still available, but is not recommended. The original InputStreamSource interface is no longer available and should not be used.

Getting and Setting the Correlation ID

You should implement InputStreamSource_3 such that the getCorelationID() method returns the corresponding ID as the BOP.

public interface InputStreamSource_3 extends InputStreamSource_2 {
   public String getCorelation ID();
}

You should invoke bproxy.setCorelationID(corelationId) for each BOP on the list.

public class BusinessObjectProxy implements Cloneable, Serializable {
   public void setCorelationID(String corelationId) {
      _corelationId = corelationId;
   }

For convenience, a unique ID generation method has been added to the FcsClient. Applications can use this method to generate a unique correlation ID.

public class FcsClient {
   public static String generateCorelationId() {
      return System.currentTimeMillis() + rand.nextInt() + "";
   }

Debugging with the Correlation ID

For debugging purposes, FcsSubmit accepts a -correlateWithId argument, which causes the checkin to be run in correlationID mode. For example:

String fcsargs[] = {"-user", "tester1",
                   "-password", "",
                   "-type", "FCSTstType1",
                   "-name", "TSTBO",
                   "-rev", "A",
                   "-url", _fcsurl,
                   "-policy", "FCSTstPolicy1",
                   "-vault", "eService Production",
                   "-format", "FCSTstFormat1",
                   "-store", "TESTSTORE",
                   "-count", ""+_COUNT,
                   "-donotexit",
                   "-correlateWithId"};
   FcsSubmit.main(fcsargs);    

Uncompressing the Data Stream

By default, the FcsClient receives a compressed data stream when checking out more than one file. The compressed data stream conserves network bandwidth but negatively impacts the transfer rate between the FCS and FcsClient. When you check out without compression, the transfer rate between the FCS and FcsClient improves and FCS CPU consumption is minimized.

You can choose to check out with compression when you need to conserve bandwidth, or without compression when bandwidth is available. You can uncompress the data stream in either of two ways:

  • Set the zipOutput parameter to false when retrieving the checkout ticket, using the doIt method in the com.matrixone.fcs.mcs.Checkout class:
    /**
    * @param ctx
    * @param zipOutput
    * @param outFileName
    * @param contextConnect
    * @param list
    * @return
    * @throws MatrixException
    */
    public static TicketWrapper doIt(Context ctx, boolean zipOutput, String outFileName,
    String contextConnect, ArrayList list)throws MatrixException 
    

    You can choose to ignore the outFileName parameter or set it to null. The locationOverride parameter needs to be used only if you need to override the FcsClient's preferred location. The contextConnect parameter is the MCS URL. The list parameter contains the list of BOPs involved in the checkout operation.

    The checkout operation is performed as usual. The output stream compression switch is in the checkout ticket returned by the doIt method.

  • Enable the checkout method for the FcsClient to unzip the zip stream. A boolean unzipFiles parameter is available in the FcsClient.checkout method for this functionality:
    public static void checkout(String ticketStr, 
                                String url,
                                String cookieStr,
                                HashMap args,
                                OutputStreamSource outSrc,
                                String mcsUrl,
                                StatusMonitor monitor,
                                boolean unzipFiles) throws Exception {