Skip to content

Commit

Permalink
Improved ForgeFactory API to allow use without bootpath/
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Apr 16, 2013
1 parent f6448be commit 08bd7f5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions se/src/main/java/org/jboss/forge/se/init/ForgeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@ public static Forge getInstance()
{
try
{
final BootstrapClassLoader cl = new BootstrapClassLoader("bootpath");
Class<?> bootstrapType = cl.loadClass("org.jboss.forge.container.ForgeImpl");
return (Forge) ClassLoaderAdapterCallback.enhance(ForgeFactory.class.getClassLoader(), cl,
final BootstrapClassLoader loader = new BootstrapClassLoader("bootpath");
Class<?> bootstrapType = loader.loadClass("org.jboss.forge.container.ForgeImpl");
return (Forge) ClassLoaderAdapterCallback.enhance(ForgeFactory.class.getClassLoader(), loader,
bootstrapType.newInstance(), Forge.class);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}

public static Forge getInstance(ClassLoader loader)
{
try
{
Class<?> bootstrapType = loader.loadClass("org.jboss.forge.container.ForgeImpl");
return (Forge) ClassLoaderAdapterCallback.enhance(ForgeFactory.class.getClassLoader(), loader,
bootstrapType.newInstance(), Forge.class);
}
catch (Exception e)
Expand Down

0 comments on commit 08bd7f5

Please sign in to comment.