@Override
 public void loadFromXML(Reader in) {
   XMLConfiguration xml = ConfigurationUtil.newXMLConfiguration(in);
   setRegex(xml.getString(""));
   super.loadFromXML(xml);
   setCaseSensitive(xml.getBoolean("[@caseSensitive]", false));
 }
 @Override
 public void loadFromXML(Reader in) throws IOException {
   XMLConfiguration xml = ConfigurationUtil.newXMLConfiguration(in);
   setStatusCodes(xml.getString("statusCodes", getStatusCodes()));
   setOutputDir(xml.getString("outputDir", getOutputDir()));
   setFileNamePrefix(xml.getString("fileNamePrefix", getFileNamePrefix()));
 }
 @Test
 public void testWriteRead() throws IOException {
   StripAfterTransformer t = new StripAfterTransformer();
   t.setInclusive(true);
   t.setStripAfterRegex("<p>");
   System.out.println("Writing/Reading this: " + t);
   ConfigurationUtil.assertWriteRead(t);
 }
Ejemplo n.º 4
0
 @Test
 public void testWriteRead() throws IOException {
   ScriptTransformer t = new ScriptTransformer();
   t.setScript("a script");
   t.setEngineName("an engine name");
   t.setMaxReadSize(256);
   System.out.println("Writing/Reading this: " + t);
   ConfigurationUtil.assertWriteRead(t);
 }
  @Override
  public void loadFromXML(Reader in) {
    XMLConfiguration xml = ConfigurationUtil.newXMLConfiguration(in);
    setSourceReferenceField(xml.getString("sourceReferenceField", sourceReferenceField));
    setKeepSourceReferenceField(
        xml.getBoolean("sourceReferenceField[@keep]", keepSourceReferenceField));
    setTargetReferenceField(xml.getString("targetReferenceField", targetReferenceField));
    setSourceContentField(xml.getString("sourceContentField", sourceContentField));
    setKeepSourceContentField(xml.getBoolean("sourceContentField[@keep]", keepSourceContentField));
    setTargetContentField(xml.getString("targetContentField", targetContentField));
    setQueueDir(xml.getString("queueDir", DEFAULT_QUEUE_DIR));
    setQueueSize(xml.getInt("queueSize", AbstractBatchCommitter.DEFAULT_QUEUE_SIZE));
    setCommitBatchSize(
        xml.getInt("commitBatchSize", AbstractBatchCommitter.DEFAULT_COMMIT_BATCH_SIZE));
    setMaxRetries(xml.getInt("maxRetries", 0));
    setMaxRetryWait(xml.getInt("maxRetryWait", 0));

    loadFromXml(xml);
  }
 @Override
 public void loadFromXML(Reader in) throws IOException {
   try {
     XMLConfiguration xml = ConfigurationUtil.newXMLConfiguration(in);
     defaultDelay = xml.getLong("[@default]", defaultDelay);
     ignoreRobotsCrawlDelay = xml.getBoolean("[@ignoreRobotsCrawlDelay]", ignoreRobotsCrawlDelay);
     scope = xml.getString("[@scope]", SCOPE_CRAWLER);
     List<HierarchicalConfiguration> nodes = xml.configurationsAt("schedule");
     for (HierarchicalConfiguration node : nodes) {
       schedules.add(
           new DelaySchedule(
               node.getString("[@dayOfWeek]", null),
               node.getString("[@dayOfMonth]", null),
               node.getString("[@time]", null),
               node.getLong("", DEFAULT_DELAY)));
     }
   } catch (ConfigurationException e) {
     throw new IOException("Cannot load XML.", e);
   }
 }