Package uk.org.ogsadai.activity.io

Examples of uk.org.ogsadai.activity.io.BlockReader


            ActivityProcessingException, ActivityTerminatedException
    {
        try
        {
            preprocess();
            BlockReader data = getInput(INPUT_DATA);
            BlockWriter result = getOutput();
            int arraySize = getArraySize();
           
            BytesOutputStream bytes =
                new BytesOutputStream(result, arraySize);

            STypeOutputStream output = new STypeOutputStream(bytes);
            result.write(ControlBlock.LIST_BEGIN);
            Object block;
            while ((block = data.read()) != ControlBlock.NO_MORE_DATA)
            {
                serialise(data, output, block);
            }
            output.close();
            result.write(ControlBlock.LIST_END);
View Full Code Here


    }

    private int getArraySize()
        throws DataError, PipeIOException, PipeTerminatedException, InvalidInputValueException
    {
        BlockReader reader = getInput(INPUT_ARRAY_SIZE);
        int arraySize = DEFAULT_ARRAY_SIZE;
        if (reader != null)
        {
            Object block = reader.read();
            if (block instanceof Number)
            {
                int value = ((Number)block).intValue();
                if (value > 0) arraySize = value;
            }
View Full Code Here

    public void process() throws ActivityUserException,
            ActivityProcessingException, ActivityTerminatedException
    {
        preprocess();
       
        BlockReader data = getInput(INPUT_DATA);
        BlockWriter result = getOutput(OUTPUT_RESULT);
       
        try
        {
           
            // make sure we have a list of binary data
            // BytesInputStream expects that the LIST_BEGIN has been read
            Object first = data.read();
            if (first != ControlBlock.LIST_BEGIN)
            {
                throw new InvalidInputValueException(INPUT_DATA, first);
            }
           
View Full Code Here

    {

       List<ActivityInput> inputs = new ArrayList<ActivityInput>();
        
         // set up block reader for data input
         BlockReader data = getInput(INPUT_DATA);
         if (data == null)
         {
             throw new InvalidActivityInputsException(1, INPUT_DATA);
         }  
         ActivityInput dataInput = new TupleListActivityInput(INPUT_DATA);
         dataInput.setBlockReader(data);
         inputs.add(dataInput);
        
         BlockReader priorities = getInput(INPUT_PRIORITIES);
         if (priorities == null)
         {
             throw new InvalidActivityInputsException(1, INPUT_PRIORITIES);
         }  
         ActivityInput prioritiesInput = new TypedListActivityInput(INPUT_PRIORITIES, Object.class);
View Full Code Here

    private BlockReader mKeyIndex;
  protected ActivityInput[] getIterationInputs() {
        List<ActivityInput> inputs = new ArrayList<ActivityInput>();
       
        // set up block reader for items input
        BlockReader items = getInput(INPUT_ITEMS);

        ActivityInput itemsInput = new TupleListActivityInput(INPUT_ITEMS);
        itemsInput.setBlockReader(items);
        inputs.add(itemsInput);
       
        // set up block reader for customers input
        BlockReader customers = getInput(INPUT_TRANSACTIONS);
 
        ActivityInput customersInput = new TupleListActivityInput(INPUT_TRANSACTIONS);
        customersInput.setBlockReader(customers);
        inputs.add(customersInput);
       
       
        // set up block reader for customers input
        BlockReader key = getInput(INPUT_KEY_INDEX);
 
        ActivityInput keyIndexInput = new TypedActivityInput(INPUT_KEY_INDEX, Integer.class);
        keyIndexInput.setBlockReader(key);
        inputs.add(keyIndexInput);
       
View Full Code Here

      ActivityProcessingException,
      ActivityTerminatedException
{
  validateInput(this.INPUT);
  validateOutput(this.OUTPUT_DATA);
  BlockReader mInputBlockReader = getInput(this.INPUT);
  BlockReader mInputBlockReader2 = getInput(this.LOOKUP_FOLDER);
  mOutputBlockWriter = getOutput(this.OUTPUT_DATA);
  String lookupfolder="";
  String stacode;

  try{
 

       

    Object block;
    List stacodes= new ArrayList();
   
    while ((block = mInputBlockReader.read()) != ControlBlock.NO_MORE_DATA)

    {
      

      if (block instanceof String)

      { 
        stacodes.add(block);
      }

    

    }
   
    while ((block = mInputBlockReader2.read()) != ControlBlock.NO_MORE_DATA)
    {
      if (block instanceof String)
      { 
         lookupfolder = (String)requestResouce.getResourceID().getLocalPart()+"/"+block;
      }
View Full Code Here

            throws InvalidActivityInputsException
    {
        List<ActivityInput> inputs = new ArrayList<ActivityInput>();
       
        // set up block reader for data input
        BlockReader data = getInput(INPUT_DATA);
        if (data == null)
        {
            throw new InvalidActivityInputsException(1, INPUT_DATA);
        }  
        ActivityInput dataInput = new TupleListActivityInput(INPUT_DATA);
        dataInput.setBlockReader(data);
        inputs.add(dataInput);

        // set up block reader for options input
        BlockReader options = getInput(INPUT_OPTIONS);

        TypedOptionalActivityInput optionsInput =
            new TypedOptionalActivityInput(INPUT_OPTIONS, Object.class, DEFAULT_OPTIONS);
        optionsInput.setBlockReader(options);
        inputs.add(optionsInput);
       
        // set up block reader for options input
        BlockReader algorithm = getInput(INPUT_ALGORITHM_CLASS);
       
        TypedOptionalActivityInput algorithmInput =
            new TypedOptionalActivityInput(INPUT_ALGORITHM_CLASS, Object.class, DEFAULT_ALGORITHM);
        algorithmInput.setBlockReader(algorithm);
        inputs.add(algorithmInput);
       
        // set up block reader for indexes of nominal values columns
        BlockReader indexes = getInput(INPUT_COLUMN_INDICES);
        if (indexes == null)
        {
            throw new InvalidActivityInputsException(1, INPUT_COLUMN_INDICES);
        }  
        ActivityInput nomValIndexesInput = new TypedListActivityInput(INPUT_COLUMN_INDICES, Object.class);
View Full Code Here

    {

       List<ActivityInput> inputs = new ArrayList<ActivityInput>();
        
         // set up block reader for data input
         BlockReader data = getInput(INPUT_DATA);
         if (data == null)
         {
             throw new InvalidActivityInputsException(1, INPUT_DATA);
         }  
         ActivityInput dataInput = new TupleListActivityInput(INPUT_DATA);
         dataInput.setBlockReader(data);
         inputs.add(dataInput);
        
         BlockReader priorities = getInput(INPUT_PRIORITIES);
         if (priorities == null)
         {
             throw new InvalidActivityInputsException(1, INPUT_PRIORITIES);
         }  
         ActivityInput prioritiesInput = new TypedListActivityInput(INPUT_PRIORITIES, Object.class);
View Full Code Here

  protected ActivityInput[] getIterationInputs()
      throws InvalidActivityInputsException {
    List<ActivityInput> inputs = new ArrayList<ActivityInput>();

    // set up block reader for data input
    BlockReader data = getInput(INPUT_DATA);
    if (data == null) {
      throw new InvalidActivityInputsException(1, INPUT_DATA);
    }
    ActivityInput dataInput = new TupleListActivityInput(INPUT_DATA);
    dataInput.setBlockReader(data);
    inputs.add(dataInput);

    // set up block reader for class index input
    BlockReader classIndex = getInput(INPUT_CLASS_INDEX);
    if (classIndex == null) {
      throw new InvalidActivityInputsException(1, INPUT_CLASS_INDEX);
    }
    ActivityInput classIndexInput = new TypedActivityInput(
        INPUT_CLASS_INDEX, Object.class);
    classIndexInput.setBlockReader(classIndex);
    inputs.add(classIndexInput);

    // set up block reader for indexes of nominal values columns
    BlockReader indexes = getInput(INPUT_COLUMN_INDICES);
    if (indexes == null) {
      throw new InvalidActivityInputsException(1, INPUT_COLUMN_INDICES);
    }
    ActivityInput nomValIndexesInput = new TypedListActivityInput(
        INPUT_COLUMN_INDICES, Object.class);
View Full Code Here

    private BlockReader mKeyIndex;
  protected ActivityInput[] getIterationInputs() {
        List<ActivityInput> inputs = new ArrayList<ActivityInput>();
       
        // set up block reader for items input
        BlockReader items = getInput(INPUT_ITEM_LIST);

        ActivityInput itemsInput = new TupleListActivityInput(INPUT_ITEM_LIST);
        itemsInput.setBlockReader(items);
        inputs.add(itemsInput);
       
        // set up block reader for customers input
        BlockReader customers = getInput(INPUT_CUSTOMERS_LIST);
 
        ActivityInput customersInput = new TupleListActivityInput(INPUT_CUSTOMERS_LIST);
        customersInput.setBlockReader(customers);
        inputs.add(customersInput);
       
       
        // set up block reader for customers input
        BlockReader key = getInput(INPUT_KEY_INDEX);
 
        ActivityInput keyIndexInput = new TypedActivityInput(INPUT_KEY_INDEX, Integer.class);
        keyIndexInput.setBlockReader(key);
        inputs.add(keyIndexInput);
       
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.activity.io.BlockReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.