You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by rk...@apache.org on 2016/08/04 19:05:23 UTC
[4/4] oozie git commit: OOZIE-2625 Drop workflowgenerator (rkanter)
OOZIE-2625 Drop workflowgenerator (rkanter)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/aec39dd2
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/aec39dd2
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/aec39dd2
Branch: refs/heads/master
Commit: aec39dd2669b22c385961c48759e7e037e15160d
Parents: d03d463
Author: Robert Kanter <rk...@cloudera.com>
Authored: Thu Aug 4 12:05:10 2016 -0700
Committer: Robert Kanter <rk...@cloudera.com>
Committed: Thu Aug 4 12:05:10 2016 -0700
----------------------------------------------------------------------
distro/pom.xml | 15 -
distro/src/main/bin/oozie-setup.sh | 7 -
pom.xml | 26 -
release-log.txt | 1 +
src/main/assemblies/distro.xml | 8 -
workflowgenerator/README.txt | 138 ----
workflowgenerator/pom.xml | 185 -----
.../src/main/assemblies/workflowgenerator.xml | 30 -
.../client/OozieDiagramController.java | 452 -----------
.../client/OozieWorkflowGenerator.java | 765 -------------------
.../client/property/Property.java | 75 --
.../client/property/PropertyTable.java | 620 ---------------
.../client/property/PropertyTableFactory.java | 137 ----
.../property/action/EmailPropertyTable.java | 114 ---
.../client/property/action/FSPropertyTable.java | 477 ------------
.../property/action/JavaPropertyTable.java | 189 -----
.../property/action/MapReducePropertyTable.java | 156 ----
.../property/action/PigPropertyTable.java | 168 ----
.../property/action/PipesPropertyTable.java | 207 -----
.../property/action/SSHPropertyTable.java | 234 ------
.../property/action/ShellPropertyTable.java | 190 -----
.../property/action/StreamingPropertyTable.java | 206 -----
.../property/action/SubWFPropertyTable.java | 140 ----
.../property/control/DecisionPropertyTable.java | 423 ----------
.../property/control/EndPropertyTable.java | 67 --
.../property/control/ForkPropertyTable.java | 237 ------
.../property/control/JoinPropertyTable.java | 72 --
.../property/control/KillPropertyTable.java | 77 --
.../property/control/StartPropertyTable.java | 73 --
.../property/control/WrkflowPropertyTable.java | 169 ----
.../client/widget/NodeWidget.java | 272 -------
.../client/widget/action/EmailActionWidget.java | 48 --
.../client/widget/action/FSActionWidget.java | 48 --
.../client/widget/action/JavaActionWidget.java | 49 --
.../widget/action/MapReduceActionWidget.java | 48 --
.../client/widget/action/PigActionWidget.java | 49 --
.../client/widget/action/PipesActionWidget.java | 48 --
.../client/widget/action/SSHActionWidget.java | 48 --
.../client/widget/action/ShellActionWidget.java | 48 --
.../widget/action/StreamingActionWidget.java | 48 --
.../client/widget/action/SubWFActionWidget.java | 48 --
.../widget/control/DecisionNodeWidget.java | 49 --
.../client/widget/control/EndNodeWidget.java | 56 --
.../client/widget/control/ForkNodeWidget.java | 50 --
.../client/widget/control/JoinNodeWidget.java | 47 --
.../client/widget/control/KillNodeWidget.java | 42 -
.../client/widget/control/StartNodeWidget.java | 69 --
.../workflowgenerator/workflowgenerator.gwt.xml | 43 --
.../src/main/resources/img/action.png | Bin 889 -> 0 bytes
.../src/main/resources/img/add-btn.png | Bin 1656 -> 0 bytes
.../src/main/resources/img/decision.png | Bin 1042 -> 0 bytes
.../src/main/resources/img/del-btn.png | Bin 1521 -> 0 bytes
.../src/main/resources/img/distcp-action.png | Bin 1584 -> 0 bytes
.../src/main/resources/img/email-action.png | Bin 1454 -> 0 bytes
.../src/main/resources/img/end.png | Bin 1246 -> 0 bytes
.../src/main/resources/img/fork-shape.png | Bin 1591 -> 0 bytes
.../src/main/resources/img/fork.png | Bin 2078 -> 0 bytes
.../src/main/resources/img/fs-action.png | Bin 1310 -> 0 bytes
.../src/main/resources/img/hive-action.png | Bin 1401 -> 0 bytes
.../src/main/resources/img/java-action.png | Bin 1428 -> 0 bytes
.../src/main/resources/img/join-shape.png | Bin 1609 -> 0 bytes
.../src/main/resources/img/join.png | Bin 2141 -> 0 bytes
.../src/main/resources/img/kill.png | Bin 2439 -> 0 bytes
.../src/main/resources/img/mr-action.png | Bin 1335 -> 0 bytes
.../src/main/resources/img/pig-action.png | Bin 1387 -> 0 bytes
.../src/main/resources/img/pipes-action.png | Bin 1610 -> 0 bytes
.../src/main/resources/img/shell-action.png | Bin 1612 -> 0 bytes
.../src/main/resources/img/ssh-action.png | Bin 1346 -> 0 bytes
.../src/main/resources/img/start-shape.png | Bin 1513 -> 0 bytes
.../src/main/resources/img/start.png | Bin 2368 -> 0 bytes
.../src/main/resources/img/streaming-action.png | Bin 1566 -> 0 bytes
.../src/main/resources/img/subwf-action.png | Bin 1562 -> 0 bytes
.../workflowgenerator/workflowgenerator.gwt.xml | 43 --
.../src/main/webapp/WEB-INF/web.xml | 31 -
.../src/main/webapp/workflowgenerator.css | 200 -----
.../src/main/webapp/workflowgenerator.html | 66 --
.../client/OozieWorkflowGeneratorTest.java | 35 -
.../workflowgeneratorTest-dev.launch | 39 -
.../workflowgeneratorTest-prod.launch | 39 -
79 files changed, 1 insertion(+), 7220 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/distro/pom.xml
----------------------------------------------------------------------
diff --git a/distro/pom.xml b/distro/pom.xml
index 73a7d97..7baaff2 100644
--- a/distro/pom.xml
+++ b/distro/pom.xml
@@ -130,21 +130,6 @@
<profiles>
<profile>
- <id>wfgen</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.oozie</groupId>
- <artifactId>oozie-workflowgenerator</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- <type>war</type>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<id>loginServerExample</id>
<activation>
<activeByDefault>false</activeByDefault>
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/distro/src/main/bin/oozie-setup.sh
----------------------------------------------------------------------
diff --git a/distro/src/main/bin/oozie-setup.sh b/distro/src/main/bin/oozie-setup.sh
index a41e42d..3b6a643 100644
--- a/distro/src/main/bin/oozie-setup.sh
+++ b/distro/src/main/bin/oozie-setup.sh
@@ -217,13 +217,6 @@ else
extjsHome=${libext}/ext-2.2.zip
addExtjs=true
fi
- # find war files (e.g., workflowgenerator) under /libext and deploy
- if [ `ls ${libext} | grep \.war\$ | wc -c` != 0 ]; then
- for i in "${libext}/"*.war; do
- echo "INFO: Deploying extention: $i"
- cp $i ${CATALINA_BASE}/webapps/
- done
- fi
fi
prepare
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 27a3098..a1c9357 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1746,32 +1746,6 @@
</properties>
</profile>
<profile>
- <id>wfgen</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <modules>
- <module>workflowgenerator</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <fork>true</fork>
- <source>1.6</source>
- <target>1.6</target>
- <compilerArguments>
- <Xlint/>
- <Xmaxwarns>9999</Xmaxwarns>
- </compilerArguments>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
<id>hadoop-1</id>
<activation>
<activeByDefault>true</activeByDefault>
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 810330d..7df9643 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 4.3.0 release (trunk - unreleased)
+OOZIE-2625 Drop workflowgenerator (rkanter)
OOZIE-2602 Upgrade oozie to pig 0.16.0 (nperiwal via jaydeepvishwakarma)
OOZIE-2493 TestDistcpMain deletes action.xml from wrong filesystem (abhishekbafna via rkanter)
OOZIE-2496 Testcase failure due to environment specific line.separator value (abhishekbafna via rkanter)
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/src/main/assemblies/distro.xml
----------------------------------------------------------------------
diff --git a/src/main/assemblies/distro.xml b/src/main/assemblies/distro.xml
index bdb5351..1ffbfd6 100644
--- a/src/main/assemblies/distro.xml
+++ b/src/main/assemblies/distro.xml
@@ -92,14 +92,6 @@
</includes>
<fileMode>0555</fileMode>
</fileSet>
- <fileSet>
- <directory>${basedir}/../workflowgenerator/target</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>oozie-wfgen.war</include>
- </includes>
- <fileMode>0555</fileMode>
- </fileSet>
<!-- Oozie Login Server Example war and jar -->
<fileSet>
<directory>${basedir}/../login/target</directory>
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/README.txt
----------------------------------------------------------------------
diff --git a/workflowgenerator/README.txt b/workflowgenerator/README.txt
deleted file mode 100644
index 61e2102..0000000
--- a/workflowgenerator/README.txt
+++ /dev/null
@@ -1,138 +0,0 @@
-
-Workflow Generator Tool
-=========================
-
------------------------------------------------
-What is Workflow Generator Tool
------------------------------------------------
-Workflow generator tool is a web application where a user can construct Oozie workflow through GUI.
-Since it is based on html and javascript, a user needs only browser to access the tool. (major browsers such as Chrome, Firefox, IE supported)
-It is developed using Google Web Toolkit ( https://developers.google.com/web-toolkit/ ), which provides functionality to compile java code into javascript.
-Therefore, although final product is in javascript, development process is performed in java.
-
-
--------------------------------------------------------------------------------------
-How to build and launch Workflow Generator Tool as part of entire oozie package build
--------------------------------------------------------------------------------------
-
-1. run mkdistro.sh on top-level directory
----------------------
-bin/mkdistro.sh -P wfgen
----------------------
-[NOTE]
-currently workflow generator is not included in build as default, thus need to specify maven profile (-P wfgen)
-
-2. move to output directory
---------------------
-cd distro/target/oozie-<version>-distro/oozie-<version>
---------------------
-
-3-(a). copy the war file to oozie-server/webapps/
---------------------
-cp oozie-wfgen.war ./oozie-server/webapps
---------------------
-
-or
-
-3-(b). create /libext and copy the war file to it
---------------------
-mkdir libext
-cp oozie-wfgen.war ./libext
---------------------
-[NOTE]
-bin/oozie-setup.sh is implemented such that wfgen.war is automatically picked up and deployed to oozie server
-
-4. start oozie server (using bin/oozie-setup.sh and bin/oozie-start.sh) and check through browser
----------------------
-http://localhost:11000/oozie-wfgen
----------------------
-[NOTE]
-using default port number, which is 11000. tomcat server may fail to start if other application already using the same port. please make sure the port is not used.
-
-
-
-----------------------------------------------------------------------------------------
-How to build and launch Workflow Generator Tool only (not whole package build)
-----------------------------------------------------------------------------------------
-
-There are two possible options
-Option-A) launch app using web server that you are already running (without using bundled tomcat)
-Option-B) launch app in dev mode using bundled internal web server provided by GWT.
-
-Option-A would be suitable when you want to host this application on the existing tomcat instance. You need to copy war file into webapp directory of existing tomcat.
-Option-B would be suitable for development of the tool since you can see error messages for debugging, and don't need to create and copy war file every time
-
-Option-B internally using java class (servlet), not javascript.
-On browser UI, therefore, DOM operation (e.g., creating/deleting nodewidget) might be slower than using pure javascript (Option-A)
-
-===============================================
-<Option-A>
-
-1. build workflowgenerator and create war file
----------------------
-cd workflowgenerator // assuming you are on top directory
-mvn clean package
----------------------
-[NOTE]
-test case not implemented yet
-
-2. copy war file to webapps directory of web server
----------------------
-cp target/oozie-wfgen.war <webserver-installed-directory>/webapps/
----------------------
-
-3. start web server
----------------------
-<webserver-installed-directory>/bin/startup.sh
----------------------
-[NOTE]
-name of start script might be different in your web-server, please change accordingly
-
-4. check through browser
----------------------
-http://localhost:8080/oozie-wfgen
----------------------
-[NOTE]
-port number might not be 8080 in your web-server setting (usually it's default in tomcat), please change accordingly
-
-5. stop web server
----------------------
-<webserver-installed-directory>/bin/shutdown.sh
----------------------
-[NOTE] name of shutdown script might be different in your web-server, please change accordingly
-
-===============================================
-<Option-B>
-
-1. compile and start GWT launcher
----------------------
-cd workflowgenerator // assuming you are on top directory
-mvn clean gwt:run
----------------------
-you will see GWT launcher program automatically starts
-
-2. launch app on browser from GWT launcher
----------------------
-press button either "Launch Default Browser" or "Copy to Clipboard"
-
-"Launcher Default Browser"
- --> automatically open application on default browser
- --> First time, you will be asked to install plug-in on browser, (also take few mins to launch app, pls be patient)
-
-"Copy to Clipboard"
- --> you can copy this link to browser that you like and open it
- --> First time, you will be asked to install plug-in on browser (also take few mins to launch app, pls be patient)
----------------------
-
-if you want to kill process, Ctrl-C in console
-
-
-=====================================================================
-
-If you have any questions/issues, please send an email to:
-
-user@oozie.apache.org
-
-Subscribe using the link:
-
-http://oozie.apache.org/mail-lists.html
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/pom.xml
----------------------------------------------------------------------
diff --git a/workflowgenerator/pom.xml b/workflowgenerator/pom.xml
deleted file mode 100644
index 38e918c..0000000
--- a/workflowgenerator/pom.xml
+++ /dev/null
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.oozie</groupId>
- <artifactId>oozie-main</artifactId>
- <version>4.3.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.oozie</groupId>
- <artifactId>oozie-workflowgenerator</artifactId>
- <version>4.3.0-SNAPSHOT</version>
- <packaging>war</packaging>
- <description>Apache Oozie WorkflowGenerator</description>
- <name>Apache Oozie WorkflowGenerator</name>
-
- <properties>
- <!-- Convenience property to set the GWT version -->
- <gwtVersion>2.5.0-rc1</gwtVersion>
- <!-- GWT needs at least java 1.5 -->
- <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <version>${gwtVersion}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwtVersion}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.0.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.0.GA</version>
- <classifier>sources</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.allen-sauer.gwt.dnd</groupId>
- <artifactId>gwt-dnd</artifactId>
- <version>3.1.2</version>
- </dependency>
- <dependency>
- <groupId>com.orange.links</groupId>
- <artifactId>gwt-links</artifactId>
- <version>1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-incubator</artifactId>
- <version>2.0.1</version>
- </dependency>
- </dependencies>
- <build>
- <!-- Generate compiled stuff in the folder used for developing mode -->
- <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
- <finalName>oozie-wfgen</finalName>
-
- <plugins>
-
- <!-- GWT Maven Plugin -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <version>2.5.0-rc1</version>
- <executions>
- <execution>
- <configuration>
- <module>org.apache.oozie.tools.workflowgenerator.workflowgenerator</module>
- </configuration>
- <goals>
- <goal>compile</goal>
- <goal>test</goal>
- </goals>
- </execution>
- </executions>
- <!-- Plugin configuration. There are many available options, see
- gwt-maven-plugin documentation at codehaus.org -->
- <configuration>
- <runTarget>workflowgenerator.html</runTarget>
- <hostedWebapp>${webappDirectory}</hostedWebapp>
- </configuration>
- </plugin>
-
- <!-- Copy static web files before executing gwt:run -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>exploded</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <webappDirectory>${webappDirectory}</webappDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.8.1</version>
- <configuration>
- <linksource>true</linksource>
- <quiet>true</quiet>
- <verbose>false</verbose>
- <source>${maven.compile.source}</source>
- <charset>${maven.compile.encoding}</charset>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>javadoc</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources/img</directory>
- <targetPath>../../img</targetPath>
- </resource>
- </resources>
- </build>
- <repositories>
- <repository>
- <id>gwt-links</id>
- <url>http://gwt-links.googlecode.com/svn/repository</url>
- </repository>
- </repositories>
-</project>
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/src/main/assemblies/workflowgenerator.xml
----------------------------------------------------------------------
diff --git a/workflowgenerator/src/main/assemblies/workflowgenerator.xml b/workflowgenerator/src/main/assemblies/workflowgenerator.xml
deleted file mode 100644
index 3b780b0..0000000
--- a/workflowgenerator/src/main/assemblies/workflowgenerator.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
--->
-<assembly>
- <id>tomcat</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}/target/${project.artifactId}-${project.version}-tomcat</directory>
- <outputDirectory>${project.artifactId}-${project.version}</outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieDiagramController.java
----------------------------------------------------------------------
diff --git a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieDiagramController.java b/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieDiagramController.java
deleted file mode 100644
index 4e8c8cf..0000000
--- a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieDiagramController.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.tools.workflowgenerator.client;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.oozie.tools.workflowgenerator.client.property.control.WrkflowPropertyTable;
-import org.apache.oozie.tools.workflowgenerator.client.widget.NodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.KillNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.StartNodeWidget;
-
-import com.google.gwt.dom.client.Style.Cursor;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.MenuItem;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.TextArea;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.xml.client.Document;
-import com.google.gwt.xml.client.Element;
-import com.google.gwt.xml.client.Node;
-import com.google.gwt.xml.client.XMLParser;
-import com.orange.links.client.DiagramController;
-import com.orange.links.client.connection.Connection;
-import com.orange.links.client.event.TieLinkEvent;
-import com.orange.links.client.menu.ContextMenu;
-import com.orange.links.client.shapes.FunctionShape;
-
-/**
- * Class to provide a panel where users create node widget or draw a line to
- * construct a workflow
- */
-public class OozieDiagramController extends DiagramController {
-
- private Panel xmlpanel;
- private WrkflowPropertyTable wrkflowtable;
-
- /**
- * Constructor which records canvas size
- *
- * @param canvasWidth width of canvas
- * @param canvasHeight height of canvas
- */
- public OozieDiagramController(int canvasWidth, int canvasHeight) {
- super(canvasWidth, canvasHeight);
- }
-
- /**
- * Constructor which records canvas size and frame size
- *
- * @param canvasWidth width of canvas
- * @param canvasHeight height of canvas
- * @param frameWidth width of frame
- * @param frameHeight height of frame
- */
- public OozieDiagramController(int canvasWidth, int canvasHeight, int frameWidth, int frameHeight) {
- super(canvasWidth, canvasHeight, frameWidth, frameHeight);
- }
-
- /**
- * Initialize right-click context menu
- */
- public void initMenu() {
- canvasMenu = new ContextMenu();
- canvasMenu.addItem(new MenuItem("Generate XML", new Command() {
- @Override
- public void execute() {
- generateXml();
- }
- }));
-
- }
-
- /**
- * Return a list of neighboring node widgets which the specified node widget
- * has connection to
- *
- * @param w node widget
- * @return
- */
- public List<NodeWidget> getCurrentNeighbor(NodeWidget w) {
- List<NodeWidget> current = new ArrayList<NodeWidget>();
- FunctionShape s = widgetShapeMap.get(w);
- Map<Widget, Connection> connectMap = functionsMap.get(w);
- if (connectMap == null) {
- return null;
- }
- for (Iterator<Map.Entry<Widget, Connection>> it = connectMap.entrySet().iterator(); it.hasNext();) {
- Map.Entry<Widget, Connection> entry = it.next();
- Connection c = entry.getValue();
- if (c.getStartShape() == s) {
- FunctionShape e = (FunctionShape) c.getEndShape();
- current.add((NodeWidget) e.asWidget());
- }
- }
-
- return current;
- }
-
- /**
- * Return a list of connections that the specified node widget has
- *
- * @param w node widget
- * @return
- */
- public List<Connection> getConnection(NodeWidget w) {
- List<Connection> li = new ArrayList<Connection>();
- FunctionShape shape = widgetShapeMap.get(w);
- for (Connection c : shape.getConnections()) {
- li.add(c);
- }
- return li;
- }
-
- /**
- * Add a new connection from one node widget to the other, while deleting
- * existing connection that the start node widget has if any
- *
- * @param start start node widget
- * @param end end node widget
- */
- public void addConnection(NodeWidget start, NodeWidget end) {
- boolean exists = false;
- FunctionShape s1 = widgetShapeMap.get(start);
- FunctionShape s2 = widgetShapeMap.get(end);
- Connection current = null;
- for (Connection c : s1.getConnections()) {
- if (c.getStartShape() == s1) {
- current = c;
- }
- if (c.getEndShape() == s2) {
- exists = true;
- break;
- }
- }
- if (!exists) {
- if (current != null) {
- this.deleteConnection(current);
- s1.removeConnection(current);
- s2.removeConnection(current);
- }
- Connection c = drawStraightArrowConnection(start, end);
- fireEvent(new TieLinkEvent(start, end, c));
- }
- }
-
- /**
- * Add a new connection from one node widget to the other without deleting
- * existing connection that the starting node widget has
- *
- * @param start start node widget
- * @param end end node widget
- * @return
- */
- public Connection addMultiConnection(NodeWidget start, NodeWidget end) {
- boolean exists = false;
- FunctionShape s1 = widgetShapeMap.get(start);
- FunctionShape s2 = widgetShapeMap.get(end);
- Connection conn = null;
-
- for (Connection c : s1.getConnections()) {
- if (c.getEndShape() == s2) {
- exists = true;
- break;
- }
- }
- if (!exists) {
- conn = drawStraightArrowConnection(start, end);
- fireEvent(new TieLinkEvent(start, end, conn));
- }
-
- return conn;
- }
-
- /**
- * Return a connection between node widgets
- *
- * @param start start node widget
- * @param end end node widget
- * @return
- */
- public Connection getConnection(NodeWidget start, NodeWidget end) {
-
- Connection conn = null;
- Map<Widget, Connection> m = (Map<Widget, Connection>) functionsMap.get(start);
- if (m != null) {
- conn = (Connection) m.get(end);
- }
- return conn;
- }
-
- /**
- * Return if there is a connection between node widgets
- *
- * @param start start node widget
- * @param end end node widget
- * @return
- */
- public boolean isConnected(NodeWidget start, NodeWidget end) {
- return functionsMap.get(start).containsKey(end);
- }
-
- /**
- * Remove a connection between node widgets
- *
- * @param start start node widget
- * @param end end node widget
- */
- public void removeConnection(NodeWidget start, NodeWidget end) {
-
- FunctionShape s1 = widgetShapeMap.get(start);
- FunctionShape s2 = widgetShapeMap.get(end);
-
- if (functionsMap.get(start).containsKey(end)) {
- Connection c = functionsMap.get(start).get(end);
- this.deleteConnection(c);
- s1.removeConnection(c);
- s2.removeConnection(c);
- functionsMap.get(start).remove(end);
- }
- }
-
- /**
- * Set a panel to display generated xml
- *
- * @param w
- */
- public void setXmlPanel(Panel w) {
- this.xmlpanel = w;
- }
-
- /**
- * Generate a xml document of the current workflow
- */
- public void generateXml() {
-
- Document xmldoc = null;
- xmldoc = (Document) XMLParser.createDocument();
-
- // initialize visit-flag of all widgets
- for (Widget w : widgetShapeMap.keySet()) {
- ((NodeWidget) w).unvisit();
- }
-
- NodeWidget current = null;
- NodeWidget next = null;
- LinkedList<NodeWidget> queue = new LinkedList<NodeWidget>();
-
- String appname = "visualizationApp";
- if (wrkflowtable != null) {
- appname = wrkflowtable.getName();
- }
- Element root = xmldoc.createElement("workflow-app");
- root.setAttribute("xmlns", wrkflowtable.getNameSpace());
- root.setAttribute("name", appname);
- xmldoc.appendChild(root);
-
- wrkflowtable.generateXML(xmldoc, root, null);
-
- for (Connection c : this.connections) {
- FunctionShape startShape = (FunctionShape) c.getStartShape();
- NodeWidget w = (NodeWidget) startShape.asWidget();
- if (w instanceof StartNodeWidget) {
- queue.add(w);
- break;
- }
- }
-
- while ((current = queue.poll()) != null) {
-
- if (current.isVisited()) {
- continue;
- }
- Map<Widget, Connection> nextMap = this.functionsMap.get(current);
- if (nextMap == null) {
- next = null;
- }
- else {
- for (Iterator itr = nextMap.keySet().iterator(); itr.hasNext();) {
- next = (NodeWidget) itr.next();
- queue.add(next);
- }
- }
- current.generateXML(xmldoc, root, next);
- current.visit();
- }
-
- // Adding Kill Node
- for (Widget w : this.widgetShapeMap.keySet()) {
- if (w instanceof KillNodeWidget) {
- ((KillNodeWidget) w).generateXML(xmldoc, root, null);
- }
- }
-
- xmlpanel.clear();
- TextArea xml = new TextArea();
- xml.getElement().setScrollTop(xml.getElement().getScrollHeight());
- xml.setCharacterWidth(80);
- xml.setVisibleLines(30);
- xml.setText(formatXML(root, " "));
- xmlpanel.add(xml);
-
- }
-
- /**
- * Format generated xml doc by indentation
- *
- * @param node
- * @param indent
- * @return
- */
- protected String formatXML(Node node, String indent) {
- StringBuilder formatted = new StringBuilder();
-
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- StringBuilder attributes = new StringBuilder();
- for (int k = 0; k < node.getAttributes().getLength(); k++) {
- attributes.append(" ");
- attributes.append(node.getAttributes().item(k).getNodeName());
- attributes.append("=\"");
- attributes.append(node.getAttributes().item(k).getNodeValue());
- attributes.append("\"");
- }
-
- formatted.append(indent);
- formatted.append("<");
- formatted.append(node.getNodeName());
- formatted.append(attributes.toString());
- if (!node.hasChildNodes() || (node.hasChildNodes() && node.getFirstChild().getNodeType() == Node.TEXT_NODE)) {
- formatted.append(">");
- }
- else {
- formatted.append(">\n");
- }
-
- for (int i = 0; i < node.getChildNodes().getLength(); i++) {
- formatted.append(formatXML(node.getChildNodes().item(i), indent + " "));
- }
-
- if (node.hasChildNodes() && node.getFirstChild().getNodeType() != Node.TEXT_NODE) {
- formatted.append(indent);
- }
- formatted.append("</");
- formatted.append(node.getNodeName());
- formatted.append(">\n");
- }
- else {
- if (node.toString().trim().length() > 0) {
- formatted.append(node.toString());
- }
- }
-
- return formatted.toString();
- }
-
- /**
- * Update a diagram controller
- */
- @Override
- public void update() {
- redrawConnections();
-
- // If the user is dragging widgets, do nothing
- if (inDragWidget) {
- return;
- }
- topCanvas.clear();
-
- // Search for selectable area
- if (!inDragBuildArrow) {
- for (FunctionShape s : shapes) {
- if (s.isMouseNearSelectableArea(mousePoint)) {
- s.highlightSelectableArea(mousePoint);
- inEditionSelectableShapeToDrawConnection = true;
- startFunctionWidget = s.asWidget();
- RootPanel.getBodyElement().getStyle().setCursor(Cursor.POINTER);
- return;
- }
- inEditionSelectableShapeToDrawConnection = false;
- }
- }
- else {
- // Don't go deeper if in edition mode
- // If mouse over a widget, highlight it
- FunctionShape s = getShapeUnderMouse();
- if (s != null) {
- s.drawHighlight();
- highlightFunctionShape = s;
- }
- else if (highlightFunctionShape != null) {
- highlightFunctionShape.draw();
- highlightFunctionShape = null;
- }
- clearAnimationsOnCanvas();
- }
-
- // Test if in Drag Movable Point
- if (!inDragMovablePoint && !inDragBuildArrow) {
- for (Connection c : connections) {
- if (c.isMouseNearConnection(mousePoint)) {
- highlightPoint = c.highlightMovablePoint(mousePoint);
- highlightConnection = getConnectionNearMouse();
- inEditionDragMovablePoint = true;
- RootPanel.getBodyElement().getStyle().setCursor(Cursor.POINTER);
- return;
- }
- inEditionDragMovablePoint = false;
- }
- }
-
- clearAnimationsOnCanvas();
- }
-
- /**
- * Return a workflow property table
- *
- * @return
- */
- public WrkflowPropertyTable getWrkflowPropertyTable() {
- return wrkflowtable;
- }
-
- /**
- * Set a workflow property table
- *
- * @param t Workflow property table
- */
- public void setWrkflowPropertyTable(WrkflowPropertyTable t) {
- this.wrkflowtable = t;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieWorkflowGenerator.java
----------------------------------------------------------------------
diff --git a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieWorkflowGenerator.java b/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieWorkflowGenerator.java
deleted file mode 100644
index 113a401..0000000
--- a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/OozieWorkflowGenerator.java
+++ /dev/null
@@ -1,765 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.tools.workflowgenerator.client;
-
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-
-import org.apache.oozie.tools.workflowgenerator.client.OozieDiagramController;
-import org.apache.oozie.tools.workflowgenerator.client.property.PropertyTable;
-import org.apache.oozie.tools.workflowgenerator.client.property.control.WrkflowPropertyTable;
-import org.apache.oozie.tools.workflowgenerator.client.widget.NodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.EmailActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.FSActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.JavaActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.MapReduceActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.PigActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.PipesActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.SSHActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.ShellActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.StreamingActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.action.SubWFActionWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.DecisionNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.EndNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.ForkNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.JoinNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.KillNodeWidget;
-import org.apache.oozie.tools.workflowgenerator.client.widget.control.StartNodeWidget;
-
-import com.allen_sauer.gwt.dnd.client.PickupDragController;
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Random;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.*;
-
-/**
- * Main class of application
- * <p>
- * implements EntryPoint class which defines <code>onModuleLoad()</code>.
- */
-public class OozieWorkflowGenerator implements EntryPoint {
-
- private static final int ZINDEX_FRONT_OF_GRID = 10;
-
- private PickupDragController dragController;
- private OozieDiagramController controller;
- private Panel propPanel;
- private List<NodeWidget> widgets;
- private StartNodeWidget start;
- private EndNodeWidget end;
- private KillNodeWidget kill;
- private WrkflowPropertyTable wrkflowtable;
- private NodeWidget node;
- private EnumMap<NodeType, Integer> nodeCount;
-
- enum NodeType {
- START, END, KILL, FORK, JOIN, DECISION, MAPREDUCE, PIG, FS, JAVA, PIPES, STREAMING, SHELL, SSH, EMAIL, SUBWF
- };
-
- /**
- * Return a set of created node widgets in a workflow design panel
- *
- * @return
- */
- public List<NodeWidget> getWidgets() {
- return this.widgets;
- }
-
- /**
- * Set and display the property table of a selected node widget
- *
- * @param table
- */
- public void setPropertyTable(PropertyTable table) {
- propPanel.clear();
- propPanel.add(table);
- }
-
- /**
- * Return an instance of current diagram controller
- *
- * @return
- */
- public OozieDiagramController getDiagramController() {
- return this.controller;
- }
-
- /**
- * Return the currently selected node widget
- *
- * @return
- */
- public NodeWidget getNodeWidget() {
- return this.node;
- }
-
- /**
- * Set the current node widget
- *
- * @param n node widget
- */
- protected void setNodeWidget(NodeWidget n) {
- this.node = n;
- }
-
- /**
- * onModuleLoad is the entry point method.
- */
- @SuppressWarnings("deprecation")
- public void onModuleLoad() {
-
- widgets = new ArrayList<NodeWidget>();
- nodeCount = new EnumMap<OozieWorkflowGenerator.NodeType, Integer>(NodeType.class);
-
- // start DiagramController (gwt-links library)
- controller = new OozieDiagramController(1200, 600);
- controller.showGrid(true); // Display a background grid
-
- // start PickUpDragContoller (gwt-Drag-and-Drop library)
- dragController = new PickupDragController(controller.getView(), true);
-
- // register the dragController in GWT-Links
- controller.registerDragController(dragController);
-
- // panel for Property Table
- propPanel = new AbsolutePanel();
-
- // stack Layout for left-side tree-view
- StackLayoutPanel stack = new StackLayoutPanel(Unit.EM);
-
- // create left tree-view panel
- stack.add(initNodeTree(), new HTML("Nodes"), 2);
- stack.add(initWrkflowTree(), new HTML("Workflow"), 2);
-
- initWidget();
-
- // Create a three-pane layout with splitters.
- SplitLayoutPanel p = new SplitLayoutPanel();
-
- Panel east = new AbsolutePanel();
-
- // Create a top panel under menu to hold button (e.g, generate xml)
- AbsolutePanel btnpanl = new AbsolutePanel();
- Button btn = createXMLButton();
- btnpanl.add(btn);
-
- p.addNorth(initMenu(), 30);
- p.addEast(east, 250);
- p.addSouth(propPanel, 300);
- p.addWest(stack, 150);
- p.addNorth(btnpanl, 30);
- ((OozieDiagramController) controller).setXmlPanel(east);
- p.add(controller.getView());
-
- // Attach the LayoutPanel to the RootLayoutPanel.
- RootLayoutPanel rp = RootLayoutPanel.get();
- rp.add(p);
-
- }
-
- /**
- * Create a "Generate XML" button
- *
- * @return
- */
- public Button createXMLButton() {
- Button btn = new Button("Generate XML");
- btn.addClickHandler(new ClickHandler() {
-
- @Override
- public void onClick(ClickEvent event) {
- ((OozieDiagramController) controller).generateXml();
- }
- });
- return btn;
- }
-
- /**
- * Initialize a default set of node widgets shown in a workflow design
- * panel, such as start, end, kill nodes
- */
- public void initWidget() {
-
- if (wrkflowtable == null) {
- wrkflowtable = new WrkflowPropertyTable(null);
- ((OozieDiagramController) controller).setWrkflowPropertyTable(wrkflowtable);
- }
-
- // display Start/End/Kill Nodes as default
- if (start == null) {
- start = new StartNodeWidget(this);
- controller.addWidget(start, 30, 100);
- dragController.makeDraggable(start);
- widgets.add(start);
- }
-
- if (end == null) {
- end = new EndNodeWidget(this);
- end.setName("End");
- controller.addWidget(end, 600, 100);
- dragController.makeDraggable(end);
- widgets.add(end);
- }
-
- if (kill == null) {
- kill = new KillNodeWidget(this);
- kill.setName("Kill");
- controller.addWidget(kill, 700, 100);
- dragController.makeDraggable(kill);
- widgets.add(kill);
- }
- }
-
- /**
- * Initialize workflow tree-view menu on left side
- *
- * @return
- */
- public Tree initWrkflowTree() {
- Tree t = new Tree();
- TreeItem actionTree = new TreeItem("Property");
- t.addItem(actionTree);
- t.addSelectionHandler(new SelectionHandler<TreeItem>() {
-
- @Override
- public void onSelection(SelectionEvent<TreeItem> event) {
- TreeItem item = event.getSelectedItem();
- String name = item.getText();
- if (name.equals("Property") && wrkflowtable != null) {
- setPropertyTable(wrkflowtable);
- }
- }
- });
-
- return t;
- }
-
- /**
- * Initialize node tree-view menu on left side
- *
- * @return
- */
- public Tree initNodeTree() {
-
- Tree t = new Tree();
-
- // Action Node Tree
- TreeItem actionTree = new TreeItem("Action Node");
- TreeItem mrTree = new TreeItem("MapReduce");
- mrTree.addItem("Streaming");
- mrTree.addItem("Pipes");
- actionTree.addItem(mrTree);
- actionTree.addItem("Pig");
- actionTree.addItem("Java");
- actionTree.addItem("FS");
- actionTree.addItem("Subworkflow");
- actionTree.addItem("SSH");
- actionTree.addItem("Shell");
- actionTree.addItem("Email");
-
- // Control Node Tree
- TreeItem controlTree = new TreeItem("Control Node");
- controlTree.addItem("Start");
- controlTree.addItem("End");
- controlTree.addItem("Kill");
- controlTree.addItem("Fork/Join");
- controlTree.addItem("Decision");
-
- t.addItem(actionTree);
- t.addItem(controlTree);
-
- // Event Handler
- t.addSelectionHandler(new SelectionHandler<TreeItem>() {
-
- @Override
- public void onSelection(SelectionEvent<TreeItem> event) {
- TreeItem item = event.getSelectedItem();
- String name = item.getText();
- if (name.equals("MapReduce")) {
- MapReduceActionWidget w = new MapReduceActionWidget(OozieWorkflowGenerator.this);
- w.setName("MR_".concat(nodeCount.get(NodeType.MAPREDUCE) != null ? nodeCount
- .get(NodeType.MAPREDUCE).toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("Streaming")) {
- StreamingActionWidget w = new StreamingActionWidget(OozieWorkflowGenerator.this);
- w.setName("Streaming_".concat(nodeCount.get(NodeType.STREAMING) != null ? nodeCount.get(
- NodeType.STREAMING).toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("Pipes")) {
- PipesActionWidget w = new PipesActionWidget(OozieWorkflowGenerator.this);
- w.setName("Pipes_".concat(nodeCount.get(NodeType.PIPES) != null ? nodeCount.get(NodeType.PIPES)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("Pig")) {
- PigActionWidget w = new PigActionWidget(OozieWorkflowGenerator.this);
- w.setName("Pig_".concat(nodeCount.get(NodeType.PIG) != null ? nodeCount.get(NodeType.PIG)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("Java")) {
- JavaActionWidget w = new JavaActionWidget(OozieWorkflowGenerator.this);
- w.setName("Java_".concat(nodeCount.get(NodeType.JAVA) != null ? nodeCount.get(NodeType.JAVA)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("FS")) {
- FSActionWidget w = new FSActionWidget(OozieWorkflowGenerator.this);
- w.setName("FS_".concat(nodeCount.get(NodeType.FS) != null ? nodeCount.get(NodeType.FS).toString()
- : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- else if (name.equals("SSH")) {
- SSHActionWidget w = new SSHActionWidget(OozieWorkflowGenerator.this);
- w.setName("SSH_".concat(nodeCount.get(NodeType.SSH) != null ? nodeCount.get(NodeType.SSH)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- }
- else if (name.equals("Email")) {
- EmailActionWidget w = new EmailActionWidget(OozieWorkflowGenerator.this);
- w.setName("Email_".concat(nodeCount.get(NodeType.EMAIL) != null ? nodeCount.get(NodeType.EMAIL)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- }
- else if (name.equals("Shell")) {
- ShellActionWidget w = new ShellActionWidget(OozieWorkflowGenerator.this);
- w.setName("Shell_".concat(nodeCount.get(NodeType.SHELL) != null ? nodeCount.get(NodeType.SHELL)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- }
- else if (name.equals("Subworkflow")) {
- SubWFActionWidget w = new SubWFActionWidget(OozieWorkflowGenerator.this);
- w.setName("SubWF_".concat(nodeCount.get(NodeType.SUBWF) != null ? nodeCount.get(NodeType.SUBWF)
- .toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- }
- else if (name.equals("Start")) {
- if (start == null) {
- StartNodeWidget w = new StartNodeWidget(OozieWorkflowGenerator.this);
- start = w;
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- }
- else if (name.equals("End")) {
- if (end == null) {
- EndNodeWidget w = new EndNodeWidget(OozieWorkflowGenerator.this);
- w.setName("End");
- end = w;
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- }
- else if (name.equals("Kill")) {
- if (kill == null) {
- KillNodeWidget w = new KillNodeWidget(OozieWorkflowGenerator.this);
- w.setName("Kill");
- kill = w;
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- }
- else if (name.equals("Fork/Join")) {
- ForkNodeWidget fork = new ForkNodeWidget(OozieWorkflowGenerator.this);
- fork.setName("Fork_".concat(nodeCount.get(NodeType.FORK) != null ? nodeCount.get(NodeType.FORK)
- .toString() : "0"));
- addWidget(fork, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- JoinNodeWidget join = new JoinNodeWidget(OozieWorkflowGenerator.this);
- join.setName("Join_".concat(nodeCount.get(NodeType.JOIN) != null ? nodeCount.get(NodeType.JOIN)
- .toString() : "0"));
- addWidget(join, 90 + Random.nextInt(30), 30 + Random.nextInt(30));
-
- }
- else if (name.equals("Decision")) {
- DecisionNodeWidget w = new DecisionNodeWidget(OozieWorkflowGenerator.this);
- w.setName("Decision_".concat(nodeCount.get(NodeType.DECISION) != null ? nodeCount.get(
- NodeType.DECISION).toString() : "0"));
- addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30));
- }
- }
- });
-
- return t;
- }
-
- /**
- * Initialize menu panel on top
- *
- * @return
- */
- public MenuBar initMenu() {
-
- // Menu bar
- Command cmd = new Command() {
- public void execute() {
- Window.alert("To be implemented soon");
- }
- };
-
- Command mr_cmd = new Command() {
- public void execute() {
- initWidget();
- MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this);
- mr.setName("MR_0");
- addWidget(mr, 300, 100);
- ((OozieDiagramController) controller).addConnection(start, mr);
- ((OozieDiagramController) controller).addConnection(mr, end);
- mr.updateOnSelection();
- }
- };
-
- Command pig_cmd = new Command() {
-
- public void execute() {
- clear();
- initWidget();
- PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this);
- pig.setName("Pig_0");
- addWidget(pig, 300, 100);
- ((OozieDiagramController) controller).addConnection(start, pig);
- ((OozieDiagramController) controller).addConnection(pig, end);
- pig.updateOnSelection();
- }
- };
-
- Command java_cmd = new Command() {
-
- public void execute() {
- clear();
- initWidget();
- JavaActionWidget java = new JavaActionWidget(OozieWorkflowGenerator.this);
- java.setName("Java_0");
- addWidget(java, 300, 100);
- ((OozieDiagramController) controller).addConnection(start, java);
- ((OozieDiagramController) controller).addConnection(java, end);
- java.updateOnSelection();
- }
- };
-
- Command forkjoin_cmd = new Command() {
-
- public void execute() {
- clear();
- initWidget();
- ForkNodeWidget fork = new ForkNodeWidget(OozieWorkflowGenerator.this);
- fork.setName("Fork_0");
- addWidget(fork, 150, 100);
- ((OozieDiagramController) controller).addConnection(start, fork);
-
- MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this);
- mr.setName("MR_0");
- addWidget(mr, 300, 30);
- ((OozieDiagramController) controller).addMultiConnection(fork, mr);
-
- PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this);
- pig.setName("Pig_0");
- addWidget(pig, 300, 200);
- ((OozieDiagramController) controller).addMultiConnection(fork, pig);
-
- JoinNodeWidget join = new JoinNodeWidget(OozieWorkflowGenerator.this);
- join.setName("Join_0");
- addWidget(join, 450, 100);
- ((OozieDiagramController) controller).addConnection(mr, join);
- ((OozieDiagramController) controller).addConnection(pig, join);
- ((OozieDiagramController) controller).addConnection(join, end);
-
- fork.updateOnSelection();
- join.updateOnSelection();
- mr.updateOnSelection();
- pig.updateOnSelection();
- }
- };
-
- Command clear_cmd = new Command() {
-
- public void execute() {
- clear();
- }
-
- };
-
- MenuBar fileMenu = new MenuBar(true);
- fileMenu.setAutoOpen(true);
- fileMenu.setAnimationEnabled(true);
- fileMenu.addItem("New", cmd);
- fileMenu.addItem("Open", cmd);
- fileMenu.addItem("Load XML", cmd);
- fileMenu.addItem("Save", cmd);
- fileMenu.addItem("Save As..", cmd);
- fileMenu.addItem("Generate XML", cmd);
- fileMenu.addItem("Print", cmd);
- fileMenu.addItem("Quit", cmd);
-
- MenuBar editMenu = new MenuBar(true);
- editMenu.setAutoOpen(true);
- editMenu.setAnimationEnabled(true);
- editMenu.addItem("Undo", cmd);
- editMenu.addItem("Redo", cmd);
- editMenu.addItem("Copy", cmd);
- editMenu.addItem("Cut", cmd);
- editMenu.addItem("Paste", cmd);
- editMenu.addItem("Duplicate", cmd);
- editMenu.addItem("Delete", cmd);
- editMenu.addItem("Clear Diagram", clear_cmd);
-
- MenuBar examples = new MenuBar(true);
- examples.setAutoOpen(true);
- examples.setAnimationEnabled(true);
- examples.addItem("wrkflow with MR action", mr_cmd);
- examples.addItem("wrkflow with Pig action", pig_cmd);
- examples.addItem("wrkflow with Java action", java_cmd);
- examples.addItem("wrkflow with Fork/Join ", forkjoin_cmd);
-
- MenuBar helpMenu = new MenuBar(true);
- helpMenu.setAutoOpen(true);
- helpMenu.setAnimationEnabled(true);
-
- // TODO this should point to a workflowgenerator's maven site, however there is no maven site available. (Not even in
- // Workspace of the jenkins job at https://builds.apache.org/job/oozie-trunk-precommit-build/ws/workflowgenerator/target/)
- // where client, for example, has target/site/apidocs
- // The ideal place is somewhere under http://oozie.apache.org/docs/ once it is generated.
- Command openOozieTopPageComman = new Command() {
- @Override
- public void execute() {
- Window.open("http://oozie.apache.org/", "_blank", "");
- }
- };
- helpMenu.addItem("Documentation", openOozieTopPageComman);
- helpMenu.addItem("Online Help", openOozieTopPageComman);
-
-
- Command aboutCommand = new Command() {
- @Override
- public void execute() {
- // Dialogbox
- final DialogBox d = new DialogBox(false, true);
- d.setGlassEnabled(true);
- d.setText("About Oozie Workflow Generator");
- d.center();
-
- // Set this to workaround the grid z-index issue https://issues.apache.org/jira/browse/OOZIE-1081
- d.getElement().getStyle().setZIndex(ZINDEX_FRONT_OF_GRID);
-
- // About text
- VerticalPanel vpanel = new VerticalPanel();
- vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
- vpanel.setSpacing(10);
- vpanel.setWidth("150");
- vpanel.add(new Label("Oozie Workflow Generator"));
- vpanel.add(new Label("Version 3.4.0-SNAPSHOT")); // TODO how to get a version number from pom?
-
- // OK button to close
- Button ok = new Button("OK");
- ok.addClickHandler(new ClickHandler(){
- @Override
- public void onClick(ClickEvent event) {
- d.hide();
- }
-
- });
-
- vpanel.add(ok);
- d.setWidget(vpanel);
- d.show();
-
- }
- };
- helpMenu.addItem("About", aboutCommand);
-
- MenuBar menu = new MenuBar();
- menu.addItem("File", fileMenu);
- menu.addItem("Edit", editMenu);
- menu.addItem("Example", examples);
- menu.addItem("Help", helpMenu);
-
- return menu;
- }
-
- /**
- * Add a new node widget
- *
- * @param w node widget
- * @param x x-coordinate
- * @param y y-coordinate
- */
- public void addWidget(NodeWidget w, int x, int y) {
- controller.addWidget(w, x, y);
- changeNodeCount(w, true);
- dragController.makeDraggable(w);
- widgets.add(w);
- }
-
- /**
- * Remove a node widget
- *
- * @param w node widget
- */
- public void removeWidget(NodeWidget w) {
- controller.deleteWidget(w);
- widgets.remove(w);
- if (w instanceof StartNodeWidget) {
- start = null;
- }
- else if (w instanceof EndNodeWidget) {
- end = null;
- }
- else if (w instanceof KillNodeWidget) {
- kill = null;
- }
- changeNodeCount(w, false);
- }
-
- /**
- * Increment/Decrement count of node widget type
- *
- * @param w nodeWidget
- * @param increment true: increment, false: decrement
- */
- protected void changeNodeCount(NodeWidget w, boolean increment) {
- int i = 0;
- if (w instanceof MapReduceActionWidget) {
- if (nodeCount.containsKey(NodeType.MAPREDUCE)) {
- i = nodeCount.get(NodeType.MAPREDUCE);
- }
- updateNodeCountMap(NodeType.MAPREDUCE, increment, i);
- }
- else if (w instanceof PigActionWidget) {
- if (nodeCount.containsKey(NodeType.PIG)) {
- i = nodeCount.get(NodeType.PIG);
- }
- updateNodeCountMap(NodeType.PIG, increment, i);
- }
- else if (w instanceof JavaActionWidget) {
- if (nodeCount.containsKey(NodeType.JAVA)) {
- i = nodeCount.get(NodeType.JAVA);
- }
- updateNodeCountMap(NodeType.JAVA, increment, i);
- }
- else if (w instanceof FSActionWidget) {
- if (nodeCount.containsKey(NodeType.FS)) {
- i = nodeCount.get(NodeType.FS);
- }
- updateNodeCountMap(NodeType.FS, increment, i);
- }
- else if (w instanceof PipesActionWidget) {
- if (nodeCount.containsKey(NodeType.PIPES)) {
- i = nodeCount.get(NodeType.PIPES);
- }
- updateNodeCountMap(NodeType.PIPES, increment, i);
- }
- else if (w instanceof StreamingActionWidget) {
- if (nodeCount.containsKey(NodeType.STREAMING)) {
- i = nodeCount.get(NodeType.STREAMING);
- }
- updateNodeCountMap(NodeType.STREAMING, increment, i);
- }
- else if (w instanceof ShellActionWidget) {
- if (nodeCount.containsKey(NodeType.SHELL)) {
- i = nodeCount.get(NodeType.SHELL);
- }
- updateNodeCountMap(NodeType.SHELL, increment, i);
- }
- else if (w instanceof SSHActionWidget) {
- if (nodeCount.containsKey(NodeType.SSH)) {
- i = nodeCount.get(NodeType.SSH);
- }
- updateNodeCountMap(NodeType.SSH, increment, i);
- }
- else if (w instanceof EmailActionWidget) {
- if (nodeCount.containsKey(NodeType.EMAIL)) {
- i = nodeCount.get(NodeType.EMAIL);
- }
- updateNodeCountMap(NodeType.EMAIL, increment, i);
- }
- else if (w instanceof SubWFActionWidget) {
- if (nodeCount.containsKey(NodeType.SUBWF)) {
- i = nodeCount.get(NodeType.SUBWF);
- }
- updateNodeCountMap(NodeType.SUBWF, increment, i);
- }
- else if (w instanceof StartNodeWidget) {
- if (nodeCount.containsKey(NodeType.START)) {
- i = nodeCount.get(NodeType.START);
- }
- updateNodeCountMap(NodeType.START, increment, i);
- }
- else if (w instanceof EndNodeWidget) {
- if (nodeCount.containsKey(NodeType.END)) {
- i = nodeCount.get(NodeType.END);
- }
- updateNodeCountMap(NodeType.END, increment, i);
- }
- else if (w instanceof KillNodeWidget) {
- if (nodeCount.containsKey(NodeType.KILL)) {
- i = nodeCount.get(NodeType.KILL);
- }
- updateNodeCountMap(NodeType.KILL, increment, i);
- }
- else if (w instanceof ForkNodeWidget) {
- if (nodeCount.containsKey(NodeType.FORK)) {
- i = nodeCount.get(NodeType.FORK);
- }
- updateNodeCountMap(NodeType.FORK, increment, i);
- }
- else if (w instanceof JoinNodeWidget) {
- if (nodeCount.containsKey(NodeType.JOIN)) {
- i = nodeCount.get(NodeType.JOIN);
- }
- updateNodeCountMap(NodeType.JOIN, increment, i);
- }
- else if (w instanceof DecisionNodeWidget) {
- if (nodeCount.containsKey(NodeType.DECISION)) {
- i = nodeCount.get(NodeType.DECISION);
- }
- updateNodeCountMap(NodeType.DECISION, increment, i);
- }
- }
-
- private void updateNodeCountMap(NodeType type, boolean increment, int i) {
- if (increment) {
- nodeCount.put(type, i + 1);
- }
- else {
- nodeCount.put(type, i - 1);
- }
- }
-
- /**
- * Remove all node widgets in a workflow design panel
- */
- public void clear() {
- controller.clearDiagram();
- widgets.clear();
- nodeCount.clear();
- start = null;
- end = null;
- kill = null;
- }
-}
http://git-wip-us.apache.org/repos/asf/oozie/blob/aec39dd2/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/property/Property.java
----------------------------------------------------------------------
diff --git a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/property/Property.java b/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/property/Property.java
deleted file mode 100644
index 925befc..0000000
--- a/workflowgenerator/src/main/java/org/apache/oozie/tools/workflowgenerator/client/property/Property.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.tools.workflowgenerator.client.property;
-
-/**
- * class to provide key-value pair for property, mostly used in property table
- */
-public class Property {
-
- private String name;
- private String value;
-
- /**
- * Constructor which records name and value
- *
- * @param name name
- * @param value value
- */
- public Property(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Return a name of property
- *
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set a name of property
- *
- * @param name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Return a value of property
- *
- * @return
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Set a value of property
- *
- * @param value
- */
- public void setValue(String value) {
- this.value = value;
- }
-}