• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DomainStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.cloudsearchv2.model.DomainStatus的典型用法代码示例。如果您正苦于以下问题:Java DomainStatus类的具体用法?Java DomainStatus怎么用?Java DomainStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DomainStatus类属于com.amazonaws.services.cloudsearchv2.model包,在下文中一共展示了DomainStatus类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: postConstruct

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@PostConstruct
protected void postConstruct() {
    DescribeDomainsRequest describeDomainsRequest = new DescribeDomainsRequest().withDomainNames(getDomainName());
    List<DomainStatus> list = amazonCloudSearch.describeDomains(describeDomainsRequest).getDomainStatusList();

    if (list.isEmpty()) {
        throw new InternalServerErrorException("Could not find CloudSearch domain: " + getDomainName());
    }

    ServiceEndpoint searchService = list.get(0).getSearchService();

    if (searchService == null || searchService.getEndpoint() == null) {
        throw new InternalServerErrorException("Could not find SearchService for: " + getDomainName());
    }
    
    domain = createDomain();
    domain.setEndpoint(searchService.getEndpoint());
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:19,代码来源:Indexer.java


示例2: testThrowsExecptionWhenSearchServiceDoesNotExist

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Test
public void testThrowsExecptionWhenSearchServiceDoesNotExist() {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint()))));

    try {
        // TODO suppress exception stacktrace
        getService(ModelIndexer.class);
    } catch (MultiException e) {
        assertEquals("Could not find SearchService for: test-model", e.getCause().getMessage());

        return;
    }

    fail("Was expection an exception");
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:17,代码来源:IndexerTest.java


示例3: testSearchCenter

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Test
public void testSearchCenter() {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint().withEndpoint("http://localhost")))));

    HashMap<String, List<String>> map = Maps.newHashMap();
    map.put("property", Lists.newArrayList("value"));
    SearchResult expected = new SearchResult().withHits(new Hits().withHit(new Hit().withFields(map)));
    
    ArgumentCaptor<SearchRequest> requestCaptor = ArgumentCaptor.forClass(SearchRequest.class);
    
    when(domain.search(requestCaptor.capture())).thenReturn(expected);
    
    List<ObjectNode> result = getService(ModelIndexer.class).searchCenter("0,0");
    
    SearchRequest request = requestCaptor.getValue();
    
    assertEquals("value", result.get(0).get("property").asText());
    assertEquals("latlon:['0.1,-0.1','-0.1,0.1']", request.getQuery());
    assertEquals("{\"distance\":\"haversin(0.0,0.0,latlon.latitude,latlon.longitude)\"}", request.getExpr());
    assertEquals("distance asc", request.getSort());
    assertEquals(Long.valueOf(30L), request.getSize());
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:24,代码来源:IndexerTest.java


示例4: cloudSearchDomainAsyncClients

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Bean
public Map<String, AmazonCloudSearchDomainAsyncClient> cloudSearchDomainAsyncClients(
		AmazonCloudSearchClient cloudSearchClient, AWSCredentialsProvider awsCredentialsProvider) {
	DescribeDomainsResult describeDomainsResult = cloudSearchClient.describeDomains();
	List<DomainStatus> domainStatusList = describeDomainsResult.getDomainStatusList();
	Map<String, AmazonCloudSearchDomainAsyncClient> domainClients = new HashMap<>(domainStatusList.size());
	for (DomainStatus domainStatus : domainStatusList) {
		log.debug("domainStatus: {}", domainStatus);
		String domainName = domainStatus.getDomainName();
		if (domainStatus.isCreated() && !domainStatus.isDeleted()) {
			log.info("creating AmazonCloudSearchDomainClient for {} domain", domainName);
			ServiceEndpoint serviceEndpoint = domainStatus.getDocService();
			AmazonCloudSearchDomainAsyncClient domainClient = new AmazonCloudSearchDomainAsyncClient(
					awsCredentialsProvider, client)
			.withEndpoint(serviceEndpoint.getEndpoint());
			domainClients.put(domainName, domainClient);
		} else {
			log.info("skipping domain {}: created = {}, deleted = {}", domainName, domainStatus.isCreated(),
					domainStatus.isDeleted());
		}
	}
	return domainClients;
}
 
