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.resource.ResourceException; 28 import javax.resource.spi.ResourceAdapterInternalException; 29 import javax.resource.spi.ApplicationServerInternalException; 30 import javax.resource.spi.IllegalStateException; 31 import javax.resource.spi.UnavailableException; 32 33 /** 34 * This defines a contract for a message endpoint. This is implemented by an 35 * application server. 36 * 37 * @version 1.0 38 * @author Ram Jeyaraman 39 */ 40 public interface MessageEndpoint { 41 42 /** 43 * This is called by a resource adapter before a message is delivered. 44 * 45 * @param method description of a target method. This information about 46 * the intended target method allows an application server to decide 47 * whether to start a transaction during this method call, depending 48 * on the transaction preferences of the target method. 49 * The processing (by the application server) of the actual message 50 * delivery method call on the endpoint must be independent of the 51 * class loader associated with this descriptive method object. 52 * 53 * @throws NoSuchMethodException indicates that the specified method 54 * does not exist on the target endpoint. 55 * 56 * @throws ResourceException generic exception. 57 * 58 * @throws ApplicationServerInternalException indicates an error 59 * condition in the application server. 60 * 61 * @throws IllegalStateException indicates that the endpoint is in an 62 * illegal state for the method invocation. For example, this occurs when 63 * <code>beforeDelivery</code> and <code>afterDelivery</code> 64 * method calls are not paired. 65 * 66 * @throws UnavailableException indicates that the endpoint is not 67 * available. 68 */ 69 void beforeDelivery(java.lang.reflect.Method method) 70 throws NoSuchMethodException, ResourceException; 71 72 /** 73 * This is called by a resource adapter after a message is delivered. 74 * 75 * @throws ResourceException generic exception. 76 * 77 * @throws ApplicationServerInternalException indicates an error 78 * condition in the application server. 79 * 80 * @throws IllegalStateException indicates that the endpoint is in an 81 * illegal state for the method invocation. For example, this occurs when 82 * beforeDelivery and afterDelivery method calls are not paired. 83 * 84 * @throws UnavailableException indicates that the endpoint is not 85 * available. 86 */ 87 void afterDelivery() throws ResourceException; 88 89 /** 90 * This method may be called by the resource adapter to indicate that it 91 * no longer needs a proxy endpoint instance. This hint may be used by 92 * the application server for endpoint pooling decisions. 93 */ 94 void release(); 95 } 96