Examples of Fetcher


Examples of cn.edu.hfut.dmic.webcollector.fetcher.Fetcher

    }
   
   
    @Override
    public Fetcher createFetcher() {
        Fetcher fetcher = new Fetcher();
        fetcher.setNeedUpdateDb(true);
        fetcher.setIsContentStored(isContentStored);
        conconfig = new CommonConnectionConfig(useragent, cookie);
        fetcher.setThreads(getThreads());
        return fetcher;
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.drivers.uri.Fetcher

            XMLPipeline pipeline = dynamicProcess.getPipeline();

            // In order to get the required template definition to be processed
            // we need to invoke a URI inclusion based on the given href.
            Fetcher fetcher = new Fetcher(pipeline);
            fetcher.setHref(href);

            fetcher.doInclude();
        }

        super.doAction(dynamicProcess);
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.drivers.uri.Fetcher

        if (!"".equals(queryString)) {
            hrefAttr.append("?").append(queryString);
        }

        Fetcher operation = new Fetcher(pipeline);

        // OK to pass null strings to operations attribute setters
        // Operation process can validate the attributes whenever
        // it performs its operation
        operation.setHref(hrefAttr.toString());
        operation.setParse(PARSE_ATTRIBUTE_VALUE);
        operation.setEncoding(ENCODING_ATTRIBUTE_VALUE);

        // Handle the timeout setting. Firstly, we need to see if there is a
        // timeout attribute. We default to -1 to indicate no timeout
        String timeoutAttr = TIMEOUT_ATTRIBUTE_VALUE;
        Period timeout = null;

        if (timeoutAttr != null) {
            // The attribute should contain an integer number of seconds
            int timeoutInSecs;
            try {
                timeoutInSecs = Integer.parseInt(timeoutAttr);
            } catch (NumberFormatException e) {
                LOGGER.warn("invalid-timeout", timeoutAttr);
                throw e;
            }

            timeout = Period.treatNonPositiveAsIndefinitely(
                    timeoutInSecs * 1000);
    }

        operation.setTimeout(timeout);

        operation.doInclude();

        return null;
    }
View Full Code Here

