Merged master to 7.N

7df658c SEARCH-2028: New Web Script Service to provide the next transaction commit time from a given time commit.
This commit is contained in:
Angel Borroy
2020-01-20 14:31:35 +01:00
parent b130e55bbd
commit c88a1c6360
5 changed files with 91 additions and 1 deletions

View File

@@ -37,7 +37,7 @@
<dir.root>${project.build.directory}/alf_data</dir.root>
<img.exe>convert</img.exe>
<dependency.alfresco-repository.version>7.139</dependency.alfresco-repository.version>
<dependency.alfresco-repository.version>7.140</dependency.alfresco-repository.version>
<dependency.alfresco-data-model.version>8.50.2</dependency.alfresco-data-model.version>
<dependency.alfresco-core.version>7.22</dependency.alfresco-core.version>

View File

@@ -0,0 +1,66 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.web.scripts.solr;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.repo.domain.node.ibatis.NodeDAOImpl;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* Returns the next transaction commit time from a given commit time.
* This webscript is used to skip long periods where the repository is not ingesting new content.
*
* @author aborroy
*
*/
public class NextTransactionGet extends DeclarativeWebScript
{
private NodeDAOImpl nodeDAO;
/* (non-Javadoc)
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
Long fromCommitTime = Long.parseLong(req.getParameter("fromCommitTime"));
Map<String, Object> model = new HashMap<>();
model.put("nextTransactionCommitTimeMs", nodeDAO.getNextTxCommitTime(fromCommitTime));
return model;
}
public void setNodeDAO(NodeDAOImpl nodeDAO)
{
this.nodeDAO = nodeDAO;
}
}

View File

@@ -0,0 +1,14 @@
<webscript>
<shortname>Get the next transaction commit time from a given transaction commit time</shortname>
<description>
Get the next transaction commit time from a given transaction commit time [fromCommitTime]
If no new transaction exists, -1 is returned.
</description>
<url>/api/solr/nextTransaction?fromCommitTime={fromCommitTime}</url>
<format default="json">argument</format>
<!-- Solr api is protected by a solr-specific authentication mechanism -->
<authentication>none</authentication>
<transaction allow="readonly">required</transaction>
<lifecycle>internal</lifecycle>
<family>SOLR</family>
</webscript>

View File

@@ -0,0 +1,3 @@
{
"nextTransactionCommitTimeMs": <#if nextTransactionCommitTimeMs??>${nextTransactionCommitTimeMs?c}<#else>-1</#if>
}

View File

@@ -1267,6 +1267,13 @@
<property name="nodeDAO" ref="nodeDAO" />
</bean>
<!-- /api/solr webscript returning the min txId in a nodeId range -->
<bean id="webscript.org.alfresco.repository.solr.nextTransactionCommitTime.get"
class="org.alfresco.repo.web.scripts.solr.NextTransactionGet"
parent="webscript">
<property name="nodeDAO" ref="nodeDAO" />
</bean>
<!-- -->
<!-- Node Locator -->
<!-- -->