Package org.jitterbit.plugin.sdk

Examples of org.jitterbit.plugin.sdk.DataElements


    }
   
    private void updateDataElements(PipelinePluginContext context) {
        // If a String data element with the name "my_de" is defined, change
        // its value to "New value"
        DataElements des = context.getDataElements();
        if (des.contains("my_de", DataType.STRING)) {
            DataElement<String> de = des.get("my_de", DataType.STRING);
            de.setValue("New value");
        }
        // Add a new data element. This data element will be available further down
        // the operation pipeline.
        DataElement<Date> now = DataElementFactory.newDataElement("now", DataType.DATE, new Date());
        des.add(now);
    }
View Full Code Here


         */
    }
   
    private void incrementCount(PipelinePluginContext context) {
      // Increment the value of the "Count" data element.
        DataElements des = context.getDataElements();
        if (des.contains("Count", DataType.INTEGER)) {
            DataElement<Integer> de = des.get("Count", DataType.INTEGER);
            int count = de.getValue();
            count++;
            de.setValue(count);
            System.out.println("This is stdout and count = " + count);
        }
View Full Code Here

  @Override
  public PluginResult run(PipelinePluginInput input,
      PipelinePluginOutput output, PipelinePluginContext context) throws Exception {
   
    // Get required data elements:
    DataElements dataElements = context.getDataElements();
    if ( dataElements == null || dataElements.isEmpty() )
      throw new Exception("No data elements were passed to this plugin.");
     
    DataElement<String> deCommand = dataElements.get("Command", DataType.STRING);
    if ( deCommand == null || deCommand.isNull() )
      throw new Exception("No command was specified.");
   
    DataElement<String> deArg = dataElements.get("CommandArg", DataType.STRING);
    if ( deArg == null || deArg.isNull() )
      throw new Exception("No command arguments were specified.");
   
    String command = deCommand.getValueAsString();
    String arg = deArg.getValueAsString();
   
    // Get optional data elements:
    String outputExtension = null;
   
    if ( dataElements.contains("OutputExtension", DataType.STRING) ) {
      outputExtension = dataElements.get("OutputExtension", DataType.STRING).getValueAsString();
    }
   
    InputFiles inputFiles = input.getInputFiles();
    OutputFiles outputFiles = output.getOutputFiles();
    for( InputFile inputFile : inputFiles.getFiles() ) {
View Full Code Here

          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        int records_per_file = 1000;
        String header_segment = "";
        DataElements dataElements = context.getDataElements();
        if ( dataElements.contains(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER) ) {
          records_per_file = dataElements.get(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER).getValue();
        }
        if ( dataElements.contains(HEADER_DE_NAME, DataType.STRING) ) {
          header_segment = dataElements.get(HEADER_DE_NAME, DataType.STRING).getValue();
        }
        if ( header_segment.isEmpty() ) {
          throw new PipelinePluginException("No segment header was specified. Not enough information to perform splitting.");
        }
               
View Full Code Here

        InputFiles files = input.getInputFiles();
        if ( files.isEmpty() )
          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        DataElements dataElements = context.getDataElements();  
        if ( dataElements.contains(MAX_LINES_DE_NAME, DataType.INTEGER) )
          maxLines = dataElements.get(MAX_LINES_DE_NAME, DataType.INTEGER).getValue();
        if ( dataElements.contains(MAX_SIZE_DE_NAME, DataType.INTEGER) )
          maxSizeKb = dataElements.get(MAX_SIZE_DE_NAME, DataType.INTEGER).getValue();
       
        String fileName = files.getFiles().iterator().next().getFile().getName();
        dataElements.add(DataElementFactory.newDataElement("OriginalFileName", DataType.STRING, fileName));

        // Check if there is any potential splitting to be done.
        if ( maxLines <= 0 && maxSizeKb <= 0 )
          return PluginResult.SUCCESS;
       
View Full Code Here

    public static AesCipher createCipher(PipelinePluginContext ctx) {
        return isOpenSSL(ctx) ? new OpenSslAesCipher(ctx) : new PKCS5S2AesCipher(ctx);
    }

    private static boolean isOpenSSL(PipelinePluginContext context) {
        DataElements des = context.getDataElements();
        DataElement<String> de = des.get("Jitterbit.AES.PBEGenerator", DataType.STRING);
        return (de != null) && "OpenSSL".equalsIgnoreCase(de.getValue());
    }
View Full Code Here

        baos.close();
        return baos.toByteArray();
    }

    private String getPassphrase() throws Exception {
        DataElements des = context.getDataElements();
        DataElement<String> de = des.get("Jitterbit.AES.Passphrase", DataType.STRING);
        if (de == null) {
            throw new Exception("Invalid input: no passphrase has been defined");
        }
        return de.getValue();
    }
View Full Code Here

        key = readStringDataElement("Jitterbit.HMACSHA1.Key");
        message = readStringDataElement("Jitterbit.HMACSHA1.Message");
    }
   
    private String readStringDataElement(String name) throws Exception {
        DataElements des = context.getDataElements();
        DataElement<String> de = des.get(name, DataType.STRING);
        if (de == null) {
            throw new Exception("The data element \"" + name + "\" has not been set.");
        }
        return de.getValue();
    }
View Full Code Here

        }
        throw new Exception("Invalid input: Illegal keylength " + keylen + ". Valid values are 128, 196, and 256.");
    }

    protected final int getIntInputParam(String name, int def) {
        DataElements des = context.getDataElements();
        DataElement<Integer> de = des.get(name, DataType.INTEGER);
        return (de != null) ? de.getValue() : def;
    }
View Full Code Here

        }
        return de.getValue();
    }
   
    private void readEncoding() {
        DataElements des = context.getDataElements();
        DataElement<String> de = des.get("Jitterbit.HMACSHA1.Encoding", DataType.STRING);
        encoding = (de == null) ? "US-ASCII" : de.getValue();
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.plugin.sdk.DataElements

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.