1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
34 |
34 |
35 /** |
35 /** |
36 * @author Rama Pulavarthi |
36 * @author Rama Pulavarthi |
37 */ |
37 */ |
38 public class WsaActionUtil { |
38 public class WsaActionUtil { |
|
39 |
|
40 @SuppressWarnings("FinalStaticMethod") |
39 public static final String getDefaultFaultAction(JavaMethod method, CheckedException ce) { |
41 public static final String getDefaultFaultAction(JavaMethod method, CheckedException ce) { |
40 String tns = method.getOwner().getTargetNamespace(); |
42 String tns = method.getOwner().getTargetNamespace(); |
41 String delim = getDelimiter(tns); |
43 String delim = getDelimiter(tns); |
42 if (tns.endsWith(delim)) |
44 if (tns.endsWith(delim)) { |
43 tns = tns.substring(0, tns.length() - 1); |
45 tns = tns.substring(0, tns.length() - 1); |
44 |
46 } |
45 //this assumes that fromjava case there won't be a standard fault name. |
|
46 String name = method.getOperationName() + delim + "Fault" + delim + ce.getExceptionClass(); |
|
47 |
47 |
48 return new StringBuilder(tns).append(delim).append( |
48 return new StringBuilder(tns).append(delim).append( |
49 method.getOwner().getPortTypeName().getLocalPart()).append( |
49 method.getOwner().getPortTypeName().getLocalPart()).append( |
50 delim).append(method.getOperationName()).append(delim).append("Fault").append(delim).append(ce.getExceptionClass().getSimpleName()).toString(); |
50 delim).append(method.getOperationName()).append(delim).append("Fault").append(delim).append(ce.getExceptionClass().getSimpleName()).toString(); |
51 } |
51 } |
52 |
52 |
53 private static final String getDelimiter(String tns) { |
53 private static String getDelimiter(String tns) { |
54 String delim = "/"; |
54 String delim = "/"; |
55 // TODO: is this the correct way to find the separator ? |
55 // TODO: is this the correct way to find the separator ? |
56 try { |
56 try { |
57 URI uri = new URI(tns); |
57 URI uri = new URI(tns); |
58 if ((uri.getScheme() != null) && uri.getScheme().equalsIgnoreCase("urn")) |
58 if ((uri.getScheme() != null) && uri.getScheme().equalsIgnoreCase("urn")) { |
59 delim = ":"; |
59 delim = ":"; |
|
60 } |
60 } catch (URISyntaxException e) { |
61 } catch (URISyntaxException e) { |
61 LOGGER.warning("TargetNamespace of WebService is not a valid URI"); |
62 LOGGER.warning("TargetNamespace of WebService is not a valid URI"); |
62 } |
63 } |
63 return delim; |
64 return delim; |
64 } |
65 } |