Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1013 → Rev 1014

/hostadmiral/trunk/build.xml
75,6 → 75,20
<fileset dir="${classes}" />
</copy>
 
<!-- set build number -->
<exec executable="svnversion" logError="true" outputproperty="svn.revision">
<arg value="-n" />
<arg path="." />
</exec>
<copy todir="${classes.deploy}" overwrite="true">
<fileset dir="${src}">
<include name="ak/hostadmiral/version" />
</fileset>
<filterset>
<filter token="BUILD" value="${svn.revision}"/>
</filterset>
</copy>
 
<copy todir="${classes.deploy}">
<fileset
dir="${classes}"
/hostadmiral/trunk/webapp/generalError.jsp
23,6 → 23,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.generalError.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/index.jsp
48,6 → 48,10
/ <core:country />
</logic:notEmpty>
</p>
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
/hostadmiral/trunk/webapp/mail/box/list.jsp
79,6 → 79,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.mail.box.list.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/box/edit.jsp
1,4 → 1,4
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
104,6 → 104,11
 
</html:form>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/box/view.jsp
99,6 → 99,11
</tr>
</table>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/alias/edit.jsp
163,6 → 163,11
</html:form>
<script>loadForm();</script>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/alias/editdests.jsp
160,6 → 160,11
</html:form>
<script>loadForm();</script>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/alias/view.jsp
38,6 → 38,11
</tr>
</table>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/mail/alias/list.jsp
84,6 → 84,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.mail.alias.list.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/error.jsp
31,6 → 31,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.error.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/system/login.jsp
64,6 → 64,11
 
<html:javascript formName="LoginForm" />
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/system/logout.jsp
34,6 → 34,11
 
<backpath:backlink><bean:message key="ak.hostadmiral.page.system.logout.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/deleting.jsp
1,4 → 1,4
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.*,ak.hostadmiral.core.model.*" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
52,6 → 52,11
<backpath:currentlink action="<%= (String)request.getAttribute("action") %>" paramId="id" paramName="object" paramProperty="id"><bean:message key="ak.hostadmiral.page.deleting.delete" /></backpath:currentlink>
<backpath:backlink><bean:message key="ak.hostadmiral.page.deleting.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/WEB-INF/web.xml
85,7 → 85,6
<param-name>UserCreatedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
92,7 → 91,6
<param-name>UserModifiedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
99,7 → 97,6
<param-name>UserDeletedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
106,7 → 103,6
<param-name>InetDomainCreatedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
113,7 → 109,6
<param-name>InetDomainModifiedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
120,7 → 115,6
<param-name>InetDomainDeletedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
127,7 → 121,6
<param-name>SystemUserCreatedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
134,7 → 127,6
<param-name>SystemUserModifiedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
141,7 → 133,6
<param-name>SystemUserDeletedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
148,7 → 139,6
<param-name>MailboxCreatedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
155,7 → 145,6
<param-name>MailboxModifiedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
162,7 → 151,6
<param-name>MailboxDeletedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
169,7 → 157,6
<param-name>MailAliasCreatedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
176,7 → 163,6
<param-name>MailAliasModifiedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<init-param>
183,7 → 169,6
<param-name>MailAliasDeletedListener</param-name>
<param-value>
ak.hostadmiral.core.listener.dummy.DummyListener;
ak.hostadmiral.core.listener.file.FileListener;
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
/hostadmiral/trunk/webapp/WEB-INF/struts-config.xml
163,11 → 163,16
 
<action
path="/system/login"
forward="/system/login.jsp" />
type="ak.hostadmiral.core.action.LoginAction"
parameter="show"
>
<forward name="default" path="/system/login.jsp" />
</action>
 
<action
path="/system/login/submit"
type="ak.hostadmiral.core.action.LoginAction"
parameter="submit"
name="LoginForm"
validate="true"
scope="request"
/hostadmiral/trunk/webapp/domain/edit.jsp
64,6 → 64,11
 
