{"action":"created","comment":{"url":"https://api.github.com/repos/apache/apex-malhar/pulls/comments/81367502","pull_request_review_id":2351162,"id":81367502,"diff_hunk":"@@ -0,0 +1,336 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+package com.datatorrent.contrib.parser;\n+\n+import java.lang.reflect.Field;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import javax.validation.constraints.NotNull;\n+\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import org.apache.commons.lang.StringUtils;\n+import org.apache.commons.lang3.ClassUtils;\n+\n+import com.google.common.annotations.VisibleForTesting;\n+\n+import com.datatorrent.api.AutoMetric;\n+import com.datatorrent.api.Context;\n+import com.datatorrent.api.DefaultOutputPort;\n+import com.datatorrent.api.Operator;\n+import com.datatorrent.lib.parser.Parser;\n+import com.datatorrent.lib.util.KeyValPair;\n+import com.datatorrent.lib.util.PojoUtils;\n+\n+/**\n+ * Operator that parses a fixed width record against a specified schema <br>\n+ * Schema is specified in a json format as per {@link FixedWidthSchema} that\n+ * contains field information for each field.<br>\n+ * Assumption is that each field in the data should map to a simple\n+ * java type.<br>\n+ * <br>\n+ * <b>Properties</b> <br>\n+ * <b>schema</b>:schema as a string<br>\n+ * <b>clazz</b>:Pojo class <br>\n+ * <b>Ports</b> <br>\n+ * <b>in</b>:input tuple as a byte array. Each tuple represents a record<br>\n+ * <b>parsedOutput</b>:tuples that are validated against the schema are emitted\n+ * as String on this port<br>\n+ * <b>out</b>:tuples that are validated against the schema are emitted as pojo\n+ * on this port<br>\n+ * <b>err</b>:tuples that do not confine to schema are emitted on this port as\n+ * KeyValPair<String,String><br>\n+ * Key being the tuple and Val being the reason.\n+ *\n+ * @displayName FixedWidthParser\n+ * @category Parsers\n+ * @tags fixedwidth pojo parser\n+ * @since 3.6.0\n+ */\n+public class FixedWidthParser extends Parser<byte[], KeyValPair<String, String>> implements Operator.ActivationListener<Context>\n+{\n+  private static final Logger logger = LoggerFactory.getLogger(FixedWidthParser.class);\n+  public final transient DefaultOutputPort<String> parsedOutput = new DefaultOutputPort<String>();\n+  /**\n+   * metric to keep count of number of tuples emitted on {@link #parsedOutput}","path":"contrib/src/main/java/com/datatorrent/contrib/parser/FixedWidthParser.java","position":73,"original_position":73,"commit_id":"7e42d7104ce868cdb5155975496566f256158083","original_commit_id":"7e42d7104ce868cdb5155975496566f256158083","user":{"login":"chinmaykolhatkar","id":12393897,"avatar_url":"https://avatars.githubusercontent.com/u/12393897?v=3","gravatar_id":"","url":"https://api.github.com/users/chinmaykolhatkar","html_url":"https://github.com/chinmaykolhatkar","followers_url":"https://api.github.com/users/chinmaykolhatkar/followers","following_url":"https://api.github.com/users/chinmaykolhatkar/following{/other_user}","gists_url":"https://api.github.com/users/chinmaykolhatkar/gists{/gist_id}","starred_url":"https://api.github.com/users/chinmaykolhatkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chinmaykolhatkar/subscriptions","organizations_url":"https://api.github.com/users/chinmaykolhatkar/orgs","repos_url":"https://api.github.com/users/chinmaykolhatkar/repos","events_url":"https://api.github.com/users/chinmaykolhatkar/events{/privacy}","received_events_url":"https://api.github.com/users/chinmaykolhatkar/received_events","type":"User","site_admin":false},"body":"\"Metric\" M in caps.","created_at":"2016-09-30T16:01:25Z","updated_at":"2016-09-30T16:01:25Z","html_url":"https://github.com/apache/apex-malhar/pull/427#discussion_r81367502","pull_request_url":"https://api.github.com/repos/apache/apex-malhar/pulls/427","_links":{"self":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/comments/81367502"},"html":{"href":"https://github.com/apache/apex-malhar/pull/427#discussion_r81367502"},"pull_request":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/427"}}},"pull_request":{"url":"https://api.github.com/repos/apache/apex-malhar/pulls/427","id":86479563,"html_url":"https://github.com/apache/apex-malhar/pull/427","diff_url":"https://github.com/apache/apex-malhar/pull/427.diff","patch_url":"https://github.com/apache/apex-malhar/pull/427.patch","issue_url":"https://api.github.com/repos/apache/apex-malhar/issues/427","number":427,"state":"open","locked":false,"title":"APEXMALHAR-2259 Create Fixed Length Parser Operator","user":{"login":"Hitesh-Scorpio","id":7661135,"avatar_url":"https://avatars.githubusercontent.com/u/7661135?v=3","gravatar_id":"","url":"https://api.github.com/users/Hitesh-Scorpio","html_url":"https://github.com/Hitesh-Scorpio","followers_url":"https://api.github.com/users/Hitesh-Scorpio/followers","following_url":"https://api.github.com/users/Hitesh-Scorpio/following{/other_user}","gists_url":"https://api.github.com/users/Hitesh-Scorpio/gists{/gist_id}","starred_url":"https://api.github.com/users/Hitesh-Scorpio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hitesh-Scorpio/subscriptions","organizations_url":"https://api.github.com/users/Hitesh-Scorpio/orgs","repos_url":"https://api.github.com/users/Hitesh-Scorpio/repos","events_url":"https://api.github.com/users/Hitesh-Scorpio/events{/privacy}","received_events_url":"https://api.github.com/users/Hitesh-Scorpio/received_events","type":"User","site_admin":false},"body":"@chinmaykolhatkar @bhupeshchawda please review","created_at":"2016-09-23T09:20:48Z","updated_at":"2016-09-30T16:04:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d045b8f1ca4f731e696baf157a255c64881f7a2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/apex-malhar/pulls/427/commits","review_comments_url":"https://api.github.com/repos/apache/apex-malhar/pulls/427/comments","review_comment_url":"https://api.github.com/repos/apache/apex-malhar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/apex-malhar/issues/427/comments","statuses_url":"https://api.github.com/repos/apache/apex-malhar/statuses/7e42d7104ce868cdb5155975496566f256158083","head":{"label":"Hitesh-Scorpio:APEXMALHAR-2259_FixedWidthParser","ref":"APEXMALHAR-2259_FixedWidthParser","sha":"7e42d7104ce868cdb5155975496566f256158083","user":{"login":"Hitesh-Scorpio","id":7661135,"avatar_url":"https://avatars.githubusercontent.com/u/7661135?v=3","gravatar_id":"","url":"https://api.github.com/users/Hitesh-Scorpio","html_url":"https://github.com/Hitesh-Scorpio","followers_url":"https://api.github.com/users/Hitesh-Scorpio/followers","following_url":"https://api.github.com/users/Hitesh-Scorpio/following{/other_user}","gists_url":"https://api.github.com/users/Hitesh-Scorpio/gists{/gist_id}","starred_url":"https://api.github.com/users/Hitesh-Scorpio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hitesh-Scorpio/subscriptions","organizations_url":"https://api.github.com/users/Hitesh-Scorpio/orgs","repos_url":"https://api.github.com/users/Hitesh-Scorpio/repos","events_url":"https://api.github.com/users/Hitesh-Scorpio/events{/privacy}","received_events_url":"https://api.github.com/users/Hitesh-Scorpio/received_events","type":"User","site_admin":false},"repo":{"id":65878565,"name":"apex-malhar","full_name":"Hitesh-Scorpio/apex-malhar","owner":{"login":"Hitesh-Scorpio","id":7661135,"avatar_url":"https://avatars.githubusercontent.com/u/7661135?v=3","gravatar_id":"","url":"https://api.github.com/users/Hitesh-Scorpio","html_url":"https://github.com/Hitesh-Scorpio","followers_url":"https://api.github.com/users/Hitesh-Scorpio/followers","following_url":"https://api.github.com/users/Hitesh-Scorpio/following{/other_user}","gists_url":"https://api.github.com/users/Hitesh-Scorpio/gists{/gist_id}","starred_url":"https://api.github.com/users/Hitesh-Scorpio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hitesh-Scorpio/subscriptions","organizations_url":"https://api.github.com/users/Hitesh-Scorpio/orgs","repos_url":"https://api.github.com/users/Hitesh-Scorpio/repos","events_url":"https://api.github.com/users/Hitesh-Scorpio/events{/privacy}","received_events_url":"https://api.github.com/users/Hitesh-Scorpio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Hitesh-Scorpio/apex-malhar","description":"Mirror of Apache Apex malhar","fork":true,"url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar","forks_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/forks","keys_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/teams","hooks_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/hooks","issue_events_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/issues/events{/number}","events_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/events","assignees_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/assignees{/user}","branches_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/branches{/branch}","tags_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/tags","blobs_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/statuses/{sha}","languages_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/languages","stargazers_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/stargazers","contributors_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/contributors","subscribers_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/subscribers","subscription_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/subscription","commits_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/contents/{+path}","compare_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/merges","archive_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/downloads","issues_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/issues{/number}","pulls_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/pulls{/number}","milestones_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/milestones{/number}","notifications_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/labels{/name}","releases_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/releases{/id}","deployments_url":"https://api.github.com/repos/Hitesh-Scorpio/apex-malhar/deployments","created_at":"2016-08-17T05:30:14Z","updated_at":"2016-08-17T05:30:20Z","pushed_at":"2016-09-23T09:17:39Z","git_url":"git://github.com/Hitesh-Scorpio/apex-malhar.git","ssh_url":"git@github.com:Hitesh-Scorpio/apex-malhar.git","clone_url":"https://github.com/Hitesh-Scorpio/apex-malhar.git","svn_url":"https://github.com/Hitesh-Scorpio/apex-malhar","homepage":"","size":86866,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"2291d9a0dbca15a6f43c51d9611682269e9e6c0f","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":41348334,"name":"apex-malhar","full_name":"apache/apex-malhar","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/apex-malhar","description":"Mirror of Apache Apex malhar","fork":false,"url":"https://api.github.com/repos/apache/apex-malhar","forks_url":"https://api.github.com/repos/apache/apex-malhar/forks","keys_url":"https://api.github.com/repos/apache/apex-malhar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/apex-malhar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/apex-malhar/teams","hooks_url":"https://api.github.com/repos/apache/apex-malhar/hooks","issue_events_url":"https://api.github.com/repos/apache/apex-malhar/issues/events{/number}","events_url":"https://api.github.com/repos/apache/apex-malhar/events","assignees_url":"https://api.github.com/repos/apache/apex-malhar/assignees{/user}","branches_url":"https://api.github.com/repos/apache/apex-malhar/branches{/branch}","tags_url":"https://api.github.com/repos/apache/apex-malhar/tags","blobs_url":"https://api.github.com/repos/apache/apex-malhar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/apex-malhar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/apex-malhar/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/apex-malhar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/apex-malhar/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/apex-malhar/languages","stargazers_url":"https://api.github.com/repos/apache/apex-malhar/stargazers","contributors_url":"https://api.github.com/repos/apache/apex-malhar/contributors","subscribers_url":"https://api.github.com/repos/apache/apex-malhar/subscribers","subscription_url":"https://api.github.com/repos/apache/apex-malhar/subscription","commits_url":"https://api.github.com/repos/apache/apex-malhar/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/apex-malhar/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/apex-malhar/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/apex-malhar/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/apex-malhar/contents/{+path}","compare_url":"https://api.github.com/repos/apache/apex-malhar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/apex-malhar/merges","archive_url":"https://api.github.com/repos/apache/apex-malhar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/apex-malhar/downloads","issues_url":"https://api.github.com/repos/apache/apex-malhar/issues{/number}","pulls_url":"https://api.github.com/repos/apache/apex-malhar/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/apex-malhar/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/apex-malhar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/apex-malhar/labels{/name}","releases_url":"https://api.github.com/repos/apache/apex-malhar/releases{/id}","deployments_url":"https://api.github.com/repos/apache/apex-malhar/deployments","created_at":"2015-08-25T07:00:05Z","updated_at":"2016-09-14T07:47:20Z","pushed_at":"2016-09-30T10:52:44Z","git_url":"git://github.com/apache/apex-malhar.git","ssh_url":"git@github.com:apache/apex-malhar.git","clone_url":"https://github.com/apache/apex-malhar.git","svn_url":"https://github.com/apache/apex-malhar","homepage":"","size":98495,"stargazers_count":58,"watchers_count":58,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":100,"mirror_url":"git://git.apache.org/incubator-apex-malhar.git","open_issues_count":29,"forks":100,"open_issues":29,"watchers":58,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/427"},"html":{"href":"https://github.com/apache/apex-malhar/pull/427"},"issue":{"href":"https://api.github.com/repos/apache/apex-malhar/issues/427"},"comments":{"href":"https://api.github.com/repos/apache/apex-malhar/issues/427/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/427/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/apex-malhar/pulls/427/commits"},"statuses":{"href":"https://api.github.com/repos/apache/apex-malhar/statuses/7e42d7104ce868cdb5155975496566f256158083"}}}}
{"actor":{"display_login":"chinmaykolhatkar"}}