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: * @(#)JMSBindingComponent.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.binding.jms;
030:
031: import com.sun.jbi.binding.jms.deploy.JMSBindingSUManager;
032:
033: import javax.jbi.component.Component;
034: import javax.jbi.servicedesc.ServiceEndpoint;
035:
036: import org.w3c.dom.DocumentFragment;
037:
038: /**
039: * This class implements the JBI component contract.
040: *
041: * @author Sun Microsystems Inc.
042: */
043: public class JMSBindingComponent implements Component {
044: /**
045: * Lifecycle implementation for JMS binding.
046: */
047: private JMSBindingLifeCycle mLifeCycle;
048:
049: /**
050: * Resolver implementation.
051: */
052: private JMSBindingResolver mResolver;
053: /**
054: * SU Manager implementation.
055: */
056: private JMSBindingSUManager mSUManager;
057:
058: /**
059: * Creates a new instance of JMSBindingComponent.
060: */
061: public JMSBindingComponent() {
062: mLifeCycle = new JMSBindingLifeCycle();
063: mSUManager = new JMSBindingSUManager();
064: mResolver = new JMSBindingResolver();
065: mLifeCycle.setSUManager(mSUManager);
066: mLifeCycle.setResolver(mResolver);
067: }
068:
069: /**
070: * This method is called by JBI to check if this component, in the role of
071: * provider of the service indicated by the given exchange, can actually
072: * perform the operation desired.
073: *
074: * @param endpoint endpoint reference.
075: * @param exchange message exchange.
076: * @return true if this provider component can perform the the given
077: * exchange with the described consumer
078: */
079: public boolean isExchangeWithConsumerOkay(
080: javax.jbi.servicedesc.ServiceEndpoint endpoint,
081: javax.jbi.messaging.MessageExchange exchange) {
082: return true;
083: }
084:
085: /**
086: * This method is called by JBI to check if this component, in the role of
087: * consumer of the service indicated by the given exchange, can actually
088: * interact with the the provider completely.
089: *
090: * @param endpoint endpoint reference.
091: * @param exchange message exchange.
092: * @return true if this consurer component can interact with the described
093: * provider to perform the given exchange.
094: */
095: public boolean isExchangeWithProviderOkay(
096: javax.jbi.servicedesc.ServiceEndpoint endpoint,
097: javax.jbi.messaging.MessageExchange exchange) {
098: return true;
099: }
100:
101: /**
102: * Component lifecyle implemenation is returned.
103: *
104: * @return lifecycle implementation.
105: */
106: public javax.jbi.component.ComponentLifeCycle getLifeCycle() {
107: return mLifeCycle;
108: }
109:
110: /**
111: * Returns the description for an enpoint.
112: *
113: * @param serviceendpoint endpoint reference.
114: *
115: * @return DOM based description.
116: */
117: public org.w3c.dom.Document getServiceDescription(
118: javax.jbi.servicedesc.ServiceEndpoint serviceendpoint) {
119: org.w3c.dom.Document desc = null;
120:
121: try {
122: desc = mResolver.getServiceDescription(serviceendpoint);
123: } catch (Exception e) {
124: e.printStackTrace();
125: }
126:
127: return desc;
128: }
129:
130: /**
131: * Returns the service unit manager.
132: *
133: * @return service unit manager implementation.
134: */
135: public javax.jbi.component.ServiceUnitManager getServiceUnitManager() {
136: return mSUManager;
137: }
138:
139: /** Resolve the endpoint reference using the given capabilities of the
140: * consumer. This is called by JBI when its trying to resove the given EPR
141: * on behalf of the component.
142: *
143: * @param epr endpoint description.
144: *
145: * @return ServiceEndpoint corresponding to the description.
146: */
147: public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
148: return null;
149: }
150: }
|