You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by em...@apache.org on 2014/07/04 00:58:03 UTC

svn commit: r1607764 [6/7] - in /james/bond/trunk/src: main/java/org/apache/james/bond/ main/java/org/apache/james/bond/client/ main/java/org/apache/james/bond/client/configure/ main/java/org/apache/james/bond/client/configure/dns/ main/java/org/apache...

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.bond.server.configure.lmtp;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class LmtpLocator extends Locator<Lmtp, Void> {
+
+  @Override
+  public Lmtp create(Class<? extends Lmtp> clazz) {
+    return new Lmtp();
+  }
+
+  @Override
+  public Lmtp find(Class<? extends Lmtp> clazz, Void id) {
+    return null;
+  }
+
+  @Override
+  public Class<Lmtp> getDomainType() {
+    return Lmtp.class;
+  }
+
+  @Override
+  public Void getId(Lmtp domainObject) {
+    return null;
+  }
+
+  @Override
+  public Class<Void> getIdType() {
+    return null;
+  }
+
+  @Override
+  public Object getVersion(Lmtp domainObject) {
+    return domainObject.getVersion();
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpService.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpService.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpService.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpService.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.bond.server.configure.lmtp;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+/**
+ * It defines the services that the RequestFactory offers to access the LMTP
+ * configuration
+ */
+public class LmtpService {
+  private static LmtpEditor lmtpEditor = new LmtpEditor();
+
+  /**
+   * It retrieves the Lmtp Configuration data
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static Lmtp getAllLmtpData() throws Exception {
+    return lmtpEditor.readProtocol();
+  }
+
+  /**
+   * It saves the LMTP configuration
+   * 
+   * @param lmtp
+   * @throws ConfigurationException
+   */
+  public void persist(Lmtp lmtp) throws ConfigurationException {
+    lmtpEditor.writeProtocol(lmtp);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/lmtp/LmtpServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.configure.lmtp;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class LmtpServiceLocator implements ServiceLocator {
+  private static LmtpService serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return LmtpServiceLocator.getServiceInstance();
+  }
+
+  private static LmtpService getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new LmtpService();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.bond.server.configure.pop3;
+
+import org.apache.james.bond.server.configure.BaseProtocol;
+
+/**
+ * Class that describes all the properties to configure a POP3 protocol
+ */
+public class Pop3 extends BaseProtocol {
+  public Pop3() {
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Editor.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Editor.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Editor.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Editor.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.bond.server.configure.pop3;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.james.bond.server.configure.BaseProtocol;
+import org.apache.james.bond.server.configure.BaseProtocolEditor;
+import org.apache.james.bond.shared.BondConst;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
+/**
+ * It access to the Pop3 configuration file and saves the Pop3 protocol
+ * properties using {@link XmlConfiguration}
+ */
+public class Pop3Editor extends BaseProtocolEditor {
+
+  private static final String pop3XmlName = BondConst.NAME_TEMPL_POP3;
+  private static final String POP3SERVER = "pop3server(0)";
+
+  /**
+   * Creates a new {@link Pop3Editor} to read and update the POP3 configuration
+   */
+  public Pop3Editor() {
+    super(POP3SERVER, pop3XmlName);
+  }
+
+  /**
+   * It reads the Pop3 protocol information of the xml configuration file and
+   * retrieves it
+   * 
+   * @return the Pop3 protocol information
+   * @throws Exception
+   */
+  public Pop3 readProtocol() throws Exception {
+    return (Pop3) this.readProtocol(new Pop3());
+  }
+
+  /**
+   * It saves the Pop3 protocol, both the general and the specific properties,
+   * on the xml configuration file
+   * 
+   * @param pop3
+   *          the pop3 with all the information to be saved
+   * @throws ConfigurationException
+   */
+  public void writeProtocol(Pop3 pop3) throws ConfigurationException {
+    super.writeProtocol(pop3);
+  }
+
+  @Override
+  protected void readSpecificProperties(XMLConfiguration config,
+      BaseProtocol protocol) {
+  }
+
+  @Override
+  protected void addSpecificProperties(XMLConfiguration config,
+      BaseProtocol protocol) {
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Locator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Locator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Locator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Locator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.bond.server.configure.pop3;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class Pop3Locator extends Locator<Pop3, Void> {
+
+  @Override
+  public Pop3 create(Class<? extends Pop3> clazz) {
+    return new Pop3();
+  }
+
+  @Override
+  public Pop3 find(Class<? extends Pop3> clazz, Void id) {
+    return null;
+  }
+
+  @Override
+  public Class<Pop3> getDomainType() {
+    return Pop3.class;
+  }
+
+  @Override
+  public Void getId(Pop3 domainObject) {
+    return null;
+  }
+
+  @Override
+  public Class<Void> getIdType() {
+    return null;
+  }
+
+  @Override
+  public Object getVersion(Pop3 domainObject) {
+    return domainObject.getVersion();
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Service.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Service.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Service.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3Service.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.bond.server.configure.pop3;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+/**
+ * It defines the services that the RequestFactory offers to access the Pop3
+ * configuration
+ */
+public class Pop3Service {
+  private static Pop3Editor pop3Editor = new Pop3Editor();
+
+  /**
+   * It retrieves the Pop3 Configuration data
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static Pop3 getAllPop3Data() throws Exception {
+    return pop3Editor.readProtocol();
+  }
+
+  /**
+   * It saves the Pop3 configuration
+   * 
+   * @param pop3
+   * @throws ConfigurationException
+   */
+  public void persist(Pop3 pop3) throws ConfigurationException {
+    pop3Editor.writeProtocol(pop3);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3ServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3ServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3ServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/pop3/Pop3ServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.configure.pop3;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class Pop3ServiceLocator implements ServiceLocator {
+  private static Pop3Service serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return Pop3ServiceLocator.getServiceInstance();
+  }
+
+  private static Pop3Service getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new Pop3Service();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/Smtp.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/Smtp.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/Smtp.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/Smtp.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,103 @@
+/****************************************************************
+ * 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.bond.server.configure.smtp;
+
+import javax.validation.constraints.Min;
+
+import org.apache.james.bond.server.configure.BaseProtocol;
+
+/**
+ * Class that describes all the properties to configure a SMTP protocol
+ */
+public class Smtp extends BaseProtocol {
+  private String authRequired;
+  private boolean verifyIdentity;
+  @Min(value = 0, message = "Maximum message size must be a positive integer")
+  private String maximumMessageSize;
+  private boolean heloEhloEnforcement;
+  private boolean addrBracketsEnforcement;
+  private String greeting;
+  private String authorizedAddresses; // TODO not sure if this is a list
+  private String tlsAlgorithm;
+
+  public String getAuthRequired() {
+    return authRequired;
+  }
+
+  public void setAuthRequired(String authRequired) {
+    this.authRequired = authRequired;
+  }
+
+  public boolean isVerifyIdentity() {
+    return verifyIdentity;
+  }
+
+  public void setVerifyIdentity(boolean verifyIdentity) {
+    this.verifyIdentity = verifyIdentity;
+  }
+
+  public String getMaximumMessageSize() {
+    return maximumMessageSize;
+  }
+
+  public void setMaximumMessageSize(String maximumMessageSize) {
+    this.maximumMessageSize = maximumMessageSize;
+  }
+
+  public boolean isHeloEhloEnforcement() {
+    return heloEhloEnforcement;
+  }
+
+  public void setHeloEhloEnforcement(boolean heloEhloEnforcement) {
+    this.heloEhloEnforcement = heloEhloEnforcement;
+  }
+
+  public boolean isAddrBracketsEnforcement() {
+    return addrBracketsEnforcement;
+  }
+
+  public void setAddrBracketsEnforcement(boolean addrBracketsEnforcement) {
+    this.addrBracketsEnforcement = addrBracketsEnforcement;
+  }
+
+  public String getGreeting() {
+    return greeting;
+  }
+
+  public void setGreeting(String greeting) {
+    this.greeting = greeting;
+  }
+
+  public String getAuthorizedAddresses() {
+    return authorizedAddresses;
+  }
+
+  public void setAuthorizedAddresses(String authorizedAddresses) {
+    this.authorizedAddresses = authorizedAddresses;
+  }
+
+  public String getTlsAlgorithm() {
+    return tlsAlgorithm;
+  }
+
+  public void setTlsAlgorithm(String tlsAlgorithm) {
+    this.tlsAlgorithm = tlsAlgorithm;
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpEditor.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpEditor.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpEditor.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpEditor.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,115 @@
+/****************************************************************
+ * 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.bond.server.configure.smtp;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.james.bond.server.configure.BaseProtocol;
+import org.apache.james.bond.server.configure.BaseProtocolEditor;
+import org.apache.james.bond.shared.BondConst;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
+/**
+ * It access to the Smtp configuration file and saves the Smtp protocol
+ * properties using {@link XmlConfiguration}
+ */
+public class SmtpEditor extends BaseProtocolEditor {
+  private static final String smtpXmlName = BondConst.NAME_TEMPL_SMTP;
+  private static final String SMTP_SERVER = "smtpserver(0)";
+
+  private final String AUTH_REQUIRED;
+  private final String VERIFY_IDENTITY;
+  private final String MAX_MESSAGE_SIZE;;
+  private final String HELO_EHLO_ENFORCEMENT;
+  private final String ADDR_BRACKETS_ENFORCEMENT;
+  private final String SMTP_GREETING;
+  private final String AUTHORIZED_ADDRESSES;
+  private final String TLS_ALGORITHM;
+
+  /**
+   * Creates a new {@link SmtpEditor} to read and update the SMTP configuration
+   */
+  public SmtpEditor() {
+    super(SMTP_SERVER, smtpXmlName);
+
+    AUTH_REQUIRED = SMTP_SERVER + ".authRequired";
+    VERIFY_IDENTITY = SMTP_SERVER + ".verifyIdentity";
+    MAX_MESSAGE_SIZE = SMTP_SERVER + ".maxmessagesize";
+    HELO_EHLO_ENFORCEMENT = SMTP_SERVER + ".heloEhloEnforcement";
+    ADDR_BRACKETS_ENFORCEMENT = SMTP_SERVER + ".addressBracketsEnforcement";
+    SMTP_GREETING = SMTP_SERVER + ".smtpGreeting";
+    AUTHORIZED_ADDRESSES = SMTP_SERVER + ".authorizedAddresses";
+    TLS_ALGORITHM = SMTP_SERVER + ".tls.algorithm";
+  }
+
+  /**
+   * It reads the Smtp protocol information of the xml configuration file and
+   * retrieves it
+   * 
+   * @return the Smtp protocol information
+   * @throws Exception
+   */
+  public Smtp readProtocol() throws Exception {
+    return (Smtp) this.readProtocol(new Smtp());
+  }
+
+  @Override
+  protected void readSpecificProperties(XMLConfiguration config,
+      BaseProtocol protocol) {
+    Smtp smtp = (Smtp) protocol;
+
+    smtp.setAuthRequired(config.getString(AUTH_REQUIRED, "false"));
+    smtp.setVerifyIdentity(config.getBoolean(VERIFY_IDENTITY, true));
+    smtp.setMaximumMessageSize(config.getString(MAX_MESSAGE_SIZE, "0"));
+    smtp.setHeloEhloEnforcement(config.getBoolean(HELO_EHLO_ENFORCEMENT, true));
+    smtp.setAddrBracketsEnforcement(config.getBoolean(
+        ADDR_BRACKETS_ENFORCEMENT, true));
+    smtp.setGreeting(config.getString(SMTP_GREETING));
+    smtp.setAuthorizedAddresses(config.getString(AUTHORIZED_ADDRESSES));
+    smtp.setTlsAlgorithm(config.getString(TLS_ALGORITHM));
+  }
+
+  /**
+   * It saves the Smtp protocol, both the general and the specific properties,
+   * on the xml configuration file
+   * 
+   * @param smtp
+   *          the smtp with all the information to be saved
+   * @throws ConfigurationException
+   */
+  public void writeProtocol(Smtp smtp) throws ConfigurationException {
+    super.writeProtocol(smtp);
+  }
+
+  @Override
+  protected void addSpecificProperties(XMLConfiguration config,
+      BaseProtocol protocol) {
+    Smtp smtp = (Smtp) protocol;
+
+    config.setProperty(AUTH_REQUIRED, smtp.getAuthRequired());
+    config.setProperty(VERIFY_IDENTITY, smtp.isVerifyIdentity());
+    config.setProperty(MAX_MESSAGE_SIZE, smtp.getMaximumMessageSize());
+    config.setProperty(HELO_EHLO_ENFORCEMENT, smtp.isHeloEhloEnforcement());
+    config.setProperty(ADDR_BRACKETS_ENFORCEMENT,
+        smtp.isAddrBracketsEnforcement());
+    config.setProperty(SMTP_GREETING, smtp.getGreeting());
+    config.setProperty(AUTHORIZED_ADDRESSES, smtp.getAuthorizedAddresses());
+    config.setProperty(TLS_ALGORITHM, smtp.getTlsAlgorithm());
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.bond.server.configure.smtp;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class SmtpLocator extends Locator<Smtp, Void> {
+
+  @Override
+  public Smtp create(Class<? extends Smtp> clazz) {
+    return new Smtp();
+  }
+
+  @Override
+  public Smtp find(Class<? extends Smtp> clazz, Void id) {
+    return null;
+  }
+
+  @Override
+  public Class<Smtp> getDomainType() {
+    return Smtp.class;
+  }
+
+  @Override
+  public Void getId(Smtp domainObject) {
+    return null;
+  }
+
+  @Override
+  public Class<Void> getIdType() {
+    return null;
+  }
+
+  @Override
+  public Object getVersion(Smtp domainObject) {
+    return domainObject.getVersion();
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpService.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpService.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpService.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpService.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.bond.server.configure.smtp;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+/**
+ * It defines the services that the RequestFactory offers to access the SMTP
+ * configuration
+ */
+public class SmtpService {
+  private static SmtpEditor smtpEditor = new SmtpEditor();
+
+  /**
+   * It retrieves the Smtp Configuration data
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static Smtp getAllSmtpData() throws Exception {
+    return smtpEditor.readProtocol();
+  }
+
+  /**
+   * It saves the Smtp configuration
+   * 
+   * @param smtp
+   * @throws ConfigurationException
+   */
+  public void persist(Smtp smtp) throws ConfigurationException {
+    smtpEditor.writeProtocol(smtp);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/configure/smtp/SmtpServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.configure.smtp;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class SmtpServiceLocator implements ServiceLocator {
+  private static SmtpService serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return SmtpServiceLocator.getServiceInstance();
+  }
+
+  private static SmtpService getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new SmtpService();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/Domain.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/Domain.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/Domain.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/Domain.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,72 @@
+/****************************************************************
+ * 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.bond.server.manage.domain;
+
+/**
+ * It represents a domain of the server
+ */
+public class Domain {
+  private Integer version;
+  private String domain;
+
+  public Domain() {
+  }
+
+  public Domain(String domain) {
+    this.domain = domain;
+  }
+
+  public String getId() {
+    return domain;
+  }
+
+  public Integer getVersion() {
+    if (version == null)
+      version = 0;
+    return version;
+  }
+
+  public void setId(String id) {
+    this.domain = id;
+  }
+
+  public void setVersion(Integer version) {
+    this.version = version;
+  }
+
+  public String getDomain() {
+    return domain;
+  }
+
+  public void setDomain(String domain) {
+    this.domain = domain;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj == null)
+      return false;
+    if (obj == this)
+      return true;
+    if (!(obj instanceof Domain))
+      return false;
+    Domain domainObj = (Domain) obj;
+    return this.getId().equals(domainObj.getId());
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainCache.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainCache.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainCache.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainCache.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,120 @@
+/****************************************************************
+ * 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.bond.server.manage.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import org.apache.james.bond.server.JamesConnector;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+
+/**
+ * This keeps a cache of the domains from the James server
+ */
+public class DomainCache {
+
+  private static LoadingCache<String, Domain> domainsCache;
+  final static int MAXIMUM_SIZE = 1000;
+
+  static {
+    domainsCache = CacheBuilder.newBuilder().maximumSize(MAXIMUM_SIZE)
+        .build(new CacheLoader<String, Domain>() {
+
+          @Override
+          public Map<String, Domain> loadAll(Iterable<? extends String> keys)
+              throws Exception {
+            return JamesConnector.mapDomains();
+          }
+
+          @Override
+          public Domain load(String key) throws Exception {
+            Map<String, Domain> map = this.loadAll(null);
+            return map.get(key);
+          }
+        });
+    try {
+      List<Domain> domainsList = JamesConnector.listDomains();
+      for (Domain domain : domainsList)
+        domainsCache.put(domain.getId(), domain);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+
+  /**
+   * It returns the Domain with the id.
+   * 
+   * @param id
+   * @return
+   * @throws ExecutionException
+   */
+  public Domain get(String id) throws ExecutionException {
+    return domainsCache.getIfPresent(id);
+  }
+
+  /**
+   * It retrieves all the domains from the cache
+   * 
+   * @return
+   * @throws ExecutionException
+   */
+  public List<Domain> listDomains() throws ExecutionException {
+    List<Domain> domainsList = new ArrayList<Domain>(domainsCache.asMap()
+        .values());
+    return domainsList;
+  }
+
+  /**
+   * It adds the new domain in both the cache and the server
+   * 
+   * @param domain
+   * @throws Exception
+   */
+  public void addDomain(Domain domain) throws Exception {
+    try {
+      domainsCache.put(domain.getId(), domain);
+      JamesConnector.addDomain(domain);
+    } catch (Exception e) {
+      e.printStackTrace();
+      domainsCache.invalidate(domain.getId());
+      throw e;
+    }
+  }
+
+  /**
+   * It removes the domain from both the cache and the server
+   * 
+   * @param domain
+   * @throws Exception
+   */
+  public void removeDomain(Domain domain) throws Exception {
+    try {
+      JamesConnector.removeDomain(domain);
+      domainsCache.invalidate(domain.getId());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,61 @@
+/****************************************************************
+ * 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.bond.server.manage.domain;
+
+import java.util.concurrent.ExecutionException;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class DomainLocator extends Locator<Domain, String> {
+	private DomainCache domainsCache = new DomainCache();
+
+	@Override
+	public Class<Domain> getDomainType() {
+		return Domain.class;
+	}
+
+	@Override
+	public Class<String> getIdType() {
+		return String.class;
+	}
+
+	@Override
+	public Domain create(Class<? extends Domain> clazz) {
+		return new Domain();
+	}
+
+	@Override
+	public Domain find(Class<? extends Domain> clazz, String id) {
+		try {
+			return domainsCache.get(id);
+		} catch (ExecutionException e) {
+			return null;
+		}
+	}
+
+	@Override
+	public String getId(Domain domainObject) {
+		return domainObject.getId();
+	}
+
+	@Override
+	public Object getVersion(Domain domainObject) {
+		return domainObject.getVersion();
+	}
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainService.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainService.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainService.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainService.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,58 @@
+/****************************************************************
+ * 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.bond.server.manage.domain;
+
+import java.util.List;
+
+/**
+ * It defines the services that the RequestFactory offers to access the Domains
+ */
+public class DomainService {
+  private static DomainCache domainCache = new DomainCache();
+
+  /**
+   * It retrieves all the domains from the cache
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static List<Domain> listDomains() throws Exception {
+    return domainCache.listDomains();
+  }
+
+  /**
+   * It saves a new domain
+   * 
+   * @param domain
+   * @throws Exception
+   */
+  public void persist(Domain domain) throws Exception {
+    domainCache.addDomain(domain);
+  }
+
+  /**
+   * It removes the domain
+   * 
+   * @param domain
+   * @throws Exception
+   */
+  public void remove(Domain domain) throws Exception {
+    domainCache.removeDomain(domain);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/domain/DomainServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.manage.domain;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class DomainServiceLocator implements ServiceLocator {
+  private static DomainService serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return DomainServiceLocator.getServiceInstance();
+  }
+
+  private static DomainService getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new DomainService();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/Mapping.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/Mapping.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/Mapping.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/Mapping.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,72 @@
+package org.apache.james.bond.server.manage.mappings;
+
+import java.util.Set;
+
+/**
+ * It contains all the mapping for a concrete user and domain.
+ */
+public class Mapping {
+  private String userAndDomain;
+  private Set<String> mappings;
+  private Integer version;
+
+  public Mapping() {
+  }
+
+  /**
+   * Creates the mapping with the user and domain received and all the mappings
+   * 
+   * @param userAndDomain
+   * @param mappings
+   */
+  public Mapping(String userAndDomain, Set<String> mappings) {
+    this.userAndDomain = userAndDomain;
+    this.setMappings(mappings);
+  }
+
+  public String getId() {
+    return userAndDomain;
+  }
+
+  public Integer getVersion() {
+    if (version == null)
+      version = 0;
+    return version;
+  }
+
+  public void setId(String id) {
+    this.userAndDomain = id;
+  }
+
+  public void setVersion(Integer version) {
+    this.version = version;
+  }
+
+  public String getUserAndDomain() {
+    return userAndDomain;
+  }
+
+  public void setUserAndDomain(String userAndDomain) {
+    this.userAndDomain = userAndDomain;
+  }
+
+  public Set<String> getMappings() {
+    return mappings;
+  }
+
+  public void setMappings(Set<String> mappings) {
+    this.mappings = mappings;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj == null)
+      return false;
+    if (obj == this)
+      return true;
+    if (!(obj instanceof Mapping))
+      return false;
+    Mapping mappingObj = (Mapping) obj;
+    return this.getId().equals(mappingObj.getId());
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,55 @@
+/****************************************************************
+ * 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.bond.server.manage.mappings;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class MappingLocator extends Locator<Mapping, String> {
+  @Override
+  public Class<Mapping> getDomainType() {
+    return Mapping.class;
+  }
+
+  @Override
+  public Class<String> getIdType() {
+    return String.class;
+  }
+
+  @Override
+  public Mapping create(Class<? extends Mapping> clazz) {
+    return new Mapping();
+  }
+
+  @Override
+  public Mapping find(Class<? extends Mapping> clazz, String id) {
+    // TODO
+    return null;
+
+  }
+
+  @Override
+  public String getId(Mapping mappingObject) {
+    return mappingObject.getId();
+  }
+
+  @Override
+  public Object getVersion(Mapping mappingObject) {
+    return mappingObject.getVersion();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingService.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingService.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingService.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingService.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,90 @@
+/****************************************************************
+ * 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.bond.server.manage.mappings;
+
+import java.util.List;
+
+import org.apache.james.bond.server.JamesConnector;
+
+/**
+ * It defines the services that the RequestFactory offers to access the Mappings
+ */
+public class MappingService {
+  /**
+   * It retrieves all the mappings
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static List<Mapping> listMappings() throws Exception {
+    return JamesConnector.listMappings();
+  }
+
+  /**
+   * It adds a new address mapping to the user and domain
+   * 
+   * @param user
+   * @param domain
+   * @param address
+   * @throws Exception
+   */
+  public static void addAddressMapping(String user, String domain,
+      String address) throws Exception {
+    JamesConnector.addAddressMapping(user, domain, address);
+  }
+
+  /**
+   * It adds a new regular expression mapping to the user and domain
+   * 
+   * @param user
+   * @param domain
+   * @param regex
+   * @throws Exception
+   */
+  public static void addRegexMapping(String user, String domain, String regex)
+      throws Exception {
+    JamesConnector.addRegexMapping(user, domain, regex);
+  }
+
+  /**
+   * It removes the address mapping for the user and domain
+   * 
+   * @param user
+   * @param domain
+   * @param address
+   * @throws Exception
+   */
+  public static void removeAddressMapping(String user, String domain,
+      String address) throws Exception {
+    JamesConnector.removeAddressMapping(user, domain, address);
+  }
+
+  /**
+   * It removes the regular expression mapping for the user and domain
+   * 
+   * @param user
+   * @param domain
+   * @param regex
+   * @throws Exception
+   */
+  public static void removeRegexMapping(String user, String domain, String regex)
+      throws Exception {
+    JamesConnector.removeRegexMapping(user, domain, regex);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/mappings/MappingServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.manage.mappings;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class MappingServiceLocator implements ServiceLocator {
+  private static MappingService serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return MappingServiceLocator.getServiceInstance();
+  }
+
+  private static MappingService getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new MappingService();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/User.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/User.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/User.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/User.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,84 @@
+/****************************************************************
+ * 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.bond.server.manage.user;
+
+/**
+ * This class represent a user with its password
+ */
+public class User {
+  private Integer version;
+  private String username;
+  private String password;
+
+  public User() {
+  }
+
+  public User(String username) {
+    this.username = username;
+  }
+
+  public User(String username, String password) {
+    this.username = username;
+    this.password = password;
+  }
+
+  public String getId() {
+    return username;
+  }
+
+  public Integer getVersion() {
+    return version;
+  }
+
+  public void setId(String id) {
+    this.username = id;
+  }
+
+  public void setVersion(Integer version) {
+    this.version = version;
+  }
+
+  public String getUsername() {
+    return username;
+  }
+
+  public void setUsername(String username) {
+    this.username = username;
+  }
+
+  public String getPassword() {
+    return password;
+  }
+
+  public void setPassword(String password) {
+    this.password = password;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj == null)
+      return false;
+    if (obj == this)
+      return true;
+    if (!(obj instanceof User))
+      return false;
+    User userObj = (User) obj;
+    return this.getId().equals(userObj.getId());
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,66 @@
+/****************************************************************
+ * 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.bond.server.manage.user;
+
+import java.util.List;
+
+import org.apache.james.bond.server.JamesConnector;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class UserLocator extends Locator<User, String> {
+
+  @Override
+  public Class<User> getDomainType() {
+    return User.class;
+  }
+
+  @Override
+  public Class<String> getIdType() {
+    return String.class;
+  }
+
+  @Override
+  public User create(Class<? extends User> clazz) {
+    return new User();
+  }
+
+  @Override
+  public User find(Class<? extends User> clazz, String id) {
+    List<User> users;
+    try {
+      users = JamesConnector.listUsers();
+      int index;
+      if (users != null && (index = users.indexOf(clazz)) > -1)
+        return users.get(index);
+    } catch (Exception e) {
+    }
+    return null;
+  }
+
+  @Override
+  public String getId(User domainObject) {
+    return domainObject.getId();
+  }
+
+  @Override
+  public Object getVersion(User domainObject) {
+    return domainObject.getVersion();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserService.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserService.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserService.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserService.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,68 @@
+/****************************************************************
+ * 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.bond.server.manage.user;
+
+import java.util.List;
+
+import org.apache.james.bond.server.JamesConnector;
+
+/**
+ * It defines the services that the RequestFactory offers to access the Users
+ */
+public class UserService {
+  /**
+   * It retrieves all the users from the server
+   * 
+   * @return
+   * @throws Exception
+   */
+  public static List<User> listUsers() throws Exception {
+    return JamesConnector.listUsers();
+  }
+
+  /**
+   * It adds a new user to the server
+   * 
+   * @param user
+   * @throws Exception
+   */
+  public void persist(User user) throws Exception {
+    JamesConnector.addUser(user);
+  }
+
+  /**
+   * It removes the user from the server
+   * 
+   * @param user
+   * @throws Exception
+   */
+  public void remove(User user) throws Exception {
+    JamesConnector.removeUser(user);
+  }
+
+  /**
+   * It changes the password to the user
+   * 
+   * @param user
+   * @throws Exception
+   */
+  public void changePassword(User user) throws Exception {
+    JamesConnector.changePassword(user);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserServiceLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserServiceLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserServiceLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/manage/user/UserServiceLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.bond.server.manage.user;
+
+import com.google.web.bindery.requestfactory.shared.ServiceLocator;
+
+public class UserServiceLocator implements ServiceLocator {
+  private static UserService serviceInstance;
+
+  @Override
+  public Object getInstance(Class<?> clazz) {
+    return UserServiceLocator.getServiceInstance();
+  }
+
+  private static UserService getServiceInstance() {
+    if (serviceInstance == null)
+      serviceInstance = new UserService();
+    return serviceInstance;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/JMXBondConnector.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/JMXBondConnector.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/JMXBondConnector.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/JMXBondConnector.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,91 @@
+/****************************************************************
+ * 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.bond.server.monitor;
+
+import static org.apache.james.bond.shared.BondConst.JAMES_ADDRESS;
+import static org.apache.james.bond.shared.BondConst.JAMES_PORT;
+
+import java.io.IOException;
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MXBean;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+/**
+ * It connects to the JAMES server through JMX to monitor the system
+ */
+public class JMXBondConnector {
+  private ClassLoadingMXBean classLoadingBean;
+  private MemoryMXBean memoryBean;
+  private ThreadMXBean threadBean;
+  private RuntimeMXBean runtimeBean;
+  private OperatingSystemMXBean osBean;
+
+  /**
+   * It connects to the James server through JMX and retrieves all the
+   * information accessible through several {@link MXBean}:
+   * {@link ClassLoadingMXBean}, {@link MemoryMXBean}, {@link ThreadMXBean},
+   * {@link RuntimeMXBean} and {@link OperatingSystemMXBean}
+   * 
+   * @return
+   * @throws IOException
+   */
+  public Monitoring getMonitoringInformation() throws IOException {
+    if (classLoadingBean == null) {
+      String url = "service:jmx:rmi:///jndi/rmi://" + JAMES_ADDRESS + ":"
+          + JAMES_PORT + "/jmxrmi";
+
+      JMXServiceURL serviceUrl = new JMXServiceURL(url);
+      JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceUrl);
+      MBeanServerConnection mbeanConn = jmxConnector.getMBeanServerConnection();
+
+      classLoadingBean = ManagementFactory
+          .newPlatformMXBeanProxy(mbeanConn,
+              ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
+              ClassLoadingMXBean.class);
+      memoryBean = ManagementFactory.newPlatformMXBeanProxy(mbeanConn,
+          ManagementFactory.MEMORY_MXBEAN_NAME, MemoryMXBean.class);
+      threadBean = ManagementFactory.newPlatformMXBeanProxy(mbeanConn,
+          ManagementFactory.THREAD_MXBEAN_NAME, ThreadMXBean.class);
+      runtimeBean = ManagementFactory.newPlatformMXBeanProxy(mbeanConn,
+          ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class);
+      osBean = ManagementFactory.newPlatformMXBeanProxy(mbeanConn,
+          ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
+          OperatingSystemMXBean.class);
+    }
+
+    Monitoring monitoring = new Monitoring();
+
+    monitoring.setClassLoadingBean(classLoadingBean);
+    monitoring.setMemoryBean(memoryBean);
+    monitoring.setThreadBean(threadBean);
+    monitoring.setRuntimeBean(runtimeBean);
+    monitoring.setOsBean(osBean);
+
+    return monitoring;
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/Monitoring.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/Monitoring.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/Monitoring.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/Monitoring.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,212 @@
+/****************************************************************
+ * 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.bond.server.monitor;
+
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+
+import javax.management.MXBean;
+
+/**
+ * This represents the monitoring information extracted from several
+ * {@link MXBean}
+ */
+public class Monitoring {
+  private Integer version;
+  private ClassLoadingMXBean classLoadingBean;
+  private MemoryMXBean memoryBean;
+  private ThreadMXBean threadBean;
+  private RuntimeMXBean runtimeBean;
+  private OperatingSystemMXBean osBean;
+
+  public void setClassLoadingBean(ClassLoadingMXBean classLoadingBean) {
+    this.classLoadingBean = classLoadingBean;
+  }
+
+  public void setMemoryBean(MemoryMXBean memoryBean) {
+    this.memoryBean = memoryBean;
+  }
+
+  public void setThreadBean(ThreadMXBean threadBean) {
+    this.threadBean = threadBean;
+  }
+
+  public void setRuntimeBean(RuntimeMXBean runtimeBean) {
+    this.runtimeBean = runtimeBean;
+  }
+
+  public void setOsBean(OperatingSystemMXBean osBean) {
+    this.osBean = osBean;
+  }
+
+  public int getClassLoadingLoadedClassCount() {
+    return classLoadingBean.getLoadedClassCount();
+  }
+
+  public long getClassLoadingTotalLoadedClassCount() {
+    return classLoadingBean.getTotalLoadedClassCount();
+  }
+
+  public long getClassLoadingUnloadedClassCount() {
+    return classLoadingBean.getUnloadedClassCount();
+  }
+
+  public int getMemoryObjectPendingFinalizationCount() {
+    return memoryBean.getObjectPendingFinalizationCount();
+  }
+
+  public long getHeapMemoryUsageInit() {
+    return memoryBean.getHeapMemoryUsage().getInit();
+  }
+
+  public long getHeapMemoryUsageMax() {
+    return memoryBean.getHeapMemoryUsage().getMax();
+  }
+
+  public long getHeapMemoryUsageUsed() {
+    return memoryBean.getHeapMemoryUsage().getUsed();
+  }
+
+  public long getHeapMemoryUsageComitted() {
+    return memoryBean.getHeapMemoryUsage().getCommitted();
+  }
+
+  public long getNonHeapMemoryUsageInit() {
+    return memoryBean.getNonHeapMemoryUsage().getInit();
+  }
+
+  public long getNonHeapMemoryUsageMax() {
+    return memoryBean.getNonHeapMemoryUsage().getMax();
+  }
+
+  public long getNonHeapMemoryUsageUsed() {
+    return memoryBean.getNonHeapMemoryUsage().getUsed();
+  }
+
+  public long getNonHeapMemoryUsageComitted() {
+    return memoryBean.getNonHeapMemoryUsage().getCommitted();
+  }
+
+  public long getCurrentThreadCpuTime() {
+    return threadBean.getCurrentThreadCpuTime();
+  }
+
+  public long getCurrentThreadUserTime() {
+    return threadBean.getCurrentThreadUserTime();
+  }
+
+  public int getDaemonThreadCount() {
+    return threadBean.getDaemonThreadCount();
+  }
+
+  public int getPeakThreadCount() {
+    return threadBean.getPeakThreadCount();
+  }
+
+  public int getThreadCount() {
+    return threadBean.getThreadCount();
+  }
+
+  public long getTotalStartedThreadCount() {
+    return threadBean.getTotalStartedThreadCount();
+  }
+
+  public String getRuntimeBootClassPath() {
+    return runtimeBean.getBootClassPath();
+  }
+
+  public String getRuntimeClassPath() {
+    return runtimeBean.getClassPath();
+  }
+
+  public String getRuntimeLibraryPath() {
+    return runtimeBean.getLibraryPath();
+  }
+
+  public String getRuntimeManagementSpecVersion() {
+    return runtimeBean.getManagementSpecVersion();
+  }
+
+  public String getRuntimeName() {
+    return runtimeBean.getName();
+  }
+
+  public String getRuntimeSpecName() {
+    return runtimeBean.getSpecName();
+  }
+
+  public String getRuntimeSpecVendor() {
+    return runtimeBean.getSpecVendor();
+  }
+
+  public String getRuntimeSpecVersion() {
+    return runtimeBean.getSpecVersion();
+  }
+
+  public long getRuntimeStartTime() {
+    return runtimeBean.getStartTime();
+  }
+
+  public long getRuntimeUpTime() {
+    return runtimeBean.getUptime();
+  }
+
+  public String getRuntimeVmName() {
+    return runtimeBean.getVmName();
+  }
+
+  public String getRuntimeVmVendor() {
+    return runtimeBean.getVmVendor();
+  }
+
+  public String getRuntimeVmVersion() {
+    return runtimeBean.getVmVersion();
+  }
+
+  public String getOSArch() {
+    return osBean.getArch();
+  }
+
+  public int getOSAvailableProcessors() {
+    return osBean.getAvailableProcessors();
+  }
+
+  public String getOSName() {
+    return osBean.getName();
+  }
+
+  public double getOSSystemLoadAverage() {
+    return osBean.getSystemLoadAverage();
+  }
+
+  public String getOSVersion() {
+    return osBean.getVersion();
+  }
+
+  public Integer getVersion() {
+    return version;
+  }
+
+  public void setVersion(Integer version) {
+    this.version = version;
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/MonitoringLocator.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/MonitoringLocator.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/MonitoringLocator.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/server/monitor/MonitoringLocator.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.bond.server.monitor;
+
+import com.google.web.bindery.requestfactory.shared.Locator;
+
+public class MonitoringLocator extends Locator<Monitoring, Void> {
+
+  @Override
+  public Monitoring create(Class<? extends Monitoring> clazz) {
+    return new Monitoring();
+  }
+
+  @Override
+  public Monitoring find(Class<? extends Monitoring> clazz, Void id) {
+    return null;
+  }
+
+  @Override
+  public Class<Monitoring> getDomainType() {
+    return Monitoring.class;
+  }
+
+  @Override
+  public Void getId(Monitoring domainObject) {
+    return null;
+  }
+
+  @Override
+  public Class<Void> getIdType() {
+    return null;
+  }
+
+  @Override
+  public Object getVersion(Monitoring domainObject) {
+    return domainObject.getVersion();
+  }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org