-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScanSnapv4Repo.java
140 lines (136 loc) · 4.45 KB
/
ScanSnapv4Repo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package com.syed.netbeans.mac1;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;
public class ScanSnapv4Repo {
private static final String DEPENDENCY_TO_BE_SCANNED_FOR = "jxml";
private static final String FILE_PATH_HOLDING_TREE = "/tmp/syed.tree";
private static final String[] ALL_SNAPPACKS = new String[] {
"activedirectory",
"amazonsns",
"amazonsqs",
"anaplan",
"apisuite",
"autosync",
"azureactivedirectory",
"azureservicebus",
"binary",
"birst",
"box",
"confluentkafka",
"coupa",
"datacatalog",
"db/alloydb",
"db/azuresql",
"db/azuresynapsesql",
"db/cassandra",
"db/databricks",
"db/elt",
"db/hive",
"db/jdbc",
"db/mongo",
"db/mysql",
"db/netezza",
"db/oracle",
"db/postgres",
"db/redshift",
"db/saphana",
"db/snowflake",
"db/sqlserver",
"db/teradata",
"dynamics365forsales",
"dynamodb",
"eloqua",
"email",
"exchange",
"expensify",
"facebook",
"flow",
"foursquare",
"google/analytics",
"google/analytics4",
"google/bigquery",
"google/directory",
"google/spreadsheet",
"hadoop",
"jira",
"jms",
"jwt",
"ldap",
"marketo",
"microsoft/businesscentral",
"microsoft/msdynamics365fo",
"microsoft/exchangeonline",
"microsoft/onedrive",
"microsoft/teams",
"mlanalytics",
"mlcore",
"mldatapreparation",
"mlnlp",
"msdynamicsax",
"netsuite",
"openair",
"openapi",
"policies",
"rabbitmq",
"reltiosnapconnector",
"rest",
"s3snap",
"salesforce",
"sap",
"script",
"servicenow",
"shopify",
"slack",
"snaplogicmetadata",
"soap",
"splunk",
"sumologic",
"tableau9",
"test",
"transform",
"twitter",
"vertica",
"workday",
"workdayprism",
"xactly",
"zuora"
};
private static final String SNAP_V4_LOCATION = "/Users/syedgaian/SyedsMacWorld/7_Work/Snap_v4";
private static final String MATCHING_PATTERN = "\n[INFO] +- com.snaplogic:" + DEPENDENCY_TO_BE_SCANNED_FOR + ":jar:34.0:compile";
public static void main(String[] args) throws Exception {
for (String snappack : ALL_SNAPPACKS) {
System.out.println("processing: " + snappack);
String snappackLocation = SNAP_V4_LOCATION;
if (!snappackLocation.endsWith(File.separator)) {
snappackLocation = snappackLocation + File.separator;
}
snappackLocation = snappackLocation + snappack;
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("sh", "-c",
"/Users/syedgaian/SyedsMacWorld/6_Setup/2_Maven/apache-maven-3.8.6/bin/mvn -f " +
snappackLocation + " dependency:tree > " + FILE_PATH_HOLDING_TREE);
try {
Process process = processBuilder.start();
BufferedReader reader =
new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
process.waitFor();
String allContents = Files.readString(Paths.get(FILE_PATH_HOLDING_TREE));
if (allContents.contains(MATCHING_PATTERN)) {
System.out.println("snappack impacted: " + snappack);
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}