Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1065: Add SHA-256 checksum generator to url-updater #1089

Closed
Closed
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
57726c3
Crawler implemented And Refactored Status Json
Amueller36 Jan 23, 2023
11d60da
Merge branch 'master' into feature-941-New-approach-for-ide-mirrors-1…
Amueller36 Jan 30, 2023
6d722f0
Pom.xml update
Amueller36 Feb 9, 2023
33f0484
Merge branch 'devonfw:master' into feature-941-New-approach-for-ide-m…
Amueller36 Feb 9, 2023
43bb7fb
semicolon missing
Amueller36 Feb 9, 2023
6d5fc3c
Merge branch 'feature-941-New-approach-for-ide-mirrors-1009-Create-cr…
Amueller36 Feb 9, 2023
d177c21
Fixxed bug where files from repo were loaded that shouldnt be loaded
Amueller36 Feb 9, 2023
b6deba9
Merge branch 'master' into feature-941-New-approach-for-ide-mirrors-1…
Amueller36 Feb 13, 2023
714e66d
Update url-updater/src/main/java/com/devonfw/tools/ide/url/folderhand…
Amueller36 Feb 20, 2023
970e34a
Added missing import caused by sonarlift
Amueller36 Feb 20, 2023
17f26de
Added Mac Os aarch64 support for helm and terraform.
Amueller36 Feb 21, 2023
e312ca1
Added Mac Os aarch64 support for helm,terraform,GraalVM,GH.
Amueller36 Feb 21, 2023
e6462cb
Removed unused methods that are not needed anymore
Amueller36 Feb 21, 2023
1bbd840
Corrected additonal s in lift.toml
Amueller36 Feb 22, 2023
795cb97
Removed potential Nullptr Dereference
Amueller36 Feb 22, 2023
2d0a61a
Merge branch 'master' into feature-941-New-approach-for-ide-mirrors-1…
hohwille Feb 28, 2023
7505c22
Merge branch 'master' into feature-941-New-approach-for-ide-mirrors-1…
Amueller36 Mar 27, 2023
d867881
Added Kotlin/ Kotlin native Crawler
Amueller36 Mar 28, 2023
731eecf
Added javadoc to important classes
Amueller36 Mar 28, 2023
6863e7e
Fixxed Naming of intellij Edition folder.
Amueller36 Mar 28, 2023
62c5346
Merge branch 'master' into feature-941-New-approach-for-ide-mirrors-1…
hohwille Mar 28, 2023
11055d1
Working on the reviews
Amueller36 Mar 28, 2023
b7c6e4e
Merge branch 'feature-941-New-approach-for-ide-mirrors-1009-Create-cr…
Amueller36 Mar 28, 2023
3a84432
Added Check in Updateinitiator for args
Amueller36 Mar 29, 2023
b17b118
add independent checksum generator
alfeilex Mar 30, 2023
d8a963a
add independent checksum generator
alfeilex Mar 30, 2023
f7e8578
Create testing-checksum.yml
alfeilex Mar 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ generated/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
url-updater/src/main/java/com/devonfw/tools/ide/url/UpdateInitiator.java
url-updater/src/main/java/com/devonfw/tools/ide/url/updater/intellij/IntelliJUltimateEditionCrawler.java
url-updater/src/main/java/com/devonfw/tools/ide/url/updater/kotlin/KotlinNativeCrawler.java
2 changes: 1 addition & 1 deletion .lift.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build = "mvn"

ignoreRules = [ "Var", "Varifier" ]
ignoreRules = [ "Var", "Varifier", "MissingSummary", "JavaLangClash", "PATH_TRAVERSAL_IN" ]
2 changes: 1 addition & 1 deletion settings/src/main/settings
2 changes: 1 addition & 1 deletion url-updater/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.devonfw.tools.ide.url.folderhandling.UrlRepository</mainClass>
<mainClass>com.devonfw.tools.ide.url.UpdateInitiator</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.devonfw.tools.ide.url;

import com.devonfw.tools.ide.url.updater.ChecksumGenerator;
import com.devonfw.tools.ide.url.updater.UpdateManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.file.Path;

