Author: bimargulies
Date: Thu Nov 22 18:52:16 2007
New Revision: 597527
URL: http://svn.apache.org/viewvc?rev=597527&view=rev
Log:
More tweaks to service model. Add comments to the visitor, add a standard
interface to return names
of named items.
Added:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/NamedItem.java
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessageInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/ServiceModelVisitor.java
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
Thu Nov 22 18:52:16 2007
@@ -28,7 +28,7 @@
import javax.xml.namespace.QName;
-public abstract class AbstractMessageContainer extends
AbstractPropertiesHolder {
+public abstract class AbstractMessageContainer extends
AbstractPropertiesHolder implements NamedItem {
protected QName mName;
private OperationInfo operation;
private Map<QName, MessagePartInfo> messageParts
@@ -47,7 +47,6 @@
public QName getName() {
return mName;
}
-
/**
* Returns the operation of this container.
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/BindingInfo.java
Thu Nov 22 18:52:16 2007
@@ -30,7 +30,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-public class BindingInfo extends AbstractDescriptionElement {
+public class BindingInfo extends AbstractDescriptionElement implements
NamedItem {
private static final Logger LOG = LogUtils.getL7dLogger(BindingInfo.class);
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/DescriptionInfo.java
Thu Nov 22 18:52:16 2007
@@ -24,7 +24,7 @@
import javax.xml.namespace.QName;
-public class DescriptionInfo extends AbstractPropertiesHolder {
+public class DescriptionInfo extends AbstractPropertiesHolder implements
NamedItem {
QName name;
String uri;
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
Thu Nov 22 18:52:16 2007
@@ -24,7 +24,7 @@
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.apache.cxf.wsdl.EndpointReferenceUtils;
-public class EndpointInfo extends AbstractDescriptionElement {
+public class EndpointInfo extends AbstractDescriptionElement implements
NamedItem {
String transportId;
ServiceInfo service;
BindingInfo binding;
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/InterfaceInfo.java
Thu Nov 22 18:52:16 2007
@@ -30,7 +30,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-public class InterfaceInfo extends AbstractDescriptionElement {
+public class InterfaceInfo extends AbstractDescriptionElement implements
NamedItem {
private static final Logger LOG =
LogUtils.getL7dLogger(InterfaceInfo.class);
QName name;
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessageInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessageInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessageInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessageInfo.java
Thu Nov 22 18:52:16 2007
@@ -29,12 +29,14 @@
import org.apache.cxf.common.util.StringUtils;
+/**
+ * A message for an operation.
+ */
public class MessageInfo extends AbstractMessageContainer {
public static enum Type {
INPUT,
- OUTPUT,
- FAULT;
+ OUTPUT;
}
private Type type;
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/MessagePartInfo.java
Thu Nov 22 18:52:16 2007
@@ -24,7 +24,7 @@
import org.apache.ws.commons.schema.XmlSchemaAnnotated;
import org.apache.ws.commons.schema.XmlSchemaElement;
-public final class MessagePartInfo extends AbstractPropertiesHolder {
+public final class MessagePartInfo extends AbstractPropertiesHolder implements
NamedItem {
private QName pname;
private AbstractMessageContainer mInfo;
Added:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/NamedItem.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/NamedItem.java?rev=597527&view=auto
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/NamedItem.java
(added)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/NamedItem.java
Thu Nov 22 18:52:16 2007
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.service.model;
+
+import javax.xml.namespace.QName;
+
+/**
+ * All elements of the service model that are named by a QName implement this
interface.
+ */
+public interface NamedItem {
+ QName getName();
+}
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
Thu Nov 22 18:52:16 2007
@@ -31,7 +31,7 @@
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
-public class OperationInfo extends AbstractPropertiesHolder {
+public class OperationInfo extends AbstractPropertiesHolder implements
NamedItem {
private static final Logger LOG =
LogUtils.getL7dLogger(OperationInfo.class);
InterfaceInfo intf;
QName opName;
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
(original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
Thu Nov 22 18:52:16 2007
@@ -30,7 +30,7 @@
import org.apache.cxf.common.xmlschema.SchemaCollection;
-public class ServiceInfo extends AbstractDescriptionElement {
+public class ServiceInfo extends AbstractDescriptionElement implements
NamedItem {
QName name;
String targetNamespace;
InterfaceInfo intf;
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/ServiceModelVisitor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/ServiceModelVisitor.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/ServiceModelVisitor.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/ServiceModelVisitor.java
Thu Nov 22 18:52:16 2007
@@ -28,7 +28,29 @@
/**
* Implements the Visitor pattern for the Service model.
- *
+ * The visit order is as follows:
+ * <pre>
+ * 1) Begin the overall service info.
+ * 2) Begin the service's interface.
+ * 3) For each operation, begin the operation.
+ * 3.1) begin the input message.
+ * 3.1.1) begin and end each part of the input message.
+ * 3.2) end the input message.
+ * 3.3) begin the output message.
+ * 3.3.1) begin and end each part of the output message.
+ * 3.4) end the output message
+ * 3.5) begin each fault. (3.5-3.6 repeated for each fault)
+ * 3.5.1) begin and end each part of each fault
+ * 3.6) end each fault.
+ * 3.7) if a wrapped operation, begin the corresponding unwrapped operation.
+ * 3.8) process the entire unwrapped operation starting at (3).
+ * 3.9) end the unwrapped operation.
+ * 4) end the operation.
+ * 5) end the interface.
+ * 6) end the service info.
+ * </pre>
+ * Unwrapped operations <i>share messages</i> with their corresponding wrapped
messages,
+ * so beware of processing the same messages twice as if unique.
*/
public class ServiceModelVisitor {
protected ServiceInfo serviceInfo;
@@ -50,6 +72,7 @@
end(o);
}
+ end(serviceInfo.getInterface());
end(serviceInfo);
}
Modified:
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++
incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Thu Nov 22 18:52:16 2007
@@ -82,6 +82,8 @@
private String opFunctionPropertyName;
private String opFunctionGlobalName;
+ private boolean isInUnwrappedOperation;
+
public ServiceJavascriptBuilder(ServiceInfo serviceInfo,
NamespacePrefixAccumulator prefixAccumulator,
NameManager nameManager) {
super(serviceInfo);
@@ -127,10 +129,6 @@
serviceSchemaInfo =
serviceInfo.getSchema(serviceInfo.getTargetNamespace());
}
- @Override
- public void begin(MessagePartInfo part) {
- }
-
private static class ElementAndNames {
private XmlSchemaElement element;
private String javascriptName;
@@ -177,6 +175,7 @@
public void end(OperationInfo op) {
// we only process the wrapped operation, not the unwrapped
alternative.
if (op.isUnwrapped()) {
+ isInUnwrappedOperation = false;
return;
}
@@ -540,6 +539,7 @@
@Override
public void begin(OperationInfo op) {
if (op.isUnwrapped()) {
+ isInUnwrappedOperation = true;
return;
}
currentOperation = op;
@@ -555,6 +555,10 @@
@Override
public void begin(MessageInfo msg) {
+ if (isInUnwrappedOperation) {
+ return;
+ }
+ LOG.fine("Message " + msg.getName().toString());
Map<String, MessageInfo> nameMap;
Set<MessageInfo> conflicts;
if (msg.getType() == MessageInfo.Type.INPUT) {
Modified:
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
(original)
+++
incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
Thu Nov 22 18:52:16 2007
@@ -82,7 +82,7 @@
testUtilities.javaToJS(Integer.valueOf(42)),
testUtilities.javaToJS(Long.valueOf(240000)),
"This is the cereal shot
from guns");
- boolean notified = notifier.waitForJavascript(10);
+ boolean notified = notifier.waitForJavascript(0 /* 1000 * 10
*/);
assertTrue(notified);
Integer errorStatus =
testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
assertNull(errorStatus);
Modified:
incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties Thu
Nov 22 18:52:16 2007
@@ -23,5 +23,6 @@
.level= WARNING
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-org.apache.cxf.javascript.level=FINE
-org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINE
+org.apache.cxf.javascript.level=INFO
+#org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINE
+org.apache.cxf.javascript.service.JavascriptTestUtilities.level=FINE
Modified:
incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js?rev=597527&r1=597526&r2=597527&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
(original)
+++
incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
Thu Nov 22 18:52:16 2007
@@ -45,6 +45,8 @@
function test1(url, doubleArg, floatArg, intArg, longArg, stringArg)
{
+ org_apache_cxf_trace.trace("Enter test1.");
+ throw "frustration";
globalNotifier = new org_apache_cxf_notifier();
var intf = new org_apache_cxf_javascript_fortest_SimpleDocLitWrapped();