</html:form>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/domain/view.jsp
59,6 → 59,11
</tr>
</table>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/domain/list.jsp
77,6 → 77,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.domain.list.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/partedit.jsp
96,6 → 96,11
<backpath:link action="/user/logins" paramId="id" paramName="u" paramProperty="id"><bean:message key="ak.hostadmiral.page.user.partedit.logins" /></backpath:link>
</p>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/failedLogins.jsp
57,6 → 57,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.user.failedLogins.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/edit.jsp
95,6 → 95,9
<td colspan=2>
<html:submit><bean:message key="ak.hostadmiral.page.user.edit.submit" /></html:submit>
<backpath:backlink><bean:message key="ak.hostadmiral.page.user.edit.back" /></backpath:backlink>
<logic:notEmpty name="u" property="id">
<backpath:link action="/user/logins" paramId="id" paramName="u" paramProperty="id"><bean:message key="ak.hostadmiral.page.user.edit.logins" /></backpath:link>
</logic:notEmpty>
</td>
</tr>
</table>
102,7 → 105,8
</html:form>
 
<p>
<backpath:link action="/user/logins" paramId="id" paramName="u" paramProperty="id"><bean:message key="ak.hostadmiral.page.user.edit.logins" /></backpath:link>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
/hostadmiral/trunk/webapp/user/password/change.jsp
67,6 → 67,11
</table>
</html:form>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/system/edit.jsp
68,6 → 68,11
 
</html:form>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/system/view.jsp
70,6 → 70,11
</tr>
</table>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/system/list.jsp
86,6 → 86,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.user.system.list.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/view.jsp
81,6 → 81,11
<backpath:link action="/user/logins" paramId="id" paramName="u" paramProperty="id"><bean:message key="ak.hostadmiral.page.user.view.logins" /></backpath:link>
</p>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/list.jsp
1,4 → 1,4
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
97,6 → 97,11
</logic:equal>
<backpath:backlink><bean:message key="ak.hostadmiral.page.user.list.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/webapp/user/logins.jsp
55,6 → 55,11
<br>
<backpath:backlink><bean:message key="ak.hostadmiral.page.user.logins.back" /></backpath:backlink>
 
<p>
<bean:message key="ak.hostadmiral.page.general.version" />:
<bean:write name="projectVersion" />
</p>
 
</body>
 
</html>
/hostadmiral/trunk/src/ak/hostadmiral/util/ProjectVersion.java
0,0 → 1,180
package ak.hostadmiral.util;
 
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
 
