View Javadoc
1   /**
2    * 
3    */
4   package org.melati.app.test;
5   
6   import org.melati.util.test.StringInputStream;
7   import org.melati.Melati;
8   import org.melati.MelatiConfig;
9   import org.melati.app.TemplateApp;
10  import org.melati.login.AccessHandler;
11  import org.melati.login.CommandLineAccessHandler;
12  import org.melati.util.MelatiException;
13  
14  /**
15   * @author timp
16   *
17   */
18  public class ConfiguredTemplateApp extends TemplateApp {
19  
20    /**
21     * 
22     */
23    public ConfiguredTemplateApp() {
24      super();
25    }
26  
27    /**
28     * {@inheritDoc}
29     * @see org.melati.app.AbstractConfigApp#melatiConfig()
30     */
31    protected MelatiConfig melatiConfig() throws MelatiException {
32      MelatiConfig config = super.melatiConfig();
33  
34        try {
35          config.setAccessHandler(
36              (AccessHandler)CommandLineAccessHandler.class
37                  .newInstance());
38        } catch (Exception e) {
39          throw new RuntimeException(e);
40        }
41  
42  
43      return config;
44      
45    }
46  
47    /**
48     * {@inheritDoc}
49     * @see org.melati.app.AbstractTemplateApp#init(java.lang.String[])
50     */
51    public Melati init(String[] args) throws MelatiException {
52      Melati melati = super.init(args);
53      CommandLineAccessHandler ah = (CommandLineAccessHandler)melati.getConfig().getAccessHandler();
54      ah.setInput(new StringInputStream("_administrator_\nFIXME\n"));
55      return melati;
56      
57    }
58  
59  }