001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)NMRComponent.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.messaging;
030:
031: import java.io.File;
032:
033: import javax.jbi.component.Component;
034: import javax.jbi.servicedesc.ServiceEndpoint;
035:
036: import javax.xml.namespace.QName;
037:
038: import org.w3c.dom.Document;
039:
040: /** Abstract implementation of Component interface used by test components
041: * in the NMR regression suite.
042: * @author Sun Microsystems, Inc.
043: */
044: public class NMRComponent implements Component {
045: public static final int WSDL_11 = 1;
046: public static final int WSDL_20 = 2;
047:
048: private int mType;
049: private boolean mExchangeOkay;
050:
051: public NMRComponent() {
052: this (WSDL_20, false);
053: }
054:
055: public NMRComponent(int type) {
056: this (type, false);
057: }
058:
059: public NMRComponent(int type, boolean isExchangeOkay) {
060: mType = type;
061: mExchangeOkay = isExchangeOkay;
062: }
063:
064: public javax.jbi.component.ComponentLifeCycle getLifeCycle() {
065: return null;
066: }
067:
068: /** Default behavior is to return the WSDL found at DEFAULT_DOC_PATH.
069: */
070: public Document getServiceDescription(ServiceEndpoint endpoint) {
071: Document doc = null;
072:
073: try {
074: if (mType == WSDL_20) {
075: doc = WsdlDocument
076: .readDocument(WsdlDocument.WSDL_20_DEFINITION);
077: } else if (mType == WSDL_11) {
078: doc = WsdlDocument
079: .readDocument(WsdlDocument.WSDL_11_DEFINITION);
080: }
081: } catch (Exception ex) {
082: ex.printStackTrace();
083: }
084:
085: return doc;
086: }
087:
088: public javax.jbi.component.ServiceUnitManager getServiceUnitManager() {
089: return null;
090: }
091:
092: public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint,
093: javax.jbi.messaging.MessageExchange exchange) {
094: return mExchangeOkay;
095: }
096:
097: public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint,
098: javax.jbi.messaging.MessageExchange exchange) {
099: return mExchangeOkay;
100: }
101:
102: public ServiceEndpoint resolveEndpointReference(
103: org.w3c.dom.DocumentFragment epr) {
104: return null;
105: }
106: }
|