http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/wavefunction.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/wavefunction.flex b/datacat/cup_flex/wavefunction.flex new file mode 100644 index 0000000..57fbce7 --- /dev/null +++ b/datacat/cup_flex/wavefunction.flex @@ -0,0 +1,217 @@ +package org.gridchem.client; +import java_cup.runtime.*; +import java.io.*; +import org.gridchem.client.common.*; +import org.gridchem.client.util.*; + + + +%% + +%class WavefunctionLexer +%public +%unicode +%cup +%cupdebug +%state ITER +%state ITER1 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "----------------------" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found Gaussian 98"); + yybegin(ITER); + return new Symbol(WavefunctionSym.FOUNDITER); + } +} + +<ITER> { + "geom" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "casscf" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + + "B3LYP" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } +"B1B95" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } +"B3PW91" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + + "RHF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found RHF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + + "ccsd" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found RHF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "SCFTYP=MCSCF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found SCFTYP=MCSCF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print("mcscf"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "SCFTYP=GVB" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found SCFTYP=GVB"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print("gvb"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "MP2" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found MP2"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "rhf" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found rhf"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "HF-SCF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found HF-SCF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream(Env.getApplicationDataDir() +Settings.fileSeparator + "runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + +} + + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {}
http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/wavefunction1.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/wavefunction1.flex b/datacat/cup_flex/wavefunction1.flex new file mode 100644 index 0000000..d630469 --- /dev/null +++ b/datacat/cup_flex/wavefunction1.flex @@ -0,0 +1,187 @@ +import java_cup.runtime.*; +import java.io.*; + +%% + +%class Wavefunction1Lexer +%public +%unicode +%cup +%cupdebug +%state ITER +%state ITER1 +%state IGNOREALL +%standalone +%8bit + +/* ___________________________________________ + Copied verbatim into generated lexer class: +*/ +%{ + public static boolean DEBUG = false; +%} + +LineTerminator = \r|\n|\r\n +InputCharacter = [^\r\n] +WhiteSpace = {LineTerminator} | [ \t\f] +Comment = {TraditionalComment} | {EndOfLineComment} | {DocumentationComment} +TraditionalComment = "/*" [^*] ~"*/" +EndOfLineComment = "//" {InputCharacter}* {LineTerminator} +DocumentationComment = "/**" {CommentContent} "*"+ "/" +CommentContent = ( [^*] | \*+ [^/*] )* /* adjust syntax font-coloring */ +Identifier = [:jletter:] [:jletterdigit:]* +dec_int_lit = 0 | [1-9][0-9]* +dec_int_id = [A-Za-z_][A-Za-z_0-9]* +DIGIT = [0-9] +FLOAT = [+|-]?{DIGIT}+"."{DIGIT}+ +INT = [+|-]?{DIGIT}+ +BOOL = [T|F] +EQ = "=" +STRING = [A-Z]+ +GRAB = [^(" "|\r|\n|\r\n| \t\f)]+ + +%% + +<YYINITIAL>{ + "************" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found Gaussian 98"); + yybegin(ITER); + return new Symbol(WavefunctionSym.FOUNDITER); + } +} + +<ITER> { + "geom" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "casscf" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + + "b3lyp" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found geom "); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "RHF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found RHF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + + "SCF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found RHF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "SCFTYP=MCSCF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found SCFTYP=MCSCF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print("mcscf"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "SCFTYP=GVB" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found SCFTYP=GVB"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print("gvb"); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "MP2" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found MP2"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "rhf" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found rhf"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + + "HF-SCF" { + if (Settings.DEBUG) System.out.println("WavefunctionFlex: Found HF-SCF"); + if (Settings.DEBUG) System.out.println(yytext()); + try{ + PrintStream temp = new PrintStream(new FileOutputStream("runtype2")); + temp.print(yytext()); + System.out.println(yytext());} + catch (IOException ie){ System.out.println("Error in Gaussian Lexer");} + yybegin(IGNOREALL); + return new Symbol(WavefunctionSym.RUNTYP); + } + +} + + + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/whichProgram.cup ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/whichProgram.cup b/datacat/cup_flex/whichProgram.cup new file mode 100644 index 0000000..a15676d --- /dev/null +++ b/datacat/cup_flex/whichProgram.cup @@ -0,0 +1,116 @@ +import java_cup.runtime.*; +import javax.swing.*; +import java.util.*; +import java.io.*; + + + +/* +OUTPUT FORMAT:____________________________________________________________ +1NSERCH= 0 + more text + SCF Done: E(RHF) = -7.85284496695 A.U. after 8 cycles + more text + Maximum Force 0.000000 0.000450 YES + RMS Force 0.000000 0.000300 YES + more text +TO MONITOR:____________________________________________________________ + iteration, energy + +MANUALLY ADD TO CUP-GENERATED CLASS IN SCFaParser.java:________________ + + +//add to CUP$SCFaParser$actions +public ParseSCF2 parseSCF; + +//add to the constructor of CUP$SCFaParser$actions + parseSCF = new ParseSCF2(); + +*/ + +action code {: + //__________________________________ + public static boolean DEBUG = true; + private static JTable table; + private static final String tableLabel = "SCF Intermediate Results:"; +// private static String cycle = "0"; + + + public static JTable getTable() { + return table; + } + + public static String getTableLabel() { + return tableLabel; + } + +// } +:} + + + + +terminal FOUNDITER, SCFDONE, NSearch, Energ, MaxGrad, RmsGrad; +terminal Integer ITERATION; +terminal Float ENERGY, MGRAD, RGRAD; +non terminal startpt, scfintro, scfpat, scfcycle, cycle, grad1, grad2; + + + + +/* ___________ + The grammer */ + +startpt ::= scfintro + scfpat + SCFDONE + {: if (DEBUG) System.out.println("CUP:gopt: end of parse tree "); + table = new JTable(); + +// table = parseSCF.getTable(); + :} + ; + + + + +scfintro ::= + FOUNDITER + {: if (DEBUG) System.out.println("CUP:gopt: found the start of Iteration"); :} +; + +scfpat ::= scfpat scfcycle + {: if (DEBUG) System.out.println("CUP:gopt: in scfpat"); :} + | + scfcycle +; + +scfcycle ::= Energ ENERGY:e +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gopt: ENERGY "+e); + :} +cycle +; + + + + +cycle ::= NSearch ITERATION:c +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gopt: ITERATION "+c); + :} +grad1 +grad2 + ; + +grad1 ::= MaxGrad MGRAD:mg +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gopt: Maximum Force "+mg); + :} +; + +grad2 ::= RmsGrad RGRAD:rg +{: //___________________________________________________________________ + if (DEBUG) System.out.println("CUP:gopt: RMS Force "+rg); + :} +; http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/cup_flex/whichProgram.flex ---------------------------------------------------------------------- diff --git a/datacat/cup_flex/whichProgram.flex b/datacat/cup_flex/whichProgram.flex new file mode 100644 index 0000000..a78764e --- /dev/null +++ b/datacat/cup_flex/whichProgram.flex @@ -0,0 +1,78 @@ + + + +%% + + + +%class WhichProgram +%public +%unicode +/* +%cup +%cupdebug +%ignorecase +*/ + +%state GETREVISION +%state GETVERSION +%state IGNOREALL + +%standalone +%8bit + +%{ + public static boolean DEBUG = false; + public static String format; +%} + +WORD = [A-Za-z]+ +INT = [+|-]?[0-9]+ +REVISIONNUM = [A-Za-z0-9"."]+ + + + +%% + + + +/* ___________ + Description */ + +<YYINITIAL>{ + "Gaussian 03," {if (Settings.DEBUG) System.out.println(yytext()); + WhichProgram.format = "Gauss03"; + } + "GAMESS VERSION =" {if (Settings.DEBUG) System.out.println(yytext()); + WhichProgram.format = "GAMESS"; + yybegin(GETVERSION); + } + + "PROGRAM SYSTEM MOLPRO" {System.out.println(yytext()); + WhichProgram.format = "Molpro"; + yybegin(IGNOREALL); + } + + + + .|\n {} +} + +<GETREVISION>{ + {REVISIONNUM} {if (Settings.DEBUG) System.out.println(yytext()); + yybegin(IGNOREALL); + } +} + +<GETVERSION>{ + [0-9]{4} {if (Settings.DEBUG) System.out.println(yytext()); + yybegin(IGNOREALL); + } +} + +<IGNOREALL>{ + .|\n {} +} + +.|\n {} + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/inchi-1 ---------------------------------------------------------------------- diff --git a/datacat/inchi-1 b/datacat/inchi-1 new file mode 100755 index 0000000..fa054fe Binary files /dev/null and b/datacat/inchi-1 differ http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/datacat/integration-tests/pom.xml b/datacat/integration-tests/pom.xml new file mode 100644 index 0000000..2e7b595 --- /dev/null +++ b/datacat/integration-tests/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>datacat</artifactId> + <groupId>org.apache.airavata.datacat</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>integration-tests</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.airavata.datacat</groupId> + <artifactId>models</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.airavata.datacat</groupId> + <artifactId>server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.airavata.datacat</groupId> + <artifactId>agent</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/integration-tests/src/test/java/org/apache/airavata/datacat/integration/IntegrationTest.java ---------------------------------------------------------------------- diff --git a/datacat/integration-tests/src/test/java/org/apache/airavata/datacat/integration/IntegrationTest.java b/datacat/integration-tests/src/test/java/org/apache/airavata/datacat/integration/IntegrationTest.java new file mode 100644 index 0000000..0ac901b --- /dev/null +++ b/datacat/integration-tests/src/test/java/org/apache/airavata/datacat/integration/IntegrationTest.java @@ -0,0 +1,154 @@ +/* +* +* 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.airavata.datacat.integration; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.airavata.datacat.agent.dispatcher.DispatcherService; +import org.apache.airavata.datacat.agent.monitor.IMonitor; +import org.apache.airavata.datacat.agent.monitor.impl.LocalFileSystemMonitor; +import org.apache.airavata.datacat.agent.util.AgentProperties; +import org.apache.airavata.datacat.models.PrimaryQueryParameter; +import org.apache.airavata.datacat.models.PrimaryQueryType; +import org.apache.airavata.datacat.server.db.solr.SolrClientFactory; +import org.apache.airavata.datacat.server.db.solr.SolrQuerier; +import org.apache.airavata.datacat.server.services.DataCatService; +import org.apache.airavata.datacat.server.services.PublisherService; +import org.apache.airavata.datacat.server.util.Constants; +import org.apache.airavata.datacat.server.util.ServerProperties; +import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrServerException; +import org.glassfish.grizzly.http.server.HttpServer; +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; +import org.glassfish.jersey.server.ResourceConfig; + +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +public class IntegrationTest extends TestCase { + + public void testSimpleIntegration() throws IOException, ClassNotFoundException, InterruptedException, SolrServerException { + //deleting file snapshot file + File file = new File("snapshot.ser"); + file.delete(); + System.out.println("snapshot.ser file deleted."); + + //Deleting Solr index files + SolrServer metadataClient = new SolrClientFactory().createSolrMetadataClient(); + metadataClient.deleteByQuery("*:*"); + metadataClient.commit(); + SolrServer aclClient = new SolrClientFactory().createSolrAclClient(); + aclClient.deleteByQuery("*:*"); + aclClient.commit(); + System.out.println("Deleted existing data in Solr"); + + //starting DataCat server + new Thread(new Runnable() { + @Override + public void run() { + try { + URI datacatUri = UriBuilder.fromUri( + ServerProperties.getInstance().getProperty(Constants.DATACAT_URI, "")).build(); + ResourceConfig datacatConfig = new ResourceConfig(DataCatService.class); + HttpServer datacatServer = GrizzlyHttpServerFactory.createHttpServer(datacatUri, datacatConfig); + + datacatServer.start(); + + URI publisherUri = UriBuilder.fromUri( + ServerProperties.getInstance().getProperty(Constants.PUBLISHER_URI, "")).build(); + ResourceConfig publisherConfig = new ResourceConfig(PublisherService.class); + HttpServer publisherServer = GrizzlyHttpServerFactory.createHttpServer(publisherUri, publisherConfig); + + publisherServer.start(); + } catch (Exception ex) { + ex.printStackTrace(); + Assert.assertTrue(false); + } + } + }).start(); + + + //starting DataCat agent + new Thread(new Runnable() { + @Override + public void run() { + try { + //waiting for some time to get the data indexed + Thread.sleep(1000 * 15); // waits for 15 seconds + AgentProperties properties = AgentProperties.getInstance(); + IMonitor iMonitor = new LocalFileSystemMonitor(); + DispatcherService dispatcherService = DispatcherService.getInstance(); + dispatcherService.startDispatcher(); + iMonitor.startMonitor(Paths.get(properties.getProperty( + org.apache.airavata.datacat.agent.util.Constants.DATA_ROOT, "")) + ); + + } catch (Exception ex) { + ex.printStackTrace(); + Assert.assertTrue(false); + } + } + }).start(); + + + //Testing the Query API + //waiting for some time to get the data indexed + Thread.sleep(1000 * 300); // waits for 30 seconds + + //FIXME Ideally this querying should be done via the REST API + //Querying using the DataCat API + List<PrimaryQueryParameter> primaryQueryParameters; + PrimaryQueryParameter parameter; + ArrayList<LinkedHashMap<String, Object>> result; + SolrQuerier solrQuerier = new SolrQuerier(); + + String username = "test"; + String[] groups = new String[]{"group_1", "group_2", "sudhakar"}; + + String primaryKey = ServerProperties.getInstance().getProperty(Constants.METADATA_PRIMARY_INDEX, "InChi"); + + //Field value search + primaryQueryParameters = new ArrayList<PrimaryQueryParameter>(); + parameter = new PrimaryQueryParameter(); + parameter.setField(primaryKey); + parameter.setFirstParameter("InChI=1S/C14H14N4O3/c1-7-5-9-10(6-8(7)2)18(3-4-19)12-11(15-9)13(20)17-14(21)16-12/h5-6,19H,3-4H2,1-2H3,(H,17,20,21)"); + parameter.setPrimaryQueryType(PrimaryQueryType.EQUALS); + primaryQueryParameters.add(parameter); + result = solrQuerier.getResultsFromParameters(primaryQueryParameters, username, groups, 1, 2); + Assert.assertTrue(result.size() >= 1); + + //Sub string search + primaryQueryParameters = new ArrayList<PrimaryQueryParameter>(); + parameter = new PrimaryQueryParameter(); + parameter.setField(primaryKey); + parameter.setFirstParameter("C14H14N4"); + parameter.setPrimaryQueryType(PrimaryQueryType.SUBSTRING); + primaryQueryParameters.add(parameter); + result = solrQuerier.getResultsFromParameters(primaryQueryParameters, username, groups, 1, 5); + Assert.assertTrue(result.size() >= 1); + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/laravel-pga/vendor/apache/thrift ---------------------------------------------------------------------- diff --git a/datacat/laravel-pga/vendor/apache/thrift b/datacat/laravel-pga/vendor/apache/thrift new file mode 160000 index 0000000..e758837 --- /dev/null +++ b/datacat/laravel-pga/vendor/apache/thrift @@ -0,0 +1 @@ +Subproject commit e758837339c16726b7c3198e9646466fc25519f3 http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/models/pom.xml ---------------------------------------------------------------------- diff --git a/datacat/models/pom.xml b/datacat/models/pom.xml new file mode 100644 index 0000000..e843c43 --- /dev/null +++ b/datacat/models/pom.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>datacat</artifactId> + <groupId>org.apache.airavata.datacat</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>models</artifactId> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <compilerArgument>-Xlint:unchecked</compilerArgument> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencies> + <!-- RabbitMQ dependencies - For the message-Broker --> + <dependency> + <groupId>com.rabbitmq</groupId> + <artifactId>amqp-client</artifactId> + <version>${rabbitmq.version}</version> + </dependency> + + <!-- Thrift dependency --> + <dependency> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + <version>${thrift.version}</version> + </dependency> + + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclDTO.java ---------------------------------------------------------------------- diff --git a/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclDTO.java b/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclDTO.java new file mode 100644 index 0000000..c86aebc --- /dev/null +++ b/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclDTO.java @@ -0,0 +1,53 @@ +/* +* +* 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.airavata.datacat.models; + +public class AclDTO { + private String id; + + private String[] acl; + + private String _version_; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String[] getAcl() { + return acl; + } + + public void setAcl(String[] acl) { + this.acl = acl; + } + + public String get_version_() { + return _version_; + } + + public void set_version_(String _version_) { + this._version_ = _version_; + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclFields.java ---------------------------------------------------------------------- diff --git a/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclFields.java b/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclFields.java new file mode 100644 index 0000000..a428f31 --- /dev/null +++ b/datacat/models/src/main/java/org/apache/airavata/datacat/models/AclFields.java @@ -0,0 +1,27 @@ +/* +* +* 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.airavata.datacat.models; + +public class AclFields { + + public static final String ID = "id"; + public static final String ACL = "acl"; +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/4231ac35/datacat/models/src/main/java/org/apache/airavata/datacat/models/Messaging/ExperimentOutputCreatedEvent.java ---------------------------------------------------------------------- diff --git a/datacat/models/src/main/java/org/apache/airavata/datacat/models/Messaging/ExperimentOutputCreatedEvent.java b/datacat/models/src/main/java/org/apache/airavata/datacat/models/Messaging/ExperimentOutputCreatedEvent.java new file mode 100644 index 0000000..92b9ab1 --- /dev/null +++ b/datacat/models/src/main/java/org/apache/airavata/datacat/models/Messaging/ExperimentOutputCreatedEvent.java @@ -0,0 +1,981 @@ +/** + * Autogenerated by Thrift Compiler (1.0.0-dev) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.datacat.models.Messaging; + +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +import javax.annotation.Generated; +import java.util.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2015-2-3") +public class ExperimentOutputCreatedEvent implements org.apache.thrift.TBase<ExperimentOutputCreatedEvent, ExperimentOutputCreatedEvent._Fields>, java.io.Serializable, Cloneable, Comparable<ExperimentOutputCreatedEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExperimentOutputCreatedEvent"); + + private static final org.apache.thrift.protocol.TField EXPERIMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField EXPERIMENT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("experimentName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField OUTPUT_PATH_FIELD_DESC = new org.apache.thrift.protocol.TField("outputPath", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField OWNER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerId", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField GATEWAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayName", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)6); + private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)7); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ExperimentOutputCreatedEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ExperimentOutputCreatedEventTupleSchemeFactory()); + } + + public String experimentId; // required + public String experimentName; // required + public String outputPath; // required + public String ownerId; // required + public String gatewayName; // required + public String applicationName; // required + public String host; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + EXPERIMENT_ID((short)1, "experimentId"), + EXPERIMENT_NAME((short)2, "experimentName"), + OUTPUT_PATH((short)3, "outputPath"), + OWNER_ID((short)4, "ownerId"), + GATEWAY_NAME((short)5, "gatewayName"), + APPLICATION_NAME((short)6, "applicationName"), + HOST((short)7, "host"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // EXPERIMENT_ID + return EXPERIMENT_ID; + case 2: // EXPERIMENT_NAME + return EXPERIMENT_NAME; + case 3: // OUTPUT_PATH + return OUTPUT_PATH; + case 4: // OWNER_ID + return OWNER_ID; + case 5: // GATEWAY_NAME + return GATEWAY_NAME; + case 6: // APPLICATION_NAME + return APPLICATION_NAME; + case 7: // HOST + return HOST; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("experimentId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EXPERIMENT_NAME, new org.apache.thrift.meta_data.FieldMetaData("experimentName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OUTPUT_PATH, new org.apache.thrift.meta_data.FieldMetaData("outputPath", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OWNER_ID, new org.apache.thrift.meta_data.FieldMetaData("ownerId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.GATEWAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("gatewayName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("applicationName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ExperimentOutputCreatedEvent.class, metaDataMap); + } + + public ExperimentOutputCreatedEvent() { + } + + public ExperimentOutputCreatedEvent( + String experimentId, + String experimentName, + String outputPath, + String ownerId, + String gatewayName, + String applicationName, + String host) + { + this(); + this.experimentId = experimentId; + this.experimentName = experimentName; + this.outputPath = outputPath; + this.ownerId = ownerId; + this.gatewayName = gatewayName; + this.applicationName = applicationName; + this.host = host; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ExperimentOutputCreatedEvent(ExperimentOutputCreatedEvent other) { + if (other.isSetExperimentId()) { + this.experimentId = other.experimentId; + } + if (other.isSetExperimentName()) { + this.experimentName = other.experimentName; + } + if (other.isSetOutputPath()) { + this.outputPath = other.outputPath; + } + if (other.isSetOwnerId()) { + this.ownerId = other.ownerId; + } + if (other.isSetGatewayName()) { + this.gatewayName = other.gatewayName; + } + if (other.isSetApplicationName()) { + this.applicationName = other.applicationName; + } + if (other.isSetHost()) { + this.host = other.host; + } + } + + public ExperimentOutputCreatedEvent deepCopy() { + return new ExperimentOutputCreatedEvent(this); + } + + @Override + public void clear() { + this.experimentId = null; + this.experimentName = null; + this.outputPath = null; + this.ownerId = null; + this.gatewayName = null; + this.applicationName = null; + this.host = null; + } + + public String getExperimentId() { + return this.experimentId; + } + + public ExperimentOutputCreatedEvent setExperimentId(String experimentId) { + this.experimentId = experimentId; + return this; + } + + public void unsetExperimentId() { + this.experimentId = null; + } + + /** Returns true if field experimentId is set (has been assigned a value) and false otherwise */ + public boolean isSetExperimentId() { + return this.experimentId != null; + } + + public void setExperimentIdIsSet(boolean value) { + if (!value) { + this.experimentId = null; + } + } + + public String getExperimentName() { + return this.experimentName; + } + + public ExperimentOutputCreatedEvent setExperimentName(String experimentName) { + this.experimentName = experimentName; + return this; + } + + public void unsetExperimentName() { + this.experimentName = null; + } + + /** Returns true if field experimentName is set (has been assigned a value) and false otherwise */ + public boolean isSetExperimentName() { + return this.experimentName != null; + } + + public void setExperimentNameIsSet(boolean value) { + if (!value) { + this.experimentName = null; + } + } + + public String getOutputPath() { + return this.outputPath; + } + + public ExperimentOutputCreatedEvent setOutputPath(String outputPath) { + this.outputPath = outputPath; + return this; + } + + public void unsetOutputPath() { + this.outputPath = null; + } + + /** Returns true if field outputPath is set (has been assigned a value) and false otherwise */ + public boolean isSetOutputPath() { + return this.outputPath != null; + } + + public void setOutputPathIsSet(boolean value) { + if (!value) { + this.outputPath = null; + } + } + + public String getOwnerId() { + return this.ownerId; + } + + public ExperimentOutputCreatedEvent setOwnerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + public void unsetOwnerId() { + this.ownerId = null; + } + + /** Returns true if field ownerId is set (has been assigned a value) and false otherwise */ + public boolean isSetOwnerId() { + return this.ownerId != null; + } + + public void setOwnerIdIsSet(boolean value) { + if (!value) { + this.ownerId = null; + } + } + + public String getGatewayName() { + return this.gatewayName; + } + + public ExperimentOutputCreatedEvent setGatewayName(String gatewayName) { + this.gatewayName = gatewayName; + return this; + } + + public void unsetGatewayName() { + this.gatewayName = null; + } + + /** Returns true if field gatewayName is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayName() { + return this.gatewayName != null; + } + + public void setGatewayNameIsSet(boolean value) { + if (!value) { + this.gatewayName = null; + } + } + + public String getApplicationName() { + return this.applicationName; + } + + public ExperimentOutputCreatedEvent setApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + public void unsetApplicationName() { + this.applicationName = null; + } + + /** Returns true if field applicationName is set (has been assigned a value) and false otherwise */ + public boolean isSetApplicationName() { + return this.applicationName != null; + } + + public void setApplicationNameIsSet(boolean value) { + if (!value) { + this.applicationName = null; + } + } + + public String getHost() { + return this.host; + } + + public ExperimentOutputCreatedEvent setHost(String host) { + this.host = host; + return this; + } + + public void unsetHost() { + this.host = null; + } + + /** Returns true if field host is set (has been assigned a value) and false otherwise */ + public boolean isSetHost() { + return this.host != null; + } + + public void setHostIsSet(boolean value) { + if (!value) { + this.host = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case EXPERIMENT_ID: + if (value == null) { + unsetExperimentId(); + } else { + setExperimentId((String)value); + } + break; + + case EXPERIMENT_NAME: + if (value == null) { + unsetExperimentName(); + } else { + setExperimentName((String)value); + } + break; + + case OUTPUT_PATH: + if (value == null) { + unsetOutputPath(); + } else { + setOutputPath((String)value); + } + break; + + case OWNER_ID: + if (value == null) { + unsetOwnerId(); + } else { + setOwnerId((String)value); + } + break; + + case GATEWAY_NAME: + if (value == null) { + unsetGatewayName(); + } else { + setGatewayName((String)value); + } + break; + + case APPLICATION_NAME: + if (value == null) { + unsetApplicationName(); + } else { + setApplicationName((String)value); + } + break; + + case HOST: + if (value == null) { + unsetHost(); + } else { + setHost((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case EXPERIMENT_ID: + return getExperimentId(); + + case EXPERIMENT_NAME: + return getExperimentName(); + + case OUTPUT_PATH: + return getOutputPath(); + + case OWNER_ID: + return getOwnerId(); + + case GATEWAY_NAME: + return getGatewayName(); + + case APPLICATION_NAME: + return getApplicationName(); + + case HOST: + return getHost(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case EXPERIMENT_ID: + return isSetExperimentId(); + case EXPERIMENT_NAME: + return isSetExperimentName(); + case OUTPUT_PATH: + return isSetOutputPath(); + case OWNER_ID: + return isSetOwnerId(); + case GATEWAY_NAME: + return isSetGatewayName(); + case APPLICATION_NAME: + return isSetApplicationName(); + case HOST: + return isSetHost(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ExperimentOutputCreatedEvent) + return this.equals((ExperimentOutputCreatedEvent)that); + return false; + } + + public boolean equals(ExperimentOutputCreatedEvent that) { + if (that == null) + return false; + + boolean this_present_experimentId = true && this.isSetExperimentId(); + boolean that_present_experimentId = true && that.isSetExperimentId(); + if (this_present_experimentId || that_present_experimentId) { + if (!(this_present_experimentId && that_present_experimentId)) + return false; + if (!this.experimentId.equals(that.experimentId)) + return false; + } + + boolean this_present_experimentName = true && this.isSetExperimentName(); + boolean that_present_experimentName = true && that.isSetExperimentName(); + if (this_present_experimentName || that_present_experimentName) { + if (!(this_present_experimentName && that_present_experimentName)) + return false; + if (!this.experimentName.equals(that.experimentName)) + return false; + } + + boolean this_present_outputPath = true && this.isSetOutputPath(); + boolean that_present_outputPath = true && that.isSetOutputPath(); + if (this_present_outputPath || that_present_outputPath) { + if (!(this_present_outputPath && that_present_outputPath)) + return false; + if (!this.outputPath.equals(that.outputPath)) + return false; + } + + boolean this_present_ownerId = true && this.isSetOwnerId(); + boolean that_present_ownerId = true && that.isSetOwnerId(); + if (this_present_ownerId || that_present_ownerId) { + if (!(this_present_ownerId && that_present_ownerId)) + return false; + if (!this.ownerId.equals(that.ownerId)) + return false; + } + + boolean this_present_gatewayName = true && this.isSetGatewayName(); + boolean that_present_gatewayName = true && that.isSetGatewayName(); + if (this_present_gatewayName || that_present_gatewayName) { + if (!(this_present_gatewayName && that_present_gatewayName)) + return false; + if (!this.gatewayName.equals(that.gatewayName)) + return false; + } + + boolean this_present_applicationName = true && this.isSetApplicationName(); + boolean that_present_applicationName = true && that.isSetApplicationName(); + if (this_present_applicationName || that_present_applicationName) { + if (!(this_present_applicationName && that_present_applicationName)) + return false; + if (!this.applicationName.equals(that.applicationName)) + return false; + } + + boolean this_present_host = true && this.isSetHost(); + boolean that_present_host = true && that.isSetHost(); + if (this_present_host || that_present_host) { + if (!(this_present_host && that_present_host)) + return false; + if (!this.host.equals(that.host)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_experimentId = true && (isSetExperimentId()); + list.add(present_experimentId); + if (present_experimentId) + list.add(experimentId); + + boolean present_experimentName = true && (isSetExperimentName()); + list.add(present_experimentName); + if (present_experimentName) + list.add(experimentName); + + boolean present_outputPath = true && (isSetOutputPath()); + list.add(present_outputPath); + if (present_outputPath) + list.add(outputPath); + + boolean present_ownerId = true && (isSetOwnerId()); + list.add(present_ownerId); + if (present_ownerId) + list.add(ownerId); + + boolean present_gatewayName = true && (isSetGatewayName()); + list.add(present_gatewayName); + if (present_gatewayName) + list.add(gatewayName); + + boolean present_applicationName = true && (isSetApplicationName()); + list.add(present_applicationName); + if (present_applicationName) + list.add(applicationName); + + boolean present_host = true && (isSetHost()); + list.add(present_host); + if (present_host) + list.add(host); + + return list.hashCode(); + } + + @Override + public int compareTo(ExperimentOutputCreatedEvent other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetExperimentId()).compareTo(other.isSetExperimentId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExperimentId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.experimentId, other.experimentId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetExperimentName()).compareTo(other.isSetExperimentName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetExperimentName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.experimentName, other.experimentName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOutputPath()).compareTo(other.isSetOutputPath()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOutputPath()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.outputPath, other.outputPath); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetOwnerId()).compareTo(other.isSetOwnerId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOwnerId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerId, other.ownerId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetGatewayName()).compareTo(other.isSetGatewayName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGatewayName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayName, other.gatewayName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetApplicationName()).compareTo(other.isSetApplicationName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetApplicationName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationName, other.applicationName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetHost()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ExperimentOutputCreatedEvent("); + boolean first = true; + + sb.append("experimentId:"); + if (this.experimentId == null) { + sb.append("null"); + } else { + sb.append(this.experimentId); + } + first = false; + if (!first) sb.append(", "); + sb.append("experimentName:"); + if (this.experimentName == null) { + sb.append("null"); + } else { + sb.append(this.experimentName); + } + first = false; + if (!first) sb.append(", "); + sb.append("outputPath:"); + if (this.outputPath == null) { + sb.append("null"); + } else { + sb.append(this.outputPath); + } + first = false; + if (!first) sb.append(", "); + sb.append("ownerId:"); + if (this.ownerId == null) { + sb.append("null"); + } else { + sb.append(this.ownerId); + } + first = false; + if (!first) sb.append(", "); + sb.append("gatewayName:"); + if (this.gatewayName == null) { + sb.append("null"); + } else { + sb.append(this.gatewayName); + } + first = false; + if (!first) sb.append(", "); + sb.append("applicationName:"); + if (this.applicationName == null) { + sb.append("null"); + } else { + sb.append(this.applicationName); + } + first = false; + if (!first) sb.append(", "); + sb.append("host:"); + if (this.host == null) { + sb.append("null"); + } else { + sb.append(this.host); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (experimentId == null) { + throw new TProtocolException("Required field 'experimentId' was not present! Struct: " + toString()); + } + if (experimentName == null) { + throw new TProtocolException("Required field 'experimentName' was not present! Struct: " + toString()); + } + if (outputPath == null) { + throw new TProtocolException("Required field 'outputPath' was not present! Struct: " + toString()); + } + if (ownerId == null) { + throw new TProtocolException("Required field 'ownerId' was not present! Struct: " + toString()); + } + if (gatewayName == null) { + throw new TProtocolException("Required field 'gatewayName' was not present! Struct: " + toString()); + } + if (applicationName == null) { + throw new TProtocolException("Required field 'applicationName' was not present! Struct: " + toString()); + } + if (host == null) { + throw new TProtocolException("Required field 'host' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class ExperimentOutputCreatedEventStandardSchemeFactory implements SchemeFactory { + public ExperimentOutputCreatedEventStandardScheme getScheme() { + return new ExperimentOutputCreatedEventStandardScheme(); + } + } + + private static class ExperimentOutputCreatedEventStandardScheme extends StandardScheme<ExperimentOutputCreatedEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ExperimentOutputCreatedEvent struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // EXPERIMENT_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // EXPERIMENT_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.experimentName = iprot.readString(); + struct.setExperimentNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // OUTPUT_PATH + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.outputPath = iprot.readString(); + struct.setOutputPathIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // OWNER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.ownerId = iprot.readString(); + struct.setOwnerIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // GATEWAY_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // APPLICATION_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // HOST + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, ExperimentOutputCreatedEvent struct) throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.experimentId != null) { + oprot.writeFieldBegin(EXPERIMENT_ID_FIELD_DESC); + oprot.writeString(struct.experimentId); + oprot.writeFieldEnd(); + } + if (struct.experimentName != null) { + oprot.writeFieldBegin(EXPERIMENT_NAME_FIELD_DESC); + oprot.writeString(struct.experimentName); + oprot.writeFieldEnd(); + } + if (struct.outputPath != null) { + oprot.writeFieldBegin(OUTPUT_PATH_FIELD_DESC); + oprot.writeString(struct.outputPath); + oprot.writeFieldEnd(); + } + if (struct.ownerId != null) { + oprot.writeFieldBegin(OWNER_ID_FIELD_DESC); + oprot.writeString(struct.ownerId); + oprot.writeFieldEnd(); + } + if (struct.gatewayName != null) { + oprot.writeFieldBegin(GATEWAY_NAME_FIELD_DESC); + oprot.writeString(struct.gatewayName); + oprot.writeFieldEnd(); + } + if (struct.applicationName != null) { + oprot.writeFieldBegin(APPLICATION_NAME_FIELD_DESC); + oprot.writeString(struct.applicationName); + oprot.writeFieldEnd(); + } + if (struct.host != null) { + oprot.writeFieldBegin(HOST_FIELD_DESC); + oprot.writeString(struct.host); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ExperimentOutputCreatedEventTupleSchemeFactory implements SchemeFactory { + public ExperimentOutputCreatedEventTupleScheme getScheme() { + return new ExperimentOutputCreatedEventTupleScheme(); + } + } + + private static class ExperimentOutputCreatedEventTupleScheme extends TupleScheme<ExperimentOutputCreatedEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ExperimentOutputCreatedEvent struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.experimentId); + oprot.writeString(struct.experimentName); + oprot.writeString(struct.outputPath); + oprot.writeString(struct.ownerId); + oprot.writeString(struct.gatewayName); + oprot.writeString(struct.applicationName); + oprot.writeString(struct.host); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ExperimentOutputCreatedEvent struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.experimentId = iprot.readString(); + struct.setExperimentIdIsSet(true); + struct.experimentName = iprot.readString(); + struct.setExperimentNameIsSet(true); + struct.outputPath = iprot.readString(); + struct.setOutputPathIsSet(true); + struct.ownerId = iprot.readString(); + struct.setOwnerIdIsSet(true); + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(true); + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } + } + +} +
