mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
The highlights of this checkin are: o No need to manually remove virt server work dir anymore o Now contents of work dir are virtualized in addition to the jars in memory. Starts / reloads faster, plus a lot more scalable. o You can create users & invite them to web project, delete their sandboxe, etc. Works. o Virt server picks up new web projects properly even when these projects were created after the virt server was started. Not done: o Need to play the same game with classes dirs that I'm doing with lib dirs. Should be easy now. o Some cleanup is needed in the way that sandboxes are destroyed. Works, but on the brittle side. Not urgent. o Because of problems with RMI auth, you still need to startup the alfreco webapp before the virt server, and if one poops out, the auth code does not recover that well yet. Britt & I will have to deal with this over the next few days. Gory details: root/projects/catalina-virtual/config/server.xml Turned off autoDeploy entirely. Now all reloading is explicit via JMX Put the request dumper valve into a comment. It's for debugging purposes only (and slows stuff down). root/projects/catalina-virtual/source/java/org/alfresco/catalina/host/AVMHost.java Cleaned up api a bit. root/projects/catalina-virtual/source/java/org/alfresco/catalina/host/AVMHostConfig.java Recursive reload of webapps. root/projects/catalina-virtual/source/java/org/alfresco/catalina/loader/AVMWebappLoader.java Recursive reload of webapps. root/projects/catalina-virtual/source/java/org/alfresco/catalina/valve/AVMUrlValve.java Cleaned up & refactoring root/projects/catalina-virtual/source/java/org/alfresco/mbeans/VirtServerRegistrationThread.java Using new api from AVMFileDirContext root/projects/jndi-client/source/java/org/alfresco/jndi/AVMFileDirContext.java Cleaned up api, made non-fatal log messages 'debug' rather than 'info'. root/projects/web-client/source/java/org/alfresco/web/bean/wcm/AVMConstants.java Added new constant. This file needs to be refactored soon. root/projects/web-client/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java Moved virt server notification to doPostCommitProcessing root/projects/web-client/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java Fixed notification of virt server. root/projects/web-client/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java Moved virt server notification to doPostCommitProcessing root/projects/web-client/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java Moved virt server notification to doPostCommitProcessing root/projects/web-client/source/java/org/alfresco/web/bean/wcm/SandboxFactory.java Added new property to sandboxes to make recursive reload efficient. root/projects/web-client/source/java/org/alfresco/web/forms/ServletContextFormDataFunctionsAdapter.java Now uses new AVMFileDirContext api. Removed System.err.prinln() statements. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4839 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
146 lines
4.5 KiB
Java
146 lines
4.5 KiB
Java
/*
|
|
* Copyright (C) 2005 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.
|
|
*/
|
|
package org.alfresco.web.bean.wcm;
|
|
|
|
import java.io.File;
|
|
import java.io.Serializable;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
|
import org.alfresco.service.cmr.avm.AVMService;
|
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
|
import org.alfresco.web.bean.content.AddContentDialog;
|
|
|
|
/**
|
|
* Add/upload content dialog for AVM browse screens.
|
|
*
|
|
* @author Kevin Roast
|
|
*/
|
|
public class AddAvmContentDialog extends AddContentDialog
|
|
{
|
|
/** The AVMService bean reference */
|
|
protected AVMService avmService;
|
|
|
|
/** AVM Browse Bean reference */
|
|
protected AVMBrowseBean avmBrowseBean;
|
|
|
|
/** */
|
|
protected String path;
|
|
|
|
|
|
/**
|
|
* @param avmService The AVMService to set.
|
|
*/
|
|
public void setAvmService(AVMService avmService)
|
|
{
|
|
this.avmService = avmService;
|
|
}
|
|
|
|
/**
|
|
* @param avmBrowseBean The AVMBrowseBean to set.
|
|
*/
|
|
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
|
{
|
|
this.avmBrowseBean = avmBrowseBean;
|
|
}
|
|
|
|
/**
|
|
* Save the specified content using the currently set wizard attributes
|
|
*
|
|
* @param fileContent File content to save
|
|
* @param strContent String content to save
|
|
*/
|
|
protected void saveContent(File fileContent, String strContent) throws Exception
|
|
{
|
|
// get the AVM path that will contain the content
|
|
String parent = this.avmBrowseBean.getCurrentPath();
|
|
|
|
// create the file
|
|
this.avmService.createFile(parent, this.fileName);
|
|
this.path = parent + '/' + this.fileName;
|
|
NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path);
|
|
|
|
if (logger.isDebugEnabled())
|
|
logger.debug("Created AVM file: " + this.path);
|
|
|
|
// apply the titled aspect - title and description
|
|
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(2, 1.0f);
|
|
titledProps.put(ContentModel.PROP_TITLE, this.title);
|
|
titledProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
|
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
|
|
|
// get a writer for the content and put the file
|
|
ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
|
|
writer.setMimetype(this.mimeType);
|
|
writer.setEncoding("UTF-8");
|
|
if (fileContent != null)
|
|
{
|
|
writer.putContent(fileContent);
|
|
}
|
|
else
|
|
{
|
|
writer.putContent(strContent == null ? "" : strContent);
|
|
}
|
|
|
|
// remember the created node now
|
|
this.createdNode = fileNodeRef;
|
|
}
|
|
|
|
/**
|
|
* @see org.alfresco.web.bean.content.AddContentDialog#doPostCommitProcessing(javax.faces.context.FacesContext, java.lang.String)
|
|
*/
|
|
@Override
|
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
|
{
|
|
clearUpload();
|
|
|
|
// Notify virtualization server
|
|
//
|
|
// This must be done in doPostCommitProcessing so that the notification
|
|
// can only be received by the virtualization server *after* the content
|
|
// update transaction within the AVM has completed. Otherwise, there's
|
|
// a race condition that can cause the virtualization server to not be
|
|
// able to read the new (or modified) web.xml file within the virtual
|
|
// webapps being relaoded via the call to updateVServerWebapp.
|
|
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Reloading virtualisation server on path: " + this.path);
|
|
}
|
|
|
|
AVMConstants.updateVServerWebapp(this.path, false);
|
|
|
|
return outcome;
|
|
}
|
|
|
|
/**
|
|
* @see org.alfresco.web.bean.content.AddContentDialog#getDefaultFinishOutcome()
|
|
*/
|
|
@Override
|
|
protected String getDefaultFinishOutcome()
|
|
{
|
|
return "cancel";
|
|
}
|
|
}
|