Merged V2.2 to HEAD

8049: Fix for WCM-1033: Only admin users can create web projects
   8051: Merged V2.1 to V2.2
      8006: Merged V2.1-A to V2.1 (Virtual Server fixes)
         7723: The JMX server connector is now lazily instantiated in the server context.
         7734: Fix for WCM-934.
         7735: The linkvalidation service now provides a public API
         7742: Possible fix for ACT #361
      8012: Merged V2.1-A to V2.1
         7749: Fix stack overflow
         7955: Fix for issue ADB-18 Forward slash '/' in username causes Advanced Search failure
         7975: AR-1832: Allow setting of timeout value in the Java webservices client
         7995: Include the alf_child_assoc.type_qname in the check for duplicate children.
   8052: Build fix
   8054: Merged V2.1 to V2.2
      8045: Patch fix to solve WCM-1051 - also reruns fixed patch on previously patched repos (see CHK-2143)
   8058: Fixed compilation issues following merge


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8466 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2008-03-07 13:39:01 +00:00
parent d096386b6b
commit a55663b452
10 changed files with 84 additions and 80 deletions

View File

@ -24,6 +24,7 @@
<value>classpath:alfresco/repository.properties</value> <value>classpath:alfresco/repository.properties</value>
<value>classpath:alfresco/version.properties</value> <value>classpath:alfresco/version.properties</value>
<value>classpath:alfresco/domain/transaction.properties</value> <value>classpath:alfresco/domain/transaction.properties</value>
<value>classpath:alfresco/jndi.properties</value>
</list> </list>
</property> </property>
</bean> </bean>
@ -54,14 +55,17 @@
<!-- Custom MBeanServer --> <!-- Custom MBeanServer -->
<bean id="alfrescoMBeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/> <bean id="alfrescoMBeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> <bean id="registry"
class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
lazy-init="true">
<property name="port" value="${alfresco.rmi.services.port}"/> <property name="port" value="${alfresco.rmi.services.port}"/>
</bean> </bean>
<!-- MBeanServer Connector (registers itself with custom alfrescoMBeanServer) --> <!-- MBeanServer Connector (registers itself with custom alfrescoMBeanServer) -->
<bean id="serverConnector" <bean id="serverConnector"
class="org.springframework.jmx.support.ConnectorServerFactoryBean" class="org.springframework.jmx.support.ConnectorServerFactoryBean"
depends-on="registry"> depends-on="registry"
lazy-init="true">
<property name="server" ref="alfrescoMBeanServer"/> <property name="server" ref="alfrescoMBeanServer"/>
<property name="objectName" value="connector:name=rmi"/> <property name="objectName" value="connector:name=rmi"/>

View File

@ -1358,8 +1358,8 @@
</property> </property>
</bean> </bean>
<bean id="patch.avmWebProjectInheritPermissions" class="org.alfresco.repo.admin.patch.impl.AVMWebProjectInheritPermissionsPatch" parent="basePatch"> <bean id="patch.avmWebProjectInheritPermissions02" class="org.alfresco.repo.admin.patch.impl.AVMWebProjectInheritPermissionsPatch" parent="basePatch">
<property name="id"><value>patch.avmWebProjectInheritPermissions</value></property> <property name="id"><value>patch.avmWebProjectInheritPermissions02</value></property>
<property name="description"><value>patch.avmWebProjectInheritPermissions.description</value></property> <property name="description"><value>patch.avmWebProjectInheritPermissions.description</value></property>
<property name="fixesFromSchema"><value>0</value></property> <property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>122</value></property> <property name="fixesToSchema"><value>122</value></property>

View File

@ -1418,7 +1418,6 @@
<value>getHrefManifest</value> <value>getHrefManifest</value>
<value>getBrokenHrefManifest</value> <value>getBrokenHrefManifest</value>
<value>getHrefDifference</value> <value>getHrefDifference</value>
<value>getHrefManifestBrokenByDelete</value>
<value>getHrefManifestBrokenByNewOrMod</value> <value>getHrefManifestBrokenByNewOrMod</value>
<value>getHrefsDependentUponFile</value> <value>getHrefsDependentUponFile</value>
</list> </list>

View File

