Java 类com.amazonaws.services.cloudsearchdomain.AmazonCloudSearchDomainClient 实例源码

项目:RekognitionS3Batch    文件:CloudSearchIndexer.java   
public CloudSearchIndexer(AWSCredentialsProvider creds, String index) {
    // Find the Cloud Search Domain endpoint
    AmazonCloudSearchClient cloudsearch = new AmazonCloudSearchClient(creds);
    for (DomainStatus domain : cloudsearch.describeDomains().getDomainStatusList()) {
        Logger.Info(domain.getDomainName());
        if (domain.getDomainName().equals(index))
            searchClient = new AmazonCloudSearchDomainClient(creds)
                .withEndpoint(domain.getDocService().getEndpoint());
    }
    if (searchClient == null) {
        Logger.Info("Could not find Cloud Search index %s, aborting.", index);
        throw new IllegalArgumentException("Unrecognized index.");
    }
}
项目:mcs    文件:CloudSearchService.java   
@PostConstruct
public void initialize() {
  domain = new AmazonCloudSearchDomainClient(new AWSCredentials() {
    @Override
    public String getAWSAccessKeyId() {
      return accessKey;
    }

    @Override
    public String getAWSSecretKey() {
      return secretKey;
    }
  });
  domain.setEndpoint(documentEndPoint);
}
项目:GeoCrawler    文件:CloudSearchIndexWriter.java   
@Override
public void open(JobConf job, String name) throws IOException {
  LOG.debug("CloudSearchIndexWriter.open() name={} ", name);

  maxDocsInBatch = job.getInt(CloudSearchConstants.MAX_DOCS_BATCH, -1);

  buffer = new StringBuffer(MAX_SIZE_BATCH_BYTES).append('[');

  dumpBatchFilesToTemp = job.getBoolean(CloudSearchConstants.BATCH_DUMP,
      false);

  if (dumpBatchFilesToTemp) {
    // only dumping to local file
    // no more config required
    return;
  }

  String endpoint = job.get(CloudSearchConstants.ENDPOINT);

  if (StringUtils.isBlank(endpoint)) {
    throw new RuntimeException("endpoint not set for CloudSearch");
  }

  AmazonCloudSearchClient cl = new AmazonCloudSearchClient();
  if (StringUtils.isNotBlank(regionName)) {
    cl.setRegion(RegionUtils.getRegion(regionName));
  }

  String domainName = null;

  // retrieve the domain name
  DescribeDomainsResult domains = cl
      .describeDomains(new DescribeDomainsRequest());

  Iterator<DomainStatus> dsiter = domains.getDomainStatusList().iterator();
  while (dsiter.hasNext()) {
    DomainStatus ds = dsiter.next();
    if (ds.getDocService().getEndpoint().equals(endpoint)) {
      domainName = ds.getDomainName();
      break;
    }
  }

  // check domain name
  if (StringUtils.isBlank(domainName)) {
    throw new RuntimeException(
        "No domain name found for CloudSearch endpoint");
  }

  DescribeIndexFieldsResult indexDescription = cl.describeIndexFields(
      new DescribeIndexFieldsRequest().withDomainName(domainName));
  for (IndexFieldStatus ifs : indexDescription.getIndexFields()) {
    String indexname = ifs.getOptions().getIndexFieldName();
    String indextype = ifs.getOptions().getIndexFieldType();
    LOG.info("CloudSearch index name {} of type {}", indexname, indextype);
    csfields.put(indexname, indextype);
  }

  client = new AmazonCloudSearchDomainClient();
  client.setEndpoint(endpoint);

}
项目:mosquito-report-api    文件:Indexer.java   
protected AmazonCloudSearchDomain createDomain() {
    return new AmazonCloudSearchDomainClient();
}
项目:dxa-modules    文件:AwsCloudSearchProvider.java   
private AmazonCloudSearchDomainClient getClient(Localization localization) {
    AmazonCloudSearchDomainClient client = new AmazonCloudSearchDomainClient(awsCredentials);
    client.setEndpoint(getServiceUrl(localization));
    return client;
}
项目:Cheddar    文件:AmazonCloudSearchDomainClientBuilder.java   
public static AmazonCloudSearchDomain build(final String endpoint) {
    final AmazonCloudSearchDomain amazonCloudSearchDomain = new AmazonCloudSearchDomainClient();
    amazonCloudSearchDomain.setEndpoint(endpoint);
    return amazonCloudSearchDomain;
}
项目:storm-crawler    文件:CloudSearchIndexerBolt.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void prepare(Map conf, TopologyContext context,
        OutputCollector collector) {
    super.prepare(conf, context, collector);
    _collector = collector;

    this.eventCounter = context.registerMetric("CloudSearchIndexer",
            new MultiCountMetric(), 10);

    maxTimeBuffered = ConfUtils.getInt(conf,
            CloudSearchConstants.MAX_TIME_BUFFERED, 10);

    maxDocsInBatch = ConfUtils.getInt(conf,
            CloudSearchConstants.MAX_DOCS_BATCH, -1);

    buffer = new StringBuffer(MAX_SIZE_BATCH_BYTES).append('[');

    dumpBatchFilesToTemp = ConfUtils.getBoolean(conf,
            "cloudsearch.batch.dump", false);

    if (dumpBatchFilesToTemp) {
        // only dumping to local file
        // no more config required
        return;
    }

    String endpoint = ConfUtils.getString(conf, "cloudsearch.endpoint");

    if (StringUtils.isBlank(endpoint)) {
        String message = "Missing CloudSearch endpoint";
        LOG.error(message);
        throw new RuntimeException(message);
    }

    String regionName = ConfUtils.getString(conf,
            CloudSearchConstants.REGION);

    AmazonCloudSearchClient cl = new AmazonCloudSearchClient();
    if (StringUtils.isNotBlank(regionName)) {
        cl.setRegion(RegionUtils.getRegion(regionName));
    }

    String domainName = null;

    // retrieve the domain name
    DescribeDomainsResult domains = cl
            .describeDomains(new DescribeDomainsRequest());

    Iterator<DomainStatus> dsiter = domains.getDomainStatusList()
            .iterator();
    while (dsiter.hasNext()) {
        DomainStatus ds = dsiter.next();
        if (ds.getDocService().getEndpoint().equals(endpoint)) {
            domainName = ds.getDomainName();
            break;
        }
    }
    // check domain name
    if (StringUtils.isBlank(domainName)) {
        throw new RuntimeException(
                "No domain name found for CloudSearch endpoint");
    }

    DescribeIndexFieldsResult indexDescription = cl
            .describeIndexFields(new DescribeIndexFieldsRequest()
                    .withDomainName(domainName));
    for (IndexFieldStatus ifs : indexDescription.getIndexFields()) {
        String indexname = ifs.getOptions().getIndexFieldName();
        String indextype = ifs.getOptions().getIndexFieldType();
        LOG.info("CloudSearch index name {} of type {}", indexname,
                indextype);
        csfields.put(indexname, indextype);
    }

    client = new AmazonCloudSearchDomainClient();
    client.setEndpoint(endpoint);
}