Java源码示例:org.apache.solr.common.params.CoreAdminParams
示例1
@Override
public void execute(CoreAdminHandler.CallInfo it) throws Exception {
SolrParams params = it.req.getParams();
String cname = params.get(CoreAdminParams.CORE);
String indexInfo = params.get(CoreAdminParams.INDEX_INFO);
boolean isIndexInfoNeeded = Boolean.parseBoolean(null == indexInfo ? "true" : indexInfo);
NamedList<Object> status = new SimpleOrderedMap<>();
Map<String, Exception> failures = new HashMap<>();
for (Map.Entry<String, CoreContainer.CoreLoadFailure> failure : it.handler.coreContainer.getCoreInitFailures().entrySet()) {
failures.put(failure.getKey(), failure.getValue().exception);
}
if (cname == null) {
for (String name : it.handler.coreContainer.getAllCoreNames()) {
status.add(name, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, name, isIndexInfoNeeded));
}
it.rsp.add("initFailures", failures);
} else {
failures = failures.containsKey(cname)
? Collections.singletonMap(cname, failures.get(cname))
: Collections.<String, Exception>emptyMap();
it.rsp.add("initFailures", failures);
status.add(cname, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, cname, isIndexInfoNeeded));
}
it.rsp.add("status", status);
}
示例2
/**
* Send request to all replicas of a slice
* @return List of replicas which is not live for receiving the request
*/
public List<Replica> sliceCmd(ClusterState clusterState, ModifiableSolrParams params, Replica.State stateMatcher,
Slice slice, ShardHandler shardHandler) {
List<Replica> notLiveReplicas = new ArrayList<>();
for (Replica replica : slice.getReplicas()) {
if ((stateMatcher == null || Replica.State.getState(replica.getStr(ZkStateReader.STATE_PROP)) == stateMatcher)) {
if (clusterState.liveNodesContain(replica.getStr(ZkStateReader.NODE_NAME_PROP))) {
// For thread safety, only simple clone the ModifiableSolrParams
ModifiableSolrParams cloneParams = new ModifiableSolrParams();
cloneParams.add(params);
cloneParams.set(CoreAdminParams.CORE, replica.getStr(ZkStateReader.CORE_NAME_PROP));
sendShardRequest(replica.getStr(ZkStateReader.NODE_NAME_PROP), cloneParams, shardHandler);
} else {
notLiveReplicas.add(replica);
}
}
}
return notLiveReplicas;
}
示例3
/**
* Asserts that the input {@link ShardState} and the CoreAdmin.SUMMARY response give the same information.
*
* @param state the {@link ShardState} instance.
* @param core the target {@link SolrCore} instance.
*/
public static void assertShardAndCoreSummaryConsistency(ShardState state, SolrCore core) {
SolrParams params =
new ModifiableSolrParams()
.add(CoreAdminParams.CORE, core.getName())
.add(CoreAdminParams.ACTION, "SUMMARY");
SolrQueryRequest request = new LocalSolrQueryRequest(core, params);
SolrQueryResponse response = new SolrQueryResponse();
coreAdminHandler(core).handleRequest(request, response);
NamedList<?> summary =
ofNullable(response.getValues())
.map(values -> values.get("Summary"))
.map(NamedList.class::cast)
.map(values -> values.get(core.getName()))
.map(NamedList.class::cast)
.orElseGet(NamedList::new);
assertEquals(state.getLastIndexedChangeSetId(), summary.get("Id for last Change Set in index"));
assertEquals(state.getLastIndexedChangeSetCommitTime(), summary.get("Last Index Change Set Commit Time"));
assertEquals(state.getLastIndexedTxCommitTime(), summary.get("Last Index TX Commit Time"));
assertEquals(state.getLastIndexedTxId(), summary.get("Id for last TX in index"));
}
示例4
@SuppressWarnings("unchecked")
public CollectionSnapshotMetaData(Map<String, Object> data) {
this.name = (String)data.get(CoreAdminParams.NAME);
this.status = SnapshotStatus.valueOf((String)data.get(SolrSnapshotManager.SNAPSHOT_STATUS));
this.creationDate = new Date((Long)data.get(SolrSnapshotManager.CREATION_DATE));
this.replicaSnapshots = new ArrayList<>();
List<Object> r = (List<Object>) data.get(SolrSnapshotManager.SNAPSHOT_REPLICAS);
for (Object x : r) {
Map<String, Object> info = (Map<String, Object>)x;
String coreName = (String)info.get(CoreAdminParams.CORE);
String indexDirPath = (String)info.get(SolrSnapshotManager.INDEX_DIR_PATH);
long generationNumber = (Long) info.get(SolrSnapshotManager.GENERATION_NUM);
String shardId = (String)info.get(SolrSnapshotManager.SHARD_ID);
boolean leader = (Boolean) info.get(SolrSnapshotManager.LEADER);
Collection<String> files = (Collection<String>)info.get(SolrSnapshotManager.FILE_LIST);
replicaSnapshots.add(new CoreSnapshotMetaData(coreName, indexDirPath, generationNumber, shardId, leader, files));
}
}
示例5
@Test
public void testNonexistentCoreReload() throws Exception {
final CoreAdminHandler admin = new CoreAdminHandler(h.getCoreContainer());
SolrQueryResponse resp = new SolrQueryResponse();
SolrException e = expectThrows(SolrException.class, () -> {
admin.handleRequestBody(
req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.RELOAD.toString(),
CoreAdminParams.CORE, "non-existent-core")
, resp);
});
assertEquals("Expected error message for non-existent core.", "No such core: non-existent-core", e.getMessage());
// test null core
e = expectThrows(SolrException.class, () -> {
admin.handleRequestBody(
req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.RELOAD.toString())
, resp);
});
assertEquals("Expected error message for non-existent core.", "Missing required parameter: core", e.getMessage());
admin.close();
}
示例6
private void checkStatus(CoreContainer cc, Boolean ok, String core) throws Exception {
SolrQueryResponse resp = new SolrQueryResponse();
try (final CoreAdminHandler admin = new CoreAdminHandler(cc)) {
admin.handleRequestBody
(req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.STATUS.toString(),
CoreAdminParams.CORE, core),
resp);
}
@SuppressWarnings({"unchecked"})
Map<String, Exception> failures =
(Map<String, Exception>) resp.getValues().get("initFailures");
if (ok) {
if (failures.size() != 0) {
fail("Should have cleared the error, but there are failues " + failures.toString());
}
} else {
if (failures.size() == 0) {
fail("Should have had errors here but the status return has no failures!");
}
}
}
示例7
@Override
public SolrParams getParams() {
ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();
params.set(CoreAdminParams.COLLECTION, collection);
if(this.maxWaitSeconds != null) {
params.set("maxWaitSeconds", this.maxWaitSeconds);
}
if(this.maxAtOnce != null) {
params.set("maxAtOnce", this.maxAtOnce);
}
return params;
}
示例8
@Override
public SolrParams getParams() {
ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();
params.set(CoreAdminParams.COLLECTION, collection);
params.set(CoreAdminParams.NAME, name);
params.set(CoreAdminParams.BACKUP_LOCATION, location); //note: optional
if (repositoryName.isPresent()) {
params.set(CoreAdminParams.BACKUP_REPOSITORY, repositoryName.get());
}
if (commitName.isPresent()) {
params.set(CoreAdminParams.COMMIT_NAME, commitName.get());
}
if (indexBackupStrategy.isPresent()) {
params.set(CollectionAdminParams.INDEX_BACKUP_STRATEGY, indexBackupStrategy.get());
}
return params;
}
示例9
@Override
public void execute(CoreAdminHandler.CallInfo it) throws Exception {
final SolrParams params = it.req.getParams();
String commitName = params.required().get(CoreAdminParams.COMMIT_NAME);
String cname = params.required().get(CoreAdminParams.CORE);
CoreContainer cc = it.handler.getCoreContainer();
SolrCore core = cc.getCore(cname);
if (core == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unable to locate core " + cname);
}
try {
core.deleteNamedSnapshot(commitName);
// Ideally we shouldn't need this. This is added since the RPC logic in
// OverseerCollectionMessageHandler can not provide the coreName as part of the result.
it.rsp.add(CoreAdminParams.CORE, core.getName());
it.rsp.add(CoreAdminParams.COMMIT_NAME, commitName);
} finally {
core.close();
}
}
示例10
@Test
public void testAsyncCreateCollectionCleanup() throws Exception {
final CloudSolrClient cloudClient = cluster.getSolrClient();
String collectionName = "foo2";
assertThat(CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));
// Create a collection that would fail
CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,"conf1",1,1);
Properties properties = new Properties();
Path tmpDir = createTempDir();
tmpDir = tmpDir.resolve("foo");
Files.createFile(tmpDir);
properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
create.setAsyncId("testAsyncCreateCollectionCleanup");
create.process(cloudClient);
RequestStatusState state = AbstractFullDistribZkTestBase.getRequestStateAfterCompletion("testAsyncCreateCollectionCleanup", 30, cloudClient);
assertThat(state.getKey(), is("failed"));
// Confirm using LIST that the collection does not exist
assertThat("Failed collection is still in the clusterstate: " + cluster.getSolrClient().getClusterStateProvider().getClusterState().getCollectionOrNull(collectionName),
CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));
}
示例11
static List<ZkNodeProps> getReplicasOfNode(String source, ClusterState state) {
List<ZkNodeProps> sourceReplicas = new ArrayList<>();
for (Map.Entry<String, DocCollection> e : state.getCollectionsMap().entrySet()) {
for (Slice slice : e.getValue().getSlices()) {
for (Replica replica : slice.getReplicas()) {
if (source.equals(replica.getNodeName())) {
ZkNodeProps props = new ZkNodeProps(
COLLECTION_PROP, e.getKey(),
SHARD_ID_PROP, slice.getName(),
ZkStateReader.CORE_NAME_PROP, replica.getCoreName(),
ZkStateReader.REPLICA_PROP, replica.getName(),
ZkStateReader.REPLICA_TYPE, replica.getType().name(),
ZkStateReader.LEADER_PROP, String.valueOf(replica.equals(slice.getLeader())),
CoreAdminParams.NODE, source);
sourceReplicas.add(props);
}
}
}
}
return sourceReplicas;
}
示例12
private void tryCreateFail(CoreAdminHandler admin, String name, String dataDir, String... errs) throws Exception {
SolrException thrown = expectThrows(SolrException.class, () -> {
SolrQueryResponse resp = new SolrQueryResponse();
SolrQueryRequest request = req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.CREATE.toString(),
CoreAdminParams.DATA_DIR, dataDir,
CoreAdminParams.NAME, name,
"schema", "schema.xml",
"config", "solrconfig.xml");
admin.handleRequestBody(request, resp);
});
assertEquals("Exception code should be 500", 500, thrown.code());
for (String err : errs) {
assertTrue("Should have seen an exception containing the an error",
thrown.getMessage().contains(err));
}
}
示例13
@Test
public void testCreateCollectionCleanup() throws Exception {
final CloudSolrClient cloudClient = cluster.getSolrClient();
String collectionName = "foo";
assertThat(CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));
// Create a collection that would fail
CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection(collectionName,"conf1",1,1);
Properties properties = new Properties();
Path tmpDir = createTempDir();
tmpDir = tmpDir.resolve("foo");
Files.createFile(tmpDir);
properties.put(CoreAdminParams.DATA_DIR, tmpDir.toString());
create.setProperties(properties);
expectThrows(BaseHttpSolrClient.RemoteSolrException.class, () -> {
create.process(cloudClient);
});
// Confirm using LIST that the collection does not exist
assertThat("Failed collection is still in the clusterstate: " + cluster.getSolrClient().getClusterStateProvider().getClusterState().getCollectionOrNull(collectionName),
CollectionAdminRequest.listCollections(cloudClient), not(hasItem(collectionName)));
}
示例14
@SuppressWarnings("unchecked")
public CollectionSnapshotMetaData(NamedList<Object> data) {
this.name = (String)data.get(CoreAdminParams.NAME);
String statusStr = (String)data.get(SolrSnapshotManager.SNAPSHOT_STATUS);
this.creationDate = new Date((Long)data.get(SolrSnapshotManager.CREATION_DATE));
this.status = SnapshotStatus.valueOf(statusStr);
this.replicaSnapshots = new ArrayList<>();
NamedList<Object> r = (NamedList<Object>) data.get(SolrSnapshotManager.SNAPSHOT_REPLICAS);
for (Map.Entry<String,Object> x : r) {
NamedList<Object> info = (NamedList<Object>)x.getValue();
String coreName = (String)info.get(CoreAdminParams.CORE);
String indexDirPath = (String)info.get(SolrSnapshotManager.INDEX_DIR_PATH);
long generationNumber = (Long) info.get(SolrSnapshotManager.GENERATION_NUM);
String shardId = (String)info.get(SolrSnapshotManager.SHARD_ID);
boolean leader = (Boolean) info.get(SolrSnapshotManager.LEADER);
Collection<String> files = (Collection<String>)info.get(SolrSnapshotManager.FILE_LIST);
replicaSnapshots.add(new CoreSnapshotMetaData(coreName, indexDirPath, generationNumber, shardId, leader, files));
}
}
示例15
@Test(expected = SolrException.class)
public void testUnhandled() throws Exception
{
SolrQueryResponse resp = new SolrQueryResponse();
admin.handleRequestBody(req(CoreAdminParams.ACTION, "totalnonsense",
CoreAdminParams.NAME, getCore().getName()),
resp);
}
示例16
@SuppressWarnings({"unchecked"})
private void reloadCollection(ClusterState clusterState, ZkNodeProps message, @SuppressWarnings({"rawtypes"})NamedList results) {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
String asyncId = message.getStr(ASYNC);
collectionCmd(message, params, results, Replica.State.ACTIVE, asyncId);
}
示例17
public void testDefaultSchemaFactory() throws Exception {
deleteCore();
initCore("solrconfig-managed-schema-test.xml", "schema-minimal.xml", tmpSolrHome.getPath());
final CoreContainer cores = h.getCoreContainer();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
SolrQueryRequest request = req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
SolrQueryResponse response = new SolrQueryResponse();
admin.handleRequestBody(request, response);
assertNull("Exception on create", response.getException());
assertSchemaResource(collection, "managed-schema");
}
示例18
/** Check that when an unknown action is provided we don't generate a report. */
@Test(expected = SolrException.class)
public void handleCustomActionUnknownAction()
{
when(params.get(CoreAdminParams.ACTION)).thenReturn("Unknown");
alfrescoCoreAdminHandler.handleCustomAction(req, rsp);
verify(rsp, never()).add(anyString(), any());
}
示例19
@Test
public void testLoadReporter() throws Exception {
Random random = random();
String className = MockMetricReporter.class.getName();
String reporterName = TestUtil.randomUnicodeString(random);
String taggedName = reporterName + "@" + coreMetricManager.getTag();
Map<String, Object> attrs = new HashMap<>();
attrs.put(FieldType.CLASS_NAME, className);
attrs.put(CoreAdminParams.NAME, reporterName);
boolean shouldDefineConfigurable = random.nextBoolean();
String configurable = TestUtil.randomUnicodeString(random);
if (shouldDefineConfigurable) attrs.put("configurable", configurable);
boolean shouldDefinePlugin = random.nextBoolean();
PluginInfo pluginInfo = shouldDefinePlugin ? new PluginInfo(TestUtil.randomUnicodeString(random), attrs) : null;
try {
metricManager.loadReporter(coreMetricManager.getRegistryName(), coreMetricManager.getCore(),
pluginInfo, coreMetricManager.getTag());
assertNotNull(pluginInfo);
Map<String, SolrMetricReporter> reporters = metricManager.getReporters(coreMetricManager.getRegistryName());
assertTrue("reporters.size should be > 0, but was + " + reporters.size(), reporters.size() > 0);
assertNotNull("reporter " + reporterName + " not present among " + reporters, reporters.get(taggedName));
assertTrue("wrong reporter class: " + reporters.get(taggedName), reporters.get(taggedName) instanceof MockMetricReporter);
} catch (IllegalArgumentException e) {
assertTrue(pluginInfo == null || attrs.get("configurable") == null);
assertNull(metricManager.getReporters(coreMetricManager.getRegistryName()).get(taggedName));
}
}
示例20
/**
* Calls the Admin handler with an action.
*/
protected static SolrQueryResponse callHandler(AlfrescoCoreAdminHandler coreAdminHandler, SolrCore testingCore, String action)
{
SolrQueryRequest request = new LocalSolrQueryRequest(testingCore,
params(CoreAdminParams.ACTION, action, CoreAdminParams.CORE, testingCore.getName()));
SolrQueryResponse response = new SolrQueryResponse();
coreAdminHandler.handleCustomAction(request, response);
return response;
}
示例21
public List<String> getCoreList() throws IOException, SolrServerException {
SolrClient solrClient = getSolrclient(null);
CoreAdminRequest coreAdminRequest = new CoreAdminRequest();
coreAdminRequest.setAction(CoreAdminParams.CoreAdminAction.STATUS);
CoreAdminResponse cores = coreAdminRequest.process(solrClient);
List<String> coreList = new ArrayList<String>();
for (int i = 0; i < cores.getCoreStatus().size(); i++) {
coreList.add(cores.getCoreStatus().getName(i));
}
return coreList;
}
示例22
@Test
public void test() throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
QueryRequest request = new QueryRequest(params);
request.setPath("/admin/cores");
int which = r.nextInt(clients.size());
HttpSolrClient client = (HttpSolrClient)clients.get(which);
String previousBaseURL = client.getBaseURL();
// Strip /collection1 step from baseURL - requests fail otherwise
client.setBaseURL(previousBaseURL.substring(0, previousBaseURL.lastIndexOf("/")));
@SuppressWarnings({"rawtypes"})
NamedList namedListResponse = client.request(request);
client.setBaseURL(previousBaseURL); // Restore baseURL
@SuppressWarnings({"rawtypes"})
NamedList status = (NamedList)namedListResponse.get("status");
@SuppressWarnings({"rawtypes"})
NamedList collectionStatus = (NamedList)status.getVal(0);
String collectionSchema = (String)collectionStatus.get(CoreAdminParams.SCHEMA);
// Make sure the upgrade to managed schema happened
assertEquals("Schema resource name differs from expected name", "managed-schema", collectionSchema);
SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), 30000);
try {
// Make sure "DO NOT EDIT" is in the content of the managed schema
String fileContent = getFileContentFromZooKeeper(zkClient, "/solr/configs/conf1/managed-schema");
assertTrue("Managed schema is missing", fileContent.contains("DO NOT EDIT"));
// Make sure the original non-managed schema is no longer in ZooKeeper
assertFileNotInZooKeeper(zkClient, "/solr/configs/conf1", "schema.xml");
// Make sure the renamed non-managed schema is present in ZooKeeper
fileContent = getFileContentFromZooKeeper(zkClient, "/solr/configs/conf1/schema.xml.bak");
assertTrue("schema file doesn't contain '<schema'", fileContent.contains("<schema"));
} finally {
if (zkClient != null) {
zkClient.close();
}
}
}
示例23
public static CreateReplica assignReplicaDetails(SolrCloudManager cloudManager, ClusterState clusterState,
ZkNodeProps message, ReplicaPosition replicaPosition) {
boolean skipCreateReplicaInClusterState = message.getBool(SKIP_CREATE_REPLICA_IN_CLUSTER_STATE, false);
String collection = message.getStr(COLLECTION_PROP);
String node = replicaPosition.node;
String shard = message.getStr(SHARD_ID_PROP);
String coreName = message.getStr(CoreAdminParams.NAME);
String coreNodeName = message.getStr(CoreAdminParams.CORE_NODE_NAME);
Replica.Type replicaType = replicaPosition.type;
if (StringUtils.isBlank(coreName)) {
coreName = message.getStr(CoreAdminParams.PROPERTY_PREFIX + CoreAdminParams.NAME);
}
log.info("Node Identified {} for creating new replica of shard {} for collection {}", node, shard, collection);
if (!clusterState.liveNodesContain(node)) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Node: " + node + " is not live");
}
DocCollection coll = clusterState.getCollection(collection);
if (coreName == null) {
coreName = Assign.buildSolrCoreName(cloudManager.getDistribStateManager(), coll, shard, replicaType);
} else if (!skipCreateReplicaInClusterState) {
//Validate that the core name is unique in that collection
for (Slice slice : coll.getSlices()) {
for (Replica replica : slice.getReplicas()) {
String replicaCoreName = replica.getStr(CORE_NAME_PROP);
if (coreName.equals(replicaCoreName)) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Another replica with the same core name already exists" +
" for this collection");
}
}
}
}
log.info("Returning CreateReplica command.");
return new CreateReplica(collection, shard, node, replicaType, coreName, coreNodeName);
}
示例24
/**
* Maintenance method
* @param txnId
* @throws Exception
*/
public static void reindexTransactionId(long txnId) throws Exception
{
CoreAdminHandler admin = getMultiCoreHandler();
SolrQueryResponse resp = new SolrQueryResponse();
admin.handleRequestBody(req(CoreAdminParams.ACTION,
"REINDEX",
CoreAdminParams.NAME,
getCore().getName(),
"txid", Long.toString(txnId)),
resp);
}
示例25
@SuppressWarnings({"rawtypes", "unchecked"})
public NamedList toNamedList() {
NamedList result = new NamedList();
result.add(CoreAdminParams.NAME, this.name);
result.add(SolrSnapshotManager.SNAPSHOT_STATUS, this.status.toString());
result.add(SolrSnapshotManager.CREATION_DATE, this.getCreationDate().getTime());
NamedList replicas = new NamedList();
for (CoreSnapshotMetaData x : replicaSnapshots) {
replicas.add(x.getCoreName(), x.toNamedList());
}
result.add(SolrSnapshotManager.SNAPSHOT_REPLICAS, replicas);
return result;
}
示例26
@SuppressWarnings({"unchecked", "rawtypes"})
public CoreSnapshotMetaData(NamedList resp) {
this.coreName = (String)resp.get(CoreAdminParams.CORE);
this.indexDirPath = (String)resp.get(SolrSnapshotManager.INDEX_DIR_PATH);
this.generationNumber = (Long)resp.get(SolrSnapshotManager.GENERATION_NUM);
this.shardId = (String)resp.get(SolrSnapshotManager.SHARD_ID);
this.leader = (Boolean)resp.get(SolrSnapshotManager.LEADER);
this.files = (Collection<String>)resp.get(SolrSnapshotManager.FILE_LIST);
}
示例27
protected static Map<String, String> buildCoreParams(SolrParams params) {
Map<String, String> coreParams = new HashMap<>();
// standard core create parameters
for (Map.Entry<String, String> entry : paramToProp.entrySet()) {
String value = params.get(entry.getKey(), null);
if (StringUtils.isNotEmpty(value)) {
coreParams.put(entry.getValue(), value);
}
}
// extra properties
Iterator<String> paramsIt = params.getParameterNamesIterator();
while (paramsIt.hasNext()) {
String param = paramsIt.next();
if (param.startsWith(CoreAdminParams.PROPERTY_PREFIX)) {
String propName = param.substring(CoreAdminParams.PROPERTY_PREFIX.length());
String propValue = params.get(param);
coreParams.put(propName, propValue);
}
if (param.startsWith(ZkController.COLLECTION_PARAM_PREFIX)) {
coreParams.put(param, params.get(param));
}
}
return coreParams;
}
示例28
public static void createSimpleCore(AlfrescoCoreAdminHandler coreAdminHandler,
String coreName, String storeRef, String templateName,
String... extraParams) throws InterruptedException
{
ModifiableSolrParams coreParams = params(CoreAdminParams.ACTION, "NEWDEFAULTINDEX",
"storeRef", storeRef,
"coreName", coreName,
"template", templateName);
coreParams.add(params(extraParams));
SolrQueryRequest request = new LocalSolrQueryRequest(null,coreParams);
SolrQueryResponse response = new SolrQueryResponse();
coreAdminHandler.handleCustomAction(request, response);
TimeUnit.SECONDS.sleep(2);
}
示例29
public static void updateCore(AlfrescoCoreAdminHandler coreAdminHandler,
String coreName,
String... extraParams) throws InterruptedException
{
ModifiableSolrParams coreParams = params(CoreAdminParams.ACTION, "UPDATECORE", "coreName", coreName);
coreParams.add(params(extraParams));
SolrQueryRequest request = new LocalSolrQueryRequest(null,coreParams);
SolrQueryResponse response = new SolrQueryResponse();
coreAdminHandler.handleCustomAction(request, response);
TimeUnit.SECONDS.sleep(2);
}
示例30
public static void updateShared(AlfrescoCoreAdminHandler coreAdminHandler,
String... extraParams) throws InterruptedException
{
ModifiableSolrParams coreParams = params(CoreAdminParams.ACTION, "UPDATESHARED");
coreParams.add(params(extraParams));
SolrQueryRequest request = new LocalSolrQueryRequest(null,coreParams);
SolrQueryResponse response = new SolrQueryResponse();
coreAdminHandler.handleCustomAction(request, response);
TimeUnit.SECONDS.sleep(2);
}