You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/03/14 23:29:57 UTC

svn commit: r637297 [3/6] - in /incubator/tuscany/java/sca: demos/workpool-distributed/ demos/workpool-distributed/src/ demos/workpool-distributed/src/main/ demos/workpool-distributed/src/main/java/ demos/workpool-distributed/src/main/java/node/ demos/...

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java Fri Mar 14 15:29:46 2008
@@ -0,0 +1,555 @@
+/*
+ * 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 workpool;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+
+import node.TestJob;
+import java.io.File;
+import java.util.Vector;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import org.osoa.sca.CallableReference;
+import org.drools.FactHandle;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.StatelessSession;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantLock;
+
+@Service(interfaces = { NodeManagerInitService.class, WorkpoolManager.class })
+@Scope("COMPOSITE")
+/*
+ * This is the core manager of the workpool application. The Workpool Manager
+ * holds the reference to each remote node manager. Inside it we've a rule
+ * engine instance.
+ */
+public class WorkpoolManagerImpl implements WorkpoolManager,
+        NodeManagerInitService, WorkpoolBeanListener {
+    /*
+     * This inner class trigs the rule engine, at given times: 1. It checks the
+     * different loads for each nodes and sets the WorkpoolBean 2. It checks the
+     * Workpool AverageService Time and sets the WorkpoolBean 3. It checks how
+     * many jobs are already computed and sets the WorkpoolBean Then given the
+     * configured bean and the rules, run the Rule Engine for executing the
+     * business logic
+     */
+    class RuleEngineTrigger extends TimerTask {
+        // private ReentrantLock triggerLock = new ReentrantLock();
+        @Override
+        public void run() {
+
+            System.out.println("Updating WorkpoolBean..");
+            // checkActiveWorkers();
+            // checkLoadInNodes();
+            checkServiceTime();
+            // checkEstimedQueueSize();
+            // checkArrivalTime();
+            getProcessedItem();
+            // computeUsageFactor();
+            doRun(bean);
+        }
+
+    }
+
+    private WorkerManager managerNodeB;
+    private WorkerManager managerNodeC;
+    private WorkerManager managerNodeD;
+    private WorkerManager managerNodeE;
+
+    private SCANodeImpl node;
+    private WorkpoolBean bean = new WorkpoolBean();
+    private ReentrantLock handleEventLock = new ReentrantLock();
+    private ReentrantLock updateRuleLock = new ReentrantLock();
+
+    private ServiceReference<WorkpoolService> reference;
+    private AtomicInteger activeWorkers = new AtomicInteger(0);
+    private Logger log = Logger.getLogger(WorkpoolManagerImpl.class.getName());
+    @Property
+    protected String workers;
+    @Property
+    protected String nodes;
+    @Property
+    protected String injection;
+    @Context
+    protected ComponentContext workpoolManagerContext;
+    private CallableReferenceImpl<WorkpoolManager> myReference;
+    private String rules = null;
+    private boolean referenceInjection = false;
+    private ConcurrentHashMap<String, WorkerManager> workerManagerTable = new ConcurrentHashMap<String, WorkerManager>();
+    private int workersNo;
+    private int nodesNo;
+    private Timer timer = new Timer();
+    /* this handle facts */
+    private RuleBase ruleBase = null;
+    private FactHandle handle = null;
+    private StatefulSession wm = null;
+    private long cycleTime = 5000;
+
+    @Reference
+    public void setManagerNodeB(WorkerManager managerNodeB) {
+        this.managerNodeB = managerNodeB;
+        workerManagerTable.put("nodeB", managerNodeB);
+    }
+
+    @Reference
+    public void setManagerNodeC(WorkerManager managerNodeC) {
+        this.managerNodeC = managerNodeC;
+        workerManagerTable.put("nodeC", managerNodeC);
+    }
+
+    @Reference
+    public void setManagerNodeD(WorkerManager managerNodeD) {
+        this.managerNodeD = managerNodeD;
+        workerManagerTable.put("nodeD", managerNodeD);
+    }
+
+    @Reference
+    public void setManagerNodeE(WorkerManager managerNodeE) {
+        this.managerNodeE = managerNodeE;
+        workerManagerTable.put("nodeE", managerNodeE);
+    }
+
+    private void startNewComponents(
+            Vector<CallableReferenceImpl<WorkerService>> vector) {
+        log.info("Starting new components");
+        WorkpoolService wp = reference.getService();
+        // CallableReferenceImpl<WorkpoolService> sink =
+        // (CallableReferenceImpl<WorkpoolService>) reference;
+        Job j = new NullJob();
+        for (CallableReferenceImpl<WorkerService> item : vector) {
+            // WorkerService service = item.getService();
+            // service.start();
+            // service.computeFirstTime(j, sink);
+            log.info("Send PostWorkerReference...");
+            wp.PostWorkerReference(item);
+        }
+        if (myReference != null)
+            wp.registerManager(myReference);
+    }
+
+    public void setCycleTime(long cycle) {
+        this.cycleTime = cycle;
+    }
+
+    @SuppressWarnings("unchecked")
+    /*
+     * This gets the number of workers workerNo and instantiates them
+     */
+    public void start() {
+        this.myReference = (CallableReferenceImpl<WorkpoolManager>) workpoolManagerContext
+                .createSelfReference(WorkpoolManager.class, "WorkpoolManager");
+        this.workersNo = Integer.parseInt(this.workers);
+        this.nodesNo = Integer.parseInt(this.nodes);
+        this.referenceInjection = (Integer.parseInt(this.injection) != 0);
+        log.info("Starting WorkpoolManager Component with #" + workersNo
+                + " workers and #" + nodes + " nodes");
+        nodesNo = workerManagerTable.values().size();
+        // Sets info in the bean.
+        bean.setWorkers(this.workersNo);
+        bean.setNodeNumbers(nodesNo);
+        Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+        int exactTimes = workersNo / nodesNo;
+        for (int i = 0; i < exactTimes; ++i) {
+            for (WorkerManager manager : workerManagerTable.values()) {
+                manager.start();
+                if (manager != null) {
+                    System.err.println("Actual load  = "
+                            + manager.getNodeLoad() + " for node ");
+                    addNewComponent(manager, workerRefs);
+                }
+            }
+        }
+
+        int module = (workersNo % nodesNo);
+        int n = 0;
+        if (module > 0) {
+            Vector<String> v = new Vector(workerManagerTable.keySet());
+            Collections.sort(v);
+            // Iterator<WorkerManager> iter =
+            // workerManagerTable.values().iterator();
+            // Display (sorted) hashtable.
+            for (Enumeration<String> e = v.elements(); (e.hasMoreElements() && n < module); ++n) {
+                String key = e.nextElement();
+                WorkerManager m = workerManagerTable.get(key);
+                System.err.println("Module Actual load  = " + m.getNodeLoad()
+                        + " for node ");
+                addNewComponent(m, workerRefs);
+            }
+        }
+        startNewComponents(workerRefs);
+        bean.addListener(this);
+        TimerTask task = new WorkpoolManagerImpl.RuleEngineTrigger();
+        timer.scheduleAtFixedRate(task, 3000, cycleTime);
+    }
+
+    private void checkLoadInNodes() {
+        System.out.println("CheckLoadInNodes");
+        int number = 1;
+        double loadAverage = 0;
+        for (WorkerManager manager : workerManagerTable.values()) {
+            loadAverage += manager.getNodeLoad();
+            number++;
+        }
+        bean.setLoadAverage(loadAverage / number);
+    }
+
+    private void computeUsageFactor() {
+        bean.setUsageFactor();
+    }
+
+    private void checkEstimedQueueSize() {
+        WorkpoolService wp = reference.getService();
+
+        if (wp != null) {
+            int size = wp.estimatedQueueSize();
+            log.info("Estimed Queue Size =" + size);
+            bean.setEstimedQueueSize(size);
+        }
+    }
+
+    private WorkerManager findMinLoad() {
+        double load = 0;
+        // workerManagerTable.values().iterator().next().getNodeLoad();
+        WorkerManager toFind = null;
+        for (WorkerManager manager : workerManagerTable.values()) {
+            if (load == 0) {
+                load = manager.getNodeLoad();
+                toFind = manager;
+            } else if (manager.getNodeLoad() < load) {
+                load = manager.getNodeLoad();
+                toFind = manager;
+            }
+        }
+        return toFind;
+    }
+
+    private void checkServiceTime() {
+        WorkpoolService wp = reference.getService();
+
+        if (wp != null) {
+            double time = wp.getServiceTime();
+            log.info("Average System Service Time =" + time);
+            bean.setAverageServiceTime(time);
+        }
+    }
+
+    private void checkArrivalTime() {
+        WorkpoolService wp = reference.getService();
+
+        if (wp != null) {
+            double time = wp.getArrivalTime();
+            log.info("Average Arrival Service Time =" + time);
+            bean.setAverageArrivalTime(time);
+        }
+    }
+
+    private void checkActiveWorkers() {
+        bean.setWorkers(this.activeWorkers());
+    }
+
+    private void getProcessedItem() {
+        WorkpoolService wp = reference.getService();
+        if (wp != null) {
+            long computed = wp.getJobComputed();
+            log.info("The system has already computed " + computed + " jobs");
+            bean.setJobComputed(computed);
+        }
+    }
+
+    private boolean removeComponent(WorkerManager manager, int k) {
+        manager.removeWorkers(k);
+        activeWorkers.decrementAndGet();
+        return true;
+    }
+
+    @SuppressWarnings("unchecked")
+    private boolean addNewComponent(WorkerManager manager,
+            Vector<CallableReferenceImpl<WorkerService>> workerRefs) {
+        CallableReferenceImpl<WorkerService> workerReference = (CallableReferenceImpl<WorkerService>) manager
+                .addWorker();
+
+        if (workerReference != null) {
+            /* if i'll decide to use dynamically generated references */
+            if (referenceInjection) {
+                workerReference.getService();
+                String uri = workerReference.getEndpointReference().getURI();
+                int nameIndex = uri.indexOf("/");
+                String componentName = uri.substring(0, nameIndex);
+                if (componentName.startsWith("/"))
+                    componentName = uri.substring(1, uri.length());
+                if (componentName.endsWith("/"))
+                    componentName = uri.substring(0, uri.length() - 1);
+                // String componentName = uri.substring(0, nameIndex-1);
+
+                log.info("Adding wire from WorkpoolComponentService to "
+                        + componentName);
+                String referenceName = "ref" + componentName;
+
+                /*
+                 * I'm updating the WorkpoolServiceComponent with a new
+                 * reference to a just created component I assume that the
+                 * WorkpoolManagerService and the WorkpoolServiceComponent stay
+                 * in the same JVM It's like in the scdl there were: <reference
+                 * name=referenceName target="componentName"/> With this then
+                 * I've a wire WorkpoolService---> a new Worker
+                 */
+                try {
+                    node.addComponentReferenceWire(referenceName, "nodeA",
+                            "Workpool.composite", "workpool.WorkerServiceImpl",
+                            WorkerService.class, "WorkpoolServiceComponent",
+                            componentName);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    return false;
+                }
+                log.info("Sending reference name " + referenceName
+                        + " to WorkpoolService");
+                // TODO: this was part of dynamic wiring, but it doesn't work.
+                // reference.getService().PostWorkerName(referenceName);
+
+            } else {
+                // log.info("Sending callable reference to WorkpoolService
+                // placed at -->"+reference);
+                // reference.getService().PostWorkerReference(workerReference);
+                workerRefs.add(workerReference);
+            }
+            activeWorkers.incrementAndGet();
+            return true;
+        }
+        return false;
+    }
+
+    public int activeWorkers() {
+
+        return activeWorkers.get();
+    }
+
+    private void doRun(WorkpoolBean bean) {
+
+        long startTime = System.currentTimeMillis();
+        updateRuleLock.lock();
+        if (wm == null)
+            wm = ruleBase.newStatefulSession();
+        if (this.handle == null)
+            handle = wm.insert(bean);
+        else {
+            wm.update(handle, bean);
+        }
+        wm.fireAllRules();
+        updateRuleLock.unlock();
+
+        System.out.println("Engine rule overhead = "
+                + (System.currentTimeMillis() - startTime));
+    }
+
+    private RuleBase readRule(String rule) {
+
+        PackageBuilder packBuilder = new PackageBuilder();
+        try {
+            packBuilder.addPackageFromDrl(new StringReader(rule));
+        } catch (DroolsParserException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        Package pkg = packBuilder.getPackage();
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        try {
+            ruleBase.addPackage(pkg);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ruleBase;
+    }
+
+    public void acceptRules(String rules) {
+        this.rules = rules;
+        if (ruleBase == null) {
+            RuleBase base = readRule(rules);
+            if (base != null) {
+                ruleBase = base;
+            }
+        } else {
+            updateRuleLock.lock();
+            // i have already a rule: updating
+            ruleBase = readRule(rules);
+            wm = ruleBase.newStatefulSession();
+            handle = null;
+            updateRuleLock.unlock();
+        }
+
+        System.out.println("Accepted rules = " + rules);
+    }
+
+    public String getRules() {
+        return rules;
+    }
+
+    private WorkerManager findMaxLoadNode() {
+        double load = 0.0;
+        WorkerManager toFind = null;
+        for (WorkerManager manager : workerManagerTable.values()) {
+            if (manager.getNodeLoad() > load) {
+                load = manager.getNodeLoad();
+                toFind = manager;
+            }
+        }
+        return toFind;
+
+    }
+
+    public void setWorkpoolReference(
+            ServiceReference<WorkpoolService> serviceReference) {
+        reference = serviceReference;
+    }
+
+    public void setNode(SCANode arg0) {
+        node = (SCANodeImpl) arg0;
+    }
+
+    public void handleEvent(WorkpoolEvent ev) {
+        if (ev == null)
+            return;
+
+        String nodeName = ev.getNodeName();
+
+        switch (ev.getType()) {
+        case WorkpoolEvent.SINGLE_ADD_WORKER: {
+            if (nodeName != null) {
+                Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+
+                // in this case I have a nodeName
+                if (!nodeName.equals("")
+                        && (workerManagerTable.containsKey(nodeName))) {
+                    WorkerManager manager = workerManagerTable.get(nodeName);
+                    addNewComponent(manager, workerRefs);
+                    startNewComponents(workerRefs);
+                } else if (nodeName.equals("")) {
+                    WorkerManager manager = findMinLoad();
+                    addNewComponent(manager, workerRefs);
+                    startNewComponents(workerRefs);
+                }
+            }
+            break;
+        }
+        case WorkpoolEvent.EVENT_MULTIPLE_ADD_WORKER: {
+            Vector<CallableReferenceImpl<WorkerService>> workerRefs = new Vector<CallableReferenceImpl<WorkerService>>();
+
+            if (nodeName.equals("")) {
+
+                WorkerManager manager = findMinLoad();
+                int k = ev.workers();
+                for (int h = 0; h < k; ++h) {
+                    addNewComponent(manager, workerRefs);
+                }
+            } else {
+                WorkerManager manager = workerManagerTable
+                        .get(ev.getNodeName());
+                int k = ev.workers();
+                for (int h = 0; h < k; ++h) {
+                    addNewComponent(manager, workerRefs);
+                }
+            }
+            startNewComponents(workerRefs);
+            break;
+        }
+        case WorkpoolEvent.SINGLE_REMOVE_WORKER: {
+            if (nodeName != null) {
+                // in this case I have a nodeName
+                if (!nodeName.equals("")
+                        && (workerManagerTable.containsKey(nodeName))) {
+                    WorkerManager manager = workerManagerTable.get(nodeName);
+                    removeComponent(manager, 1);
+                } else if (nodeName.equals("")) {
+                    WorkerManager manager = findMaxLoadNode();
+                    removeComponent(manager, 1);
+                }
+            }
+            break;
+        }
+        case WorkpoolEvent.EVENT_MULTIPLE_REMOVE_WORKER: {
+            if (nodeName.equals("")) {
+                WorkerManager manager = findMaxLoadNode();
+                removeComponent(manager, ev.workers());
+
+            } else {
+                WorkerManager manager = workerManagerTable.get(nodeName);
+                removeComponent(manager, ev.workers());
+            }
+            break;
+        }
+        }
+
+    }
+
+    @Destroy
+    public void onExit() {
+        // do cleanup
+        this.timer.cancel();
+        this.timer.purge();
+    }
+
+    public void stopAutonomicCycle() {
+        this.timer.cancel();
+        this.timer.purge();
+        this.timer = null;
+    }
+
+    public void startAutonomicCycle() {
+        if (this.timer == null) {
+            this.timer = new Timer();
+            TimerTask task = new WorkpoolManagerImpl.RuleEngineTrigger();
+            timer.schedule(task, 3000, cycleTime);
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolManagerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java Fri Mar 14 15:29:46 2008
@@ -0,0 +1,91 @@
+/*
+ * 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 workpool;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.ServiceReference;
+
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+@Remotable
+public interface WorkpoolService {
+
+    /* this the functional part */
+    void submit(Job i);
+
+    /* the time between two subsequent worker invocations */
+    double getServiceTime();
+
+    /* the number of ResultJob received */
+    long getJobComputed();
+
+    /* the time elapsed between the stream has initiated and now */
+    long getElapsedTime();
+
+    /* the size of the internal queue : it's not accurate */
+    int estimatedQueueSize();
+
+    /* the average time between two consuecutive submit */
+    double getArrivalTime();
+
+    void start();
+
+    void stop();
+
+    /*
+     * this is the part needed by management. May be in future i'll refactor it
+     * order to hide this part.
+     */
+    @OneWay
+    void handleResult(Job j, boolean reuse, String string,
+            CallableReferenceImpl<WorkerService> worker, boolean newJob);
+
+    void addTrigger(CallableReferenceImpl<Trigger> reference);
+
+    void removeTrigger();
+
+    void registerManager(
+            CallableReferenceImpl<WorkpoolManager> createSelfReference);
+
+    /*
+     * This could placed in another interface definition - think about it These
+     * methods evict, and evictAll are needed when a worker finish to exist and
+     * it needs to be evicted by the WorkpoolManager. In the system I have two
+     * caches: 1) a domain cache, which holds the components URI 2) a
+     * workerReference cache (implemented by a ConcurrentHashMap), which holds a
+     * proxy to each worker. Every proxy gets built from the worker callable
+     * reference. I'm thinking for placing the workerReferenceCache in a local
+     * interface. Assuming that WorkpoolService and WorkpoolManager are in the
+     * same JVM.
+     */
+    void evict(String workerURI);
+
+    void evictAll();
+
+    /*
+     * these two are no longer needed. I leave it because if i'll have time to
+     * do dynamic wiring the first one is needed. void PostWorkerName(String
+     * referenceName);
+     */
+    void PostWorkerReference(CallableReferenceImpl<WorkerService> worker);
+
+}

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java Fri Mar 14 15:29:46 2008
@@ -0,0 +1,416 @@
+/*
+ * 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 workpool;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.apache.tuscany.sca.databinding.job.Job;
+import org.apache.tuscany.sca.databinding.job.JobDataMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * An implementation of the Workpool service.
+ */
+@Service(WorkpoolService.class)
+@Scope("COMPOSITE")
+@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
+public class WorkpoolServiceImpl implements WorkpoolService,
+        WorkerServiceCallback {
+
+    /* incoming job queue */
+    private LinkedBlockingQueue<Job> queue = new LinkedBlockingQueue<Job>(5000);
+    private CallableReferenceImpl<Trigger> trigger = null;
+    private Trigger forwardResult = null;
+    /* counter for job's number fetched from the queue and sent to the Worker */
+    private AtomicInteger jobSent = new AtomicInteger(0);
+    /* time for initHandleResult */
+    private AtomicLong initHandleResult = new AtomicLong(0);
+    /* time for endHandleResult */
+    private AtomicLong endHandleResult = new AtomicLong(0);
+    /*
+     * number of job computed, this will be exposed in order to be used to
+     * firing rules
+     */
+    private long jobComputed = 0;
+    /* same as above */
+    private AtomicLong elapsedTime = new AtomicLong(0);
+    /* this is for comuputing averageServiceTime */
+    private long times = 1;
+    /* this is for computing averageArrivalTime */
+    private long timesArrival = 1;
+    private ReentrantLock arrivalLock = new ReentrantLock();
+    private long arrivalPrevious = -1;
+    // private AtomicBoolean processingStopped = new AtomicBoolean(false);
+    private boolean processingStopped = false;
+    // private LinkedBlockingQueue<Trigger> triggers = new
+    // LinkedBlockingQueue<Trigger>();
+    @Context
+    protected ComponentContext workpoolContext;
+    private CallableReferenceImpl<WorkpoolManager> manager;
+    private long previousSubmitTime = -1;
+    private boolean firstTime = true;
+    private boolean first = true;
+    private long start = 0;
+    private long end = 0;
+    private double averageServiceTime = 0;
+    private double averageArrivalTime = 0;
+    private int workersNo = 0;
+    private final Job nullJob = new NullJob();
+    /* This is useful for counting the start and end */
+    private Logger log = Logger.getLogger(WorkpoolServiceImpl.class.getName());
+    private ReentrantLock handleResultLock = new ReentrantLock();
+    private ReentrantLock postWorkerReferenceLock = new ReentrantLock();
+    private ConcurrentHashMap<String, WorkerService> cacheReference = new ConcurrentHashMap<String, WorkerService>();
+    private CallableReferenceImpl<WorkpoolService> myReference;
+    private String previuosURI = "";
+    private long time = 0;
+
+    private void computeAverageTime() {
+        long actualServiceTime = 0;
+        // if the processing is finished
+        if (processingStopped)
+            return;
+
+        if (firstTime == true) {
+            this.previousSubmitTime = System.currentTimeMillis();
+            this.averageServiceTime = 0;
+            firstTime = false;
+        } else {
+            actualServiceTime = System.currentTimeMillis()
+                    - this.previousSubmitTime;
+            this.previousSubmitTime = System.currentTimeMillis();
+            averageServiceTime = ((averageServiceTime * times) + actualServiceTime)
+                    / (times + 1);
+            ++times;
+        }
+    }
+
+    public void submit(Job j) {
+        try {
+            // log.info("Submit job in queue -->"+ j.getType());
+            // processingStopped.set(false);
+            try {
+                arrivalLock.lock();
+                if (this.arrivalPrevious == -1) {
+                    arrivalPrevious = System.currentTimeMillis();
+                    averageArrivalTime = 0;
+                }
+                double actualArrivalTime = System.currentTimeMillis()
+                        - arrivalPrevious;
+                averageArrivalTime = ((averageArrivalTime * timesArrival) + actualArrivalTime)
+                        / (timesArrival + 1);
+                arrivalPrevious = System.currentTimeMillis();
+                ++timesArrival;
+            } finally {
+                arrivalLock.unlock();
+            }
+            queue.put(j);
+        } catch (Exception e) {
+            log.info("Exception in queue");
+            queue.clear();
+            e.printStackTrace();
+        }
+    }
+
+    public double getArrivalTime() {
+        return this.averageArrivalTime;
+    }
+
+    public double getServiceTime() {
+        return this.averageServiceTime;
+    }
+
+    public void receiveResult(Job resultType, boolean reuse, String workerURI) {
+
+        if (reuse) {
+            queue.add(resultType);
+            return;
+        }
+
+        computeAverageTime();
+        Job job = null;
+        try {
+            job = queue.take();
+        } catch (InterruptedException e) {
+            // TODO Better exception handling --> see Exception antipattern doc
+            e.printStackTrace();
+            return;
+        }
+
+        if ((job != null) && (job.eos() == false)) {
+            int nameIndex = workerURI.indexOf("/");
+            String workerName = workerURI.substring(0, nameIndex - 1);
+            log.info("Sending job to worker --> " + workerName);
+            WorkerService worker = workpoolContext.getService(
+                    WorkerService.class, workerName);
+            worker.compute(job);
+        }
+
+        JobDataMap map = ((ResultJob) resultType).getDataMap();
+        if (map != null) {
+            ++jobComputed;
+            Object obj = map.getJobDataObject("result");
+            System.out.println("Result = " + ((Double) obj).doubleValue());
+        }
+
+    }
+
+    public void start() {
+        log.info("WorkpoolServiceComponent started...");
+        myReference = (CallableReferenceImpl) workpoolContext
+                .createSelfReference(WorkpoolService.class, "WorkpoolService");
+        myReference.getService();
+    }
+
+    /*
+     * 
+     * This method is called by WorkpoolManagerImpl, when it creates a new
+     * worker component in order to dispatch worker to the WorkpoolServiceImpl
+     * @param CallableReferenceImpl reference - a dynamically created reference
+     * from the Worker
+     */
+    public void PostWorkerReference(
+            CallableReferenceImpl<WorkerService> reference) {
+
+        try {
+            long initPostWorkerReference;
+            long endPostWorkerReference;
+            this.postWorkerReferenceLock.lock();
+
+            initPostWorkerReference = System.currentTimeMillis();
+            WorkerService worker;
+            worker = reference.getService();
+            worker.start();
+
+            ++workersNo;
+            if (myReference != null) {
+
+                // Job poison = new ResultJob();
+                this.postWorkerReferenceLock.unlock();
+                log.info("Sending null job to worker");
+                worker.computeFirstTime(nullJob, myReference);
+                // queue.put(poison);
+                endPostWorkerReference = System.currentTimeMillis();
+                System.out.println("Time PostWorker ="
+                        + (endPostWorkerReference - initPostWorkerReference));
+            } else {
+                log.info("myReference is null");
+
+            }
+        } catch (Exception e) {
+            postWorkerReferenceLock.unlock();
+        } finally {
+        }
+
+    }
+
+    /*
+     * FIXME This method currently is not used because i've not yet ready
+     * dynamic wire injection
+     */
+
+    public void PostWorkerName(String referenceName) {
+        /* TODO Do something similar to PostWorkerReference */
+    }
+
+    private void printComputingTime(Job j) {
+
+        if (first == true) {
+            first = false;
+            start = System.currentTimeMillis();
+            end = System.currentTimeMillis();
+        } else {
+            end = System.currentTimeMillis();
+            System.out.println("Elapsed Time = " + (end - start));
+            elapsedTime.set(end - start);
+        }
+        /*
+         * i could use reflection or instance of (but it's a penalty kick) , or
+         * an object as result, but i'd prefer a job so i've defined a
+         * RESULT_JOB There're in the system three kind of jobs: RESULT_JOB,
+         * NULL_JOB, DEFAULT_JOB
+         */
+        if ((j != null) && (j.getType() == Job.RESULT_JOB)) {
+            jobComputed++;
+            ResultJob result = (ResultJob) j;
+            JobDataMap map = result.getDataMap();
+            if (map != null) {
+                Double doubleValue = (Double) map.getJobDataObject("result");
+                System.out
+                        .println("ResultValue = " + doubleValue.doubleValue());
+            }
+
+        }
+
+    }
+
+    public void handleResult(Job resultType, boolean reuse, String workerURI,
+            CallableReferenceImpl<WorkerService> worker, boolean newWorker) {
+        initHandleResult.set(System.nanoTime());
+        if (reuse) {
+            log.info("Reusing a job..");
+            queue.add(resultType);
+            return;
+        }
+        // init job variable
+        Job job;
+        if (newWorker)
+            System.out.println("newWorkerActivation= " + System.nanoTime());
+        printComputingTime(resultType);
+
+        try {
+            job = queue.take();
+        } catch (Exception e) {
+            log.info("Exception during fetching the queue");
+            e.printStackTrace();
+            return;
+        }
+
+        try {
+            // it needs to be locked because multiple threads could invoke this.
+            handleResultLock.lock();
+            if (previuosURI.equals("")) {
+                time = System.currentTimeMillis();
+                this.previuosURI = workerURI;
+            } else {
+                if (previuosURI.equals(workerURI))
+                    System.out.println("Complete ComputeTime for an item ="
+                            + (time - System.currentTimeMillis()));
+            }
+            if (job.eos()) {
+                long endTime = System.currentTimeMillis();
+                /* checking for EOS */
+                if (processingStopped == false) {
+                    processingStopped = true;
+                    System.out.println("GOT EOS in time=" + (endTime - start));
+                    log.info("Stop autonomic cycle..");
+                    /*
+                     * I'm doing this because i want that in the termination i
+                     * would have more jobs with eos == true than workers. So
+                     * i'm sure that every worker removes itself from its
+                     * manager. I do it only one time. This is necessary because
+                     * i have a variable number of workers. The number of
+                     * workers in the system might change every time the rule
+                     * engine cycle gets executed.
+                     */
+                    ResultJob poison = new ResultJob();
+                    for (int i = 0; i < workersNo; ++i) {
+                        try {
+
+                            queue.put(poison);
+
+                        } catch (Exception e) {
+                            log.info("Cannot duplicate poison tokens");
+                            break;
+                        }
+
+                    }
+                    manager.getService().stopAutonomicCycle();
+                }
+            }
+            computeAverageTime();
+            System.out.println("AverageTime =" + averageServiceTime);
+            if (job != null) {
+
+                WorkerService workerService;
+                /*
+                 * the workpool has a high reuse, i always call the same
+                 * component set or un superset or subset, so i cache it. When
+                 * the WorkpoolManager will remove an item, it removes still
+                 * this cache entry
+                 */
+                if (!cacheReference.containsKey(workerURI)) {
+                    workerService = worker.getService();
+                    handleResultLock.unlock();
+                    cacheReference.put(workerURI, workerService);
+                } else {
+                    handleResultLock.unlock();
+                    workerService = cacheReference.get(workerURI);
+                }
+                // it's still a penalty kick locking compute because it's going
+                // to be scheduled whereas it's async.
+                workerService.compute(job);
+                log.info("Sent job #" + jobSent.incrementAndGet()
+                        + " Queue size " + queue.size());
+                endHandleResult.set(System.nanoTime());
+                System.out
+                        .println("begin:handleResult ==> end:handleResult:compute = "
+                                + (endHandleResult.addAndGet(-(initHandleResult
+                                        .get())) / 1000000));
+            }
+        } catch (Exception e) {
+            handleResultLock.unlock();
+        }
+    }
+
+    public void evictAll() {
+        cacheReference.clear();
+    }
+
+    public void evict(String workerURI) {
+        if (cacheReference.containsKey(workerURI)) {
+            cacheReference.remove(workerURI);
+        }
+
+    }
+
+    public int estimatedQueueSize() {
+        return queue.size();
+    }
+
+    public long getElapsedTime() {
+        return elapsedTime.get();
+    }
+
+    public long getJobComputed() {
+        return jobComputed;
+    }
+
+    public void registerManager(
+            CallableReferenceImpl<WorkpoolManager> createSelfReference) {
+        manager = createSelfReference;
+
+    }
+
+    public void stop() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addTrigger(CallableReferenceImpl<Trigger> reference) {
+        this.trigger = reference;
+        this.forwardResult = reference.getService();
+
+    }
+
+    public void removeTrigger() {
+        this.trigger = null;
+        this.forwardResult = null;
+    }
+}

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/java/workpool/WorkpoolServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml Fri Mar 14 15:29:46 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Workpool"/>
+</contribution>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite Fri Mar 14 15:29:46 2008
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Workpool">
+    
+    <component name="WorkpoolServiceComponent">
+	<implementation.java class="workpool.WorkpoolServiceImpl"/>
+    </component>
+    <component name="WorkpoolManagerComponent">
+    <implementation.java class="workpool.WorkpoolManagerImpl"/>
+    <property name="workers">4</property>
+    <property name="nodes">4</property>
+    <property name="injection">0</property>
+    <reference name="managerNodeB" target="WorkerManagerNodeBComponent" />
+
+    <reference name="managerNodeC" target="WorkerManagerNodeCComponent" />
+
+    <reference name="managerNodeD" target="WorkerManagerNodeDComponent" />
+
+    <reference name="managerNodeE" target="WorkerManagerNodeEComponent" />
+
+
+    <service name="WorkpoolManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+            <binding.sca/>
+    </service>
+    </component>     
+ </composite>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeA/Workpool.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml Fri Mar 14 15:29:46 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Workpool"/>
+</contribution>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite Fri Mar 14 15:29:46 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Workpool">
+        <component name="WorkerManagerNodeBComponent">   
+        <implementation.java class="workpool.WorkerManagerImpl"/>
+        <property name="nodeName">nodeB</property>
+	 	<property name="compositeName">Workpool.composite</property>
+	 	 <property name="workerClass">workpool.MyWorker</property> 
+	 	<service name="WorkerManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+            <binding.sca/>
+        </service>
+     <service name="WorkerManager">
+      <binding.sca uri="http://u13:13001/WorkerManagerNodeBComponent"/>
+     </service>
+     </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeB/Workpool.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml Fri Mar 14 15:29:46 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Workpool"/>
+</contribution>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite Fri Mar 14 15:29:46 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Workpool">
+        <component name="WorkerManagerNodeCComponent">   
+        <implementation.java class="workpool.WorkerManagerImpl"/>
+        <property name="nodeName">nodeC</property>
+	 	<property name="compositeName">Workpool.composite</property>
+	 	 <property name="workerClass">workpool.MyWorker</property> 
+	 	<service name="WorkerManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+            <binding.sca/>
+        </service>
+     <service name="WorkerManager">
+      <binding.sca uri="http://u14:13002/WorkerManagerNodeCComponent"/>
+     </service>
+     </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeC/Workpool.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml Fri Mar 14 15:29:46 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Workpool"/>
+</contribution>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite Fri Mar 14 15:29:46 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Workpool">
+        <component name="WorkerManagerNodeDComponent">   
+        <implementation.java class="workpool.WorkerManagerImpl"/>
+        <property name="nodeName">nodeD</property>
+	 	<property name="compositeName">Workpool.composite</property>
+	 	 <property name="workerClass">workpool.MyWorker</property> 
+	 	<service name="WorkerManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+            <binding.sca/>
+        </service>
+     <service name="WorkerManager">
+      <binding.sca uri="http://u15:13003/WorkerManagerNodeDComponent"/>
+     </service>
+     </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeD/Workpool.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml Fri Mar 14 15:29:46 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Workpool"/>
+</contribution>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite Fri Mar 14 15:29:46 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Workpool">
+        <component name="WorkerManagerNodeEComponent">   
+        <implementation.java class="workpool.WorkerManagerImpl"/>
+        <property name="nodeName">nodeE</property>
+	 	<property name="compositeName">Workpool.composite</property>
+	 	 <property name="workerClass">workpool.MyWorker</property> 
+	 	<service name="WorkerManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+            <binding.sca/>
+        </service>
+     <service name="WorkerManager">
+      <binding.sca uri="http://u16:13004/WorkerManagerNodeEComponent"/>
+     </service>
+     </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/main/resources/nodeE/Workpool.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java Fri Mar 14 15:29:46 2008
@@ -0,0 +1,25 @@
+/*
+ * 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 workpool;
+
+public interface AComponent {
+    public static final int RETURN_VALUE = 1;
+
+    public void greet();
+}

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/demos/workpool-distributed/src/test/java/workpool/AComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/demos/workpool-distributed/workerRules.drl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/workerRules.drl?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/workerRules.drl (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/workerRules.drl Fri Mar 14 15:29:46 2008
@@ -0,0 +1,9 @@
+package workpool
+import workpool.*;
+rule "WorkerAdder"
+	when 
+		$workerBean: WorkpoolBean(singleAction == false && (jobComputed > 500))
+	then
+		$workerBean.addWorkerToNode("nodeB");
+		$workerBean.setSingleAction();
+end

Added: incubator/tuscany/java/sca/demos/workpool-distributed/workerRules1.drl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/workerRules1.drl?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/workerRules1.drl (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/workerRules1.drl Fri Mar 14 15:29:46 2008
@@ -0,0 +1,9 @@
+package workpool
+import workpool.*;
+rule "WorkerAdder"
+	when 
+		$workerBean: WorkpoolBean(averageServiceTime > 250)
+	then
+		$workerBean.addWorkerToNode("nodeB");
+		$workerBean.setSingleAction();
+end

Added: incubator/tuscany/java/sca/demos/workpool-distributed/workerRules2.drl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/workerRules2.drl?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/workerRules2.drl (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/workerRules2.drl Fri Mar 14 15:29:46 2008
@@ -0,0 +1,8 @@
+package workpool
+import workpool.*;
+rule "WorkerAverageService"
+	when 
+		$workerBean: WorkpoolBean(jobComputed > 250)
+	then
+		$workerBean.addWorkerToNode("nodeB");
+end

Added: incubator/tuscany/java/sca/demos/workpool-distributed/workerRules3.drl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/workpool-distributed/workerRules3.drl?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/demos/workpool-distributed/workerRules3.drl (added)
+++ incubator/tuscany/java/sca/demos/workpool-distributed/workerRules3.drl Fri Mar 14 15:29:46 2008
@@ -0,0 +1,14 @@
+package workpool
+import workpool.*;
+rule "AdaptUsageFactor"
+	when 
+		$workerBean: WorkpoolBean(usageFactor > 0.8)
+	then
+		$workerBean.addWorkerToNode("");
+end
+rule "AdaptQueueFull"
+	when
+		$workerBean: WorkpoolBean((estimedQueueSize > 1900) && jobsComputed > 100)
+	then	
+		$workerBean.addWorkerToNode("nodeB")
+end 
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/modules/contribution-updater/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 14 15:29:46 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Propchange: incubator/tuscany/java/sca/modules/contribution-updater-impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 14 15:29:46 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER (added)
+++ incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER Fri Mar 14 15:29:46 2008
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+

Propchange: incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-updater-impl/DISCLAIMER
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE (added)
+++ incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE Fri Mar 14 15:29:46 2008
@@ -0,0 +1,205 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+
+

Propchange: incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-updater-impl/LICENSE
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/tuscany/java/sca/modules/contribution-updater-impl/NOTICE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-updater-impl/NOTICE?rev=637297&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-updater-impl/NOTICE (added)
+++ incubator/tuscany/java/sca/modules/contribution-updater-impl/NOTICE Fri Mar 14 15:29:46 2008
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+



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