Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 9d50bd9

Browse files
Apex Devprasannapramod
authored andcommitted
APEXMALHAR-2462 Fixed Checkstyle and Log4j Properties.
1 parent 41abbfe commit 9d50bd9

26 files changed

+397
-50
lines changed

examples/jdbc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ mysql> select count(*) from testDev.test_event_table;
172172
Step 3: Build the code,
173173
shell> mvn clean install
174174

175-
Upload the target/jdbcInput-1.0-SNAPSHOT.apa to the gateway
175+
Upload the target/malhar-examples-JDBC-3.8.0-SNAPSHOT.apa to the gateway
176176

177177
Step 4 : During launch use "Specify custom properties" option and select example.xml
178178

examples/jdbc/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
222
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
323
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
424
<modelVersion>4.0.0</modelVersion>

examples/jdbc/src/assemble/appPackage.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<!--
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
20+
-->
121
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
222
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
323
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

examples/jdbc/src/main/java/org/apache/apex/examples/FileToJdbcApp/CustomParser.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
*/
1919
package org.apache.apex.examples.FileToJdbcApp;
2020

21+
import java.util.regex.Pattern;
22+
import org.slf4j.Logger;
23+
import org.slf4j.LoggerFactory;
2124
import com.datatorrent.api.Context.OperatorContext;
2225
import com.datatorrent.api.DefaultInputPort;
2326
import com.datatorrent.api.DefaultOutputPort;
2427
import com.datatorrent.api.annotation.OutputPortFieldAnnotation;
2528
import com.datatorrent.common.util.BaseOperator;
26-
import org.slf4j.Logger;
27-
import org.slf4j.LoggerFactory;
28-
29-
import java.util.regex.Pattern;
3029

3130
// parse input line into pojo event
3231
public class CustomParser extends BaseOperator
@@ -42,12 +41,11 @@ public class CustomParser extends BaseOperator
4241
@OutputPortFieldAnnotation(optional = false)
4342
public final transient DefaultOutputPort<PojoEvent> output = new DefaultOutputPort<>();
4443

45-
public final transient DefaultInputPort<String>
46-
input = new DefaultInputPort<String>() {
47-
48-
@Override
49-
public void process(String line)
50-
{
44+
public final transient DefaultInputPort<String> input = new DefaultInputPort<String>()
45+
{
46+
@Override
47+
public void process(String line)
48+
{
5149
// use custom regex to split line into words
5250
final String[] words = regexPattern.split(line);
5351

@@ -70,14 +68,16 @@ public void process(String line)
7068
pojo.setAmount(0);
7169
}
7270
output.emit(pojo);
73-
}
71+
}
7472
};
7573

