{"action":"created","comment":{"url":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments/64594547","id":64594547,"diff_hunk":"@@ -520,6 +523,185 @@ private void handleEntry2tsv(List<String> args) throws ApiException, IOException\n     }\n \n     /**\n+     * this function will check if the content of the file is CWL or not\n+     * @param content\n+     * @return\n+     */\n+    public Boolean checkCWL(File content){\n+        /* CWL: check for 'class:Workflow OR CommandLineTool', 'inputs: ','outputs: ', and 'steps' */\n+        Pattern cwlVersion = Pattern.compile(\"(.*)(cwlVersion)(.*)(:)(.*)\");\n+        Pattern classWfPattern = Pattern.compile(\"(.*)(class)(.*)(:)(\\\\sWorkflow)\");\n+        Pattern classToolPattern = Pattern.compile(\"(.*)(class)(.*)(:)(\\\\sCommandLineTool)\");\n+        //String line;\n+        Boolean versionFound = false;\n+        Path p = Paths.get(content.getPath());\n+        try{\n+            List<String> fileContent = java.nio.file.Files.readAllLines(p, StandardCharsets.UTF_8);\n+            for(String line: fileContent){\n+                Matcher matchWf = classWfPattern.matcher(line);\n+                Matcher matchTool = classToolPattern.matcher(line);\n+                Matcher matchVersion = cwlVersion.matcher(line);\n+                if(matchVersion.find() && !versionFound){\n+                    versionFound = true;\n+                } else if(versionFound){\n+                    if(getEntryType().toLowerCase().equals(\"workflow\") && matchWf.find()){\n+                        return true;\n+                    } else if(getEntryType().toLowerCase().equals(\"tool\") && matchTool.find()){\n+                        return true;\n+                    }\n+                    errorMessage(\"Entry type does not match the class specified in CWL file.\",CLIENT_ERROR);\n+                }\n+            }\n+        } catch(IOException e){\n+            throw new RuntimeException(\"Failed to get content of entry file.\", e);\n+        }\n+        return false;\n+    }\n+\n+    /**\n+     * this function will check if the content of the file is WDL or not\n+     * @param content\n+     * @return\n+     */\n+    public Boolean checkWDL(File content){\n+        /* WDL: check for 'task' (can be >=1) and 'workflow', cause on the description it says that you can construct workflow from tasks\n+                and wdl describes tasks and workflows */\n+        Pattern taskPattern = Pattern.compile(\"(.*)(task)(\\\\s)(.*)(\\\\{)\");\n+        Pattern wfPattern = Pattern.compile(\"(.*)(workflow)(\\\\s)(.*)(\\\\{)\");\n+        String line;\n+        Integer counter = 0;\n+        try{\n+            InputStreamReader is = new InputStreamReader(new FileInputStream(content.getPath()),StandardCharsets.UTF_8);\n+            BufferedReader bufferedReader = new BufferedReader(is);\n+            ArrayList<String> lines = new ArrayList<>();\n+            while((line = bufferedReader.readLine()) != null) {\n+                Matcher m = taskPattern.matcher(line);\n+                lines.add(line);\n+                if (m.find()) {\n+                    counter++;\n+                }\n+            }\n+            bufferedReader.close();\n+            //check if 'workflow' exist in the file or not\n+            if(counter>0){\n+                for(String l : lines) {\n+                    Matcher m = wfPattern.matcher(l);\n+                    if(m.find()){\n+                        return true;\n+                    }\n+                }\n+                return false; // 'workflow' does not exist, file is invalid\n+            }\n+        } catch (IOException e){\n+            e.printStackTrace();","path":"dockstore-client/src/main/java/io/dockstore/client/cli/nested/AbstractEntryClient.java","position":93,"original_position":93,"commit_id":"790c397e2d350c90bf3e5a4ff556fa18bc60ac13","original_commit_id":"790c397e2d350c90bf3e5a4ff556fa18bc60ac13","user":{"login":"denis-yuen","id":1730679,"avatar_url":"https://avatars.githubusercontent.com/u/1730679?v=3","gravatar_id":"","url":"https://api.github.com/users/denis-yuen","html_url":"https://github.com/denis-yuen","followers_url":"https://api.github.com/users/denis-yuen/followers","following_url":"https://api.github.com/users/denis-yuen/following{/other_user}","gists_url":"https://api.github.com/users/denis-yuen/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-yuen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-yuen/subscriptions","organizations_url":"https://api.github.com/users/denis-yuen/orgs","repos_url":"https://api.github.com/users/denis-yuen/repos","events_url":"https://api.github.com/users/denis-yuen/events{/privacy}","received_events_url":"https://api.github.com/users/denis-yuen/received_events","type":"User","site_admin":false},"body":"Don't throw away exceptions","created_at":"2016-05-25T15:27:09Z","updated_at":"2016-05-25T15:27:09Z","html_url":"https://github.com/ga4gh/dockstore/pull/243#discussion_r64594547","pull_request_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/243","_links":{"self":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments/64594547"},"html":{"href":"https://github.com/ga4gh/dockstore/pull/243#discussion_r64594547"},"pull_request":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/243"}}},"pull_request":{"url":"https://api.github.com/repos/ga4gh/dockstore/pulls/243","id":70885385,"html_url":"https://github.com/ga4gh/dockstore/pull/243","diff_url":"https://github.com/ga4gh/dockstore/pull/243.diff","patch_url":"https://github.com/ga4gh/dockstore/pull/243.patch","issue_url":"https://api.github.com/repos/ga4gh/dockstore/issues/243","number":243,"state":"open","locked":false,"title":"Feature/dockstore 223 cli launch simplification","user":{"login":"jpatricia","id":6503391,"avatar_url":"https://avatars.githubusercontent.com/u/6503391?v=3","gravatar_id":"","url":"https://api.github.com/users/jpatricia","html_url":"https://github.com/jpatricia","followers_url":"https://api.github.com/users/jpatricia/followers","following_url":"https://api.github.com/users/jpatricia/following{/other_user}","gists_url":"https://api.github.com/users/jpatricia/gists{/gist_id}","starred_url":"https://api.github.com/users/jpatricia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpatricia/subscriptions","organizations_url":"https://api.github.com/users/jpatricia/orgs","repos_url":"https://api.github.com/users/jpatricia/repos","events_url":"https://api.github.com/users/jpatricia/events{/privacy}","received_events_url":"https://api.github.com/users/jpatricia/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-20T16:52:30Z","updated_at":"2016-05-25T15:27:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fafff6e19875109d8ea185f81ca0b2f8ac34204b","assignee":{"login":"denis-yuen","id":1730679,"avatar_url":"https://avatars.githubusercontent.com/u/1730679?v=3","gravatar_id":"","url":"https://api.github.com/users/denis-yuen","html_url":"https://github.com/denis-yuen","followers_url":"https://api.github.com/users/denis-yuen/followers","following_url":"https://api.github.com/users/denis-yuen/following{/other_user}","gists_url":"https://api.github.com/users/denis-yuen/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-yuen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-yuen/subscriptions","organizations_url":"https://api.github.com/users/denis-yuen/orgs","repos_url":"https://api.github.com/users/denis-yuen/repos","events_url":"https://api.github.com/users/denis-yuen/events{/privacy}","received_events_url":"https://api.github.com/users/denis-yuen/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/243/commits","review_comments_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/243/comments","review_comment_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/issues/243/comments","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/790c397e2d350c90bf3e5a4ff556fa18bc60ac13","head":{"label":"ga4gh:feature/dockstore_223_cli_launch_simplification","ref":"feature/dockstore_223_cli_launch_simplification","sha":"790c397e2d350c90bf3e5a4ff556fa18bc60ac13","user":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":33383826,"name":"dockstore","full_name":"ga4gh/dockstore","owner":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/dockstore","description":"Our VM/Docker sharing infrastructure and management component","fork":false,"url":"https://api.github.com/repos/ga4gh/dockstore","forks_url":"https://api.github.com/repos/ga4gh/dockstore/forks","keys_url":"https://api.github.com/repos/ga4gh/dockstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/dockstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/dockstore/teams","hooks_url":"https://api.github.com/repos/ga4gh/dockstore/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/dockstore/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/dockstore/events","assignees_url":"https://api.github.com/repos/ga4gh/dockstore/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/dockstore/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/dockstore/tags","blobs_url":"https://api.github.com/repos/ga4gh/dockstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/dockstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/dockstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/dockstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/dockstore/languages","stargazers_url":"https://api.github.com/repos/ga4gh/dockstore/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/dockstore/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/dockstore/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/dockstore/subscription","commits_url":"https://api.github.com/repos/ga4gh/dockstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/dockstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/dockstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/dockstore/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/dockstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/dockstore/merges","archive_url":"https://api.github.com/repos/ga4gh/dockstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/dockstore/downloads","issues_url":"https://api.github.com/repos/ga4gh/dockstore/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/dockstore/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/dockstore/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/dockstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/dockstore/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/dockstore/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/dockstore/deployments","created_at":"2015-04-03T21:34:05Z","updated_at":"2016-05-18T21:54:43Z","pushed_at":"2016-05-25T15:20:12Z","git_url":"git://github.com/ga4gh/dockstore.git","ssh_url":"git@github.com:ga4gh/dockstore.git","clone_url":"https://github.com/ga4gh/dockstore.git","svn_url":"https://github.com/ga4gh/dockstore","homepage":"","size":5323,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":67,"forks":2,"open_issues":67,"watchers":10,"default_branch":"develop"}},"base":{"label":"ga4gh:develop","ref":"develop","sha":"7331f704894ecc1cb9409615d0b65cf81cae734a","user":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":33383826,"name":"dockstore","full_name":"ga4gh/dockstore","owner":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/dockstore","description":"Our VM/Docker sharing infrastructure and management component","fork":false,"url":"https://api.github.com/repos/ga4gh/dockstore","forks_url":"https://api.github.com/repos/ga4gh/dockstore/forks","keys_url":"https://api.github.com/repos/ga4gh/dockstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/dockstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/dockstore/teams","hooks_url":"https://api.github.com/repos/ga4gh/dockstore/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/dockstore/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/dockstore/events","assignees_url":"https://api.github.com/repos/ga4gh/dockstore/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/dockstore/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/dockstore/tags","blobs_url":"https://api.github.com/repos/ga4gh/dockstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/dockstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/dockstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/dockstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/dockstore/languages","stargazers_url":"https://api.github.com/repos/ga4gh/dockstore/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/dockstore/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/dockstore/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/dockstore/subscription","commits_url":"https://api.github.com/repos/ga4gh/dockstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/dockstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/dockstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/dockstore/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/dockstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/dockstore/merges","archive_url":"https://api.github.com/repos/ga4gh/dockstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/dockstore/downloads","issues_url":"https://api.github.com/repos/ga4gh/dockstore/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/dockstore/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/dockstore/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/dockstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/dockstore/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/dockstore/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/dockstore/deployments","created_at":"2015-04-03T21:34:05Z","updated_at":"2016-05-18T21:54:43Z","pushed_at":"2016-05-25T15:20:12Z","git_url":"git://github.com/ga4gh/dockstore.git","ssh_url":"git@github.com:ga4gh/dockstore.git","clone_url":"https://github.com/ga4gh/dockstore.git","svn_url":"https://github.com/ga4gh/dockstore","homepage":"","size":5323,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":67,"forks":2,"open_issues":67,"watchers":10,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/243"},"html":{"href":"https://github.com/ga4gh/dockstore/pull/243"},"issue":{"href":"https://api.github.com/repos/ga4gh/dockstore/issues/243"},"comments":{"href":"https://api.github.com/repos/ga4gh/dockstore/issues/243/comments"},"review_comments":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/243/comments"},"review_comment":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/243/commits"},"statuses":{"href":"https://api.github.com/repos/ga4gh/dockstore/statuses/790c397e2d350c90bf3e5a4ff556fa18bc60ac13"}}}}
{"actor":{"display_login":"denis-yuen"}}