Search in sources :

Example 16 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMediaSourceServiceImpl method modify.

/**
     * 修改
     */
public void modify(DataMediaSource dataMediaSource) {
    Assert.assertNotNull(dataMediaSource);
    try {
        DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource);
        if (dataMediaSourceDao.checkUnique(dataMediaSourceDo)) {
            dataMediaSourceDao.update(dataMediaSourceDo);
        } else {
            String exceptionCause = "exist the same name source in the database.";
            logger.warn("WARN ## " + exceptionCause);
            throw new RepeatConfigureException(exceptionCause);
        }
    } catch (RepeatConfigureException rce) {
        throw rce;
    } catch (Exception e) {
        logger.error("ERROR ## modify dataMediaSource has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaSourceDO(com.alibaba.otter.manager.biz.config.datamediasource.dal.dataobject.DataMediaSourceDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Example 17 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class CanalServiceImpl method modify.

/**
     * 修改
     */
public void modify(final Canal canal) {
    Assert.assertNotNull(canal);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                CanalDO canalDo = modelToDo(canal);
                if (canalDao.checkUnique(canalDo)) {
                    canalDao.update(canalDo);
                } else {
                    String exceptionCause = "exist the same repeat canal in the database.";
                    logger.warn("WARN ## " + exceptionCause);
                    throw new RepeatConfigureException(exceptionCause);
                }
            } catch (RepeatConfigureException rce) {
                throw rce;
            } catch (Exception e) {
                logger.error("ERROR ## modify canal(" + canal.getId() + ") has an exception!");
                throw new ManagerException(e);
            }
        }
    });
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) CanalDO(com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO) TransactionStatus(org.springframework.transaction.TransactionStatus) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Example 18 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class ChannelServiceImpl method create.

/**
     * 添加Channel
     */
public void create(final Channel channel) {
    Assert.assertNotNull(channel);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        @Override
        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                ChannelDO channelDo = modelToDo(channel);
                channelDo.setId(0L);
                if (!channelDao.checkUnique(channelDo)) {
                    String exceptionCause = "exist the same name channel in the database.";
                    logger.warn("WARN ## " + exceptionCause);
                    throw new RepeatConfigureException(exceptionCause);
                }
                channelDao.insert(channelDo);
                arbitrateManageService.channelEvent().init(channelDo.getId());
            } catch (RepeatConfigureException rce) {
                throw rce;
            } catch (Exception e) {
                logger.error("ERROR ## create channel has an exception ", e);
                throw new ManagerException(e);
            }
        }
    });
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) TransactionStatus(org.springframework.transaction.TransactionStatus) ChannelDO(com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) InvalidConfigureException(com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException)

Example 19 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataColumnPairServiceImpl method create.

public void create(ColumnPair entityObj) {
    Assert.assertNotNull(entityObj);
    try {
        DataColumnPairDO dataColumnPairDo = modelToDo(entityObj);
        dataColumnPairDao.insert(dataColumnPairDo);
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataColumnPair has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataColumnPairDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)

Example 20 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.

the class DataMatrixServiceImpl method modify.

/**
     * 修改
     */
public void modify(final DataMatrix matrix) {
    Assert.assertNotNull(matrix);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                DataMatrixDO matrixDo = modelToDo(matrix);
                if (dataMatrixDao.checkUnique(matrixDo)) {
                    dataMatrixDao.update(matrixDo);
                } else {
                    String exceptionCause = "exist the same repeat matrix in the database.";
                    logger.warn("WARN ## " + exceptionCause);
                    throw new RepeatConfigureException(exceptionCause);
                }
            } catch (RepeatConfigureException rce) {
                throw rce;
            } catch (Exception e) {
                logger.error("ERROR ## modify canal(" + matrix.getId() + ") has an exception!");
                throw new ManagerException(e);
            }
        }
    });
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMatrixDO(com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO) TransactionStatus(org.springframework.transaction.TransactionStatus) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)

Aggregations

RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)46 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)23 TransactionStatus (org.springframework.transaction.TransactionStatus)8 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)8 ArrayList (java.util.ArrayList)7 Node (com.alibaba.otter.shared.common.model.config.node.Node)6 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)5 AutoKeeperCluster (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)4 DataColumnPairDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)3 DataMediaDO (com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO)3 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)3 DataMediaSource (com.alibaba.otter.shared.common.model.config.data.DataMediaSource)3 MqMediaSource (com.alibaba.otter.shared.common.model.config.data.mq.MqMediaSource)3 List (java.util.List)3 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)2 CanalParameter (com.alibaba.otter.canal.instance.manager.model.CanalParameter)2 DataSourcing (com.alibaba.otter.canal.instance.manager.model.CanalParameter.DataSourcing)2 SourcingType (com.alibaba.otter.canal.instance.manager.model.CanalParameter.SourcingType)2 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)2 CanalDO (com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO)2