/**
* Project version holder. Understands version from resource ak/hostadmiral/version
* in format ${Major}.${Minor}-rc${ReleaseCanditat}.${Build}${Additional},
* where ${ReleaseCanditat}, ${Build} and ${Additional} are optional.
* ${Additional} contains letters only.
* Instead of "-rc${ReleaseCanditat}" "-p${Patch}" may exist.
* E.g. 1.2-rc4.1234, 2.0, 2.1.4567M, 3.3-p1.
*/
public class ProjectVersion
{
private static boolean initialized = false;
private static String version = null;
private static int major = -1;
private static int minor = -1;
private static int rcandidat = -1;
private static int patch = -1;
private static int build = -1;
private static String additional = null;
 
private static void init()
{
synchronized(ProjectVersion.class) {
// in this method not exceptions are expected,
// so throw an runtime exception if any problems
 
if(initialized) return;
 
try {
// get class loader
ClassLoader cl = ProjectVersion.class.getClassLoader();
if(cl == null) cl = ClassLoader.getSystemClassLoader();
if(cl == null)
throw new RuntimeException("Cannot get class loader, something is really wrong");
 
// load
InputStream in = cl.getResourceAsStream("ak/hostadmiral/version");
if(in == null)
throw new RuntimeException("Cannot get project version, resource not found");
 
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
version = reader.readLine();
 
if(version == null || version.equals(""))
throw new RuntimeException("Cannot get project version, it's empty");
 
// parse
parse(version);
}
catch(IOException ex) {
throw new RuntimeException("Cannot get project version: " + ex.getMessage());
}
 
initialized = true;
}
}
 
private static void parse(String v)
{
Pattern pattern = Pattern.compile(
"^(\\d+)\\.(\\d+)((-rc(\\d+))|(-p(\\d+)))?(\\.(\\d+))?([a-zA-Z]*)$");
Matcher matcher = pattern.matcher(v);
if(!matcher.matches())
throw new RuntimeException(
"Cannot get project version, it doesn't match pattern: [" + v + "]");
 
major = Integer.parseInt(matcher.group(1));
minor = Integer.parseInt(matcher.group(2));
 
if(matcher.group(4) == null)
rcandidat = -1;
else
rcandidat = Integer.parseInt(matcher.group(5));
 
if(matcher.group(6) == null)
patch = -1;
else
patch = Integer.parseInt(matcher.group(7));
 
if(matcher.group(8) == null)
build = -1;
else
build = Integer.parseInt(matcher.group(9));
 
additional = matcher.group(10);
}
 
public static String getVersion()
{
init();
return version;
}
 
public static int getMajor()
{
init();
return major;
}
 
public static int getMinor()
{
init();
return minor;
}
 
public static int getRCandidat()
{
init();
return rcandidat;
}
 
public static int getPatch()
{
init();
return patch;
}
 
public static int getBuild()
{
init();
return build;
}
 
public static String getAdditional()
{
init();
return additional;
}
 
public static boolean sufficient(int major_)
{
return (major >= major_);
}
 
public static boolean sufficient(int major_, int minor_)
{
return (major > major_) || (major == major_) && (minor >= minor_);
}
 
public static boolean sufficient(int major_, int minor_, int patch_)
{
return (major > major_) || (major == major_) && (minor > minor_)
|| (major == major_) && (minor == minor_) && (patch >= patch_);
}
 
private static String formString()
{
return ("" + major + "." + minor
+ (rcandidat >= 0 ? "-rc" + rcandidat : "")
+ (patch >= 0 ? "-p" + patch : "")
+ (build >= 0 ? "." + build : "") + additional);
}
 
private static void testParse(String v)
{
parse(v);
System.out.println("test: [" + v + "] [" + formString() + "]");
}
 
/**
* internal tests
*/
public static void main(String[] args)
throws Exception
{
System.out.println("Current version is: [" + getVersion() + "] [" + formString() + "]");
testParse("1.2-rc4.1234");
testParse("2.0");
testParse("2.1.4567M");
testParse("3.3-p1");
}
}
/hostadmiral/trunk/src/ak/hostadmiral/version
0,0 → 1,0
0.1.@BUILD@
/hostadmiral/trunk/src/ak/hostadmiral/core/action/SystemUserAction.java
37,6 → 37,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("submit".equals(mapping.getParameter())) {
User user = (User)request.getSession().getAttribute("user");
initUserList(request, user);
47,6 → 48,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
 
if("list".equals(mapping.getParameter())) {
/hostadmiral/trunk/src/ak/hostadmiral/core/action/IndexAction.java
8,6 → 8,7
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
 
import ak.hostadmiral.util.ProjectVersion;
import ak.hostadmiral.core.model.User;
import ak.hostadmiral.core.model.SystemUserManager;
import ak.hostadmiral.core.model.InetDomainManager;
21,6 → 22,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
 
request.setAttribute("showSystemUsers",
/hostadmiral/trunk/src/ak/hostadmiral/core/action/InetDomainAction.java
37,6 → 37,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("submit".equals(mapping.getParameter())) {
User user = (User)request.getSession().getAttribute("user");
initUserList(request, user);
47,6 → 48,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
 
if("list".equals(mapping.getParameter())) {
/hostadmiral/trunk/src/ak/hostadmiral/core/action/ChangePasswordAction.java
25,6 → 25,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("first".equals(mapping.getParameter())) {
return mapping.findForward("default");
}
/hostadmiral/trunk/src/ak/hostadmiral/core/action/LoginAction.java
26,32 → 26,41
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
DynaActionForm theForm = (DynaActionForm)form;
ActionUtils.prepare(request, response);
 
User user = UserManager.getInstance().loginUser(
(String)theForm.get("login"), (String)theForm.get("password"), request.getRemoteAddr());
if("show".equals(mapping.getParameter())) {
return mapping.findForward("default");
}
else if("submit".equals(mapping.getParameter())) {
DynaActionForm theForm = (DynaActionForm)form;
User user = UserManager.getInstance().loginUser((String)theForm.get("login"),
(String)theForm.get("password"), request.getRemoteAddr());
 
if(user == null) {
Thread.sleep(1000); // FIXME: make this delay configurable
if(user == null) {
Thread.sleep(1000); // FIXME: make this delay configurable
 
ActionErrors errors = new ActionErrors();
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionError(CoreResources.LOGIN_FAILED));
saveErrors(request, errors);
return mapping.getInputForward();
}
else {
request.getSession().setAttribute("user", user);
request.getSession().setAttribute(Globals.LOCALE_KEY, user.getLocale());
ActionErrors errors = new ActionErrors();
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionError(CoreResources.LOGIN_FAILED));
saveErrors(request, errors);
return mapping.getInputForward();
}
else {
request.getSession().setAttribute("user", user);
request.getSession().setAttribute(Globals.LOCALE_KEY, user.getLocale());
 
String origin = BackPath.findBackPath(request).getBackwardUrl();
if(origin == null || origin.length() <= 0) {
return mapping.findForward("default");
String origin = BackPath.findBackPath(request).getBackwardUrl();
if(origin == null || origin.length() <= 0) {
return mapping.findForward("default");
}
else {
response.sendRedirect(origin);
return null;
}
}
else {
response.sendRedirect(origin);
return null;
}
}
else {
throw new Exception("unknown mapping parameter");
}
}
}
/hostadmiral/trunk/src/ak/hostadmiral/core/action/LogoutAction.java
19,6 → 19,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if(request.getSession() != null)
request.getSession().invalidate();
 
/hostadmiral/trunk/src/ak/hostadmiral/core/action/UserLoginsAction.java
24,6 → 24,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
 
DynaActionForm theForm = (DynaActionForm)form;
/hostadmiral/trunk/src/ak/hostadmiral/core/action/MailboxAction.java
39,6 → 39,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("submit".equals(mapping.getParameter())) {
User user = (User)request.getSession().getAttribute("user");
initLists(request, user);
49,6 → 50,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
if("list".equals(mapping.getParameter())) {
List list = new ArrayList(MailboxManager.getInstance().listMailboxes(user));
/hostadmiral/trunk/src/ak/hostadmiral/core/action/MailAliasAction.java
46,6 → 46,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("submit".equals(mapping.getParameter())) {
User user = (User)request.getSession().getAttribute("user");
initLists(request, user);
56,6 → 57,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
if("list".equals(mapping.getParameter())) {
List list = new ArrayList(MailAliasManager.getInstance().listMailAliases(user));
/hostadmiral/trunk/src/ak/hostadmiral/core/action/UserAction.java
35,6 → 35,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
if("submit".equals(mapping.getParameter())) {
User user = (User)request.getSession().getAttribute("user");
initUserList(request, user);
63,6 → 64,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
 
if("list".equals(mapping.getParameter())) {
/hostadmiral/trunk/src/ak/hostadmiral/core/action/FailedLoginsAction.java
24,6 → 24,7
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ActionUtils.prepare(request, response);
User user = (User)request.getSession().getAttribute("user");
List logins = new ArrayList(UserManager.getInstance().listFailedLogins(user));
 
/hostadmiral/trunk/src/ak/hostadmiral/core/action/ActionUtils.java
0,0 → 1,16
package ak.hostadmiral.core.action;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import ak.hostadmiral.util.ProjectVersion;
 
public final class ActionUtils
{
public static void prepare(HttpServletRequest request, HttpServletResponse response)
throws Exception
{
System.out.println("SET VERSION");
request.setAttribute("projectVersion", ProjectVersion.getVersion());
}
}
/hostadmiral/trunk/src/ak/hostadmiral/core/CoreResources.properties
58,6 → 58,7
ak.hostadmiral.core.mail.alias.edit.id.wrong=Please select an alias from the list
 
ak.hostadmiral.page.general.errors=There are errors in you input
ak.hostadmiral.page.general.version=Project version
 
ak.hostadmiral.page.error.title=Host Admiral - error
ak.hostadmiral.page.error.back=back
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserDeletingListener.java
0,0 → 1,18
package ak.hostadmiral.core.model;
 
import java.util.Collection;
import ak.hostadmiral.util.ModelException;
 
public interface SystemUserDeletingListener
{
/**
* called just before some system user is deleted.
*
* @param editor who is doing the operation
* @param systemUser the system user is being deleting
* @throws ModelException in case of any errors, no action should be done
* until this moment in other classes
*/
public void systemUserDeleting(User editor, SystemUser systemUser)
throws ModelException;
}
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserManager.java
8,7 → 8,9
import ak.hostadmiral.util.ModelSecurityException;
 
public class UserManager
implements UserBeforeDeleteListener
implements
UserBeforeDeleteListener,
UserDeletingListener
{
private static UserManager userManager = null;
private static boolean registered = false;
25,7 → 27,7
 
registered = true;
try {
/*
/* FIMXE: do the same for all classes
HibernateUtil.getConfiguration().addResource(
"ak/hostadmiral/core/model/User.hbm.xml");
HibernateUtil.getConfiguration().addResource(
47,6 → 49,7
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
private Collection beforeDeleteListeners = new ArrayList();
private Collection deletingListeners = new ArrayList();
private Collection deletedListeners = new ArrayList();
private Map loggedinUsers = new WeakHashMap();
 
53,6 → 56,7
private UserManager()
{
addBeforeDeleteListener(this);
addDeletingListener(this);
}
 
public User create(User editor)
218,6 → 222,16
deletedListeners.remove(listener);
}
 
public void addDeletingListener(UserDeletingListener listener)
{
deletingListeners.add(listener);
}
 
public void removeDeletingListener(UserDeletingListener listener)
{
deletingListeners.remove(listener);
}
 
public Collection beforeDelete(User editor, User user, Collection known)
throws ModelException
{
240,6 → 254,12
if(!user.deleteableBy(editor))
throw new ModelSecurityException();
 
// inform deleting listeners
for(Iterator i = deletingListeners.iterator(); i.hasNext(); ) {
UserDeletingListener listener = (UserDeletingListener)i.next();
listener.userDeleting(editor, user);
}
 
// backup copy
User oldUser = new User(user);
 
251,7 → 271,7
throw new ModelException(ex);
}
 
// inform listeners
// inform delete listeners
for(Iterator i = deletedListeners.iterator(); i.hasNext(); ) {
UserDeletedListener listener = (UserDeletedListener)i.next();
listener.userDeleted(editor, oldUser);
373,6 → 393,25
return cascade;
}
 
public void userDeleting(User editor, User user)
throws ModelException
{
Collection subusers;
 
try {
subusers = HibernateUtil.currentSession().find(
"from User where boss = ?",
user, Hibernate.entity(User.class) );
}
catch(HibernateException ex) {
throw new ModelException(ex);
}
 
for(Iterator i = subusers.iterator(); i.hasNext(); ) {
delete(editor, (User)i.next());
}
}
 
public static final Comparator LOGIN_COMPARATOR = new LoginComparator();
public static final Comparator LOGINS_TIME_COMPARATOR = new LoginsTimeComparator();
 
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxDeletingListener.java
0,0 → 1,18
package ak.hostadmiral.core.model;
 
import java.util.Collection;
import ak.hostadmiral.util.ModelException;
 
public interface MailboxDeletingListener
{
/**
* called just before some mailbox is deleted.
*
* @param editor who is doing the operation
* @param mailbox the mailbox is being deleting
* @throws ModelException in case of any errors, no action should be done
* until this moment in other classes
*/
public void mailboxDeleting(User editor, Mailbox mailbox)
throws ModelException;
}
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDeletingListener.java
0,0 → 1,18
package ak.hostadmiral.core.model;
 
import java.util.Collection;
import ak.hostadmiral.util.ModelException;
 
public interface MailAliasDeletingListener
{
/**
* called just before some mail alias is deleted.
*
* @param editor who is doing the operation
* @param mailAlias the mail alias is being deleting
* @throws ModelException in case of any errors, no action should be done
* until this moment in other classes
*/
public void mailAliasDeleting(User editor, MailAlias mailAlias)
throws ModelException;
}
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainManager.java
8,7 → 8,9
import ak.hostadmiral.util.ModelSecurityException;
 
public class InetDomainManager
implements UserBeforeDeleteListener
implements
UserBeforeDeleteListener,
UserDeletingListener
{
private static InetDomainManager inetDomainManager = null;
private static boolean registered = false;
44,11 → 46,13
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
private Collection beforeDeleteListeners = new ArrayList();
private Collection deletingListeners = new ArrayList();
private Collection deletedListeners = new ArrayList();
 
private InetDomainManager()
{
UserManager.getInstance().addBeforeDeleteListener(this);
UserManager.getInstance().addDeletingListener(this);
}
 
public InetDomain create(User editor)
190,6 → 194,16
beforeDeleteListeners.remove(listener);
}
 
public void addDeletingListener(InetDomainDeletingListener listener)
{
deletingListeners.add(listener);
}
 
public void removeDeletingListener(InetDomainDeletingListener listener)
{
deletingListeners.remove(listener);
}
 
public void addDeletedListener(InetDomainDeletedListener listener)
{
deletedListeners.add(listener);
222,6 → 236,12
if(!domain.deleteableBy(editor))
throw new ModelSecurityException();
 
// inform deleting listeners
for(Iterator i = deletingListeners.iterator(); i.hasNext(); ) {
InetDomainDeletingListener listener = (InetDomainDeletingListener)i.next();
listener.inetDomainDeleting(editor, domain);
}
 
// backup copy
InetDomain oldDomain = new InetDomain(domain);
 
235,7 → 255,7
throw new ModelException(ex);
}
 
// inform listeners
// inform deleted listeners
for(Iterator i = deletedListeners.iterator(); i.hasNext(); ) {
InetDomainDeletedListener listener = (InetDomainDeletedListener)i.next();
listener.inetDomainDeleted(editor, oldDomain);
309,6 → 329,26
return cascade;
}
 
public void userDeleting(User editor, User user)
throws ModelException
{
Collection domains;
 
try {
domains = HibernateUtil.currentSession().find(
"from InetDomain where owner = ?",
user, Hibernate.entity(User.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = domains.iterator(); i.hasNext(); ) {
delete(editor, (InetDomain)i.next());
}
}
 
public static final Comparator NAME_COMPARATOR = new NameComparator();
 
private static class NameComparator
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasManager.java
8,7 → 8,11
import ak.hostadmiral.util.ModelSecurityException;
 
public class MailAliasManager
implements UserBeforeDeleteListener
implements
UserBeforeDeleteListener,
UserDeletingListener,
InetDomainBeforeDeleteListener,
InetDomainDeletingListener
{
private static MailAliasManager mailAliasManager = null;
private static boolean registered = false;
45,6 → 49,7
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
private Collection beforeDeleteListeners = new ArrayList();
private Collection deletingListeners = new ArrayList();
private Collection deletedListeners = new ArrayList();
 
private MailAliasManager()
197,6 → 202,16
beforeDeleteListeners.remove(listener);
}
 
public void addDeletingListener(MailAliasDeletingListener listener)
{
deletingListeners.add(listener);
}
 
public void removeDeletingListener(MailAliasDeletingListener listener)
{
deletingListeners.remove(listener);
}
 
public void addDeletedListener(MailAliasDeletedListener listener)
{
deletedListeners.add(listener);
229,6 → 244,12
if(!mailAlias.deleteableBy(editor))
throw new ModelSecurityException();
 
// inform deleting listeners
for(Iterator i = deletingListeners.iterator(); i.hasNext(); ) {
MailAliasDeletingListener listener = (MailAliasDeletingListener)i.next();
listener.mailAliasDeleting(editor, mailAlias);
}
 
// backup copy
MailAlias oldMailAlias = new MailAlias(mailAlias);
 
241,7 → 262,7
throw new ModelException(ex);
}
 
// inform listeners
// inform deleted listeners
for(Iterator i = deletedListeners.iterator(); i.hasNext(); ) {
MailAliasDeletedListener listener = (MailAliasDeletedListener)i.next();
listener.mailAliasDeleted(editor, oldMailAlias);
309,6 → 330,64
return iterateBeforeDelete(editor, mailAliases, known);
}
 
public void userDeleting(User editor, User user)
throws ModelException
{
Collection mailAliases;
 
try {
mailAliases = HibernateUtil.currentSession().find(
"from MailAlias where owner = ?",
user, Hibernate.entity(User.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = mailAliases.iterator(); i.hasNext(); ) {
delete(editor, (MailAlias)i.next());
}
}
 
public Collection inetDomainBeforeDelete(User editor, InetDomain domain, Collection known)
throws ModelException
{
Collection mailAliases;
 
try {
mailAliases = HibernateUtil.currentSession().find(
"from MailAlias where domain = ?",
domain, Hibernate.entity(InetDomain.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
return iterateBeforeDelete(editor, mailAliases, known);
}
 
public void inetDomainDeleting(User editor, InetDomain domain)
throws ModelException
{
Collection mailAliases;
 
try {
mailAliases = HibernateUtil.currentSession().find(
"from MailAlias where domain = ?",
domain, Hibernate.entity(InetDomain.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = mailAliases.iterator(); i.hasNext(); ) {
delete(editor, (MailAlias)i.next());
}
}
 
private Collection iterateBeforeDelete(User editor, Collection mailAliases, Collection known)
throws ModelException
{
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainDeletingListener.java
0,0 → 1,18
package ak.hostadmiral.core.model;
 
import java.util.Collection;
import ak.hostadmiral.util.ModelException;
 
public interface InetDomainDeletingListener
{
/**
* called just before some domain is deleted.
*
* @param editor who is doing the operation
* @param domain the domain is being deleting
* @throws ModelException in case of any errors, no action should be done
* until this moment in other classes
*/
public void inetDomainDeleting(User editor, InetDomain domain)
throws ModelException;
}
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserManager.java
8,7 → 8,9
import ak.hostadmiral.util.ModelSecurityException;
 
public class SystemUserManager
implements UserBeforeDeleteListener
implements
UserBeforeDeleteListener,
UserDeletingListener
{
private static SystemUserManager systemUserManager = null;
private static boolean registered = false;
44,6 → 46,7
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
private Collection beforeDeleteListeners = new ArrayList();
private Collection deletingListeners = new ArrayList();
private Collection deletedListeners = new ArrayList();
 
private SystemUserManager()
229,6 → 232,16
beforeDeleteListeners.remove(listener);
}
 
public void addDeletingListener(SystemUserDeletingListener listener)
{
deletingListeners.add(listener);
}
 
public void removeDeletingListener(SystemUserDeletingListener listener)
{
deletingListeners.remove(listener);
}
 
public void addDeletedListener(SystemUserDeletedListener listener)
{
deletedListeners.add(listener);
261,6 → 274,12
if(!systemUser.deleteableBy(editor))
throw new ModelSecurityException();
 
// inform deleting listeners
for(Iterator i = deletingListeners.iterator(); i.hasNext(); ) {
SystemUserDeletingListener listener = (SystemUserDeletingListener)i.next();
listener.systemUserDeleting(editor, systemUser);
}
 
// backup copy
SystemUser oldSystemUser = new SystemUser(systemUser);
 
273,7 → 292,7
throw new ModelException(ex);
}
 
// inform listeners
// inform deleted listeners
for(Iterator i = deletedListeners.iterator(); i.hasNext(); ) {
SystemUserDeletedListener listener = (SystemUserDeletedListener)i.next();
listener.systemUserDeleted(editor, oldSystemUser);
350,6 → 369,26
return cascade;
}
 
public void userDeleting(User editor, User user)
throws ModelException
{
Collection systemUsers;
 
try {
systemUsers = HibernateUtil.currentSession().find(
"from SystemUser where owner = ?",
user, Hibernate.entity(User.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = systemUsers.iterator(); i.hasNext(); ) {
delete(editor, (SystemUser)i.next());
}
}
 
public static final Comparator UID_COMPARATOR = new UidComparator();
public static final Comparator NAME_COMPARATOR = new NameComparator();
 
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxManager.java
10,8 → 10,11
public class MailboxManager
implements
UserBeforeDeleteListener,
UserDeletingListener,
SystemUserBeforeDeleteListener,
InetDomainBeforeDeleteListener
SystemUserDeletingListener,
InetDomainBeforeDeleteListener,
InetDomainDeletingListener
{
private static MailboxManager mailboxManager = null;
private static boolean registered = false;
47,6 → 50,7
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
private Collection beforeDeleteListeners = new ArrayList();
private Collection deletingListeners = new ArrayList();
private Collection deletedListeners = new ArrayList();
 
private MailboxManager()
199,6 → 203,16
beforeDeleteListeners.remove(listener);
}
 
public void addDeletingListener(MailboxDeletingListener listener)
{
deletingListeners.add(listener);
}
 
public void removeDeletingListener(MailboxDeletingListener listener)
{
deletingListeners.remove(listener);
}
 
public void addDeletedListener(MailboxDeletedListener listener)
{
deletedListeners.add(listener);
231,6 → 245,12
if(!mailbox.deleteableBy(editor))
throw new ModelSecurityException();
 
// inform deleting listeners
for(Iterator i = deletingListeners.iterator(); i.hasNext(); ) {
MailboxDeletingListener listener = (MailboxDeletingListener)i.next();
listener.mailboxDeleting(editor, mailbox);
}
 
// backup copy
Mailbox oldMailbox = new Mailbox(mailbox);
 
243,7 → 263,7
throw new ModelException(ex);
}
 
// inform listeners
// inform deleted listeners
for(Iterator i = deletedListeners.iterator(); i.hasNext(); ) {
MailboxDeletedListener listener = (MailboxDeletedListener)i.next();
listener.mailboxDeleted(editor, oldMailbox);
311,6 → 331,26
return iterateBeforeDelete(editor, mailboxes, known);
}
 
public void userDeleting(User editor, User user)
throws ModelException
{
Collection mailboxes;
 
try {
mailboxes = HibernateUtil.currentSession().find(
"from Mailbox where owner = ?",
user, Hibernate.entity(User.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = mailboxes.iterator(); i.hasNext(); ) {
delete(editor, (Mailbox)i.next());
}
}
 
public Collection inetDomainBeforeDelete(User editor, InetDomain domain, Collection known)
throws ModelException
{
329,6 → 369,26
return iterateBeforeDelete(editor, mailboxes, known);
}
 
public void inetDomainDeleting(User editor, InetDomain domain)
throws ModelException
{
Collection mailboxes;
 
try {
mailboxes = HibernateUtil.currentSession().find(
"from Mailbox where domain = ?",
domain, Hibernate.entity(InetDomain.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = mailboxes.iterator(); i.hasNext(); ) {
delete(editor, (Mailbox)i.next());
}
}
 
public Collection systemUserBeforeDelete(User editor, SystemUser user, Collection known)
throws ModelException
{
347,6 → 407,26
return iterateBeforeDelete(editor, mailboxes, known);
}
 
public void systemUserDeleting(User editor, SystemUser user)
throws ModelException
{
Collection mailboxes;
 
try {
mailboxes = HibernateUtil.currentSession().find(
"from Mailbox where systemUser = ?",
user, Hibernate.entity(SystemUser.class) );
}
catch(HibernateException ex)
{
throw new ModelException(ex);
}
 
for(Iterator i = mailboxes.iterator(); i.hasNext(); ) {
delete(editor, (Mailbox)i.next());
}
}
 
private Collection iterateBeforeDelete(User editor, Collection mailboxes, Collection known)
throws ModelException
{
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserDeletingListener.java
0,0 → 1,18
package ak.hostadmiral.core.model;
 
import java.util.Collection;
import ak.hostadmiral.util.ModelException;
 
public interface UserDeletingListener
{
/**
* called just before some user is deleted.
*
* @param editor who is doing the operation
* @param user the user is being deleting
* @throws ModelException in case of any errors, no action should be done
* until this moment in other classes
*/
public void userDeleting(User editor, User user)
throws ModelException;
}