|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janosvm.resources.ClassPathResource
Provides access methods to the current team's class path.
The class path in a typical VM is used to specify where to find the class files on the local file system, however, in the JanosVM we're trying to simulate multiple JVMs so a single class path for all of the teams might be insufficient. For example, a user might want to have access to a standard and debugging build of their classes or a more paranoid user might want a team to have no class path to make sure it can't gain access to anything outside of its sandbox. Whatever the case may be, per-team class paths help maintain the illusion of multiple JVMs running in a single instance of the JanosVM.
The current implementation of the resource simply takes the class path as determined at startup and uses it as the global path from which each team can select a subset of paths. Then when a team is created you can create a ClassPathSpec with an array of strings containing the paths that the team should have access too or just use the default of everything in the global path.
ClassPathSpec
Constructor Summary | |
private |
ClassPathResource()
Its a static only class. |
Method Summary | |
static void |
addPath(java.lang.String path)
Add a class path to the globally available set. |
static java.lang.String[] |
getPaths()
|
static void |
hidePath(java.lang.String path)
Hide a path from the global class path. |
static byte[] |
loadFile(java.lang.String name)
Load the file with the given name from the class path. |
static void |
removePath(java.lang.String path)
Remove a path from the global class path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait, wait0 |
Constructor Detail |
private ClassPathResource()
Method Detail |
public static byte[] loadFile(java.lang.String name) throws java.io.FileNotFoundException, java.io.IOException, DeadTeamException
Throws
- FileNotFoundException if the file couldn't be found.Throws
- an IOException if the there was a problem while
loading.Throws
- a DeadTeamException if the current team was unable
to visit the kernel to add the path.public static void addPath(java.lang.String path) throws java.io.IOException, DeadTeamException
path
- The path string to add to the global class path.Throws
- an IOException if the resource is unable to open the
path.Throws
- a DeadTeamException if the current team was unable
to visit the kernel to add the path.public static void hidePath(java.lang.String path) throws java.io.IOException, DeadTeamException
path
- The path string to hide from the global class path.Throws
- an IOException if the resource is unable to open the
path.Throws
- a DeadTeamException if the current team was unable
to visit the kernel to hide the path.public static void removePath(java.lang.String path) throws DeadTeamException
path
- The path string to remove from the global class path.Throws
- a DeadTeamException if the current team was unable
to visit the kernel to remove the path.public static java.lang.String[] getPaths()
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |