001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.servicemix.common;
018
019 import org.apache.commons.logging.Log;
020 import org.apache.servicemix.common.xbean.XBeanServiceUnit;
021
022 import org.w3c.dom.Document;
023
024 import javax.jbi.management.DeploymentException;
025 import javax.jbi.messaging.MessageExchange;
026 import javax.jbi.messaging.MessagingException;
027 import javax.jbi.messaging.MessageExchange.Role;
028 import javax.wsdl.Definition;
029 import javax.xml.namespace.QName;
030
031 public interface Endpoint {
032
033 String getKey();
034
035 QName getInterfaceName();
036
037 QName getService();
038
039 String getEndpoint();
040
041 Document getDescription();
042
043 Role getRole();
044
045 ServiceUnit getServiceUnit();
046
047 void setServiceUnit(ServiceUnit serviceUnit);
048
049 boolean isExchangeOkay(MessageExchange exchange);
050
051 /**
052 * Register this endpoint into the NMR and put the endpoint
053 * in a STOPPED state, where the endpoint is able to process
054 * incoming requests, but won't consume external requests such
055 * as JMS messages or HTTP requests.
056 *
057 * @throws Exception
058 */
059 void activate() throws Exception;
060
061 /**
062 * Start consumption of external requests.
063 *
064 * @throws Exception
065 */
066 void start() throws Exception;
067
068 /**
069 * Stop consumption of external requests.
070 *
071 * @throws Exception
072 */
073 void stop() throws Exception;
074
075 /**
076 * Unregister this endpoint from the NMR.
077 *
078 * @throws Exception
079 */
080 void deactivate() throws Exception;
081
082 /**
083 * Process an incoming JBI exchange.
084 *
085 * @param exchange
086 * @throws Exception
087 */
088 void process(MessageExchange exchange) throws Exception;
089
090 /**
091 * Validation is a step which is done at deployment time to check
092 * that the endpoint definition is valid and that there is no
093 * missing properties.
094 *
095 * @throws DeploymentException
096 */
097 void validate() throws DeploymentException;
098
099 }