Changeset 3161

Show
Ignore:
Timestamp:
03/06/10 15:42:39 (2 years ago)
Author:
romain.reuillon
Message:

ui enhancement

Location:
trunk/openmole
Files:
5 modified
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/openmole/core/org.openmole.core.workflow.implementation/src/main/java/org/openmole/core/workflow/implementation/mole/execution/MoleExecution.java

    r3147 r3161  
    1717package org.openmole.core.workflow.implementation.mole.execution; 
    1818 
     19import com.db4o.CorruptionException; 
    1920import java.util.ArrayList; 
    2021import java.util.Collection; 
    2122import java.util.Collections; 
     23import java.util.LinkedList; 
    2224import java.util.Map; 
    2325import java.util.TreeMap; 
     
    212214        getSubmiter().interrupt(); 
    213215 
    214         for(IMoleJob moleJob : allMoleJobs()) { 
     216        for(IMoleJob moleJob : getAllMoleJobsInternal()) { 
    215217            moleJob.cancel(); 
    216218        } 
     
    226228    } 
    227229 
    228     public Iterable<IMoleJob> allMoleJobs() { 
     230 
     231    private Iterable<IMoleJob> getAllMoleJobsInternal() { 
    229232        return inProgress.keySet(); 
    230233    } 
    231234 
     235    @Override 
     236    public synchronized Iterable<IMoleJob> getAllMoleJobs() { 
     237        Collection<IMoleJob> ret = new LinkedList<IMoleJob>(); 
     238 
     239        for(IMoleJob moleJob : getAllMoleJobsInternal()) { 
     240            ret.add(moleJob); 
     241        } 
     242 
     243        return ret; 
     244    } 
    232245 
    233246    @Override 
  • trunk/openmole/core/org.openmole.core.workflow.model/src/main/java/org/openmole/core/workflow/model/mole/execution/IMoleExecution.java

    r3147 r3161  
    5959 
    6060    IExecutionContext getExecutionContext(); 
     61 
     62    Iterable<IMoleJob> getAllMoleJobs(); 
    6163} 
  • trunk/openmole/misc/org.openmole.misc.tools/src/main/java/org/openmole/misc/tools/structure/Counter.java

    r3149 r3161  
    2222 * @author Romain Reuillon <romain.reuillon at openmole.org> 
    2323 */ 
    24 public class Counter { 
     24public class Counter implements Comparable<Counter> { 
    2525 
    26     int value; 
     26    Integer value; 
    2727 
    2828    public Counter() { 
     
    4242    } 
    4343 
    44     public int getValue() { 
     44    public Integer getValue() { 
    4545        return value; 
    4646    } 
    4747 
    48      public void increment(int val) { 
     48     public void increment(Integer val) { 
    4949        value+=val; 
    5050    } 
     
    5454    } 
    5555 
     56    @Override 
     57    public String toString() { 
     58        return getValue().toString(); 
     59    } 
     60 
     61    @Override 
     62    public boolean equals(Object obj) { 
     63        if (obj == null) { 
     64            return false; 
     65        } 
     66        if (getClass() != obj.getClass()) { 
     67            return false; 
     68        } 
     69        final Counter other = (Counter) obj; 
     70        if (this.getValue() != other.getValue() && (this.getValue() == null || !this.getValue().equals(other.getValue()))) { 
     71            return false; 
     72        } 
     73        return true; 
     74    } 
     75 
     76    @Override 
     77    public int hashCode() { 
     78        int hash = this.getValue().hashCode(); 
     79        return hash; 
     80    } 
     81 
     82 
     83 
     84    public int compareTo(Counter intgr) { 
     85        return getValue().compareTo(intgr.getValue()); 
     86    } 
     87 
     88 
     89 
     90 
     91 
    5692} 
  • trunk/openmole/ui/org.openmole.ui.console/src/main/java/org/openmole/ui/console/Application.java

    r3159 r3161  
    99import org.openmole.misc.workspace.ForbidenPasswordProvider; 
    1010import org.openmole.ui.console.internal.Activator; 
    11 import org.openmole.ui.console.internal.command.Echo; 
     11import org.openmole.ui.console.internal.command.Print; 
    1212import org.openmole.ui.console.internal.command.Ppasswd; 
    1313//import org.openmole.core.execution.environmentprovider.glite.GliteEnvironment; 
     
    3535        Groovysh g = new Groovysh(Groovy.class.getClassLoader(), binding, new IO()); 
    3636 
    37         g.leftShift(new Echo(g,"echo", "\\ec")); 
    38         g.leftShift(new Ppasswd(g,"ppwd", "\\ppwd")); 
     37        g.leftShift(new Print(g,"print", "\\pr")); 
     38        g.leftShift(new Ppasswd(g,"ppasswd", "\\pp")); 
    3939 
    4040        g.run(); 
  • trunk/openmole/ui/org.openmole.ui.console/src/main/java/org/openmole/ui/console/internal/command/Print.java

    r3149 r3161  
    2222import org.codehaus.groovy.tools.shell.Shell; 
    2323import org.openmole.core.workflow.model.execution.IEnvironment; 
     24import org.openmole.core.workflow.model.mole.execution.IMoleExecution; 
    2425import org.openmole.misc.tools.service.HierarchicalRegistry; 
    2526import org.openmole.ui.console.internal.viewer.EnvironmentViewer; 
    2627import org.openmole.ui.console.internal.viewer.IViewer; 
     28import org.openmole.ui.console.internal.viewer.MoleExecutionViewer; 
    2729 
    2830/** 
     
    3032 * @author Romain Reuillon <romain.reuillon at openmole.org> 
    3133 */ 
    32 public class Echo extends CommandSupport { 
     34public class Print extends CommandSupport { 
    3335 
    3436    private HierarchicalRegistry<IViewer> viewers = new HierarchicalRegistry<IViewer>(); 
    3537 
    3638 
    37     public Echo(Shell shell, String string, String string1) { 
     39    public Print(Shell shell, String string, String string1) { 
    3840        super(shell, string, string1); 
    3941        viewers.register(IEnvironment.class, new EnvironmentViewer()); 
     42        viewers.register(IMoleExecution.class, new MoleExecutionViewer()); 
    4043    } 
    4144 
  • trunk/openmole/ui/org.openmole.ui.console/src/main/java/org/openmole/ui/console/internal/viewer/EnvironmentViewer.java

    r3149 r3161  
    4848 
    4949        for(ExecutionState state : ExecutionState.values()) { 
    50             System.out.println(state.getLabel() + ": " + accounting.get(state).getValue()); 
     50            System.out.println(state.getLabel() + ": " + accounting.get(state)); 
    5151        } 
    5252 

logo cemagref

logo iscpif

logo lifegrid

logo region auvergne

logo patres project