You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/10/13 20:04:16 UTC
svn commit: r463759 - in
/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common:
EndpointComponentContext.java EndpointDeliveryChannel.java
Author: gnodet
Date: Fri Oct 13 11:04:15 2006
New Revision: 463759
URL: http://svn.apache.org/viewvc?view=rev&rev=463759
Log:
Move EndpointComponentContext.java and EndpointDeliveryChannel.java to servicemix-common
Added:
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointComponentContext.java
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
Added: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointComponentContext.java?view=auto&rev=463759
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointComponentContext.java (added)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointComponentContext.java Fri Oct 13 11:04:15 2006
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common;
+
+import java.util.MissingResourceException;
+import java.util.logging.Logger;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.management.MBeanNames;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.management.MBeanServer;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+public class EndpointComponentContext implements ComponentContext {
+
+ private ComponentContext context;
+ private DeliveryChannel channel;
+
+ public EndpointComponentContext(ComponentContext context) {
+ this.context = context;
+ }
+
+ public ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void deactivateEndpoint(ServiceEndpoint endpoint) throws JBIException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void deregisterExternalEndpoint(ServiceEndpoint externalEndpoint) throws JBIException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getComponentName() {
+ return context.getComponentName();
+ }
+
+ public DeliveryChannel getDeliveryChannel() throws MessagingException {
+ if (this.channel == null) {
+ this.channel = new EndpointDeliveryChannel(context.getDeliveryChannel());
+ }
+ return this.channel;
+ }
+
+ public ServiceEndpoint getEndpoint(QName service, String name) {
+ return context.getEndpoint(service, name);
+ }
+
+ public Document getEndpointDescriptor(ServiceEndpoint endpoint) throws JBIException {
+ return context.getEndpointDescriptor(endpoint);
+ }
+
+ public ServiceEndpoint[] getEndpoints(QName interfaceName) {
+ return context.getEndpoints(interfaceName);
+ }
+
+ public ServiceEndpoint[] getEndpointsForService(QName serviceName) {
+ return context.getEndpointsForService(serviceName);
+ }
+
+ public ServiceEndpoint[] getExternalEndpoints(QName interfaceName) {
+ return context.getExternalEndpoints(interfaceName);
+ }
+
+ public ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) {
+ return context.getExternalEndpointsForService(serviceName);
+ }
+
+ public String getInstallRoot() {
+ return context.getInstallRoot();
+ }
+
+ public Logger getLogger(String suffix, String resourceBundleName) throws MissingResourceException, JBIException {
+ return context.getLogger(suffix, resourceBundleName);
+ }
+
+ public MBeanNames getMBeanNames() {
+ return context.getMBeanNames();
+ }
+
+ public MBeanServer getMBeanServer() {
+ return context.getMBeanServer();
+ }
+
+ public InitialContext getNamingContext() {
+ return context.getNamingContext();
+ }
+
+ public Object getTransactionManager() {
+ return context.getTransactionManager();
+ }
+
+ public String getWorkspaceRoot() {
+ return context.getWorkspaceRoot();
+ }
+
+ public void registerExternalEndpoint(ServiceEndpoint externalEndpoint) throws JBIException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
+ return context.resolveEndpointReference(epr);
+ }
+
+}
Added: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java?view=auto&rev=463759
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java (added)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java Fri Oct 13 11:04:15 2006
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+/**
+ * This class is a wrapper around an existing DeliveryChannel
+ * that will be given to service engine endpoints so that
+ * they are able to send messages and to interact with the
+ * JBI container.
+ *
+ * @author gnodet
+ */
+public class EndpointDeliveryChannel implements DeliveryChannel {
+
+ private final DeliveryChannel channel;
+
+ public EndpointDeliveryChannel(DeliveryChannel channel) {
+ this.channel = channel;
+ }
+
+ public MessageExchange accept() throws MessagingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public MessageExchange accept(long timeout) throws MessagingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void close() throws MessagingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public MessageExchangeFactory createExchangeFactory() {
+ return channel.createExchangeFactory();
+ }
+
+ public MessageExchangeFactory createExchangeFactory(QName interfaceName) {
+ return channel.createExchangeFactory(interfaceName);
+ }
+
+ public MessageExchangeFactory createExchangeFactory(ServiceEndpoint endpoint) {
+ return channel.createExchangeFactory(endpoint);
+ }
+
+ public MessageExchangeFactory createExchangeFactoryForService(QName serviceName) {
+ return channel.createExchangeFactoryForService(serviceName);
+ }
+
+ public void send(MessageExchange exchange) throws MessagingException {
+ if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
+ throw new UnsupportedOperationException("Asynchronous send of active exchanges are not supported");
+ }
+ channel.send(exchange);
+ }
+
+ public boolean sendSync(MessageExchange exchange, long timeout) throws MessagingException {
+ return channel.sendSync(exchange, timeout);
+ }
+
+ public boolean sendSync(MessageExchange exchange) throws MessagingException {
+ return channel.sendSync(exchange);
+ }
+}