You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/12/17 20:17:15 UTC
svn commit: r488028 [3/4] - in /incubator/tuscany/java/sca:
commands/launcher/src/main/java/org/apache/tuscany/launcher/
kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/
kernel/core/src/main/java/org/apache/tuscany/core/builder/ kernel/core...
Copied: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java (from r487433, incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ObjectRegistrationException.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java?view=diff&rev=488028&p1=incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ObjectRegistrationException.java&r1=487433&p2=incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ObjectRegistrationException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java Sun Dec 17 11:17:11 2006
@@ -19,23 +19,27 @@
package org.apache.tuscany.spi.component;
/**
- * Thrown when an error is encountered registering an object
+ * Thrown when an error is encountered registering a component
*
* @version $$Rev$$ $$Date$$
*/
-public class ObjectRegistrationException extends ComponentRuntimeException {
- public ObjectRegistrationException() {
+public abstract class ComponentRegistrationException extends ComponentException {
+ public ComponentRegistrationException() {
}
- public ObjectRegistrationException(String message) {
+ public ComponentRegistrationException(String message) {
super(message);
}
- public ObjectRegistrationException(String message, Throwable cause) {
+ public ComponentRegistrationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ComponentRegistrationException(String message, Throwable cause) {
super(message, cause);
}
- public ObjectRegistrationException(Throwable cause) {
+ public ComponentRegistrationException(Throwable cause) {
super(cause);
}
}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java Sun Dec 17 11:17:11 2006
@@ -21,7 +21,7 @@
import org.apache.tuscany.spi.CoreRuntimeException;
/**
- * An unchecked exception encountered by an {@link SCAObject}
+ * An unchecked exception encountered by an {@link org.apache.tuscany.spi.component.Component}
*
* @version $Rev$ $Date$
*/
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java Sun Dec 17 11:17:11 2006
@@ -34,12 +34,27 @@
public interface CompositeComponent extends Component, RuntimeEventListener {
/**
+ * Sets the scope container associated with the composite
+ *
+ * @param scopeContainer the scope container associated with the composite
+ */
+ void setScopeContainer(ScopeContainer scopeContainer);
+
+ /**
+ * Returns the value of a Property of this composite.
+ *
+ * @param name the name of the Property
+ * @return its value, or null if there is not such property or if it has no defined value
+ */
+ Document getPropertyValue(String name);
+
+ /**
* Registers a child of this composite.
*
* @param context the context to add as a child
- * @throws InvalidComponentTypeException
+ * @throws ComponentRegistrationException
*/
- void register(SCAObject context) throws InvalidComponentTypeException;
+ void register(SCAObject context) throws ComponentRegistrationException;
/**
* Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to
@@ -48,10 +63,10 @@
* @param name the name of the resulting component
* @param service the service interface the component should expose
* @param instance the Object that will become the component's implementation
- * @throws ObjectRegistrationException
+ * @throws ComponentRegistrationException
*/
<S, I extends S> void registerJavaObject(String name, Class<S> service, I instance)
- throws ObjectRegistrationException;
+ throws ComponentRegistrationException;
/**
* Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to
@@ -60,10 +75,10 @@
* @param name the name of the resulting component
* @param services the service interfaces the component should expose
* @param instance the Object that will become the component's implementation
- * @throws ObjectRegistrationException
+ * @throws ComponentRegistrationException
*/
<S, I extends S> void registerJavaObject(String name, List<Class<?>> services, I instance)
- throws ObjectRegistrationException;
+ throws ComponentRegistrationException;
/**
* Returns the child associated with a given name
@@ -97,17 +112,13 @@
/**
* Returns the service associated with the given name
- *
- * @throws TargetNotFoundException
*/
- Service getService(String name) throws TargetNotFoundException;
+ Service getService(String name);
/**
* Returns the system service associated with the given name
- *
- * @throws TargetNotFoundException
*/
- Service getSystemService(String name) throws TargetNotFoundException;
+ Service getSystemService(String name);
/**
* Returns a system service associated with the given name
@@ -117,47 +128,38 @@
Object getSystemServiceInstance(String name) throws TargetException;
/**
- * Returns the references contained by the composite
- */
- List<Reference> getReferences();
-
- /**
- * Returns the system references contained by the composite
- */
- List<Reference> getSystemReferences();
-
- /**
* Returns the service instance for associated with the child registered for the given name
+ *
+ * @throws TargetException
*/
- <T> T locateService(Class<T> serviceInterface, String serviceName);
+ <T> T locateService(Class<T> serviceInterface, String serviceName) throws TargetException;
/**
* Returns the system service instance for associated with the child registered for the given name
+ *
+ * @throws TargetException
*/
- <T> T locateSystemService(Class<T> serviceInterface, String serviceName);
+ <T> T locateSystemService(Class<T> serviceInterface, String serviceName) throws TargetException;
/**
- * @param scopeContainer the scope container associated with the composite
+ * Returns the references contained by the composite
*/
- void setScopeContainer(ScopeContainer scopeContainer);
+ List<Reference> getReferences();
/**
- * Returns the value of a Property of this composite.
- *
- * @param name the name of the Property
- * @return its value, or null if there is not such property or if it has no defined value
+ * Returns the system references contained by the composite
*/
- Document getPropertyValue(String name);
-
+ List<Reference> getSystemReferences();
+
/**
* Invoked by child components to return an an autowire target. Resolved targets may be services or components in
* the parent or its ancestors, or references in a sibling component
*
* @param instanceInterface the type of service being requested
* @return a reference to the requested service or null if none can be found
- * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire
+ * @throws TargetException
*/
- <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException;
+ <T> T resolveInstance(Class<T> instanceInterface) throws TargetException;
/**
* Invoked by system child components to return an an autowire target. Resolved targets may be system services or
@@ -165,9 +167,9 @@
*
* @param instanceInterface the type of service being requested
* @return a reference to the requested service or null if none can be found
- * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire
+ * @throws TargetException
*/
- <T> T resolveSystemInstance(Class<T> instanceInterface) throws AutowireResolutionException;
+ <T> T resolveSystemInstance(Class<T> instanceInterface) throws TargetException;
/**
* Invoked by a parent component to return an autowire target in a child. Resolved targets must be services. For
@@ -177,9 +179,9 @@
*
* @param instanceInterface the type of service being requested
* @return a reference to the requested service or null if none can be found
- * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire
+ * @throws TargetException
*/
- <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException;
+ <T> T resolveExternalInstance(Class<T> instanceInterface) throws TargetException;
/**
* Invoked by a parent component to return a system autowire target in a child. Resolved targets must be system
@@ -189,8 +191,8 @@
*
* @param instanceInterface the type of service being requested
* @return a reference to the requested service or null if none can be found
- * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire
+ * @throws TargetException
*/
- <T> T resolveSystemExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException;
+ <T> T resolveSystemExternalInstance(Class<T> instanceInterface) throws TargetException;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java Sun Dec 17 11:17:11 2006
@@ -23,7 +23,7 @@
*
* @version $Rev$ $Date$
*/
-public class DuplicateNameException extends ComponentRuntimeException {
+public class DuplicateNameException extends ComponentRegistrationException {
public DuplicateNameException(String message) {
super(message);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java Sun Dec 17 11:17:11 2006
@@ -23,17 +23,9 @@
*
* @version $Rev$ $Date$
*/
-public class InvalidConversationSequenceException extends TargetException {
+public class InvalidConversationSequenceException extends TargetInvocationException {
- public InvalidConversationSequenceException(String message) {
- super(message);
- }
-
- public InvalidConversationSequenceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidConversationSequenceException(Throwable cause) {
- super(cause);
+ public InvalidConversationSequenceException(String message, String identifier) {
+ super(message, identifier);
}
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java Sun Dec 17 11:17:11 2006
@@ -18,14 +18,12 @@
*/
package org.apache.tuscany.spi.component;
-import org.apache.tuscany.api.TuscanyRuntimeException;
-
/**
* Raised when an error is encountered reactivating a serialized instance
*
* @version $Rev$ $Date$
*/
-public class ReactivationException extends TuscanyRuntimeException {
+public class ReactivationException extends ComponentRuntimeException {
private String owner;
public ReactivationException(String message) {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java Sun Dec 17 11:17:11 2006
@@ -42,7 +42,7 @@
*
* @throws TargetException
*/
- WireInvocationHandler getHandler() throws TargetException;
+ WireInvocationHandler getHandler();
/**
* Returns the inbound wire for flowing a request through the reference
@@ -70,25 +70,33 @@
*
* @param contract the service contract to invoke on
* @param operation the operation to invoke
+ * @throws TargetInvokerCreationException
*/
- TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation);
+ TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException;
/**
* Creates a target invoker for callbacks
+ *
+ * @param contract the service contract to invoke on
+ * @param operation the operation to invoke
+ * @throws TargetInvokerCreationException
*/
- TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation);
+ TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException;
/**
* Get the ServiceContract for the binding
+ *
* @return
*/
ServiceContract<?> getBindingServiceContract();
-
-
+
+
/**
- * Set the ServiceContract for the binding. This contract will be used for the outbound wire.
- * If not set, it will be the same as the ServideContract from the interface.
- *
+ * Set the ServiceContract for the binding. This contract will be used for the outbound wire. If not set, it will be
+ * the same as the ServideContract from the interface.
+ *
* @param serviceContract
*/
void setBindingServiceContract(ServiceContract<?> serviceContract);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java Sun Dec 17 11:17:11 2006
@@ -52,17 +52,11 @@
Scope getScope();
/**
- * Returns an instance associated with the default service
+ * Returns true if the artifact is a system artifact
*
- * @throws TargetException if an error occurs retrieving the instance
- */
- Object getServiceInstance() throws TargetException;
-
- /**
- * Called to signal that the composite should perform and required steps prior to registration with its parent such
- * as wiring of its children
+ * @return true if the artifact is a system artifact
*/
- void prepare() throws PrepareException;
+ boolean isSystem();
/**
* The extensions map contains other runtime context such as type systems for various databindings
@@ -72,10 +66,16 @@
Map<Object, Object> getExtensions();
/**
- * Returns true if the artifact is a system artifact
+ * Returns an instance associated with the default service
*
- * @return true if the artifact is a system artifact
+ * @throws TargetException if an error occurs retrieving the instance
*/
- boolean isSystem();
+ Object getServiceInstance() throws TargetException;
+
+ /**
+ * Called to signal that the composite should perform any required steps prior to registration with its parent such
+ * as wiring of its children
+ */
+ void prepare() throws PrepareException;
}
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java?view=auto&rev=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java Sun Dec 17 11:17:11 2006
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.spi.component;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an error starting an SCAObject
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectStartException extends CoreRuntimeException {
+
+ public SCAObjectStartException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java?view=auto&rev=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java Sun Dec 17 11:17:11 2006
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.spi.component;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an error stopping an SCAObject
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectStopException extends CoreRuntimeException {
+
+ public SCAObjectStopException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java Sun Dec 17 11:17:11 2006
@@ -33,11 +33,25 @@
public interface Service extends SCAObject {
/**
- * Returns the handler responsible for flowing a request through the service
+ * Get the ServiceContract for the binding
*
- * @throws TargetException
+ * @return the ServiceContract for the binding
+ */
+ ServiceContract<?> getBindingServiceContract();
+
+
+ /**
+ * Set the ServiceContract for the binding. This contract will be used for the inbound wire. If not set, it will be
+ * the same as the ServideContract from the interface.
+ *
+ * @param serviceContract the binding contract
+ */
+ void setBindingServiceContract(ServiceContract<?> serviceContract);
+
+ /**
+ * Returns the handler responsible for flowing a request through the service
*/
- WireInvocationHandler getHandler() throws TargetException;
+ WireInvocationHandler getHandler();
/**
* Returns the service interface configured for the service
@@ -77,21 +91,9 @@
*
* @param contract the callback contract
* @param operation the callback operation the target invoker dispatches to
+ * @throws TargetInvokerCreationException
*/
- TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation);
-
- /**
- * Get the ServiceContract for the binding
- * @return
- */
- ServiceContract<?> getBindingServiceContract();
-
-
- /**
- * Set the ServiceContract for the binding. This contract will be used for the inbound wire.
- * If not set, it will be the same as the ServideContract from the interface.
+ TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException;
- * @param serviceContract
- */
- void setBindingServiceContract(ServiceContract<?> serviceContract);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java Sun Dec 17 11:17:11 2006
@@ -18,14 +18,12 @@
*/
package org.apache.tuscany.spi.component;
-import org.apache.tuscany.spi.CoreRuntimeException;
-
/**
- * Denotes an error while performing an operation on a target component implementation instance or proxy
+ * Denotes an error while performing an operation on a target component implementation instance
*
* @version $Rev$ $Date$
*/
-public class TargetException extends CoreRuntimeException {
+public abstract class TargetException extends ComponentException {
public TargetException(String message) {
super(message);
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java?view=auto&rev=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java Sun Dec 17 11:17:11 2006
@@ -0,0 +1,43 @@
+/*
+ * 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.tuscany.spi.component;
+
+/**
+ * Raised when an error is encountered during a target invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInvocationException extends TargetException {
+
+ public TargetInvocationException(String message) {
+ super(message);
+ }
+
+ public TargetInvocationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvocationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java?view=auto&rev=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java Sun Dec 17 11:17:11 2006
@@ -0,0 +1,50 @@
+/*
+ * 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.tuscany.spi.component;
+
+/**
+ * Denotes an error creating a {@link org.apache.tuscany.spi.wire.TargetInvoker}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TargetInvokerCreationException extends ComponentException {
+
+ public TargetInvokerCreationException() {
+ }
+
+ public TargetInvokerCreationException(String message) {
+ super(message);
+ }
+
+ public TargetInvokerCreationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetInvokerCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvokerCreationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public TargetInvokerCreationException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java (from r487877, incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java?view=diff&rev=488028&p1=incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java&r1=487877&p2=incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java&r2=488028
==============================================================================
(empty)
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java Sun Dec 17 11:17:11 2006
@@ -32,12 +32,11 @@
import org.apache.tuscany.spi.builder.WiringException;
import org.apache.tuscany.spi.component.AbstractSCAObject;
import org.apache.tuscany.spi.component.AtomicComponent;
-import org.apache.tuscany.spi.component.AutowireResolutionException;
import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.DuplicateNameException;
import org.apache.tuscany.spi.component.IllegalTargetException;
-import org.apache.tuscany.spi.component.ObjectRegistrationException;
import org.apache.tuscany.spi.component.PrepareException;
import org.apache.tuscany.spi.component.Reference;
import org.apache.tuscany.spi.component.SCAObject;
@@ -55,7 +54,6 @@
* @version $$Rev$$ $$Date$$
*/
public abstract class CompositeComponentExtension extends AbstractSCAObject implements CompositeComponent {
-
protected final Map<String, SCAObject> children = new ConcurrentHashMap<String, SCAObject>();
protected final List<Service> services = new ArrayList<Service>();
protected final List<Reference> references = new ArrayList<Reference>();
@@ -91,12 +89,12 @@
}
public <S, I extends S> void registerJavaObject(String name, Class<S> service, I instance)
- throws ObjectRegistrationException {
+ throws ComponentRegistrationException {
throw new UnsupportedOperationException();
}
public <S, I extends S> void registerJavaObject(String name, List<Class<?>> services, I instance)
- throws ObjectRegistrationException {
+ throws ComponentRegistrationException {
throw new UnsupportedOperationException();
}
@@ -138,7 +136,7 @@
return Collections.unmodifiableList(references);
}
- public void register(SCAObject child) {
+ public void register(SCAObject child) throws ComponentRegistrationException {
if (child.isSystem()) {
if (systemChildren.get(child.getName()) != null) {
throw new DuplicateNameException("A system child is already registered with the name", child.getName());
@@ -203,7 +201,7 @@
public InboundWire getInboundWire(String serviceName) {
SCAObject object = children.get(serviceName);
if (!(object instanceof Service)) {
- throw new TargetNotFoundException(serviceName);
+ return null;
}
return ((Service) object).getInboundWire();
}
@@ -220,33 +218,29 @@
public Service getService(String name) {
SCAObject ctx = children.get(name);
- if (ctx == null) {
- throw new TargetNotFoundException("Service not found", name);
- } else if (!(ctx instanceof Service)) {
- throw new TargetNotFoundException("Target not a service", name);
+ if (ctx instanceof Service) {
+ return (Service) ctx;
}
- return (Service) ctx;
+ return null;
}
public Object getServiceInstance() throws TargetException {
Service service = services.get(0);
if (service == null) {
- throw new TargetException("Component has no services");
+ throw new TargetNotFoundException("Component has no services");
}
return service.getServiceInstance();
}
public Service getSystemService(String name) {
SCAObject ctx = systemChildren.get(name);
- if (ctx == null) {
- throw new TargetNotFoundException("Service not found", name);
- } else if (!(ctx instanceof Service)) {
- throw new TargetNotFoundException("Target not a service");
+ if (ctx instanceof Service) {
+ return (Service) ctx;
}
- return (Service) ctx;
+ return null;
}
- public <T> T locateService(Class<T> serviceInterface, String name) {
+ public <T> T locateService(Class<T> serviceInterface, String name) throws TargetException {
SCAObject target = children.get(name);
if (target == null) {
TargetNotFoundException e = new TargetNotFoundException(name);
@@ -256,7 +250,7 @@
return serviceInterface.cast(target.getServiceInstance());
}
- public <T> T locateSystemService(Class<T> serviceInterface, String name) {
+ public <T> T locateSystemService(Class<T> serviceInterface, String name) throws TargetException {
SCAObject object = systemChildren.get(name);
if (object == null) {
TargetNotFoundException e = new TargetNotFoundException(name);
@@ -302,7 +296,7 @@
return serviceInterfaces;
}
- public <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException {
+ public <T> T resolveInstance(Class<T> instanceInterface) throws TargetException {
if (CompositeComponent.class.equals(instanceInterface)) {
return instanceInterface.cast(this);
}
@@ -312,33 +306,26 @@
if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
return instanceInterface.cast(context.getServiceInstance());
} else {
- IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
- + "service, atomic component, or reference", instanceInterface.getName());
- e.addContextName(getName());
- throw e;
+ String interfaceName = instanceInterface.getName();
+ throw new IllegalTargetException("Autowire target must be a system type", interfaceName);
}
} catch (CoreRuntimeException e) {
e.addContextName(getName());
throw e;
}
} else {
- try {
- if (CompositeComponent.class.isAssignableFrom(instanceInterface)) {
- return instanceInterface.cast(this);
- }
- // resolve to parent
- if (getParent() == null) {
- return null;
- }
- return getParent().resolveInstance(instanceInterface);
- } catch (AutowireResolutionException e) {
- e.addContextName(getName());
- throw e;
+ if (CompositeComponent.class.isAssignableFrom(instanceInterface)) {
+ return instanceInterface.cast(this);
+ }
+ // resolve to parent
+ if (getParent() == null) {
+ return null;
}
+ return getParent().resolveInstance(instanceInterface);
}
}
- public <T> T resolveSystemInstance(Class<T> instanceInterface) throws AutowireResolutionException {
+ public <T> T resolveSystemInstance(Class<T> instanceInterface) throws TargetException {
if (CompositeComponent.class.equals(instanceInterface)) {
return instanceInterface.cast(this);
}
@@ -348,31 +335,24 @@
if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
return instanceInterface.cast(context.getServiceInstance());
} else {
- IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
- + "service, atomic component, or reference", instanceInterface.getName());
- e.addContextName(getName());
- throw e;
+ String interfaceName = instanceInterface.getName();
+ throw new IllegalTargetException("Autowire target must be a system type", interfaceName);
}
} catch (CoreRuntimeException e) {
e.addContextName(getName());
throw e;
}
} else {
- try {
- // resolve to parent
- if (getParent() != null) {
- return getParent().resolveSystemInstance(instanceInterface);
- } else {
- return null;
- }
- } catch (AutowireResolutionException e) {
- e.addContextName(getName());
- throw e;
+ // resolve to parent
+ if (getParent() != null) {
+ return getParent().resolveSystemInstance(instanceInterface);
+ } else {
+ return null;
}
}
}
- public <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException {
+ public <T> T resolveExternalInstance(Class<T> instanceInterface) throws TargetException {
Service service = autowireExternal.get(instanceInterface);
if (service != null) {
try {
@@ -386,7 +366,7 @@
}
}
- public <T> T resolveSystemExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException {
+ public <T> T resolveSystemExternalInstance(Class<T> instanceInterface) throws TargetException {
Service service = systemAutowireExternal.get(instanceInterface);
if (service != null) {
try {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java Sun Dec 17 11:17:11 2006
@@ -22,6 +22,7 @@
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.Reference;
import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.Scope;
import org.apache.tuscany.spi.model.ServiceContract;
@@ -81,11 +82,12 @@
return wireService.createProxy(inboundWire);
}
- public WireInvocationHandler getHandler() throws TargetException {
+ public WireInvocationHandler getHandler() {
return wireService.createHandler(inboundWire);
}
- public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
+ public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
throw new UnsupportedOperationException();
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java Sun Dec 17 11:17:11 2006
@@ -23,6 +23,7 @@
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.Service;
import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.Scope;
import org.apache.tuscany.spi.model.ServiceContract;
@@ -38,7 +39,6 @@
* @version $Rev$ $Date$
*/
public class ServiceExtension extends AbstractSCAObject implements Service {
-
protected Class<?> interfaze;
protected InboundWire inboundWire;
protected OutboundWire outboundWire;
@@ -72,14 +72,6 @@
this.outboundWire = outboundWire;
}
- public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
- throw new UnsupportedOperationException();
- }
-
- public Object getServiceInstance() throws TargetException {
- return wireService.createProxy(inboundWire);
- }
-
public WireInvocationHandler getHandler() {
return wireService.createHandler(inboundWire);
}
@@ -87,7 +79,7 @@
public Class<?> getInterface() {
return interfaze;
}
-
+
public ServiceContract<?> getBindingServiceContract() {
return bindingServiceContract;
}
@@ -95,4 +87,14 @@
public void setBindingServiceContract(ServiceContract<?> serviceContract) {
this.bindingServiceContract = serviceContract;
}
+
+ public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getServiceInstance() throws TargetException {
+ return wireService.createProxy(inboundWire);
+ }
+
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java Sun Dec 17 11:17:11 2006
@@ -21,14 +21,16 @@
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedList;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.Message;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.component.WorkContext;
/**
* The default implementation of a TargetInvoker
+ *
+ * @version $Rev$ $Date$
*/
public abstract class TargetInvokerExtension implements TargetInvoker {
@@ -40,9 +42,9 @@
/**
* Creates a new invoker
*
- * @param wire the callback wire
+ * @param wire the callback wire
* @param workContext the work context to use for setting correlation information
- * @param monitor
+ * @param monitor the event monitor
*/
public TargetInvokerExtension(InboundWire wire, WorkContext workContext, ExecutionMonitor monitor) {
this.wire = wire;
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java Sun Dec 17 11:17:11 2006
@@ -18,9 +18,6 @@
*/
package org.apache.tuscany.spi.wire;
-import java.lang.reflect.InvocationTargetException;
-
-
/**
* Base class for dispatching an invocation through an {@link InboundInvocationChain}
*
@@ -34,16 +31,11 @@
public Object invoke(InboundInvocationChain chain, TargetInvoker invoker, Object[] args) throws Throwable {
Interceptor headInterceptor = chain.getHeadInterceptor();
if (headInterceptor == null) {
- try {
- // short-circuit the dispatch and invoke the target directly
- if (chain.getTargetInvoker() == null) {
- throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]");
- }
- return chain.getTargetInvoker().invokeTarget(args, TargetInvoker.NONE);
- } catch (InvocationTargetException e) {
- // the cause was thrown by the target so throw it
- throw e.getCause();
+ // short-circuit the dispatch and invoke the target directly
+ if (chain.getTargetInvoker() == null) {
+ throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]");
}
+ return chain.getTargetInvoker().invokeTarget(args, TargetInvoker.NONE);
} else {
Message msg = new MessageImpl();
msg.setTargetInvoker(invoker);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java Sun Dec 17 11:17:11 2006
@@ -18,14 +18,14 @@
*/
package org.apache.tuscany.spi.wire;
-import org.apache.tuscany.api.TuscanyRuntimeException;
+import org.apache.tuscany.spi.CoreRuntimeException;
/**
* Denotes an error creating a proxy
*
* @version $$Rev$$ $$Date$$
*/
-public class ProxyCreationException extends TuscanyRuntimeException {
+public class ProxyCreationException extends CoreRuntimeException {
public ProxyCreationException() {
}
Modified: incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiService.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiService.java (original)
+++ incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiService.java Sun Dec 17 11:17:11 2006
@@ -22,6 +22,8 @@
import java.util.Properties;
import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObjectStartException;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.ServiceExtension;
import org.apache.tuscany.spi.wire.WireService;
@@ -58,10 +60,15 @@
this.host = host;
}
- public void start() {
+ public void start() throws SCAObjectStartException {
super.start();
Properties properties = new Properties();
- Object instance = getServiceInstance();
+ Object instance;
+ try {
+ instance = getServiceInstance();
+ } catch (TargetException e) {
+ throw new SCAObjectStartException(e);
+ }
if (instance instanceof ServiceFactory) {
host.registerService(osgiServiceName, instance, properties);
} else {
Modified: incubator/tuscany/java/sca/runtime/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone-host/src/main/java/org/apache/tuscany/runtime/standalone/host/StandaloneRuntimeImpl.java Sun Dec 17 11:17:11 2006
@@ -24,11 +24,12 @@
import org.apache.tuscany.spi.bootstrap.ComponentNames;
import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
-import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.deployer.Deployer;
import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.core.bootstrap.Bootstrapper;
import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
@@ -36,6 +37,7 @@
import org.apache.tuscany.core.runtime.AbstractRuntime;
import org.apache.tuscany.host.MonitorFactory;
import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
/**
@@ -48,7 +50,7 @@
private CompositeComponent tuscanySystem;
private CompositeComponent application;
- public void initialize() {
+ public void initialize() throws InitializationException {
ClassLoader bootClassLoader = getClass().getClassLoader();
// Read optional system monitor factory classname
@@ -63,13 +65,17 @@
// register the runtime info provided by the host
RuntimeInfo runtimeInfo = getRuntimeInfo();
- systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME, RuntimeInfo.class, runtimeInfo);
- systemComponent.registerJavaObject(StandaloneRuntimeInfo.COMPONENT_NAME,
- StandaloneRuntimeInfo.class,
- (StandaloneRuntimeInfo) runtimeInfo);
-
- // register the monitor factory provided by the host
- systemComponent.registerJavaObject("MonitorFactory", MonitorFactory.class, mf);
+ try {
+ systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME, RuntimeInfo.class, runtimeInfo);
+ systemComponent.registerJavaObject(StandaloneRuntimeInfo.COMPONENT_NAME,
+ StandaloneRuntimeInfo.class,
+ (StandaloneRuntimeInfo) runtimeInfo);
+
+ // register the monitor factory provided by the host
+ systemComponent.registerJavaObject("MonitorFactory", MonitorFactory.class, mf);
+ } catch (ComponentRegistrationException e) {
+ throw new InitializationException(e);
+ }
systemComponent.start();
Modified: incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java Sun Dec 17 11:17:11 2006
@@ -27,6 +27,7 @@
import org.apache.tuscany.spi.bootstrap.ComponentNames;
import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.SCAObject;
import org.apache.tuscany.spi.deployer.Deployer;
@@ -44,6 +45,7 @@
import org.apache.tuscany.core.runtime.AbstractRuntime;
import org.apache.tuscany.host.MonitorFactory;
import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.host.servlet.ServletRequestInjector;
/**
@@ -82,13 +84,12 @@
this.servletContext = servletContext;
}
- public void initialize() {
+ public void initialize() throws InitializationException {
ClassLoader bootClassLoader = getClass().getClassLoader();
// Read optional system monitor factory classname
MonitorFactory mf = getMonitorFactory();
-
XMLInputFactory xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", bootClassLoader);
Bootstrapper bootstrapper = new DefaultBootstrapper(mf, xmlFactory);
@@ -96,18 +97,22 @@
runtime.start();
systemComponent = runtime.getSystemComponent();
- // register the runtime info provided by the host
- // FIXME andyp@bea.com -- autowire appears to need an exact type match,
- // hence the need to register this twice
- systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME,
- RuntimeInfo.class,
- (WebappRuntimeInfo) getRuntimeInfo());
- systemComponent.registerJavaObject(WebappRuntimeInfo.COMPONENT_NAME,
- WebappRuntimeInfo.class,
- (WebappRuntimeInfo) getRuntimeInfo());
-
- // register the monitor factory provided by the host
- systemComponent.registerJavaObject("MonitorFactory", MonitorFactory.class, mf);
+ try {
+ // register the runtime info provided by the host
+ // FIXME andyp@bea.com -- autowire appears to need an exact type match,
+ // hence the need to register this twice
+ systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME,
+ RuntimeInfo.class,
+ (WebappRuntimeInfo) getRuntimeInfo());
+ systemComponent.registerJavaObject(WebappRuntimeInfo.COMPONENT_NAME,
+ WebappRuntimeInfo.class,
+ (WebappRuntimeInfo) getRuntimeInfo());
+
+ // register the monitor factory provided by the host
+ systemComponent.registerJavaObject("MonitorFactory", MonitorFactory.class, mf);
+ } catch (ComponentRegistrationException e) {
+ throw new InitializationException(e);
+ }
systemComponent.start();
Modified: incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/TuscanyContextListener.java Sun Dec 17 11:17:11 2006
@@ -25,8 +25,9 @@
import javax.servlet.ServletContextListener;
import org.apache.tuscany.api.TuscanyRuntimeException;
-import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
+import org.apache.tuscany.host.runtime.ShutdownException;
import static org.apache.tuscany.runtime.webapp.Constants.ONLINE_PARAM;
+import static org.apache.tuscany.runtime.webapp.Constants.RUNTIME_ATTRIBUTE;
/**
* Launches a Tuscany runtime in a web application, loading information from servlet context parameters. This listener
@@ -39,11 +40,11 @@
* <p/>
* The <code>web.xml</code> of a web application embedding Tuscany must have entries for this listener and {@link
* TuscanySessionListener}. The latter notifies the runtime of session creation and expiration events through a
- * "bridging" contract, {@link WebappRuntime}. The <code>web.xml</code> may also optionally be configured with
- * entries for {@link TuscanyFilter} and {@link TuscanyServlet}. The former must be mapped to all urls that execute
- * "unmanaged" code which accesses the Tuscany runtime though the SCA API, for example, JSPs and Servlets. The latter
- * forwards service requests into the runtime, by default requests sent to URLs relative to the context path beginning
- * with <code>/services</code>.
+ * "bridging" contract, {@link WebappRuntime}. The <code>web.xml</code> may also optionally be configured with entries
+ * for {@link TuscanyFilter} and {@link TuscanyServlet}. The former must be mapped to all urls that execute "unmanaged"
+ * code which accesses the Tuscany runtime though the SCA API, for example, JSPs and Servlets. The latter forwards
+ * service requests into the runtime, by default requests sent to URLs relative to the context path beginning with
+ * <code>/services</code>.
*
* @version $Rev$ $Date$
*/
@@ -58,8 +59,8 @@
WebappRuntime runtime = utils.getRuntime(bootClassLoader);
boolean online = Boolean.valueOf(utils.getInitParameter(ONLINE_PARAM, "true"));
WebappRuntimeInfo info = new WebappRuntimeInfoImpl(servletContext,
- servletContext.getResource("/WEB-INF/tuscany/"),
- online);
+ servletContext.getResource("/WEB-INF/tuscany/"),
+ online);
URL systemScdl = utils.getSystemScdl(bootClassLoader);
URL applicationScdl = utils.getApplicationScdl(webappClassLoader);
String name = utils.getApplicationName();
@@ -100,7 +101,11 @@
return;
}
servletContext.removeAttribute(RUNTIME_ATTRIBUTE);
- runtime.destroy();
+ try {
+ runtime.destroy();
+ } catch (ShutdownException e) {
+ servletContext.log("Error destorying runtume", e);
+ }
}
}
Modified: incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java Sun Dec 17 11:17:11 2006
@@ -42,6 +42,7 @@
import org.apache.tuscany.spi.CoreRuntimeException;
import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.ServiceExtension;
import org.apache.tuscany.spi.wire.WireService;
@@ -215,7 +216,12 @@
Class<?> serviceInterface = this.getInterface();
Method meth = getMethod(serviceInterface, operationName.getLocalPart());
- Object proxy = this.getServiceInstance();
+ Object proxy = null;
+ try {
+ proxy = this.getServiceInstance();
+ } catch (TargetException e) {
+ throw new CeltixServiceInitException(e);
+ }
return new SCAServerDataBindingCallback(opInfo, inout, meth, proxy, typeHelper);
}
Modified: incubator/tuscany/java/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java Sun Dec 17 11:17:11 2006
@@ -19,6 +19,8 @@
package org.apache.tuscany.binding.jsonrpc;
import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObjectStartException;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.ServiceExtension;
import org.apache.tuscany.spi.host.ServletHost;
import org.apache.tuscany.spi.wire.WireService;
@@ -44,8 +46,12 @@
public synchronized void start() {
super.start();
-
- JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet(getName(), interfaze, this.getServiceInstance());
+ JSONRPCEntryPointServlet servlet;
+ try {
+ servlet = new JSONRPCEntryPointServlet(getName(), interfaze, this.getServiceInstance());
+ } catch (TargetException e) {
+ throw new SCAObjectStartException(e);
+ }
// register the servlet based on the service name
servletHost.registerMapping("/" + getName(), servlet);
Modified: incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java Sun Dec 17 11:17:11 2006
@@ -26,8 +26,8 @@
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.ObjectFactory;
import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
import org.apache.tuscany.spi.extension.AtomicComponentExtension;
-import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
@@ -37,6 +37,8 @@
/**
* The Groovy atomic component implementation. Groovy implementations may be "scripts" or classes.
+ *
+ * @version $Rev$ $Date$
*/
public class GroovyAtomicComponent extends AtomicComponentExtension {
private final Class<? extends GroovyObject> groovyClass;
@@ -104,7 +106,7 @@
public Object getServiceInstance(String service) throws TargetException {
InboundWire wire = getInboundWire(service);
if (wire == null) {
- throw new TargetException("ServiceDefinition not found", service);
+ throw new TargetNotFoundException("Service not found", service);
}
return wireService.createProxy(wire);
}
Modified: incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyInvoker.java Sun Dec 17 11:17:11 2006
@@ -20,6 +20,7 @@
import java.lang.reflect.InvocationTargetException;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.extension.TargetInvokerExtension;
@@ -61,11 +62,15 @@
}
/**
- * Dispatches to the the target.
- * TODO support conversational dispatch
+ * Dispatches to the the target. TODO support conversational dispatch
*/
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
- GroovyObject target = component.getTargetInstance();
+ GroovyObject target = null;
+ try {
+ target = component.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
Object[] args = (Object[]) payload;
try {
return target.invokeMethod(operation, args);
Modified: incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java Sun Dec 17 11:17:11 2006
@@ -26,6 +26,7 @@
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.ScopeContainer;
import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.extension.AtomicComponentExtension;
import org.apache.tuscany.spi.extension.ExecutionMonitor;
@@ -49,7 +50,8 @@
private RhinoScript rhinoScript;
- public JavaScriptComponent(String name, RhinoScript rhinoScript, Map<String, Object> properties, List<Class<?>> services,
+ public JavaScriptComponent(String name, RhinoScript rhinoScript, Map<String, Object> properties,
+ List<Class<?>> services,
CompositeComponent parent, ScopeContainer scopeContainer, WireService wireService,
WorkContext workContext,
ExecutionMonitor monitor) {
@@ -112,7 +114,7 @@
public Object getServiceInstance(String service) throws TargetException {
InboundWire wire = getInboundWire(service);
if (wire == null) {
- throw new TargetException("ServiceDefinition not found", service);
+ throw new TargetNotFoundException("ServiceDefinition not found", service);
}
return wireService.createProxy(wire);
}
Modified: incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java Sun Dec 17 11:17:11 2006
@@ -21,6 +21,7 @@
import java.lang.reflect.InvocationTargetException;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.extension.TargetInvokerExtension;
import org.apache.tuscany.spi.wire.InboundWire;
@@ -52,7 +53,12 @@
* Invokes a function on a script instance
*/
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
- RhinoScriptInstance target = context.getTargetInstance();
+ RhinoScriptInstance target = null;
+ try {
+ target = context.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
return target.invokeFunction(functionName, (Object[]) payload);
}
Modified: incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java Sun Dec 17 11:17:11 2006
@@ -27,6 +27,7 @@
import org.apache.tuscany.spi.component.ScopeContainer;
import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
import org.apache.tuscany.spi.extension.AtomicComponentExtension;
import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.model.Operation;
@@ -131,7 +132,7 @@
public Object getServiceInstance(String service) throws TargetException {
InboundWire wire = getInboundWire(service);
if (wire == null) {
- throw new TargetException("ServiceDefinition not found", service); // TODO better error message
+ throw new TargetNotFoundException("ServiceDefinition not found", service); // TODO better error message
}
return wireService.createProxy(wire);
}
Modified: incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyInvoker.java Sun Dec 17 11:17:11 2006
@@ -21,6 +21,7 @@
import java.lang.reflect.InvocationTargetException;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.extension.TargetInvokerExtension;
import org.apache.tuscany.spi.wire.InboundWire;
@@ -56,7 +57,13 @@
* Invokes a function on a script instance
*/
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
- RubyScriptInstance target = context.getTargetInstance();
+ RubyScriptInstance target = null;
+ try {
+ target = context.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+
+ }
return target.invokeFunction(functionName,
(Object[]) payload,
returnType);
Modified: incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java Sun Dec 17 11:17:11 2006
@@ -23,6 +23,7 @@
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
import org.apache.tuscany.spi.extension.AtomicComponentExtension;
import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
import org.apache.tuscany.spi.model.Operation;
@@ -79,7 +80,7 @@
public Object getServiceInstance(String service) throws TargetException {
InboundWire wire = getInboundWire(service);
if (wire == null) {
- throw new TargetException("Service not found", service); // TODO better error message
+ throw new TargetNotFoundException("Service not found", service);
}
return wireService.createProxy(wire);
}
Modified: incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java Sun Dec 17 11:17:11 2006
@@ -20,10 +20,13 @@
import java.lang.reflect.InvocationTargetException;
+import org.apache.tuscany.spi.component.TargetException;
import org.apache.tuscany.spi.extension.TargetInvokerExtension;
/**
* TargetInvoker implementation that calls a function on a ScriptInstanceImpl
+ *
+ * @version $Rev$ $Dev$
*/
public class ScriptTargetInvoker extends TargetInvokerExtension {
@@ -37,7 +40,12 @@
}
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
- ScriptInstance target = (ScriptInstance) component.getTargetInstance();
+ ScriptInstance target;
+ try {
+ target = (ScriptInstance) component.getTargetInstance();
+ } catch (TargetException e) {
+ throw new InvocationTargetException(e);
+ }
try {
return target.invokeTarget(functionName, (Object[]) payload);
} catch (Exception e) {
Modified: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java Sun Dec 17 11:17:11 2006
@@ -54,7 +54,7 @@
}
@SuppressWarnings("unchecked")
- public void testGetServiceInstance() {
+ public void testGetServiceInstance() throws Exception {
WireService wireService = EasyMock.createMock(WireService.class);
EasyMock.expect(wireService.createProxy(EasyMock.isA(RuntimeWire.class))).andStubAnswer(new IAnswer() {
public Object answer() throws Throwable {
Modified: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java Sun Dec 17 11:17:11 2006
@@ -29,7 +29,7 @@
public class ScriptInvokerTestCase extends TestCase {
@SuppressWarnings("unchecked")
- public void testInvokeTarget() throws InvocationTargetException {
+ public void testInvokeTarget() throws Exception {
ScriptInstance instance = EasyMock.createMock(ScriptInstance.class);
instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull());
EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
@@ -51,7 +51,7 @@
}
@SuppressWarnings("unchecked")
- public void testInvokeTargetException() throws InvocationTargetException, SecurityException, NoSuchMethodException {
+ public void testInvokeTargetException() throws Exception {
ScriptInstance instance = EasyMock.createMock(ScriptInstance.class);
instance.invokeTarget(EasyMock.eq("operation"), (Object[]) EasyMock.notNull());
EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java?view=diff&rev=488028&r1=488027&r2=488028
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java Sun Dec 17 11:17:11 2006
@@ -21,6 +21,7 @@
import org.apache.tuscany.spi.QualifiedName;
import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.Reference;
import org.apache.tuscany.spi.component.Service;
@@ -36,6 +37,7 @@
import org.apache.tuscany.container.spring.model.SpringComponentType;
import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.apache.tuscany.spi.builder.BuilderInstantiationException;
import org.springframework.core.io.Resource;
/**
@@ -70,13 +72,21 @@
chain.setTargetInvoker(component.createTargetInvoker(targetName.getPartName(), chain.getOperation(),
null));
}
- component.register(service);
+ try {
+ component.register(service);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering service", e);
+ }
}
for (BoundReferenceDefinition<?> referenceDefinition : componentType.getReferences().values()) {
// call back into builder registry to handle building of references
Reference reference = (Reference) builderRegistry.build(parent, referenceDefinition, deploymentContext);
connector.connect(reference);
- component.register(reference);
+ try {
+ component.register(reference);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering reference", e);
+ }
}
return component;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org