Examples of DomainListException


Examples of org.apache.james.domainlist.api.DomainListException

    @Override
    public void addDomain(String domain) throws DomainListException {
        String lowerCasedDomain = domain.toLowerCase();
        if (containsDomain(lowerCasedDomain)) {
            throw new DomainListException(lowerCasedDomain + " already exists.");
        }
        EntityManager entityManager = entityManagerFactory.createEntityManager();
        final EntityTransaction transaction = entityManager.getTransaction();
        try {
            transaction.begin();
            JPADomain jpaDomain = new JPADomain(lowerCasedDomain);
            entityManager.persist(jpaDomain);
            transaction.commit();
        } catch (PersistenceException e) {
            getLogger().error("Failed to save domain", e);
            if (transaction.isActive()) {
                transaction.rollback();
            }
            throw new DomainListException("Unable to add domain " + domain, e);
        } finally {
            entityManager.close();
        }
    }
View Full Code Here

Examples of org.apache.james.domainlist.api.DomainListException

        } catch (PersistenceException e) {
            getLogger().error("Failed to remove domain", e);
            if (transaction.isActive()) {
                transaction.rollback();
            }
            throw new DomainListException("Unable to remove domain " + domain, e);

        } finally {
            entityManager.close();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.