Search in sources :

Example 41 with RepeatConfigureException

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

the class DataMediaPairAction method doAdd.

/**
     * 添加DataMediaPair
     * 
     * @param channelInfo
     * @param channelParameterInfo
     * @throws Exception
     */
public void doAdd(@Param("submitKey") String submitKey, @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);
    // filter解析
    ExtensionDataType filterType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("filterType").getStringValue());
    ExtensionData filterData = new ExtensionData();
    filterData.setExtensionDataType(filterType);
    if (filterType.isClazz()) {
        filterData.setClazzPath(dataMediaPairInfo.getField("filterText").getStringValue());
    } else if (filterType.isSource()) {
        filterData.setSourceText(dataMediaPairInfo.getField("filterText").getStringValue());
    }
    dataMediaPair.setFilterData(filterData);
    // fileresovler解析
    ExtensionDataType resolverType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("resolverType").getStringValue());
    ExtensionData resolverData = new ExtensionData();
    resolverData.setExtensionDataType(resolverType);
    if (resolverType.isClazz()) {
        resolverData.setClazzPath(dataMediaPairInfo.getField("resolverText").getStringValue());
    } else if (resolverType.isSource()) {
        resolverData.setSourceText(dataMediaPairInfo.getField("resolverText").getStringValue());
    }
    dataMediaPair.setResolverData(resolverData);
    sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
    dataMediaPair.setSource(sourceDataMedia);
    targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
    dataMediaPair.setTarget(targetDataMedia);
    Long id = 0L;
    try {
        id = dataMediaPairService.createAndReturnId(dataMediaPair);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaPair");
        return;
    }
    if (submitKey.equals("保存")) {
        nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
    } else if (submitKey.equals("下一步")) {
        nav.redirectToLocation("addColumnPair.htm?dataMediaPairId=" + id + "&pipelineId=" + dataMediaPair.getPipelineId() + "&dataMediaPairId=" + id + "&sourceMediaId=" + sourceDataMedia.getId() + "&targetMediaId=" + targetDataMedia.getId());
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ExtensionDataType(com.alibaba.otter.shared.common.model.config.data.ExtensionDataType) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia) ExtensionData(com.alibaba.otter.shared.common.model.config.data.ExtensionData)

Example 42 with RepeatConfigureException

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

the class NodeAction method doEdit.

/**
     * 修改Node
     */
public void doEdit(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formNodeError", group = "nodeInfo") CustomErrors err, Navigator nav) throws Exception {
    Node node = new Node();
    NodeParameter parameter = new NodeParameter();
    nodeInfo.setProperties(node);
    nodeParameterInfo.setProperties(parameter);
    if (parameter.getDownloadPort() == null || parameter.getDownloadPort() == 0) {
        parameter.setDownloadPort(node.getPort().intValue() + 1);
    }
    if (parameter.getMbeanPort() == null || parameter.getMbeanPort() == 0) {
        parameter.setMbeanPort(node.getPort().intValue() + 2);
    }
    Long autoKeeperclusterId = nodeParameterInfo.getField("autoKeeperclusterId").getLongValue();
    if (autoKeeperclusterId != null && autoKeeperclusterId > 0) {
        AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(autoKeeperclusterId);
        parameter.setZkCluster(autoKeeperCluster);
    }
    node.setParameters(parameter);
    try {
        nodeService.modify(node);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidNode");
        return;
    }
    nav.redirectToLocation("nodeList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) NodeParameter(com.alibaba.otter.shared.common.model.config.node.NodeParameter) Node(com.alibaba.otter.shared.common.model.config.node.Node) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 43 with RepeatConfigureException

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

the class NodeAction method doAdd.

public void doAdd(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @FormField(name = "formNodeError", group = "nodeInfo") CustomErrors err, Navigator nav) throws Exception {
    Node node = new Node();
    NodeParameter parameter = new NodeParameter();
    nodeInfo.setProperties(node);
    nodeParameterInfo.setProperties(parameter);
    if (parameter.getDownloadPort() == null || parameter.getDownloadPort() == 0) {
        parameter.setDownloadPort(node.getPort().intValue() + 1);
    }
    if (parameter.getMbeanPort() == null || parameter.getMbeanPort() == 0) {
        parameter.setMbeanPort(node.getPort().intValue() + 2);
    }
    Long autoKeeperclusterId = nodeParameterInfo.getField("autoKeeperclusterId").getLongValue();
    if (autoKeeperclusterId != null && autoKeeperclusterId > 0) {
        AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(autoKeeperclusterId);
        parameter.setZkCluster(autoKeeperCluster);
    }
    node.setParameters(parameter);
    try {
        nodeService.create(node);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidNode");
        return;
    }
    nav.redirectTo(WebConstant.NODE_LIST_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) NodeParameter(com.alibaba.otter.shared.common.model.config.node.NodeParameter) Node(com.alibaba.otter.shared.common.model.config.node.Node) AutoKeeperCluster(com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)

Example 44 with RepeatConfigureException

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

the class PipelineAction method doAdd.

public void doAdd(@FormGroup("pipelineInfo") Group pipelineInfo, @FormGroup("pipelineParameterInfo") Group pipelineParameterInfo, @FormField(name = "formPipelineError", group = "pipelineInfo") CustomErrors err, HttpSession session, Navigator nav) throws Exception {
    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()) {
        err.setMessage("invalidDestinationName");
        return;
    }
    try {
        pipelineService.create(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 45 with RepeatConfigureException

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

the class UserAction method doAdd.

public void doAdd(@FormGroup("addUserInfo") Group userInfo, Navigator nav, @FormField(name = "formUserError", group = "addUserInfo") CustomErrors err) {
    User user = new User();
    userInfo.setProperties(user);
    user.setPassword(SecurityUtils.getPassword(user.getPassword()));
    try {
        userService.createUser(user);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidUser");
        return;
    }
    nav.redirectTo(WebConstant.USER_MANAGER_LINK);
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) User(com.alibaba.otter.shared.common.model.user.User)

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