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/03/12 06:43:27 UTC
svn commit: r517105 - in
/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java:
JavaComponent.java JavaPhysicalComponentBuilder.java
Author: jboynes
Date: Sun Mar 11 22:43:25 2007
New Revision: 517105
URL: http://svn.apache.org/viewvc?view=rev&rev=517105
Log:
integrate System and Java Component
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponent.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponent.java?view=diff&rev=517105&r1=517104&r2=517105
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponent.java Sun Mar 11 22:43:25 2007
@@ -18,144 +18,28 @@
*/
package org.apache.tuscany.core.implementation.java;
-import java.lang.reflect.Method;
import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import org.osoa.sca.ComponentContext;
-
-import org.apache.tuscany.spi.CoreRuntimeException;
-import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.component.AtomicComponent;
-import org.apache.tuscany.spi.component.ComponentException;
-import org.apache.tuscany.spi.component.Reference;
-import org.apache.tuscany.spi.component.RegistrationException;
+import org.apache.tuscany.core.component.InstanceFactoryProvider;
+import org.apache.tuscany.core.implementation.PojoComponent;
import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.component.TargetInvokerCreationException;
-import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.component.InstanceWrapper;
-import org.apache.tuscany.spi.event.Event;
-import org.apache.tuscany.spi.event.EventFilter;
-import org.apache.tuscany.spi.event.RuntimeEventListener;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.PropertyValue;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.Wire;
-
-import org.apache.tuscany.core.component.InstanceFactory;
/**
* @version $Revision$ $Date$
+ * @param <T> the implementation class for the defined component
*/
-public class JavaComponent<T> implements AtomicComponent {
-
- // Instance factory class
- private Class<InstanceFactory<T>> instanceFactoryClass; //NOPMD
- private Class<T> implementationClass;
- private WorkContext workContext;
-
- // Scope container
- private ScopeContainer scopeContainer; //NOPMD
-
- /**
- * Injects the instance factory class.
- *
- * @param instanceFactoryClass Instance factory class.
- */
- public void setInstanceFactoryClass(Class<InstanceFactory<T>> instanceFactoryClass) {
- this.instanceFactoryClass = instanceFactoryClass;
- }
-
- /**
- * Injects the scope container.
- *
- * @param scopeContainer Scope container.
- */
- public void setScopeContainer(ScopeContainer scopeContainer) {
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * Injects the work context.
- *
- * @param workContext the work context.
- */
- public void setWorkContext(WorkContext workContext) {
- this.workContext = workContext;
- }
-
- /**
- * Sets the component implementation class.
- *
- * @param implementationClass the component implementation class.
- */
- public void setImplementationClass(Class<T> implementationClass) {
- this.implementationClass = implementationClass;
- }
-
- public void attachCallbackWire(Wire wire) {
- throw new UnsupportedOperationException();
- }
-
- public void attachWire(Wire wire) {
- throw new UnsupportedOperationException();
- }
-
- public void attachWires(List<Wire> wires) {
- throw new UnsupportedOperationException();
- }
-
- public ComponentContext getComponentContext() {
- throw new UnsupportedOperationException();
- }
-
- public Map<String, PropertyValue<?>> getDefaultPropertyValues() {
- throw new UnsupportedOperationException();
- }
-
- public Reference getReference(String name) {
- throw new UnsupportedOperationException();
- }
-
- public Scope getScope() {
- throw new UnsupportedOperationException();
- }
-
- public Service getService(String name) {
- throw new UnsupportedOperationException();
- }
-
- public List<Wire> getWires(String name) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isOptimizable() {
- throw new UnsupportedOperationException();
- }
-
- public void register(Service service) throws RegistrationException {
- throw new UnsupportedOperationException();
- }
-
- public void register(Reference reference) throws RegistrationException {
- throw new UnsupportedOperationException();
- }
-
- public void setDefaultPropertyValues(Map<String, PropertyValue<?>> defaultPropertyValues) {
- throw new UnsupportedOperationException();
- }
-
- public TargetInvoker createTargetInvoker(String targetName, Operation operation)
- throws TargetInvokerCreationException {
- throw new UnsupportedOperationException();
+public class JavaComponent<T> extends PojoComponent<T> {
+ public JavaComponent(URI componentId,
+ InstanceFactoryProvider<T> instanceFactoryProvider,
+ ScopeContainer scopeContainer,
+ int initLevel,
+ long maxIdleTime,
+ long maxAge
+ ) {
+ super(componentId, instanceFactoryProvider, scopeContainer, initLevel, maxIdleTime, maxAge);
}
+/*
public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation)
throws TargetInvokerCreationException {
List<String> params = operation.getParameters();
@@ -178,76 +62,5 @@
}
return new JavaTargetInvoker(method, this, scopeContainer, workContext);
}
-
- public URI getUri() {
- throw new UnsupportedOperationException();
- }
-
- public void addListener(RuntimeEventListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void addListener(EventFilter filter, RuntimeEventListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void publish(Event object) {
- throw new UnsupportedOperationException();
- }
-
- public void removeListener(RuntimeEventListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public int getLifecycleState() {
- throw new UnsupportedOperationException();
- }
-
- public void start() throws CoreRuntimeException {
- throw new UnsupportedOperationException();
- }
-
- public void stop() throws CoreRuntimeException {
- throw new UnsupportedOperationException();
- }
-
- public boolean isEagerInit() {
- return false;
- }
-
- public boolean isDestroyable() {
- return false;
- }
-
- public int getInitLevel() {
- return 0;
- }
-
- public long getMaxIdleTime() {
- return 0;
- }
-
- public long getMaxAge() {
- return 0;
- }
-
- public Object createInstance() throws ObjectCreationException {
- return null;
- }
-
- public void removeInstance() throws ComponentException {
-
- }
-
- public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
- throw new UnsupportedOperationException();
- }
-
- public Object getTargetInstance() throws TargetResolutionException {
- return scopeContainer.getInstance(this);
- }
-
- public Object getAssociatedTargetInstance() throws TargetResolutionException {
- return scopeContainer.getAssociatedInstance(this);
- }
+*/
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java?view=diff&rev=517105&r1=517104&r2=517105
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java Sun Mar 11 22:43:25 2007
@@ -23,7 +23,6 @@
import org.osoa.sca.annotations.Reference;
import org.apache.tuscany.core.builder.physical.AbstractPhysicalComponentBuilder;
-import org.apache.tuscany.core.component.InstanceFactory;
import org.apache.tuscany.core.model.physical.java.JavaPhysicalComponentDefinition;
import org.apache.tuscany.core.model.physical.java.JavaPhysicalWireSourceDefinition;
import org.apache.tuscany.core.model.physical.java.JavaPhysicalWireTargetDefinition;
@@ -38,9 +37,10 @@
* Java physical component builder.
*
* @version $Rev$ $Date$
+ * @param <T> the implementation class for the defined component
*/
-public class JavaPhysicalComponentBuilder extends
- AbstractPhysicalComponentBuilder<JavaPhysicalComponentDefinition, JavaComponent>
+public class JavaPhysicalComponentBuilder<T> extends
+ AbstractPhysicalComponentBuilder<JavaPhysicalComponentDefinition, JavaComponent<T>>
implements WireAttacher<JavaComponent, JavaPhysicalWireSourceDefinition, JavaPhysicalWireTargetDefinition> {
// Classloader registry
@@ -66,9 +66,10 @@
* @return A component instance that is ready to go live.
* @throws BuilderException If unable to build the component.
*/
- public JavaComponent build(JavaPhysicalComponentDefinition componentDefinition) throws BuilderException {
+ public JavaComponent<T> build(JavaPhysicalComponentDefinition componentDefinition) throws BuilderException {
- JavaComponent component = new JavaComponent();
+ URI componentId = componentDefinition.getComponentId();
+ JavaComponent<T> component = new JavaComponent<T>(componentId, null, null, 0, -1, -1);
setScopeContainer(componentDefinition, component);
@@ -101,16 +102,16 @@
* Sets the instance factory class.
*/
private void setInstanceFactoryClass(JavaPhysicalComponentDefinition componentDefinition, JavaComponent component) {
+/*
// TODO use MPCL to load IF class
URI classLoaderId = componentDefinition.getClassLoaderId();
-/*
byte[] instanceFactoryByteCode = componentDefinition.getInstanceFactoryByteCode(); //NOPMD
-*/
ClassLoader appCl = classLoaderRegistry.getClassLoader(classLoaderId); //NOPMD
ClassLoader systemCl = getClass().getClassLoader(); //NOPMD
ClassLoader mpcl = null; //NOPMD
Class<InstanceFactory<?>> instanceFactoryClass = null;
component.setInstanceFactoryClass(instanceFactoryClass);
+*/
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org