Permalink
Browse files

SWITCHYARD-214

  • Loading branch information...
errantepiphany committed Apr 13, 2011
1 parent 1d9b10d commit 7ebb20fd4c2f18f9ce640eb2e9a6dae5a09f3709
@@ -102,9 +102,6 @@ public void processBean(@Observes ProcessBean processBean, BeanManager beanManag
// Create Service Proxy ExchangeHandlers and register them as Services, for all @Service beans...
if (isServiceBean(bean)) {
- Class<?> serviceType = bean.getBeanClass();
- Service serviceAnnotation = serviceType.getAnnotation(Service.class);
-
_logger.debug("Adding ServiceDescriptor for bean " + bean.getBeanClass().getName());
_beanDeploymentMetaData.addServiceDescriptor(new CDIBeanServiceDescriptor(bean, beanManager, _beanDeploymentMetaData));
}
@@ -27,6 +27,9 @@
import java.util.List;
import java.util.Set;
+import org.switchyard.common.type.classpath.ClasspathScanner;
+import org.switchyard.common.type.classpath.IsAnnotationPresentFilter;
+import org.switchyard.common.type.classpath.ResourceExistsFilter;
import org.switchyard.component.bean.Reference;
import org.switchyard.component.bean.Service;
import org.switchyard.component.bean.config.model.v1.V1BeanComponentImplementationModel;
@@ -46,9 +49,6 @@
import org.switchyard.config.model.composite.v1.V1CompositeModel;
import org.switchyard.config.model.switchyard.SwitchYardModel;
import org.switchyard.config.model.switchyard.v1.V1SwitchYardModel;
-import org.switchyard.config.util.classpath.ClasspathScanner;
-import org.switchyard.config.util.classpath.IsAnnotationPresentFilter;
-import org.switchyard.config.util.classpath.ResourceExistsFilter;
/**
* Bean Scanner.
@@ -29,13 +29,13 @@
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Before;
import org.junit.Test;
+import org.switchyard.common.io.resource.StringResource;
import org.switchyard.config.Configuration;
import org.switchyard.config.model.ModelResource;
import org.switchyard.config.model.composite.ComponentImplementationModel;
import org.switchyard.config.model.composite.ComponentModel;
import org.switchyard.config.model.composite.CompositeModel;
import org.switchyard.config.model.switchyard.SwitchYardModel;
-import org.switchyard.config.util.StringResource;
/**
* BeanModelTests.
@@ -29,6 +29,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.switchyard.common.type.Classes;
import org.switchyard.component.bean.Service;
import org.switchyard.component.bean.tests.OneWay;
import org.switchyard.component.bean.tests.ServiceWithReferenceBean;
@@ -37,7 +38,6 @@
import org.switchyard.config.model.composite.ComponentModel;
import org.switchyard.config.model.composite.ComponentReferenceModel;
import org.switchyard.config.model.switchyard.SwitchYardModel;
-import org.switchyard.config.util.Classes;
/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
View
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<project name="Switchyard">
+<project name="SwitchYard">
<skin>
<groupId>org.apache.maven.skins</groupId>
View
@@ -1,4 +1,4 @@
-# Switchyard Camel Component
+# SwitchYard Camel Component
This project deals with integrating Apache Camel with SwitchYard.
## Using Apache Camel components as gateways/entrypoint into SwitchYard
@@ -26,9 +26,9 @@
/**
* A CamelResponseHandler is responsible for passing back result data from Apache Camel data to
- * Switchyard.
+ * SwitchYard.
*
- * By given access to the CamelExchange this ExchangeHandler can extract the Switchyard payload
+ * By given access to the CamelExchange this ExchangeHandler can extract the SwitchYard payload
* and set in into the Camel Exchange.
*
* @author Daniel Bevenius
@@ -48,12 +48,12 @@ public CamelResponseHandler(final org.apache.camel.Exchange camelExchange) {
}
/**
- * Will extract the message content from the Switchyard exchange and insert
+ * Will extract the message content from the SwitchYard exchange and insert
* it into the Camel Exchange's In body.
*
- * @param switchYardExchange Switchyards Exchange from which the payload will be extracted.
+ * @param switchYardExchange SwitchYards Exchange from which the payload will be extracted.
* @throws HandlerException If there was an exception while trying to extract the payload from
- * the Switchyard Exchange.
+ * the SwitchYard Exchange.
*/
@Override
public void handleMessage(final Exchange switchYardExchange) throws HandlerException {
@@ -26,7 +26,7 @@
import org.apache.camel.impl.DefaultComponent;
/**
- * SwitchyardComponent enable Switchyard services to be exposed
+ * SwitchyardComponent enable SwitchYard services to be exposed
* through Apache Camel.
*
* Example usage using Camel's Java DSL:
@@ -26,7 +26,7 @@
/**
* A Camel Endpoint that is a simple {@link ProcessorEndpoint}.
*
- * This adds the ability to set a Switchyard {@link ServiceReference} on
+ * This adds the ability to set a SwitchYard {@link ServiceReference} on
* the underlying processor, giving it access to the target service of the
* {@link SwitchyardProcessor}.
*
@@ -31,7 +31,7 @@
/**
* Switchard processor is a Camel {@link Processor} that is capable
- * of sending the contents of a Camel Message to a Switchyard Service.
+ * of sending the contents of a Camel Message to a SwitchYard Service.
*/
public class SwitchyardProcessor implements Processor {
@@ -58,10 +58,10 @@ public void setServiceReference(final ServiceReference serviceReference) {
/**
* Will extract the payload from the {@link org.apache.camel.Exchange}, by calling
- * getIn(), and send that payload to the Switchyard service by using the {@link ServiceReference}.
+ * getIn(), and send that payload to the SwitchYard service by using the {@link ServiceReference}.
*
* @param camelExchange The Camel Exchange instance
- * @throws Exception If an error occurs while calling Switchyard.
+ * @throws Exception If an error occurs while calling SwitchYard.
*/
@Override
public void process(final org.apache.camel.Exchange camelExchange) throws Exception {
@@ -29,6 +29,7 @@
import java.util.List;
import org.junit.Test;
+import org.switchyard.common.type.Classes;
import org.switchyard.config.model.ModelResource;
import org.switchyard.config.model.Validation;
import org.switchyard.config.model.composite.BindingModel;
@@ -61,8 +62,8 @@ private V1CamelBindingModel getCamelBindingFromCompositeService(final String con
}
private SwitchYardModel getSwitchYardModel(final String config) throws IOException {
- final InputStream in = getClass().getResourceAsStream(config);
- return (SwitchYardModel) new ModelResource<SwitchYardModel>().pull(in);
+ final InputStream in = Classes.getResourceAsStream(config, getClass());
+ return new ModelResource<SwitchYardModel>().pull(in);
}
@Test
@@ -26,6 +26,7 @@
import java.io.InputStream;
import org.junit.Test;
+import org.switchyard.common.type.Classes;
import org.switchyard.config.model.ModelResource;
import org.switchyard.config.model.Validation;
import org.switchyard.config.model.composite.ComponentImplementationModel;
@@ -48,8 +49,8 @@ public void validateCamelImplementationModelWithBeanElement() throws Exception {
}
private V1CamelImplementationModel getFirstCamelBinding(final String config) throws Exception {
- final InputStream in = getClass().getResourceAsStream(config);
- final SwitchYardModel model = (SwitchYardModel) new ModelResource<SwitchYardModel>().pull(in);
+ final InputStream in = Classes.getResourceAsStream(config, getClass());
+ final SwitchYardModel model = new ModelResource<SwitchYardModel>().pull(in);
final ComponentModel componentModel = model.getComposite().getComponents().get(0);
final ComponentImplementationModel implementation = componentModel.getImplementation();
return (V1CamelImplementationModel) implementation;
@@ -29,6 +29,7 @@
import java.util.List;
import org.junit.Test;
+import org.switchyard.common.type.Classes;
import org.switchyard.config.model.ModelResource;
import org.switchyard.config.model.Validation;
import org.switchyard.config.model.composite.BindingModel;
@@ -56,8 +57,8 @@ private String expectedDirectoryName() {
}
private V1CamelFileBindingModel getFirstCamelBinding(final String config) throws Exception {
- final InputStream in = getClass().getResourceAsStream(config);
- final SwitchYardModel model = (SwitchYardModel) new ModelResource<SwitchYardModel>().pull(in);
+ final InputStream in = Classes.getResourceAsStream(config, getClass());
+ final SwitchYardModel model = new ModelResource<SwitchYardModel>().pull(in);
final List<CompositeServiceModel> services = model.getComposite().getServices();
final CompositeServiceModel compositeServiceModel = services.get(0);
final List<BindingModel> bindings = compositeServiceModel.getBindings();
View
@@ -49,7 +49,7 @@
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
- <artifactId>switchyard-common-xml</artifactId>
+ <artifactId>switchyard-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
@@ -43,6 +43,7 @@
import org.switchyard.Message;
import org.switchyard.Scope;
import org.switchyard.ServiceReference;
+import org.switchyard.common.type.Classes;
import org.switchyard.component.soap.config.model.SOAPBindingModel;
import org.switchyard.component.soap.util.SOAPUtil;
import org.switchyard.component.soap.util.WSDLUtil;
@@ -84,7 +85,7 @@ public InboundHandler(SOAPBindingModel config) {
if (composer != null && composer.length() > 0) {
try {
- Class<? extends MessageComposer> composerClass = Class.forName(composer).asSubclass(MessageComposer.class);
+ Class<? extends MessageComposer> composerClass = Classes.forName(composer, getClass()).asSubclass(MessageComposer.class);
_composer = composerClass.newInstance();
} catch (Exception cnfe) {
LOGGER.error("Could not instantiate composer", cnfe);
@@ -95,7 +96,7 @@ public InboundHandler(SOAPBindingModel config) {
}
if (decomposer != null && decomposer.length() > 0) {
try {
- Class<? extends MessageDecomposer> decomposerClass = Class.forName(decomposer).asSubclass(MessageDecomposer.class);
+ Class<? extends MessageDecomposer> decomposerClass = Classes.forName(decomposer, getClass()).asSubclass(MessageDecomposer.class);
_decomposer = decomposerClass.newInstance();
} catch (Exception cnfe) {
LOGGER.error("Could not instantiate decomposer", cnfe);
@@ -36,6 +36,7 @@
import org.switchyard.Exchange;
import org.switchyard.HandlerException;
import org.switchyard.Message;
+import org.switchyard.common.type.Classes;
import org.switchyard.component.soap.config.model.SOAPBindingModel;
import org.switchyard.component.soap.util.SOAPUtil;
import org.switchyard.component.soap.util.WSDLUtil;
@@ -65,7 +66,7 @@ public OutboundHandler(final SOAPBindingModel config) {
if (composer != null && composer.length() > 0) {
try {
- Class<? extends MessageComposer> composerClass = Class.forName(composer).asSubclass(MessageComposer.class);
+ Class<? extends MessageComposer> composerClass = Classes.forName(composer, getClass()).asSubclass(MessageComposer.class);
_composer = composerClass.newInstance();
} catch (Exception cnfe) {
LOGGER.error("Could not instantiate composer", cnfe);
@@ -76,7 +77,7 @@ public OutboundHandler(final SOAPBindingModel config) {
}
if (decomposer != null && decomposer.length() > 0) {
try {
- Class<? extends MessageDecomposer> decomposerClass = Class.forName(decomposer).asSubclass(MessageDecomposer.class);
+ Class<? extends MessageDecomposer> decomposerClass = Classes.forName(decomposer, getClass()).asSubclass(MessageDecomposer.class);
_decomposer = decomposerClass.newInstance();
} catch (Exception cnfe) {
LOGGER.error("Could not instantiate decomposer", cnfe);
@@ -46,6 +46,7 @@
import org.apache.log4j.Logger;
import org.switchyard.ExchangePattern;
+import org.switchyard.common.type.Classes;
import org.switchyard.common.xml.XMLHelper;
import org.switchyard.component.soap.PortName;
import org.switchyard.component.soap.WebServicePublishException;
@@ -141,7 +142,12 @@ public static URL getURL(final String path) throws MalformedURLException {
if (path.startsWith("http://") || path.startsWith("https://") || path.startsWith("file://")) {
return new URL(null, path);
} else {
- URL url = Thread.currentThread().getContextClassLoader().getResource(path);
+ URL url;
+ try {
+ url = Classes.getResource(path, WSDLUtil.class);
+ } catch (IOException ioe) {
+ url = null;
+ }
if (url == null) {
File localFile = new File(path);
url = localFile.toURI().toURL();

0 comments on commit 7ebb20f

Please sign in to comment.