Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

79326: Merged EOL to HEAD-BUG-FIX (5.0/Cloud)
      79090: ACE-2013 EOL JCR, JCR-RMI, etc in 5.0
         - Removed references to http://www.jcp.org/jcr (left in web-scripts-application-context.xml
           and multiple versions of opencmis-gnamefilter-context.xml)
      78990: ACE-2013 EOL JCR, JCR-RMI, etc in 5.0
         - Removing references to "jcr-xpath" - Biggest changes were to: DocumentNavigator, NodeServiceXPath and NodeSearcher
         - SearcherComponentTest has a lot of tests removed that appeared to be JCR specific
         - There are still a lot of namespace references in XML files to http://www.jcp.org/jcr/1.0 etc.
         - Left a few  references to "JSR 170" and JCR in java classes as they looked like they might be common with other bits.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82708 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-09-03 15:21:53 +00:00
parent ef18c89175
commit c717551907
27 changed files with 51 additions and 1998 deletions

View File

@@ -511,7 +511,7 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
* {
* query: string, mandatory, in appropriate format and encoded for the given language
* store: string, optional, defaults to 'workspace://SpacesStore'
* language: string, optional, one of: lucene, xpath, jcr-xpath, fts-alfresco - defaults to 'lucene'
* language: string, optional, one of: lucene, xpath, fts-alfresco - defaults to 'lucene'
* templates: [], optional, Array of query language template objects (see below) - if supported by the language
* sort: [], optional, Array of sort column objects (see below) - if supported by the language
* page: object, optional, paging information object (see below) - if supported by the language

View File

@@ -60,12 +60,6 @@ import org.jaxen.XPath;
*/
public class DocumentNavigator extends DefaultNavigator implements NamedAccessNavigator
{
private static QName JCR_ROOT = QName.createQName("http://www.jcp.org/jcr/1.0", "root");
private static QName JCR_PRIMARY_TYPE = QName.createQName("http://www.jcp.org/jcr/1.0", "primaryType");
private static QName JCR_MIXIN_TYPES = QName.createQName("http://www.jcp.org/jcr/1.0", "mixinTypes");
private static final long serialVersionUID = 3618984485740165427L;
private DictionaryService dictionaryService;
@@ -108,30 +102,17 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
}
}
public class JCRRootNodeChildAssociationRef extends ChildAssociationRef
{
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = -3890194577752476675L;
public JCRRootNodeChildAssociationRef(QName assocTypeQName, NodeRef parentRef, QName childQName, NodeRef childRef)
{
super(assocTypeQName, parentRef, childQName, childRef);
}
public JCRRootNodeChildAssociationRef(QName assocTypeQName, NodeRef parentRef, QName childQName, NodeRef childRef, boolean isPrimary, int nthSibling)
{
super(assocTypeQName, parentRef, childQName, childRef, isPrimary, nthSibling);
}
}
private boolean followAllParentLinks;
private boolean useJCRRootNode;
/**
* @deprecated useJCRRootNode parameter is now obsolete.
*/
public DocumentNavigator(DictionaryService dictionaryService, NodeService nodeService, SearchService searchService,
NamespacePrefixResolver nspr, boolean followAllParentLinks, boolean useJCRRootNode)
{
this(dictionaryService, nodeService, searchService, nspr, followAllParentLinks);
}
/**
* @param dictionaryService
* used to resolve the <b>subtypeOf</b> function and other
@@ -149,7 +130,7 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
* parent-child association should be traversed
*/
public DocumentNavigator(DictionaryService dictionaryService, NodeService nodeService, SearchService searchService,
NamespacePrefixResolver nspr, boolean followAllParentLinks, boolean useJCRRootNode)
NamespacePrefixResolver nspr, boolean followAllParentLinks)
{
super();
this.dictionaryService = dictionaryService;
@@ -157,7 +138,6 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
this.searchService = searchService;
this.nspr = nspr;
this.followAllParentLinks = followAllParentLinks;
this.useJCRRootNode = useJCRRootNode;
}
@@ -379,14 +359,6 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
properties.add(property);
}
}
if(useJCRRootNode)
{
properties.add(new Property(JCR_PRIMARY_TYPE, nodeService.getType(nodeRef), nodeRef));
for(QName mixin : nodeService.getAspects(nodeRef))
{
properties.add(new Property(JCR_MIXIN_TYPES, mixin, nodeRef));
}
}
return properties.iterator();
}
@@ -400,18 +372,7 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
NodeRef childRef = assocRef.getChildRef();
QName qName = QName.createQName(namespaceURI, localName);
List<? extends ChildAssociationRef> list = null;
// Add compatability for JCR 170 by including the root node.
if(isDocument(contextNode) && useJCRRootNode)
{
list = new ArrayList<ChildAssociationRef>(1);
list = Collections.singletonList(
new JCRRootNodeChildAssociationRef(
ContentModel.ASSOC_CHILDREN, childRef, JCR_ROOT, childRef, true, 0));
}
else
{
list = nodeService.getChildAssocs(childRef, RegexQNamePattern.MATCH_ALL, qName);
}
list = nodeService.getChildAssocs(childRef, RegexQNamePattern.MATCH_ALL, qName);
// done
return list.iterator();
}
@@ -422,16 +383,7 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
ChildAssociationRef assocRef = (ChildAssociationRef) o;
NodeRef childRef = assocRef.getChildRef();
List<ChildAssociationRef> list;
// Add compatability for JCR 170 by including the root node.
if(isDocument(o) && useJCRRootNode)
{
list = new ArrayList<ChildAssociationRef>(1);
list.add(new JCRRootNodeChildAssociationRef(ContentModel.ASSOC_CHILDREN, childRef, JCR_ROOT, childRef, true, 0));
}
else
{
list = nodeService.getChildAssocs(childRef);
}
list = nodeService.getChildAssocs(childRef);
return list.iterator();
}

