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

@@ -1,19 +1,19 @@
/*
* 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
* 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.web.forms;
@@ -274,10 +274,10 @@ public class RenderingEngineTemplateImpl
AVMUtil.PathRelation.SANDBOX_RELATIVE);
if (logger.isDebugEnabled())
{
logger.debug("processed pattern " + outputPathPattern + " as " + result);
{
logger.debug("processed pattern " + outputPathPattern + " as " + result);
}
return result;
}
@@ -304,8 +304,8 @@ public class RenderingEngineTemplateImpl
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
AVMUtil.makeAllDirectories(parentAVMPath);
avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
AVMNodeConverter.SplitBase(renditionAvmPath)[1]).close();
if (logger.isDebugEnabled())
{
logger.debug("Created file node for file: " + renditionAvmPath);
@@ -432,13 +432,13 @@ public class RenderingEngineTemplateImpl
final NodeRef parentNodeRef =
nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef();
if (logger.isDebugEnabled())
{
logger.debug("request to resolve resource " + name +
" webapp url is " + webappUrl +
" and data dictionary workspace is " + parentNodeRef);
if (logger.isDebugEnabled())
{
logger.debug("request to resolve resource " + name +
" webapp url is " + webappUrl +
" and data dictionary workspace is " + parentNodeRef);
}
final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name);
if (result != null)
{
@@ -447,10 +447,10 @@ public class RenderingEngineTemplateImpl
try
{
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();
}
catch (Exception e)
@@ -527,17 +527,17 @@ public class RenderingEngineTemplateImpl
}
final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/'));
if (logger.isDebugEnabled())
{
logger.debug("loading " + uri);
}
return uri.toURL().openStream();
}
catch (Exception e)
{
logger.warn(e);
logger.warn(e);
return null;
}
}
@@ -562,41 +562,41 @@ public class RenderingEngineTemplateImpl
// add methods
final FormDataFunctions fdf = this.getFormDataFunctions();
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"encodeQuotes",
namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod()
{
public Object exec(final Object[] arguments)
throws IOException,
SAXException
{
if (arguments.length != 1)
{
throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " +
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);
"encodeQuotes",
namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod()
{
public Object exec(final Object[] arguments)
throws IOException,
SAXException
{
if (arguments.length != 1)
{
throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " +
arguments.length);
}
final String result = fdf.encodeQuotes(text);
return result;
}
});
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
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);
}
final String result = fdf.encodeQuotes(text);
return result;
}
});
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"parseXMLDocument",
namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod()
@@ -620,12 +620,12 @@ public class RenderingEngineTemplateImpl
path = AVMUtil.buildPath(parentPath,
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);
if (logger.isDebugEnabled())
{
logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
{
logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
}
final Document d = fdf.parseXMLDocument(path);
return d != null ? d.getDocumentElement() : null;
}
@@ -661,20 +661,20 @@ public class RenderingEngineTemplateImpl
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);
final String formName = (String)arguments[0];
if (logger.isDebugEnabled())
{
logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
"'), parentPath = " + parentPath);
{
logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
"'), parentPath = " + parentPath);
}
final Map<String, Document> resultMap = fdf.parseXMLDocuments(formName, path);
if (logger.isDebugEnabled())
{
logger.debug("received " + resultMap.size() +
" documents in " + path +
" with form name " + formName);
{
logger.debug("received " + resultMap.size() +
" documents in " + path +
" with form name " + formName);
}
// 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];
if (logger.isDebugEnabled())
{
{
logger.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath);
}
}
return AVMUtil.buildPath(parentPath,
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);