@ -39,6 +39,13 @@ public interface LinkValidationService
public void onBootstrap(); public void onBootstrap();
public void onShutdown(); public void onShutdown();
/**
* Returns the poll interval (in milliseconds) used to check
* for new snapshots in staging.
*/
public int getPollInterval();
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/** /**
* This function is applied to a webapp in staging, and is just a * This function is applied to a webapp in staging, and is just a
@ -105,43 +112,13 @@ public interface LinkValidationService
throws AVMNotFoundException, throws AVMNotFoundException,
SocketException; SocketException;
//-------------------------------------------------------------------------
/**
* Fetches a manifest of all hyperlinks broken by files
* deleted in a HrefDifference. Files and hrefs in this
* manifest will be in the namespace of the src in the
* HrefDifference. For example, suppose the "test"
* web project had a ROOT webapp with a link within
* "moo.html" that pointed to: "hamlet.html".
* Now suppose that user 'alice' proposes to delete "hamlet.html".
* Because 'alice' is the 'src' and staging is the 'dst'
* in the HrefDifference, all files and hyperlinks appear from
* the perspective of the main working store within
* alice's sandbox. Thus, the broken link info is as follows:
*
* <pre>
* File containing broken link:
* test--alice:/www/avm_webapps/ROOT/moo.html
*
* Broken link:
* http://alice.test.www--sandbox.version--v-1.127-0-0-1.ip.alfrescodemo.net:8180/hamlet.html
* </pre>
*
* @param hdiff The difference between two webapps obtained
* by calling getHrefDifference().
*/
//-------------------------------------------------------------------------
public HrefManifest getHrefManifestBrokenByDelete(HrefDifference hdiff);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/** /**
* Fetches a manifest of all hyperlinks broken in new or modified files in * Fetches a manifest of all hyperlinks broken in new or modified files in
* an HrefDifference. Similar to getHrefManifestBrokenByDelete(), * an HrefDifference. The entries in this manifest are in the 'src'
* the entries in this manifest are in the 'src' namespace of the * namespace of the HrefDifference operation
* HrefDifference operation (i.e.: files & urls from alice, not staging). * (i.e.: files & urls from alice, not staging).
* *
* @param hdiff The difference between two webapps obtained * @param hdiff The difference between two webapps obtained
* by calling getHrefDifference(). * by calling getHrefDifference().

View File

@ -24,16 +24,21 @@
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
import java.util.List;
import org.alfresco.i18n.I18NUtil; import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.admin.patch.AbstractPatch; import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.importer.ImporterBootstrap; import org.alfresco.repo.importer.ImporterBootstrap;
import org.alfresco.repo.search.Indexer;
import org.alfresco.repo.search.IndexerAndSearcher; import org.alfresco.repo.search.IndexerAndSearcher;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow; import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.RegexQNamePattern;
/** /**
* Patch to break the inheritance of permissions on AVM Web Project Folders. * Patch to break the inheritance of permissions on AVM Web Project Folders.
@ -81,7 +86,23 @@ public class AVMWebProjectInheritPermissionsPatch extends AbstractPatch
rs = searchService.query(sp); rs = searchService.query(sp);
for (ResultSetRow row : rs) for (ResultSetRow row : rs)
{ {
// break permission inheritance for the Web Project nodes
this.permissionService.setInheritParentPermissions(row.getNodeRef(), false); this.permissionService.setInheritParentPermissions(row.getNodeRef(), false);
// ensure that permissions are explicitly assigned for all Content Manager roles
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(
row.getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
NodeRef userInfoRef = ref.getChildRef();
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if ("ContentManager".equals(userrole))
{
this.permissionService.setPermission(row.getNodeRef(), username, "ContentManager", true);
}
}
} }
} }
finally finally

View File

@ -327,13 +327,14 @@
assoc.id assoc.id
</query> </query>
<query name="node.GetChildAssocIdByShortName"> <query name="node.GetChildAssocIdByTypeAndName">
select select
assoc.id assoc.id
from from
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
where where
assoc.parent = :parent and assoc.parent = :parent and
assoc.typeQName = :typeQName and
assoc.childNodeName = :childNodeName and assoc.childNodeName = :childNodeName and
assoc.childNodeNameCrc = :childNodeNameCrc assoc.childNodeNameCrc = :childNodeNameCrc
</query> </query>

View File

@ -99,7 +99,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
private static final String QUERY_GET_PRIMARY_CHILD_NODE_STATUSES = "node.GetPrimaryChildNodeStatuses"; private static final String QUERY_GET_PRIMARY_CHILD_NODE_STATUSES = "node.GetPrimaryChildNodeStatuses";
private static final String QUERY_GET_CHILD_ASSOCS = "node.GetChildAssocs"; private static final String QUERY_GET_CHILD_ASSOCS = "node.GetChildAssocs";
private static final String QUERY_GET_CHILD_ASSOCS_BY_ALL = "node.GetChildAssocsByAll"; private static final String QUERY_GET_CHILD_ASSOCS_BY_ALL = "node.GetChildAssocsByAll";
private static final String QUERY_GET_CHILD_ASSOC_ID_BY_NAME = "node.GetChildAssocIdByShortName"; private static final String QUERY_GET_CHILD_ASSOC_ID_TYPE_AND_BY_NAME = "node.GetChildAssocIdByTypeAndName";
private static final String QUERY_GET_CHILD_ASSOC_BY_TYPE_AND_NAME = "node.GetChildAssocByTypeAndName"; private static final String QUERY_GET_CHILD_ASSOC_BY_TYPE_AND_NAME = "node.GetChildAssocByTypeAndName";
private static final String QUERY_GET_CHILD_ASSOC_REFS = "node.GetChildAssocRefs"; private static final String QUERY_GET_CHILD_ASSOC_REFS = "node.GetChildAssocRefs";
private static final String QUERY_GET_CHILD_ASSOC_REFS_BY_QNAME = "node.GetChildAssocRefsByQName"; private static final String QUERY_GET_CHILD_ASSOC_REFS_BY_QNAME = "node.GetChildAssocRefsByQName";
@ -772,42 +772,17 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
} }
} }
/*
* The parent node is explicitly locked. A query is then issued to ensure that there
* are no duplicates in the index on the child assoc table. The child association is
* then modified, although not directly in the database. The lock guards against other
* transactions modifying the unique index without this transaction's knowledge.
*/
final Node parentNode = childAssoc.getParent(); final Node parentNode = childAssoc.getParent();
// if (loggerChildAssoc.Enabled()) final QNameEntity assocTypeQName = childAssoc.getTypeQName();
// {
// loggerChildAssoc.debug(
// "Locking parent node for modifying child assoc: \n" +
// " Parent: " + parentNode + "\n" +
// " Child Assoc: " + childAssoc + "\n" +
// " New Name: " + childNameNew);
// }
// for (int i = 0; i < maxLockRetries; i++)
// {
// try
// {
// getSession().lock(parentNode, LockMode.UPGRADE);
// // The lock was good, proceed
// break;
// }
// catch (LockAcquisitionException e) {}
// catch (ConcurrencyFailureException e) {}
// // We can retry after a short pause that gets potentially longer each time
// try { Thread.sleep(randomWaitTime.nextInt(500 * i + 500)); } catch (InterruptedException ee) {}
// }
// We have the lock, so issue the query to check // We have the lock, so issue the query to check
HibernateCallback callback = new HibernateCallback() HibernateCallback callback = new HibernateCallback()
{ {
public Object doInHibernate(Session session) public Object doInHibernate(Session session)
{ {
Query query = session Query query = session
.getNamedQuery(HibernateNodeDaoServiceImpl.QUERY_GET_CHILD_ASSOC_ID_BY_NAME) .getNamedQuery(HibernateNodeDaoServiceImpl.QUERY_GET_CHILD_ASSOC_ID_TYPE_AND_BY_NAME)
.setParameter("parent", parentNode) .setParameter("parent", parentNode)
.setParameter("typeQName", assocTypeQName)
.setParameter("childNodeName", childNameNewShort) .setParameter("childNodeName", childNameNewShort)
.setLong("childNodeNameCrc", childNameNewCrc); .setLong("childNodeNameCrc", childNameNewCrc);
return query.uniqueResult(); return query.uniqueResult();
@ -822,15 +797,14 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
logger.debug( logger.debug(
"Duplicate child association detected: \n" + "Duplicate child association detected: \n" +
" Existing Child Assoc: " + childAssocIdExisting + "\n" + " Existing Child Assoc: " + childAssocIdExisting + "\n" +
" Assoc Name: " + childName); " Child Name: " + childName);
} }
throw new DuplicateChildNodeNameException( throw new DuplicateChildNodeNameException(
parentNode.getNodeRef(), parentNode.getNodeRef(),
childAssoc.getTypeQName().getQName(), childAssoc.getTypeQName().getQName(),
childName); childName);
} }
// We got past that, so we can just update the entity and know that no other transaction // We got past that, so we can just update the entity
// can lock the parent.
childAssoc.setChildNodeName(childNameNewShort); childAssoc.setChildNodeName(childNameNewShort);
childAssoc.setChildNodeNameCrc(childNameNewCrc); childAssoc.setChildNodeNameCrc(childNameNewCrc);

