Examples of TextInputFormat


Examples of com.volantis.mcs.protocols.forms.validation.TextInputFormat

    }

    protected void writeJavaScriptValidation(XFTextInputAttributes attribute,
                                             StringBuffer sb) {
       
        TextInputFormat pattern = getTextInputFormat(attribute);
       
        if (pattern != null) {
           
            String caption = getTextFromReference (attribute.getCaption (),
                                                TextEncoding.PLAIN);
            String errorMsg = getTextFromReference (attribute.getErrmsg (),
                                                 TextEncoding.PLAIN);
            if(errorMsg == null) {
                // if no error message has been provided then we
                // need to generate a sensible message
                errorMsg = "Invalid input for " +
                    ((caption != null)?caption:" a form field");
            }

            // We generate the JavaScript to perform the validation
            // If the attribute.emptryOK is true then we must test if
            // the form field is not empty and if it fails the regex
            // and only then generate the error message
            sb.append("if(!(new RegEx(\"" + pattern + "\",")
                .append("form." + attribute.getName() + ".value).match())");
           
            if(pattern.isEmptyOk()) {
                sb.append(" && (form." + attribute.getName() +".value!='')");
            }
            sb.append(") {\n errMsg += \"\\n" + errorMsg + "\";")
                .append("}\n");
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.forms.validation.TextInputFormat

            Element element,
            XFTextInputAttributes attributes) {

        // Get the validation format and parse it to make sure that it is
        // valid.
        TextInputFormat inputFormat = getTextInputFormat(attributes);

        // If it is valid then add appropriate attributes.
        if (inputFormat != null) {
            String format = inputFormat.getFormat();
            if (format != null) {
                ValidationHelper helper = getValidationHelper();
                element.setAttribute("format",
                        helper.createTextInputFormat(format));
            }
            boolean emptyOk = inputFormat.isEmptyOk();
            if (emptyOk) {
                element.setAttribute("emptyok", "true");
            }
        }
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.forms.validation.TextInputFormat

                    "Unknown " +
                            StylePropertyDetails.MCS_INPUT_FORMAT.getName() +
                            " value " + value);
        }

        TextInputFormat result;
        if (format == null) {
            result = null;
        } else {
            result = parser.parseFormat(attributes.getName(), format);
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.forms.validation.TextInputFormat

    }

    public void writeJavaScriptValidation(
            XFTextInputAttributes attribute,
            StringBuffer sb) {
        TextInputFormat format = getTextInputFormat2(attribute);
        if (format != null) {
            String pattern = format.getFormat();
            pattern = extractPattern(pattern);

            String caption = getPlainText(attribute.getCaption());
            String errorMsg = getPlainText(attribute.getErrmsg());
            if (errorMsg == null) {
                // if no error message has been provided then we
                // need to generate a sensible message
                errorMsg = "Invalid input for " +
                        ((caption != null) ? caption : " a form field");
            }

            // We generate the JavaScript to perform the validation
            // If the attribute.emptryOK is true then we must test if
            // the form field is not empty and if it fails the regex
            // and only then generate the error message
            sb.append("if(!(new RegEx(\"").append(pattern).append("\",")
                    .append("form.")
                    .append(attribute.getName()).append(".value).match())");
            if (format.isEmptyOk()) {
                sb.append(" && (form.").append(attribute.getName())
                        .append(".value!='')");
            }
            sb.append(") {\n errMsg += \"\\n").append(errorMsg).append("\";")
                    .append("}\n");
View Full Code Here

Examples of eu.stratosphere.api.java.io.TextInputFormat

   * @return A DataSet that represents the data read from the given file as text lines.
   */
  public DataSource<String> readTextFile(String filePath) {
    Validate.notNull(filePath, "The file path may not be null.");
   
    return new DataSource<String>(this, new TextInputFormat(new Path(filePath)), BasicTypeInfo.STRING_TYPE_INFO );
  }
View Full Code Here

Examples of eu.stratosphere.api.java.record.io.TextInputFormat

    // parse job parameters
    int numSubTasks   = (args.length > 0 ? Integer.parseInt(args[0]) : 1);
    String dataInput = (args.length > 1 ? args[1] : "");
    String output    = (args.length > 2 ? args[2] : "");

    FileDataSource source = new FileDataSource(new TextInputFormat(), dataInput, "Input Lines");
    MapOperator mapper = MapOperator.builder(new TokenizeLine())
      .input(source)
      .name("Tokenize Lines")
      .build();
    ReduceOperator reducer = ReduceOperator.builder(CountWords.class, StringValue.class, 0)
View Full Code Here

Examples of org.apache.flink.api.java.io.TextInputFormat

   * @return A DataSet that represents the data read from the given file as text lines.
   */
  public DataSource<String> readTextFile(String filePath) {
    Validate.notNull(filePath, "The file path may not be null.");
   
    return new DataSource<String>(this, new TextInputFormat(new Path(filePath)), BasicTypeInfo.STRING_TYPE_INFO );
  }
View Full Code Here

Examples of org.apache.flink.api.java.record.io.TextInputFormat

  public Plan getPlan(int numSubTasks, String dataInput, String output) {


    // input is {word, count} pair
    FileDataSource source = new FileDataSource(new TextInputFormat(), dataInput, "Input Lines");

    //do a selection using cached file
    MapOperator mapper = MapOperator.builder(new TokenizeLine())
      .input(source)
      .name("Tokenize Lines")
View Full Code Here

Examples of org.apache.hadoop.mapred.TextInputFormat

  }

  @Override
  protected void runJob(JobConf job) throws IOException {
    // retrieve the splits
    TextInputFormat input = (TextInputFormat) job.getInputFormat();
    InputSplit[] splits = input.getSplits(job, job.getNumMapTasks());
    log.debug("Nb splits : {}", splits.length);

    InputSplit[] sorted = Arrays.copyOf(splits, splits.length);
    Builder.sortSplits(sorted);

    int numTrees = Builder.getNbTrees(job); // total number of trees

    firstOutput = new PartialOutputCollector(numTrees);
    Reporter reporter = Reporter.NULL;

    firstIds = new int[splits.length];
    sizes = new int[splits.length];
   
    // to compute firstIds, process the splits in file order
    int firstId = 0;
    long slowest = 0; // duration of slowest map
    for (InputSplit split : splits) {
      int hp = ArrayUtils.indexOf(sorted, split); // hadoop's partition

      RecordReader<LongWritable, Text> reader = input.getRecordReader(split, job, reporter);

      LongWritable key = reader.createKey();
      Text value = reader.createValue();

      Step1Mapper mapper = new MockStep1Mapper(getTreeBuilder(), dataset, getSeed(),
View Full Code Here

Examples of org.apache.hadoop.mapred.TextInputFormat

   *
   */
  void secondStep(JobConf job, Path forestPath,
      PredictionCallback callback) throws IOException {
    // retrieve the splits
    TextInputFormat input = (TextInputFormat) job.getInputFormat();
    InputSplit[] splits = input.getSplits(job, job.getNumMapTasks());
    log.debug("Nb splits : {}", splits.length);

    Builder.sortSplits(splits);

    int numTrees = Builder.getNbTrees(job); // total number of trees

    // compute the expected number of outputs
    int total = 0;
    for (int p = 0; p < splits.length; p++) {
      total += Step2Mapper.nbConcerned(splits.length, numTrees, p);
    }

    secondOutput = new PartialOutputCollector(total);
    Reporter reporter = Reporter.NULL;
    long slowest = 0; // duration of slowest map

    for (int partition = 0; partition < splits.length; partition++) {
      InputSplit split = splits[partition];
      RecordReader<LongWritable, Text> reader = input.getRecordReader(split,
          job, reporter);

      LongWritable key = reader.createKey();
      Text value = reader.createValue();

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.