You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/03/11 16:38:12 UTC

svn commit: r516932 - in /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core: builder/physical/AbstractPhysicalComponentBuilder.java implementation/java/JavaPhysicalComponentBuilder.java

Author: meerajk
Date: Sun Mar 11 08:38:11 2007
New Revision: 516932

URL: http://svn.apache.org/viewvc?view=rev&rev=516932
Log:
Added abstract physical component builder.

Added:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java   (with props)
Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java

Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java?view=auto&rev=516932
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java Sun Mar 11 08:38:11 2007
@@ -0,0 +1,52 @@
+/*
+ * 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.core.builder.physical;
+
+import org.apache.tuscany.spi.builder.physical.PhysicalComponentBuilder;
+import org.apache.tuscany.spi.builder.physical.PhysicalComponentBuilderRegistry;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Abstract implementation that supports registering.
+ * 
+ * @param <PCD>
+ * @param <C>
+ */
+public abstract class AbstractPhysicalComponentBuilder<PCD extends PhysicalComponentDefinition, C extends Component>
+    implements PhysicalComponentBuilder<PCD, C> {
+    
+    /**
+     * Gets the physical component definition this builder expects.
+     * @return Physical component definition class.
+     */
+    protected abstract Class<PCD> getComponentType();
+
+    /**
+     * Injects builder registry.
+     * @param scopeRegistry Scope registry.
+     */
+    @Reference
+    public void setBuilderRegistry(PhysicalComponentBuilderRegistry registry) {
+        registry.register(getComponentType(), this);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/physical/AbstractPhysicalComponentBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=516932&r1=516931&r2=516932
==============================================================================
--- 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 08:38:11 2007
@@ -20,10 +20,10 @@
 
 import java.net.URI;
 
+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.spi.builder.BuilderException;
-import org.apache.tuscany.spi.builder.physical.PhysicalComponentBuilder;
 import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.ScopeRegistry;
 import org.apache.tuscany.spi.model.Scope;
@@ -36,14 +36,22 @@
  * @version $Rev$ $Date$
  *
  */
-public class JavaPhysicalComponentBuilder implements
-    PhysicalComponentBuilder<JavaPhysicalComponentDefinition, JavaComponent> {
+public class JavaPhysicalComponentBuilder extends
+    AbstractPhysicalComponentBuilder<JavaPhysicalComponentDefinition, JavaComponent> {
     
     // Classloader registry
     private ClassLoaderRegistry classLoaderRegistry;
     
     // SCope registry
     private ScopeRegistry scopeRegistry;
+    
+    /**
+     * Gets the physical component definition this builder expects.
+     * @return Physical component definition class.
+     */
+    protected Class<JavaPhysicalComponentDefinition> getComponentType() {
+        return JavaPhysicalComponentDefinition.class;
+    }
 
     /**
      * Builds a component from its physical component definition.



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