ALF-4291: PostgreSQL - AVM index/search (wip)

- split concurrency test(s) into separate file and added to AVMTestSuite
- added missing close(s) for calls to AVM createFile

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22307 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-09-07 16:04:45 +00:00
parent 0578df0270
commit e0b0e5d97e
2 changed files with 84 additions and 84 deletions

View File

@@ -93,7 +93,7 @@ public class AddAvmContentDialog extends AddContentDialog
String parent = this.avmBrowseBean.getCurrentPath(); String parent = this.avmBrowseBean.getCurrentPath();
// create the file // create the file
this.getAvmService().createFile(parent, this.fileName); this.getAvmService().createFile(parent, this.fileName).close();
this.path = parent + '/' + this.fileName; this.path = parent + '/' + this.fileName;
NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path); NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path);

View File

@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2005-2010 Alfresco Software Limited. * Copyright (C) 2005-2010 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.alfresco.web.forms; package org.alfresco.web.forms;
@@ -274,10 +274,10 @@ public class RenderingEngineTemplateImpl
AVMUtil.PathRelation.SANDBOX_RELATIVE); AVMUtil.PathRelation.SANDBOX_RELATIVE);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("processed pattern " + outputPathPattern + " as " + result); logger.debug("processed pattern " + outputPathPattern + " as " + result);
} }
return result; return result;
} }
@@ -304,8 +304,8 @@ public class RenderingEngineTemplateImpl
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0]; final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
AVMUtil.makeAllDirectories(parentAVMPath); AVMUtil.makeAllDirectories(parentAVMPath);
avmService.createFile(parentAVMPath, avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]); AVMNodeConverter.SplitBase(renditionAvmPath)[1]).close();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("Created file node for file: " + renditionAvmPath); logger.debug("Created file node for file: " + renditionAvmPath);
@@ -432,13 +432,13 @@ public class RenderingEngineTemplateImpl
final NodeRef parentNodeRef = final NodeRef parentNodeRef =
nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef(); nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("request to resolve resource " + name + logger.debug("request to resolve resource " + name +
" webapp url is " + webappUrl + " webapp url is " + webappUrl +
" and data dictionary workspace is " + parentNodeRef); " and data dictionary workspace is " + parentNodeRef);
} }
final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name); final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name);
if (result != null) if (result != null)
{ {
@@ -447,10 +447,10 @@ public class RenderingEngineTemplateImpl
try try
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("found " + name + " in data dictonary: " + result); logger.debug("found " + name + " in data dictonary: " + result);
} }
return contentService.getReader(result, ContentModel.PROP_CONTENT).getContentInputStream(); return contentService.getReader(result, ContentModel.PROP_CONTENT).getContentInputStream();
} }
catch (Exception e) catch (Exception e)
@@ -527,17 +527,17 @@ public class RenderingEngineTemplateImpl
} }
final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/')); final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/'));
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("loading " + uri); logger.debug("loading " + uri);
} }
return uri.toURL().openStream(); return uri.toURL().openStream();
} }
catch (Exception e) catch (Exception e)
{ {
logger.warn(e); logger.warn(e);
return null; return null;
} }
} }
@@ -562,41 +562,41 @@ public class RenderingEngineTemplateImpl
// add methods // add methods
final FormDataFunctions fdf = this.getFormDataFunctions(); final FormDataFunctions fdf = this.getFormDataFunctions();
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX, model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"encodeQuotes", "encodeQuotes",
namespacePrefixResolver), namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod() new RenderingEngine.TemplateProcessorMethod()
{ {
public Object exec(final Object[] arguments) public Object exec(final Object[] arguments)
throws IOException, throws IOException,
SAXException SAXException
{ {
if (arguments.length != 1) if (arguments.length != 1)
{ {
throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " + throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " +
arguments.length); arguments.length);
}
if (! (arguments[0] instanceof String))
{
throw new ClassCastException("expected arguments[0] to be a " + String.class.getName() +
". got a " + arguments[0].getClass().getName() + ".");
}
String text = (String)arguments[0];
if (logger.isDebugEnabled())
{
logger.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath);
} }
if (! (arguments[0] instanceof String))
final String result = fdf.encodeQuotes(text); {
return result; throw new ClassCastException("expected arguments[0] to be a " + String.class.getName() +
} ". got a " + arguments[0].getClass().getName() + ".");
}); }
String text = (String)arguments[0];
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX, if (logger.isDebugEnabled())
{
logger.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath);
}
final String result = fdf.encodeQuotes(text);
return result;
}
});
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"parseXMLDocument", "parseXMLDocument",
namespacePrefixResolver), namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod() new RenderingEngine.TemplateProcessorMethod()
@@ -620,12 +620,12 @@ public class RenderingEngineTemplateImpl
path = AVMUtil.buildPath(parentPath, path = AVMUtil.buildPath(parentPath,
path, path,
AVMUtil.PathRelation.WEBAPP_RELATIVE); AVMUtil.PathRelation.WEBAPP_RELATIVE);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath); logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
} }
final Document d = fdf.parseXMLDocument(path); final Document d = fdf.parseXMLDocument(path);
return d != null ? d.getDocumentElement() : null; return d != null ? d.getDocumentElement() : null;
} }
@@ -661,20 +661,20 @@ public class RenderingEngineTemplateImpl
path, path,
AVMUtil.PathRelation.WEBAPP_RELATIVE); AVMUtil.PathRelation.WEBAPP_RELATIVE);
final String formName = (String)arguments[0]; final String formName = (String)arguments[0];
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path + logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
"'), parentPath = " + parentPath); "'), parentPath = " + parentPath);
} }
final Map<String, Document> resultMap = fdf.parseXMLDocuments(formName, path); final Map<String, Document> resultMap = fdf.parseXMLDocuments(formName, path);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("received " + resultMap.size() + logger.debug("received " + resultMap.size() +
" documents in " + path + " documents in " + path +
" with form name " + formName); " with form name " + formName);
} }
// create a root document for rooting all the results. we do this // create a root document for rooting all the results. we do this
@@ -723,12 +723,12 @@ public class RenderingEngineTemplateImpl
} }
final String path = (String)arguments[0]; final String path = (String)arguments[0];
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
logger.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath); logger.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath);
} }
return AVMUtil.buildPath(parentPath, return AVMUtil.buildPath(parentPath,
path, path,
AVMUtil.PathRelation.WEBAPP_RELATIVE); AVMUtil.PathRelation.WEBAPP_RELATIVE);