コード例 #1
0
  public static void main(final String[] args) throws IOException, URISyntaxException {
    DesktopSetup.deploy();
    Json.installComponent("com.jfixby.cmns.adopted.gdx.json.RedJson");

    final File words_folder = LocalFileSystem.ApplicationHome().child("words");
    final ChildrenList words_files = words_folder.listDirectChildren();
    final WordsSorter sorter = new WordsSorter(false);
    for (int i = 0; i < words_files.size(); i++) {
      final File file = words_files.getElementAt(i);
      final String file_name = file.getName();
      if (file_name.startsWith("#")) {
        continue;
      }
      L.d("reading", file_name);
      final String data = file.readToString();
      L.d("parsing", file_name);
      final WordCollectorFile content = Json.deserializeFromString(WordCollectorFile.class, data);

      final List<WordCollector> split = Collections.newList(content.values);
      L.d("   adding", split.size());
      sorter.addOthers(split);
    }
    sorter.filter(1);
    sorter.sort();

    // sorter.print();

    final Collection<WordCollector> terms_list = sorter.list();
    terms_list.print("terms_list", 0, 500);
    final Random random = new Random();

    final int EXTRACTIONS = 100;
    final int NUMBER_OF_TERMS = 8;

    for (int i = 0; ; i++) {
      final List<String> batch = Collections.newList();
      for (int k = 0; k < EXTRACTIONS; k++) {
        final String request = generateRequest(NUMBER_OF_TERMS, terms_list, random);
        batch.add(request);
      }
      batch.print("batch generated");
      for (int k = 0; k < batch.size(); k++) {
        final String request = batch.getElementAt(k);
        final String request_url = template + request.replaceAll(" ", "+");
        L.d(request, request_url);
        openUrl(request_url);
        Sys.sleep(10 * 1000);
      }
    }
  }
コード例 #2
0
ファイル: TestBucket.java プロジェクト: JFixby/jfixby-commons
  public static void main(final String[] args) {
    DesktopSetup.deploy();
    final RelativePath target = JUtils.newRelativePath();

    final AmazonS3 s3 = new AmazonS3Client(new ProfileCredentialsProvider());
    final ListObjectsRequest request = new ListObjectsRequest().withBucketName("jfix.by");

    final String prefix = "/";
    request.withPrefix("wp-content");
    request.setDelimiter("");

    final ObjectListing objectListing = s3.listObjects(request);
    final List<String> prefixes = Collections.newList(objectListing.getCommonPrefixes());
    prefixes.print("prefixes");

    final List<S3ObjectSummary> summs = Collections.newList(objectListing.getObjectSummaries());
  }