Author: jstrachan
Date: Wed Oct 22 01:38:07 2008
New Revision: 706896

URL: http://svn.apache.org/viewvc?rev=706896&view=rev
Log:
avoided bad spring dependency in refactor for CAMEL-1015

Added:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java
   (with props)
Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorSupport.java
    
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorSupport.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorSupport.java?rev=706896&r1=706895&r2=706896&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorSupport.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorSupport.java
 Wed Oct 22 01:38:07 2008
@@ -17,22 +17,12 @@
  */
 package org.apache.camel.impl;
 
-import org.apache.camel.MessageDriven;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Consume;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.Consumer;
-import org.apache.camel.Service;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Producer;
-import org.apache.camel.PollingConsumer;
+import org.apache.camel.*;
 import org.apache.camel.component.bean.BeanProcessor;
 import org.apache.camel.component.bean.ProxyHelper;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.BeanInstantiationException;
 
 import javax.xml.bind.annotation.XmlTransient;
 import java.lang.reflect.Method;
@@ -136,7 +126,7 @@
                 try {
                     return ProxyHelper.createProxy(endpoint, type);
                 } catch (Exception e) {
-                    throw new BeanInstantiationException(type, "Could not 
instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
+                    throw createProxyInstantiationRuntimeException(type, 
endpoint, e);
                 }
             } else {
                 throw new IllegalArgumentException("Invalid type: " + 
type.getName() + " which cannot be injected via @EndpointInject for " + 
endpoint);
@@ -145,6 +135,10 @@
         return null;
     }
 
+    protected RuntimeException 
createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, 
Exception e) {
+        return new ProxyInstantiationException(type, endpoint, e);
+    }
+
     /**
      * Factory method to create a started [EMAIL PROTECTED] 
org.apache.camel.PollingConsumer} to be injected
      * into a POJO

Added: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java?rev=706896&view=auto
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java
 (added)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java
 Wed Oct 22 01:38:07 2008
@@ -0,0 +1,44 @@
+/**
+ *
+ * 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.camel.impl;
+
+import org.apache.camel.Endpoint;
+
+/**
+ * A proxy creation failed trying to create a proxy of a given type and on an 
given endpoint
+ *
+ * @version $Revision: 1.1 $
+ */
+public class ProxyInstantiationException extends RuntimeException {
+    private Class<?> type;
+    private Endpoint endpoint;
+
+    public ProxyInstantiationException(Class<?> type, Endpoint endpoint, 
Throwable cause) {
+        super("Could not instantiate proxy of type " + type.getName() + " on 
endpoint " + endpoint, cause);
+        this.type = type;
+        this.endpoint = endpoint;
+    }
+
+    public Class<?> getType() {
+        return type;
+    }
+
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
+}

Propchange: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProxyInstantiationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=706896&r1=706895&r2=706896&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
 Wed Oct 22 01:38:07 2008
@@ -102,7 +102,12 @@
 
     public void setCamelContext(SpringCamelContext camelContext) {
         this.camelContext = camelContext;
-        postProcessor = new CamelPostProcessorSupport(camelContext);
+        postProcessor = new CamelPostProcessorSupport(camelContext) {
+            @Override
+            protected RuntimeException 
createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, 
Exception e) {
+                return new BeanInstantiationException(type, "Could not 
instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
+            }
+        };
     }
 
     // Implementation methods


Reply via email to