-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defines the basic class of the orchestration module. #354
- Loading branch information
1 parent
fdbfe5b
commit fc03550
Showing
13 changed files
with
823 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2019 WeBank | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~ | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>dss</artifactId> | ||
<groupId>com.webank.wedatasphere.dss</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>dss-orchestrator-core</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.webank.wedatasphere.linkis</groupId> | ||
<artifactId>linkis-module</artifactId> | ||
<version>${linkis.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.webank.wedatasphere.dss</groupId> | ||
<artifactId>dss-appconn-core</artifactId> | ||
<version>${dss.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<artifactId>linkis-bml-client</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>gson</artifactId> | ||
<groupId>com.google.code.gson</groupId> | ||
</exclusion> | ||
</exclusions> | ||
<groupId>com.webank.wedatasphere.linkis</groupId> | ||
<version>${linkis.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.webank.wedatasphere.dss</groupId> | ||
<artifactId>dss-contextservice</artifactId> | ||
<version>${dss.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.webank.wedatasphere.linkis</groupId> | ||
<artifactId>linkis-rpc</artifactId> | ||
<version>${linkis.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.webank.wedatasphere.dss</groupId> | ||
<artifactId>dss-orchestrator-common</artifactId> | ||
<version>${dss.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.webank.wedatasphere.dss</groupId> | ||
<artifactId>dss-common</artifactId> | ||
<version>${dss.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
|
||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*.xml</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<excludes> | ||
<exclude>**/*.xml</exclude> | ||
<exclude>**/*.properties</exclude> | ||
<exclude>**/*.yml</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
</project> |
68 changes: 68 additions & 0 deletions
68
...tor-core/src/main/java/com/webank/wedatasphere/dss/orchestrator/core/DSSOrchestrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core; | ||
|
||
import com.webank.wedatasphere.dss.appconn.core.AppConn; | ||
import com.webank.wedatasphere.dss.common.label.DSSLabel; | ||
import java.util.List; | ||
|
||
|
||
|
||
public interface DSSOrchestrator { | ||
|
||
/** | ||
* 返回Orchestrator的名称,如workflow | ||
* @return | ||
*/ | ||
String getName(); | ||
|
||
|
||
/** | ||
* 返回编排关联的AppConn | ||
* @return | ||
*/ | ||
AppConn getAppConn(); | ||
|
||
DSSOrchestratorContext getDSSOrchestratorContext(); | ||
|
||
void setAppConn(AppConn appConn); | ||
|
||
/** | ||
*添加当前编排需要使用到在appconn | ||
* @param appconn | ||
*/ | ||
void addLinkedAppConn(AppConn appconn); | ||
|
||
|
||
/** | ||
* 为编排提供标签说明,如DEV | ||
* @param dssLabel | ||
*/ | ||
void addLinkedDssLabels(DSSLabel dssLabel); | ||
|
||
/** | ||
* 返回所有已经关联到的AppConn | ||
* @return | ||
*/ | ||
List<AppConn> getLinkedAppConn(); | ||
|
||
/** | ||
* 用于工具条功能按钮展示,可以查到该模式可以提供的功能按钮 | ||
* @return | ||
*/ | ||
List<String> getToolBars(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...e/src/main/java/com/webank/wedatasphere/dss/orchestrator/core/DSSOrchestratorContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core; | ||
|
||
import com.webank.wedatasphere.dss.common.exception.DSSRuntimeException; | ||
import com.webank.wedatasphere.dss.orchestrator.core.plugin.DSSOrchestratorPlugin; | ||
import java.io.Closeable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
|
||
public interface DSSOrchestratorContext extends Closeable { | ||
|
||
void initialize(); | ||
|
||
Map<String, Object> getConfigMap(); | ||
|
||
List<DSSOrchestratorPlugin> getOrchestratorPlugins(); | ||
|
||
default <T extends DSSOrchestratorPlugin> T getDSSOrchestratorPlugin(Class<T> clazz) { | ||
return (T) getOrchestratorPlugins().stream().filter(clazz::isInstance) | ||
.findFirst().orElseThrow(() -> new DSSRuntimeException(50321, "Cannot find " + clazz.getSimpleName())); | ||
} | ||
|
||
boolean isActive(); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...om/webank/wedatasphere/dss/orchestrator/core/exception/DSSOrchestratorErrorException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core.exception; | ||
|
||
import com.webank.wedatasphere.dss.common.exception.DSSErrorException; | ||
|
||
|
||
public class DSSOrchestratorErrorException extends DSSErrorException { | ||
public DSSOrchestratorErrorException(int errCode, String desc) { | ||
super(errCode, desc); | ||
} | ||
|
||
public DSSOrchestratorErrorException(int errCode, String desc, String ip, int port, String serviceKind) { | ||
super(errCode, desc, ip, port, serviceKind); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...va/com/webank/wedatasphere/dss/orchestrator/core/impl/AbstractDSSOrchestratorContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core.impl; | ||
|
||
import com.webank.wedatasphere.dss.common.utils.DSSExceptionUtils; | ||
import com.webank.wedatasphere.dss.orchestrator.core.DSSOrchestratorContext; | ||
import com.webank.wedatasphere.dss.orchestrator.core.plugin.DSSOrchestratorPlugin; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public abstract class AbstractDSSOrchestratorContext implements DSSOrchestratorContext { | ||
|
||
private boolean isClosed = false; | ||
private Map<String, Object> configMap = new HashMap<>(); | ||
|
||
|
||
@Override | ||
public Map<String, Object> getConfigMap() { | ||
return configMap; | ||
} | ||
|
||
@Override | ||
public boolean isActive() { | ||
return !isClosed; | ||
} | ||
|
||
@Override | ||
public void close() { | ||
isClosed = true; | ||
getOrchestratorPlugins().forEach(DSSExceptionUtils.handling(DSSOrchestratorPlugin::close)); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...rc/main/java/com/webank/wedatasphere/dss/orchestrator/core/impl/AbstractOrchestrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core.impl; | ||
|
||
import com.webank.wedatasphere.dss.orchestrator.core.DSSOrchestrator; | ||
|
||
import com.webank.wedatasphere.dss.orchestrator.core.DSSOrchestratorContext; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
|
||
abstract class AbstractOrchestrator implements DSSOrchestrator { | ||
|
||
private volatile DSSOrchestratorContext dssOrchestratorContext; | ||
|
||
@Override | ||
public List<String> getToolBars() { | ||
String[] toolNames = {"参数", "资源", "执行", "发布","保存"}; | ||
return Arrays.asList(toolNames); | ||
} | ||
|
||
protected abstract DSSOrchestratorContext createOrchestratorContext(); | ||
|
||
@Override | ||
public DSSOrchestratorContext getDSSOrchestratorContext() { | ||
if(dssOrchestratorContext == null) { | ||
synchronized (this) { | ||
if(dssOrchestratorContext == null) { | ||
dssOrchestratorContext = createOrchestratorContext(); | ||
} | ||
} | ||
} | ||
return dssOrchestratorContext; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...n/java/com/webank/wedatasphere/dss/orchestrator/core/impl/DSSOrchestratorContextImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2019 WeBank | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.webank.wedatasphere.dss.orchestrator.core.impl; | ||
|
||
import com.webank.wedatasphere.dss.common.utils.ClassUtils; | ||
import com.webank.wedatasphere.dss.orchestrator.core.plugin.DSSOrchestratorPlugin; | ||
import java.util.List; | ||
|
||
|
||
public class DSSOrchestratorContextImpl extends AbstractDSSOrchestratorContext { | ||
|
||
private List<DSSOrchestratorPlugin> plugins; | ||
|
||
@Override | ||
public void initialize() { | ||
plugins = ClassUtils.getInstances(DSSOrchestratorPlugin.class); | ||
plugins.forEach(DSSOrchestratorPlugin::init); | ||
} | ||
|
||
@Override | ||
public List<DSSOrchestratorPlugin> getOrchestratorPlugins() { | ||
return plugins; | ||
} | ||
|
||
} |
Oops, something went wrong.