001/*
002 *   Licensed to the Apache Software Foundation (ASF) under one
003 *   or more contributor license agreements.  See the NOTICE file
004 *   distributed with this work for additional information
005 *   regarding copyright ownership.  The ASF licenses this file
006 *   to you under the Apache License, Version 2.0 (the
007 *   "License"); you may not use this file except in compliance
008 *   with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *   Unless required by applicable law or agreed to in writing,
013 *   software distributed under the License is distributed on an
014 *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *   KIND, either express or implied.  See the License for the
016 *   specific language governing permissions and limitations
017 *   under the License.
018 *
019 */
020
021package org.apache.james.sieverepository.lib;
022
023import org.apache.james.sieverepository.api.SieveRepository;
024import org.apache.james.sieverepository.api.SieveRepositoryManagementMBean;
025import org.apache.james.sieverepository.api.exception.SieveRepositoryException;
026
027import javax.inject.Inject;
028import javax.management.NotCompliantMBeanException;
029import javax.management.StandardMBean;
030
031public class SieveRepositoryManagement extends StandardMBean implements SieveRepositoryManagementMBean {
032
033    private SieveRepository sieveRepository;
034
035    public SieveRepositoryManagement() throws NotCompliantMBeanException {
036        super(SieveRepositoryManagementMBean.class);
037    }
038
039    @Inject
040    public void setSieveRepository(SieveRepository sieveRepository) {
041        this.sieveRepository = sieveRepository;
042    }
043
044    @Override
045    public long getQuota() throws SieveRepositoryException {
046        return sieveRepository.getQuota();
047    }
048
049    @Override
050    public void setQuota(long quota) throws SieveRepositoryException {
051        sieveRepository.setQuota(quota);
052    }
053
054    @Override
055    public void removeQuota() throws SieveRepositoryException {
056        sieveRepository.removeQuota();
057    }
058
059    @Override
060    public long getQuota(String user) throws SieveRepositoryException {
061        return sieveRepository.getQuota(user);
062    }
063
064    @Override
065    public void setQuota(String user, long quota) throws SieveRepositoryException {
066        sieveRepository.setQuota(user, quota);
067    }
068
069    @Override
070    public void removeQuota(String user) throws SieveRepositoryException {
071        sieveRepository.removeQuota(user);
072    }
073}