diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml
index 9ed10030d4..0576ba56e9 100644
--- a/config/alfresco/action-services-context.xml
+++ b/config/alfresco/action-services-context.xml
@@ -414,37 +414,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${mail.header}
-
-
- ${mail.from.default}
-
-
- ${repo.remote.url}
+
+
+ org.alfresco.repo.action.executer.ActionExecuter
+
diff --git a/config/alfresco/application-context-core.xml b/config/alfresco/application-context-core.xml
index dfd28a0a5e..206e21dac8 100644
--- a/config/alfresco/application-context-core.xml
+++ b/config/alfresco/application-context-core.xml
@@ -16,7 +16,6 @@
-
diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index cb2a6e5bbf..4f44f493ab 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -469,6 +469,42 @@
+
+
+
+ email
+
+
+ OutboundSMTP
+
+
+
+ outbound
+
+
+
+ true
+
+
+
+
+
+
+ email
+
+
+ InboundSMTP
+
+
+
+ inbound
+
+
+
+ true
+
+
+
@@ -529,28 +565,6 @@
-
-
-
- ${email.server.enabled}
-
-
- ${email.server.domain}
-
-
- ${email.server.port}
-
-
- ${email.server.blocked.senders}
-
-
- ${email.server.allowed.senders}
-
-
-
-
-
-
diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index 55121b0fa1..7b294c7b4a 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -433,34 +433,6 @@
-
-
-
-
-
- ${mail.host}
-
-
- ${mail.port}
-
-
- ${mail.username}
-
-
- ${mail.password}
-
-
- ${mail.encoding}
-
-
-
- ${mail.smtp.auth}
- ${mail.smtp.timeout}
-
-
-
-
-
diff --git a/config/alfresco/extension/custom-email-server.sample.zip b/config/alfresco/extension/custom-email-server.sample.zip
deleted file mode 100644
index 150cc00f03..0000000000
Binary files a/config/alfresco/extension/custom-email-server.sample.zip and /dev/null differ
diff --git a/config/alfresco/network-protocol-context.xml b/config/alfresco/network-protocol-context.xml
index 604a041919..2eedd142d5 100644
--- a/config/alfresco/network-protocol-context.xml
+++ b/config/alfresco/network-protocol-context.xml
@@ -59,6 +59,7 @@
+
diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties
index 5aa3191dab..2b8e5d53fe 100644
--- a/config/alfresco/repository.properties
+++ b/config/alfresco/repository.properties
@@ -257,19 +257,6 @@ audit.cmischangelog.enabled=true
# alfresco/audit/*.xml will be used.
audit.useNewConfig=false
-# Email configuration
-mail.host=
-mail.port=25
-mail.username=anonymous
-mail.password=
-# Set this value to UTF-8 or similar for encoding of email messages as required
-mail.encoding=UTF-8
-# Set this value to 7bit or similar for Asian encoding of email headers as required
-mail.header=
-mail.from.default=alfresco@alfresco.org
-mail.smtp.auth=false
-mail.smtp.timeout=30000
-
# System Configuration
system.store=system://system
system.descriptor.childname=sys:descriptor
@@ -421,7 +408,6 @@ nfs.user.mappings.default.gid=0
# IMAP
imap.server.enabled=false
imap.server.port=143
-imap.server.host=localhost
imap.server.attachments.extraction.enabled=true
# Default IMAP mount points
diff --git a/config/alfresco/emailserver/email-service-context.xml b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml
old mode 100644
new mode 100755
similarity index 81%
rename from config/alfresco/emailserver/email-service-context.xml
rename to config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml
index d09f885219..82bd92110c
--- a/config/alfresco/emailserver/email-service-context.xml
+++ b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml
@@ -13,16 +13,28 @@
-
-
- true
+
+
+
+ ${email.server.enabled}
-
-
- classpath:alfresco/emailserver/email-server.properties
-
+
+ ${email.server.domain}
+
+
+ ${email.server.port}
+
+
+ ${email.server.blocked.senders}
+
+
+ ${email.server.allowed.senders}
+
+
+
+
diff --git a/config/alfresco/emailserver/email-server.properties b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties
old mode 100644
new mode 100755
similarity index 70%
rename from config/alfresco/emailserver/email-server.properties
rename to config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties
index e5c0528eb3..3957d20eea
--- a/config/alfresco/emailserver/email-server.properties
+++ b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties
@@ -4,10 +4,10 @@
#
email.inbound.unknownUser=anonymous
-email.inbound.enabled=false
+email.inbound.enabled=true
-email.server.enabled=false
+email.server.enabled=true
email.server.port=25
email.server.domain=alfresco.com
-email.server.allowed.senders=
+email.server.allowed.senders=.*
email.server.blocked.senders=
\ No newline at end of file
diff --git a/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP-context.xml b/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP-context.xml
new file mode 100755
index 0000000000..791e49f381
--- /dev/null
+++ b/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP-context.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+ ${mail.host}
+
+
+ ${mail.port}
+
+
+ ${mail.protocol}
+
+
+
+ ${mail.username}
+
+
+ ${mail.password}
+
+
+ ${mail.encoding}
+
+
+
+ ${mail.smtps.auth}
+ ${mail.smtps.starttls.enable}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${mail.header}
+
+
+ ${mail.from.default}
+
+
+ ${repo.remote.url}
+
+
+ ${mail.testmessage.send}
+
+
+ ${mail.testmessage.to}
+
+
+ ${mail.testmessage.subject}
+
+
+ ${mail.testmessage.text}
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP.properties b/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP.properties
new file mode 100755
index 0000000000..c4b53171f9
--- /dev/null
+++ b/config/alfresco/subsystems/email/OutboundSMTP/outboundSMTP.properties
@@ -0,0 +1,14 @@
+mail.host=smtp.alfresco.com
+mail.port=25
+mail.username=anonymous
+mail.password=
+mail.encoding=UTF-8
+mail.from.default=alfresco@demo.alfresco.org
+mail.smtp.auth=false
+mail.protocol=smtp
+
+#use these properties to send test message during start of subsystem
+mail.testmessage.send=false
+mail.testmessage.to=
+mail.testmessage.subject=Outbound SMTP
+mail.testmessage.text=The Outbound SMTP email subsystem is working.
diff --git a/config/alfresco/subsystems/fileServers/default/file-servers-context.xml b/config/alfresco/subsystems/fileServers/default/file-servers-context.xml
index 637a5de5e7..fc9cc2b8dc 100644
--- a/config/alfresco/subsystems/fileServers/default/file-servers-context.xml
+++ b/config/alfresco/subsystems/fileServers/default/file-servers-context.xml
@@ -298,6 +298,9 @@
+
+
+
${filesystem.name}
@@ -311,9 +314,6 @@
__Alfresco.url
-
- ${cifs.urlfile.prefix}
-
true
@@ -333,9 +333,6 @@
alfresco/desktop/Alfresco.exe
-
- ${cifs.urlfile.prefix}
-
diff --git a/config/alfresco/subsystems/fileServers/default/file-servers.properties b/config/alfresco/subsystems/fileServers/default/file-servers.properties
index 43a9ed64f1..2e0572a540 100644
--- a/config/alfresco/subsystems/fileServers/default/file-servers.properties
+++ b/config/alfresco/subsystems/fileServers/default/file-servers.properties
@@ -29,8 +29,6 @@ cifs.WINS.autoDetectEnabled=true
cifs.WINS.primary=1.2.3.4
cifs.WINS.secondary=5.6.7.8
-cifs.urlfile.prefix=http://${localname}:8080/alfresco/
-
# CIFS session debug flags (also enable org.alfresco.fileserver=debug logging level)
# Comma delimeted list of levels :-
# NETBIOS, STATE, RXDATA, TXDATA, DUMPDATA, NEGOTIATE, TREE, SEARCH, INFO, FILE, FILEIO, TRANSACT
diff --git a/config/alfresco/subsystems/imap/default/imap-server-context.xml b/config/alfresco/subsystems/imap/default/imap-server-context.xml
index 3e5353cddf..9ffd005107 100644
--- a/config/alfresco/subsystems/imap/default/imap-server-context.xml
+++ b/config/alfresco/subsystems/imap/default/imap-server-context.xml
@@ -13,8 +13,8 @@
-
- ${imap.server.host}
+
+
${imap.server.port}
@@ -98,6 +98,9 @@
+
+
+
@@ -118,10 +121,7 @@
- ${mail.from.default}
-
-
- ${web.application.context.url}
+ ${imap.mail.from.default}
${spaces.store}/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.imapConfig.childname}/${spaces.imap_templates.childname}
diff --git a/config/alfresco/subsystems/imap/default/imap-server.properties b/config/alfresco/subsystems/imap/default/imap-server.properties
index 0542da93e9..13ede9fd25 100644
--- a/config/alfresco/subsystems/imap/default/imap-server.properties
+++ b/config/alfresco/subsystems/imap/default/imap-server.properties
@@ -1,9 +1,8 @@
imap.server.enabled=false
-imap.server.host=localhost
imap.server.port=143
+imap.mail.from.default=alfresco@demo.alfresco.org
+
imap.config.home.store=${spaces.store}
imap.config.home.rootPath=/${spaces.company_home.childname}
imap.config.home.folderPath=Imap Home
-
-#imap.server.web.application.context.url=http://localhost:8080/alfresco
diff --git a/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter-context.xml b/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter-context.xml
index 1aef144a3d..c8b9fd53ff 100644
--- a/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter-context.xml
+++ b/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter-context.xml
@@ -13,6 +13,31 @@
${server.transaction.allow-writes}
+
+ ${alfresco.context}
+
+
+ ${alfresco.host}
+
+
+ ${alfresco.port}
+
+
+ ${alfresco.protocol}
+
+
+
+ ${share.context}
+
+
+ ${share.host}
+
+
+ ${share.port}
+
+
+ ${share.protocol}
+
diff --git a/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter.properties b/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter.properties
index c1a3b01789..92ddefa30f 100644
--- a/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter.properties
+++ b/config/alfresco/subsystems/sysAdmin/default/sysadmin-parameter.properties
@@ -1,3 +1,12 @@
server.maxusers=-1
server.allowedusers=
-server.transaction.allow-writes=true
\ No newline at end of file
+server.transaction.allow-writes=true
+alfresco.context=alfresco
+alfresco.host=${localname}
+alfresco.port=8080
+alfresco.protocol=http
+
+share.context=share
+share.host=${localname}
+share.port=8080
+share.protocol=http
diff --git a/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java b/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
index 7d2fac53df..a71cc95a88 100644
--- a/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
+++ b/source/java/org/alfresco/filesys/alfresco/AlfrescoContext.java
@@ -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
*
diff --git a/source/java/org/alfresco/filesys/alfresco/DesktopAction.java b/source/java/org/alfresco/filesys/alfresco/DesktopAction.java
index 6a1c6f06cd..bdaf963acd 100644
--- a/source/java/org/alfresco/filesys/alfresco/DesktopAction.java
+++ b/source/java/org/alfresco/filesys/alfresco/DesktopAction.java
@@ -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 + "/";
}
}
diff --git a/source/java/org/alfresco/filesys/config/GlobalDesktopActionConfigBean.java b/source/java/org/alfresco/filesys/config/GlobalDesktopActionConfigBean.java
index 57e314b22d..091f9106ce 100644
--- a/source/java/org/alfresco/filesys/config/GlobalDesktopActionConfigBean.java
+++ b/source/java/org/alfresco/filesys/config/GlobalDesktopActionConfigBean.java
@@ -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.
*
diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java
index f765e26f8a..a9390a000c 100644
--- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java
+++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver.java
@@ -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());
}
}
diff --git a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java
index 9d7ae2bcf6..0cabb60001 100644
--- a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java
+++ b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java
@@ -134,6 +134,11 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
*/
private String repoRemoteUrl = null;
+ private boolean sendTestMessage = false;
+ private String testMessageTo = null;
+ private String testMessageSubject = "Test message";
+ private String testMessageText = "This is a test message.";
+
/**
* Test mode prevents email messages from being sent.
* It is used when unit testing when we don't actually want to send out email messages.
@@ -224,6 +229,43 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
this.repoRemoteUrl = repoRemoteUrl;
}
+ public void setTestMessageTo(String testMessageTo)
+ {
+ this.testMessageTo = testMessageTo;
+ }
+
+ public void setTestMessageSubject(String testMessageSubject)
+ {
+ this.testMessageSubject = testMessageSubject;
+ }
+
+ public void setTestMessageText(String testMessageText)
+ {
+ this.testMessageText = testMessageText;
+ }
+
+ public void setSendTestMessage(boolean sendTestMessage)
+ {
+ this.sendTestMessage = sendTestMessage;
+ }
+
+
+ @Override
+ public void init()
+ {
+ super.init();
+ if (sendTestMessage)
+ {
+ Map params = new HashMap();
+ params.put(PARAM_TO, testMessageTo);
+ params.put(PARAM_SUBJECT, testMessageSubject);
+ params.put(PARAM_TEXT, testMessageText);
+
+ Action ruleAction = serviceRegistry.getActionService().createAction(NAME, params);
+ executeImpl(ruleAction, null);
+ }
+ }
+
/**
* Initialise bean
*/
@@ -363,7 +405,12 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
// set the from address
NodeRef person = personService.getPerson(authService.getCurrentUserName());
- String fromActualUser = (String)nodeService.getProperty(person, ContentModel.PROP_EMAIL);
+
+ String fromActualUser = null;
+ if (person != null)
+ {
+ fromActualUser = (String) nodeService.getProperty(person, ContentModel.PROP_EMAIL);
+ }
if( fromActualUser != null && fromActualUser.length() != 0)
{
message.setFrom(fromActualUser);
diff --git a/source/java/org/alfresco/repo/admin/SysAdminParams.java b/source/java/org/alfresco/repo/admin/SysAdminParams.java
index 9d96de2bca..fda30a2b5a 100644
--- a/source/java/org/alfresco/repo/admin/SysAdminParams.java
+++ b/source/java/org/alfresco/repo/admin/SysAdminParams.java
@@ -48,4 +48,69 @@ public interface SysAdminParams
* @return the the maximum number of users who are allowed to log in
*/
public int getMaxUsers();
+
+ /**
+ * Gets Alfresco context.
+ *
+ * @return Alfresco context
+ */
+ public String getAlfrescoContext();
+
+ /**
+ * Gets Alfresco host.
+ *
+ * @return Alfresco host
+ */
+ public String getAlfrescoHost();
+
+ /**
+ * Gets Alfresco port.
+ *
+ * @return Alfresco port
+ */
+ public int getAlfrescoPort();
+
+ /**
+ * Gets Alfresco protocole.
+ *
+ * @return Alfresco protocole
+ */
+ public String getAlfrescoProtocol();
+
+ /**
+ * Gets Share context.
+ *
+ * @return Share context
+ */
+ public String getShareContext();
+
+ /**
+ * Gets Share host.
+ *
+ * @return Share host
+ */
+ public String getShareHost();
+
+ /**
+ * Gets Share port.
+ *
+ * @return Share port
+ */
+ public int getSharePort();
+
+ /**
+ * Gets Share protocol.
+ *
+ * @return Share protocol
+ */
+ public String getShareProtocol();
+
+ /**
+ * Expands the special ${localname} token within a host name using the resolved DNS name for the local host.
+ *
+ * @param hostName
+ * the host name
+ * @return the string
+ */
+ public String subsituteHost(String hostName);
}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/admin/SysAdminParamsImpl.java b/source/java/org/alfresco/repo/admin/SysAdminParamsImpl.java
index 282d3752fc..d07641dd63 100644
--- a/source/java/org/alfresco/repo/admin/SysAdminParamsImpl.java
+++ b/source/java/org/alfresco/repo/admin/SysAdminParamsImpl.java
@@ -18,6 +18,7 @@
*/
package org.alfresco.repo.admin;
+import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
@@ -33,6 +34,12 @@ import org.springframework.context.ApplicationContextAware;
*/
public class SysAdminParamsImpl implements SysAdminParams, ApplicationContextAware, InitializingBean
{
+ /** Token name to substitute current servers DNS name or TCP/IP address into a host name **/
+ private static final String TOKEN_LOCAL_NAME = "${localname}";
+
+ /** The local server name to which the above token will expand. */
+ private final String localName;
+
/** The application context, to get license component, if installed. */
private ApplicationContext ctx;
@@ -45,6 +52,45 @@ public class SysAdminParamsImpl implements SysAdminParams, ApplicationContextAwa
/** The allow write. */
private boolean allowWrite = true;
+ /** Alfresco context. */
+ private String alfrescoContext = "alfresco";
+
+ /** Alfresco host. */
+ private String alfrescoHost = "localhost";
+
+ /** Alfresco port. */
+ private int alfrescoPort = 8080;
+
+ /** Alfresco protocol. */
+ private String alfrescoProtocol = "http";
+
+ /** Share context. */
+ private String shareContext = "alfresco";
+
+ /** Share host. */
+ private String shareHost = "localhost";
+
+ /** Share port. */
+ private int sharePort = 8080;
+
+ /** Share protocol. */
+ private String shareProtocol = "http";
+
+ public SysAdminParamsImpl()
+ {
+ // Establish the name of the local server so we can use it in token substitutions
+ String srvName = "localhost";
+ try
+ {
+ srvName = InetAddress.getLocalHost().getHostName();
+ }
+ catch (Exception ex)
+ {
+ srvName = "localhost";
+ }
+ localName = srvName;
+ }
+
/*
* (non-Javadoc)
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.
@@ -146,4 +192,95 @@ public class SysAdminParamsImpl implements SysAdminParams, ApplicationContextAwa
return this.allowWrite;
}
+ public String getAlfrescoContext()
+ {
+ return alfrescoContext;
+ }
+
+ public void setAlfrescoContext(String alfrescoContext)
+ {
+ this.alfrescoContext = alfrescoContext;
+ }
+
+ public String getAlfrescoHost()
+ {
+ return alfrescoHost;
+ }
+
+ public void setAlfrescoHost(String alfrescoHost)
+ {
+ this.alfrescoHost = subsituteHost(alfrescoHost);
+ }
+
+ public int getAlfrescoPort()
+ {
+ return alfrescoPort;
+ }
+
+ public void setAlfrescoPort(int alfrescoPort)
+ {
+ this.alfrescoPort = alfrescoPort;
+ }
+
+ public String getAlfrescoProtocol()
+ {
+ return alfrescoProtocol;
+ }
+
+ public void setAlfrescoProtocol(String alfrescoProtocol)
+ {
+ this.alfrescoProtocol = alfrescoProtocol;
+ }
+
+ public String getShareContext()
+ {
+ return shareContext;
+ }
+
+ public void setShareContext(String shareContext)
+ {
+ this.shareContext = shareContext;
+ }
+
+ public String getShareHost()
+ {
+ return shareHost;
+ }
+
+ public void setShareHost(String shareHost)
+ {
+ this.shareHost = subsituteHost(shareHost);
+ }
+
+ public int getSharePort()
+ {
+ return sharePort;
+ }
+
+ public void setSharePort(int sharePort)
+ {
+ this.sharePort = sharePort;
+ }
+
+ public String getShareProtocol()
+ {
+ return shareProtocol;
+ }
+
+ public void setShareProtocol(String shareProtocol)
+ {
+ this.shareProtocol = shareProtocol;
+ }
+
+ /**
+ * Expands the special ${localname} token within a host name using the resolved DNS name for the local host.
+ *
+ * @param hostName
+ * the host name
+ * @return the string
+ */
+ public String subsituteHost(String hostName)
+ {
+ return hostName.replace(TOKEN_LOCAL_NAME, localName);
+ }
}
diff --git a/source/java/org/alfresco/repo/imap/AlfrescoImapServer.java b/source/java/org/alfresco/repo/imap/AlfrescoImapServer.java
index a46ed8cbd8..066a33de16 100644
--- a/source/java/org/alfresco/repo/imap/AlfrescoImapServer.java
+++ b/source/java/org/alfresco/repo/imap/AlfrescoImapServer.java
@@ -19,6 +19,7 @@
package org.alfresco.repo.imap;
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
+import org.alfresco.repo.admin.SysAdminParams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationEvent;
@@ -38,15 +39,21 @@ public class AlfrescoImapServer extends AbstractLifecycleBean
private static Log logger = LogFactory.getLog(AlfrescoImapServer.class);
private ImapServer serverImpl;
+ private SysAdminParams sysAdminParams;
private int port = 143;
- private String host = "localhost";
private ImapHostManager imapHostManager;
private UserManager imapUserManager;
private boolean imapServerEnabled;
+
+ public void setSysAdminParams(SysAdminParams sysAdminParams)
+ {
+ this.sysAdminParams = sysAdminParams;
+ }
+
public void setImapServerEnabled(boolean imapServerEnabled)
{
this.imapServerEnabled = imapServerEnabled;
@@ -57,11 +64,6 @@ public class AlfrescoImapServer extends AbstractLifecycleBean
this.port = port;
}
- public void setHost(String host)
- {
- this.host = host;
- }
-
public void setImapHostManager(ImapHostManager imapHostManager)
{
this.imapHostManager = imapHostManager;
@@ -88,11 +90,13 @@ public class AlfrescoImapServer extends AbstractLifecycleBean
return imapUserManager;
}
};
- serverImpl = new ImapServer(new ServerSetup(port, host, ServerSetup.PROTOCOL_IMAP), imapManagers);
+ String currentHost = sysAdminParams.getAlfrescoHost();
+
+ serverImpl = new ImapServer(new ServerSetup(port, currentHost, ServerSetup.PROTOCOL_IMAP), imapManagers);
serverImpl.startService(null);
if (logger.isInfoEnabled())
{
- logger.info("IMAP service started on host:port " + this.host + ":" + this.port + ".");
+ logger.info("IMAP service started on host:port " + currentHost + ":" + this.port + ".");
}
}
else
diff --git a/source/java/org/alfresco/repo/imap/ImapServiceImpl.java b/source/java/org/alfresco/repo/imap/ImapServiceImpl.java
index b63a0d9340..514d65f524 100644
--- a/source/java/org/alfresco/repo/imap/ImapServiceImpl.java
+++ b/source/java/org/alfresco/repo/imap/ImapServiceImpl.java
@@ -36,6 +36,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ImapModel;
+import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.repo.imap.AlfrescoImapConst.ImapViewMode;
import org.alfresco.repo.imap.config.ImapConfigMountPointsBean;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -76,6 +77,7 @@ public class ImapServiceImpl implements ImapService
private static final String ERROR_MAILBOX_NAME_IS_MANDATORY = "imap.server.error.mailbox_name_is_mandatory";
private static final String ERROR_CANNOT_GET_A_FOLDER = "imap.server.error.cannot_get_a_folder";
+ private SysAdminParams sysAdminParams;
private FileFolderService fileFolderService;
private NodeService nodeService;
private ServiceRegistry serviceRegistry;
@@ -88,7 +90,6 @@ public class ImapServiceImpl implements ImapService
private Set ignoreExtractionFolders;
private String defaultFromAddress;
- private String webApplicationContextUrl = "http://localhost:8080/alfresco";
private String repositoryTemplatePath;
private boolean extractAttachmentsEnabled = true;
@@ -154,6 +155,11 @@ public class ImapServiceImpl implements ImapService
}
}
+ public void setSysAdminParams(SysAdminParams sysAdminParams)
+ {
+ this.sysAdminParams = sysAdminParams;
+ }
+
public FileFolderService getFileFolderService()
{
return fileFolderService;
@@ -201,12 +207,7 @@ public class ImapServiceImpl implements ImapService
public String getWebApplicationContextUrl()
{
- return webApplicationContextUrl;
- }
-
- public void setWebApplicationContextUrl(String webApplicationContextUrl)
- {
- this.webApplicationContextUrl = webApplicationContextUrl;
+ return sysAdminParams.getAlfrescoProtocol() + "://" + sysAdminParams.getAlfrescoHost() + ":" + sysAdminParams.getAlfrescoPort() + "/" + sysAdminParams.getAlfrescoContext();
}
public String getRepositoryTemplatePath()
diff --git a/source/java/org/alfresco/repo/management/subsystems/AbstractPropertyBackedBean.java b/source/java/org/alfresco/repo/management/subsystems/AbstractPropertyBackedBean.java
index b7893a7622..53e641ade1 100644
--- a/source/java/org/alfresco/repo/management/subsystems/AbstractPropertyBackedBean.java
+++ b/source/java/org/alfresco/repo/management/subsystems/AbstractPropertyBackedBean.java
@@ -61,6 +61,9 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
/** The category (first part of the ID). */
private String category;
+
+ /** The bean name if we have been initialized by Spring. */
+ private String beanName;
/** The hierarchical instance path within the category (second part of the ID). */
private List instancePath = Collections.singletonList(AbstractPropertyBackedBean.DEFAULT_INSTANCE_NAME);
@@ -120,7 +123,18 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
*/
public void setBeanName(String name)
{
- this.category = name;
+ this.beanName = name;
+ }
+
+ /**
+ * Sets the category (first part of the ID).
+ *
+ * @param category
+ * the category
+ */
+ public void setCategory(String category)
+ {
+ this.category = category;
}
/**
@@ -214,10 +228,20 @@ public abstract class AbstractPropertyBackedBean implements PropertyBackedBean,
*/
public void afterPropertiesSet() throws Exception
{
+ // Default the category to the bean name
+ if (this.category == null)
+ {
+ if (this.beanName == null)
+ {
+ throw new IllegalStateException("Category not provided");
+ }
+ this.category = this.beanName;
+ }
+
// Derive the unique ID from the category and instance path
List path = getInstancePath();
this.id = new ArrayList(path.size() + 1);
- this.id.add(getCategory());
+ this.id.add(this.category);
this.id.addAll(getInstancePath());
init();
diff --git a/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java b/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java
index 0df14fecec..46c869515e 100644
--- a/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java
+++ b/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java
@@ -178,7 +178,7 @@ public class ChildApplicationContextFactory extends AbstractPropertyBackedBean i
setApplicationContext(parent);
setRegistry(registry);
setPropertyDefaults(propertyDefaults);
- setBeanName(category);
+ setCategory(category);
setTypeName(typeName);
setInstancePath(instancePath);
diff --git a/source/java/org/alfresco/repo/management/subsystems/CompositeDataBean.java b/source/java/org/alfresco/repo/management/subsystems/CompositeDataBean.java
index b78456b0ae..7496891d5e 100644
--- a/source/java/org/alfresco/repo/management/subsystems/CompositeDataBean.java
+++ b/source/java/org/alfresco/repo/management/subsystems/CompositeDataBean.java
@@ -87,7 +87,7 @@ public class CompositeDataBean extends AbstractPropertyBackedBean
setApplicationContext(parent);
setRegistry(registry);
setPropertyDefaults(propertyDefaults);
- setBeanName(category);
+ setCategory(category);
setInstancePath(instancePath);
this.owner = owner;
this.type = type;