Changeset 7437


Ignore:
Timestamp:
12/17/10 13:22:31 (9 years ago)
Author:
aivar
Message:

Handles nested workflows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/deep-zoom-plugin/src/test/java/loci/workflow/TestComponentFactory.java

    r7430 r7437  
    66package loci.workflow; 
    77 
     8import loci.util.xml.XMLParser; 
     9import loci.util.xml.XMLException; 
     10import loci.util.xml.XMLTag; 
    811import java.util.HashMap; 
    912import java.util.Map; 
     
    1417 */ 
    1518public class TestComponentFactory implements IComponentFactory { 
    16     Map<String, IComponent> m_map = new HashMap<String, IComponent>(); 
     19    private static Map<String, IComponent> s_map = new HashMap<String, IComponent>(); 
    1720 
    18     public IComponent create(String xml) { 
    19         System.out.println("create [" + xml + "] " + m_map.get(xml)); 
    20         return m_map.get(xml); 
     21    public IComponent create(String xml) throws XMLException { 
     22        IComponent component = null; 
     23        XMLParser xmlHelper = new XMLParser(); 
     24        XMLTag tag = xmlHelper.getNextTagInclusive(xml); 
     25        if (WorkFlow.WORKFLOW.equals(tag.getName())) { 
     26            component = WorkFlowFactory.create(tag.getContent()); 
     27 
     28        } 
     29        else { //TODO if (WorkFlow.COMPONENT.equals(tag.getName())) { 
     30            component = s_map.get(xml); 
     31        } 
     32        //else { 
     33        //    throw new XMLException("Invalid tag " + tag.getName()); 
     34        //} 
     35        return component; 
    2136    } 
    2237 
    2338    void set(String xml, IComponent component) { 
    2439        System.out.println("put [" + xml + "] " + component.getName()); 
    25         m_map.put(xml, component); 
     40        s_map.put(xml, component); 
    2641    } 
    2742} 
Note: See TracChangeset for help on using the changeset viewer.