This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
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
19 changed files
with
389 additions
and
400 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
56 changes: 0 additions & 56 deletions
56
phantomjs-maven-core/src/main/java/com/github/klieber/phantomjs/cache/CachedArtifact.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
phantomjs-maven-core/src/main/java/com/github/klieber/phantomjs/cache/CachedFile.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
phantomjs-maven-core/src/main/java/com/github/klieber/phantomjs/cache/CachedFileFactory.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,24 @@ | ||
package com.github.klieber.phantomjs.cache; | ||
|
||
import com.github.klieber.phantomjs.archive.PhantomJSArchive; | ||
import com.github.klieber.phantomjs.util.ArtifactBuilder; | ||
import org.eclipse.aether.RepositorySystemSession; | ||
import org.eclipse.aether.artifact.Artifact; | ||
import org.eclipse.aether.repository.LocalRepositoryManager; | ||
|
||
import java.io.File; | ||
|
||
public class CachedFileFactory { | ||
|
||
private final ArtifactBuilder artifactBuilder; | ||
|
||
public CachedFileFactory(ArtifactBuilder artifactBuilder) { | ||
this.artifactBuilder = artifactBuilder; | ||
} | ||
|
||
public File create(PhantomJSArchive phantomJSArchive, RepositorySystemSession repositorySystemSession) { | ||
Artifact artifact = artifactBuilder.createArtifact(phantomJSArchive); | ||
LocalRepositoryManager manager = repositorySystemSession.getLocalRepositoryManager(); | ||
return new File(manager.getRepository().getBasedir(), manager.getPathForLocalArtifact(artifact)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...mjs-maven-core/src/main/java/com/github/klieber/phantomjs/download/DownloaderFactory.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,39 @@ | ||
package com.github.klieber.phantomjs.download; | ||
|
||
import com.github.klieber.phantomjs.archive.PhantomJSArchive; | ||
import com.github.klieber.phantomjs.cache.CachedFileFactory; | ||
import com.github.klieber.phantomjs.locate.PhantomJsLocatorOptions; | ||
import com.github.klieber.phantomjs.locate.RepositoryDetails; | ||
import com.github.klieber.phantomjs.util.ArtifactBuilder; | ||
|
||
import java.io.File; | ||
|
||
public class DownloaderFactory { | ||
|
||
private final PhantomJsLocatorOptions options; | ||
private final RepositoryDetails repositoryDetails; | ||
private final ArtifactBuilder artifactBuilder; | ||
private final CachedFileFactory cachedFileFactory; | ||
|
||
public DownloaderFactory(PhantomJsLocatorOptions options, | ||
RepositoryDetails repositoryDetails, | ||
ArtifactBuilder artifactBuilder, | ||
CachedFileFactory cachedFileFactory) { | ||
this.options = options; | ||
this.repositoryDetails = repositoryDetails; | ||
this.artifactBuilder = artifactBuilder; | ||
this.cachedFileFactory = cachedFileFactory; | ||
} | ||
|
||
public Downloader getDownloader(PhantomJSArchive phantomJSArchive) { | ||
Downloader downloader; | ||
if (PhantomJsLocatorOptions.Source.REPOSITORY.equals(options.getSource())) { | ||
downloader = new RepositoryDownloader(artifactBuilder, repositoryDetails); | ||
} else { | ||
File cachedFile = cachedFileFactory.create(phantomJSArchive, repositoryDetails.getRepositorySystemSession()); | ||
downloader = new WebDownloader(cachedFile); | ||
} | ||
return downloader; | ||
} | ||
|
||
} |
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
32 changes: 0 additions & 32 deletions
32
phantomjs-maven-core/src/main/java/com/github/klieber/phantomjs/extract/Extractor.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.