开发者ID:efenderbosch,项目名称:spring-boot-aws-cloudsearch,代码行数:24,代码来源:CloudSearchConfig.java


示例5: CloudSearchIndexer

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
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.");
    }
}
 
开发者ID:jhy,项目名称:RekognitionS3Batch,代码行数:15,代码来源:CloudSearchIndexer.java


示例6: testCreateDomain

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Test
public void testCreateDomain() {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint().withEndpoint("http://localhost")))));
    
    AmazonCloudSearchDomain domain = getService(ModelIndexer2.class).createDomain();
    assertNotNull(domain);
    assertTrue(domain instanceof AmazonCloudSearchDomain);
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:10,代码来源:IndexerTest.java


示例7: scanCloudSearch

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
/**
 * Collect data for CloudSearch.
 *
 * @param stats
 *            current statistics object.
 * @param account
 *            currently used credentials object.
 * @param region
 *            currently used aws region.
 */
public static void scanCloudSearch(AwsStats stats, AwsAccount account, Regions region) {
	LOG.debug("Scan for CloudSearch in region " + region.getName() + " in account " + account.getAccountId());

	try {
		AmazonCloudSearchClient cs = new AmazonCloudSearchClient(account.getCredentials());
		cs.setRegion(Region.getRegion(region));

		int totalDomains = 0;
		for (DomainStatus ds : cs.describeDomains().getDomainStatusList()) {
			AwsResource res = new AwsResource(ds.getDomainName(), account.getAccountId(), AwsResourceType.CloudSearch, region);
			res.addInfo("Endpoint", ds.getSearchService().getEndpoint());
			res.addInfo("SearchInstanceType", ds.getSearchInstanceType());
			res.addInfo("SearchInstanceCount", ds.getSearchInstanceCount());
			res.addInfo("ARN", ds.getARN());
			stats.add(res);
			totalDomains++;
		}

		LOG.info(totalDomains + " CloudSearch domains in region " + region.getName() + " in account " + account.getAccountId());
	} catch (AmazonServiceException ase) {
		if (ase.getErrorCode().contains("AccessDenied")) {
			LOG.info("Access denied for CloudSearch in region " + region.getName() + " in account " + account.getAccountId());
		} else {
			LOG.error("Exception of CloudSearch: " + ase.getMessage());
		}
	} catch (Exception ex) {
		LOG.error("Exception of CloudSearch: " + ex.getMessage());
	}
}
 
开发者ID:janloeffler,项目名称:aws-utilization-monitor,代码行数:40,代码来源:AwsScan.java


