forked from devonfw/ide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devonfw#941:Added (folders + code) frame for discussion
- Loading branch information
1 parent
689d2df
commit 754b739
Showing
11 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.devonfw.tools.ide.dev</groupId> | ||
<artifactId>devonfw-ide</artifactId> | ||
<version>dev-SNAPSHOT</version> | ||
</parent> | ||
<groupId>com.devonfw.tools.ide</groupId> | ||
<artifactId>devonfw-ide-url-updater</artifactId> | ||
<packaging>jar</packaging> | ||
<version>${revision}</version> | ||
<name>${project.artifactId}</name> | ||
<description>Code for maintenance of download urls of IDEs (Eclipse, etc.).</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.json</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>com.devonfw.tools.ide.url-updater.Url-updater</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.devonfw.tools.ide.dev</groupId> | ||
<artifactId>devonfw-ide</artifactId> | ||
<version>dev-SNAPSHOT</version> | ||
</parent> | ||
<groupId>com.devonfw.tools.ide</groupId> | ||
<artifactId>devonfw-ide-url-updater</artifactId> | ||
<packaging>jar</packaging> | ||
<version>${revision}</version> | ||
<name>${project.artifactId}</name> | ||
<description>Code for maintenance of download urls of IDEs tools (Eclipse, Docker, etc.).</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.json</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>com.devonfw.tools.ide.url-updater.Url-updater</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
25 changes: 25 additions & 0 deletions
25
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @param <P> Parent type | ||
* @param <C> Child type | ||
*/ | ||
public abstract class UrlArtifact<P, C> { | ||
protected final Path path; | ||
|
||
public UrlArtifact(Path path) { | ||
this.path = path; | ||
} | ||
|
||
public Path getPath() { | ||
return this.path; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlEdition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
public class UrlEdition extends UrlHasChildParentArtifact<UrlTool, UrlVersion> { | ||
|
||
public UrlEdition(UrlTool parent, String name) { | ||
|
||
super(parent, name); | ||
} | ||
|
||
@Override | ||
protected UrlVersion newChild(String name) { | ||
|
||
return new UrlVersion(this, name); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlHasChildArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public abstract class UrlHasChildArtifact<P ,C> extends UrlArtifact<P,C> { | ||
protected Map<String, C> children; | ||
|
||
|
||
public UrlHasChildArtifact(Path path) { | ||
super(path); | ||
this.children = new HashMap<>(); | ||
} | ||
|
||
|
||
public int getChildCount() { | ||
|
||
return this.children.size(); | ||
} | ||
|
||
public C getChild(String name) { | ||
|
||
return this.children.get(name); | ||
} | ||
|
||
public C getOrCreateChild(String name) { | ||
|
||
return this.children.computeIfAbsent(name, p -> newChild(name)); | ||
} | ||
|
||
|
||
protected abstract C newChild(String name); | ||
} |
49 changes: 49 additions & 0 deletions
49
...ter/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlHasChildParentArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public abstract class UrlHasChildParentArtifact<P extends UrlArtifact<?, ?>, C> extends UrlArtifact<P, C> { | ||
protected final P parent; | ||
|
||
protected final String name; | ||
|
||
protected Map<String, C> children; | ||
|
||
|
||
public UrlHasChildParentArtifact(P parent, String name) { | ||
super(parent.getPath().resolve(name)); | ||
this.parent = parent; | ||
this.name = name; | ||
this.children = new HashMap<>(); | ||
|
||
} | ||
|
||
public P getParent() { | ||
|
||
return this.parent; | ||
} | ||
|
||
public String getName() { | ||
|
||
return this.name; | ||
} | ||
|
||
public int getChildCount() { | ||
|
||
return this.children.size(); | ||
} | ||
|
||
public C getChild(String name) { | ||
|
||
return this.children.get(name); | ||
} | ||
|
||
public C getOrCreateChild(String name) { | ||
|
||
return this.children.computeIfAbsent(name, p -> newChild(name)); | ||
} | ||
|
||
protected abstract C newChild(String name); | ||
} |
16 changes: 16 additions & 0 deletions
16
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlHasParentArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Map; | ||
|
||
public abstract class UrlHasParentArtifact<P extends UrlArtifact<?, ?>, C> extends UrlArtifact<UrlArtifact<?, ?>, C> { | ||
protected final P parent; | ||
protected final String name; | ||
|
||
public UrlHasParentArtifact(P parent, String name) { | ||
super(parent.getPath().resolve(name)); | ||
this.parent = parent; | ||
this.name = name; | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.nio.file.Path; | ||
|
||
public class UrlRepository extends UrlHasChildArtifact<UrlRepository, UrlTool> { | ||
|
||
Path path; | ||
|
||
/** | ||
* | ||
* @param path Enter the path to the url folder structure in which the tool folders are supposed to be later on in the | ||
* creation process. | ||
*/ | ||
public UrlRepository(Path path) { | ||
super(path); | ||
this.path = path; | ||
|
||
} | ||
|
||
@Override | ||
protected UrlTool newChild(String name) { | ||
|
||
return new UrlTool(this, name); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlTool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
public class UrlTool extends UrlHasChildParentArtifact<UrlRepository, UrlEdition> { | ||
|
||
public UrlTool(UrlRepository parent, String name) { | ||
|
||
super(parent, name); | ||
} | ||
|
||
@Override | ||
protected UrlEdition newChild(String name) { | ||
|
||
return new UrlEdition(this, name); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
url-updater/src/main/java/com/devonfw/tools/ide/url/folderhandling/UrlVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.devonfw.tools.ide.url.folderhandling; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class UrlVersion extends UrlHasChildParentArtifact<UrlEdition, UrlFile> { | ||
|
||
public UrlVersion(UrlEdition parent, String name) { | ||
|
||
super(parent, name); | ||
} | ||
|
||
protected void makeFile(String os, String arch) throws IOException { | ||
|
||
Path filePath = getPath().resolve(os + "_" + arch + ".urls"); | ||
if (!Files.exists(filePath)) { | ||
Files.createFile(filePath); | ||
} | ||
} | ||
|
||
protected void makeFile(String os) throws IOException { | ||
|
||
Path filePath = getPath().resolve(os + ".urls"); | ||
if (!Files.exists(filePath)) { | ||
Files.createFile(filePath); | ||
} | ||
} | ||
|
||
protected void makeFile() throws IOException { | ||
|
||
Path filePath = getPath().resolve("urls"); | ||
if (!Files.exists(filePath)) { | ||
Files.createFile(filePath); | ||
} | ||
} | ||
|
||
@Override | ||
protected UrlFile newChild(String name) { | ||
|
||
return new UrlFile(this, name); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
url-updater/src/test/resources/urlsRepo/docker/rancher/1.6.2/linux.urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
url/1 | ||
url/2 |