Search in sources :

Example 31 with ManagerException

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

the class DataMatrixServiceImpl method modelToDo.

/**
 * 用于Model对象转化为DO对象
 */
private DataMatrixDO modelToDo(DataMatrix matrix) {
    DataMatrixDO matrixDo = new DataMatrixDO();
    try {
        matrixDo.setId(matrix.getId());
        matrixDo.setGroupKey(matrix.getGroupKey());
        matrixDo.setDescription(matrix.getDescription());
        matrixDo.setMaster(matrix.getMaster());
        matrixDo.setSlave(matrix.getSlave());
        matrixDo.setGmtCreate(matrix.getGmtCreate());
        matrixDo.setGmtModified(matrix.getGmtModified());
    } catch (Exception e) {
        logger.error("ERROR ## change the matrix Model to Do has an exception");
        throw new ManagerException(e);
    }
    return matrixDo;
}
Also used : DataMatrixDO(com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO) 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 32 with ManagerException

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

the class DataMatrixServiceImpl method remove.

/**
 * 删除
 */
public void remove(final Long matrixId) {
    Assert.assertNotNull(matrixId);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                dataMatrixDao.delete(matrixId);
            } catch (Exception e) {
                logger.error("ERROR ## remove canal(" + matrixId + ") has an exception!");
                throw new ManagerException(e);
            }
        }
    });
}
Also used : 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 33 with ManagerException

use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException 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 34 with ManagerException

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

the class DataMediaSourceServiceImpl method create.

/**
 * 添加
 */
public void create(DataMediaSource dataMediaSource) {
    Assert.assertNotNull(dataMediaSource);
    try {
        DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource);
        dataMediaSourceDo.setId(0L);
        if (!dataMediaSourceDao.checkUnique(dataMediaSourceDo)) {
            String exceptionCause = "exist the same name source in the database.";
            logger.warn("WARN ## " + exceptionCause);
            throw new RepeatConfigureException(exceptionCause);
        }
        dataMediaSourceDao.insert(dataMediaSourceDo);
    } catch (RepeatConfigureException rce) {
        throw rce;
    } catch (Exception e) {
        logger.error("ERROR ## create 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 35 with ManagerException

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

the class NodeServiceImpl method remove.

/**
 * 删除
 */
public void remove(final Long nodeId) {
    Assert.assertNotNull(nodeId);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                nodeDao.delete(nodeId);
            } catch (Exception e) {
                logger.error("ERROR ## remove node(" + nodeId + ") has an exception!");
                throw new ManagerException(e);
            }
        }
    });
}
Also used : 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

ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)85 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)76 ArrayList (java.util.ArrayList)35 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)17 TransactionStatus (org.springframework.transaction.TransactionStatus)13 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)13 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)12 PipelineDO (com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO)10 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)10 DataMediaPairDO (com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO)9 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)9 ChannelDO (com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO)8 DataMediaDO (com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO)7 Node (com.alibaba.otter.shared.common.model.config.node.Node)7 CanalDO (com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO)5 DataColumnPairDO (com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairDO)5 DataMatrixDO (com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO)5 PipelineNodeRelationDO (com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineNodeRelationDO)5 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)5 DataMediaSourceDO (com.alibaba.otter.manager.biz.config.datamediasource.dal.dataobject.DataMediaSourceDO)4