Search in sources :

Example 21 with RepeatConfigureException

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

the class DataColumnPairGroupServiceImpl method create.

@Override
public void create(ColumnGroup entityObj) {
    Assert.assertNotNull(entityObj);
    try {
        DataColumnPairGroupDO dataColumnPairGroupDo = modelToDo(entityObj);
        dataColumnPairGroupDao.insert(dataColumnPairGroupDo);
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataColumnPairGroup has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataColumnPairGroupDO(com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject.DataColumnPairGroupDO) 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 22 with RepeatConfigureException

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

the class DataColumnPairServiceImpl method createBatch.

public void createBatch(List<ColumnPair> dataColumnPairs) {
    Assert.assertNotNull(dataColumnPairs);
    try {
        List<DataColumnPairDO> dataColumnPairDos = new ArrayList<DataColumnPairDO>();
        for (ColumnPair columnPair : dataColumnPairs) {
            DataColumnPairDO dataColumnPairDo = modelToDo(columnPair);
            dataColumnPairDos.add(dataColumnPairDo);
        }
        dataColumnPairDao.insertBatch(dataColumnPairDos);
    } catch (RepeatConfigureException rcf) {
        throw rcf;
    } catch (Exception e) {
        logger.error("ERROR ## create dataColumnPair has an exception!");
        throw new ManagerException(e);
    }
}
Also used : ColumnPair(com.alibaba.otter.shared.common.model.config.data.ColumnPair) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ArrayList(java.util.ArrayList) 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 23 with RepeatConfigureException

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

the class PipelineAction method doEdit.

public void doEdit(@FormGroup("pipelineInfo") Group pipelineInfo, @FormGroup("pipelineParameterInfo") Group pipelineParameterInfo, @FormField(name = "formPipelineError", group = "pipelineInfo") CustomErrors err, HttpSession session, Navigator nav) {
    Pipeline pipeline = new Pipeline();
    PipelineParameter parameters = new PipelineParameter();
    pipelineInfo.setProperties(pipeline);
    pipelineParameterInfo.setProperties(parameters);
    // if (parameters.getLoadPoolSize() < 1) {
    // parameters.setLoadPoolSize(PipelineParameter.DEFAULT_LOAD_POOL_SIZE);
    // }
    List<Long> selectNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
    List<Node> selectNodes = new ArrayList<Node>();
    for (Long selectNodeId : selectNodeIds) {
        Node node = new Node();
        node.setId(selectNodeId);
        selectNodes.add(node);
    }
    // select/extract节点普遍配置为同一个节点
    List<Long> extractNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
    // List<Long> extractNodeIds =
    // Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("extractNodeIds").getLongValues()));
    List<Node> extractNodes = new ArrayList<Node>();
    for (Long extractNodeId : extractNodeIds) {
        Node node = new Node();
        node.setId(extractNodeId);
        extractNodes.add(node);
    }
    List<Long> loadNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("loadNodeIds").getLongValues()));
    List<Node> loadNodes = new ArrayList<Node>();
    for (Long loadNodeId : loadNodeIds) {
        Node node = new Node();
        node.setId(loadNodeId);
        loadNodes.add(node);
    }
    pipeline.setSelectNodes(selectNodes);
    pipeline.setExtractNodes(extractNodes);
    pipeline.setLoadNodes(loadNodes);
    pipeline.setParameters(parameters);
    List<Pipeline> values = pipelineService.listByDestinationWithoutOther(pipeline.getParameters().getDestinationName());
    if (!values.isEmpty()) {
        if (values.size() > 1 || !values.get(0).getId().equals(pipeline.getId())) {
            err.setMessage("invalidDestinationName");
            return;
        }
    }
    try {
        pipelineService.modify(pipeline);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidPipelineName");
        return;
    }
    nav.redirectToLocation("pipelineList.htm?channelId=" + pipeline.getChannelId());
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) Node(com.alibaba.otter.shared.common.model.config.node.Node) ArrayList(java.util.ArrayList) PipelineParameter(com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 24 with RepeatConfigureException

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

the class CanalServiceImpl method create.

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

        protected void doInTransactionWithoutResult(TransactionStatus status) {
            try {
                CanalDO canalDO = modelToDo(canal);
                canalDO.setId(0L);
                if (!canalDao.checkUnique(canalDO)) {
                    String exceptionCause = "exist the same repeat canal in the database.";
                    logger.warn("WARN ## " + exceptionCause);
                    throw new RepeatConfigureException(exceptionCause);
                }
                canalDao.insert(canalDO);
                canal.setId(canalDO.getId());
            } catch (RepeatConfigureException rce) {
                throw rce;
            } catch (Exception e) {
                logger.error("ERROR ## create canal 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 25 with RepeatConfigureException

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

the class ChannelServiceImpl method modify.

/**
     * 修改Channel
     */
public void modify(Channel channel) {
    Assert.assertNotNull(channel);
    try {
        ChannelDO channelDo = modelToDo(channel);
        if (channelDao.checkUnique(channelDo)) {
            channelDao.update(channelDo);
        } else {
            String exceptionCause = "exist the same name channel in the database.";
            logger.warn("WARN ## " + exceptionCause);
            throw new RepeatConfigureException(exceptionCause);
        }
    } catch (RepeatConfigureException rce) {
        throw rce;
    } catch (Exception e) {
        logger.error("ERROR ## modify channel has an exception ", e);
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ChannelDO(com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) 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)

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