1   //
2   // Copyright (c) 2004, International Decision Systems
3   // all rights reserved
4   /*
5    * Copyright (c) 2005 Your Corporation. All Rights Reserved.
6    */
7   package net.sourceforge.addam.ddlrun.utils;
8   
9   import java.util.Map;
10  
11  import net.sourceforge.addam.ddlrun.utils.ResourceReader;
12  import net.sourceforge.addam.ddlrun.utils.ResourceReaderFactory;
13  
14  /**
15   * Used to retrieve a MockReader.
16   *
17   * @author TIM3
18   * @since Mar 5, 2005
19   */
20  public class MockReaderFactory implements ResourceReaderFactory {
21      public MockReaderFactory(Map contentMap) {
22          this.contentMap = contentMap;
23      }
24  
25      public ResourceReader getReader(String resource) {
26          return new MockReader(contentMap.get(resource).toString());
27      }
28  
29      public ResourceReader getReader(String path, String resource) {
30          return new MockReader(contentMap.get(path + "/" + resource).toString());
31      }
32  
33      private final Map contentMap; // used to map resources to contents
34  }