Point checkin.

Reorg to allow sandbox-related constants to be accessed more easily from 
other compilation units.   AVMConstants had become a dumping ground for
things that had nothing to do with const values.   Therefore, this
is now AVMUtil, and sandbox-related constants have been moved to
org.alfresco.sandbox.SandboxConstants, which builds in repository.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5637 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jon Cox
2007-05-08 02:33:18 +00:00
parent 6e0afbf34c
commit 8abfd5ebc8
41 changed files with 289 additions and 528 deletions

View File

@@ -49,7 +49,7 @@ import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.bean.wcm.AVMWorkflowUtil;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.apache.commons.logging.Log;
@@ -154,7 +154,7 @@ public class FormImpl
root.put("xml", NodeModel.wrap(formInstanceData));
root.put("name", formInstanceDataName);
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
root.put("cwd", AVMConstants.getWebappRelativePath(parentAVMPath));
root.put("cwd", AVMUtil.getWebappRelativePath(parentAVMPath));
final TemplateService templateService = this.getServiceRegistry().getTemplateService();
@@ -182,9 +182,9 @@ public class FormImpl
":\n" + te.getMessage(),
te);
}
result = AVMConstants.buildPath(parentAVMPath,
result = AVMUtil.buildPath(parentAVMPath,
result,
AVMConstants.PathRelation.SANDBOX_RELATIVE);
AVMUtil.PathRelation.SANDBOX_RELATIVE);
LOGGER.debug("processed pattern " + outputPathPattern + " as " + result);
return result;
}

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.*;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.*;
@@ -79,12 +79,12 @@ public class FormInstanceDataImpl
public String getWebappRelativePath()
{
return AVMConstants.getWebappRelativePath(this.getPath());
return AVMUtil.getWebappRelativePath(this.getPath());
}
public String getSandboxRelativePath()
{
return AVMConstants.getSandboxRelativePath(this.getPath());
return AVMUtil.getSandboxRelativePath(this.getPath());
}
public String getPath()
@@ -116,7 +116,7 @@ public class FormInstanceDataImpl
public String getUrl()
{
return AVMConstants.buildAssetUrl(this.getPath());
return AVMUtil.buildAssetUrl(this.getPath());
}
public List<Rendition> getRenditions()
@@ -127,7 +127,7 @@ public class FormInstanceDataImpl
final Collection<Serializable> renditionPaths = (pv == null
? Collections.EMPTY_LIST
: pv.getCollection(DataTypeDefinition.TEXT));
final String storeName = AVMConstants.getStoreName(this.getPath());
final String storeName = AVMUtil.getStoreName(this.getPath());
final List<Rendition> result = new ArrayList<Rendition>(renditionPaths.size());
for (Serializable path : renditionPaths)
{

View File

@@ -56,7 +56,7 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.apache.commons.logging.Log;

View File

@@ -35,7 +35,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;

View File

@@ -57,7 +57,7 @@ import org.alfresco.service.namespace.*;
import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -186,9 +186,9 @@ public class RenderingEngineTemplateImpl
final String webappName =
(avmService.hasAspect(-1,
AVMConstants.getWebappPath(formInstanceDataAVMPath),
AVMUtil.getWebappPath(formInstanceDataAVMPath),
WCMAppModel.ASPECT_WEBAPP)
? AVMConstants.getWebapp(formInstanceDataAVMPath)
? AVMUtil.getWebapp(formInstanceDataAVMPath)
: null);
root.put("webapp", webappName);
@@ -211,7 +211,7 @@ public class RenderingEngineTemplateImpl
root.put("xml", NodeModel.wrap(formInstanceDataDocument));
root.put("node", new TemplateNode(((FormInstanceDataImpl)formInstanceData).getNodeRef(), sr, null));
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
root.put("cwd", AVMConstants.getWebappRelativePath(currentAVMPath));
root.put("cwd", AVMUtil.getWebappRelativePath(currentAVMPath));
final TemplateService templateService = sr.getTemplateService();
final String outputPathPattern = (FreeMarkerUtil.buildNamespaceDeclaration(formInstanceDataDocument) +
this.getOutputPathPattern());
@@ -232,9 +232,9 @@ public class RenderingEngineTemplateImpl
te);
}
result = AVMConstants.buildPath(parentAVMPath,
result = AVMUtil.buildPath(parentAVMPath,
result,
AVMConstants.PathRelation.SANDBOX_RELATIVE);
AVMUtil.PathRelation.SANDBOX_RELATIVE);
LOGGER.debug("processed pattern " + outputPathPattern + " as " + result);
return result;
}
@@ -257,7 +257,7 @@ public class RenderingEngineTemplateImpl
if (!isRegenerate)
{
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
AVMConstants.makeAllDirectories(parentAVMPath);
AVMUtil.makeAllDirectories(parentAVMPath);
avmService.createFile(parentAVMPath,
AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
if (LOGGER.isDebugEnabled())
@@ -278,7 +278,7 @@ public class RenderingEngineTemplateImpl
final Collection<Serializable> renditions = (pv == null
? new HashSet<Serializable>()
: pv.getCollection(DataTypeDefinition.TEXT));
renditions.add(AVMConstants.getStoreRelativePath(renditionAvmPath));
renditions.add(AVMUtil.getStoreRelativePath(renditionAvmPath));
avmService.setNodeProperty(formInstanceData.getPath(),
WCMAppModel.PROP_RENDITIONS,
new PropertyValue(DataTypeDefinition.TEXT,
@@ -317,7 +317,7 @@ public class RenderingEngineTemplateImpl
new PropertyValue(DataTypeDefinition.TEXT,
MessageFormat.format(bundle.getString("default_rendition_description"),
this.getTitle(),
AVMConstants.getSandboxRelativePath(rendition.getPath()))));
AVMUtil.getSandboxRelativePath(rendition.getPath()))));
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE,
new PropertyValue(DataTypeDefinition.NODE_REF,
this.nodeRef));
@@ -327,7 +327,7 @@ public class RenderingEngineTemplateImpl
// extract a store relative path for the primary form instance data
props.put(WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA,
new PropertyValue(DataTypeDefinition.TEXT,
AVMConstants.getStoreRelativePath(formInstanceData.getPath())));
AVMUtil.getStoreRelativePath(formInstanceData.getPath())));
final AVMService avmService = this.getServiceRegistry().getAVMService();
avmService.setNodeProperties(rendition.getPath(), props);
@@ -344,8 +344,8 @@ public class RenderingEngineTemplateImpl
final String formInstanceDataAvmPath = formInstanceData.getPath();
final String renditionAvmPath = rendition.getPath();
final String parentPath = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[0];
final String sandboxUrl = AVMConstants.buildStoreUrl(formInstanceDataAvmPath);
final String webappUrl = AVMConstants.buildWebappUrl(formInstanceDataAvmPath);
final String sandboxUrl = AVMUtil.buildStoreUrl(formInstanceDataAvmPath);
final String webappUrl = AVMUtil.buildWebappUrl(formInstanceDataAvmPath);
final HashMap<QName, Object> model = new HashMap<QName, Object>();
// add simple scalar parameters
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
@@ -441,9 +441,9 @@ public class RenderingEngineTemplateImpl
". got a " + arguments[0].getClass().getName() + ".");
}
String path = (String)arguments[0];
path = AVMConstants.buildPath(parentPath,
path = AVMUtil.buildPath(parentPath,
path,
AVMConstants.PathRelation.WEBAPP_RELATIVE);
AVMUtil.PathRelation.WEBAPP_RELATIVE);
LOGGER.debug("tpm_parseXMLDocument('" + path +
"'), parentPath = " + parentPath);
final Document d = fdf.parseXMLDocument(path);
@@ -477,9 +477,9 @@ public class RenderingEngineTemplateImpl
}
String path = arguments.length == 2 ? (String)arguments[1] : "";
path = AVMConstants.buildPath(parentPath,
path = AVMUtil.buildPath(parentPath,
path,
AVMConstants.PathRelation.WEBAPP_RELATIVE);
AVMUtil.PathRelation.WEBAPP_RELATIVE);
final String formName = (String)arguments[0];
LOGGER.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
"'), parentPath = " + parentPath);
@@ -535,9 +535,9 @@ public class RenderingEngineTemplateImpl
final String path = (String)arguments[0];
LOGGER.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath);
return AVMConstants.buildPath(parentPath,
return AVMUtil.buildPath(parentPath,
path,
AVMConstants.PathRelation.WEBAPP_RELATIVE);
AVMUtil.PathRelation.WEBAPP_RELATIVE);
}
});

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -83,12 +83,12 @@ public class RenditionImpl
public String getWebappRelativePath()
{
return AVMConstants.getWebappRelativePath(this.getPath());
return AVMUtil.getWebappRelativePath(this.getPath());
}
public String getSandboxRelativePath()
{
return AVMConstants.getSandboxRelativePath(this.getPath());
return AVMUtil.getSandboxRelativePath(this.getPath());
}
public FormInstanceData getPrimaryFormInstanceData()
@@ -139,7 +139,7 @@ public class RenditionImpl
public String getUrl()
{
return AVMConstants.buildAssetUrl(this.getPath());
return AVMUtil.buildAssetUrl(this.getPath());
}
public String getFileTypeImage()

