Author: norman
Date: Sun Nov 19 13:26:44 2006
New Revision: 476928
URL: http://svn.apache.org/viewvc?view=rev&rev=476928
Log:
Add JMX support for VUT-Management. See JAMES-706
Added:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java
(with props)
Modified:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.java
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.xinfo
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
Modified:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.java?view=diff&rev=476928&r1=476927&r2=476928
==============================================================================
---
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.java
(original)
+++
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.java
Sun Nov 19 13:26:44 2006
@@ -35,8 +35,6 @@
/**
* Management for VirtualUserTables
*
- * TODO: Add JMX support
- * Add to RemoteManager
*/
public class VirtualUserTableManagement implements Serviceable,
VirtualUserTableManagementService {
@@ -67,11 +65,11 @@
* @throws VirtualUserTableManagementException if no VirtualUserTable with
the given name exists
*/
private org.apache.james.services.VirtualUserTableManagement
getTable(String tableName) throws VirtualUserTableManagementException {
- // if the tableName was null return the DefaultVirtualUserTable
- if (tableName == null) {
- return defaultVUT;
- } else {
- org.apache.james.services.VirtualUserTableManagement vut =
(org.apache.james.services.VirtualUserTableManagement)
store.getTable(tableName);
+ // if the tableName was null return the DefaultVirtualUserTable
+ if (tableName == null) {
+ return defaultVUT;
+ } else {
+ org.apache.james.services.VirtualUserTableManagement vut =
(org.apache.james.services.VirtualUserTableManagement)
store.getTable(tableName);
// Check if a table with the given name exists, if not throw an
Exception
if (vut == null) {
@@ -79,7 +77,7 @@
} else {
return vut;
}
- }
+ }
}
/**
Modified:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.xinfo
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.xinfo?view=diff&rev=476928&r1=476927&r2=476928
==============================================================================
---
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.xinfo
(original)
+++
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagement.xinfo
Sun Nov 19 13:26:44 2006
@@ -11,6 +11,11 @@
<service
name="org.apache.james.services.VirtualUserTableManagementService"
version="1.0" />
</services>
+ <!-- interfaces that may be exported to manange this block -->
+ <management-access-points>
+ <service
name="org.apache.james.management.VirtualUserTableManagmentMBean"/>
+ </management-access-points>
+
<dependencies>
<dependency>
<service name="org.apache.james.services.VirtualUserTableStore"
version="1.0"/>
Added:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java?view=auto&rev=476928
==============================================================================
---
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java
(added)
+++
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java
Sun Nov 19 13:26:44 2006
@@ -0,0 +1,162 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+
+
+package org.apache.james.management;
+
+import java.util.Collection;
+
+import org.apache.james.management.VirtualUserTableManagementException;
+import org.apache.james.vut.InvalidMappingException;
+
+/**
+ * Expose virtualusertable management functionality through JMX.
+ *
+ * @phoenix:mx-topic name="VirtualUserTableAdministration"
+ */
+public interface VirtualUserTableManagmentMBean {
+
+ /**
+ * Add regex mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Add regex mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean addRegexMapping(String virtualUserTable, String user,
String domain, String regex) throws VirtualUserTableManagementException;
+
+ /**
+ * Remove regex mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Remove regex mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean removeRegexMapping(String virtualUserTable, String
user,String domain, String regex) throws VirtualUserTableManagementException;
+
+ /***
+ * Add address mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Add address mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean addAddressMapping(String virtualUserTable, String user,
String domain, String address) throws VirtualUserTableManagementException;
+
+ /**
+ * Remove address mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Remove address mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean removeAddressMapping(String virtualUserTable, String
user,String domain, String address) throws VirtualUserTableManagementException;
+
+ /**
+ * Add error mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Add error mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean addErrorMapping(String virtualUserTable, String user,
String domain, String error) throws VirtualUserTableManagementException;
+
+ /**
+ * Remove error mapping
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Remove error mapping
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param regex the regex.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean removeErrorMapping(String virtualUserTable, String
user,String domain, String error) throws VirtualUserTableManagementException;
+
+ /**
+ * Return the explicit mapping stored for the given user and domain.
Return null
+ * if no mapping was found
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Return the explicit mapping stored for the
given user and domain. Return null
+ * if no mapping was found
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username
+ * @param domain the domain
+ * @return the collection which holds the mappings.
+ * @throws InvalidMappingException get thrown if an invalid use or domain
was given
+ */
+ public Collection getUserDomainMappings(String virtualUserTable, String
user, String domain) throws VirtualUserTableManagementException;
+
+ /**
+ * Try to identify the right method based on the prefix of the mapping and
add it.
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Try to identify the right method based on the
prefix of the mapping and add it
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param mapping the mapping.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean addMapping(String virtualUserTable, String user, String
domain, String mapping) throws VirtualUserTableManagementException;
+
+ /**
+ * Try to identify the right method based on the prefix of the mapping and
remove it.
+ * @phoenix:mx-operation
+ * @phoenix:mx-description Try to identify the right method based on the
prefix of the mapping and remove it
+ *
+ * @param virtualUserTable The virtualUserTable
+ * @param user the username. Null if no username should be used
+ * @param domain the domain. Null if no domain should be used
+ * @param mapping the mapping.
+ * @return true if successfully
+ * @throws InvalidMappingException get thrown if an invalid argument was
given
+ */
+ public boolean removeMapping(String virtualUserTable, String user, String
domain, String mapping) throws VirtualUserTableManagementException;
+}
Propchange:
james/server/trunk/src/java/org/apache/james/management/VirtualUserTableManagmentMBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java?view=diff&rev=476928&r1=476927&r2=476928
==============================================================================
---
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
(original)
+++
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
Sun Nov 19 13:26:44 2006
@@ -1515,12 +1515,12 @@
out.flush();
}
} catch (VirtualUserTableManagementException e) {
- getLogger().error("Error on removing mapping: " + e);
- out.println("Error on removing mapping: " + e);
+ getLogger().error("Error on listing mapping: " + e);
+ out.println("Error on listing mapping: " + e);
out.flush();
} catch (IllegalArgumentException e) {
- getLogger().error("Error on removing mapping: " + e);
- out.println("Error on removing mapping: " + e);
+ getLogger().error("Error on listing mapping: " + e);
+ out.println("Error on listing mapping: " + e);
out.flush();
}
return true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]