//hostadmiral/trunk/webapp/WEB-INF/conf/hostadmiral_config.xml.default |
---|
48,6 → 48,10 |
and can use static initializers. |
--> |
<initializations> |
<!-- Utils --> |
<initialization> |
<class>ak.hostadmiral.util.ResourceManager</class> |
</initialization> |
<!-- Core classes --> |
<initialization> |
<class>ak.hostadmiral.core.model.UserManager</class> |
56,10 → 60,6 |
<param-value>ak.hostadmiral.core.model.store.hibernate.UserHibernate</param-value> |
</init-param> |
<init-param> |
<param-name>userValidator</param-name> |
<param-value>ak.hostadmiral.core.model.UserValidatorAtDomain</param-value> |
</init-param> |
<init-param> |
<param-name>passwordStore</param-name> |
<param-value>ak.hostadmiral.core.model.PasswordStoreMd5</param-value> |
<param-value>ak.hostadmiral.core.model.PasswordStoreCrypt</param-value> |
//hostadmiral/trunk/src/ak/hostadmiral/struts/MultiPropertyMessageResources.java |
---|
1,8 → 1,14 |
package ak.hostadmiral.struts; |
import java.util.HashMap; |
import java.util.List; |
import java.util.ArrayList; |
import java.util.Iterator; |
import org.apache.struts.util.PropertyMessageResources; |
import ak.hostadmiral.util.ResourceManager; |
import ak.hostadmiral.util.ResourceAddedListener; |
/** |
* Extention of PropertyMessageResources to work with multiple |
* resource files, specified as semicolomn separated list. |
10,9 → 16,10 |
*/ |
public class MultiPropertyMessageResources |
extends PropertyMessageResources |
implements ResourceAddedListener |
{ |
private HashMap[] multiLocales; |
private String[] multiConfig; |
private List multiLocales = new ArrayList(); // List(HashMap) |
private List multiConfig = new ArrayList(); // List(String) |
public MultiPropertyMessageResources(MultiPropertyMessageResourcesFactory factory, |
String config) |
19,6 → 26,7 |
{ |
super(factory, config); |
initMultiConfig(config); |
ResourceManager.getInstance().addAddedListener(this); |
} |
public MultiPropertyMessageResources(MultiPropertyMessageResourcesFactory factory, |
26,13 → 34,14 |
{ |
super(factory, config, returnNull); |
initMultiConfig(config); |
ResourceManager.getInstance().addAddedListener(this); |
} |
protected synchronized void loadLocale(String localeKey) |
{ |
for(int i = 0; i < multiConfig.length; i++) { |
config = multiConfig[i]; |
locales = multiLocales[i]; |
for(int i = 0; i < multiConfig.size(); i++) { |
config = (String)multiConfig.get(i); |
locales = (HashMap)multiLocales.get(i); |
super.loadLocale(localeKey); |
} |
} |
39,10 → 48,24 |
protected void initMultiConfig(String cfg) |
{ |
this.multiConfig = cfg.split("\\s*;\\s*"); |
// from struts-config.xml |
String[] strs = cfg.split("\\s*;\\s*"); |
this.multiLocales = new HashMap[this.multiConfig.length]; |
for(int i = 0; i < this.multiLocales.length; i++) |
this.multiLocales[i] = new HashMap(); |
for(int i = 0; i < strs.length; i++) { |
this.multiConfig.add(strs[i]); |
this.multiLocales.add(new HashMap()); |
} |
// from resource manager |
for(Iterator i = ResourceManager.getInstance().getResources().iterator(); i.hasNext(); ) { |
this.multiConfig.add((String)i.next()); |
this.multiLocales.add(new HashMap()); |
} |
} |
public void resourceAdded(String resourceName) |
{ |
this.multiConfig.add(resourceName); |
this.multiLocales.add(new HashMap()); |
} |
} |
//hostadmiral/trunk/src/ak/hostadmiral/listener/uservalidatoratdomain/UserValidatorAtDomain.java |
---|
0,0 → 1,52 |
package ak.hostadmiral.listener.uservalidatoratdomain; |
import java.util.Map; |
import java.util.Collection; |
import java.util.Iterator; |
import ak.hostadmiral.core.model.User; |
import ak.hostadmiral.core.model.UserManager; |
import ak.hostadmiral.core.model.UserValidateListener; |
import ak.hostadmiral.core.model.InetDomain; |
import ak.hostadmiral.core.model.InetDomainManager; |
import ak.hostadmiral.util.ConfigInit; |
import ak.hostadmiral.util.ModelException; |
import ak.hostadmiral.util.ModelUserException; |
import ak.hostadmiral.util.ResourceManager; |
public class UserValidatorAtDomain |
implements |
ConfigInit, |
UserValidateListener |
{ |
public void init(Map params) |
{ |
UserManager.getInstance().addValidateListener(this); |
ResourceManager.getInstance().addResource( |
"ak.hostadmiral.listener.uservalidatoratdomain.UserValidatorAtDomainMessages"); |
} |
public void userValidate(User editor, User user, User oldUser) |
throws ModelException |
{ |
// superuser |
if(editor.isSuperuser()) return; |
// login not changed |
if(oldUser.getLogin() != null && user.getLogin().equals(oldUser.getLogin())) |
return; |
// go through all domains |
Collection domains = InetDomainManager.getInstance().listInetDomains(editor); |
for(Iterator i = domains.iterator(); i.hasNext(); ) { |
InetDomain domain = (InetDomain)i.next(); |
if(user.getLogin().endsWith("@" + domain.getName())) |
return; |
} |
// nothing found |
throw new ModelUserException( |
"ak.hostadmiral.listener.uservalidatoratdomain.login.wrong"); |
} |
} |
//hostadmiral/trunk/src/ak/hostadmiral/listener/uservalidatoratdomain/UserValidatorAtDomainMessages.properties |
---|
0,0 → 1,0 |
ak.hostadmiral.listener.uservalidatoratdomain.login.wrong=User login must be inside one of your domains, e.g. user@example.com |
//hostadmiral/trunk/src/ak/hostadmiral/core/resources/CoreMessages.properties |
---|
56,5 → 56,3 |
ak.hostadmiral.core.domain.edit.name.empty=Please enter domain name |
ak.hostadmiral.core.mail.alias.edit.id.wrong=Please select an alias from the list |
ak.hostadmiral.core.uservalidator.atdomain.login.wrong=User login must end with name of your domain, e.g. me@example.com |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidator.java |
---|
File deleted |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidatorAtDomain.java |
---|
File deleted |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserDeletedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserDeletedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserCreatedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserCreatedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserManager.java |
---|
20,6 → 20,7 |
{ |
private SystemUserStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
94,12 → 95,21 |
public void save(User editor, SystemUser systemUser) |
throws ModelException |
{ |
// security check |
if(!systemUser.editableBy(editor)) |
throw new ModelSecurityException(); |
//systemUser.setModUser(editor); // FIXME |
boolean isNew = systemUser.isNew(); |
SystemUser oldSystemUser = systemUser.getOrigin(); |
if(oldSystemUser == null) oldSystemUser = systemUser; |
//systemUser.setModUser(editor); // FIXME |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
SystemUserValidateListener listener = (SystemUserValidateListener)i.next(); |
listener.systemUserValidate(editor, systemUser, oldSystemUser); |
} |
store.save(systemUser); |
111,8 → 121,6 |
} |
} |
else { |
SystemUser oldSystemUser = systemUser.getOrigin(); |
if(oldSystemUser == null) oldSystemUser = systemUser; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
SystemUserModifiedListener listener = (SystemUserModifiedListener)i.next(); |
listener.systemUserModified(editor, systemUser, oldSystemUser); |
123,6 → 131,16 |
systemUser.resetOrigin(); |
} |
public void addValidateListener(SystemUserValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(SystemUserValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(SystemUserCreatedListener listener) |
{ |
createdListeners.add(listener); |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainDeletedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainDeletedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainCreatedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainCreatedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserModifiedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserModifiedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasManager.java |
---|
22,6 → 22,7 |
{ |
private MailAliasStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
84,12 → 85,21 |
public void save(User editor, MailAlias mailAlias) |
throws ModelException |
{ |
// security check |
if(!mailAlias.editableBy(editor)) |
throw new ModelSecurityException(); |
//mailAlias.setModUser(editor); // FIXME |
boolean isNew = mailAlias.isNew(); |
MailAlias oldMailAlias = mailAlias.getOrigin(); |
if(oldMailAlias == null) oldMailAlias = mailAlias; |
//mailAlias.setModUser(editor); // FIXME |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
MailAliasValidateListener listener = (MailAliasValidateListener)i.next(); |
listener.mailAliasValidate(editor, mailAlias, oldMailAlias); |
} |
store.save(mailAlias); |
101,8 → 111,6 |
} |
} |
else { |
MailAlias oldMailAlias = mailAlias.getOrigin(); |
if(oldMailAlias == null) oldMailAlias = mailAlias; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
MailAliasModifiedListener listener = (MailAliasModifiedListener)i.next(); |
listener.mailAliasModified(editor, mailAlias, oldMailAlias); |
113,6 → 121,16 |
mailAlias.resetOrigin(); |
} |
public void addValidateListener(MailAliasValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(MailAliasValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(MailAliasCreatedListener listener) |
{ |
createdListeners.add(listener); |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxDeletedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxDeletedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxCreatedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxCreatedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserModifiedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserModifiedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainValidateListener.java |
---|
0,0 → 1,18 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainValidateListener |
{ |
/** |
* called if domain information is about to be changed - by new or existing entry |
* |
* @param editor who is doing the operation |
* @param inetDomain the domain in its new state |
* @param oldInetDomain copy of domain as it was before the operation |
* @throws ModelException in case of any validation errors, validation will be stopped |
* by first exception |
*/ |
public void inetDomainValidate(User editor, InetDomain inetDomain, InetDomain oldInetDomain) |
throws ModelException; |
} |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserManager.java |
---|
21,9 → 21,9 |
UserDeletingListener |
{ |
private UserStore store; |
private UserValidator userValidator; |
private Class[] passwordStores; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
92,6 → 92,7 |
public void save(User editor, User user) |
throws ModelException |
{ |
// security check |
if(!user.editableBy(editor) && !user.partEditableBy(editor) |
&& !user.mayChangeSuperuser(editor)) |
{ |
98,13 → 99,18 |
throw new ModelSecurityException(); |
} |
if(userValidator != null) |
userValidator.validateUser(editor, user); |
//user.setModUser(editor); // FIXME: disabled because hb throws exception |
// if user edits itself |
boolean isNew = user.isNew(); |
User oldUser = user.getOrigin(); |
if(oldUser == null) oldUser = user; |
//user.setModUser(editor); // FIXME: disabled because hb throws exception |
// if user edits itself |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
UserValidateListener listener = (UserValidateListener)i.next(); |
listener.userValidate(editor, user, oldUser); |
} |
store.save(user); |
123,8 → 129,6 |
} |
} |
else { |
User oldUser = user.getOrigin(); |
if(oldUser == null) oldUser = user; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
UserModifiedListener listener = (UserModifiedListener)i.next(); |
listener.userModified(editor, user, oldUser); |
135,6 → 139,16 |
user.resetOrigin(); |
} |
public void addValidateListener(UserValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(UserValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(UserCreatedListener listener) |
{ |
createdListeners.add(listener); |
407,12 → 421,6 |
Class c = Class.forName(((String[])params.get("store"))[0]); |
store = (UserStore)c.newInstance(); |
String[] userValidatorName = (String[])params.get("userValidator"); |
if(userValidatorName != null) { |
Class c2 = Class.forName(userValidatorName[0]); |
userValidator = (UserValidator)c2.newInstance(); |
} |
String[] passwordStoreNames = (String[])params.get("passwordStore"); |
if(passwordStoreNames != null) { |
passwordStores = new Class[passwordStoreNames.length]; |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainDeletingListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainDeletingListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxValidateListener.java |
---|
0,0 → 1,18 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxValidateListener |
{ |
/** |
* called if mailbox information is about to be changed - by new or existing entry |
* |
* @param editor who is doing the operation |
* @param mailbox the mailbox in its new state |
* @param oldMailbox copy of mailbox as it was before the operation |
* @throws ModelException in case of any validation errors, validation will be stopped |
* by first exception |
*/ |
public void mailboxValidate(User editor, Mailbox mailbox, Mailbox oldMailbox) |
throws ModelException; |
} |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasValidateListener.java |
---|
0,0 → 1,18 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasValidateListener |
{ |
/** |
* called if mail alias information is about to be changed - by new or existing entry |
* |
* @param editor who is doing the operation |
* @param mailAlias the mail alias in its new state |
* @param oldMailAlias copy of mail alias as it was before the operation |
* @throws ModelException in case of any validation errors, validation will be stopped |
* by first exception |
*/ |
public void mailAliasValidate(User editor, MailAlias mailAlias, MailAlias oldMailAlias) |
throws ModelException; |
} |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxDeletingListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxDeletingListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDeletingListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasDeletingListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserDeletedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserDeletedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserCreatedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserCreatedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainManager.java |
---|
20,6 → 20,7 |
{ |
private InetDomainStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
78,12 → 79,21 |
public void save(User editor, InetDomain domain) |
throws ModelException |
{ |
// security check |
if(!domain.editableBy(editor)) |
throw new ModelSecurityException(); |
//domain.setModUser(editor); // FIXME |
boolean isNew = domain.isNew(); |
InetDomain oldDomain = domain.getOrigin(); |
if(oldDomain == null) oldDomain = domain; |
//domain.setModUser(editor); // FIXME |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
InetDomainValidateListener listener = (InetDomainValidateListener)i.next(); |
listener.inetDomainValidate(editor, domain, oldDomain); |
} |
store.save(domain); |
95,8 → 105,6 |
} |
} |
else { |
InetDomain oldDomain = domain.getOrigin(); |
if(oldDomain == null) oldDomain = domain; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
InetDomainModifiedListener listener = (InetDomainModifiedListener)i.next(); |
listener.inetDomainModified(editor, domain, oldDomain); |
107,6 → 115,16 |
domain.resetOrigin(); |
} |
public void addValidateListener(InetDomainValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(InetDomainValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(InetDomainCreatedListener listener) |
{ |
createdListeners.add(listener); |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxManager.java |
---|
25,6 → 25,7 |
private MailboxStore store; |
private Class[] passwordStores; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
90,12 → 91,21 |
public void save(User editor, Mailbox mailbox) |
throws ModelException |
{ |
// security check |
if(!mailbox.editableBy(editor)) |
throw new ModelSecurityException(); |
//mailbox.setModUser(editor); // FIXME |
boolean isNew = mailbox.isNew(); |
Mailbox oldMailbox = mailbox.getOrigin(); |
if(oldMailbox == null) oldMailbox = mailbox; |
//mailbox.setModUser(editor); // FIXME |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
MailboxValidateListener listener = (MailboxValidateListener)i.next(); |
listener.mailboxValidate(editor, mailbox, oldMailbox); |
} |
store.save(mailbox); |
107,8 → 117,6 |
} |
} |
else { |
Mailbox oldMailbox = mailbox.getOrigin(); |
if(oldMailbox == null) oldMailbox = mailbox; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
MailboxModifiedListener listener = (MailboxModifiedListener)i.next(); |
listener.mailboxModified(editor, mailbox, oldMailbox); |
119,6 → 127,16 |
mailbox.resetOrigin(); |
} |
public void addValidateListener(MailboxValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(MailboxValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(MailboxCreatedListener listener) |
{ |
createdListeners.add(listener); |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDeletedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasDeletedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasCreatedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasCreatedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainModifiedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainModifiedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidateListener.java |
---|
0,0 → 1,18 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface UserValidateListener |
{ |
/** |
* called if user information is about to be changed - by new or existing entry |
* |
* @param editor who is doing the operation |
* @param user the user in its new state |
* @param oldUser copy of user as it was before the operation |
* @throws ModelException in case of any validation errors, validation will be stopped |
* by first exception |
*/ |
public void userValidate(User editor, User user, User oldUser) |
throws ModelException; |
} |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/UserDeletingListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserDeletingListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxModifiedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxModifiedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasModifiedListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasModifiedListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserValidateListener.java |
---|
0,0 → 1,18 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserValidateListener |
{ |
/** |
* called if system user information is about to be changed - by new or existing entry |
* |
* @param editor who is doing the operation |
* @param systemUser the user in its new state |
* @param oldSystemUser copy of user as it was before the operation |
* @throws ModelException in case of any validation errors, validation will be stopped |
* by first exception |
*/ |
public void systemUserValidate(User editor, SystemUser systemUser, SystemUser oldSystemUser) |
throws ModelException; |
} |
//hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserDeletingListener.java |
---|
1,6 → 1,5 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserDeletingListener |
//hostadmiral/trunk/src/ak/hostadmiral/core/Locales.java |
---|
2,6 → 2,7 |
import java.util.Locale; |
// FIXME: make this list as text file or build it directly from resources |
public abstract class Locales |
{ |
private static final Locale[] locales = { |
//hostadmiral/trunk/src/ak/hostadmiral/util/ResourceAddedListener.java |
---|
0,0 → 1,6 |
package ak.hostadmiral.util; |
public interface ResourceAddedListener |
{ |
public void resourceAdded(String resourceName); |
} |
//hostadmiral/trunk/src/ak/hostadmiral/util/ResourceManager.java |
---|
0,0 → 1,44 |
package ak.hostadmiral.util; |
import java.util.Collection; |
import java.util.Collections; |
import java.util.ArrayList; |
import java.util.Iterator; |
public class ResourceManager |
{ |
private Collection resources = new ArrayList(); // Collection(String) |
private Collection addedListeners = new ArrayList(); // Collection(ResourceAddedListener) |
public void addAddedListener(ResourceAddedListener listener) |
{ |
addedListeners.add(listener); |
} |
public void removeAddedListener(ResourceAddedListener listener) |
{ |
addedListeners.remove(listener); |
} |
public Collection getResources() |
{ |
return Collections.unmodifiableCollection(resources); |
} |
public void addResource(String resourceName) |
{ |
resources.add(resourceName); |
for(Iterator i = addedListeners.iterator(); i.hasNext(); ) { |
ResourceAddedListener listener = (ResourceAddedListener)i.next(); |
listener.resourceAdded(resourceName); |
} |
} |
private static ResourceManager resourceManager = new ResourceManager(); |
public static ResourceManager getInstance() |
{ |
return resourceManager; |
} |
} |