76-
public String getRegexStr() {
74+
public String getRegexStr()
75+
{
7776
return this.regexStr;
7877
}
7978

80-
public void setRegexStr(String regex) {
79+
public void setRegexStr(String regex)
80+
{
8181
this.regexStr = regex;
8282
}
8383

examples/jdbc/src/main/java/org/apache/apex/examples/FileToJdbcApp/FileReader.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.FileToJdbcApp;
220

3-
import com.datatorrent.api.DefaultOutputPort;
421
import org.apache.apex.malhar.lib.fs.LineByLineFileInputOperator;
522

6-
public class FileReader extends LineByLineFileInputOperator{
23+
import com.datatorrent.api.DefaultOutputPort;
724

25+
public class FileReader extends LineByLineFileInputOperator
26+
{
827
/**
928
* output in bytes to match CsvParser input type
1029
*/

examples/jdbc/src/main/java/org/apache/apex/examples/FileToJdbcApp/FileToJdbcCsvParser.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.FileToJdbcApp;
220

321
import java.util.List;
@@ -19,10 +37,11 @@
1937
import static java.sql.Types.VARCHAR;
2038

2139
@ApplicationAnnotation(name = "FileToJdbcCsvParser")
22-
public class FileToJdbcCsvParser implements StreamingApplication{
23-
40+
public class FileToJdbcCsvParser implements StreamingApplication
41+
{
2442
@Override
25-
public void populateDAG(DAG dag, Configuration configuration) {
43+
public void populateDAG(DAG dag, Configuration configuration)
44+
{
2645
// create operators
2746
FileReader fileReader = dag.addOperator("FileReader", FileReader.class);
2847
CsvParser csvParser = dag.addOperator("CsvParser", CsvParser.class);
@@ -45,9 +64,10 @@ public void populateDAG(DAG dag, Configuration configuration) {
4564
* This method can be modified to have field mappings based on used defined
4665
* class
4766
*/
48-
private List<JdbcFieldInfo> addFieldInfos() {
67+
private List<JdbcFieldInfo> addFieldInfos()
68+
{
4969
List<JdbcFieldInfo> fieldInfos = Lists.newArrayList();
50-
fieldInfos.add(new JdbcFieldInfo("ACCOUNT_NO", "accountNumber", JdbcFieldInfo.SupportType.INTEGER , INTEGER));
70+
fieldInfos.add(new JdbcFieldInfo("ACCOUNT_NO", "accountNumber", JdbcFieldInfo.SupportType.INTEGER, INTEGER));
5171
fieldInfos.add(new JdbcFieldInfo("NAME", "name", JdbcFieldInfo.SupportType.STRING, VARCHAR));
5272
fieldInfos.add(new JdbcFieldInfo("AMOUNT", "amount", JdbcFieldInfo.SupportType.INTEGER, INTEGER));
5373
return fieldInfos;

examples/jdbc/src/main/java/org/apache/apex/examples/FileToJdbcApp/FileToJdbcCustomParser.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.FileToJdbcApp;
220

21+
import java.util.List;
22+
23+
import org.apache.hadoop.conf.Configuration;
24+
25+
import com.google.common.collect.Lists;
26+
327
import com.datatorrent.api.DAG;
428
import com.datatorrent.api.StreamingApplication;
529
import com.datatorrent.api.annotation.ApplicationAnnotation;
630
import com.datatorrent.lib.db.jdbc.JdbcFieldInfo;
731
import com.datatorrent.lib.db.jdbc.JdbcPOJOInsertOutputOperator;
832
import com.datatorrent.lib.db.jdbc.JdbcTransactionalStore;
9-
import com.google.common.collect.Lists;
10-
import org.apache.hadoop.conf.Configuration;
11-
12-
import java.util.List;
1333

1434
import static java.sql.Types.INTEGER;
1535
import static java.sql.Types.VARCHAR;
1636

1737
@ApplicationAnnotation(name = "FileToJdbcCustomParser")
18-
public class FileToJdbcCustomParser implements StreamingApplication{
19-
38+
public class FileToJdbcCustomParser implements StreamingApplication
39+
{
2040
@Override
21-
public void populateDAG(DAG dag, Configuration configuration) {
41+
public void populateDAG(DAG dag, Configuration configuration)
42+
{
2243
// create operators
2344
FileReader fileReader = dag.addOperator("FileReader", FileReader.class);
2445
CustomParser customParser = dag.addOperator("CustomParser", CustomParser.class);
@@ -41,7 +62,7 @@ public void populateDAG(DAG dag, Configuration configuration) {
4162
private List<JdbcFieldInfo> addFieldInfos()
4263
{
4364
List<JdbcFieldInfo> fieldInfos = Lists.newArrayList();
44-
fieldInfos.add(new JdbcFieldInfo("ACCOUNT_NO", "accountNumber", JdbcFieldInfo.SupportType.INTEGER , INTEGER));
65+
fieldInfos.add(new JdbcFieldInfo("ACCOUNT_NO", "accountNumber", JdbcFieldInfo.SupportType.INTEGER, INTEGER));
4566
fieldInfos.add(new JdbcFieldInfo("NAME", "name", JdbcFieldInfo.SupportType.STRING, VARCHAR));
4667
fieldInfos.add(new JdbcFieldInfo("AMOUNT", "amount", JdbcFieldInfo.SupportType.INTEGER, INTEGER));
4768
return fieldInfos;

examples/jdbc/src/main/java/org/apache/apex/examples/FileToJdbcApp/PojoEvent.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.FileToJdbcApp;
220

321
public class PojoEvent

examples/jdbc/src/main/java/org/apache/apex/examples/JdbcIngest/JdbcPollerApplication.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.JdbcIngest;
220

321
import java.util.List;

examples/jdbc/src/main/java/org/apache/apex/examples/JdbcIngest/PojoEvent.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
119
package org.apache.apex.examples.JdbcIngest;
220

321
public class PojoEvent

0 commit comments

Comments
 (0)