Search in sources :

Example 11 with RepeatConfigureException

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

the class DataMediaPairAction method doNextToView.

/**
     * 选择视图同步
     * 
     * @param channelInfo
     * @param channelParameterInfo
     * @throws Exception
     */
public void doNextToView(@FormGroup("dataMediaPairInfo") Group dataMediaPairInfo, @FormField(name = "formDataMediaPairError", group = "dataMediaPairInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMediaPair dataMediaPair = new DataMediaPair();
    DataMedia sourceDataMedia = new DataMedia();
    DataMedia targetDataMedia = new DataMedia();
    dataMediaPairInfo.setProperties(dataMediaPair);
    sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
    dataMediaPair.setSource(sourceDataMedia);
    targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
    dataMediaPair.setTarget(targetDataMedia);
    try {
        dataMediaPairService.create(dataMediaPair);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaPair");
        return;
    }
    nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia)

Example 12 with RepeatConfigureException

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

the class DataMediaSourceAction method doAdd.

/**
     * 添加Channel
     * 
     * @param channelInfo
     * @param channelParameterInfo
     * @throws Exception
     */
public void doAdd(@FormGroup("dataMediaSourceInfo") Group dataMediaSourceInfo, @FormField(name = "formDataMediaSourceError", group = "dataMediaSourceInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMediaSource dataMediaSource = new DataMediaSource();
    dataMediaSourceInfo.setProperties(dataMediaSource);
    if (dataMediaSource.getType().isMysql() || dataMediaSource.getType().isOracle()) {
        DbMediaSource dbMediaSource = new DbMediaSource();
        dataMediaSourceInfo.setProperties(dbMediaSource);
        if (dataMediaSource.getType().isMysql()) {
            dbMediaSource.setDriver("com.mysql.jdbc.Driver");
        } else if (dataMediaSource.getType().isOracle()) {
            dbMediaSource.setDriver("oracle.jdbc.driver.OracleDriver");
        }
        try {
            dataMediaSourceService.create(dbMediaSource);
        } catch (RepeatConfigureException rce) {
            err.setMessage("invalidDataMediaSource");
            return;
        }
    } else if (dataMediaSource.getType().isNapoli() || dataMediaSource.getType().isMq()) {
        MqMediaSource mqMediaSource = new MqMediaSource();
        dataMediaSourceInfo.setProperties(mqMediaSource);
        try {
            dataMediaSourceService.create(mqMediaSource);
        } catch (RepeatConfigureException rce) {
            err.setMessage("invalidDataMediaSource");
            return;
        }
    }
    nav.redirectTo(WebConstant.DATA_MEDIA_SOURCE_LIST_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) MqMediaSource(com.alibaba.otter.shared.common.model.config.data.mq.MqMediaSource) DataMediaSource(com.alibaba.otter.shared.common.model.config.data.DataMediaSource) DbMediaSource(com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource)

Example 13 with RepeatConfigureException

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

the class DataMediaSourceAction method doEdit.

public void doEdit(@FormGroup("dataMediaSourceInfo") Group dataMediaSourceInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formDataMediaSourceError", group = "dataMediaSourceInfo") CustomErrors err, Navigator nav) throws Exception {
    DbMediaSource dbMediaSource = new DbMediaSource();
    dataMediaSourceInfo.setProperties(dbMediaSource);
    if (dbMediaSource.getType().isMysql()) {
        dbMediaSource.setDriver("com.mysql.jdbc.Driver");
    } else if (dbMediaSource.getType().isOracle()) {
        dbMediaSource.setDriver("oracle.jdbc.driver.OracleDriver");
    }
    try {
        dataMediaSourceService.modify(dbMediaSource);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaSource");
        return;
    }
    nav.redirectToLocation("dataSourceList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DbMediaSource(com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource)

Example 14 with RepeatConfigureException

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

the class DataMediaServiceImpl method createReturnId.

/**
     * 添加
     */
@Override
public Long createReturnId(DataMedia dataMedia) {
    Assert.assertNotNull(dataMedia);
    try {
        DataMediaDO dataMediaDo = modelToDo(dataMedia);
        dataMediaDo.setId(0L);
        DataMediaDO dataMediaDoInDb = dataMediaDao.checkUniqueAndReturnExist(dataMediaDo);
        if (dataMediaDoInDb == null) {
            dataMediaDo = dataMediaDao.insert(dataMediaDo);
        } else {
            dataMediaDo = dataMediaDoInDb;
        }
        return dataMediaDo.getId();
    } catch (RepeatConfigureException rce) {
        throw rce;
    } catch (Exception e) {
        logger.error("ERROR ## create dataMedia has an exception!");
        throw new ManagerException(e);
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaDO(com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO) 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 15 with RepeatConfigureException

use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException 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)

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