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

Bootstrap tests #410

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@
@SuppressWarnings("unchecked") // TODO make more specific
@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
public final class QuiltJoinedFileSystemProvider extends FileSystemProvider {
public QuiltJoinedFileSystemProvider() {}
public QuiltJoinedFileSystemProvider() {
if (instance == null) {
instance = this;
}
}

public static final String SCHEME = "quilt.jfs";

private static QuiltJoinedFileSystemProvider instance;
private static final Map<String, WeakReference<QuiltJoinedFileSystem>> ACTIVE_FILESYSTEMS = new HashMap<>();

static {
Expand Down Expand Up @@ -108,12 +113,25 @@ static synchronized void closeFileSystem(QuiltJoinedFileSystem fs) {
}

public static QuiltJoinedFileSystemProvider instance() {
QuiltJoinedFileSystemProvider found = findInstance();
if (found != null) {
return found;
}
throw new IllegalStateException("Unable to load QuiltJoinedFileSystemProvider via services!");
}

public static QuiltJoinedFileSystemProvider findInstance() {
if (instance != null) {
return instance;
}

for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
if (provider instanceof QuiltJoinedFileSystemProvider) {
return (QuiltJoinedFileSystemProvider) provider;
}
}
throw new IllegalStateException("Unable to load QuiltJoinedFileSystemProvider via services!");

return instance;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.net.URI;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Path;
import java.nio.file.spi.FileSystemProvider;
import java.util.Map;
Expand All @@ -30,20 +29,39 @@

@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
public final class QuiltMemoryFileSystemProvider extends QuiltMapFileSystemProvider<QuiltMemoryFileSystem, QuiltMemoryPath> {
public QuiltMemoryFileSystemProvider() {}
public QuiltMemoryFileSystemProvider() {
if (instance == null) {
instance = this;
}
}

public static final String SCHEME = "quilt.mfs";

private static QuiltMemoryFileSystemProvider instance;

static final String READ_ONLY_EXCEPTION = "This FileSystem is read-only";
static final QuiltFSP<QuiltMemoryFileSystem> PROVIDER = new QuiltFSP<>(SCHEME);

public static QuiltMemoryFileSystemProvider instance() {
QuiltMemoryFileSystemProvider found = findInstance();
if (found != null) {
return found;
}
throw new IllegalStateException("Unable to load QuiltMemoryFileSystemProvider via services!");
}

public static QuiltMemoryFileSystemProvider findInstance() {
if (instance != null) {
return instance;
}

for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
if (provider instanceof QuiltMemoryFileSystemProvider) {
return (QuiltMemoryFileSystemProvider) provider;
}
}
throw new IllegalStateException("Unable to load QuiltMemoryFileSystemProvider via services!");

return instance;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,39 @@

@QuiltLoaderInternal(QuiltLoaderInternalType.NEW_INTERNAL)
public class QuiltUnifiedFileSystemProvider extends QuiltMapFileSystemProvider<QuiltUnifiedFileSystem, QuiltUnifiedPath> {
public QuiltUnifiedFileSystemProvider() {}
public QuiltUnifiedFileSystemProvider() {
if (instance == null) {
instance = this;
}
}

public static final String SCHEME = "quilt.ufs";

static final String READ_ONLY_EXCEPTION = "This FileSystem is read-only";
static final QuiltFSP<QuiltUnifiedFileSystem> PROVIDER = new QuiltFSP<>(SCHEME);

private static QuiltUnifiedFileSystemProvider instance;

public static QuiltUnifiedFileSystemProvider instance() {
QuiltUnifiedFileSystemProvider found = findInstance();
if (found != null) {
return found;
}
throw new IllegalStateException("Unable to load QuiltUnifiedFileSystemProvider via services!");
}

public static QuiltUnifiedFileSystemProvider findInstance() {
if (instance != null) {
return instance;
}

for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
if (provider instanceof QuiltUnifiedFileSystemProvider) {
return (QuiltUnifiedFileSystemProvider) provider;
}
}
throw new IllegalStateException("Unable to load QuiltUnifiedFileSystemProvider via services!");

return instance;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,37 @@

@QuiltLoaderInternal(QuiltLoaderInternalType.NEW_INTERNAL)
public class QuiltZipFileSystemProvider extends QuiltMapFileSystemProvider<QuiltZipFileSystem, QuiltZipPath> {
public QuiltZipFileSystemProvider() {
if (instance == null) {
instance = this;
}
}

public static final String SCHEME = "quilt.zfs";
static final String READ_ONLY_EXCEPTION = "This FileSystem is read-only";
static final QuiltFSP<QuiltZipFileSystem> PROVIDER = new QuiltFSP<>(SCHEME);
private static QuiltZipFileSystemProvider instance;

public static QuiltZipFileSystemProvider instance() {
QuiltZipFileSystemProvider found = findInstance();
if (found != null) {
return found;
}
throw new IllegalStateException("Unable to load QuiltZipFileSystemProvider via services!");
}

public static QuiltZipFileSystemProvider findInstance() {
if (instance != null) {
return instance;
}

for (FileSystemProvider provider : FileSystemProvider.installedProviders()) {
if (provider instanceof QuiltZipFileSystemProvider) {
return (QuiltZipFileSystemProvider) provider;
}
}
throw new IllegalStateException("Unable to load QuiltZipFileSystemProvider via services!");

return instance;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.nio.file.Files;
import java.nio.file.Path;

import org.quiltmc.loader.impl.filesystem.QuiltJoinedFileSystem;
import org.quiltmc.loader.impl.filesystem.QuiltJoinedFileSystemProvider;
Expand All @@ -36,7 +34,7 @@
@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
public class Handler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
public URLConnection openConnection(URL u) throws IOException {
QuiltJoinedPath path;
try {
path = QuiltJoinedFileSystemProvider.instance().getPath(u.toURI());
Expand All @@ -58,7 +56,7 @@ public InputStream getInputStream() throws IOException {
}

@Override
protected InetAddress getHostAddress(URL u) {
public InetAddress getHostAddress(URL u) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
public class Handler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
public URLConnection openConnection(URL u) throws IOException {
QuiltMemoryPath path;
try {
path = QuiltMemoryFileSystemProvider.instance().getPath(u.toURI());
Expand All @@ -56,7 +56,7 @@ public InputStream getInputStream() throws IOException {
}

@Override
protected InetAddress getHostAddress(URL u) {
public InetAddress getHostAddress(URL u) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@QuiltLoaderInternal(QuiltLoaderInternalType.NEW_INTERNAL)
public class Handler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
public URLConnection openConnection(URL u) throws IOException {
QuiltUnifiedPath path;
try {
path = QuiltUnifiedFileSystemProvider.instance().getPath(u.toURI());
Expand All @@ -56,7 +56,7 @@ public InputStream getInputStream() throws IOException {
}

@Override
protected InetAddress getHostAddress(URL u) {
public InetAddress getHostAddress(URL u) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@QuiltLoaderInternal(QuiltLoaderInternalType.LEGACY_EXPOSED)
public class Handler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
public URLConnection openConnection(URL u) throws IOException {
QuiltZipPath path;
try {
path = QuiltZipFileSystemProvider.instance().getPath(u.toURI());
Expand All @@ -56,7 +56,7 @@ public InputStream getInputStream() throws IOException {
}

@Override
protected InetAddress getHostAddress(URL u) {
public InetAddress getHostAddress(URL u) {
return null;
}
}
Loading