01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.server.axis.assembler;
18:
19: public enum BindingStyle {
20: RPC_LITERAL(false, true, false), RPC_ENCODED(false, false, false), DOCUMENT_LITERAL(
21: true, true, false), DOCUMENT_ENCODED(true, false, false), DOCUMENT_LITERAL_WRAPPED(
22: true, true, true);
23:
24: private final boolean document;
25: private final boolean literal;
26: private final boolean wrapped;
27:
28: BindingStyle(boolean document, boolean literal, boolean wrapped) {
29: this .document = document;
30: this .literal = literal;
31: this .wrapped = wrapped;
32: }
33:
34: public boolean isRpc() {
35: return !document;
36: }
37:
38: public boolean isDocument() {
39: return document;
40: }
41:
42: public boolean isEncoded() {
43: return !literal;
44: }
45:
46: public boolean isLiteral() {
47: return literal;
48: }
49:
50: public boolean isWrapped() {
51: return wrapped;
52: }
53:
54: public static BindingStyle getBindingStyle(String style, String use) {
55: if ("rpc".equalsIgnoreCase(style)) {
56: if (use == null || "encoded".equalsIgnoreCase(use)) {
57: return RPC_ENCODED;
58: } else if ("literal".equalsIgnoreCase(use)) {
59: return RPC_LITERAL;
60: } else {
61: throw new IllegalArgumentException(
62: "Use must be literal or encoded: " + use);
63: }
64: } else if ("document".equalsIgnoreCase(style)) {
65: if (use == null || "encoded".equalsIgnoreCase(use)) {
66: return DOCUMENT_ENCODED;
67: } else if ("literal".equalsIgnoreCase(use)) {
68: return DOCUMENT_LITERAL;
69: } else {
70: throw new IllegalArgumentException(
71: "Use must be literal or encoded: " + use);
72: }
73: } else {
74: throw new IllegalArgumentException(
75: "Style must rpc or document: " + style);
76: }
77: }
78: }
|