Skip to content

Commit 8babef1

Browse files
committed
working ping, includes list providers and list authenticators
0 parents  commit 8babef1

File tree

82 files changed

+5109
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5109
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.iml
2+
target
3+
dependency-reduced-pom.xml

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "parsec-operations"]
2+
path = parsec-operations
3+
url = https://github.com/parallaxsecond/parsec-operations.git
4+
branch = main
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import java.net.*;
17+
import java.io.*;
18+
import java.nio.channels.*;
19+
import java.util.Properties;
20+
21+
public class MavenWrapperDownloader {
22+
23+
private static final String WRAPPER_VERSION = "0.5.6";
24+
/** Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */
25+
private static final String DEFAULT_DOWNLOAD_URL =
26+
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
27+
+ WRAPPER_VERSION
28+
+ "/maven-wrapper-"
29+
+ WRAPPER_VERSION
30+
+ ".jar";
31+
32+
/**
33+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to use
34+
* instead of the default one.
35+
*/
36+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
37+
".mvn/wrapper/maven-wrapper.properties";
38+
39+
/** Path where the maven-wrapper.jar will be saved to. */
40+
private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar";
41+
42+
/**
43+
* Name of the property which should be used to override the default download url for the wrapper.
44+
*/
45+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
46+
47+
public static void main(String args[]) {
48+
System.out.println("- Downloader started");
49+
File baseDirectory = new File(args[0]);
50+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
51+
52+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
53+
// wrapperUrl parameter.
54+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
55+
String url = DEFAULT_DOWNLOAD_URL;
56+
if (mavenWrapperPropertyFile.exists()) {
57+
FileInputStream mavenWrapperPropertyFileInputStream = null;
58+
try {
59+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
60+
Properties mavenWrapperProperties = new Properties();
61+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
62+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
63+
} catch (IOException e) {
64+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
65+
} finally {
66+
try {
67+
if (mavenWrapperPropertyFileInputStream != null) {
68+
mavenWrapperPropertyFileInputStream.close();
69+
}
70+
} catch (IOException e) {
71+
// Ignore ...
72+
}
73+
}
74+
}
75+
System.out.println("- Downloading from: " + url);
76+
77+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
78+
if (!outputFile.getParentFile().exists()) {
79+
if (!outputFile.getParentFile().mkdirs()) {
80+
System.out.println(
81+
"- ERROR creating output directory '"
82+
+ outputFile.getParentFile().getAbsolutePath()
83+
+ "'");
84+
}
85+
}
86+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
87+
try {
88+
downloadFileFromURL(url, outputFile);
89+
System.out.println("Done");
90+
System.exit(0);
91+
} catch (Throwable e) {
92+
System.out.println("- Error downloading");
93+
e.printStackTrace();
94+
System.exit(1);
95+
}
96+
}
97+
98+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
99+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
100+
String username = System.getenv("MVNW_USERNAME");
101+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
102+
Authenticator.setDefault(
103+
new Authenticator() {
104+
@Override
105+
protected PasswordAuthentication getPasswordAuthentication() {
106+
return new PasswordAuthentication(username, password);
107+
}
108+
});
109+
}
110+
URL website = new URL(urlString);
111+
ReadableByteChannel rbc;
112+
rbc = Channels.newChannel(website.openStream());
113+
FileOutputStream fos = new FileOutputStream(destination);
114+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
115+
fos.close();
116+
rbc.close();
117+
}
118+
}

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

lombok.config

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
config.stopBubbling = true
2+
lombok.addLombokGeneratedAnnotation = true
3+
lombok.anyConstructor.addConstructorProperties = true

0 commit comments

Comments
 (0)