Examples of com.volantis.xml.pipeline.sax.drivers.uri.Fetcher

        }

        queryString.append("&").append(MessageFormat.format(
                FLICKR_PAGE_PARAM, pageIndex));

        Fetcher operation = new Fetcher(pipeline);

        // OK to pass null strings to operations attribute setters
        // Operation process can validate the attributes whenever
        // it performs its operation
        operation.setHref(FLICKR_REST_API_URL + queryString.toString());
        operation.setParse(PARSE_ATTRIBUTE_VALUE);
        operation.setEncoding(ENCODING_ATTRIBUTE_VALUE);

        // Handle the timeout setting. Firstly, we need to see if there is a
        // timeout attribute. We default to -1 to indicate no timeout
        String timeoutAttr = TIMEOUT_ATTRIBUTE_VALUE;
        Period timeout = null;

        if (timeoutAttr != null) {
            // The attribute should contain an integer number of seconds
            int timeoutInSecs;
            try {
                timeoutInSecs = Integer.parseInt(timeoutAttr);
            } catch (NumberFormatException e) {
                LOGGER.warn("invalid-timeout", timeoutAttr);
                throw e;
            }

            timeout = Period.treatNonPositiveAsIndefinitely(
                    timeoutInSecs * 1000);
        }

        operation.setTimeout(timeout);

        operation.doInclude();

        return null;
    }
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

    selectedFetchersList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    selectedFetchersList.setLayoutData(LayoutHelper.formData(140, 200, new FormAttachment(0), new FormAttachment(selectedLabel, 80, SWT.RIGHT), new FormAttachment(selectedLabel), null));
    Iterator<Fetcher> i = fetcherRegistry.getSelectedFetchers().iterator();
    i.next()// skip IP
    while (i.hasNext()) {
      Fetcher fetcher = i.next();
      selectedFetchersList.add(fetcher.getName());
    }
   
    Button upButton = new Button(shell, SWT.NONE);
    upButton.setText(Labels.getLabel("button.up"))
   
    Button downButton = new Button(shell, SWT.NONE);
    downButton.setText(Labels.getLabel("button.down"));
   
    Button addButton = new Button(shell, SWT.NONE);
    addButton.setText(Labels.getLabel("button.left"));

    Button removeButton = new Button(shell, SWT.NONE);
    removeButton.setText(Labels.getLabel("button.right"));
   
    Button prefsButton = new Button(shell, SWT.NONE);
    prefsButton.setText(Labels.getLabel("button.fetcherPrefs"));
    prefsButton.setToolTipText(Labels.getLabel("text.fetchers.preferences"));
   
    upButton.setLayoutData(LayoutHelper.formData(new FormAttachment(selectedFetchersList), new FormAttachment(downButton, 0, SWT.RIGHT), new FormAttachment(selectedLabel), null));
    downButton.setLayoutData(LayoutHelper.formData(new FormAttachment(selectedFetchersList), null, new FormAttachment(upButton), null));
    addButton.setLayoutData(LayoutHelper.formData(new FormAttachment(selectedFetchersList), new FormAttachment(downButton, 0, SWT.RIGHT), new FormAttachment(downButton, 16), null))
    removeButton.setLayoutData(LayoutHelper.formData(new FormAttachment(selectedFetchersList), new FormAttachment(downButton, 0, SWT.RIGHT), new FormAttachment(addButton), null));
    prefsButton.setLayoutData(LayoutHelper.formData(new FormAttachment(selectedFetchersList), new FormAttachment(downButton, 0, SWT.RIGHT), new FormAttachment(removeButton, 16), null));
   
    Label registeredLabel = new Label(shell, SWT.NONE);
    registeredLabel.setText(Labels.getLabel("text.fetchers.availableList"));   
    registeredLabel.setLayoutData(LayoutHelper.formData(new FormAttachment(downButton, 10), null, new FormAttachment(messageLabel, 5), null));
   
    registeredFetchersList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    registeredFetchersList.setLayoutData(LayoutHelper.formData(140, 200, new FormAttachment(downButton, 10), null, new FormAttachment(registeredLabel), null));
    i = fetcherRegistry.getRegisteredFetchers().iterator();
    i.next(); // skip IP
    while (i.hasNext()) {
      Fetcher fetcher = i.next();
      String fetcherName = fetcher.getName();
      registeredFetcherIdsByNames.put(fetcherName, fetcher.getId());
      if (selectedFetchersList.indexOf(fetcherName) < 0)
        registeredFetchersList.add(fetcherName);
    }

    Button okButton = new Button(shell, SWT.NONE);
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

    }

    public void handleEvent(Event e) {
      // modify menu text a bit
      TableColumn tableColumn = (TableColumn) e.widget;
      Fetcher fetcher = (Fetcher) tableColumn.getData();
     
      MenuItem sortMenuItem = columnsMenu.getItem(0);
      MenuItem preferencesMenuItem = columnsMenu.getItem(1);
      MenuItem aboutMenuItem = columnsMenu.getItem(2);

      if (tableColumn.getParent().getSortColumn() == tableColumn)
        sortMenuItem.setText(Labels.getLabel("menu.columns.sortDirection"));
      else
        sortMenuItem.setText(Labels.getLabel("menu.columns.sortBy") + " " + fetcher.getName());

      // disable these menu items if scanning
      sortMenuItem.setEnabled(stateMachine.inState(ScanningState.IDLE));

      preferencesMenuItem.setText(fetcher.getName() + " " + Labels.getLabel("menu.columns.preferences"));
      preferencesMenuItem.setEnabled(fetcher.getPreferencesClass() != null && stateMachine.inState(ScanningState.IDLE));

      aboutMenuItem.setText(Labels.getLabel("menu.columns.about") + " " + fetcher.getName());
     
      // focus the table to make Enter work after using the menu
      tableColumn.getParent().forceFocus();
     
      // remember the clicked column (see SortBy, FetcherPreferences, and AboutFetcher below)
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

    public void handleEvent(Event event) {
      // retrieve the clicked column (see ColumnClick above)
      TableColumn tableColumn = (TableColumn) ((MenuItem)event.widget).getParent().getData();
     
      Fetcher fetcher = (Fetcher) tableColumn.getData();
     
      fetcherRegistry.openPreferencesEditor(fetcher);
     
      // update name if preferences changed
      tableColumn.setText(fetcher.getFullName());
    }
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

   
    public void handleEvent(Event event) {
      // retrieve the clicked column (see ColumnClick above)
      TableColumn tableColumn = (TableColumn) ((MenuItem)event.widget).getParent().getData();
     
      Fetcher fetcher = (Fetcher) tableColumn.getData();

      MessageBox messageBox = new MessageBox(tableColumn.getParent().getShell(), SWT.ICON_INFORMATION | SWT.OK);
      messageBox.setText(Labels.getLabel("text.fetchers.info") + fetcher.getName());
      String info = fetcher.getInfo();
      if (info == null) {
        info = Labels.getLabel("text.fetchers.info.notAvailable");
      }
      messageBox.setMessage(info);
      messageBox.open();
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

    Thread.sleep(10);
    assertEquals(scanTime2, scanInfo.getScanTime());
  }
 
  private Fetcher mockFetcher(String name) {
    Fetcher fetcher = mock(Fetcher.class);
    when(fetcher.getName()).thenReturn(name);
    return fetcher;
  }
View Full Code Here

Examples of net.azib.ipscan.fetchers.Fetcher

    assertEquals(33, preferences.getInt("windowWidth", 0));
  }

  @Test
  public void columnWidths() throws Exception {
    Fetcher fetcher = mock(Fetcher.class);
    when(fetcher.getId()).thenReturn("fetcher.abc");

    config.setColumnWidth(fetcher, 35);
    assertEquals(35, config.getColumnWidth(fetcher));
    assertEquals(35, preferences.getInt("columnWidth." + fetcher.getId(), 0));
  }
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.