{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/comments/65916197","id":65916197,"diff_hunk":"@@ -0,0 +1,108 @@\n+package com.cloudbees.jenkins.support;\n+\n+import java.io.*;\n+import java.util.ArrayList;\n+import java.util.Enumeration;\n+import java.util.List;\n+\n+//import org.apache.tools.zip;\n+import org.apache.tools.zip.ZipEntry;\n+import org.apache.tools.zip.ZipFile;\n+import org.apache.tools.zip.ZipOutputStream;\n+/*import java.util.zip.ZipEntry;\n+import java.util.zip.ZipFile;\n+import java.util.zip.ZipOutputStream;*/\n+\n+/**\n+ * Created by minudika on 5/29/16.\n+ */\n+public class BundleBrowser {\n+    private final String root = \"./work/support\";\n+    private List<File> zipFileList ;\n+    private ZipFile allInOneZipFile;\n+\n+    public File[] getFileList() throws IOException {\n+        File rootFile = new File(root);\n+        return rootFile.listFiles();\n+    }\n+    public List<File> getZipFileList() throws IOException {\n+        List<File> zipFileList = new ArrayList<File>();\n+        for(File file: getFileList()){\n+            if(file!=null && file.getName().contains(\".zip\")){\n+                zipFileList.add(file);\n+            }\n+        }\n+        this.zipFileList = zipFileList;\n+        return zipFileList;\n+    }\n+\n+    public List<ZipEntry> getZipContent(ZipFile zipFile){\n+        ArrayList<ZipEntry> zipFileList = new ArrayList<ZipEntry>();\n+        Enumeration<? extends ZipEntry> entries = zipFile.getEntries();\n+\n+        while(entries.hasMoreElements()){\n+            ZipEntry entry = entries.nextElement();\n+            zipFileList.add(entry);\n+            System.out.println(entry.getName());\n+        }\n+        return zipFileList;\n+    }\n+\n+    public List<File> getSelectedFiles(ArrayList<Integer> selectedFileIndices) throws IOException {\n+       List<File> list = new ArrayList<File>();\n+        List<File> zipFileList = getZipFileList();\n+        for(Integer i : selectedFileIndices){\n+            list.add(zipFileList.get(i));\n+        }\n+        return  list;\n+    }\n+\n+    public void compressFiles(List<File>fileNames){\n+        byte[] buffer = new byte[1024*1024*10];\n+        try{\n+            String zipFile = \"bundles.zip\";\n+            FileOutputStream fos = new FileOutputStream(root+File.separator+zipFile);\n+            ZipOutputStream zos = new ZipOutputStream(fos);\n+\n+            System.out.println(\"Output to Zip : \" + zipFile);\n+\n+            for(File file : fileNames){\n+\n+                System.out.println(\"File Added : \" + file);\n+                ZipEntry ze= new ZipEntry(file.getName());\n+                zos.putNextEntry(ze);\n+\n+                FileInputStream in =\n+                        new FileInputStream(file);\n+\n+                int len;\n+                while ((len = in.read(buffer)) > 0) {\n+                    zos.write(buffer, 0, len);\n+                }\n+\n+                in.close();","path":"src/main/java/com/cloudbees/jenkins/support/BundleBrowser.java","position":83,"original_position":83,"commit_id":"ca0d6bd6a2bf92ea6919fb74ca2d12d832bce079","original_commit_id":"ca0d6bd6a2bf92ea6919fb74ca2d12d832bce079","user":{"login":"christ66","id":1302212,"avatar_url":"https://avatars.githubusercontent.com/u/1302212?v=3","gravatar_id":"","url":"https://api.github.com/users/christ66","html_url":"https://github.com/christ66","followers_url":"https://api.github.com/users/christ66/followers","following_url":"https://api.github.com/users/christ66/following{/other_user}","gists_url":"https://api.github.com/users/christ66/gists{/gist_id}","starred_url":"https://api.github.com/users/christ66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christ66/subscriptions","organizations_url":"https://api.github.com/users/christ66/orgs","repos_url":"https://api.github.com/users/christ66/repos","events_url":"https://api.github.com/users/christ66/events{/privacy}","received_events_url":"https://api.github.com/users/christ66/received_events","type":"User","site_admin":false},"body":"It might be better if we switch to java 7 which allows for the try-with-resources which will simplify this code.","created_at":"2016-06-06T15:52:40Z","updated_at":"2016-06-06T15:52:40Z","html_url":"https://github.com/jenkinsci/support-core-plugin/pull/64#discussion_r65916197","pull_request_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/comments/65916197"},"html":{"href":"https://github.com/jenkinsci/support-core-plugin/pull/64#discussion_r65916197"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64","id":72504794,"html_url":"https://github.com/jenkinsci/support-core-plugin/pull/64","diff_url":"https://github.com/jenkinsci/support-core-plugin/pull/64.diff","patch_url":"https://github.com/jenkinsci/support-core-plugin/pull/64.patch","issue_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/64","number":64,"state":"open","locked":false,"title":"[JENKINS-33090] Ease the management bundles by the administrator","user":{"login":"minudika","id":6940029,"avatar_url":"https://avatars.githubusercontent.com/u/6940029?v=3","gravatar_id":"","url":"https://api.github.com/users/minudika","html_url":"https://github.com/minudika","followers_url":"https://api.github.com/users/minudika/followers","following_url":"https://api.github.com/users/minudika/following{/other_user}","gists_url":"https://api.github.com/users/minudika/gists{/gist_id}","starred_url":"https://api.github.com/users/minudika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minudika/subscriptions","organizations_url":"https://api.github.com/users/minudika/orgs","repos_url":"https://api.github.com/users/minudika/repos","events_url":"https://api.github.com/users/minudika/events{/privacy}","received_events_url":"https://api.github.com/users/minudika/received_events","type":"User","site_admin":false},"body":"This pull request is to keep track of the progress of GSoC project, Support Core Plugin Improvements.\r\n@aheritier @christ66 ","created_at":"2016-06-03T13:13:18Z","updated_at":"2016-06-06T15:52:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7551b6861177153b560aa0e5d7a087147057bf60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/64/comments","statuses_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/statuses/ca0d6bd6a2bf92ea6919fb74ca2d12d832bce079","head":{"label":"minudika:JENKINS_33090","ref":"JENKINS_33090","sha":"ca0d6bd6a2bf92ea6919fb74ca2d12d832bce079","user":{"login":"minudika","id":6940029,"avatar_url":"https://avatars.githubusercontent.com/u/6940029?v=3","gravatar_id":"","url":"https://api.github.com/users/minudika","html_url":"https://github.com/minudika","followers_url":"https://api.github.com/users/minudika/followers","following_url":"https://api.github.com/users/minudika/following{/other_user}","gists_url":"https://api.github.com/users/minudika/gists{/gist_id}","starred_url":"https://api.github.com/users/minudika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minudika/subscriptions","organizations_url":"https://api.github.com/users/minudika/orgs","repos_url":"https://api.github.com/users/minudika/repos","events_url":"https://api.github.com/users/minudika/events{/privacy}","received_events_url":"https://api.github.com/users/minudika/received_events","type":"User","site_admin":false},"repo":{"id":53755815,"name":"support-core-plugin","full_name":"minudika/support-core-plugin","owner":{"login":"minudika","id":6940029,"avatar_url":"https://avatars.githubusercontent.com/u/6940029?v=3","gravatar_id":"","url":"https://api.github.com/users/minudika","html_url":"https://github.com/minudika","followers_url":"https://api.github.com/users/minudika/followers","following_url":"https://api.github.com/users/minudika/following{/other_user}","gists_url":"https://api.github.com/users/minudika/gists{/gist_id}","starred_url":"https://api.github.com/users/minudika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minudika/subscriptions","organizations_url":"https://api.github.com/users/minudika/orgs","repos_url":"https://api.github.com/users/minudika/repos","events_url":"https://api.github.com/users/minudika/events{/privacy}","received_events_url":"https://api.github.com/users/minudika/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/minudika/support-core-plugin","description":"","fork":true,"url":"https://api.github.com/repos/minudika/support-core-plugin","forks_url":"https://api.github.com/repos/minudika/support-core-plugin/forks","keys_url":"https://api.github.com/repos/minudika/support-core-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minudika/support-core-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minudika/support-core-plugin/teams","hooks_url":"https://api.github.com/repos/minudika/support-core-plugin/hooks","issue_events_url":"https://api.github.com/repos/minudika/support-core-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/minudika/support-core-plugin/events","assignees_url":"https://api.github.com/repos/minudika/support-core-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/minudika/support-core-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/minudika/support-core-plugin/tags","blobs_url":"https://api.github.com/repos/minudika/support-core-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minudika/support-core-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minudika/support-core-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/minudika/support-core-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minudika/support-core-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/minudika/support-core-plugin/languages","stargazers_url":"https://api.github.com/repos/minudika/support-core-plugin/stargazers","contributors_url":"https://api.github.com/repos/minudika/support-core-plugin/contributors","subscribers_url":"https://api.github.com/repos/minudika/support-core-plugin/subscribers","subscription_url":"https://api.github.com/repos/minudika/support-core-plugin/subscription","commits_url":"https://api.github.com/repos/minudika/support-core-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/minudika/support-core-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/minudika/support-core-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/minudika/support-core-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/minudika/support-core-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/minudika/support-core-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minudika/support-core-plugin/merges","archive_url":"https://api.github.com/repos/minudika/support-core-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minudika/support-core-plugin/downloads","issues_url":"https://api.github.com/repos/minudika/support-core-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/minudika/support-core-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/minudika/support-core-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/minudika/support-core-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minudika/support-core-plugin/labels{/name}","releases_url":"https://api.github.com/repos/minudika/support-core-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/minudika/support-core-plugin/deployments","created_at":"2016-03-12T22:13:07Z","updated_at":"2016-03-12T22:13:08Z","pushed_at":"2016-06-03T13:06:28Z","git_url":"git://github.com/minudika/support-core-plugin.git","ssh_url":"git@github.com:minudika/support-core-plugin.git","clone_url":"https://github.com/minudika/support-core-plugin.git","svn_url":"https://github.com/minudika/support-core-plugin","homepage":"https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin","size":595,"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":"jenkinsci:master","ref":"master","sha":"1e5ffae4bb740115c092f381c944b61b0d8cd80b","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":13830109,"name":"support-core-plugin","full_name":"jenkinsci/support-core-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/support-core-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/support-core-plugin","forks_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/support-core-plugin/deployments","created_at":"2013-10-24T11:18:45Z","updated_at":"2016-01-11T17:52:03Z","pushed_at":"2016-06-03T13:13:18Z","git_url":"git://github.com/jenkinsci/support-core-plugin.git","ssh_url":"git@github.com:jenkinsci/support-core-plugin.git","clone_url":"https://github.com/jenkinsci/support-core-plugin.git","svn_url":"https://github.com/jenkinsci/support-core-plugin","homepage":"https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin","size":609,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":4,"forks":18,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64"},"html":{"href":"https://github.com/jenkinsci/support-core-plugin/pull/64"},"issue":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/64"},"comments":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/support-core-plugin/statuses/ca0d6bd6a2bf92ea6919fb74ca2d12d832bce079"}}}}
{"actor":{"display_login":"christ66"}}