You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by th...@apache.org on 2017/03/27 15:19:11 UTC
[10/19] apex-malhar git commit: SPOI-9032 Added sample application
for Inner Join
SPOI-9032 Added sample application for Inner Join
Project: http://git-wip-us.apache.org/repos/asf/apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-malhar/commit/ca12bca0
Tree: http://git-wip-us.apache.org/repos/asf/apex-malhar/tree/ca12bca0
Diff: http://git-wip-us.apache.org/repos/asf/apex-malhar/diff/ca12bca0
Branch: refs/heads/master
Commit: ca12bca03b0ac0525fe779895cb40340f6666147
Parents: 172b20a
Author: chaitanya <ch...@apache.org>
Authored: Tue Sep 13 12:07:40 2016 +0530
Committer: Lakshmi Prasanna Velineni <la...@datatorrent.com>
Committed: Sun Mar 26 11:43:48 2017 -0700
----------------------------------------------------------------------
examples/innerjoin/README.md | 6 +
.../innerjoin/XmlJavadocCommentsExtractor.xsl | 44 +++
examples/innerjoin/pom.xml | 267 +++++++++++++++++++
examples/innerjoin/src/assemble/appPackage.xml | 43 +++
.../com/example/join/InnerJoinApplication.java | 39 +++
.../java/com/example/join/POJOGenerator.java | 260 ++++++++++++++++++
.../src/main/resources/META-INF/properties.xml | 36 +++
.../example/join/InnerJoinApplicationTest.java | 21 ++
.../src/test/resources/log4j.properties | 22 ++
9 files changed, 738 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/README.md
----------------------------------------------------------------------
diff --git a/examples/innerjoin/README.md b/examples/innerjoin/README.md
new file mode 100644
index 0000000..7cc1d7d
--- /dev/null
+++ b/examples/innerjoin/README.md
@@ -0,0 +1,6 @@
+Sample application to show how to use the POJOInnerJoinOperator to join two data streams.
+
+Operators in sample application are as follows:
+1) POJOGenerator which emits SalesEvent/ProductEvent POJO's
+2) POJOInnerJoinOperator which joins two POJO streams and emits POJO tuple.
+3) ConsoleOutputOperator which write joined POJO tuples to stdout.
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/XmlJavadocCommentsExtractor.xsl
----------------------------------------------------------------------
diff --git a/examples/innerjoin/XmlJavadocCommentsExtractor.xsl b/examples/innerjoin/XmlJavadocCommentsExtractor.xsl
new file mode 100644
index 0000000..08075a9
--- /dev/null
+++ b/examples/innerjoin/XmlJavadocCommentsExtractor.xsl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<!--
+ Document : XmlJavadocCommentsExtractor.xsl
+ Created on : September 16, 2014, 11:30 AM
+ Description:
+ The transformation strips off all information except for comments and tags from xml javadoc generated by xml-doclet.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" standalone="yes"/>
+
+ <!-- copy xml by selecting only the following nodes, attributes and text -->
+ <xsl:template match="node()|text()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="root|package|class|interface|method|field|type|comment|tag|text()|@name|@qualified|@text"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Strip off the following paths from the selected xml -->
+ <xsl:template match="//root/package/interface/interface
+ |//root/package/interface/method/@qualified
+ |//root/package/class/interface
+ |//root/package/class/class
+ |//root/package/class/method/@qualified
+ |//root/package/class/field/@qualified" />
+
+ <xsl:strip-space elements="*"/>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/pom.xml
----------------------------------------------------------------------
diff --git a/examples/innerjoin/pom.xml b/examples/innerjoin/pom.xml
new file mode 100644
index 0000000..29c1b90
--- /dev/null
+++ b/examples/innerjoin/pom.xml
@@ -0,0 +1,267 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.example</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>innerjoin</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Inner Join Application</name>
+ <description>Sample Application for Inner Join</description>
+
+ <properties>
+ <!-- change this if you desire to use a different version of Apex Core -->
+ <apex.version>3.5.0</apex.version>
+ <malhar.version>3.6.0</malhar.version>
+ <apex.apppackage.classpath>lib/*.jar</apex.apppackage.classpath>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <source>1.7</source>
+ <target>1.7</target>
+ <debug>true</debug>
+ <optimize>false</optimize>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>target/deps</outputDirectory>
+ <includeScope>runtime</includeScope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>app-package-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}-${project.version}-apexapp</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/assemble/appPackage.xml</descriptor>
+ </descriptors>
+ <archiverConfig>
+ <defaultDirectoryMode>0755</defaultDirectoryMode>
+ </archiverConfig>
+ <archive>
+ <manifestEntries>
+ <Class-Path>${apex.apppackage.classpath}</Class-Path>
+ <DT-Engine-Version>${apex.version}</DT-Engine-Version>
+ <DT-App-Package-Group-Id>${project.groupId}</DT-App-Package-Group-Id>
+ <DT-App-Package-Name>${project.artifactId}</DT-App-Package-Name>
+ <DT-App-Package-Version>${project.version}</DT-App-Package-Version>
+ <DT-App-Package-Display-Name>${project.name}</DT-App-Package-Display-Name>
+ <DT-App-Package-Description>${project.description}</DT-App-Package-Description>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <move file="${project.build.directory}/${project.artifactId}-${project.version}-apexapp.jar"
+ tofile="${project.build.directory}/${project.artifactId}-${project.version}.apa" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <!-- create resource directory for xml javadoc-->
+ <id>createJavadocDirectory</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <tasks>
+ <delete dir="${project.build.directory}/generated-resources/xml-javadoc"/>
+ <mkdir dir="${project.build.directory}/generated-resources/xml-javadoc"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/${project.artifactId}-${project.version}.apa</file>
+ <type>apa</type>
+ </artifact>
+ </artifacts>
+ <skipAttach>false</skipAttach>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- generate javdoc -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <!-- generate xml javadoc -->
+ <execution>
+ <id>xml-doclet</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ <configuration>
+ <doclet>com.github.markusbernhardt.xmldoclet.XmlDoclet</doclet>
+ <additionalparam>-d ${project.build.directory}/generated-resources/xml-javadoc -filename ${project.artifactId}-${project.version}-javadoc.xml</additionalparam>
+ <useStandardDocletOptions>false</useStandardDocletOptions>
+ <docletArtifact>
+ <groupId>com.github.markusbernhardt</groupId>
+ <artifactId>xml-doclet</artifactId>
+ <version>1.0.4</version>
+ </docletArtifact>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Transform xml javadoc to stripped down version containing only class/interface comments and tags-->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>transform-xmljavadoc</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>transform</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <transformationSets>
+ <transformationSet>
+ <dir>${project.build.directory}/generated-resources/xml-javadoc</dir>
+ <includes>
+ <include>${project.artifactId}-${project.version}-javadoc.xml</include>
+ </includes>
+ <stylesheet>XmlJavadocCommentsExtractor.xsl</stylesheet>
+ <outputDir>${project.build.directory}/generated-resources/xml-javadoc</outputDir>
+ </transformationSet>
+ </transformationSets>
+ </configuration>
+ </plugin>
+ <!-- copy xml javadoc to class jar -->
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.build.directory}/generated-resources/xml-javadoc</directory>
+ <includes>
+ <include>${project.artifactId}-${project.version}-javadoc.xml</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <dependencies>
+ <!-- add your dependencies here -->
+ <dependency>
+ <groupId>org.apache.apex</groupId>
+ <artifactId>malhar-library</artifactId>
+ <version>${malhar.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.apex</groupId>
+ <artifactId>apex-common</artifactId>
+ <version>${apex.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.apex</groupId>
+ <artifactId>apex-engine</artifactId>
+ <version>${apex.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>2.7.8</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/assemble/appPackage.xml
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/assemble/appPackage.xml b/examples/innerjoin/src/assemble/appPackage.xml
new file mode 100644
index 0000000..7ad071c
--- /dev/null
+++ b/examples/innerjoin/src/assemble/appPackage.xml
@@ -0,0 +1,43 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>appPackage</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}/target/</directory>
+ <outputDirectory>/app</outputDirectory>
+ <includes>
+ <include>${project.artifactId}-${project.version}.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/deps</directory>
+ <outputDirectory>/lib</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/site/conf</directory>
+ <outputDirectory>/conf</outputDirectory>
+ <includes>
+ <include>*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/META-INF</directory>
+ <outputDirectory>/META-INF</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/app</directory>
+ <outputDirectory>/app</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/resources</directory>
+ <outputDirectory>/resources</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/main/java/com/example/join/InnerJoinApplication.java
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/main/java/com/example/join/InnerJoinApplication.java b/examples/innerjoin/src/main/java/com/example/join/InnerJoinApplication.java
new file mode 100644
index 0000000..0b2f663
--- /dev/null
+++ b/examples/innerjoin/src/main/java/com/example/join/InnerJoinApplication.java
@@ -0,0 +1,39 @@
+package com.example.join;
+
+import org.apache.apex.malhar.lib.join.POJOInnerJoinOperator;
+import org.apache.hadoop.conf.Configuration;
+
+import com.datatorrent.api.Context;
+import com.datatorrent.api.DAG;
+import com.datatorrent.api.StreamingApplication;
+import com.datatorrent.api.annotation.ApplicationAnnotation;
+import com.datatorrent.common.partitioner.StatelessPartitioner;
+import com.datatorrent.lib.io.ConsoleOutputOperator;
+
+@ApplicationAnnotation(name="InnerJoinExample")
+public class InnerJoinApplication implements StreamingApplication
+{
+ @Override
+ public void populateDAG(DAG dag, Configuration conf)
+ {
+ // SalesEvent Generator
+ POJOGenerator salesGenerator = dag.addOperator("Input1", new POJOGenerator());
+ // ProductEvent Generator
+ POJOGenerator productGenerator = dag.addOperator("Input2", new POJOGenerator());
+ productGenerator.setSalesEvent(false);
+
+ // Inner join Operator
+ POJOInnerJoinOperator join = dag.addOperator("Join", new POJOInnerJoinOperator());
+ ConsoleOutputOperator output = dag.addOperator("Output", new ConsoleOutputOperator());
+
+ // Streams
+ dag.addStream("SalesToJoin", salesGenerator.output, join.input1);
+ dag.addStream("ProductToJoin", productGenerator.output, join.input2);
+ dag.addStream("JoinToConsole", join.outputPort, output.input);
+
+ // Setting tuple class properties to the ports of join operator
+ dag.setInputPortAttribute(join.input1, Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class);
+ dag.setInputPortAttribute(join.input2, Context.PortContext.TUPLE_CLASS, POJOGenerator.ProductEvent.class);
+ dag.setOutputPortAttribute(join.outputPort,Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/main/java/com/example/join/POJOGenerator.java
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/main/java/com/example/join/POJOGenerator.java b/examples/innerjoin/src/main/java/com/example/join/POJOGenerator.java
new file mode 100644
index 0000000..613c80e
--- /dev/null
+++ b/examples/innerjoin/src/main/java/com/example/join/POJOGenerator.java
@@ -0,0 +1,260 @@
+package com.example.join;
+
+import java.util.Random;
+
+import javax.validation.constraints.Min;
+
+import com.datatorrent.api.Context;
+import com.datatorrent.api.DefaultOutputPort;
+import com.datatorrent.api.InputOperator;
+
+/**
+ * Generates and emits the SalesEvent/ProductEvent based on isSalesEvent.
+ */
+public class POJOGenerator implements InputOperator
+{
+ @Min(1)
+ private int maxProductId = 100000;
+ @Min(1)
+ private int maxCustomerId = 100000;
+ @Min(1)
+ private int maxProductCategories = 100;
+ private double maxAmount = 100.0;
+ private long tuplesCounter;
+ private long time;
+ private long timeIncrement;
+ private boolean isSalesEvent = true;
+ // Limit number of emitted tuples per window
+ @Min(0)
+ private long maxTuplesPerWindow = 100;
+ private final Random random = new Random();
+ public final transient DefaultOutputPort<Object> output = new DefaultOutputPort<>();
+
+ @Override
+ public void beginWindow(long windowId)
+ {
+ tuplesCounter = 0;
+ }
+
+ @Override
+ public void endWindow()
+ {
+ time += timeIncrement;
+ }
+
+ @Override
+ public void setup(Context.OperatorContext context)
+ {
+ time = System.currentTimeMillis();
+ timeIncrement = context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) *
+ context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS);
+ }
+
+ @Override
+ public void teardown()
+ {
+
+ }
+
+ SalesEvent generateSalesEvent() throws Exception {
+
+ SalesEvent salesEvent = new SalesEvent();
+ salesEvent.productId = randomId(maxProductId);
+ salesEvent.customerId = randomId(maxCustomerId);
+ salesEvent.amount = randomAmount();
+ salesEvent.timestamp = time;
+ return salesEvent;
+ }
+
+ ProductEvent generateProductEvent() throws Exception {
+ ProductEvent productEvent = new ProductEvent();
+ productEvent.productId = randomId(maxProductId);
+ productEvent.productCategory = randomId(maxProductCategories);
+ productEvent.timestamp = time;
+ return productEvent;
+ }
+
+ private int randomId(int max) {
+ if (max < 1) return 1;
+ return 1 + random.nextInt(max);
+ }
+
+ private double randomAmount() {
+ return maxAmount * random.nextDouble();
+ }
+
+ @Override
+ public void emitTuples()
+ {
+ while (tuplesCounter++ < maxTuplesPerWindow) {
+ try {
+ if (isSalesEvent) {
+ SalesEvent event = generateSalesEvent();
+ this.output.emit(event);
+ } else {
+ ProductEvent event = generateProductEvent();
+ this.output.emit(event);
+ }
+
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+
+ public static class SalesEvent
+ {
+ public int customerId;
+ public int productId;
+ public int productCategory;
+ public double amount;
+ public long timestamp;
+
+ public int getCustomerId()
+ {
+ return customerId;
+ }
+
+ public void setCustomerId(int customerId)
+ {
+ this.customerId = customerId;
+ }
+
+ public int getProductId()
+ {
+ return productId;
+ }
+
+ public void setProductId(int productId)
+ {
+ this.productId = productId;
+ }
+
+ public int getProductCategory()
+ {
+ return productCategory;
+ }
+
+ public void setProductCategory(int productCategory)
+ {
+ this.productCategory = productCategory;
+ }
+
+ public double getAmount()
+ {
+ return amount;
+ }
+
+ public void setAmount(double amount)
+ {
+ this.amount = amount;
+ }
+
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+ }
+
+ public static class ProductEvent
+ {
+ public int productId;
+ public int productCategory;
+ public long timestamp;
+
+ public int getProductId()
+ {
+ return productId;
+ }
+
+ public void setProductId(int productId)
+ {
+ this.productId = productId;
+ }
+
+ public int getProductCategory()
+ {
+ return productCategory;
+ }
+
+ public void setProductCategory(int productCategory)
+ {
+ this.productCategory = productCategory;
+ }
+
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+ }
+
+ public int getMaxProductId()
+ {
+ return maxProductId;
+ }
+
+ public void setMaxProductId(int maxProductId)
+ {
+ this.maxProductId = maxProductId;
+ }
+
+ public int getMaxCustomerId()
+ {
+ return maxCustomerId;
+ }
+
+ public void setMaxCustomerId(int maxCustomerId)
+ {
+ this.maxCustomerId = maxCustomerId;
+ }
+
+ public int getMaxProductCategories()
+ {
+ return maxProductCategories;
+ }
+
+ public void setMaxProductCategories(int maxProductCategories)
+ {
+ this.maxProductCategories = maxProductCategories;
+ }
+
+ public double getMaxAmount()
+ {
+ return maxAmount;
+ }
+
+ public void setMaxAmount(double maxAmount)
+ {
+ this.maxAmount = maxAmount;
+ }
+
+ public boolean isSalesEvent()
+ {
+ return isSalesEvent;
+ }
+
+ public void setSalesEvent(boolean salesEvent)
+ {
+ isSalesEvent = salesEvent;
+ }
+
+ public long getMaxTuplesPerWindow()
+ {
+ return maxTuplesPerWindow;
+ }
+
+ public void setMaxTuplesPerWindow(long maxTuplesPerWindow)
+ {
+ this.maxTuplesPerWindow = maxTuplesPerWindow;
+ }
+}
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/main/resources/META-INF/properties.xml
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/main/resources/META-INF/properties.xml b/examples/innerjoin/src/main/resources/META-INF/properties.xml
new file mode 100644
index 0000000..5c9cb75
--- /dev/null
+++ b/examples/innerjoin/src/main/resources/META-INF/properties.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<configuration>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.attr.MEMORY_MB</name>
+ <value>1024</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.leftKeyExpression</name>
+ <value>productId</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.rightKeyExpression</name>
+ <value>productId</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.timeFieldsStr</name>
+ <value>timestamp,timestamp</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.expiryTime</name>
+ <value>3600000</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.includeFieldStr</name>
+ <value>customerId,productId,amount;productCategory,timestamp</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.prop.noOfBuckets</name>
+ <value>2</value>
+ </property>
+ <property>
+ <name>dt.application.InnerJoinExample.operator.Join.attr.PARTITIONER</name>
+ <value>com.datatorrent.common.partitioner.StatelessPartitioner:3</value>
+ </property>
+</configuration>
+
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/test/java/com/example/join/InnerJoinApplicationTest.java
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/test/java/com/example/join/InnerJoinApplicationTest.java b/examples/innerjoin/src/test/java/com/example/join/InnerJoinApplicationTest.java
new file mode 100644
index 0000000..6da3908
--- /dev/null
+++ b/examples/innerjoin/src/test/java/com/example/join/InnerJoinApplicationTest.java
@@ -0,0 +1,21 @@
+package com.example.join;
+
+import org.junit.Test;
+import org.apache.hadoop.conf.Configuration;
+import com.datatorrent.api.LocalMode;
+
+public class InnerJoinApplicationTest
+{
+ @Test
+ public void testApplication() throws Exception
+ {
+ LocalMode lma = LocalMode.newInstance();
+ Configuration conf = new Configuration(false);
+ conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml"));
+ lma.prepareDAG(new InnerJoinApplication(), conf);
+ LocalMode.Controller lc = lma.getController();
+ lc.runAsync();
+ Thread.sleep(10 * 1000);
+ lc.shutdown();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/ca12bca0/examples/innerjoin/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/innerjoin/src/test/resources/log4j.properties b/examples/innerjoin/src/test/resources/log4j.properties
new file mode 100644
index 0000000..98544e8
--- /dev/null
+++ b/examples/innerjoin/src/test/resources/log4j.properties
@@ -0,0 +1,22 @@
+log4j.rootLogger=DEBUG,CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} %M - %m%n
+
+log4j.appender.RFA=org.apache.log4j.RollingFileAppender
+log4j.appender.RFA.layout=org.apache.log4j.PatternLayout
+log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} %M - %m%n
+log4j.appender.RFA.File=/tmp/app.log
+
+# to enable, add SYSLOG to rootLogger
+log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
+log4j.appender.SYSLOG.syslogHost=127.0.0.1
+log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
+log4j.appender.SYSLOG.layout.conversionPattern=${dt.cid} %-5p [%t] %c{2} %x - %m%n
+log4j.appender.SYSLOG.Facility=LOCAL1
+
+#log4j.logger.org.apache.commons.beanutils=warn
+log4j.logger.com.datatorrent=debug
+log4j.logger.org.apache.apex=debug
+log4j.logger.org=info