/****************************************************************
 * 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.domainlist.lib;

import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.management.NotCompliantMBeanException;
import javax.management.StandardMBean;

import org.apache.james.domainlist.api.DomainList;
import org.apache.james.domainlist.api.DomainListException;
import org.apache.james.domainlist.api.DomainListManagementMBean;

public class DomainListManagement extends StandardMBean implements DomainListManagementMBean {

    private DomainList domainList;

    public DomainListManagement() throws NotCompliantMBeanException {
        super(DomainListManagementMBean.class);
    }

    @Inject
    @Resource(@Named("domainlist") name = "domainlist")
    public void setDomainList(DomainList domainList) {
        this.domainList = domainList;
    }

    public void addDomain(String domain) throws Exception {
        try {
            domainList.addDomain(domain);
        } catch (DomainListException e) {
            throw new Exception(e.getMessage());
        }
    }

    public boolean containsDomain(String domain) throws Exception {
        try {
            return domainList.containsDomain(domain);
        } catch (DomainListException e) {
            throw new Exception(e.getMessage());
        }
    }

    public String[] getDomains() throws Exception {
        try {
            return domainList.getDomains();
        } catch (DomainListException e) {
            throw new Exception(e.getMessage());
        }
    }

    public void removeDomain(String domain) throws Exception {
        try {
            domainList.removeDomain(domain);
        } catch (DomainListException e) {
            throw new Exception(e.getMessage());
        }
    }

    public String getDefaultDomain() throws Exception {
        try {
            return domainList.getDefaultDomain();
        } catch (DomainListException e) {
            throw new Exception(e.getMessage());
        }

    }

}

@@ -1909,28 +1909,17 @@
 rce(
-@Named(%22domainlist%22)
+%0D%0A       
  nam
@@ -1967,16 +1967,37 @@
 ainList(
+@Named(%22domainlist%22) 
 DomainLi
@@ -2054,32 +2054,47 @@
 List;%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A
     public void 
@@ -2197,32 +2197,41 @@
 ain);%0D%0A        %7D
+%0D%0A       
  catch (DomainLi
@@ -2310,32 +2310,47 @@
     %7D%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A
     public boole
@@ -2473,32 +2473,41 @@
 ain);%0D%0A        %7D
+%0D%0A       
  catch (DomainLi
@@ -2586,32 +2586,47 @@
     %7D%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A
     public Strin
@@ -2723,32 +2723,41 @@
 ns();%0D%0A        %7D
+%0D%0A       
  catch (DomainLi
@@ -2836,32 +2836,47 @@
     %7D%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A
     public void 
@@ -2985,32 +2985,41 @@
 ain);%0D%0A        %7D
+%0D%0A       
  catch (DomainLi
@@ -3102,24 +3102,39 @@
 %7D%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A
     public S
@@ -3240,24 +3240,24 @@
 tDomain();%0D%0A
-
         %7D ca
@@ -3253,16 +3253,25 @@
        %7D
+%0D%0A       
  catch (

Move back the @Named annotations on the parameters (JAMES-1477)