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

Java CollectionAction类代码示例

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

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



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

示例1: createAlias

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void createAlias(String alias, String collections)
    throws SolrServerException, IOException {
  SolrServer server = createNewSolrServer("",
      getBaseUrl((HttpSolrServer) clients.get(0)));
  if (random().nextBoolean()) {
    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("collections", collections);
    params.set("name", alias);
    params.set("action", CollectionAction.CREATEALIAS.toString());
    QueryRequest request = new QueryRequest(params);
    request.setPath("/admin/collections");
    server.request(request);
  } else {
    CollectionAdminRequest.CreateAlias.createAlias(alias, collections, server);
  }
  server.shutdown();
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:AliasIntegrationTest.java


示例2: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
public NamedList<Object> createCollection(String name, int numShards, int replicationFactor, 
    String configName, String createNodeSet, String asyncId, Map<String, String> collectionProperties) throws SolrServerException, IOException {
  final ModifiableSolrParams params = new ModifiableSolrParams();
  params.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
  params.set(CoreAdminParams.NAME, name);
  params.set("numShards", numShards);
  params.set("replicationFactor", replicationFactor);
  params.set("collection.configName", configName);
  if (null != createNodeSet) {
    params.set(OverseerCollectionMessageHandler.CREATE_NODE_SET, createNodeSet);
  }
  if (null != asyncId) {
    params.set(CommonAdminParams.ASYNC, asyncId);
  }
  if(collectionProperties != null) {
    for(Map.Entry<String, String> property : collectionProperties.entrySet()){
      params.set(CoreAdminParams.PROPERTY_PREFIX + property.getKey(), property.getValue());
    }
  }
  
  return makeCollectionsRequest(params);
}
 
开发者ID:BorisNaguet,项目名称:solr-maven-plugin,代码行数:23,代码来源:MiniSolrCloudCluster.java


示例3: setUrlScheme

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void setUrlScheme(String value) throws Exception {
  @SuppressWarnings("rawtypes")
  Map m = makeMap("action", CollectionAction.CLUSTERPROP.toString()
      .toLowerCase(Locale.ROOT), "name", "urlScheme", "val", value);
  @SuppressWarnings("unchecked")
  SolrParams params = new MapSolrParams(m);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  
  List<String> urls = new ArrayList<String>();
  for(Replica replica : getReplicas()) {
    urls.add(replica.getStr(ZkStateReader.BASE_URL_PROP));
  }
  //Create new SolrServer to configure new HttpClient w/ SSL config
  new LBHttpSolrServer(urls.toArray(new String[]{})).request(request);
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SSLMigrationTest.java


示例4: setClusterProp

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
public static boolean setClusterProp(CloudSolrServer client, String name , String val) throws SolrServerException, IOException, InterruptedException {
  Map m = makeMap(
      "action", CollectionAction.CLUSTERPROP.toLower(),
      "name",name);

  if(val != null) m.put("val", val);
  SolrRequest request = new QueryRequest(new MapSolrParams(m));
  request.setPath("/admin/collections");
  client.request(request);

  long tomeOut = System.currentTimeMillis() + 3000;
  boolean changed = false;
  while(System.currentTimeMillis() <tomeOut){
    Thread.sleep(10);
    changed = Objects.equals(val,client.getZkStateReader().getClusterProps().get(name));
    if(changed) break;
  }
  return changed;
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:CollectionsAPIDistributedZkTest.java


示例5: deleteAlias

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void deleteAlias(String alias) throws SolrServerException,
    IOException {
  SolrServer server = createNewSolrServer("",
      getBaseUrl((HttpSolrServer) clients.get(0)));
  if (random().nextBoolean()) {
    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("name", alias);
    params.set("action", CollectionAction.DELETEALIAS.toString());
    QueryRequest request = new QueryRequest(params);
    request.setPath("/admin/collections");
    server.request(request);
  } else {
    CollectionAdminRequest.deleteAlias(alias,server);
  }
  server.shutdown();
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:AliasIntegrationTest.java


示例6: verifyCollectionAdminOpPass

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
/**
 * Method to validate collection Admin operation pass
 * @param solrUserName - User authenticated into Solr
 * @param adminOp - Admin operation to be performed
 * @param collectionName - Name of the collection to be queried
 * @param params - SolrParams to use
 * @throws Exception
 */
protected void verifyCollectionAdminOpPass(String solrUserName,
                                           CollectionAction adminOp,
                                           String collectionName,
                                           SolrParams params) throws Exception {
  String originalUser = getAuthenticatedUser();
  try {
    setAuthenticationUser(solrUserName);
    QueryRequest request = populateCollectionAdminParams(adminOp, collectionName, params);
    CloudSolrServer solrServer = createNewCloudSolrServer();
    try {
      solrServer.request(request);
      if (adminOp.compareTo(CollectionAction.CREATE) == 0) {
        // Wait for collection creation to complete.
        waitForRecoveriesToFinish(collectionName, solrServer, false);
      }
    } finally {
      solrServer.shutdown();
    }
  } finally {
    setAuthenticationUser(originalUser);
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:31,代码来源:AbstractSolrSentryTestBase.java


示例7: setupCollectionWithDocSecurity

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void setupCollectionWithDocSecurity(String name, int shards) throws Exception {
  String configDir = RESOURCES_DIR + File.separator + DEFAULT_COLLECTION
    + File.separator + "conf";
  uploadConfigDirToZk(configDir, name);
  // replace solrconfig.xml with solrconfig-doc-level.xml
  uploadConfigFileToZk(configDir + File.separator + "solrconfig-doclevel.xml",
      "solrconfig.xml", name);
  ModifiableSolrParams modParams = new ModifiableSolrParams();
  modParams.set("numShards", shards);
  StringBuilder builder = new StringBuilder();
  for (int i = 0; i < shards; ++i) {
    if (i != 0) {
      builder.append(",");
    }
    builder.append("shard").append(i+1);
  }
  modParams.set("shards", builder.toString());
  verifyCollectionAdminOpPass(ADMIN_USER, CollectionAction.CREATE, name, modParams);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:20,代码来源:TestRealTimeGet.java


示例8: deleteCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
public NamedList<Object> deleteCollection(String name) throws SolrServerException, IOException {
  final ModifiableSolrParams params = new ModifiableSolrParams();
  params.set(CoreAdminParams.ACTION, CollectionAction.DELETE.name());
  params.set(CoreAdminParams.NAME, name);

  return makeCollectionsRequest(params);
}
 
开发者ID:BorisNaguet,项目名称:solr-maven-plugin,代码行数:8,代码来源:MiniSolrCloudCluster.java


示例9: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
protected NamedList<Object> createCollection(CloudSolrClient server, String name, int numShards,
                                             int replicationFactor, String configName) throws Exception {
    ModifiableSolrParams modParams = new ModifiableSolrParams();
    modParams.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
    modParams.set("name", name);
    modParams.set("numShards", numShards);
    modParams.set("replicationFactor", replicationFactor);
    modParams.set("collection.configName", configName);
    QueryRequest request = new QueryRequest(modParams);
    request.setPath("/admin/collections");
    return server.request(request);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:SolrCloudFixture.java


示例10: createAlias

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private NamedList<Object> createAlias(String alias, String collections) throws SolrServerException, IOException {
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("collections", collections);
  params.set("name", alias);
  params.set("action", CollectionAction.CREATEALIAS.toString());
  QueryRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  return cloudClient.request(request);
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:SolrMorphlineZkAliasTest.java


示例11: handleRole

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void handleRole(CollectionAction action, SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException {
  req.getParams().required().check("role", "node");
  Map<String, Object> map = ZkNodeProps.makeMap(Overseer.QUEUE_OPERATION, action.toLower());
  copyIfNotNull(req.getParams(), map,"role", "node");
  ZkNodeProps m = new ZkNodeProps(map);
  if(!KNOWN_ROLES.contains(m.getStr("role"))) throw new SolrException(ErrorCode.BAD_REQUEST,"Unknown role. Supported roles are ,"+ KNOWN_ROLES);
  handleResponse(action.toString().toLowerCase(Locale.ROOT), m, rsp);
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CollectionsHandler.java


示例12: handleAddReplica

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void handleAddReplica(SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException  {
  log.info("Add replica action invoked: " + req.getParamString());
  Map<String,Object> props = new HashMap<>();
  props.put(Overseer.QUEUE_OPERATION, CollectionAction.ADDREPLICA.toString());
  copyIfNotNull(req.getParams(), props, COLLECTION_PROP, "node", SHARD_ID_PROP, ShardParams._ROUTE_,
      CoreAdminParams.NAME, CoreAdminParams.INSTANCE_DIR, CoreAdminParams.DATA_DIR, ASYNC);
  ZkNodeProps m = new ZkNodeProps(props);
  handleResponse(CollectionAction.ADDREPLICA.toString(), m, rsp);
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:CollectionsHandler.java


示例13: setOverseerRole

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void setOverseerRole(CollectionAction action, String overseerDesignate) throws Exception, IOException {
  log.info("Adding overseer designate {} ", overseerDesignate);
  Map m = makeMap(
      "action", action.toString().toLowerCase(Locale.ROOT),
      "role", "overseer",
      "node", overseerDesignate);
  SolrParams params = new MapSolrParams(m);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  client.request(request);
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:OverseerRolesTest.java


示例14: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
protected CollectionAdminResponse createCollection(Map<String, List<Integer>> collectionInfos,
                                                   String collectionName, int numShards, int numReplicas, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
  // TODO: Use CollectionAdminRequest for this test
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.CREATE.toString());

  params.set(OverseerCollectionProcessor.NUM_SLICES, numShards);
  params.set(ZkStateReader.REPLICATION_FACTOR, numReplicas);
  params.set(ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode);
  if (createNodeSetStr != null) params.set(OverseerCollectionProcessor.CREATE_NODE_SET, createNodeSetStr);

  int clientIndex = clients.size() > 1 ? random().nextInt(2) : 0;
  List<Integer> list = new ArrayList<>();
  list.add(numShards);
  list.add(numReplicas);
  if (collectionInfos != null) {
    collectionInfos.put(collectionName, list);
  }
  params.set("name", collectionName);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");

  CollectionAdminResponse res = new CollectionAdminResponse();
  if (client == null) {
    final String baseUrl = ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().substring(
        0,
        ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().length()
            - DEFAULT_COLLECTION.length() - 1);
    
    SolrServer aClient = createNewSolrServer("", baseUrl);
    res.setResponse(aClient.request(request));
    aClient.shutdown();
  } else {
    res.setResponse(client.request(request));
  }
  return res;
}
 
开发者ID:europeana,项目名称:search,代码行数:38,代码来源:BasicDistributedZkTest.java


示例15: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
protected NamedList<Object> createCollection(CloudSolrServer server, String name, int numShards,
    int replicationFactor, String configName) throws Exception {
  ModifiableSolrParams modParams = new ModifiableSolrParams();
  modParams.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
  modParams.set("name", name);
  modParams.set("numShards", numShards);
  modParams.set("replicationFactor", replicationFactor);
  modParams.set("collection.configName", configName);
  QueryRequest request = new QueryRequest(modParams);
  request.setPath("/admin/collections");
  return server.request(request);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TestMiniSolrCloudCluster.java


示例16: deleteCollectionRemovesStaleZkCollectionsNode

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void deleteCollectionRemovesStaleZkCollectionsNode() throws Exception {
  
  // we can use this client because we just want base url
  final String baseUrl = getBaseUrl((HttpSolrServer) clients.get(0));
  
  String collectionName = "out_of_sync_collection";
  
  List<Integer> numShardsNumReplicaList = new ArrayList<>();
  numShardsNumReplicaList.add(2);
  numShardsNumReplicaList.add(1);
  
  
  cloudClient.getZkStateReader().getZkClient().makePath(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true);
  
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.DELETE.toString());
  params.set("name", collectionName);
  QueryRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  try {
    NamedList<Object> resp = createNewSolrServer("", baseUrl)
        .request(request);
    fail("Expected to fail, because collection is not in clusterstate");
  } catch (RemoteSolrException e) {
    
  }
  
  checkForMissingCollection(collectionName);
  
  assertFalse(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true));

}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:CollectionsAPIDistributedZkTest.java


示例17: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
protected void createCollection(Map<String,List<Integer>> collectionInfos,
    String collectionName, int numShards, int numReplicas, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.CREATE.toString());

  params.set(OverseerCollectionProcessor.NUM_SLICES, numShards);
  params.set(OverseerCollectionProcessor.REPLICATION_FACTOR, numReplicas);
  params.set(OverseerCollectionProcessor.MAX_SHARDS_PER_NODE, maxShardsPerNode);
  if (createNodeSetStr != null) params.set(OverseerCollectionProcessor.CREATE_NODE_SET, createNodeSetStr);

  int clientIndex = random().nextInt(2);
  List<Integer> list = new ArrayList<Integer>();
  list.add(numShards);
  list.add(numReplicas);
  if (collectionInfos != null) {
    collectionInfos.put(collectionName, list);
  }
  params.set("name", collectionName);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");

  if (client == null) {
    final String baseUrl = getBaseUrl((HttpSolrServer) clients.get(clientIndex));
    
    createNewSolrServer("", baseUrl).request(request);
  } else {
    client.request(request);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:30,代码来源:AbstractFullDistribZkTestBase.java


示例18: createCollection

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
protected void createCollection(Map<String,List<Integer>> collectionInfos,
    String collectionName, int numShards, int numReplicas, int maxShardsPerNode, SolrServer client, String createNodeSetStr) throws SolrServerException, IOException {
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("action", CollectionAction.CREATE.toString());

  params.set(OverseerCollectionProcessor.NUM_SLICES, numShards);
  params.set(OverseerCollectionProcessor.REPLICATION_FACTOR, numReplicas);
  params.set(OverseerCollectionProcessor.MAX_SHARDS_PER_NODE, maxShardsPerNode);
  if (createNodeSetStr != null) params.set(OverseerCollectionProcessor.CREATE_NODE_SET, createNodeSetStr);

  int clientIndex = random().nextInt(2);
  List<Integer> list = new ArrayList<Integer>();
  list.add(numShards);
  list.add(numReplicas);
  collectionInfos.put(collectionName, list);
  params.set("name", collectionName);
  SolrRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");

  if (client == null) {
    final String baseUrl = ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().substring(
        0,
        ((HttpSolrServer) clients.get(clientIndex)).getBaseURL().length()
            - DEFAULT_COLLECTION.length() - 1);
    
    createNewSolrServer("", baseUrl).request(request);
  } else {
    client.request(request);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:BasicDistributedZkTest.java


示例19: createAlias

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void createAlias(String alias, String collections) throws SolrServerException, IOException {
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("collections", collections);
  params.set("name", alias);
  params.set("action", CollectionAction.CREATEALIAS.toString());
  QueryRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  NamedList<Object> result = createNewSolrServer("", getBaseUrl((HttpSolrServer) clients.get(0))).request(request);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:10,代码来源:AliasIntegrationTest.java


示例20: deleteAlias

import org.apache.solr.common.params.CollectionParams.CollectionAction; //导入依赖的package包/类
private void deleteAlias(String alias) throws SolrServerException, IOException {
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set("name", alias);
  params.set("action", CollectionAction.DELETEALIAS.toString());
  QueryRequest request = new QueryRequest(params);
  request.setPath("/admin/collections");
  NamedList<Object> result = createNewSolrServer("", getBaseUrl((HttpSolrServer) clients.get(0))).request(request);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:9,代码来源:AliasIntegrationTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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