View Javadoc

1   package org.astrogrid.portal.registry;
2   
3   import org.apache.avalon.framework.parameters.Parameters;
4   import org.apache.cocoon.acting.AbstractAction;
5   import org.apache.cocoon.environment.Request;
6   import org.apache.cocoon.environment.Session;
7   import org.apache.cocoon.environment.Redirector;
8   import org.apache.cocoon.environment.SourceResolver;
9   import org.apache.cocoon.environment.ObjectModelHelper;
10  import java.util.Map;
11  import java.util.HashMap;
12  import java.util.ArrayList;
13  import java.util.LinkedHashMap;
14  import java.io.File;
15  import org.astrogrid.registry.client.admin.RegistryAdminService;
16  import org.astrogrid.registry.client.RegistryDelegateFactory;
17  
18  /***
19   * Main Options component to let the user determine the next course of action which are Query, Add, or Harvest new
20   * registry entry.
21   *
22   */
23  public class RegistryStatusAction extends AbstractAction
24  {
25     /***
26      * Switch for our debug statements.
27      *
28      */
29     public static boolean DEBUG_FLAG = true;
30     
31     private static final String PARAM_STATUS = "Status";   
32     
33     /***
34      * Cocoon param for the user param in the session.
35      *
36      */
37     private static final String PARAM_ACTION = "action";
38     
39     
40     /***
41      * Our action method.
42      *
43      */
44     public Map act(
45        Redirector redirector, 
46        SourceResolver resolver, 
47        Map objectModel, 
48        String source, 
49        Parameters params)
50        {
51        
52        //
53        // Get our current request and session.
54        Request request = ObjectModelHelper.getRequest(objectModel);
55        Session session = request.getSession();
56  
57        RegistryAdminService ras = RegistryDelegateFactory.createAdmin();
58        String status = ras.getCurrentStatus();
59        request.setAttribute(PARAM_STATUS,status);
60  
61        //
62        //Create a new HashMap for our results.  Will be used to
63        //pass to the transformer (xsl page)
64        Map results = new HashMap();
65        return results;
66     }
67  
68  }