Skip to content

Commit

Permalink
Add util methods for creating ResourceRoots.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Oct 3, 2012
1 parent d5e301c commit 56e3504
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -29,6 +29,7 @@
import java.util.List;
import java.util.jar.JarFile;

import org.jboss.as.server.deployment.module.ModuleRootMarker;
import org.jboss.as.server.deployment.module.ResourceRoot;
import org.jboss.as.server.deployment.module.VFSResourceLoader;
import org.jboss.modules.Module;
Expand All @@ -43,6 +44,19 @@

public class ResourceLoaderUtil {

public static ResourceRoot createResourceRoot(File file, boolean mark) {
return createResourceRoot( file.getAbsolutePath(), mark );
}

public static ResourceRoot createResourceRoot(String path, boolean mark) {
final ResourceRoot resource = new ResourceRoot( VFS.getChild( path ), null );
if (mark) {
ModuleRootMarker.mark(resource);
}

return resource;
}

public static ResourceLoaderSpec createLoaderSpec(File file) throws IOException {
ResourceLoader loader = ResourceLoaders.createJarResourceLoader( file.getName(), new JarFile( file ) );
return ResourceLoaderSpec.createResourceLoaderSpec( loader );
Expand Down

0 comments on commit 56e3504

Please sign in to comment.