示例8: cacheDomainEndpoints

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
private void cacheDomainEndpoints() {
    if (cloudSearchClient != null && !domainEndpointsCached) {
        final Set<String> managedDomains = new HashSet<>();
        for (final DocumentConfiguration documentConfiguration : documentConfigurations.values()) {
            final String domainName = documentConfigurationHolder.schemaName() + "-"
                    + documentConfiguration.namespace();
            managedDomains.add(domainName);
        }
        final DescribeDomainsRequest describeDomainsRequest = new DescribeDomainsRequest();
        describeDomainsRequest.setDomainNames(managedDomains);
        final DescribeDomainsResult describeDomainsResult = cloudSearchClient
                .describeDomains(describeDomainsRequest);
        final List<DomainStatus> domainStatusList = describeDomainsResult.getDomainStatusList();
        if (domainStatusList.size() != managedDomains.size()) {
            logger.info("Unable to cache CloudSearch document/search endpoints for: " + managedDomains);
        } else {
            for (final DomainStatus domainStatus : domainStatusList) {
                if (domainStatus.isCreated() && !domainStatus.isDeleted()) {
                    final String documentServiceEndpoint = domainStatus.getDocService().getEndpoint();
                    final String searchServiceEndpoint = domainStatus.getSearchService().getEndpoint();
                    if (documentServiceEndpoint == null || searchServiceEndpoint == null) {
                        domainEndpointsCached = false;
                        return;
                    }
                    final AmazonCloudSearchDomain documentServiceClient = AmazonCloudSearchDomainClientBuilder
                            .build(documentServiceEndpoint);
                    final AmazonCloudSearchDomain searchServiceClient = AmazonCloudSearchDomainClientBuilder
                            .build(searchServiceEndpoint);
                    documentServiceClients.put(domainStatus.getDomainName(), documentServiceClient);
                    searchServiceClients.put(domainStatus.getDomainName(), searchServiceClient);
                }
            }
            domainEndpointsCached = true;
        }
    }
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:37,代码来源:CloudSearchEngine.java


示例9: getDescribeDomainsResult

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
private DescribeDomainsResult getDescribeDomainsResult(final String domainName,
        final String documentServiceEndpoint, final String searchServiceEndpoint) {
    return new DescribeDomainsResult()
            .withDomainStatusList(new DomainStatus().withDomainName(domainName).withCreated(true).withDeleted(false)
                    .withDocService(new ServiceEndpoint().withEndpoint(documentServiceEndpoint))
                    .withSearchService(new ServiceEndpoint().withEndpoint(searchServiceEndpoint)));
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:8,代码来源:CloudSearchEngineTest.java


示例10: open

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@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);

}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:63,代码来源:CloudSearchIndexWriter.java


示例11: testIndexJsonProcessingException

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Test
public void testIndexJsonProcessingException() throws Exception {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint().withEndpoint("http://localhost")))));
    
    Model model = new Model();
    model.setGuid("00000000-0000-0000-0000-000000000000");
    
    ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
    
    getService(ModelIndexer.class).index(Lists.newArrayList(model));
    
    verify(executor).submit(runnableCaptor.capture());
    
    when(objectMapper.writeValueAsString(any())).thenThrow(new StubJsonProcessingException());
    
    runnableCaptor.getValue().run();
    
    verify(domain, never()).uploadDocuments(any());
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:21,代码来源:IndexerTest.java


示例12: prepare

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@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);
}
 
开发者ID:DigitalPebble,项目名称:storm-crawler,代码行数:79,代码来源:CloudSearchIndexerBolt.java


示例13: testIndex

import com.amazonaws.services.cloudsearchv2.model.DomainStatus; //导入依赖的package包/类
@Test
public void testIndex() throws Exception {
    when(amazonCloudSearch.describeDomains(any())).thenReturn(new DescribeDomainsResult()
            .withDomainStatusList(Lists.newArrayList(new DomainStatus().withSearchService(new ServiceEndpoint().withEndpoint("http://localhost")))));
    
    objectMapper = new ObjectMapper();
    
    Model model = new Model();
    model.setGuid("00000000-0000-0000-0000-000000000000");
    
    ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
    
    getService(ModelIndexer.class).index(model);
    
    verify(executor).submit(runnableCaptor.capture());
    
    runnableCaptor.getValue().run();
    
    ArgumentCaptor<UploadDocumentsRequest> requestCaptor = ArgumentCaptor.forClass(UploadDocumentsRequest.class);
    
    verify(domain).uploadDocuments(requestCaptor.capture());
    
    Scanner scanner = new Scanner(requestCaptor.getValue().getDocuments());
    
    JsonNode json = new ObjectMapper().readTree(scanner.useDelimiter("\\A").next()).get(0);
    
    assertEquals("add", json.get("type").asText());
    assertEquals("00000000-0000-0000-0000-000000000000", json.get("id").asText());
    assertEquals("00000000-0000-0000-0000-000000000000", json.get("fields").get("guid").asText());
    
    scanner.close();
}
 
开发者ID:coding4people,项目名称:mosquito-report-api,代码行数:33,代码来源:IndexerTest.java



注:本文中的com.amazonaws.services.cloudsearchv2.model.DomainStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GeneralName类代码示例发布时间:2022-05-23
下一篇:
Java Axis类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap