loginContext = ContextManager.login(realmName, callbackHandler);
clientSubject = loginContext.getSubject();
}
ContextManager.setCallers(clientSubject, clientSubject);
Class mainClass = classLoader.loadClass(mainClassName);
ObjectRecipe objectRecipe = new ObjectRecipe(mainClass);
objectRecipe.allow(Option.FIELD_INJECTION);
objectRecipe.allow(Option.PRIVATE_PROPERTIES);
objectRecipe.allow(Option.STATIC_PROPERTIES);
List<Injection> injections = new ArrayList<Injection>();
while (mainClass != null && mainClass != Object.class) {
List<Injection> perClass = holder.getInjections(mainClass.getName());
if (perClass != null) {
injections.addAll(perClass);
}
mainClass = mainClass.getSuperclass();
}
if (injections != null) {
List<NamingException> problems = new ArrayList<NamingException>();
for (Injection injection : injections) {
String jndiName = injection.getJndiName();
try {
Object object = componentContext.lookup(jndiName);
objectRecipe.setProperty(injection.getTargetName(), object);
} catch (NamingException e) {
log.info("Injection problem for jndiName: " + jndiName, e);
problems.add(e);
}
}
if (!problems.isEmpty()) {
//TODO fix the problems with trying to lookup resource refs from the client.
// throw new Exception("Some objects to be injected were not found in jndi: " + problems);
log.error("Some objects to be injected were not found in jndi: " + problems);
}
}
Class clazz = objectRecipe.setStaticProperties();
if (holder.getPostConstruct() != null) {
Holder.apply(null, clazz, holder.getPostConstruct());
}
if (clientSubject == null) {