View File

@@ -44,7 +44,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -49,7 +49,7 @@ import org.alfresco.web.app.servlet.ajax.InvokeCommand;
import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMBrowseBean;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.bean.wcm.AVMNode;
import org.alfresco.web.forms.*;
import org.alfresco.web.ui.common.Utils;
@@ -462,10 +462,10 @@ public class XFormsBean
else
{
final String previewStorePath =
AVMConstants.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMConstants.buildPath(previewStorePath,
AVMUtil.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMUtil.buildPath(previewStorePath,
currentPath,
AVMConstants.PathRelation.WEBAPP_RELATIVE);
AVMUtil.PathRelation.WEBAPP_RELATIVE);
}
LOGGER.debug(this + ".getFilePickerData(" + currentPath + ")");
@@ -490,7 +490,7 @@ public class XFormsBean
Element e = result.createElement("current-node");
e.setAttribute("avmPath", currentPath);
e.setAttribute("webappRelativePath",
AVMConstants.getWebappRelativePath(currentPath));
AVMUtil.getWebappRelativePath(currentPath));
e.setAttribute("type", "directory");
e.setAttribute("image", "/images/icons/space_small.gif");
filePickerDataElement.appendChild(e);
@@ -501,7 +501,7 @@ public class XFormsBean
e = result.createElement("child-node");
e.setAttribute("avmPath", entry.getValue().getPath());
e.setAttribute("webappRelativePath",
AVMConstants.getWebappRelativePath(entry.getValue().getPath()));
AVMUtil.getWebappRelativePath(entry.getValue().getPath()));
e.setAttribute("type", entry.getValue().isDirectory() ? "directory" : "file");
e.setAttribute("image", (entry.getValue().isDirectory()
? "/images/icons/space_small.gif"
@@ -552,10 +552,10 @@ public class XFormsBean
else if (item.isFormField() && item.getFieldName().equals("currentPath"))
{
final String previewStorePath =
AVMConstants.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMConstants.buildPath(previewStorePath,
AVMUtil.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath());
currentPath = AVMUtil.buildPath(previewStorePath,
item.getString(),
AVMConstants.PathRelation.WEBAPP_RELATIVE);
AVMUtil.PathRelation.WEBAPP_RELATIVE);
LOGGER.debug("currentPath is " + currentPath);
}
else
@@ -692,8 +692,8 @@ public class XFormsBean
}
final String baseURI = (uri.charAt(0) == '/'
? AVMConstants.buildStoreUrl(cwdAvmPath)
: AVMConstants.buildAssetUrl(cwdAvmPath));
? AVMUtil.buildStoreUrl(cwdAvmPath)
: AVMUtil.buildAssetUrl(cwdAvmPath));
LOGGER.debug("rewriting " + uri + " as " + (baseURI + uri));
includeEl.setAttribute("schemaLocation", baseURI + uri);

View File

@@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.web.bean.wcm.AVMBrowseBean;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
import org.alfresco.web.forms.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -173,7 +173,7 @@ public class XFormsProcessor
append(JavaScriptUtils.javaScriptEscape(avmBrowseBean.getWebapp())).
append("';\n");
js.append("alfresco.constants.AVM_WEBAPP_URL = '").
append(JavaScriptUtils.javaScriptEscape(AVMConstants.buildWebappUrl(AVMConstants.getCorrespondingPreviewStoreName(avmBrowseBean.getSandbox()),
append(JavaScriptUtils.javaScriptEscape(AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(avmBrowseBean.getSandbox()),
avmBrowseBean.getWebapp()))).
append("';\n");
js.append("alfresco.xforms.constants.XFORMS_UI_DIV_ID = '").