public class UpdateInitiator {
private static final Logger logger = LoggerFactory.getLogger(UpdateInitiator.class.getName());

public static void main(String[] args) {
if (args.length == 0) {
logger.error("Error: Missing path to repository as command line argument.");
logger.error("Usage: java UpdateInitiator <path_to_repository>");
System.exit(1);
}
String pathToRepo = args[0];
Path repoPath = Path.of(pathToRepo);
if (!repoPath.toFile().isDirectory()) {
logger.error("Error: Provided path is not a valid directory.");
System.exit(1);
}
UpdateManager updateManager = new UpdateManager(repoPath);
updateManager.updateAll();
ChecksumGenerator checksumGenerator = new ChecksumGenerator();
checksumGenerator.generateChecksums(repoPath.toFile().listFiles());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.devonfw.tools.ide.url.folderhandling;

import java.nio.file.Path;

import com.devonfw.tools.ide.url.folderhandling.abstractUrlClasses.AbstractUrlArtifact;

import java.nio.file.Path;

/**
* An {@link UrlArtifact} represents a file or folder in the directory structure of a devonfw-ide urls repository.
*
Expand All @@ -15,13 +15,13 @@
*/
public interface UrlArtifact {

/**
* @return the {@link Path} to this {@link AbstractUrlArtifact} as folder or file on the disc.
*/
Path getPath();
/**
* @return the {@link Path} to this {@link AbstractUrlArtifact} as folder or file on the disc.
*/
Path getPath();

/**
* @return name the file-name of this {@link AbstractUrlArtifact}.
*/
String getName();
/**
* @return name the file-name of this {@link AbstractUrlArtifact}.
*/
String getName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/
public interface UrlArtifactWithParent<P extends UrlFolder<?>> extends UrlArtifact {

/**
* @return the parent {@link UrlFolder} owning this artifact as child.
*/
P getParent();
/**
* @return the parent {@link UrlFolder} owning this artifact as child.
*/
P getParent();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.devonfw.tools.ide.url.folderhandling;

import com.devonfw.tools.ide.url.folderhandling.abstractUrlClasses.AbstractUrlFile;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
Expand All @@ -9,8 +11,6 @@
import java.util.HashSet;
import java.util.Set;

import com.devonfw.tools.ide.url.folderhandling.abstractUrlClasses.AbstractUrlFile;

/**
* {@link UrlFile} with the download URLs. Its {@link #getName() name} has to follow one of the following conventions:
* <ul>
Expand All @@ -21,97 +21,93 @@
*/
public class UrlDownloadFile extends AbstractUrlFile {

private final Set<String> urls = new HashSet<>();

/**
* The constructor.
*
* @param parent the {@link #getParent() parent folder}.
* @param name the {@link #getName() filename}.
*/
public UrlDownloadFile(UrlVersion parent, String name) {

super(parent, name);
}

/**
* @return the number of #getUrl
*/
public int getUrlCount() {

return this.urls.size();
}

/**
* @param url the download URL to add.
*/
public void addUrl(String url) {

boolean added = this.urls.add(url);
if (added) {
this.modified = true;
}
}

public Set<String> getUrls() {

return this.urls;
}

/**
* @param url the download URL to remove.
*/
public void removeUrl(String url) {

boolean removed = this.urls.remove(url);
if (removed) {
this.modified = true;
}
}

public Set<Integer> generateUrlHashes() {

Set<String> urlsSet = getUrls();
Set<Integer> urlHashes = new HashSet<>();
for (String url : urlsSet) {
Integer urlHash = url.hashCode();
urlHashes.add(urlHash);

}
return urlHashes;

}

@Override
public void doLoad() {

this.urls.clear();
Path path = getPath();
try (BufferedReader br = Files.newBufferedReader(path)) {
String line;
do {
line = br.readLine();
if (line != null) {
this.urls.add(line.trim());
}
} while (line != null);
} catch (IOException e) {
throw new IllegalStateException("Failed to load file " + path, e);
}
}

@Override
public void doSave() {

Path path = getPath();
try (BufferedWriter bw = Files.newBufferedWriter(path, StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.WRITE, StandardOpenOption.CREATE)) {
for (String line : this.urls) {
bw.write(line + "\n");
}
} catch (IOException e) {
throw new IllegalStateException("Failed to save file " + path, e);
}
}

private final Set<String> urls = new HashSet<>();

/**
* The constructor.
*
* @param parent the {@link #getParent() parent folder}.
* @param name the {@link #getName() filename}.
*/
public UrlDownloadFile(UrlVersion parent, String name) {

super(parent, name);
}

/**
* @return the number of #getUrl
*/
public int getUrlCount() {

return this.urls.size();
}

/**
* @param url the download URL to add.
*/
public void addUrl(String url) {

boolean added = this.urls.add(url);
if (added) {
this.modified = true;
}
}


public Set<String> getUrls() {
return this.urls;
}

/**
* @param url the download URL to remove.
*/
public void removeUrl(String url) {

boolean removed = this.urls.remove(url);
if (removed) {
this.modified = true;
}
}


public Set<Integer> generateUrlHashes() {
Set<Integer> urlHashes = new HashSet<>();
for (String url : this.urls) {
Integer urlHash = url.hashCode();
urlHashes.add(urlHash);
}
return urlHashes;

}

@Override
public void doLoad() {

this.urls.clear();
Path path = getPath();
try (BufferedReader br = Files.newBufferedReader(path)) {
String line;
do {
line = br.readLine();
if (line != null) {
this.urls.add(line.trim());
}
} while (line != null);
} catch (IOException e) {
throw new IllegalStateException("Failed to load file " + path, e);
}
}

@Override
public void doSave() {

Path path = getPath();
try (BufferedWriter bw = Files.newBufferedWriter(path, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE, StandardOpenOption.CREATE)) {
for (String line : this.urls) {
bw.write(line + "\n");
}
} catch (IOException e) {
throw new IllegalStateException("Failed to save file " + path, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@
*/
public class UrlEdition extends AbstractUrlFolderWithParent<UrlTool, UrlVersion> {

/**
* The constructor.
*
* @param parent the {@link #getParent() parent folder}.
* @param name the {@link #getName() filename}.
*/
public UrlEdition(UrlTool parent, String name) {
/**
* The constructor.
*
* @param parent the {@link #getParent() parent folder}.
* @param name the {@link #getName() filename}.
*/
public UrlEdition(UrlTool parent, String name) {

super(parent, name);
}
super(parent, name);
}

/**
* This method is used to add new children to the children collection of an instance from this class.
*
* @param name The name of the {@link UrlVersion} object that should be created.
*/
@Override
protected UrlVersion newChild(String name) {
/**
* This method is used to add new children to the children collection of an instance from this class.
*
* @param name The name of the {@link UrlVersion} object that should be created.
*/
@Override
protected UrlVersion newChild(String name) {

return new UrlVersion(this, name);
}

return new UrlVersion(this, name);
}
}
Loading