mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Now when InviteWebsiteUsersWizard invites a user,
the update message that the virtualization server gets is the path to the newly added webapp, not the path to that webapp in the staging area. For example, if 'bob' is added to the 'ROOT' webapp of 'mysite', the virt server now gets: mysite--bob:/www/avm_webapps/ROOT not: mysite:/www/avm_webapps/ROOT git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4704 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -72,9 +72,9 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
final NodeService nodeService)
|
||||
{
|
||||
// create package paths (layered to user sandbox area as target)
|
||||
final String packageName = SandboxFactory.createWorkflowSandbox(storeId);
|
||||
final String workflowMainStoreName =
|
||||
AVMConstants.buildWorkflowMainStoreName(storeId, packageName);
|
||||
|
||||
SandboxInfo sandboxInfo = SandboxFactory.createWorkflowSandbox(storeId);
|
||||
final String workflowMainStoreName = sandboxInfo.getMainStoreName();
|
||||
final String packagesPath = AVMConstants.buildStoreRootPath(workflowMainStoreName);
|
||||
|
||||
final List<AVMDifference> diffs = new ArrayList<AVMDifference>(srcPaths.size());
|
||||
|
@@ -20,6 +20,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -150,14 +151,18 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
}
|
||||
|
||||
// build the sandboxes now we have the manager list and complete user list
|
||||
List<SandboxInfo> sandboxInfoList = new LinkedList<SandboxInfo>();
|
||||
|
||||
for (UserGroupRole userRole : this.userGroupRoles)
|
||||
{
|
||||
String authority = userRole.getAuthority();
|
||||
if (excludeUsers.contains(authority) == false)
|
||||
{
|
||||
SandboxInfo info =
|
||||
SandboxFactory.createUserSandbox(
|
||||
getAvmStore(), this.managers, userRole.getAuthority(), userRole.getRole());
|
||||
|
||||
sandboxInfoList.add( info );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +184,21 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
}
|
||||
}
|
||||
|
||||
// reload virtualisation server for the web project
|
||||
// reload virtualisation server for webapp in this web project
|
||||
if (isStandalone())
|
||||
{
|
||||
String stagingStore = AVMConstants.buildStagingStoreName(getAvmStore());
|
||||
String path = AVMConstants.buildStoreWebappPath(stagingStore, this.avmBrowseBean.getWebapp());
|
||||
for (SandboxInfo sandboxInfo : sandboxInfoList )
|
||||
{
|
||||
String newlyInvitedStoreName =
|
||||
AVMConstants.buildStagingStoreName( sandboxInfo.getMainStoreName() );
|
||||
|
||||
String path =
|
||||
AVMConstants.buildStoreWebappPath( newlyInvitedStoreName,
|
||||
this.avmBrowseBean.getWebapp());
|
||||
|
||||
AVMConstants.updateVServerWebapp(path, true);
|
||||
}
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ public final class SandboxFactory
|
||||
* @param storeId The store name to create the sandbox for
|
||||
* @param managers The list of authorities who have ContentManager role in the website
|
||||
*/
|
||||
public static void createStagingSandbox(final String storeId, final List<String> managers)
|
||||
public static SandboxInfo createStagingSandbox(final String storeId, final List<String> managers)
|
||||
{
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
final AVMService avmService = services.getAVMService();
|
||||
@@ -145,6 +145,8 @@ public final class SandboxFactory
|
||||
dumpStoreProperties(avmService, stagingStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
|
||||
return new SandboxInfo( new String[] { stagingStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,8 +166,9 @@ public final class SandboxFactory
|
||||
* @param managers The list of authorities who have ContentManager role in the website
|
||||
* @param username Username of the user to create the sandbox for
|
||||
* @param role Role permission for the user
|
||||
* @return Summary information regarding the sandbox
|
||||
*/
|
||||
public static void createUserSandbox(final String storeId,
|
||||
public static SandboxInfo createUserSandbox(final String storeId,
|
||||
final List<String> managers,
|
||||
final String username,
|
||||
final String role)
|
||||
@@ -176,13 +179,15 @@ public final class SandboxFactory
|
||||
|
||||
// create the user 'main' store
|
||||
final String userStoreName = AVMConstants.buildUserMainStoreName(storeId, username);
|
||||
final String previewStoreName = AVMConstants.buildUserPreviewStoreName(storeId, username);
|
||||
|
||||
if (avmService.getStore(userStoreName) != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Not creating as store already exists: " + userStoreName);
|
||||
}
|
||||
return;
|
||||
return new SandboxInfo( new String[] { userStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
avmService.createStore(userStoreName);
|
||||
@@ -227,7 +232,6 @@ public final class SandboxFactory
|
||||
|
||||
|
||||
// create the user 'preview' store
|
||||
String previewStoreName = AVMConstants.buildUserPreviewStoreName(storeId, username);
|
||||
avmService.createStore(previewStoreName);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created user preview sandbox store: " + previewStoreName +
|
||||
@@ -275,6 +279,7 @@ public final class SandboxFactory
|
||||
dumpStoreProperties(avmService, userStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
return new SandboxInfo( new String[] { userStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +300,7 @@ public final class SandboxFactory
|
||||
* @param username Username of the user to create the sandbox for
|
||||
* @param role Role permission for the user
|
||||
*/
|
||||
public static String createWorkflowSandbox(final String storeId)
|
||||
public static SandboxInfo createWorkflowSandbox(final String storeId)
|
||||
{
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
final AVMService avmService = services.getAVMService();
|
||||
@@ -305,86 +310,86 @@ public final class SandboxFactory
|
||||
|
||||
// create the user 'main' store
|
||||
final String packageName = AVMConstants.STORE_WORKFLOW + "-" + GUID.generate();
|
||||
final String workflowMainStoreName =
|
||||
final String mainStoreName =
|
||||
AVMConstants.buildWorkflowMainStoreName(storeId, packageName);
|
||||
|
||||
avmService.createStore(workflowMainStoreName);
|
||||
avmService.createStore(mainStoreName);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created workflow sandbox store: " + workflowMainStoreName);
|
||||
logger.debug("Created workflow sandbox store: " + mainStoreName);
|
||||
|
||||
// create a layered directory pointing to 'www' in the staging area
|
||||
avmService.createLayeredDirectory(AVMConstants.buildStoreRootPath(stagingStoreName),
|
||||
workflowMainStoreName + ":/",
|
||||
mainStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(workflowMainStoreName,
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
AVMConstants.PROP_SANDBOX_WORKFLOW_MAIN,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the base name of the website so that corresponding
|
||||
// staging areas can be found.
|
||||
avmService.setStoreProperty(workflowMainStoreName,
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
AVMConstants.PROP_WEBSITE_NAME,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, storeId));
|
||||
|
||||
// tag the store, oddly enough, with its own store name for querying.
|
||||
// when will the madness end.
|
||||
avmService.setStoreProperty(workflowMainStoreName,
|
||||
QName.createQName(null, AVMConstants.PROP_SANDBOX_STORE_PREFIX + workflowMainStoreName),
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
QName.createQName(null, AVMConstants.PROP_SANDBOX_STORE_PREFIX + mainStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, workflowMainStoreName, storeId, packageName);
|
||||
tagStoreDNSPath(avmService, mainStoreName, storeId, packageName);
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(workflowMainStoreName, null, null);
|
||||
avmService.createSnapshot(mainStoreName, null, null);
|
||||
|
||||
// create the user 'preview' store
|
||||
final String workflowPreviewStoreName =
|
||||
final String previewStoreName =
|
||||
AVMConstants.buildWorkflowPreviewStoreName(storeId, packageName);
|
||||
avmService.createStore(workflowPreviewStoreName);
|
||||
avmService.createStore(previewStoreName);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created user sandbox preview store: " + workflowPreviewStoreName);
|
||||
logger.debug("Created user sandbox preview store: " + previewStoreName);
|
||||
|
||||
// create a layered directory pointing to 'www' in the user 'main' store
|
||||
avmService.createLayeredDirectory(AVMConstants.buildStoreRootPath(workflowMainStoreName),
|
||||
workflowPreviewStoreName + ":/",
|
||||
avmService.createLayeredDirectory(AVMConstants.buildStoreRootPath(mainStoreName),
|
||||
previewStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(workflowPreviewStoreName,
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
AVMConstants.PROP_SANDBOX_WORKFLOW_PREVIEW,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with its own store name for querying.
|
||||
avmService.setStoreProperty(workflowPreviewStoreName,
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
QName.createQName(null,
|
||||
AVMConstants.PROP_SANDBOX_STORE_PREFIX + workflowPreviewStoreName),
|
||||
AVMConstants.PROP_SANDBOX_STORE_PREFIX + previewStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, workflowPreviewStoreName, storeId, packageName, "preview");
|
||||
tagStoreDNSPath(avmService, previewStoreName, storeId, packageName, "preview");
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(workflowPreviewStoreName, null, null);
|
||||
avmService.createSnapshot(previewStoreName, null, null);
|
||||
|
||||
|
||||
// tag all related stores to indicate that they are part of a single sandbox
|
||||
final QName sandboxIdProp = QName.createQName(AVMConstants.PROP_SANDBOXID + GUID.generate());
|
||||
avmService.setStoreProperty(workflowMainStoreName,
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
avmService.setStoreProperty(workflowPreviewStoreName,
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(avmService, workflowMainStoreName);
|
||||
dumpStoreProperties(avmService, workflowPreviewStoreName);
|
||||
dumpStoreProperties(avmService, mainStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
return packageName;
|
||||
return new SandboxInfo( new String[] { mainStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
/**
|
||||
|
50
source/java/org/alfresco/web/bean/wcm/SandboxInfo.java
Normal file
50
source/java/org/alfresco/web/bean/wcm/SandboxInfo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Copyright 2007 Alfresco Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at:
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
*
|
||||
* Author Jon Cox <jcox@alfresco.com>
|
||||
* File SandboxInfo.java
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
/**
|
||||
* Provides information about a sandbox created by SandboxFactory.
|
||||
*/
|
||||
public final class SandboxInfo
|
||||
{
|
||||
String [] store_names_;
|
||||
public SandboxInfo(String [] store_names)
|
||||
{
|
||||
store_names_ = store_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of names of the stores within this sandbox.
|
||||
* The "main" store should come first in this list;
|
||||
* any other stores should appear in the order that
|
||||
* they are overlaid on "main" (e.g.: any "preview"
|
||||
* layers should come afterward, in "lowest first" order).
|
||||
* <p>
|
||||
* Note: all sandboxes must have a "main" layer.
|
||||
*/
|
||||
public String [] getStoreNames() { return store_names_; }
|
||||
|
||||
/**
|
||||
* The name of the "main" store within this sandbox.
|
||||
*/
|
||||
public String getMainStoreName() { return store_names_[0]; }
|
||||
}
|
Reference in New Issue
Block a user