blob: 31d0819aeed14ea28b9fc6c548edc3e73ec2ea76 [file] [log] [blame]
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.5-b01-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.07.15 at 04:13:34 PM PDT
//
package org.apache.geronimo.components.jaspi.model;
import java.io.Serializable;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.security.auth.message.MessagePolicy;
import javax.security.auth.message.AuthException;
import javax.security.auth.callback.CallbackHandler;
/**
* <p>Java class for targetType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="targetType">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="className" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "targetType", propOrder = {
"className"
})
public class TargetType
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(required = true)
protected String className;
/**
* Gets the value of the className property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClassName() {
return className;
}
/**
* Sets the value of the className property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClassName(String value) {
this.className = value;
}
public MessagePolicy.Target newTarget(final ClassLoader classLoader) throws AuthException {
try {
return java.security.AccessController
.doPrivileged(new PrivilegedExceptionAction<MessagePolicy.Target>() {
public MessagePolicy.Target run() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
Class<? extends MessagePolicy.Target> cl = (Class<? extends MessagePolicy.Target>) Class.forName(className, true, classLoader);
Constructor<? extends MessagePolicy.Target> cnst = cl.getConstructor();
MessagePolicy.Target target = cnst.newInstance();
return target;
}
});
} catch (PrivilegedActionException e) {
Exception inner = e.getException();
if (inner instanceof InstantiationException) {
throw (AuthException) new AuthException("AuthConfigFactory error:"
+ inner.getCause().getMessage()).initCause(inner.getCause());
} else {
throw (AuthException) new AuthException("AuthConfigFactory error: " + inner).initCause(inner);
}
} catch (Exception e) {
throw (AuthException) new AuthException("AuthConfigFactory error: " + e).initCause(e);
}
}
}