You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/19 23:29:11 UTC

svn commit: r509357 - /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java

Author: jboynes
Date: Mon Feb 19 14:29:10 2007
New Revision: 509357

URL: http://svn.apache.org/viewvc?view=rev&rev=509357
Log:
wrap all container exceptions in a spec ServiceRuntimeException

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java?view=diff&rev=509357&r1=509356&r2=509357
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java Mon Feb 19 14:29:10 2007
@@ -22,6 +22,9 @@
 import org.osoa.sca.ComponentContext;
 import org.osoa.sca.RequestContext;
 import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
 
 /**
  * Implementation of ComponentContext that delegates to a ComponentContextProvider.
@@ -36,7 +39,11 @@
     }
 
     public String getURI() {
-        return component.getUri().toString();
+        try {
+            return component.getUri().toString();
+        } catch (TuscanyRuntimeException e) {
+            throw new ServiceRuntimeException(e.getMessage(), e);
+        }
     }
 
     public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
@@ -44,15 +51,27 @@
     }
 
     public <B> B getService(Class<B> businessInterface, String referenceName) {
-        return component.getService(businessInterface, referenceName);
+        try {
+            return component.getService(businessInterface, referenceName);
+        } catch (TuscanyRuntimeException e) {
+            throw new ServiceRuntimeException(e.getMessage(), e);
+        }
     }
 
     public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
-        return component.getServiceReference(businessInterface, referenceName);
+        try {
+            return component.getServiceReference(businessInterface, referenceName);
+        } catch (TuscanyRuntimeException e) {
+            throw new ServiceRuntimeException(e.getMessage(), e);
+        }
     }
 
     public <B> B getProperty(Class<B> type, String propertyName) {
-        return component.getProperty(type, propertyName);
+        try {
+            return component.getProperty(type, propertyName);
+        } catch (TuscanyRuntimeException e) {
+            throw new ServiceRuntimeException(e.getMessage(), e);
+        }
     }
 
     public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org