You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2017/07/16 20:58:25 UTC
[3/5] oodt git commit: OODT-837: cleanup.
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/build.xml
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/build.xml b/tools/pdi_plugin/build.xml
deleted file mode 100644
index db9e523..0000000
--- a/tools/pdi_plugin/build.xml
+++ /dev/null
@@ -1,68 +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.
--->
-<!--===========================================================================
- This is the build file for the PDI SDK Step Plugin
-
- This build file will use the subfloor.xml file as the default build
- process and should only override the tasks that need to differ from
- the common build file.
-============================================================================-->
-<project name="kettle-sdk-step-plugin" basedir="." default="default">
-
- <description>
- This build file works with the subfloor.xml file.
- </description>
-
- <!-- Import the subfloor-pkg.xml file which contains all the default tasks -->
- <import file="build-res/subfloor-pkg.xml" />
-
- <!--
- AS STATED ABOVE, THE ONLY TASKS THAT SHOULD EXIST IN THIS BUILD FILE ARE
- THE TASKS THAT NEED TO DIFFER FROM THE DEFAULT IMPLEMENTATION OF THE TASKS
- FOUND IN common_build.xml.
- -->
-
- <!--
- override to:
- - include the source directly (this is SDK demo code)
- - include kettle dependency jars
- - include the build folder (used by the SDK user to build the plugin)
- - include eclipse project files for convenience
- -->
- <target name="assemble.copy-libs">
-
- <copy todir="${approot.stage.dir}/lib">
- <fileset dir="${lib.dir}"/>
- </copy>
-
- <copy todir="${approot.stage.dir}/src">
- <fileset dir="src" excludes="**/.DS_Store" />
- </copy>
-
- <copy todir="${approot.stage.dir}/build">
- <fileset dir="build" />
- </copy>
-
- <!--<copy file="eclipse/classpath.xml" tofile="${approot.stage.dir}/.classpath">
- <filterset>
- <filter token="PROJECT-REVISION" value="${project.revision}"/>
- <filter token="METASTORE-REVISION" value="${dependency.pentaho-metadata.revision}"/>
- </filterset>
- </copy>-->
- <!--<copy file="eclipse/project.xml" tofile="${approot.stage.dir}/.project" />-->
-
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/build/build.properties
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/build/build.properties b/tools/pdi_plugin/build/build.properties
deleted file mode 100644
index 50da26c..0000000
--- a/tools/pdi_plugin/build/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# Please adjust to point to your data-integration folder if you'd like the
-# ant script to be able to install the compiled plugin automatically
-kettle-dir=/Applications/pentaho/design-tools/data-integration
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/build/build.xml
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/build/build.xml b/tools/pdi_plugin/build/build.xml
deleted file mode 100644
index 4f00648..0000000
--- a/tools/pdi_plugin/build/build.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0"?>
-<project name="PdiSdkDemoStepPlugin" default="dist" basedir="..">
- <description>
- Build file for a PDI step plugin
- </description>
-
- <!-- you can use this file to set the kettle-dir property or change it directly below -->
- <property file="build/build.properties" />
-
- <!-- set global properties for this build -->
- <property name="src" location="src" />
- <property name="classes" location="classes" />
- <property name="dist" location="dist" />
- <property name="diststep" location="${dist}/steps/Demo" />
- <property name="pluginname" value="Demo" />
- <property name="jarfilename" value="demo-step.jar" />
-
- <!-- used to compile code -->
- <path id="compile.classpath">
- <fileset dir="${basedir}/lib">
- <include name="**/*.jar" />
- </fileset>
- </path>
-
- <target name="init">
- <tstamp />
- </target>
-
- <target name="compile" depends="init" description="compile the source ">
- <mkdir dir="${classes}" />
- <javac source="1.6" target="1.6" srcdir="${src}" destdir="${classes}" debuglevel="lines,vars,source" debug="true">
- <classpath refid="compile.classpath" />
-
- </javac>
- </target>
-
- <target name="dist" depends="compile" description="generate the distribution">
-
- <mkdir dir="${diststep}" />
-
- <!-- jar things up, also add the properties files (messages) and the icon -->
- <copy todir="${classes}">
- <fileset dir="${src}" includes="**/*.properties" />
- <fileset dir="${src}" includes="**/*.png" />
- </copy>
-
- <!-- jar class up -->
- <jar jarfile="${diststep}/${jarfilename}" basedir="${classes}"/>
-
- </target>
-
- <target name="install" depends="dist" description="compile and install into local PDI installation">
-
- <echo message="Looking for local PDI installation in ${kettle-dir}"/>
-
- <!-- change these to adapt to your environment -->
- <property name="kettle-dir" location="your_kettle_5.x_dir_here" />
- <available file="${kettle-dir}" type="dir" property="kettle-dir.present" />
-
- <fail unless="kettle-dir.present" message="PDI installation not found. Please specify the path to your PDI installation in build/build.properties" />
-
- <!-- remove previous installations -->
- <delete dir="${kettle-dir}/plugins/steps/${pluginname}" />
-
- <!-- put fresh files in place -->
- <mkdir dir="${kettle-dir}/plugins/steps/${pluginname}" />
-
- <copy todir="${kettle-dir}/plugins/steps/${pluginname}">
- <fileset dir="${diststep}" includes="**/*.*" />
- <fileset dir="${diststep}" includes="**" />
- </copy>
-
-
- <echo message="Installed the plugin in PDI. To test, please restart Spoon."/>
-
- </target>
-
- <target name="clean" description="clean up">
- <delete dir="${classes}" />
- <delete dir="${dist}" />
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/ivy.xml
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/ivy.xml b/tools/pdi_plugin/ivy.xml
deleted file mode 100644
index f952bae..0000000
--- a/tools/pdi_plugin/ivy.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
- <info organisation="${ivy.artifact.group}" module="${ivy.artifact.id}" revision="${project.revision}"/>
-
- <configurations>
- <conf name="default"/>
- <conf name="test" visibility="private"/>
- <conf name="source"/>
- </configurations>
-
- <dependencies defaultconf="default">
-
- <dependency org="org.apache.oodt" name="cas-filemgr" rev="0.7" transitive="false" changing="true"/>
- <dependency org="org.apache.oodt" name="cas-metadata" rev="0.7" transitive="false" changing="true"/>
- <dependency org="org.apache.ws.xmlrpc" name="xmlrpc" rev="2.0.1">
- <exclude org="xml-apis" module="xml-apis"/>
- <exclude org="junit" module="junit"/>
- </dependency>
- <dependency org="org.json" name="json" rev="20140107"/>
- <dependency org="com.google.code.gson" name="gson" rev="2.2.4"/>
-
-
- <!-- kettle dependencies -->
- <dependency org="pentaho-kettle" name="kettle-core" rev="TRUNK-SNAPSHOT" changing="true"/>
- <dependency org="pentaho-kettle" name="kettle-engine" rev="TRUNK-SNAPSHOT" changing="true"/>
- <dependency org="pentaho-kettle" name="kettle-ui-swt" rev="TRUNK-SNAPSHOT" changing="true"/>
- <dependency org="pentaho" name="pentaho-metadata" rev="TRUNK-SNAPSHOT" changing="true" transitive="true"/>
-
- <!-- swt dependencies -->
- <dependency org="org.eclipse.swt" name="swt-win32" rev="3.3.0.3346" transitive="false" changing="false"/>
-
- <!-- testing dependencies -->
- <dependency org="junit" name="junit" rev="3.8.1" transitive="false" conf="test->default"/>
- <dependency org="log4j" name="log4j" rev="1.2.16" transitive="false" conf="test->default"/>
-
- </dependencies>
-</ivy-module>
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/ivysettings.xml
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/ivysettings.xml b/tools/pdi_plugin/ivysettings.xml
deleted file mode 100644
index 2d97c5c..0000000
--- a/tools/pdi_plugin/ivysettings.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivysettings>
- <properties environment="env" />
- <property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local" override="true" />
- <property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"
- override="false" />
-
-
- <!-- Repository for Pentaho-hosted artifacts -->
- <property name="pentaho.resolve.repo" value="http://ivy-nexus.pentaho.org/content/groups/omni" override="false" />
- <!-- Repository for External-hosted artifacts (Optional. Defaults to Pentaho-hosted.) -->
- <property name="public.resolve.repo" value="${pentaho.resolve.repo}" override="false" />
-
-
- <settings defaultResolver="pentaho-chained-resolver" />
- <include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
- <include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
- <resolvers>
- <chain name="pentaho-chained-resolver">
- <resolver ref="local" />
- <dual name="pentaho">
- <url name="pentaho-ivy" checkmodified="true" changingPattern="*-SNAPSHOT">
- <ivy pattern="${pentaho.resolve.repo}/[organisation]/[module]/[revision]/[module]-[revision].ivy.xml" />
- </url>
- <ibiblio name="pentaho-mvn" m2compatible="true" root="${pentaho.resolve.repo}" />
- </dual>
- <ibiblio name="public-maven" root="${public.resolve.repo}" m2compatible="true" />
- <resolver ref="public" />
- </chain>
- </resolvers>
- <caches lockStrategy="artifact-lock" resolutionCacheDir="${ivy.default.ivy.user.dir}/resol-cache${env.EXECUTOR_NUMBER}" />
-</ivysettings>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/package-ivy.xml
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/package-ivy.xml b/tools/pdi_plugin/package-ivy.xml
deleted file mode 100644
index b47c2b9..0000000
--- a/tools/pdi_plugin/package-ivy.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
- <info organisation="${ivy.artifact.group}" module="${ivy.artifact.id}" revision="${project.revision}" />
- <configurations>
- <conf name="default" />
- <conf name="test" visibility="private" />
- </configurations>
-
- <publications>
- <artifact name="${ivy.artifact.id}" type="zip" />
- </publications>
-
- <dependencies defaultconf="default->default">
- </dependencies>
-</ivy-module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/plugins
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/plugins b/tools/pdi_plugin/plugins
deleted file mode 100644
index b8291a2..0000000
Binary files a/tools/pdi_plugin/plugins and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java
deleted file mode 100644
index 2cb5a77..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStep.java
+++ /dev/null
@@ -1,199 +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.oodt.filemgrcheck;
-
-import org.pentaho.di.core.exception.KettleException;
-import org.pentaho.di.core.row.RowDataUtil;
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.trans.Trans;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.*;
-
-import java.util.Arrays;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepInterface.
- * Classes implementing this interface need to:
- *
- * - initialize the step
- * - execute the row processing logic
- * - dispose of the step
- *
- * Please do not create any local fields in a StepInterface class. Store any
- * information related to the processing logic in the supplied step data interface
- * instead.
- *
- */
-
-public class FilemgrCheckStep extends BaseStep implements StepInterface {
-
- private OODTConfig oodt = new OODTConfig();
- private OODTProcesses oodtproc = new OODTProcesses();
- /**
- * The constructor should simply pass on its arguments to the parent class.
- *
- * @param s step description
- * @param stepDataInterface step data class
- * @param c step copy
- * @param t transformation description
- * @param dis transformation executing
- */
- public FilemgrCheckStep(StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis) {
- super(s, stepDataInterface, c, t, dis);
- }
-
- /**
- * This method is called by PDI during transformation startup.
- *
- * It should initialize required for step execution.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.init() is called to ensure correct behavior.
- *
- * Typical tasks executed here are establishing the connection to a database,
- * as wall as obtaining resources, like file handles.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- *
- * @return true if initialization completed successfully, false if there was an error preventing the step from working.
- *
- */
- public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
- // Casting to step-specific implementation classes is safe
- FilemgrCheckStepMeta meta = (FilemgrCheckStepMeta) smi;
- FilemgrCheckStepData data = (FilemgrCheckStepData) sdi;
-
- try {
- logError("loading ingester");
- oodt.loadIngester(meta.getServerURLField());
- } catch (InstantiationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return super.init(meta, data);
- }
-
- /**
- * Once the transformation starts executing, the processRow() method is called repeatedly
- * by PDI for as long as it returns true. To indicate that a step has finished processing rows
- * this method must call setOutputDone() and return false;
- *
- * Steps which process incoming rows typically call getRow() to read a single row from the
- * input stream, change or add row content, call putRow() to pass the changed row on
- * and return true. If getRow() returns null, no more rows are expected to come in,
- * and the processRow() implementation calls setOutputDone() and returns false to
- * indicate that it is done too.
- *
- * Steps which generate rows typically construct a new row Object[] using a call to
- * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to
- * pass the new row on. Above process may happen in a loop to generate multiple rows,
- * at the end of which processRow() would call setOutputDone() and return false;
- *
- * @param smi the step meta interface containing the step settings
- * @param sdi the step data interface that should be used to store
- *
- * @return true to indicate that the function should be called again, false if the step is done
- */
- public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
-
- // safely cast the step settings (meta) and runtime info (data) to specific implementations
- FilemgrCheckStepMeta meta = (FilemgrCheckStepMeta) smi;
- FilemgrCheckStepData data = (FilemgrCheckStepData) sdi;
-
- // get incoming row, getRow() potentially blocks waiting for more rows, returns null if no more rows expected
- Object[] r = getRow();
-
- // if no more rows are expected, indicate step is finished and processRow() should not be called again
- if (r == null){
- setOutputDone();
- return false;
- }
-
- // the "first" flag is inherited from the base step implementation
- // it is used to guard some processing tasks, like figuring out field indexes
- // in the row structure that only need to be done once
- if (first) {
- first = false;
- // clone the input row structure and place it in our data object
- data.outputRowMeta = (RowMetaInterface) getInputRowMeta().clone();
- // use meta.getFields() to change it, so it reflects the output row structure
- meta.getFields(data.outputRowMeta, getStepname(), null, null, this, null, null);
- }
-
- String[] names = getInputRowMeta().getFieldNames();
-
- logError("fieldname = "+meta.getFilenameField());
- int idx = Arrays.asList(names).indexOf(meta.getFilenameField());
-
- logError("IDX=" +Integer.toString(idx));
-
- try {
- logError("does file exist?"+oodtproc.isAlreadyInDatabase(oodt, (String)r[idx]));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- // safely add the string "Hello World!" at the end of the output row
- // the row array will be resized if necessary
- Object[] outputRow = RowDataUtil.addValueData(r, data.outputRowMeta.size() - 1, "Hello World!");
-
- // put the row to the output row stream
- putRow(data.outputRowMeta, outputRow);
-
- // log progress if it is time to to so
- if (checkFeedback(getLinesRead())) {
- logBasic("Linenr " + getLinesRead()); // Some basic logging
- }
-
- // indicate that processRow() should be called again
- return true;
- }
-
- /**
- * This method is called by PDI once the step is done processing.
- *
- * The dispose() method is the counterpart to init() and should release any resources
- * acquired for step execution like file handles or database connections.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.dispose() is called to ensure correct behavior.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- */
- public void dispose(StepMetaInterface smi, StepDataInterface sdi) {
-
- // Casting to step-specific implementation classes is safe
- FilemgrCheckStepMeta meta = (FilemgrCheckStepMeta) smi;
- FilemgrCheckStepData data = (FilemgrCheckStepData) sdi;
-
- super.dispose(meta, data);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepData.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepData.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepData.java
deleted file mode 100644
index 30c5f31..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepData.java
+++ /dev/null
@@ -1,55 +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.oodt.filemgrcheck;
-
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.trans.step.BaseStepData;
-import org.pentaho.di.trans.step.StepDataInterface;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepDataInterface.
- *
- * Implementing classes inherit from BaseStepData, which implements the entire
- * interface completely.
- *
- * In addition classes implementing this interface usually keep track of
- * per-thread resources during step execution. Typical examples are:
- * result sets, temporary data, caching indexes, etc.
- *
- * The implementation for the demo step stores the output row structure in
- * the data class.
- *
- */
-public class FilemgrCheckStepData extends BaseStepData implements StepDataInterface {
-
- public RowMetaInterface outputRowMeta;
-
- public String fieldname;
-
- public FilemgrCheckStepData()
- {
- super();
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepDialog.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepDialog.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepDialog.java
deleted file mode 100644
index 78ef67b..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepDialog.java
+++ /dev/null
@@ -1,307 +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.oodt.filemgrcheck;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
-import org.pentaho.di.core.Const;
-import org.pentaho.di.i18n.BaseMessages;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.BaseStepMeta;
-import org.pentaho.di.trans.step.StepDialogInterface;
-import org.pentaho.di.ui.trans.step.BaseStepDialog;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepDialogInterface.
- * Classes implementing this interface need to:
- *
- * - build and open a SWT dialog displaying the step's settings (stored in the step's meta object)
- * - write back any changes the user makes to the step's meta object
- * - report whether the user changed any settings when confirming the dialog
- *
- */
-public class FilemgrCheckStepDialog extends BaseStepDialog implements StepDialogInterface {
-
- /**
- * The PKG member is used when looking up internationalized strings.
- * The properties file with localized keys is expected to reside in
- * {the package of the class specified}/messages/messages_{locale}.properties
- */
- private static Class<?> PKG = FilemgrCheckStepMeta.class; // for i18n purposes
-
- // this is the object the stores the step's settings
- // the dialog reads the settings from it when opening
- // the dialog writes the settings to it when confirmed
- private FilemgrCheckStepMeta meta;
-
- // text field holding the name of the field to add to the row stream
- //private Text wHelloFieldName;
-
- // text field holding the name of the field to check the filename against
- private Text wFilenameField;
- private Text wServerURLField;
- private Text wResultField;
- /**
- * The constructor should simply invoke super() and save the incoming meta
- * object to a local variable, so it can conveniently read and write settings
- * from/to it.
- *
- * @param parent the SWT shell to open the dialog in
- * @param in the meta object holding the step's settings
- * @param transMeta transformation description
- * @param sname the step name
- */
- public FilemgrCheckStepDialog(Shell parent, Object in, TransMeta transMeta, String sname) {
- super(parent, (BaseStepMeta) in, transMeta, sname);
- meta = (FilemgrCheckStepMeta) in;
- }
-
- /**
- * This method is called by Spoon when the user opens the settings dialog of the step.
- * It should open the dialog and return only once the dialog has been closed by the user.
- *
- * If the user confirms the dialog, the meta object (passed in the constructor) must
- * be updated to reflect the new step settings. The changed flag of the meta object must
- * reflect whether the step configuration was changed by the dialog.
- *
- * If the user cancels the dialog, the meta object must not be updated, and its changed flag
- * must remain unaltered.
- *
- * The open() method must return the name of the step after the user has confirmed the dialog,
- * or null if the user cancelled the dialog.
- */
- public String open() {
-
- // store some convenient SWT variables
- Shell parent = getParent();
- Display display = parent.getDisplay();
-
- // SWT code for preparing the dialog
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
- props.setLook(shell);
- setShellImage(shell, meta);
-
- // Save the value of the changed flag on the meta object. If the user cancels
- // the dialog, it will be restored to this saved value.
- // The "changed" variable is inherited from BaseStepDialog
- changed = meta.hasChanged();
-
- // The ModifyListener used on all controls. It will update the meta object to
- // indicate that changes are being made.
- ModifyListener lsMod = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- meta.setChanged();
- }
- };
-
- // ------------------------------------------------------- //
- // SWT code for building the actual settings dialog //
- // ------------------------------------------------------- //
- FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = Const.FORM_MARGIN;
- formLayout.marginHeight = Const.FORM_MARGIN;
-
- shell.setLayout(formLayout);
- shell.setText(BaseMessages.getString(PKG, "Demo.Shell.Title"));
-
- int middle = props.getMiddlePct();
- int margin = Const.MARGIN;
-
- // Stepname line
- wlStepname = new Label(shell, SWT.RIGHT);
- wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
- props.setLook(wlStepname);
- fdlStepname = new FormData();
- fdlStepname.left = new FormAttachment(0, 0);
- fdlStepname.right = new FormAttachment(middle, -margin);
- fdlStepname.top = new FormAttachment(0, margin);
- wlStepname.setLayoutData(fdlStepname);
-
- wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- wStepname.setText(stepname);
- props.setLook(wStepname);
- wStepname.addModifyListener(lsMod);
- fdStepname = new FormData();
- fdStepname.left = new FormAttachment(middle, 0);
- fdStepname.top = new FormAttachment(0, margin);
- fdStepname.right = new FormAttachment(100, 0);
- wStepname.setLayoutData(fdStepname);
-
- // output field value
- Label wlValName = new Label(shell, SWT.RIGHT);
- wlValName.setText(BaseMessages.getString(PKG, "FilemgrCheck.FieldName.Label"));
- props.setLook(wlValName);
- FormData fdlValName = new FormData();
- fdlValName.left = new FormAttachment(0, 0);
- fdlValName.right = new FormAttachment(middle, -margin);
- fdlValName.top = new FormAttachment(wStepname, margin);
- wlValName.setLayoutData(fdlValName);
-
- wFilenameField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wFilenameField);
- wFilenameField.addModifyListener(lsMod);
- FormData fdValName = new FormData();
- fdValName.left = new FormAttachment(middle, 0);
- fdValName.right = new FormAttachment(100, 0);
- fdValName.top = new FormAttachment(wStepname, margin);
- wFilenameField.setLayoutData(fdValName);
-
-
- // servername field value
- Label wlServerName = new Label(shell, SWT.RIGHT);
- wlServerName.setText(BaseMessages.getString(PKG, "FilemgrCheck.ServerURL.Label"));
- props.setLook(wlServerName);
- FormData fdlServerName = new FormData();
- fdlServerName.left = new FormAttachment(0, 0);
- fdlServerName.right = new FormAttachment(middle, -margin);
- fdlServerName.top = new FormAttachment(wFilenameField, margin);
- wlServerName.setLayoutData(fdlServerName);
-
- wServerURLField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wServerURLField);
- wServerURLField.addModifyListener(lsMod);
- FormData fdServerName = new FormData();
- fdServerName.left = new FormAttachment(middle, 0);
- fdServerName.right = new FormAttachment(100, 0);
- fdServerName.top = new FormAttachment(wFilenameField, margin);
- wServerURLField.setLayoutData(fdServerName);
-
- // servername field value
- Label wlResultName = new Label(shell, SWT.RIGHT);
- wlResultName.setText(BaseMessages.getString(PKG, "FilemgrCheck.Result.Label"));
- props.setLook(wlResultName);
- FormData fdlResultName = new FormData();
- fdlResultName.left = new FormAttachment(0, 0);
- fdlResultName.right = new FormAttachment(middle, -margin);
- fdlResultName.top = new FormAttachment(wServerURLField, margin);
- wlResultName.setLayoutData(fdlResultName);
-
- wResultField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wResultField);
- wResultField.addModifyListener(lsMod);
- FormData fdResultName = new FormData();
- fdResultName.left = new FormAttachment(middle, 0);
- fdResultName.right = new FormAttachment(100, 0);
- fdResultName.top = new FormAttachment(wServerURLField, margin);
- wResultField.setLayoutData(fdResultName);
-
-
- // OK and cancel buttons
- wOK = new Button(shell, SWT.PUSH);
- wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
- wCancel = new Button(shell, SWT.PUSH);
- wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
-
- BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wResultField);
-
- // Add listeners for cancel and OK
- lsCancel = new Listener() {
- public void handleEvent(Event e) {cancel();}
- };
- lsOK = new Listener() {
- public void handleEvent(Event e) {ok();}
- };
-
- wCancel.addListener(SWT.Selection, lsCancel);
- wOK.addListener(SWT.Selection, lsOK);
-
- // default listener (for hitting "enter")
- lsDef = new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {ok();}
- };
- wStepname.addSelectionListener(lsDef);
- wFilenameField.addSelectionListener(lsDef);
- wServerURLField.addSelectionListener(lsDef);
- wResultField.addSelectionListener(lsDef);
- // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {cancel();}
- });
-
- // Set/Restore the dialog size based on last position on screen
- // The setSize() method is inherited from BaseStepDialog
- setSize();
-
- // populate the dialog with the values from the meta object
- populateDialog();
-
- // restore the changed flag to original value, as the modify listeners fire during dialog population
- meta.setChanged(changed);
-
- // open dialog and enter event loop
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // at this point the dialog has closed, so either ok() or cancel() have been executed
- // The "stepname" variable is inherited from BaseStepDialog
- return stepname;
- }
-
- /**
- * This helper method puts the step configuration stored in the meta object
- * and puts it into the dialog controls.
- */
- private void populateDialog() {
- wStepname.selectAll();
- wFilenameField.setText(meta.getFilenameField());
- wServerURLField.setText(meta.getServerURLField());
- wResultField.setText(meta.getResultField());
- }
-
- /**
- * Called when the user cancels the dialog.
- */
- private void cancel() {
- // The "stepname" variable will be the return value for the open() method.
- // Setting to null to indicate that dialog was cancelled.
- stepname = null;
- // Restoring original "changed" flag on the met aobject
- meta.setChanged(changed);
- // close the SWT dialog window
- dispose();
- }
-
- /**
- * Called when the user confirms the dialog
- */
- private void ok() {
- // The "stepname" variable will be the return value for the open() method.
- // Setting to step name from the dialog control
- stepname = wStepname.getText();
- // Setting the settings to the meta object
- //meta.setOutputField(wFilenameField.getText());
- meta.setFilenameField(wFilenameField.getText());
- meta.setServerURLField(wServerURLField.getText());
- meta.setResultField(wResultField.getText());
- // close the SWT dialog window
- dispose();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepMeta.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepMeta.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepMeta.java
deleted file mode 100644
index 7fb5b97..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/FilemgrCheckStepMeta.java
+++ /dev/null
@@ -1,345 +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.oodt.filemgrcheck;
-
-import org.eclipse.swt.widgets.Shell;
-import org.pentaho.di.core.CheckResult;
-import org.pentaho.di.core.CheckResultInterface;
-import org.pentaho.di.core.annotations.Step;
-import org.pentaho.di.core.database.DatabaseMeta;
-import org.pentaho.di.core.exception.KettleException;
-import org.pentaho.di.core.exception.KettleStepException;
-import org.pentaho.di.core.exception.KettleValueException;
-import org.pentaho.di.core.exception.KettleXMLException;
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.core.row.ValueMeta;
-import org.pentaho.di.core.row.ValueMetaInterface;
-import org.pentaho.di.core.variables.VariableSpace;
-import org.pentaho.di.core.xml.XMLHandler;
-import org.pentaho.di.i18n.BaseMessages;
-import org.pentaho.di.repository.ObjectId;
-import org.pentaho.di.repository.Repository;
-import org.pentaho.di.trans.Trans;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.*;
-import org.pentaho.metastore.api.IMetaStore;
-import org.w3c.dom.Node;
-
-import java.util.List;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepMetaInterface.
- * Classes implementing this interface need to:
- *
- * - keep track of the step settings
- * - serialize step settings both to xml and a repository
- * - provide new instances of objects implementing StepDialogInterface, StepInterface and StepDataInterface
- * - report on how the step modifies the meta-data of the row-stream (row structure and field types)
- * - perform a sanity-check on the settings provided by the user
- *
- */
-
-@Step(
- id = "FilemgrCheck",
- image = "org/apache/oodt/filemgrcheck/resources/check/oodt.jpg",
- i18nPackageName="bi.meteorite.filemgrcheck",
- name="FilemgrCheckStep.Name",
- description = "FilemgrCheckStep.TooltipDesc",
- categoryDescription="i18n:org.pentaho.di.trans.step:BaseStep.Category.BigData"
-)
-public class FilemgrCheckStepMeta extends BaseStepMeta implements StepMetaInterface {
- /**
- * The PKG member is used when looking up internationalized strings.
- * The properties file with localized keys is expected to reside in
- * {the package of the class specified}/messages/messages_{locale}.properties
- */
- private static Class<?> PKG = FilemgrCheckStepMeta.class; // for i18n purposes
-
- /**
- * Stores the name of the field added to the row-stream.
- */
- private String outputField;
- private String filenameField;
- private String serverURLField;
- private String resultField;
-
- /**
- * Constructor should call super() to make sure the base class has a chance to initialize properly.
- */
- public FilemgrCheckStepMeta() {
- super();
- }
-
- /**
- * Called by Spoon to get a new instance of the SWT dialog for the step.
- * A standard implementation passing the arguments to the constructor of the step dialog is recommended.
- *
- * @param shell an SWT Shell
- * @param meta description of the step
- * @param transMeta description of the the transformation
- * @param name the name of the step
- * @return new instance of a dialog for this step
- */
- public StepDialogInterface getDialog(Shell shell, StepMetaInterface meta, TransMeta transMeta, String name) {
- return new FilemgrCheckStepDialog(shell, meta, transMeta, name);
- }
-
- /**
- * Called by PDI to get a new instance of the step implementation.
- * A standard implementation passing the arguments to the constructor of the step class is recommended.
- *
- * @param stepMeta description of the step
- * @param stepDataInterface instance of a step data class
- * @param cnr copy number
- * @param transMeta description of the transformation
- * @param disp runtime implementation of the transformation
- * @return the new instance of a step implementation
- */
- public StepInterface getStep(StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans disp) {
- return new FilemgrCheckStep(stepMeta, stepDataInterface, cnr, transMeta, disp);
- }
-
- /**
- * Called by PDI to get a new instance of the step data class.
- */
- public StepDataInterface getStepData() {
- return new FilemgrCheckStepData();
- }
-
- /**
- * This method is called every time a new step is created and should allocate/set the step configuration
- * to sensible defaults. The values set here will be used by Spoon when a new step is created.
- */
- public void setDefault() {
- outputField = "demo_field";
- filenameField = "fieldname";
- serverURLField = "http://localhost:9000";
- resultField = "result";
- }
-
- /**
- * Getter for the name of the field added by this step
- * @return the name of the field added
- */
- public String getOutputField() {
- return outputField;
- }
-
- /**
- * Setter for the name of the field added by this step
- * @param outputField the name of the field added
- */
- public void setOutputField(String outputField) {
- this.outputField = outputField;
- }
-
-
- public String getFilenameField(){
- return filenameField;
- }
-
- public void setFilenameField(String filenameField){
- this.filenameField = filenameField;
- }
- /**
- * This method is used when a step is duplicated in Spoon. It needs to return a deep copy of this
- * step meta object. Be sure to create proper deep copies if the step configuration is stored in
- * modifiable objects.
- *
- * See org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta.clone() for an example on creating
- * a deep copy.
- *
- * @return a deep copy of this
- */
- public Object clone() {
- Object retval = super.clone();
- return retval;
- }
-
- /**
- * This method is called by Spoon when a step needs to serialize its configuration to XML. The expected
- * return value is an XML fragment consisting of one or more XML tags.
- *
- * Please use org.pentaho.di.core.xml.XMLHandler to conveniently generate the XML.
- *
- * @return a string containing the XML serialization of this step
- */
- public String getXML() throws KettleValueException {
-
- // only one field to serialize
- String xml = " ";
- xml += " " +XMLHandler.addTagValue("outputfield", outputField);
- xml += " " +XMLHandler.addTagValue("filenamefield", filenameField);
- xml += " " +XMLHandler.addTagValue("serverurlfield", serverURLField);
- xml += " " +XMLHandler.addTagValue("resultfield", resultField);
- return xml;
- }
-
- /**
- * This method is called by PDI when a step needs to load its configuration from XML.
- *
- * Please use org.pentaho.di.core.xml.XMLHandler to conveniently read from the
- * XML node passed in.
- *
- * @param stepnode the XML node containing the configuration
- * @param databases the databases available in the transformation
- * @param metaStore the metaStore to optionally read from
- */
- public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException {
-
- try {
- setOutputField(XMLHandler.getNodeValue(XMLHandler.getSubNode(stepnode, "outputfield")));
- setFilenameField(XMLHandler.getNodeValue(XMLHandler.getSubNode(stepnode, "filenamefield")));
- setServerURLField(XMLHandler.getNodeValue(XMLHandler.getSubNode(stepnode, "serverurlfield")));
- setResultField(XMLHandler.getNodeValue(XMLHandler.getSubNode(stepnode, "resultfield")));
- } catch (Exception e) {
- throw new KettleXMLException("Demo plugin unable to read step info from XML node", e);
- }
-
- }
- /**
- * This method is called by Spoon when a step needs to serialize its configuration to a repository.
- * The repository implementation provides the necessary methods to save the step attributes.
- *
- * @param rep the repository to save to
- * @param metaStore the metaStore to optionally write to
- * @param id_transformation the id to use for the transformation when saving
- * @param id_step the id to use for the step when saving
- */
- public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step) throws KettleException
- {
- try{
- rep.saveStepAttribute(id_transformation, id_step, "outputfield", outputField); //$NON-NLS-1$
- }
- catch(Exception e){
- throw new KettleException("Unable to save step into repository: "+id_step, e);
- }
- }
-
- /**
- * This method is called by PDI when a step needs to read its configuration from a repository.
- * The repository implementation provides the necessary methods to read the step attributes.
- *
- * @param rep the repository to read from
- * @param metaStore the metaStore to optionally read from
- * @param id_step the id of the step being read
- * @param databases the databases available in the transformation
- * @param counters the counters available in the transformation
- */
- public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException {
- try{
- outputField = rep.getStepAttributeString(id_step, "outputfield"); //$NON-NLS-1$
- }
- catch(Exception e){
- throw new KettleException("Unable to load step from repository", e);
- }
- }
-
- /**
- * This method is called to determine the changes the step is making to the row-stream.
- * To that end a RowMetaInterface object is passed in, containing the row-stream structure as it is when entering
- * the step. This method must apply any changes the step makes to the row stream. Usually a step adds fields to the
- * row-stream.
- *
- * @param inputRowMeta the row structure coming in to the step
- * @param name the name of the step making the changes
- * @param info row structures of any info steps coming in
- * @param nextStep the description of a step this step is passing rows to
- * @param space the variable space for resolving variables
- * @param repository the repository instance optionally read from
- * @param metaStore the metaStore to optionally read from
- */
- public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException{
-
- /*
- * This implementation appends the outputField to the row-stream
- */
-
- // a value meta object contains the meta data for a field
- ValueMetaInterface v = new ValueMeta(outputField, ValueMeta.TYPE_STRING);
-
- // setting trim type to "both"
- v.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
-
- // the name of the step that adds this field
- v.setOrigin(name);
-
- // modify the row structure and add the field this step generates
- inputRowMeta.addValueMeta(v);
-
- }
-
- /**
- * This method is called when the user selects the "Verify Transformation" option in Spoon.
- * A list of remarks is passed in that this method should add to. Each remark is a comment, warning, error, or ok.
- * The method should perform as many checks as necessary to catch design-time errors.
- *
- * Typical checks include:
- * - verify that all mandatory configuration is given
- * - verify that the step receives any input, unless it's a row generating step
- * - verify that the step does not receive any input if it does not take them into account
- * - verify that the step finds fields it relies on in the row-stream
- *
- * @param remarks the list of remarks to append to
- * @param transmeta the description of the transformation
- * @param stepMeta the description of the step
- * @param prev the structure of the incoming row-stream
- * @param input names of steps sending input to the step
- * @param output names of steps this step is sending output to
- * @param info fields coming in from info steps
- * @param metaStore metaStore to optionally read from
- */
- public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String input[], String output[], RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
-
- CheckResult cr;
-
- // See if there are input streams leading to this step!
- if (input.length > 0) {
- cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "Demo.CheckResult.ReceivingRows.OK"), stepMeta);
- remarks.add(cr);
- } else {
- cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "Demo.CheckResult.ReceivingRows.ERROR"), stepMeta);
- remarks.add(cr);
- }
-
- }
-
-
- public void setServerURLField(String serverURLField) {
- this.serverURLField = serverURLField;
- }
-
- public String getServerURLField() {
- return serverURLField;
- }
-
-
- public void setResultField(String resultField) {
- this.resultField = resultField;
- }
-
- public String getResultField() {
- return resultField;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTConfig.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTConfig.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTConfig.java
deleted file mode 100644
index 9e7e529..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTConfig.java
+++ /dev/null
@@ -1,98 +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.oodt.filemgrcheck;
-
-import org.apache.oodt.cas.filemgr.ingest.Ingester;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Created by bugg on 07/03/14.
- */
-public class OODTConfig {
-
- private static final Logger LOG = Logger.getLogger(OODTConfig.class.getName());
-
- private URL fmUrl;
-
- private Ingester ingester;
-
- public Ingester getIngester() {
- return this.ingester;
- }
-
- public URL getFmUrl(){
- return this.fmUrl;
- }
-
-
- void loadIngester(String fmUrlStr) throws InstantiationException {
- try {
-
- String ingesterClass = "org.apache.oodt.cas.filemgr.ingest.StdIngester";
-
- String dataTransferClass ="org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory";
-
- String cacheFactoryClass = null;
- //"org.apache.oodt.cas.filemgr.ingest.cache.factory";
-
- LOG.log(Level.INFO, "Configuring and building ingester: ["
- + ingesterClass + "]: data transfer: ["
- + dataTransferClass + "]: to ingest to file manager: ["
- + fmUrlStr + "]");
-
- if (cacheFactoryClass != null) {
- LOG.log(Level.INFO, "Configuring Ingester cache: ["
- + cacheFactoryClass + "]");
- }
-
- this.ingester = PushPullObjectFactory.createIngester(
- ingesterClass, cacheFactoryClass);
-
- this.fmUrl = safeGetUrlFromString(fmUrlStr);
-
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- } catch (InvocationTargetException e1) {
- e1.printStackTrace();
- } catch (NoSuchMethodException e1) {
- e1.printStackTrace();
- } catch (IllegalAccessException e1) {
- e1.printStackTrace();
- }
-
- }
-
-
- private static URL safeGetUrlFromString(String urlStr) {
- URL url = null;
-
- try {
- url = new URL(urlStr);
- } catch (MalformedURLException e) {
- LOG.log(Level.WARNING, "Unable to generate url from url string: ["
- + urlStr + "]: Message: " + e.getMessage());
- }
-
- return url;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTProcesses.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTProcesses.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTProcesses.java
deleted file mode 100644
index 9977b65..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/OODTProcesses.java
+++ /dev/null
@@ -1,36 +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.oodt.filemgrcheck;
-
-import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
-
-/**
- * Created by bugg on 07/03/14.
- */
-public class OODTProcesses {
-
-
- public boolean isAlreadyInDatabase(OODTConfig config, String filename) throws CatalogException {
- return config.getIngester() != null ? config.getIngester().hasProduct(
- config.getFmUrl(), filename)
- : false;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/PushPullObjectFactory.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/PushPullObjectFactory.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/PushPullObjectFactory.java
deleted file mode 100644
index aa94372..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/PushPullObjectFactory.java
+++ /dev/null
@@ -1,74 +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.oodt.filemgrcheck;
-
-//OODT imports
-import org.apache.oodt.cas.filemgr.ingest.Cache;
-import org.apache.oodt.cas.filemgr.ingest.CacheFactory;
-import org.apache.oodt.cas.filemgr.ingest.Ingester;
-
-//JDK imports
-import java.lang.reflect.InvocationTargetException;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class PushPullObjectFactory {
-
- private PushPullObjectFactory() throws InstantiationException {
- throw new InstantiationException("Don't construct factory classes!");
- }
-
- public static <T> T createNewInstance(Class<T> clazz) throws InstantiationException {
- try {
- return clazz.newInstance();
- } catch (Exception e) {
- throw new InstantiationException(
- "Failed to create new object : "
- + e.getMessage());
- }
- }
-
- public static Ingester createIngester(String ingesterClass,
- String cacheFactoryClass) throws InstantiationException,
- IllegalAccessException, ClassNotFoundException,
- IllegalArgumentException, SecurityException,
- InvocationTargetException, NoSuchMethodException {
- String dataTransferFactory = "org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory";
- System.out.println("TRANSFER: " + dataTransferFactory);
- if (cacheFactoryClass == null || cacheFactoryClass.equals("")) {
- return (Ingester) Class.forName(ingesterClass).getConstructor(
- dataTransferFactory.getClass()).newInstance(
- dataTransferFactory);
- } else {
- Class<CacheFactory> cacheFactory = (Class<CacheFactory>) Class
- .forName(cacheFactoryClass);
- Cache cache = cacheFactory.newInstance().createCache();
- return (Ingester) Class.forName(ingesterClass).getConstructor(
- dataTransferFactory.getClass(), cache.getClass())
- .newInstance(dataTransferFactory, cache);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/messages/messages_en_US.properties
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/messages/messages_en_US.properties b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/messages/messages_en_US.properties
deleted file mode 100644
index a7af034..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/messages/messages_en_US.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-FilemgrCheckStep.Name=OODT Filemgr File Check
-FilemgrCheckStep.TooltipDesc=Check if the OODT Filemgr has a file in its repository
-
-FilemgrCheck.FieldName.Label=Stream Field Name
-FilemgrCheck.ServerURL.Label=Filemgr URL
-FilemgrCheck.Result.Label=Result Field
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.jpg
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.jpg b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.jpg
deleted file mode 100644
index 5810409..0000000
Binary files a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.png
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.png b/tools/pdi_plugin/src/org/apache/oodt/filemgrcheck/resources/check/oodt.png
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java
deleted file mode 100644
index 47f3a31..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStep.java
+++ /dev/null
@@ -1,195 +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.oodt.filemgrdelete;
-
-import org.pentaho.di.core.exception.KettleException;
-import org.pentaho.di.core.row.RowDataUtil;
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.trans.Trans;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.*;
-
-import java.util.Arrays;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepInterface.
- * Classes implementing this interface need to:
- *
- * - initialize the step
- * - execute the row processing logic
- * - dispose of the step
- *
- * Please do not create any local fields in a StepInterface class. Store any
- * information related to the processing logic in the supplied step data interface
- * instead.
- *
- */
-
-public class FilemgrDeleteStep extends BaseStep implements StepInterface {
-
- private OODTConfig oodt = new OODTConfig();
- private OODTProcesses oodtproc = new OODTProcesses();
- /**
- * The constructor should simply pass on its arguments to the parent class.
- *
- * @param s step description
- * @param stepDataInterface step data class
- * @param c step copy
- * @param t transformation description
- * @param dis transformation executing
- */
- public FilemgrDeleteStep(StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis) {
- super(s, stepDataInterface, c, t, dis);
- }
-
- /**
- * This method is called by PDI during transformation startup.
- *
- * It should initialize required for step execution.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.init() is called to ensure correct behavior.
- *
- * Typical tasks executed here are establishing the connection to a database,
- * as wall as obtaining resources, like file handles.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- *
- * @return true if initialization completed successfully, false if there was an error preventing the step from working.
- *
- */
- public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
- // Casting to step-specific implementation classes is safe
- FilemgrDeleteStepMeta meta = (FilemgrDeleteStepMeta) smi;
- FilemgrDeleteStepData data = (FilemgrDeleteStepData) sdi;
-
-
- logDetailed("loading ingester");
- oodt.loadXMLRpcClient(meta.getServerURLField());
- logDetailed("finished loading ingester");
- return super.init(meta, data);
- }
-
- /**
- * Once the transformation starts executing, the processRow() method is called repeatedly
- * by PDI for as long as it returns true. To indicate that a step has finished processing rows
- * this method must call setOutputDone() and return false;
- *
- * Steps which process incoming rows typically call getRow() to read a single row from the
- * input stream, change or add row content, call putRow() to pass the changed row on
- * and return true. If getRow() returns null, no more rows are expected to come in,
- * and the processRow() implementation calls setOutputDone() and returns false to
- * indicate that it is done too.
- *
- * Steps which generate rows typically construct a new row Object[] using a call to
- * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to
- * pass the new row on. Above process may happen in a loop to generate multiple rows,
- * at the end of which processRow() would call setOutputDone() and return false;
- *
- * @param smi the step meta interface containing the step settings
- * @param sdi the step data interface that should be used to store
- *
- * @return true to indicate that the function should be called again, false if the step is done
- */
- public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
-
- // safely cast the step settings (meta) and runtime info (data) to specific implementations
- FilemgrDeleteStepMeta meta = (FilemgrDeleteStepMeta) smi;
- FilemgrDeleteStepData data = (FilemgrDeleteStepData) sdi;
-
- // get incoming row, getRow() potentially blocks waiting for more rows, returns null if no more rows expected
- Object[] r = getRow();
-
- // if no more rows are expected, indicate step is finished and processRow() should not be called again
- if (r == null){
- setOutputDone();
- return false;
- }
-
- // the "first" flag is inherited from the base step implementation
- // it is used to guard some processing tasks, like figuring out field indexes
- // in the row structure that only need to be done once
- if (first) {
- first = false;
- // clone the input row structure and place it in our data object
- data.outputRowMeta = (RowMetaInterface) getInputRowMeta().clone();
- // use meta.getFields() to change it, so it reflects the output row structure
- meta.getFields(data.outputRowMeta, getStepname(), null, null, this, null, null);
- }
-
- String[] names = getInputRowMeta().getFieldNames();
- int idx = Arrays.asList(names).indexOf(meta.getFilenameField());
-
- boolean worked = false;
- try {
- logDetailed("Deleting Product: "+(String)r[idx]);
- worked = oodtproc.deleteProductByName(oodt, (String)r[idx]);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- // safely add the string "Hello World!" at the end of the output row
- // the row array will be resized if necessary
- Object[] outputRow = RowDataUtil.addValueData(r, data.outputRowMeta.size() - 1, worked);
-
- // put the row to the output row stream
- putRow(data.outputRowMeta, outputRow);
-
- // log progress if it is time to to so
- if (checkFeedback(getLinesRead())) {
- logBasic("Linenr " + getLinesRead()); // Some basic logging
- }
-
- // indicate that processRow() should be called again
- return true;
- }
-
- /**
- * This method is called by PDI once the step is done processing.
- *
- * The dispose() method is the counterpart to init() and should release any resources
- * acquired for step execution like file handles or database connections.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.dispose() is called to ensure correct behavior.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- */
- public void dispose(StepMetaInterface smi, StepDataInterface sdi) {
-
- // Casting to step-specific implementation classes is safe
- FilemgrDeleteStepMeta meta = (FilemgrDeleteStepMeta) smi;
- FilemgrDeleteStepData data = (FilemgrDeleteStepData) sdi;
-
- super.dispose(meta, data);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepData.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepData.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepData.java
deleted file mode 100644
index 819d9d8..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepData.java
+++ /dev/null
@@ -1,56 +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.oodt.filemgrdelete;
-
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.trans.step.BaseStepData;
-import org.pentaho.di.trans.step.StepDataInterface;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepDataInterface.
- *
- * Implementing classes inherit from BaseStepData, which implements the entire
- * interface completely.
- *
- * In addition classes implementing this interface usually keep track of
- * per-thread resources during step execution. Typical examples are:
- * result sets, temporary data, caching indexes, etc.
- *
- * The implementation for the demo step stores the output row structure in
- * the data class.
- *
- */
-public class FilemgrDeleteStepData extends BaseStepData implements StepDataInterface {
-
- public RowMetaInterface outputRowMeta;
-
- public String fieldname;
-
- public FilemgrDeleteStepData()
- {
- super();
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/2fc7bced/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepDialog.java
----------------------------------------------------------------------
diff --git a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepDialog.java b/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepDialog.java
deleted file mode 100644
index 3fa9008..0000000
--- a/tools/pdi_plugin/src/org/apache/oodt/filemgrdelete/FilemgrDeleteStepDialog.java
+++ /dev/null
@@ -1,309 +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.oodt.filemgrdelete;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
-import org.pentaho.di.core.Const;
-import org.pentaho.di.i18n.BaseMessages;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.BaseStepMeta;
-import org.pentaho.di.trans.step.StepDialogInterface;
-import org.pentaho.di.ui.trans.step.BaseStepDialog;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepDialogInterface.
- * Classes implementing this interface need to:
- *
- * - build and open a SWT dialog displaying the step's settings (stored in the step's meta object)
- * - write back any changes the user makes to the step's meta object
- * - report whether the user changed any settings when confirming the dialog
- *
- */
-public class FilemgrDeleteStepDialog extends BaseStepDialog implements StepDialogInterface {
-
- /**
- * The PKG member is used when looking up internationalized strings.
- * The properties file with localized keys is expected to reside in
- * {the package of the class specified}/messages/messages_{locale}.properties
- */
- private static Class<?> PKG = FilemgrDeleteStepMeta.class; // for i18n purposes
-
- // this is the object the stores the step's settings
- // the dialog reads the settings from it when opening
- // the dialog writes the settings to it when confirmed
- private FilemgrDeleteStepMeta meta;
-
- // text field holding the name of the field to add to the row stream
- //private Text wHelloFieldName;
-
- // text field holding the name of the field to check the filename against
- private Text wFilenameField;
- private Text wServerURLField;
- private Text wResultField;
- /**
- * The constructor should simply invoke super() and save the incoming meta
- * object to a local variable, so it can conveniently read and write settings
- * from/to it.
- *
- * @param parent the SWT shell to open the dialog in
- * @param in the meta object holding the step's settings
- * @param transMeta transformation description
- * @param sname the step name
- */
- public FilemgrDeleteStepDialog(Shell parent, Object in, TransMeta transMeta, String sname) {
- super(parent, (BaseStepMeta) in, transMeta, sname);
- meta = (FilemgrDeleteStepMeta) in;
- }
-
- /**
- * This method is called by Spoon when the user opens the settings dialog of the step.
- * It should open the dialog and return only once the dialog has been closed by the user.
- *
- * If the user confirms the dialog, the meta object (passed in the constructor) must
- * be updated to reflect the new step settings. The changed flag of the meta object must
- * reflect whether the step configuration was changed by the dialog.
- *
- * If the user cancels the dialog, the meta object must not be updated, and its changed flag
- * must remain unaltered.
- *
- * The open() method must return the name of the step after the user has confirmed the dialog,
- * or null if the user cancelled the dialog.
- */
- public String open() {
-
- // store some convenient SWT variables
- Shell parent = getParent();
- Display display = parent.getDisplay();
-
- // SWT code for preparing the dialog
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
- props.setLook(shell);
- setShellImage(shell, meta);
-
- // Save the value of the changed flag on the meta object. If the user cancels
- // the dialog, it will be restored to this saved value.
- // The "changed" variable is inherited from BaseStepDialog
- changed = meta.hasChanged();
-
- // The ModifyListener used on all controls. It will update the meta object to
- // indicate that changes are being made.
- ModifyListener lsMod = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- meta.setChanged();
- }
- };
-
- // ------------------------------------------------------- //
- // SWT code for building the actual settings dialog //
- // ------------------------------------------------------- //
- FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = Const.FORM_MARGIN;
- formLayout.marginHeight = Const.FORM_MARGIN;
-
- shell.setLayout(formLayout);
- shell.setText(BaseMessages.getString(PKG, "Demo.Shell.Title"));
-
- int middle = props.getMiddlePct();
- int margin = Const.MARGIN;
-
- // Stepname line
- wlStepname = new Label(shell, SWT.RIGHT);
- wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
- props.setLook(wlStepname);
- fdlStepname = new FormData();
- fdlStepname.left = new FormAttachment(0, 0);
- fdlStepname.right = new FormAttachment(middle, -margin);
- fdlStepname.top = new FormAttachment(0, margin);
- wlStepname.setLayoutData(fdlStepname);
-
- wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- wStepname.setText(stepname);
- props.setLook(wStepname);
- wStepname.addModifyListener(lsMod);
- fdStepname = new FormData();
- fdStepname.left = new FormAttachment(middle, 0);
- fdStepname.top = new FormAttachment(0, margin);
- fdStepname.right = new FormAttachment(100, 0);
- wStepname.setLayoutData(fdStepname);
-
- // output field value
- Label wlValName = new Label(shell, SWT.RIGHT);
- wlValName.setText(BaseMessages.getString(PKG, "FilemgrDelete.FieldName.Label"));
- props.setLook(wlValName);
- FormData fdlValName = new FormData();
- fdlValName.left = new FormAttachment(0, 0);
- fdlValName.right = new FormAttachment(middle, -margin);
- fdlValName.top = new FormAttachment(wStepname, margin);
- wlValName.setLayoutData(fdlValName);
-
- wFilenameField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wFilenameField);
- wFilenameField.addModifyListener(lsMod);
- FormData fdValName = new FormData();
- fdValName.left = new FormAttachment(middle, 0);
- fdValName.right = new FormAttachment(100, 0);
- fdValName.top = new FormAttachment(wStepname, margin);
- wFilenameField.setLayoutData(fdValName);
-
-
- // servername field value
- Label wlServerName = new Label(shell, SWT.RIGHT);
- wlServerName.setText(BaseMessages.getString(PKG, "FilemgrDelete.ServerURL.Label"));
- props.setLook(wlServerName);
- FormData fdlServerName = new FormData();
- fdlServerName.left = new FormAttachment(0, 0);
- fdlServerName.right = new FormAttachment(middle, -margin);
- fdlServerName.top = new FormAttachment(wFilenameField, margin);
- wlServerName.setLayoutData(fdlServerName);
-
- wServerURLField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wServerURLField);
- wServerURLField.addModifyListener(lsMod);
- FormData fdServerName = new FormData();
- fdServerName.left = new FormAttachment(middle, 0);
- fdServerName.right = new FormAttachment(100, 0);
- fdServerName.top = new FormAttachment(wFilenameField, margin);
- wServerURLField.setLayoutData(fdServerName);
-
- // servername field value
- Label wlResultName = new Label(shell, SWT.RIGHT);
- wlResultName.setText(BaseMessages.getString(PKG, "FilemgrDelete.Result.Label"));
- props.setLook(wlResultName);
- FormData fdlResultName = new FormData();
- fdlResultName.left = new FormAttachment(0, 0);
- fdlResultName.right = new FormAttachment(middle, -margin);
- fdlResultName.top = new FormAttachment(wServerURLField, margin);
- wlResultName.setLayoutData(fdlResultName);
-
- wResultField = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
- props.setLook(wResultField);
- wResultField.addModifyListener(lsMod);
- FormData fdResultName = new FormData();
- fdResultName.left = new FormAttachment(middle, 0);
- fdResultName.right = new FormAttachment(100, 0);
- fdResultName.top = new FormAttachment(wServerURLField, margin);
- wResultField.setLayoutData(fdResultName);
-
-
- // OK and cancel buttons
- wOK = new Button(shell, SWT.PUSH);
- wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
- wCancel = new Button(shell, SWT.PUSH);
- wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
-
- BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wResultField);
-
- // Add listeners for cancel and OK
- lsCancel = new Listener() {
- public void handleEvent(Event e) {cancel();}
- };
- lsOK = new Listener() {
- public void handleEvent(Event e) {ok();}
- };
-
- wCancel.addListener(SWT.Selection, lsCancel);
- wOK.addListener(SWT.Selection, lsOK);
-
- // default listener (for hitting "enter")
- lsDef = new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {ok();}
- };
- wStepname.addSelectionListener(lsDef);
- wFilenameField.addSelectionListener(lsDef);
- wServerURLField.addSelectionListener(lsDef);
- wResultField.addSelectionListener(lsDef);
- // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {cancel();}
- });
-
- // Set/Restore the dialog size based on last position on screen
- // The setSize() method is inherited from BaseStepDialog
- setSize();
-
- // populate the dialog with the values from the meta object
- populateDialog();
-
- // restore the changed flag to original value, as the modify listeners fire during dialog population
- meta.setChanged(changed);
-
- // open dialog and enter event loop
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- // at this point the dialog has closed, so either ok() or cancel() have been executed
- // The "stepname" variable is inherited from BaseStepDialog
- return stepname;
- }
-
- /**
- * This helper method puts the step configuration stored in the meta object
- * and puts it into the dialog controls.
- */
- private void populateDialog() {
- wStepname.selectAll();
- wFilenameField.setText(meta.getFilenameField());
- wServerURLField.setText(meta.getServerURLField());
- wResultField.setText(meta.getResultField());
- }
-
- /**
- * Called when the user cancels the dialog.
- */
- private void cancel() {
- // The "stepname" variable will be the return value for the open() method.
- // Setting to null to indicate that dialog was cancelled.
- stepname = null;
- // Restoring original "changed" flag on the met aobject
- meta.setChanged(changed);
- // close the SWT dialog window
- dispose();
- }
-
- /**
- * Called when the user confirms the dialog
- */
- private void ok() {
- // The "stepname" variable will be the return value for the open() method.
- // Setting to step name from the dialog control
- stepname = wStepname.getText();
- // Setting the settings to the meta object
- //meta.setOutputField(wFilenameField.getText());
- meta.setFilenameField(wFilenameField.getText());
- meta.setServerURLField(wServerURLField.getText());
- meta.setResultField(wResultField.getText());
- // close the SWT dialog window
- dispose();
- }
-}