Home
Operator editor user manual
Contents
1. Kit version SE 1 5 for Linux from http www oracle com technetwork java javasebusiness downloads java archive downloads javase5 419410 html or any other source the user may wish It is required that you compile your program using this version due to the fact that certain nodes of the Grid have not been updated to use the latest version of the running environment 22 Install the development kit on your IDE In order to be able to make your IDE use the desired version of Java development kit you must first make it aware of it Eclipse Select from the menu bar Run gt Run Configurations Select Java Application as the type you want to configure If there are no configurations available please create one by right clicking on it and selecting New Go to the JRE Tab and select Installed JREs Run Configurations Create manage and run configurations Run a Java application Q Name Main main t Arguments BA JRE e Classpath 7 Source MB Environment El Common E Desktop Application Runtime JRE Eclipse Application Project execution environment J2SE 1 5 jdk1 5 0 22 Ei Java Applet v E Java Application O Execution environment J2SE 1 5 jdk1 5 0 22 7 Environments E Main Alternate JRE Installed JREs Ju JUnit Figure 3 Browse Installed JREs in Eclipse Press Add to add a new Development Kit and specify the path toward your new JRE folder Preferences Filtered type filter
2. class GrassNDVI extends GrassGeneric Override public void grassExecute StringBuilder builder builder append builder append Override public void Execute try generic grassExecute ao catch Exception e The only method which has to be overridden in order to be able to write GRASS scripts is grassExecute The script needs to be written within the StringBuilder object passed as input Each GRASS or BASH command must be followed by a An in order to signal next line of the command code The user is not obliged to extend Execute method as previously stated only if there are additional operations to be performed outside what GRASS and Linux BASH scripts can offer Most often would be the case when the user wants to execute two or more scripts sequentially or in parallel GRASS Description In the previous subsection there was a section on how to integrate your operator with GRASS scripts but there was no mention of how to create an operator using this type of program Note Previous Grass knowledge is required As it turns out there are a few limitations inherent within the GRASS executables The first limitation is the fact that when the user tries to output a georeferenced image using r out gdal an error occurs Segmentation Fault The only supported output is GeoTiff In order to circumvent this the user may change the Grass distributable but it is advised
3. int i2 Integer parseInt this getParams Integer 13 11 12 Writer output null Integers cannot be passed as output only files File f new File this getParanms get 2 try f createNewFile output new BufferedWriter new FileWriter f output write i3 toString catch IOException ex Logger getLogger Add2Ints class getName log finally if output null try output close catch IOException ex err 2 Grass NDVI This operator deals with creating a NDVI cover of the area of a Red and Near Infrared Image Inputs Red Image Band Near Infrared Image Band Output NDVI Image Note This operator uses the Grass API provided in the distributable package gPOperators public class GrassNDVI extends GrassGeneric Override public void grassExecute StringBuilder builder builder GRASS builder builder builder builder GRASS builder builder append An Import begin append r in gdal input append this getParams get 0 append output image 0 append location intermediary An append g gisenv set LOCATION NAME intermediary An Import end append r in gdal input append this getParams get 1 append output image 1 append An Calculation of NDVI Image builder append r mapcalc output float imagel image0 float imagel image0 N An builder appen
4. not to do so since testing locally differs from executing on the Grid This facility is for Grass experts only which are familiar with Grass development and internal workings of it To solve the segmentation fault problem it is required to export the file using r out tiff first and that the extension of the outputted file be tif Only afterwards is it possible to export using r out gdal by using the same name r in gdal input input tif output internal reprl location intermediary import Tiff image into location intermediary g gisenv set LOCATION NAM change current location created your code here E intermediary to the one where the input image has been r out tiff input internal reprl output file tif texport Tiff without geographic reference r out gdal input internal reprl output file tif overwrite existing Tiff file in order to obtain referenced file 4 Examples The following section will detail two examples one of creating a simple operator and one which deals with using GRASS as in order to achieve satellite image processing 1 Adding two numbers This operator deals with the simple function of adding two numbers Inputs Constant Integer Consta Output File containing the resul nt Integer t of the addition package gPOperators import java util Vector public class GrassNDVI extends Operator Override public void Execute int il Integer parseInt this getParams
5. 2 days delay for releasing the operator for production usage this time is required for the GreenLand team to validate it and to assure that it function correctly both on standalone machines and Grid infrastructure If the operator is not valid it will be not made accessible throughout the GreenLand application not even for its owner Before using this option there is the need to download an example using the Download operator API that highlights how to extend basic functionalities in order to create your own operator Within this page some mandatory fields are displayed to the users e Name represents the operator s name throughout the GreenLand application e Description it is useful to know what is the functionality provided by this operator Operator Editor x Operator details Operator inputs outputs types Name Input 1 imagettf y Description Output image tif Category Basic Operator E Privacy Private gt New operator rivacy Private MA Update operator Operator functionality 7 Java class name Download operator API D aa Figure 1 Operator creation module especially for users that do not own the module Category the best solution is to group operators that share the same functionality Choose the best one for your operator Privacy public or private attributes will influence the operator s visibility throughout the GreenLand ap
6. Operator Editor User manual Contact Dorian Gorgan dorian gorgan cs utcluj ro Cluj Napoca 2012 Contents oa 3 DA E 3 Be ARO deel Anal Alea lel die sh a A ede eeeeddanct E ica SR ER eecencncnccs 5 oa 5 2 R nning ceescccsse tecccecccscorsesccccceenees E MEROS cab e NES ns ene CE EEE FEE UST c Ra E 6 A ao 11 Ea 12 A O E RR SR E A O RR 13 T Adding O se A SR A A NS RR E 13 Pa e ISS NDVI e rea re ES E RE ERR RE RC RE AS RG E RR 14 SE EConclusionta a poa cece resect Dt RIR DO oa iat RD er DDR te SR RD eeu ee a 15 1 Introduction This platform has been created with the idea that individual users of the GreenLand platform may be able to customize their programs running on the Grid up to their smallest elements which are the operators This document is an introduction into operator creation and updating It also highlights the rules for these operations It presents in great detail the Graphical User Interface and Programming Interface used in this application 2 Interface The Operator Editor is part of the Greenland application which may find at http cgis2ui mediogrid utcluj ro GreenLandv2 Once signed in the user will select Add Workflows from the top menu bar and then from the newly opened section select the OperatorMng button At this moment a new modal widow will be displayed Figure 1 The user is able to create a new operator by using the New operator menu option There is an approximately 1
7. ce to JRE in Netbeans 2 3 Select the default development kit for your project In order to compile your project using the Java SE 1 5 Development Kit you will have to tell your IDE which platform to specifically use At this moment we start from the premise that the user has already created a project Eclipse When working with Eclipse it is important to note that the Run Configurations are not attached to a given project in a one to one fashion as in Netbeans Create new Run Configurations for your Project Run gt Run Configurations gt Java Application gt New JRE gt Alternate JRE gt JSE 1 5 O Main Arguments Bi JRE Classpath Es Source EB Environment E Common Runtime JRE Project execution environment J2SE 1 5 jdk1 5 0 22 O Execution environment J2SE 1 5 jdk1 5 0_22 v Environments Alternate JRE Installed JREs Figure 7 Eclipse Project Java Running Environment Set Java Running Environment Libraries for your Project Classpath gt Bootstrap entries gt Add JRE System Library J2SE 1 5 gt Remove JRE System Library J2SE 1 6 or J2SE 1 7 Main t9 Arguments BA JRE Classpath E Source FB Environment E Common Classpath Bootstrap Entries BA JRE System Library J2SE 1 5 User Entries gt 2 GrassOperators default classpath Figure 8 Add Eclipse Classpath Entries Netbeans Each Netbeans project has exactly one running configuration atta
8. ched to it Select Project gt Project Properties gt Libraries gt Java Platform Please see Figure 5 2 4 Determine your working directory and program arguments of your project The last thing the user has to do before he can start developing his own code is establish the working directory which must contain all the needed files If the user decides to use GRASS he will have to include both GRASS program archive and GRASS dependency package This section will also present how to test his program using defined input parameters Eclipse Run gt Run Configurations gt Arguments a Program Arguments b Working Directory Main Arguments BA JRE gt Classpath E Source BB Environment E Common Program arguments O O NULL GrassEVI GrassNDVI Input1 tif Input2 tif Output3 tiF Variables Working directory Default Other home vladdoru Desktop IMAGES EVI_TEST test3 Workspace File System Variables Figure 9 Passing Arguments and Working Directory in Eclipse Netbeans Select Project gt Project Properties gt Run a Arguments b Working Directory Project Properties GrassOperators Categories iii Configuration lt default config gt y New gt Libraries v o Build gt Compiling 2 Packaging Main Class OperationExec Browse Documenting Arguments anbult tif istanbul3 tif istanbul4 tif result tiF Run 2 Application Working Directory home vladdoru Desktop EVI TEST Br
9. d r colors map output rules ndvi n String output this getParams get 2 GRASS builder builder 5 Conclusion Export Please note the order and limitations append r out tiff input output output output An append r out gdal input output output output An The advantage of using this platform for operator submission is much faster than the traditional way of development where the user asks the administrators to integrate the developed program into the ESIP platform If a certain operator is not satisfactory the user may choose to replace it with his her own version thus creating a solution which much better copes with his her everyday needs rather than relying on a general solution offered by the system
10. output tif arguments Note Each argument is separated by a comma from its neighbors Note Every argument except for the last is considered to be input for the operator Note The last operator must be a file because if it is not it cannot be communicated over the Grid platform API Description In order to create a class which can be executed using the provided API the user must extend the class Operator and override the method Execute In order to work this class must be part of the gPOperators package package gPOperators import java util Vector public class GrassGeneric extends Operator Override public void Execute int i 0 String inputArgl this getParams get i First Input Argument i String inputArg2 this getParams get i Second Input Argument String outputArg2 this getParams get i Last Output Argument To be able to access the parameters sent to a operator the user must access them by calling the method getParams get X where X is the number of the parameter This function is defined in class Operator and is available to all subclasses extending it In order to create a class which uses GRASS to solve the satellite image processing problems the user must extend the class GrassGeneric which in its turn extends the class Operator thus satisfying the before mentioned requirement The same constraints as before apply package gPOperators import java util Vector public
11. owse 2 Web Start gt Formatting VM Options e g Xms10m Figure 10 Passing Arguments and Working Directory in Netbeans The Grid program takes a series of 5 arguments from which it extracts information about how to execute it O O NULL Grass GrassNDVI input1 tif input2 tif output tif The first represents whether the operator should be monitored or not on the Grid e 0 not monitored e 1 monitored This information is handled by gProcess and the user must not concern himself with it anymore The default value of O should be passed when executing locally The second parameter represents the identifier of the iPDG sent to the platform Again the user must not be concerned with it the value O will do The third parameter represents an execution name given to the operator The value of NULL will suffice for a local execution Forth is the name of the operator being executed and has no real meaning when it is executed locally Any value not containing a space will suffice The fifth argument is the only one with importance when the operator is not on the Grid It is surrounded by right brackets and it contains the name of the class implementing the required functionality and the arguments which that class takes GrassNDVI input1 tif input2 tif output tif name of class Note The name of the executing class is separated from the rest of the parameters by a minus sign GrassNDVI input1 tif input2 tif
12. plication Private use means that the module could be used only by its own creator while the public property allows its usage for the entire community Java class name this input should contain exactly the same name as the java class that was used to extend the API functionality Browse when creating a new operator there is the need to extend the functionality provided by the existing API archive This is a java example that needs to be further changed in order to implement your own type of actions When inserting the operator into the GreenLand system you should provide an archive with all the java classes including external libraries and dependencies The archive could have rar zip and tar gz formats Inputs outputs types this section allows the users to specify the inputs and the outputs types based on the java internal implementation When changing the module s properties the Update operator menu option should be used Figure 2 On the top of the page there is a table of operators belonging to the current signed in user Selecting one of them will enable its properties to be displayed in the lower section of the page that has similar functionalities with the one presented in the operator creation paragraph There are three states available for an operator Pending set just after its creation This means that the operator will be first analyzed by the GreenLand team to verify if it adopts the principles expressed ea
13. redefined manner During the course of this chapter we will present the steps and requirements in order to build your own gProcess operator We will show some tricks in order to embed already existing programs within the newly created operator These may be implemented in any programming language as long as these programs can run within the Linux operating system This constraint is imposed by the underlying Grid platform Finally we will present the GRASS framework for Grid execution and how by simply extending a class and overriding one methods the user can have his or her own operator The IDE s of choice for presenting this task will be Eclipse and Netbeans 1 Downloading the API Before the user can start implementing his or her operator it is advised to download the API http cgis2ui mediogrid utcluj ro 8195 GreenLandv2 OperatorAPI rar for gProcess execution and start exploring it in order to get a better grip of what is allowed and how parameters are passed to the program Please see Figure 2 for an example as to from where to download the file The content of the downloaded API is as follows a JAR containing the API for gProcess execution and GRASS deployment Operators jar JAR containing the dependencies for Grid execution apmon jar GRASS application distributable archive grass tar gz GRASS dependency package dummy_location tar gz papos Main class of Operators jar OperationExec class In order to be able
14. rlier Name description category and privacy are the only fields that could be update within this period Updated_requested the functionality provided by the operator contains syntactic error or Operator Editor x Name Status Description Test_user Pending testtest 4 test_user_1 Pending test v New operator Operator details 7 Operator inputs outputs types Update operator LETS io Input 1 ageltif xX gt Input 2 int Category Basic Operator Description testtest R A T Output Privacy Private y Operator functionality Java class name Test Figure 2 Update operator module it does not perform correctly At this stage it is recommended to update the operator s implementation by rewriting the java classes Operators that share this status are not made accessible throughout the GreenLand application e Valid the operator functions correctly and it is released to the users community 3 Programming Interface To the user interface there is also attached a programming interface which allows the user to create the operators and to download a gProcess compatible framework for executing operators on the Grid Why is there the need for this programming interface It is because gProcess has a unique way of passing parameters to its operators This mode of passing constrains the operator to be implemented in Java and to have its arguments passed in a specific p
15. text The selected JRE does not support the current compiler compliance level of 1 6 Y Java Add remove or edit JRE definitions By default the checked JRE is added to the build path of gt Installed JREs newly created Java projects Installed JREs Name Location Type BA java 6 openjdk ust lib jvm java 6 openjdk Standard VM Y BA jdk1 5 0_22 usr local sbin jdk1 5 0_22 Standard VM Search Figure 4 Add Reference to JRE in Eclipse Netbeans Select from Project Explorer any project and select Properties Select Libraries category and choose Manage Platforms Project Properties GrassOperators Categories 2 Sources Java Platform JDK 1 5 y y o Build Browse 2 Compiling N o Packaging Compile Processor Run Compile Tests Run Tests Documenting gt Run Processor path Libraries v Application E Classpath for Compiling Sources Add Project 2 Web Start 2 Formatting Add Library Add JAR Eolder Y Build Projects on Classpath OK Cancel Help Figure 5 Select JRE in Netbeans Specify the path towards the Java SE 1 5 development kit Java Platform Manager Use the Javadoc tab to register the API documentation For your JDK in the IDE Click Add Platform to register other Java SE Java ME and JavaFX platform versions Platforms Platform Name JDK 1 6 Default CDK 1 6 Default Platform Folder jusr lib jum default java Add Platform Re EJES Figure 6 Add referen
16. to use the framework all the files specified above must be included within the archive submitted as the operator files Please see Sect 2 Before continuing to the implementation phase of this tutorial it is advised for the user to have a general overview of the limitations this framework imposes a Testing of any operators to be inserted within the gProcess platform will be done within the confines of a Linux operating system b All Operators which will be submitted to gProcess will be compiled using the JDK 1 5 or any previous version of the Java SE platform c When creating the operators be it that the programmer uses the framework provided or starts from scratch Either way the strict mode of passing parameters must be respected More will be detailed in the next Section 2 Running program locally Before uploading your operators to gPorcess it is best that the user tests them locally In order to be able to do this you should follow these steps Install Java SE 1 5 on your Linux machine Install the development kit on your IDE Select the default development kit for your project Ap wr a Determine your working directory and program arguments of your project After completing these steps you will be able to run your application locally The IDE s for which each of these steps will been discussed and detailed are Eclipse and Netbeans 2 1 Install Java SE 1 5 on your Linux machine First step is to download the Java Development
Download Pdf Manuals
Related Search
Related Contents
Pioneer HGW4 User's Manual à découvrir ici - Ferme des Etoiles 取扱説明書 電動かき氷器 HG-ZC-3168 MODE D`EMPLOI - Heta A/S Support Copyright © All rights reserved.
Failed to retrieve file