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: * @(#)FileBindingComponent.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.file;
030:
031: import org.w3c.dom.DocumentFragment;
032:
033: import javax.jbi.component.Component;
034: import javax.jbi.servicedesc.ServiceEndpoint;
035:
036: /**
037: * This class implements the Component contract with JBI.
038: *
039: * @author Sun Microsystems, Inc.
040: */
041: public class FileBindingComponent implements
042: javax.jbi.component.Component {
043: /**
044: * Lifecycle object.
045: */
046: private FileBindingLifeCycle mLifeCycle;
047:
048: /**
049: * Resolver object.
050: */
051: private FileBindingResolver mResolver;
052:
053: /**
054: * Service unit manager.
055: */
056: private FileBindingSUManager mSUManager;
057:
058: /**
059: * Creates a new instance of FileBindingComponent
060: */
061: public FileBindingComponent() {
062: mLifeCycle = new FileBindingLifeCycle();
063: mSUManager = new FileBindingSUManager();
064: mResolver = new FileBindingResolver();
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
075: * @param exchange
076: *
077: * @return true if its OK.
078: */
079: public boolean isExchangeWithConsumerOkay(
080: javax.jbi.servicedesc.ServiceEndpoint endpoint,
081: javax.jbi.messaging.MessageExchange exchange) {
082: /* Should not always return true
083: * The capabilities of this component has to be checked first.
084: * Not implemented right now
085: */
086: return true;
087: }
088:
089: /**
090: * This method is called by JBI to check if this component, in the role of
091: * consumer of the service indicated by the given exchange, can actually
092: * interact with the the provider completely.
093: *
094: * @param endpoint
095: * @param exchange
096: *
097: * @return true if OK.
098: */
099: public boolean isExchangeWithProviderOkay(
100: javax.jbi.servicedesc.ServiceEndpoint endpoint,
101: javax.jbi.messaging.MessageExchange exchange) {
102: /* Should not always return true
103: * The capabilities of this component has to be checked first.
104: * Not implemented right now
105: */
106: return true;
107: }
108:
109: /**
110: * Returns the lifecycle object for this component.
111: *
112: * @return component life cycle object for file binding.
113: */
114: public javax.jbi.component.ComponentLifeCycle getLifeCycle() {
115: return mLifeCycle;
116: }
117:
118: /**
119: * Returns a resolver for meta-data.
120: *
121: * @param ServiceEndpoint endpoint reference object.
122: *
123: * @return Descriptor for file binding.
124: */
125: public org.w3c.dom.Document getServiceDescription(
126: javax.jbi.servicedesc.ServiceEndpoint ServiceEndpoint) {
127: org.w3c.dom.Document desc = null;
128:
129: try {
130: desc = mResolver.getServiceDescription(ServiceEndpoint);
131: } catch (Exception e) {
132: e.printStackTrace();
133: }
134:
135: return desc;
136: }
137:
138: /**
139: * Returns the SU manager which is in charge of handling deployment. Acc to the
140: * spec the object should be the same everytime this method is called.
141: *
142: * @return SU manager.
143: */
144: public javax.jbi.component.ServiceUnitManager getServiceUnitManager() {
145: return mSUManager;
146: }
147:
148: /**
149: * Resolve the endpoint reference using the given capabilities of the
150: * consumer. This is called by JBI when its trying to resove the given EPR
151: * on behalf of the component.
152: *
153: * @param epr endpoint reference.
154: *
155: * @return Service enpoint.
156: */
157: public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
158: return null;
159: }
160: }
|