Author: norman
Date: Fri Nov 24 08:11:42 2006
New Revision: 478904
URL: http://svn.apache.org/viewvc?view=rev&rev=478904
Log:
Get sure noone can add or remove a domain from the XMLDomainList after James is
started. This is only a workaround which can be removed later when
XMLDomainList only needs to implement DomainList
Modified:
james/server/trunk/src/java/org/apache/james/domain/XMLDomainList.java
james/server/trunk/src/java/org/apache/james/management/DomainListManagement.java
Modified: james/server/trunk/src/java/org/apache/james/domain/XMLDomainList.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/domain/XMLDomainList.java?view=diff&rev=478904&r1=478903&r2=478904
==============================================================================
--- james/server/trunk/src/java/org/apache/james/domain/XMLDomainList.java
(original)
+++ james/server/trunk/src/java/org/apache/james/domain/XMLDomainList.java Fri
Nov 24 08:11:42 2006
@@ -36,6 +36,8 @@
private List domainNames = null;
+ private boolean managementDisabled = false;
+
/**
* @see
org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
@@ -65,6 +67,10 @@
* @see org.apache.james.domain.AbstractDomainList#getDomainListInternal()
*/
protected List getDomainListInternal() {
+ // TODO: Remove temporary fix!
+ // This is set to true to get sure now new domain can get added or
removed
+ // after the domains were retrieved by James.java. See is a workaround!
+ managementDisabled = true;
return domainNames;
}
@@ -82,6 +88,9 @@
* @see
org.apache.james.domain.AbstractDomainList#addDomainInternal(java.lang.String)
*/
protected boolean addDomainInternal(String domain) {
+ // TODO: Remove later. Temporary fix to get sure no domains can be
added to the XMLDomainList
+ if (managementDisabled) throw new
UnsupportedOperationException("Management not supported");
+
if (domainNames == null) {
domainNames = new ArrayList();
}
@@ -99,6 +108,9 @@
* @see
org.apache.james.domain.AbstractDomainList#removeDomainInternal(java.lang.String)
*/
protected boolean removeDomainInternal(String domain) {
+ // TODO: Remove later. Temporary fix to get sure no domains can be
added to the XMLDomainList
+ if (managementDisabled) throw new
UnsupportedOperationException("Management not supported");
+
if (domainNames == null) return false;
return domainNames.remove(domain.toLowerCase(Locale.US));
}
Modified:
james/server/trunk/src/java/org/apache/james/management/DomainListManagement.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/DomainListManagement.java?view=diff&rev=478904&r1=478903&r2=478904
==============================================================================
---
james/server/trunk/src/java/org/apache/james/management/DomainListManagement.java
(original)
+++
james/server/trunk/src/java/org/apache/james/management/DomainListManagement.java
Fri Nov 24 08:11:42 2006
@@ -34,7 +34,7 @@
* Provide management class for DomainLists
*/
public class DomainListManagement implements
DomainListManagementService,DomainListManagementMBean,Serviceable {
- DomainList domList;
+ private DomainList domList;
/**
* @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
@@ -52,7 +52,12 @@
*/
public boolean addDomain(String domain) throws
DomainListManagementException {
if (domList instanceof ManageableDomainList) {
- return ((ManageableDomainList)domList).addDomain(domain);
+ try {
+ return ((ManageableDomainList)domList).addDomain(domain);
+ } catch (UnsupportedOperationException e) {
+ //TODO: Remove later. Temporary fix
+ throw new DomainListManagementException(e);
+ }
} else {
throw new DomainListManagementException("Used DomainList
implementation not support management");
}
@@ -63,7 +68,12 @@
*/
public boolean removeDomain(String domain) throws
DomainListManagementException {
if (domList instanceof ManageableDomainList) {
- return ((ManageableDomainList)domList).removeDomain(domain);
+ try {
+ return ((ManageableDomainList)domList).removeDomain(domain);
+ } catch (UnsupportedOperationException e) {
+ //TODO: Remove later. Temporary fix
+ throw new DomainListManagementException(e);
+ }
} else {
throw new DomainListManagementException("Used DomainList
implementation not support management");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]