in proxy/src/main/java/org/apache/directory/fortress/realm/tomcat/Tc7AccessMgrProxy.java [65:122]
private void initialize()
{
try
{
URLClassLoader ucl;
if ( CONTAINER.equalsIgnoreCase( JBOSS_AGENT ) )
{
LOG.info( CLS_NM + ".initialize JBoss policy agent" );
URL[] cp = CpUtil.getRealmClasspath( REALM_CLASSPATH );
ucl = new ChildFirstUrlClassLoader(cp, this.getClass().getClassLoader() );
}
else if ( CONTAINER.equalsIgnoreCase( "TomcatContext" ) )
{
LOG.info( CLS_NM + ".initialize Tomcat7 Context-based policy agent" );
ucl = new URLClassLoader( new URL[]{}, Thread.currentThread().getContextClassLoader() );
}
else
{
LOG.info( CLS_NM + ".initialize Tomcat7 policy agent" );
if ( ( realmClasspath != null ) && ( realmClasspath.length() > 0 ) )
{
ucl = new URLClassLoader( CpUtil.parseRealmClasspath( realmClasspath ), this.getClass().getClassLoader() );
}
else
{
URL[] cp = CpUtil.getRealmClasspath( REALM_CLASSPATH );
ucl = new URLClassLoader( cp, this.getClass().getClassLoader() );
}
}
LOG.info( CLS_NM + ".initialize - instantiate policy agent name: " + REALM_IMPL );
Class<?> sc = ucl.loadClass( REALM_IMPL );
realm = (TcAccessMgr) sc.newInstance();
realm.setDefaultRoles( defaultRoles );
realm.setContextId( contextId );
LOG.info( CLS_NM + " J2EE Tomcat7 policy agent, contextId: " + contextId + ", defaultRoles: " + defaultRoles );
}
catch ( ClassNotFoundException e )
{
String error = CLS_NM + ".initialize caught java.lang.ClassNotFoundException=" + e.toString();
LOG.severe( error );
throw new RuntimeException( error, e );
}
catch ( InstantiationException ie )
{
String error = CLS_NM + ".initialize caught java.lang.InstantiationException=" + ie.toString();
LOG.severe( error );
throw new RuntimeException( error, ie );
}
catch ( IllegalAccessException iae )
{
String error = CLS_NM + ".initialize caught java.lang.IllegalAccessException=" + iae.toString();
LOG.severe( error );
throw new RuntimeException( error, iae );
}
}