| /** |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| // |
| // 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.lang.reflect.Constructor; |
| import java.lang.reflect.InvocationTargetException; |
| import java.security.PrivilegedActionException; |
| import java.security.PrivilegedExceptionAction; |
| |
| import javax.security.auth.message.AuthException; |
| import javax.security.auth.message.MessagePolicy; |
| 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 org.apache.geronimo.osgi.locator.ProviderLocator; |
| |
| |
| /** |
| * <p>Java class for targetType complex type. |
| * |
| * <p>The following schema fragment specifies the expected content contained within this class. |
| * |
| * <pre> |
| * <complexType name="targetType"> |
| * <complexContent> |
| * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
| * <sequence> |
| * <element name="className" type="{http://www.w3.org/2001/XMLSchema}string"/> |
| * </sequence> |
| * </restriction> |
| * </complexContent> |
| * </complexType> |
| * </pre> |
| * |
| * |
| * @version $Rev$ $Date$ |
| */ |
| @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() 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 = ProviderLocator.loadClass(className, getClass(), Thread.currentThread().getContextClassLoader()).asSubclass(MessagePolicy.Target.class); |
| 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); |
| } |
| |
| } |
| |
| } |