Merged V2.9 to HEAD

9848: Merged V2.2 to V2.9
      9610: Fixed ETWOTWO-548
   10232: Merged V2.2 to V2.9
      10231: Merged V2.1 to V2.2
         10229: Merged V2.1-A to V2.1
              10227: https://issues.alfresco.com/jira/browse/ADB-106
   10530: Merged V2.2 to V2.9
      9847: Applied patch for ETWOTWO-542 (supplied by Peter Monks)
      9897: Fix for ETWOTWO-302: Alphabetise advanced workflow names
      9901: Fixed ETWOTWO-426: V2.2 upgrade problems with MySQL 5.0.51
      9902: Fix for ETWOTWO-438: Versionable aspect and add-content permissions
      9905: Fix ETWOTWO-560
      9912: Increased test wait iterations from 10 (10s) to 100 (100s).
      9919: Part fix for ACT-3574: Added close for schema bootstrap connection


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10612 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-09-01 13:26:52 +00:00
parent 740d12671c
commit 11e3442f4c
10 changed files with 416 additions and 14 deletions

View File

@@ -44,6 +44,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.config.JNDIConstants;
import org.alfresco.linkvalidation.HrefValidationProgress;
import org.alfresco.linkvalidation.LinkValidationService;
import org.alfresco.model.ContentModel;
@@ -539,7 +540,7 @@ public class AVMBrowseBean implements IContextListener
*/
public String getStagingPreviewUrl()
{
return AVMUtil.buildWebappUrl(getStagingStore(), getWebapp());
return(AVMUtil.getPreviewURI(getStagingStore(), '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE + '/' + getWebapp()));
}
/**
@@ -547,7 +548,7 @@ public class AVMBrowseBean implements IContextListener
*/
public String getSandboxPreviewUrl()
{
return AVMUtil.buildWebappUrl(getSandbox(), getWebapp());
return(AVMUtil.getPreviewURI(getSandbox(), '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE + '/' + getWebapp()));
}
/**

View File

@@ -70,14 +70,9 @@ public class AVMNode extends Node implements Map<String, Object>
{
return null;
}
final ClientConfigElement config =
Application.getClientConfig(FacesContext.getCurrentInstance());
final String dns =
AVMUtil.lookupStoreDNS(AVMUtil.getStoreName(node.getPath()));
return AVMUtil.buildAssetUrl(AVMUtil.getSandboxRelativePath(node.getPath()),
config.getWCMDomain(),
config.getWCMPort(),
dns);
final String storeId = AVMUtil.getStoreName(node.getPath());
final String assetPath = AVMUtil.getStoreRelativePath(node.getPath());
return AVMUtil.getPreviewURI(storeId, assetPath);
}
};

View File

@@ -36,7 +36,6 @@ import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.config.JNDIConstants;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
@@ -52,7 +51,12 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.VirtServerUtils;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.preview.PreviewURIService;
import org.alfresco.web.bean.wcm.preview.VirtualisationServerPreviewURIService;
import org.alfresco.web.config.ClientConfigElement;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;
/**
@@ -603,6 +607,30 @@ public final class AVMUtil
return MessageFormat.format(JNDIConstants.PREVIEW_ASSET_URL, dns, domain, port, assetPath);
}
public static String getPreviewURI(final String storeId, final String assetPath)
{
if (previewURIGenerator == null)
{
WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance());
if (wac.containsBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE))
{
// if the bean is present retrieve it
previewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE,
PreviewURIService.class);
}
else
{
// Backwards compatibility - if the new Spring bean doesn't exist, default to the
// existing behaviour (create a URL to the virtualisation server).
previewURIGenerator = new VirtualisationServerPreviewURIService();
}
}
return previewURIGenerator.getPreviewURI(storeId, assetPath);
}
public static String lookupStoreDNS(String store)
{
if (store == null || store.length() == 0)
@@ -987,4 +1015,7 @@ public final class AVMUtil
private static ConfigElement deploymentConfig = null;
private static ConfigElement linksManagementConfig = null;
private final static String SPRING_BEAN_NAME_PREVIEW_URI_SERVICE = "PreviewURIService";
private static PreviewURIService previewURIGenerator = null;
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm.preview;
/**
* A PreviewURIService that always returns null (no preview URI).
*
* @author Peter Monks (peter.monks@alfresco.com)
* @version $Id$
*/
public class NullPreviewURIService
implements PreviewURIService
{
/**
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
*/
public String getPreviewURI(final String storeId, final String webapp)
{
return(null);
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm.preview;
/**
* Abstraction for generating preview URLs.
*
* @author Peter Monks (peter.monks@alfresco.com)
* @version $Id$
*/
public interface PreviewURIService
{
/**
* @param storeId The id of the store to generate the preview URI for.
* @param pathToAsset The path to the asset to generate the preview URI for.
* @return The Preview URI for the given store id and/or asset (<i>may be null</i>).
*/
String getPreviewURI(String storeId, String pathToAsset);
}

View File

@@ -0,0 +1,127 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm.preview;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.alfresco.util.Pair;
/**
* A PreviewURIService that proxies requests to underlying PreviewURIGenerator implementations based on the store that the Preview URI
* is being generated for.
*
* @author Peter Monks (peter.monks@alfresco.com)
* @version $Id$
*/
public class StoreSpecificPreviewURIService
implements PreviewURIService
{
private final List<Pair<Pattern, PreviewURIService>> storeURIGenerators;
private final PreviewURIService fallback;
public StoreSpecificPreviewURIService(final List<Pair<String, PreviewURIService>> storeURIGenerators)
{
this(storeURIGenerators, null);
}
public StoreSpecificPreviewURIService(final List<Pair<String, PreviewURIService>> storeURIGenerators,
final PreviewURIService fallback)
{
List<Pair<Pattern, PreviewURIService>> compiledStoreURIGenerators = null;
// Iterate through the list, compiling all of the regex strings into Pattern objects
if (storeURIGenerators != null)
{
Iterator<Pair<String, PreviewURIService>> iter = storeURIGenerators.iterator();
compiledStoreURIGenerators = new ArrayList<Pair<Pattern, PreviewURIService>>(storeURIGenerators.size());
while (iter.hasNext())
{
Pair<String, PreviewURIService> pair = iter.next();
if (pair != null)
{
String regex = pair.getFirst();
if (regex != null && regex.trim().length() > 0)
{
Pattern pattern = Pattern.compile(regex);
compiledStoreURIGenerators.add(new Pair<Pattern, PreviewURIService>(pattern, pair.getSecond()));
}
}
}
}
// We make the list unmodifiable to ensure correct behaviour in the presence of concurrent (multi-threaded) invocations.
this.storeURIGenerators = Collections.unmodifiableList(compiledStoreURIGenerators);
this.fallback = fallback == null ? new VirtualisationServerPreviewURIService() : fallback;
}
/**
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
*/
public String getPreviewURI(final String storeId, final String pathToAsset)
{
String result = null;
boolean resultFound = false;
if (storeURIGenerators != null)
{
Iterator<Pair<Pattern, PreviewURIService>> iter = storeURIGenerators.iterator();
while (iter.hasNext())
{
Pair<Pattern, PreviewURIService> pair = iter.next();
Matcher matcher = pair.getFirst().matcher(storeId);
if (matcher.matches())
{
result = pair.getSecond().getPreviewURI(storeId, pathToAsset);
resultFound = true;
break;
}
}
}
// We didn't find an impl for the given store, so use the fallback impl
if (!resultFound)
{
result = fallback.getPreviewURI(storeId, pathToAsset);
}
return(result);
}
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm.preview;
/**
* A PreviewURIService that takes a URI template and replaces the following parameters per request:
* <ul>
* <li>{storeId} - the store Id of the preview request</li>
* <li>{pathToAsset} - the full path and filename of the asset being previewed (including a leading '/')</li>
* </ul>
*
* @author Peter Monks (peter.monks@alfresco.com)
* @version $Id$
*/
public class URITemplatePreviewURIService
implements PreviewURIService
{
private final static String URI_TEMPLATE_PARAMETER_STORE_ID = "{storeId}";
private final static String URI_TEMPLATE_PARAMETER_PATH_TO_ASSET = "{pathToAsset}";
private final String uriTemplate;
public URITemplatePreviewURIService(final String uriTemplate)
{
// PRECONDITIONS
assert uriTemplate != null : "uriTemplate must not be null.";
// Body
this.uriTemplate = uriTemplate;
}
/**
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
*/
public String getPreviewURI(final String storeId, final String pathToAsset)
{
String result = uriTemplate;
if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_STORE_ID))
{
if (storeId != null && storeId.trim().length() > 0)
{
result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, storeId);
}
else
{
// Shouldn't ever happen (store ids are always provided), but better to be safe than sorry
result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, "");
}
}
if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET))
{
if (pathToAsset != null && pathToAsset.trim().length() > 0)
{
result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, pathToAsset);
}
else
{
result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, "");
}
}
return(result);
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.wcm.preview;
import org.alfresco.config.JNDIConstants;
import org.alfresco.web.bean.wcm.AVMUtil;
/**
* A PreviewURIService that constructs a virtualisation server URI.
*
* @author Peter Monks (peter.monks@alfresco.com)
* @version $Id$
*/
public class VirtualisationServerPreviewURIService
implements PreviewURIService
{
/**
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
*/
public String getPreviewURI(final String storeId, final String pathToAsset)
{
// Sanity checking
if (!pathToAsset.startsWith('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE))
{
throw new IllegalStateException("Invalid asset path in AVM node ref: " + storeId + ":" + pathToAsset);
}
return(AVMUtil.buildAssetUrl(storeId, pathToAsset));
}
}

View File

@@ -61,6 +61,8 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.TransientNode;
import org.alfresco.web.bean.wizard.BaseWizardBean;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.common.component.data.UIRichList;
@@ -601,6 +603,13 @@ public class StartWorkflowWizard extends BaseWizardBean
{
initializeWorkflows();
}
// Alphabetical list sorting
// Fix bug reported in https://issues.alfresco.com/browse/ETWOTWO-302
QuickSort sorter = new QuickSort(availableWorkflows, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
return availableWorkflows;
}

View File

@@ -44,6 +44,7 @@ import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
import javax.transaction.UserTransaction;
import org.alfresco.config.JNDIConstants;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.web.scripts.FileTypeImageUtils;
@@ -421,7 +422,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
out.write("</nobr></td><td><nobr>");
// Preview Website
String websiteUrl = AVMUtil.buildWebappUrl(mainStore, getWebapp());
String websiteUrl = AVMUtil.getPreviewURI(mainStore, '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE + '/' + getWebapp());
Map requestMap = context.getExternalContext().getRequestMap();
requestMap.put(REQUEST_PREVIEW_REF, websiteUrl);
Utils.encodeRecursive(context, aquireAction(
@@ -843,8 +844,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
// build node context required for actions
AVMNode avmNode = new AVMNode(node);
String assetPath = sourcePath.substring(rootPathIndex);
String previewUrl = AVMUtil.buildAssetUrl(
assetPath, config.getWCMDomain(), config.getWCMPort(), dns);
String previewUrl = AVMUtil.getPreviewURI(userStore, assetPath);
avmNode.getProperties().put("previewUrl", previewUrl);
// size of files