Merge branch 'develop' into stable
This commit is contained in:
+19
-18
@@ -10,17 +10,12 @@
|
|||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
|
||||||
<artifactId>asie-api</artifactId>
|
<artifactId>asie-api</artifactId>
|
||||||
<version>1.1.1-asie2</version>
|
<version>1.1.1-asie2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ASIE Jakarta RS API</name>
|
<name>ASIE Jakarta RS API</name>
|
||||||
<description>Alfresco Search & Insight Engine Jakarta RS API</description>
|
<description>Alfresco Search & Insight Engine Jakarta RS API</description>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<alfresco.platform.version>23.2.0</alfresco.platform.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -43,17 +38,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-data-model</artifactId>
|
<artifactId>alfresco-data-model</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>*</groupId>
|
|
||||||
<artifactId>*</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.17.0</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
@@ -63,7 +47,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>com.inteligr8</groupId>
|
||||||
<artifactId>common-rest-client</artifactId>
|
<artifactId>common-rest-client</artifactId>
|
||||||
<version>3.0.2-jersey</version>
|
<version>${commom-rest-client.base.version}-jersey</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -75,10 +59,27 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.11.2</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.repaint.maven</groupId>
|
||||||
|
<artifactId>tiles-maven-plugin</artifactId>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<tiles>
|
||||||
|
<!-- Documentation: https://git.inteligr8.com/inteligr8/ootbee-beedk/src/stable/beedk-acs-platform-webapp-tile -->
|
||||||
|
<!-- TODO spin up just ASIE
|
||||||
|
<tile>com.inteligr8.ootbee:beedk-acs-platform-webapp-tile:[1.1.6,2.0.0)</tile>
|
||||||
|
-->
|
||||||
|
</tiles>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class IndexRequest extends JsonFormattedResponseRequest<IndexRequest> {
|
|||||||
@QueryParam("acltxid")
|
@QueryParam("acltxid")
|
||||||
private Long aclTransactionId;
|
private Long aclTransactionId;
|
||||||
|
|
||||||
@QueryParam("nodeId")
|
@QueryParam("nodeid")
|
||||||
private Long nodeId;
|
private Long nodeId;
|
||||||
|
|
||||||
@QueryParam("aclid")
|
@QueryParam("aclid")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.inteligr8.alfresco.asie.model.core;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.inteligr8.solr.model.JsonFormattedResponseRequest;
|
import com.inteligr8.solr.model.JsonFormattedResponseRequest;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class NewCoreRequest extends JsonFormattedResponseRequest<NewCoreRequest>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NewCoreRequest withShardIds(Collection<String> shardIds) {
|
public NewCoreRequest withShardIds(Collection<String> shardIds) {
|
||||||
this.shardIds = StringUtils.join(shardIds, ",");
|
this.shardIds = StringUtils.collectionToDelimitedString(shardIds, ",");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class PurgeRequest extends JsonFormattedResponseRequest<PurgeRequest> {
|
|||||||
@QueryParam("acltxid")
|
@QueryParam("acltxid")
|
||||||
private Long aclTransactionId;
|
private Long aclTransactionId;
|
||||||
|
|
||||||
@QueryParam("nodeId")
|
@QueryParam("nodeid")
|
||||||
private Long nodeId;
|
private Long nodeId;
|
||||||
|
|
||||||
@QueryParam("aclid")
|
@QueryParam("aclid")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ReindexRequest extends JsonFormattedResponseRequest<ReindexRequest>
|
|||||||
@QueryParam("acltxid")
|
@QueryParam("acltxid")
|
||||||
private Long aclTransactionId;
|
private Long aclTransactionId;
|
||||||
|
|
||||||
@QueryParam("nodeId")
|
@QueryParam("nodeid")
|
||||||
private Long nodeId;
|
private Long nodeId;
|
||||||
|
|
||||||
@QueryParam("aclid")
|
@QueryParam("aclid")
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import com.inteligr8.alfresco.asie.AsieClient;
|
import com.inteligr8.alfresco.asie.AsieClient;
|
||||||
|
|
||||||
public class AbstractApiUnitTest {
|
public class AbstractApiIT {
|
||||||
|
|
||||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
+1
-1
@@ -11,7 +11,7 @@ import com.inteligr8.solr.model.Action.Status;
|
|||||||
import com.inteligr8.solr.model.Cores;
|
import com.inteligr8.solr.model.Cores;
|
||||||
import com.inteligr8.solr.model.ResponseHeader;
|
import com.inteligr8.solr.model.ResponseHeader;
|
||||||
|
|
||||||
public class CoreAdminReindexUnitTest extends AbstractApiUnitTest {
|
public class CoreAdminReindexIT extends AbstractApiIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void reindex() {
|
public void reindex() {
|
||||||
+1
-1
@@ -19,7 +19,7 @@ import com.inteligr8.solr.model.core.StatusResponse;
|
|||||||
|
|
||||||
import jakarta.ws.rs.ProcessingException;
|
import jakarta.ws.rs.ProcessingException;
|
||||||
|
|
||||||
public class CoreAdminStatusUnitTest extends AbstractApiUnitTest {
|
public class CoreAdminStatusIT extends AbstractApiIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void noHost() {
|
public void noHost() {
|
||||||
+11
-18
@@ -16,10 +16,9 @@
|
|||||||
<name>ASIE Platform Module for ACS Enterprise</name>
|
<name>ASIE Platform Module for ACS Enterprise</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<alfresco.sdk.version>4.9.0</alfresco.sdk.version>
|
<alfresco.platform.version>25.1.0</alfresco.platform.version>
|
||||||
<alfresco.platform.version>23.3.0</alfresco.platform.version>
|
<alfresco.platform.war.version>25.1.0.71</alfresco.platform.war.version>
|
||||||
<alfresco.platform.war.version>23.3.0.98</alfresco.platform.war.version>
|
<tomcat-rad.version>2.3-tomcat-10.1.52</tomcat-rad.version>
|
||||||
<tomcat-rad.version>10-2.1</tomcat-rad.version>
|
|
||||||
|
|
||||||
<beedk.rad.acs-search.enabled>true</beedk.rad.acs-search.enabled>
|
<beedk.rad.acs-search.enabled>true</beedk.rad.acs-search.enabled>
|
||||||
</properties>
|
</properties>
|
||||||
@@ -37,10 +36,13 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- Alfresco Modules required to use this module -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-shared</artifactId>
|
<artifactId>cxf-jaxrs-platform-module</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>1.4.0-acs-v25.1</version>
|
||||||
|
<type>amp</type>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Needed by this module, but provided by ACS -->
|
<!-- Needed by this module, but provided by ACS -->
|
||||||
@@ -50,19 +52,11 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Alfresco Modules required to use this module -->
|
<!-- core dependency, but dependencies of provided ones above should override -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>cxf-jaxrs-platform-module</artifactId>
|
<artifactId>asie-shared</artifactId>
|
||||||
<version>1.3.2-acs-v23.3</version>
|
<version>${project.version}</version>
|
||||||
<type>amp</type>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to shared -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.inteligr8</groupId>
|
|
||||||
<artifactId>common-rest-client</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to solr-api -->
|
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to solr-api -->
|
||||||
@@ -108,7 +102,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.repaint.maven</groupId>
|
<groupId>io.repaint.maven</groupId>
|
||||||
<artifactId>tiles-maven-plugin</artifactId>
|
<artifactId>tiles-maven-plugin</artifactId>
|
||||||
<version>2.40</version>
|
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tiles>
|
<tiles>
|
||||||
|
|||||||
@@ -43,15 +43,21 @@
|
|||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<maven.compiler.release>17</maven.compiler.release>
|
<maven.compiler.release>17</maven.compiler.release>
|
||||||
<maven.deploy.skip>true</maven.deploy.skip>
|
<maven.deploy.skip>true</maven.deploy.skip>
|
||||||
|
|
||||||
|
<!-- must be aligned with the target ACS platform junit -->
|
||||||
|
<junit.version>5.12.2</junit.version>
|
||||||
|
|
||||||
|
<commom-rest-client.base.version>3.0.3</commom-rest-client.base.version>
|
||||||
|
|
||||||
|
<alfresco.platform.version>25.1.0</alfresco.platform.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to shared -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>common-rest-client</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>3.0.3-cxf</version>
|
<version>${junit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
@@ -59,43 +65,48 @@
|
|||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- avoids log4j dependency -->
|
<!-- helps avoid vulnerable dependencies -->
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.14.1</version>
|
|
||||||
</plugin>
|
|
||||||
<!-- avoids struts dependency -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>3.21.0</version>
|
<version>3.21.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Force use of a new maven-dependency-plugin that doesn't download struts dependency -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.9.0</version>
|
<version>3.15.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.10.0</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.14.0</version>
|
<version>${junit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>5.14.0</version>
|
<version>${junit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.repaint.maven</groupId>
|
||||||
|
<artifactId>tiles-maven-plugin</artifactId>
|
||||||
|
<version>2.43</version>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<alfresco.sdk.version>4.9.0</alfresco.sdk.version>
|
<alfresco.sdk.version>4.9.0</alfresco.sdk.version>
|
||||||
<alfresco.platform.version>23.3.0</alfresco.platform.version>
|
|
||||||
|
<common-rest-client.version>${commom-rest-client.base.version}-cxf</common-rest-client.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -41,6 +42,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>com.inteligr8</groupId>
|
||||||
<artifactId>common-rest-client</artifactId>
|
<artifactId>common-rest-client</artifactId>
|
||||||
|
<version>${common-rest-client.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Needed by this module, but provided by ACS -->
|
<!-- Needed by this module, but provided by ACS -->
|
||||||
|
|||||||
+52
-46
@@ -13,15 +13,12 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.index.shard.Floc;
|
import org.alfresco.repo.index.shard.Floc;
|
||||||
import org.alfresco.repo.index.shard.Shard;
|
import org.alfresco.repo.index.shard.Shard;
|
||||||
import org.alfresco.repo.index.shard.ShardInstance;
|
import org.alfresco.repo.index.shard.ShardInstance;
|
||||||
import org.alfresco.repo.index.shard.ShardRegistry;
|
import org.alfresco.repo.index.shard.ShardRegistry;
|
||||||
import org.alfresco.repo.index.shard.ShardState;
|
import org.alfresco.repo.index.shard.ShardState;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -151,7 +148,10 @@ public abstract class AbstractNodeActionService implements DisposableBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Future<Void> _action(long nodeDbId, ActionCallback callback, Long fullQueueExpireTimeMillis) throws TimeoutException, InterruptedException {
|
private Future<Void> _action(
|
||||||
|
final long nodeDbId,
|
||||||
|
final ActionCallback callback,
|
||||||
|
Long fullQueueExpireTimeMillis) throws TimeoutException, InterruptedException {
|
||||||
List<com.inteligr8.alfresco.asie.model.ShardInstance> eligibleInstances = this.findPossibleShardInstances(nodeDbId);
|
List<com.inteligr8.alfresco.asie.model.ShardInstance> eligibleInstances = this.findPossibleShardInstances(nodeDbId);
|
||||||
this.logger.debug("Will attempt to {} ACS node against {} shard instances: {}", this.getActionName(), eligibleInstances.size(), nodeDbId);
|
this.logger.debug("Will attempt to {} ACS node against {} shard instances: {}", this.getActionName(), eligibleInstances.size(), nodeDbId);
|
||||||
|
|
||||||
@@ -164,49 +164,12 @@ public abstract class AbstractNodeActionService implements DisposableBean {
|
|||||||
Callable<Void> callable = new Callable<>() {
|
Callable<Void> callable = new Callable<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void call() {
|
public Void call() {
|
||||||
String core = instance.extractShard().getCoreName();
|
|
||||||
SolrHost host = instance.extractNode();
|
|
||||||
URL url = host.toUrl(apiService.isSecure() ? "https" : "http");
|
|
||||||
CoreAdminApi api = apiService.createApi(url.toString(), CoreAdminApi.class);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug("Performing {} of ACS node against shard instance: {}: {}", getActionName(), nodeDbId, instance);
|
actionToShard(nodeDbId, callback, instance);
|
||||||
BaseResponse apiResponse = execute(api, core, nodeDbId);
|
|
||||||
logger.trace("Performed {} of ACS node against shard instance: {}: {}", getActionName(), nodeDbId, instance);
|
|
||||||
|
|
||||||
Action action = null;
|
|
||||||
if (apiResponse instanceof ActionCoreResponse<?>) {
|
|
||||||
action = ((ActionCoreResponse<Action>) apiResponse).getCores().getByCore(core);
|
|
||||||
} else if (apiResponse instanceof ActionResponse<?>) {
|
|
||||||
action = ((ActionResponse<Action>) apiResponse).getAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action == null) {
|
|
||||||
callback.unknownResult(instance);
|
|
||||||
} else {
|
|
||||||
switch (action.getStatus()) {
|
|
||||||
case Scheduled:
|
|
||||||
callback.scheduled(instance);
|
|
||||||
break;
|
|
||||||
case Success:
|
|
||||||
callback.success(instance);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (apiResponse instanceof com.inteligr8.alfresco.asie.model.BaseResponse) {
|
|
||||||
com.inteligr8.alfresco.asie.model.BaseResponse asieResponse = (com.inteligr8.alfresco.asie.model.BaseResponse) apiResponse;
|
|
||||||
logger.debug("Performance of {} of ACS node against shard instance failed: {}: {}: {}", getActionName(), nodeDbId, instance, asieResponse.getException());
|
|
||||||
callback.error(instance, asieResponse.getException());
|
|
||||||
} else {
|
|
||||||
logger.debug("Performance of {} of ACS node against shard instance failed: {}: {}: {}", getActionName(), nodeDbId, instance, apiResponse.getResponseHeader().getStatus());
|
|
||||||
callback.error(instance, String.valueOf(apiResponse.getResponseHeader().getStatus()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("An exception occurred", e);
|
logger.error("An unexpected exception occurred", e);
|
||||||
callback.error(instance, e.getMessage());
|
callback.error(instance, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -221,15 +184,58 @@ public abstract class AbstractNodeActionService implements DisposableBean {
|
|||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void actionToShard(long nodeDbId, ActionCallback callback, com.inteligr8.alfresco.asie.model.ShardInstance instance) {
|
||||||
|
String core = instance.extractShard().getCoreName();
|
||||||
|
SolrHost host = instance.extractNode();
|
||||||
|
URL url = host.toUrl(this.apiService.isSecure() ? "https" : "http");
|
||||||
|
CoreAdminApi api = this.apiService.createApi(url.toString(), CoreAdminApi.class);
|
||||||
|
|
||||||
|
this.logger.debug("Performing {} of ACS node against shard instance: {}: {}", this.getActionName(), nodeDbId, instance);
|
||||||
|
BaseResponse apiResponse = execute(api, core, nodeDbId);
|
||||||
|
this.logger.trace("Performed {} of ACS node against shard instance: {}: {}", this.getActionName(), nodeDbId, instance);
|
||||||
|
|
||||||
|
Action action = null;
|
||||||
|
if (apiResponse instanceof ActionCoreResponse<?>) {
|
||||||
|
action = ((ActionCoreResponse<Action>) apiResponse).getCores().getByCore(core);
|
||||||
|
} else if (apiResponse instanceof ActionResponse<?>) {
|
||||||
|
action = ((ActionResponse<Action>) apiResponse).getAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == null) {
|
||||||
|
callback.unknownResult(instance);
|
||||||
|
} else {
|
||||||
|
switch (action.getStatus()) {
|
||||||
|
case Scheduled:
|
||||||
|
callback.scheduled(instance);
|
||||||
|
break;
|
||||||
|
case Success:
|
||||||
|
callback.success(instance);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (apiResponse instanceof com.inteligr8.alfresco.asie.model.BaseResponse) {
|
||||||
|
com.inteligr8.alfresco.asie.model.BaseResponse asieResponse = (com.inteligr8.alfresco.asie.model.BaseResponse) apiResponse;
|
||||||
|
this.logger.debug("Performance of {} of ACS node against shard instance failed: {}: {}: {}",
|
||||||
|
this.getActionName(), nodeDbId, instance, asieResponse.getException());
|
||||||
|
callback.error(instance, asieResponse.getException());
|
||||||
|
} else {
|
||||||
|
this.logger.debug("Performance of {} of ACS node against shard instance failed: {}: {}: {}",
|
||||||
|
this.getActionName(), nodeDbId, instance, apiResponse.getResponseHeader().getStatus());
|
||||||
|
callback.error(instance, String.valueOf(apiResponse.getResponseHeader().getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract BaseResponse execute(CoreAdminApi api, String core, long nodeDbId);
|
protected abstract BaseResponse execute(CoreAdminApi api, String core, long nodeDbId);
|
||||||
|
|
||||||
private List<com.inteligr8.alfresco.asie.model.ShardInstance> findPossibleShardInstances(long nodeDbId) {
|
private List<com.inteligr8.alfresco.asie.model.ShardInstance> findPossibleShardInstances(long nodeDbId) {
|
||||||
if (this.shardRegistry == null)
|
if (this.shardRegistry == null)
|
||||||
throw new UnsupportedOperationException("ACS instances without a sharding configuration are not yet implemented");
|
throw new UnsupportedOperationException("ACS instances without a sharding configuration are not yet implemented");
|
||||||
|
|
||||||
SearchParameters searchParams = new SearchParameters();
|
// SearchParameters searchParams = new SearchParameters();
|
||||||
searchParams.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
// searchParams.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||||
searchParams.setQuery("@" + this.formatForFts(ContentModel.PROP_NODE_DBID) + ":" + nodeDbId);
|
// searchParams.setQuery("@" + this.formatForFts(ContentModel.PROP_NODE_DBID) + ":" + nodeDbId);
|
||||||
|
|
||||||
List<com.inteligr8.alfresco.asie.model.ShardInstance> instances = new LinkedList<>();
|
List<com.inteligr8.alfresco.asie.model.ShardInstance> instances = new LinkedList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.inteligr8.alfresco.asie.service;
|
package com.inteligr8.alfresco.asie.service;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.TemporalAccessor;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -9,6 +12,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.apache.commons.codec.digest.MurmurHash3;
|
import org.apache.commons.codec.digest.MurmurHash3;
|
||||||
|
import org.joda.time.ReadablePartial;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -70,7 +74,20 @@ public class SolrShardHashService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.logger.trace("Discovered node property for sharding: {} => {}", nodeRef, fullPropertyValue);
|
this.logger.trace("Discovered node property for sharding: {} => {}", nodeRef, fullPropertyValue);
|
||||||
String hashableValue = fullPropertyValue.toString();
|
|
||||||
|
String hashableValue = null;
|
||||||
|
if (fullPropertyValue instanceof TemporalAccessor) {
|
||||||
|
Instant instant = Instant.from((TemporalAccessor) fullPropertyValue);
|
||||||
|
hashableValue = instant.toString();
|
||||||
|
} else if (fullPropertyValue instanceof ReadablePartial) {
|
||||||
|
hashableValue = ((ReadablePartial) fullPropertyValue).toString();
|
||||||
|
} else if (fullPropertyValue instanceof Date) {
|
||||||
|
Instant instant = ((Date) fullPropertyValue).toInstant();
|
||||||
|
hashableValue = instant.toString();
|
||||||
|
} else {
|
||||||
|
hashableValue = fullPropertyValue.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (shardset.getRegex() != null) {
|
if (shardset.getRegex() != null) {
|
||||||
Matcher matcher = shardset.getRegex().matcher(hashableValue);
|
Matcher matcher = shardset.getRegex().matcher(hashableValue);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
@@ -84,6 +101,7 @@ public class SolrShardHashService {
|
|||||||
int shardHash = this.hash(hashableValue, shardset.getShards().intValue());
|
int shardHash = this.hash(hashableValue, shardset.getShards().intValue());
|
||||||
this.logger.debug("Hash shardable value to shard instance ID: {}: {} => {}", nodeRef, hashableValue, shardHash);
|
this.logger.debug("Hash shardable value to shard instance ID: {}: {} => {}", nodeRef, hashableValue, shardHash);
|
||||||
return shardHash;
|
return shardHash;
|
||||||
|
// TODO replicate hash algorithm for other shard methods
|
||||||
default:
|
default:
|
||||||
this.logger.trace("Unable to determine shard instance ID due to shard method: {}", shardset.getMethod());
|
this.logger.trace("Unable to determine shard instance ID due to shard method: {}", shardset.getMethod());
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
<name>Apache Solr Jakarta RS API</name>
|
<name>Apache Solr Jakarta RS API</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jackson.version>2.18.0</jackson.version>
|
<jackson.version>2.21.1</jackson.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
Reference in New Issue
Block a user