View File

@ -83,7 +83,7 @@ public class ServiceBehaviourBinding implements BehaviourBinding
@Override @Override
public String toString() public String toString()
{ {
return "ServiceBinding[service=" + this + "]"; return "ServiceBinding[service=" + service + "]";
} }
} }

View File

@ -112,13 +112,13 @@ public class PermissionServiceTest extends AbstractPermissionTest
AuthenticationUtil.setSystemUserAsCurrentUser(); AuthenticationUtil.setSystemUserAsCurrentUser();
try try
{ {
assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CONSUMER) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CONSUMER) == AccessStatus.ALLOWED);
assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.DELETE) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.DELETE) == AccessStatus.ALLOWED);
assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.READ) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.READ) == AccessStatus.ALLOWED);
assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED);
assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CANCEL_CHECK_OUT) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CANCEL_CHECK_OUT) == AccessStatus.ALLOWED);
assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CHECK_OUT) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.CHECK_OUT) == AccessStatus.ALLOWED);
assertFalse(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.COORDINATOR) == AccessStatus.ALLOWED); assertTrue(serviceRegistry.getPermissionService().hasPermission(rootNodeRef, PermissionService.COORDINATOR) == AccessStatus.ALLOWED);
} }
finally finally
{ {

View File

@ -49,6 +49,10 @@ import org.springframework.core.Ordered;
public class RuntimeSystemPropertiesSetter public class RuntimeSystemPropertiesSetter
implements BeanFactoryPostProcessor, Ordered implements BeanFactoryPostProcessor, Ordered
{ {
private static org.apache.commons.logging.Log log=
org.apache.commons.logging.LogFactory.getLog(
RuntimeSystemPropertiesSetter.class );
// default: just before PropertyPlaceholderConfigurer // default: just before PropertyPlaceholderConfigurer
private int order = Integer.MAX_VALUE - 1; private int order = Integer.MAX_VALUE - 1;
@ -61,15 +65,39 @@ public class RuntimeSystemPropertiesSetter
String path=null; String path=null;
try try
{ {
// Typically, the value of 'path' will be something like:
//
// $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/alfresco-jmxrmi.password
// or: $TOMCAT_HOME/shared/classes/alfresco/alfresco-jmxrmi.password
//
// However, if WCM isn't installed there won't be a JMX password file.
// Therefore, while it's important to choke on bad paths, a missing
// password file must be acceptable -- it just means that WCM virtualization
// will be disabled later when org.alfresco.mbeans.VirtServerRegistry
// refuses to bring up the serverConnector bean.
path = loader.getResource("alfresco/alfresco-jmxrmi.password").toURI().getPath(); path = loader.getResource("alfresco/alfresco-jmxrmi.password").toURI().getPath();
} }
catch (java.net.URISyntaxException e ) { e.printStackTrace(); } catch (java.net.URISyntaxException e ) { e.printStackTrace(); }
catch (Exception e )
{
if ( log.isWarnEnabled() )
log.warn(
"Could not find alfresco-jmxrmi.password on classpath");
}
if ( path == null ) { System.setProperty("alfresco.jmx.dir", ""); }
else
{
String alfresco_jmx_dir = String alfresco_jmx_dir =
path.substring(0,path.lastIndexOf("/alfresco-jmxrmi.password")); path.substring(0,path.lastIndexOf("/alfresco-jmxrmi.password"));
// The value of 'alfresco.jmx.dir' will be something like:
// $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco
System.setProperty("alfresco.jmx.dir", alfresco_jmx_dir); System.setProperty("alfresco.jmx.dir", alfresco_jmx_dir);
} }
}
public void setOrder(int order) { this.order = order; } public void setOrder(int order) { this.order = order; }
public int getOrder() { return order; } public int getOrder() { return order; }
} }