Tue, 09 Apr 2013 14:51:13 +0100
8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com
1 /*
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.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.tools.internal.ws.processor.model;
28 import java.util.Iterator;
30 /**
31 *
32 * A model visitor incorporating all the logic required to walk through the model.
33 *
34 * @author WS Development Team
35 */
36 public class ExtendedModelVisitor {
38 public ExtendedModelVisitor() {}
40 public void visit(Model model) throws Exception {
41 preVisit(model);
42 for (Service service : model.getServices()) {
43 preVisit(service);
44 for (Port port : service.getPorts()) {
45 preVisit(port);
46 if (shouldVisit(port)) {
47 for (Operation operation : port.getOperations()) {
48 preVisit(operation);
49 Request request = operation.getRequest();
50 if (request != null) {
51 preVisit(request);
52 for (Iterator iter4 = request.getHeaderBlocks();
53 iter4.hasNext();) {
55 Block block = (Block) iter4.next();
56 visitHeaderBlock(block);
57 }
58 for (Iterator iter4 = request.getBodyBlocks();
59 iter4.hasNext();) {
61 Block block = (Block) iter4.next();
62 visitBodyBlock(block);
63 }
64 for (Iterator iter4 = request.getParameters();
65 iter4.hasNext();) {
67 Parameter parameter = (Parameter) iter4.next();
68 visit(parameter);
69 }
70 postVisit(request);
71 }
73 Response response = operation.getResponse();
74 if (response != null) {
75 preVisit(response);
76 for (Iterator iter4 = response.getHeaderBlocks();
77 iter4.hasNext();) {
79 Block block = (Block) iter4.next();
80 visitHeaderBlock(block);
81 }
82 for (Iterator iter4 = response.getBodyBlocks();
83 iter4.hasNext();) {
85 Block block = (Block) iter4.next();
86 visitBodyBlock(block);
87 }
88 for (Iterator iter4 = response.getParameters();
89 iter4.hasNext();) {
91 Parameter parameter = (Parameter) iter4.next();
92 visit(parameter);
93 }
94 postVisit(response);
95 }
97 for (Iterator iter4 = operation.getFaults();
98 iter4.hasNext();) {
100 Fault fault = (Fault) iter4.next();
101 preVisit(fault);
102 visitFaultBlock(fault.getBlock());
103 postVisit(fault);
104 }
105 postVisit(operation);
106 }
107 }
108 postVisit(port);
109 }
110 postVisit(service);
111 }
112 postVisit(model);
113 }
115 protected boolean shouldVisit(Port port) {
116 return true;
117 }
119 // these methods are intended for subclasses
120 protected void preVisit(Model model) throws Exception {}
121 protected void postVisit(Model model) throws Exception {}
122 protected void preVisit(Service service) throws Exception {}
123 protected void postVisit(Service service) throws Exception {}
124 protected void preVisit(Port port) throws Exception {}
125 protected void postVisit(Port port) throws Exception {}
126 protected void preVisit(Operation operation) throws Exception {}
127 protected void postVisit(Operation operation) throws Exception {}
128 protected void preVisit(Request request) throws Exception {}
129 protected void postVisit(Request request) throws Exception {}
130 protected void preVisit(Response response) throws Exception {}
131 protected void postVisit(Response response) throws Exception {}
132 protected void preVisit(Fault fault) throws Exception {}
133 protected void postVisit(Fault fault) throws Exception {}
134 protected void visitBodyBlock(Block block) throws Exception {}
135 protected void visitHeaderBlock(Block block) throws Exception {}
136 protected void visitFaultBlock(Block block) throws Exception {}
137 protected void visit(Parameter parameter) throws Exception {}
138 }