Merged DEV/BELARUS/HEAD-2010_02_10 to HEAD

19151: SAIL-298: Implemented subsystem changes.
      - We didn't remove the cifs.serverName property because it is independent of host/port/context/protocol.
   Applied following corrections
      - Removed the email 'chain'. OutboundSMTP and InboundSMTP are separate subsystems and don't need to be chained
      - Added the ability for multiple Spring-initialized subsystems to share the same category
      - No need to expose mailService outside of the OutboundSMTP subsystem as far as I can tell
      - GlobalDeskTopActionConfigBean doesn't need dependencies and no longer exposes the webpath property
      - Fixed construction of contexts in ContentDiskDriver.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19266 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-12 18:41:09 +00:00
parent 8f0ad2d96f
commit a2c2e215a8
29 changed files with 548 additions and 271 deletions

View File

@@ -18,7 +18,6 @@
*/
package org.alfresco.filesys.alfresco;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.List;
import java.util.StringTokenizer;
@@ -32,7 +31,7 @@ import org.alfresco.jlan.server.filesys.DiskInterface;
import org.alfresco.jlan.server.filesys.FileSystem;
import org.alfresco.jlan.server.filesys.SrvDiskInfo;
import org.alfresco.jlan.server.filesys.pseudo.PseudoFileInterface;
import org.alfresco.repo.admin.SysAdminParams;
/**
* Alfresco Filesystem Context Class
@@ -43,9 +42,7 @@ import org.alfresco.jlan.server.filesys.pseudo.PseudoFileInterface;
*/
public abstract class AlfrescoContext extends DiskDeviceContext
{
// Token name to substitute current servers DNS name or TCP/IP address into the webapp URL
private static final String TokenLocalName = "${localname}";
private SysAdminParams sysAdminParams;
// Debug levels
@@ -68,7 +65,6 @@ public abstract class AlfrescoContext extends DiskDeviceContext
// URL pseudo file web path prefix (server/port/webapp) and link file name
private String m_urlPathPrefix;
private String m_urlFileName;
// Pseudo file interface
@@ -103,6 +99,15 @@ public abstract class AlfrescoContext extends DiskDeviceContext
FileSystem.CaseSensitiveSearch);
}
public void setSysAdminParams(SysAdminParams sysAdminParams)
{
this.sysAdminParams = sysAdminParams;
}
public SysAdminParams getSysAdminParams()
{
return sysAdminParams;
}
public void setDisableChangeNotification(boolean disableChangeNotification)
{
@@ -303,7 +308,7 @@ public abstract class AlfrescoContext extends DiskDeviceContext
*/
public final boolean hasURLFile()
{
if ( m_urlPathPrefix != null && m_urlFileName != null)
if (m_urlFileName != null)
return true;
return false;
}
@@ -315,9 +320,9 @@ public abstract class AlfrescoContext extends DiskDeviceContext
*/
public final String getURLPrefix()
{
return m_urlPathPrefix;
return sysAdminParams.getAlfrescoProtocol() + "://" + sysAdminParams.getAlfrescoHost() + ":" + sysAdminParams.getAlfrescoPort() + "/" + sysAdminParams.getAlfrescoContext() + "/";
}
/**
* Return the URL pseudo file name
*
@@ -328,58 +333,6 @@ public abstract class AlfrescoContext extends DiskDeviceContext
return m_urlFileName;
}
/**
* Set the URL path prefix
*
* @param urlPrefix String
*/
public final void setURLPrefix(String urlPrefix)
{
m_urlPathPrefix = urlPrefix;
if ( urlPrefix != null)
{
// Make sure the web prefix has a trailing slash
if ( !urlPrefix.endsWith("/"))
urlPrefix = urlPrefix + "/";
// Check if the URL path name contains the local name token
int pos = urlPrefix.indexOf(TokenLocalName);
if (pos != -1)
{
// Get the local server name
String srvName = "localhost";
try
{
srvName = InetAddress.getLocalHost().getHostName();
}
catch ( Exception ex)
{
}
// Rebuild the host name substituting the token with the local server name
StringBuilder hostStr = new StringBuilder();
hostStr.append( urlPrefix.substring(0, pos));
hostStr.append(srvName);
pos += TokenLocalName.length();
if (pos < urlPrefix.length())
hostStr.append( urlPrefix.substring(pos));
m_urlPathPrefix = hostStr.toString();
}
enabledPseudoFileInterface();
}
}
/**
* Set the URL pseudo file name
*

View File

@@ -21,17 +21,17 @@ package org.alfresco.filesys.alfresco;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import org.springframework.extensions.config.ConfigElement;
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
import org.alfresco.jlan.server.filesys.pseudo.LocalPseudoFile;
import org.alfresco.jlan.server.filesys.pseudo.PseudoFile;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.util.ResourceFinder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;
import org.springframework.extensions.config.ConfigElement;
/**
* Desktop Action Class
@@ -86,10 +86,6 @@ public abstract class DesktopAction {
public static final int StsCommandLine = 8;
public static final int StsAuthTicket = 9;
// Token name to substitute current servers DNS name or TCP/IP address into the webapp URL
private static final String TokenLocalName = "${localname}";
// Action name
private String m_name;
@@ -443,44 +439,19 @@ public abstract class DesktopAction {
// Check if the webapp URL has been specified
SysAdminParams sysAdminParams = m_filesysContext.getSysAdminParams();
if (m_webappURL == null || m_webappURL.length() == 0)
{
m_webappURL = m_filesysContext.getGlobalDesktopActionConfig().getWebpath();
m_webappURL = m_filesysContext.getURLPrefix();
}
if ( m_webappURL != null && m_webappURL.length() > 0)
else
{
// Check if the path name contains the local name token
m_webappURL = sysAdminParams.subsituteHost(m_webappURL);
if ( !m_webappURL.endsWith("/"))
m_webappURL = m_webappURL + "/";
int pos = m_webappURL.indexOf(TokenLocalName);
if (pos != -1)
{
// Get the local server name
String srvName = "localhost";
try
{
srvName = InetAddress.getLocalHost().getHostName();
}
catch ( Exception ex)
{
}
// Rebuild the host name substituting the token with the local server name
StringBuilder hostStr = new StringBuilder();
hostStr.append(m_webappURL.substring(0, pos));
hostStr.append(srvName);
pos += TokenLocalName.length();
if (pos < m_webappURL.length())
hostStr.append(m_webappURL.substring(pos));
m_webappURL = hostStr.toString();
m_webappURL = m_webappURL + "/";
}
}

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.filesys.config;
// TODO: Auto-generated Javadoc
/**
* The Class GlobalDesktopActionConfigBean.
@@ -26,13 +27,9 @@ package org.alfresco.filesys.config;
*/
public class GlobalDesktopActionConfigBean
{
/** The no confirm. */
private boolean noConfirm;
/** The webpath. */
private String webpath;
/** The path. */
private String path;
@@ -60,27 +57,6 @@ public class GlobalDesktopActionConfigBean
this.noConfirm = noConfirm;
}
/**
* Gets the webpath.
*
* @return the webpath
*/
public String getWebpath()
{
return webpath;
}
/**
* Sets the webpath.
*
* @param webpath
* the new webpath
*/
public void setWebpath(String webpath)
{
this.webpath = webpath;
}
/**
* Gets the path.
*

View File

@@ -26,7 +26,6 @@ import java.util.List;
import javax.transaction.UserTransaction;
import org.springframework.extensions.config.ConfigElement;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
@@ -66,12 +65,12 @@ import org.alfresco.jlan.smb.server.SMBServer;
import org.alfresco.jlan.smb.server.SMBSrvSession;
import org.alfresco.jlan.util.WildCard;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationContext;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
@@ -87,6 +86,7 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.config.ConfigElement;
/**
* Content repository filesystem driver class
@@ -121,6 +121,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
private AuthenticationContext authContext;
private AuthenticationService authService;
private SysAdminParams sysAdminParams;
// Node monitor factory
@@ -296,6 +297,17 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
{
this.authService = authService;
}
/**
* Sets the sys admin params.
*
* @param sysAdminParams
* the sys admin params
*/
public void setSysAdminParams(SysAdminParams sysAdminParams)
{
this.sysAdminParams = sysAdminParams;
}
/**
* Set the file folder service
@@ -375,6 +387,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
context.setDeviceName(shareName);
context.setStoreName(storeValue);
context.setRootPath(rootPath);
context.setSysAdminParams(this.sysAdminParams);
// Check if a relative path has been specified
@@ -403,12 +416,10 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// Get the pseudo file name and web prefix path
ConfigElement pseudoName = urlFileElem.getChild( "filename");
ConfigElement webPath = urlFileElem.getChild( "webpath");
if ( pseudoName != null && webPath != null)
if ( pseudoName != null)
{
context.setURLFileName(pseudoName.getValue());
context.setURLPrefix(webPath.getValue());
}
}