-
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.
- Loading branch information
Showing
53 changed files
with
279 additions
and
1,684 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,33 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
replay_pid* | ||
|
||
# Target files | ||
target | ||
|
||
# .idea Files | ||
.idea | ||
|
||
# LastIndexProcessed | ||
lastIndexProcessed |
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
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,69 @@ | ||
package org.tudo.sse; | ||
|
||
import org.tudo.sse.model.*; | ||
import org.tudo.sse.model.index.IndexInformation; | ||
import org.tudo.sse.model.jar.JarInformation; | ||
import org.tudo.sse.model.pom.PomInformation; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* The ArtifactFactory handles the creation and storage of artifacts resolved. | ||
* Using a map double resolutions are avoided and faster retrievals are possible. | ||
*/ | ||
public class ArtifactFactory { | ||
|
||
/** | ||
* A map that stores all artifacts collected during index, pom, and jar resolution. | ||
*/ | ||
public static final Map<ArtifactIdent, Artifact> artifacts = new HashMap<>(); | ||
|
||
/** | ||
* This method creates a new Artifact or retrieves it from the map. | ||
* @param artifactInformation an identifier used to keep track of artifacts | ||
* @return a newly created or retrieved artifact | ||
*/ | ||
public static Artifact createArtifact(ArtifactInformation artifactInformation) { | ||
|
||
//first check if it exists in artifacts | ||
if(artifacts.containsKey(artifactInformation.getIdent())) { | ||
Artifact current = artifacts.get(artifactInformation.getIdent()); | ||
|
||
//see if it matches an empty field | ||
if(current.getIndexInformation() == null && (artifactInformation instanceof IndexInformation)) { | ||
current.setIndexInformation((IndexInformation) artifactInformation); | ||
} else if(current.getPomInformation() == null && (artifactInformation instanceof PomInformation)) { | ||
current.setPomInformation((PomInformation) artifactInformation); | ||
} else if (current.getJarInformation() == null && (artifactInformation instanceof JarInformation)) { | ||
current.setJarInformation((JarInformation) artifactInformation); | ||
} | ||
|
||
//return it | ||
return current; | ||
} | ||
|
||
Artifact newArtifact; | ||
if(artifactInformation instanceof IndexInformation) { | ||
newArtifact = new Artifact((IndexInformation) artifactInformation); | ||
} else if (artifactInformation instanceof PomInformation) { | ||
newArtifact = new Artifact((PomInformation) artifactInformation); | ||
} else { | ||
newArtifact = new Artifact((JarInformation) artifactInformation); | ||
} | ||
|
||
artifacts.put(artifactInformation.getIdent(), newArtifact); | ||
return newArtifact; | ||
} | ||
|
||
/** | ||
* Searches for an artifact with the matching identifier, returning it if found. | ||
* | ||
*/ | ||
public static Artifact getArtifact(ArtifactIdent ident) { | ||
if(artifacts.containsKey(ident)) { | ||
return artifacts.get(ident); | ||
} | ||
return null; | ||
} | ||
} |
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,13 @@ | ||
package org.tudo.sse; | ||
|
||
import org.tudo.sse.model.Artifact; | ||
|
||
public class OwnImplementation extends MavenCentralAnalysis { | ||
public OwnImplementation() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void analyzeArtifact(Artifact toAnalyze) { | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/main/java/org/tudo/sse/model/index/IndexInformation.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,80 @@ | ||
package org.tudo.sse.model.index; | ||
|
||
import org.tudo.sse.model.ArtifactIdent; | ||
import org.tudo.sse.model.ArtifactInformation; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* This class stores the metadata collected from walking the maven central index. | ||
*/ | ||
public class IndexInformation extends ArtifactInformation { | ||
private String name; | ||
private long index; | ||
private final long lastModified; | ||
private final List<Package> packages; | ||
|
||
public IndexInformation(ArtifactIdent ident, Package aPackage) { | ||
super(ident); | ||
packages = new ArrayList<>(); | ||
packages.add(aPackage); | ||
this.lastModified = aPackage.getLastModified(); | ||
} | ||
|
||
/** | ||
* Retrieves the last modified value | ||
* @return long represented the last modified value of the artifact | ||
*/ | ||
public long getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
/** | ||
* Retrieves the name of the artifact | ||
* @return string representing the name of the artifact | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Updates the name of the artifact | ||
* @param name new name to update with | ||
*/ | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Retrieves the index of the artifact | ||
* @return long representing the index of the artifact | ||
*/ | ||
public long getIndex() { | ||
return index; | ||
} | ||
|
||
/** | ||
* Updates the value of the artifact index | ||
* @param index new index value to set | ||
*/ | ||
public void setIndex(long index) { | ||
this.index = index; | ||
} | ||
|
||
/** | ||
* Adds a package which has the same identifier as the current artifact | ||
* @param pack package object to add | ||
*/ | ||
public void addAPackage(Package pack) { | ||
packages.add(pack); | ||
} | ||
|
||
/** | ||
* Retrieves all the packages under the same identifier | ||
* @return a list of packages | ||
*/ | ||
public List<Package> getPackages() { | ||
return packages; | ||
} | ||
} |
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,82 @@ | ||
package org.tudo.sse.model.index; | ||
|
||
/** | ||
* The Package represents each package stored under a single GAV. | ||
* So multiple packages can be stored under a single GAV, so each are stored as a Package object. | ||
*/ | ||
|
||
public class Package { | ||
private final String packaging; | ||
private final long lastModified; | ||
private final long size; | ||
private final String sha1checksum; | ||
private final int sourcesExist; | ||
private final int javadocExists; | ||
private final long signatureExists; | ||
|
||
public Package(String packaging, long lastModified, long size, int sourcesExist, int javadocExists, long signatureExists, String sha1checksum) { | ||
this.lastModified = lastModified; | ||
this.packaging = packaging; | ||
this.size = size; | ||
this.sha1checksum = sha1checksum; | ||
this.sourcesExist = sourcesExist; | ||
this.javadocExists = javadocExists; | ||
this.signatureExists = signatureExists; | ||
} | ||
|
||
/** | ||
* Retrieves the last modified value | ||
* @return long representing the last modified value of the artifact | ||
*/ | ||
public long getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
/** | ||
* Retrieves the numerical sources exist value | ||
* @return int representing sources exist metadata value | ||
*/ | ||
public int getSourcesExist() { | ||
return sourcesExist; | ||
} | ||
|
||
/** | ||
* Retrieves the numerical javadoc exist value | ||
* @return int representing source exist metadata value | ||
*/ | ||
public int getJavadocExists() { | ||
return javadocExists; | ||
} | ||
|
||
/** | ||
* Retrieves the numerical signature exist value | ||
* @return int representing signature exist metadata value | ||
*/ | ||
public long getSignatureExists() { | ||
return signatureExists; | ||
} | ||
|
||
/** | ||
* Retrieves the packaging type of the artifact | ||
* @return string representing the packaging of the current artifact | ||
*/ | ||
public String getPackaging() { | ||
return packaging; | ||
} | ||
|
||
/** | ||
* Retrieves the size of the current artifact | ||
* @return long representing the size of the current artifact | ||
*/ | ||
public long getSize() { | ||
return size; | ||
} | ||
|
||
/** | ||
* Retrieves the Sha1checksum of the current artifact | ||
* @return string representing the Sha1checksum of the current artifact | ||
*/ | ||
public String getSha1checksum() { | ||
return sha1checksum; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-540 Bytes
target/classes/org/tudo/sse/multiThreading/IndexProcessingMessage.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.79 KB
target/classes/org/tudo/sse/utils/HttpResourceHandler$HttpResource.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.