View File

@@ -88,8 +88,6 @@ public class NodeServiceXPath extends BaseXPath
{
private static final long serialVersionUID = 3834032441789592882L;
private static String JCR_URI = "http://www.jcp.org/jcr/1.0";
private static Log logger = LogFactory.getLog(NodeServiceXPath.class);
/**
@@ -469,67 +467,6 @@ public class NodeServiceXPath extends BaseXPath
}
}
static class JCRContains implements Function
{
public Object call(Context context, List args) throws FunctionCallException
{
if (args.size() == 2)
{
if (context.getNavigator().isAttribute(context.getNodeSet().get(0)))
{
throw new FunctionCallException("jcr:contains() does not apply to an attribute context.");
}
return evaluate(context.getNodeSet(), args.get(0), args.get(1), context.getNavigator());
}
throw new FunctionCallException("contains() requires two argument.");
}
public Object evaluate(List nodes, Object identifier, Object pattern, Navigator nav)
{
if (nodes.size() != 1)
{
return false;
}
QName qname = null;
NodeRef nodeRef = null;
Object target = identifier;
if (identifier instanceof List)
{
List list = (List) identifier;
if (list.isEmpty())
{
return false;
}
// do not recurse: only first list should unwrap
target = list.get(0);
}
if (nav.isElement(target))
{
qname = null; // should use all attributes and full text index
nodeRef = ((ChildAssociationRef) target).getChildRef();
}
else if (nav.isAttribute(target))
{
qname = QName.createQName(
nav.getAttributeNamespaceUri(target),
ISO9075.decode(nav.getAttributeName(target)));
nodeRef = ((DocumentNavigator.Property) target).parent;
}
String patternValue = StringFunction.evaluate(pattern, nav);
DocumentNavigator dNav = (DocumentNavigator) nav;
return dNav.contains(nodeRef, qname, patternValue, SearchParameters.AND);
}
}
static class Score implements Function
{
private Double one = new Double(1);
@@ -694,14 +631,6 @@ public class NodeServiceXPath extends BaseXPath
registerFunction("", "contains", new Contains());
registerFunction("", "first", new FirstFunction());
// 170 functions
registerFunction(JCR_URI, "like", new Like());
registerFunction(JCR_URI, "score", new Score());
registerFunction(JCR_URI, "contains", new JCRContains());
registerFunction(JCR_URI, "deref", new Deref());
}
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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/>.
*/
package org.alfresco.repo.search.impl;
import org.alfresco.repo.search.AbstractSearcherComponent;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.QueryParameter;
import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.namespace.QName;
/**
* Simple searcher against another store using the JSR 170 API.
* <p>
* This class is not fully implemented and hence still abstract.
*/
public abstract class JCR170Searcher extends AbstractSearcherComponent
{
public ResultSet query(StoreRef store, String language, String query, Path[] queryOptions,
QueryParameter[] queryParameters)
{
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public ResultSet query(StoreRef store, String language, String query, Path[] attributePaths, QueryParameterDefinition[] queryParameterDefinitions)
{
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters)
{
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public ResultSet query(SearchParameters searchParameters)
{
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
}

View File

@@ -75,53 +75,11 @@ public class NodeSearcher
try
{
String xpath = xpathIn;
boolean useJCRXPath = language.equalsIgnoreCase(SearchService.LANGUAGE_JCR_XPATH);
List<AttributeOrder> order = null;
// replace element
if (useJCRXPath)
{
order = new ArrayList<AttributeOrder>();
// We do not allow variable substitution with this pattern
xpath = xpath.replaceAll("element\\(\\s*(\\*|\\w*:\\w*)\\s*,\\s*(\\*|\\w*:\\w*)\\s*\\)",
"$1[subtypeOf(\"$2\")]");
String split[] = xpath.split("order\\s*by\\s*", 2);
xpath = split[0];
if (split.length > 1 && split[1].length() > 0)
{
String clauses[] = split[1].split("\\s,\\s");
for (String clause : clauses)
{
if (clause.startsWith("@"))
{
String attribute = clause.replaceFirst("@(\\p{Alpha}[\\w:]*)(?:\\s+(.*))?", "$1");
String sort = clause.replaceFirst("@(\\p{Alpha}[\\w:]*)(?:\\s+(.*))?", "$2");
if (sort.length() == 0)
{
sort = "ascending";
}
QName attributeQName = QName.createQName(attribute, namespacePrefixResolver);
order.add(new AttributeOrder(attributeQName, sort.equalsIgnoreCase("ascending")));
}
else if (clause.startsWith("jcr:score"))
{
// ignore jcr:score ordering
}
else
{
throw new IllegalArgumentException("Malformed order by expression " + split[1]);
}
}
}
}
DocumentNavigator documentNavigator = new DocumentNavigator(dictionaryService, nodeService, searchService,
namespacePrefixResolver, followAllParentLinks, useJCRXPath);
namespacePrefixResolver, followAllParentLinks);
NodeServiceXPath nsXPath = new NodeServiceXPath(xpath, documentNavigator, paramDefs);
for (String prefix : namespacePrefixResolver.getPrefixes())
{
@@ -236,10 +194,8 @@ public class NodeSearcher
{
try
{
boolean useJCRXPath = language.equalsIgnoreCase(SearchService.LANGUAGE_JCR_XPATH);
DocumentNavigator documentNavigator = new DocumentNavigator(dictionaryService, nodeService, searchService,
namespacePrefixResolver, followAllParentLinks, useJCRXPath);
namespacePrefixResolver, followAllParentLinks);
NodeServiceXPath nsXPath = new NodeServiceXPath(xpath, documentNavigator, paramDefs);
for (String prefix : namespacePrefixResolver.getPrefixes())
{