325N/A/*
325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.ws.model;
325N/A
325N/Aimport com.sun.xml.internal.bind.api.TypeReference;
325N/Aimport com.sun.xml.internal.bind.api.Bridge;
325N/Aimport com.sun.xml.internal.ws.api.model.CheckedException;
325N/Aimport com.sun.xml.internal.ws.api.model.ExceptionType;
325N/Aimport com.sun.xml.internal.ws.api.model.SEIModel;
325N/Aimport com.sun.xml.internal.ws.api.model.JavaMethod;
325N/Aimport com.sun.xml.internal.ws.addressing.WsaActionUtil;
325N/Aimport javax.xml.ws.WebServiceException;
325N/Aimport java.net.URI;
325N/Aimport java.net.URISyntaxException;
325N/Aimport java.util.logging.Logger;
325N/A
325N/A/**
325N/A * CheckedException class. Holds the exception class - class that has public
325N/A * constructor
325N/A *
325N/A * <code>public WrapperException()String message, FaultBean){}</code>
325N/A *
325N/A * and method
325N/A *
325N/A * <code>public FaultBean getFaultInfo();</code>
325N/A *
325N/A * @author Vivek Pandey
325N/A */
325N/Apublic final class CheckedExceptionImpl implements CheckedException {
325N/A private final Class exceptionClass;
325N/A private final TypeReference detail;
325N/A private final ExceptionType exceptionType;
325N/A private final JavaMethodImpl javaMethod;
325N/A private String messageName;
325N/A private String faultAction = "";
325N/A
325N/A /**
325N/A * @param jm {@link JavaMethodImpl} that throws this exception
325N/A * @param exceptionClass
325N/A * Userdefined or WSDL exception class that extends
325N/A * java.lang.Exception.
325N/A * @param detail
325N/A * detail or exception bean's TypeReference
325N/A * @param exceptionType
325N/A * either ExceptionType.UserDefined or
325N/A */
325N/A public CheckedExceptionImpl(JavaMethodImpl jm, Class exceptionClass, TypeReference detail, ExceptionType exceptionType) {
325N/A this.detail = detail;
325N/A this.exceptionType = exceptionType;
325N/A this.exceptionClass = exceptionClass;
325N/A this.javaMethod = jm;
325N/A }
325N/A
325N/A public AbstractSEIModelImpl getOwner() {
325N/A return javaMethod.owner;
325N/A }
325N/A
325N/A public JavaMethod getParent() {
325N/A return javaMethod;
325N/A }
325N/A
325N/A /**
325N/A * @return the <code>Class</clode> for this object
325N/A *
325N/A */
325N/A public Class getExceptionClass() {
325N/A return exceptionClass;
325N/A }
325N/A
325N/A public Class getDetailBean() {
325N/A return (Class) detail.type;
325N/A }
325N/A
325N/A public Bridge getBridge() {
325N/A return getOwner().getBridge(detail);
325N/A }
325N/A
325N/A public TypeReference getDetailType() {
325N/A return detail;
325N/A }
325N/A
325N/A public ExceptionType getExceptionType() {
325N/A return exceptionType;
325N/A }
325N/A
325N/A public String getMessageName() {
325N/A return messageName;
325N/A }
325N/A
325N/A public void setMessageName(String messageName) {
325N/A this.messageName = messageName;
325N/A }
325N/A
325N/A public String getFaultAction() {
325N/A return faultAction;
325N/A }
325N/A
325N/A public void setFaultAction(String faultAction) {
325N/A this.faultAction = faultAction;
325N/A }
325N/A
325N/A public String getDefaultFaultAction() {
325N/A return WsaActionUtil.getDefaultFaultAction(javaMethod,this);
325N/A }
325N/A
325N/A
325N/A}