1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 package javax.resource.spi.endpoint; 25 26 import java.lang.NoSuchMethodException; 27 import javax.transaction.xa.XAResource; 28 import javax.resource.spi.UnavailableException; 29 30 /** 31 * This serves as a factory for creating message endpoints. 32 * 33 * @version 1.0 34 * @author Ram Jeyaraman 35 */ 36 public interface MessageEndpointFactory { 37 38 /** 39 * This is used to create a message endpoint. The message endpoint is 40 * expected to implement the correct message listener type. 41 * 42 * @param xaResource an optional <code>XAResource</code> 43 * instance used to get transaction notifications when the message delivery 44 * is transacted. 45 * 46 * @return a message endpoint instance. 47 * 48 * @throws UnavailableException indicates a transient failure 49 * in creating a message endpoint. Subsequent attempts to create a message 50 * endpoint might succeed. 51 */ 52 MessageEndpoint createEndpoint(XAResource xaResource) 53 throws UnavailableException; 54 55 /** 56 * This is used to find out whether message deliveries to a target method 57 * on a message listener interface that is implemented by a message 58 * endpoint will be transacted or not. 59 * 60 * The message endpoint may indicate its transacted delivery preferences 61 * (at a per method level) through its deployment descriptor. The message 62 * delivery preferences must not change during the lifetime of a 63 * message endpoint. 64 * 65 * @param method description of a target method. This information about 66 * the intended target method allows an application server to find out 67 * whether the target method call will be transacted or not. 68 * 69 * @throws NoSuchMethodException indicates that the specified method 70 * does not exist on the target endpoint. 71 * 72 * @return true, if message endpoint requires transacted message delivery. 73 */ 74 boolean isDeliveryTransacted(java.lang.reflect.Method method) 75 throws NoSuchMethodException; 76 } 77 78 79 80