portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r770789 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
Date Fri, 01 May 2009 18:58:45 GMT
Author: woonsan
Date: Fri May  1 18:58:44 2009
New Revision: 770789

URL: http://svn.apache.org/viewvc?rev=770789&view=rev
Log:
JS2-946: Applying Ruben de Gooijer's patch to enable portlet application lifecycle actions.
Cheers, Ruben! :)
Also, some code cleanups.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java?rev=770789&r1=770788&r2=770789&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
Fri May  1 18:58:44 2009
@@ -17,12 +17,16 @@
 package org.apache.jetspeed.portlets.prm;
 
 import java.io.NotSerializableException;
+import java.util.Locale;
 
 import org.apache.jetspeed.audit.AuditActivity;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.portlets.AdminPortletWebPage;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.ApplicationDataProvider.AppOrderBy;
 import org.apache.jetspeed.portlets.prm.PortletDataProvider.PortletOrderBy;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.jetspeed.tools.pamanager.PortletApplicationManagement;
 import org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager;
 import org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManagerResult;
@@ -59,52 +63,51 @@
 
     public static final String PORTLET_REGISTRY_MANAGER = "Portlet Registry Manager";
 
-    @SuppressWarnings({ "unchecked", "serial"})
     public ApplicationsListHome()
     {
         SearchForm form = new SearchForm("appSearchForm");
         add(form);
 
         // Construct Data View
-        final ApplicationDataProvider applicationDataProvider = new ApplicationDataProvider(this.getServiceLocator());
-        final PortletDataProvider portletListDataProvider = new PortletDataProvider("j2-admin",

-                getPortletRequest().getLocale(),
-                getServiceLocator());
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        final Locale locale = (((AbstractAdminWebApplication) getApplication()).getPortletRequest()).getLocale();
+        final ApplicationDataProvider applicationDataProvider = new ApplicationDataProvider(locator);
+        final PortletDataProvider portletListDataProvider = new PortletDataProvider("j2-admin",
locale, locator);
 
-        final DataView dataView = new DataView(APP_TABLE,
-                applicationDataProvider)
+        final DataView<ApplicationBean> dataView = new DataView<ApplicationBean>(APP_TABLE,
applicationDataProvider)
         {
+            private static final long serialVersionUID = 1L;
 
-            protected void populateItem(final Item item)
+            protected void populateItem(final Item<ApplicationBean> item)
             {
-                final ApplicationBean pa = (ApplicationBean) item
-                        .getModelObject();
-                Link nameLink = new Link("nameLink")
+                final ApplicationBean pa = item.getModelObject();
+                
+                Link<ApplicationBean> nameLink = new Link<ApplicationBean>("nameLink")
                 {
+                    private static final long serialVersionUID = 1L;
 
                     public void onClick()
                     {
-                        ApplicationsListHome home = (ApplicationsListHome) this
-                                .getPage();
-                        String appName = this.get("nameLabel")
-                                .getDefaultModelObjectAsString();
-
+                        String appName = this.get("nameLabel").getDefaultModelObjectAsString();
                         portletListDataProvider.changeAppName(appName);
 
                         try
                         {
-                            PortletMessaging
-                                    .publish(
-                                            home.getPortletRequest(),
-                                            ApplicationsListApplication.PRM_TOPIC,
-                                            ApplicationsListApplication.SELECTED_APPLICATION_EVENT,
-                                            pa);
-                        } catch (NotSerializableException e)
+                            PortletMessaging.publish(
+                                                     ((AbstractAdminWebApplication) getApplication()).getPortletRequest(),

+                                                     ApplicationsListApplication.PRM_TOPIC,

+                                                     ApplicationsListApplication.SELECTED_APPLICATION_EVENT,

+                                                     pa
+                                                     );
+                        }
+                        catch (NotSerializableException e)
                         {
+                            // TODO Auto-generated catch block
                             e.printStackTrace();
                         }
                     }
                 };
+                
                 nameLink.add(new Label("nameLabel", pa.getApplicationName()));
                 item.add(nameLink);
                 item.add(new Label("version", pa.getVersion()));
@@ -113,46 +116,62 @@
                 item.add(new ActionPanel("actions", item.getModel()));
             }
         };
-        dataView.setItemsPerPage(this.getPreferenceAsInteger("rows"));
+        
+        dataView.setItemsPerPage(((AbstractAdminWebApplication) getApplication()).getPreferenceValueAsInteger("rows"));
 
-        add(new OrderByLink("appOrderByName", "name", applicationDataProvider,
-                VoidCssProvider.getInstance())
+        add(new OrderByLink("appOrderByName", "name", applicationDataProvider, VoidCssProvider.getInstance())
         {
+            private static final long serialVersionUID = 1L;
 
             protected void onSortChanged()
             {
                 if (applicationDataProvider.getOrderBy() == AppOrderBy.NAME_ASC)
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.NAME_DESC);
+                }
                 else
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.NAME_ASC);
+                }
+                
                 dataView.setCurrentPage(0);
             }
         });
 
-        add(new OrderByLink("appOrderByVersion", "version",
-                applicationDataProvider, VoidCssProvider.getInstance())
+        add(new OrderByLink("appOrderByVersion", "version", applicationDataProvider, VoidCssProvider.getInstance())
         {
+            private static final long serialVersionUID = 1L;
 
             protected void onSortChanged()
             {
                 if (applicationDataProvider.getOrderBy() == AppOrderBy.VERSION_ASC)
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.VERSION_DESC);
+                }
                 else
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.VERSION_ASC);
+                }
+                
                 dataView.setCurrentPage(0);
             }
         });
 
-        add(new OrderByLink("appOrderByPath", "path", applicationDataProvider,
-                VoidCssProvider.getInstance())
+        add(new OrderByLink("appOrderByPath", "path", applicationDataProvider, VoidCssProvider.getInstance())
         {
+            private static final long serialVersionUID = 1L;
 
             protected void onSortChanged()
             {
                 if (applicationDataProvider.getOrderBy() == AppOrderBy.PATH_ASC)
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.PATH_DESC);
+                }
                 else
+                {
                     applicationDataProvider.setOrderBy(AppOrderBy.PATH_ASC);
+                }
+                
                 dataView.setCurrentPage(0);
             }
         });
@@ -163,26 +182,31 @@
         feedback.setEscapeModelStrings(false);
         add(feedback);
 
-        final DataView portletListView = new DataView(PORTLET_TABLE,
-                portletListDataProvider)
+        final DataView<PortletDefinitionBean> portletListView = new DataView<PortletDefinitionBean>(PORTLET_TABLE,
portletListDataProvider)
         {
+            private static final long serialVersionUID = 1L;
 
-            protected void populateItem(final Item item)
+            protected void populateItem(final Item<PortletDefinitionBean> item)
             {
-                final PortletDefinitionBean portletDefinitionBean = (PortletDefinitionBean)
item.getModelObject();
+                final PortletDefinitionBean portletDefinitionBean = item.getModelObject();
 
-                Link link = new Link("nameLink", item.getModel())
+                Link<PortletDefinitionBean> link = new Link<PortletDefinitionBean>("nameLink",
item.getModel())
                 {
+                    private static final long serialVersionUID = 1L;
 
                     @Override
                     public void onClick()
                     {
                         try
                         {
-                            PortletMessaging
-                            .publish(getPortletRequest(), ApplicationsListApplication.PRM_TOPIC,
-                                    ApplicationsListApplication.SELECTED_PORTLET_EVENT, portletDefinitionBean);
-                        } catch (NotSerializableException e)
+                            PortletMessaging.publish(
+                                                     ((AbstractAdminWebApplication) getApplication()).getPortletRequest(),
+                                                     ApplicationsListApplication.PRM_TOPIC,
+                                                     ApplicationsListApplication.SELECTED_PORTLET_EVENT,
+                                                     portletDefinitionBean
+                                                     );
+                        } 
+                        catch (NotSerializableException e)
                         {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
@@ -200,14 +224,19 @@
 
         add(new OrderByBorder("plOrderByName", "name", portletListDataProvider)
         {
+            private static final long serialVersionUID = 1L;
 
             protected void onSortChanged()
             {
                 if (portletListDataProvider.getOrderBy() == PortletOrderBy.NAME_ASC)
-                    portletListDataProvider
-                            .setOrderBy(PortletOrderBy.NAME_DESC);
+                {
+                    portletListDataProvider.setOrderBy(PortletOrderBy.NAME_DESC);
+                }
                 else
+                {
                     portletListDataProvider.setOrderBy(PortletOrderBy.NAME_ASC);
+                }
+                
                 dataView.setCurrentPage(0);
             }
         });
@@ -216,245 +245,260 @@
         add(new PagingNavigator("plNavigator", portletListView));
     }
 
-    @SuppressWarnings("serial")
     class RunningPanel extends Panel
     {
+        private static final long serialVersionUID = 1L;
 
         public RunningPanel(String id, final IModel<ApplicationBean> model)
         {
             super(id, model);
             ApplicationBean pa = (ApplicationBean) model.getObject();
+            
             if (pa.isRunning())
             {
-                add(new Image("running", new ResourceReference(
-                        ApplicationsListHome.class, "running.gif"))
-                {
-                });
-            } else
+                add(new Image("running", new ResourceReference(ApplicationsListHome.class,
"running.gif")));
+            }
+            else
             {
-                add(new Image("running", new ResourceReference(
-                        ApplicationsListHome.class, "stop.gif"))
-                {
-                });
+                add(new Image("running", new ResourceReference(ApplicationsListHome.class,
"stop.gif")));
             }
         }
     }
 
-    @SuppressWarnings("serial")
     class ActionPanel extends Panel
     {
+        private static final long serialVersionUID = 1L;
 
+        @Override
+        protected void onBeforeRender()
+        {
+            ApplicationBean pab = (ApplicationBean) getDefaultModelObject();
+            
+            final JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+            PortletApplication pa = locator.getPortletRegistry().getPortletApplication(pab.getApplicationName());
+            ApplicationServerManager asm = locator.getApplicationServerManager();
+            
+            boolean isRunning = locator.getPortletFactory().isPortletApplicationRegistered(pa);
+            boolean isLocal = pa.getApplicationType() == PortletApplication.LOCAL;
+            boolean isAdmin = (pa.getContextPath().equals(((AbstractAdminWebApplication)
getApplication()).getPortletRequest().getContextPath()));
+
+            get("start").setVisible(
+                                    (asm != null && !isRunning) && !(isLocal
|| isAdmin)
+                                    );
+
+            get("stop").setVisible(
+                                   (asm != null && isRunning) && !(isLocal
|| isAdmin)
+                                   );
+
+            get("undeploy").setVisible(
+                                       (asm != null && !isRunning) && !(isLocal
|| isAdmin)
+                                       );
+
+            get("delete").setVisible(
+                                     !(isLocal || isAdmin) && !isRunning
+                                     );
+            
+            super.onBeforeRender();
+        }
+        
         /**
          * @param id
          *            component id
          * @param model
          *            model for contact
          */
-        @SuppressWarnings("unchecked")
-        public ActionPanel(String id, final IModel model)
+        public ActionPanel(String id, final IModel<ApplicationBean> model)
         {
             super(id, model);
-            ApplicationsListHome home = ApplicationsListHome.this;
-            ApplicationBean pab = (ApplicationBean) model.getObject();
-            PortletApplication pa = home.getServiceLocator()
-                    .getPortletRegistry().getPortletApplication(pab.getApplicationName());
-            ApplicationServerManager asm = home.getServiceLocator()
-                    .getApplicationServerManager();
-            boolean isLocal = pa.getApplicationType() == PortletApplication.LOCAL;
-            boolean isAdmin = (pa.getContextPath().equals(home
-                    .getPortletRequest().getContextPath()));
-            Link start = new Link("start")
+            
+            Link<String> start = new Link<String>("start")
             {
-
+                private static final long serialVersionUID = 1L;
+                
                 public void onClick()
                 {
-                    ApplicationsListHome home = (ApplicationsListHome) this
-                            .getPage();
+                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                    PortletRegistry registry = locator.getPortletRegistry();
+                    ApplicationServerManager asm = locator.getApplicationServerManager();
+                    AuditActivity auditActivity = locator.getAuditActivity();
+
                     ApplicationBean pab = (ApplicationBean) model.getObject();
-                    PortletApplication pa = home.getServiceLocator()
-                            .getPortletRegistry().getPortletApplication(
-                                    pab.getApplicationName());
-                    ApplicationServerManager asm = home.getServiceLocator()
-                            .getApplicationServerManager();
-                    FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
+                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
+                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
+                    
                     if (isServerReady(asm, feed, "start", pa, pab))
                     {
                         try
                         {
-                            ApplicationServerManagerResult result = asm
-                                    .start(pa.getContextPath());
+                            ApplicationServerManagerResult result = asm.start(pa.getContextPath());
+                            
                             if (!result.isOk())
                             {
-                                throw new Exception(
-                                        getString("appServerNotConfigured"));
-                            } else
+                                throw new Exception(getString("appServerNotConfigured"));
+                            }
+                            else
                             {
-                                feed.info(messageSubstition("startOK",
-                                        new String[]
-                                        { "path"}, new Object[]
-                                        { pab.getPath()}));
-                                home.getServiceLocator().getAuditActivity()
-                                        .logAdminRegistryActivity(
-                                                getAuthenticatedUsername(),
-                                                getIPAddress(),
-                                                AuditActivity.REGISTRY_START,
-                                                PORTLET_REGISTRY_MANAGER);
+                                feed.info(messageSubstition(
+                                                            "startOK",
+                                                            new String[] { "path" }, 
+                                                            new Object[] { pab.getPath()
} ));
+                                auditActivity.logAdminRegistryActivity(
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getUserPrincipalName(),
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getIPAddress(),
+                                                                       AuditActivity.REGISTRY_START,
+                                                                       PORTLET_REGISTRY_MANAGER
+                                                                       );
                             }
-                        } catch (Exception e)
+                        }
+                        catch (Exception e)
                         {
                             feed.error(messageSubstition("startFailure",
-                                    new String[]
-                                    { "path", "msg"}, new Object[]
-                                    { pab.getPath(), e.getMessage()}));
+                                                         new String[] { "path", "msg" },
+                                                         new Object[] { pab.getPath(), e.getMessage()}
));
                         }
                     }
                 }
             };
-            start.setVisible((asm != null && !pab.isRunning())
-                    && !(isLocal || isAdmin));
-            Link stop = new Link("stop")
+
+            Link<String> stop = new Link<String>("stop")
             {
+                private static final long serialVersionUID = 1L;
 
                 public void onClick()
                 {
-                    ApplicationsListHome home = (ApplicationsListHome) this
-                            .getPage();
+                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                    PortletRegistry registry = locator.getPortletRegistry();
+                    ApplicationServerManager asm = locator.getApplicationServerManager();
+                    AuditActivity auditActivity = locator.getAuditActivity();
+
                     ApplicationBean pab = (ApplicationBean) model.getObject();
-                    PortletApplication pa = home.getServiceLocator()
-                            .getPortletRegistry().getPortletApplication(
-                                    pab.getApplicationName());
-                    ApplicationServerManager asm = home.getServiceLocator()
-                            .getApplicationServerManager();
-                    FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
+                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
+                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
+                    
                     if (isServerReady(asm, feed, "stop", pa, pab))
                     {
                         try
                         {
-                            ApplicationServerManagerResult result = asm.stop(pa
-                                    .getContextPath());
+                            ApplicationServerManagerResult result = asm.stop(pa.getContextPath());
+                            
                             if (!result.isOk())
                             {
-                                throw new Exception(
-                                        getString("appServerNotConfigured"));
-                            } else
+                                throw new Exception(getString("appServerNotConfigured"));
+                            }
+                            else
                             {
                                 feed.info(messageSubstition("stopOK",
-                                        new String[]
-                                        { "path"}, new Object[]
-                                        { pab.getPath()}));
-                                home.getServiceLocator().getAuditActivity()
-                                        .logAdminRegistryActivity(
-                                                getAuthenticatedUsername(),
-                                                getIPAddress(),
-                                                AuditActivity.REGISTRY_STOP,
-                                                PORTLET_REGISTRY_MANAGER);
+                                                            new String[] { "path" }, 
+                                                            new Object[] { pab.getPath()
} ));
+                                
+                                auditActivity.logAdminRegistryActivity(
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getUserPrincipalName(),
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getIPAddress(),
+                                                                       AuditActivity.REGISTRY_STOP,
+                                                                       PORTLET_REGISTRY_MANAGER
+                                                                       );
                             }
-                        } catch (Exception e)
+                        }
+                        catch (Exception e)
                         {
                             feed.error(messageSubstition("stopFailure",
-                                    new String[]
-                                    { "path", "msg"}, new Object[]
-                                    { pab.getPath(), e.getMessage()}));
+                                                         new String[] { "path", "msg" },

+                                                         new Object[] { pab.getPath(), e.getMessage()
} ));
                         }
                     }
                 }
             };
-            stop.setVisible((asm != null && pab.isRunning())
-                    && !(isLocal || isAdmin));
-            Link undeploy = new Link("undeploy")
+            
+            Link<String> undeploy = new Link<String>("undeploy")
             {
+                private static final long serialVersionUID = 1L;
 
                 public void onClick()
                 {
-                    ApplicationsListHome home = (ApplicationsListHome) this
-                            .getPage();
+                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                    PortletRegistry registry = locator.getPortletRegistry();
+                    ApplicationServerManager asm = locator.getApplicationServerManager();
+                    AuditActivity auditActivity = locator.getAuditActivity();
+
                     ApplicationBean pab = (ApplicationBean) model.getObject();
-                    PortletApplication pa = home.getServiceLocator()
-                            .getPortletRegistry().getPortletApplication(
-                                    pab.getApplicationName());
-                    ApplicationServerManager asm = home.getServiceLocator()
-                            .getApplicationServerManager();
-                    FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
+                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
+                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
+                    
                     if (isServerReady(asm, feed, "undeploy", pa, pab))
                     {
                         try
                         {
-                            ApplicationServerManagerResult result = asm
-                                    .undeploy(pa.getContextPath());
+                            ApplicationServerManagerResult result = asm.undeploy(pa.getContextPath());
+                            
                             if (!result.isOk())
                             {
-                                throw new Exception(
-                                        getString("appServerNotConfigured"));
-                            } else
+                                throw new Exception(getString("appServerNotConfigured"));
+                            } 
+                            else
                             {
                                 feed.info(messageSubstition("undeployOK",
-                                        new String[]
-                                        { "path"}, new Object[]
-                                        { pab.getPath()}));
-                                home
-                                        .getServiceLocator()
-                                        .getAuditActivity()
-                                        .logAdminRegistryActivity(
-                                                getAuthenticatedUsername(),
-                                                getIPAddress(),
-                                                AuditActivity.REGISTRY_UNDEPLOY,
-                                                PORTLET_REGISTRY_MANAGER);
+                                                            new String[] { "path" }, 
+                                                            new Object[] { pab.getPath()}
));
+
+                                auditActivity.logAdminRegistryActivity(
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getUserPrincipalName(),
+                                                                       ((AbstractAdminWebApplication)
getApplication()).getIPAddress(),
+                                                                       AuditActivity.REGISTRY_UNDEPLOY,
+                                                                       PORTLET_REGISTRY_MANAGER
+                                                                       );
                             }
-                        } catch (Exception e)
+                        } 
+                        catch (Exception e)
                         {
                             feed.error(messageSubstition("undeployFailure",
-                                    new String[]
-                                    { "path", "msg"}, new Object[]
-                                    { pab.getPath(), e.getMessage()}));
+                                                         new String[] { "path", "msg" },

+                                                         new Object[] { pab.getPath(), e.getMessage()
} ));
                         }
                     }
                 }
             };
-            undeploy.setVisible((asm != null && !pab.isRunning())
-                    && !(isLocal || isAdmin));
-            Link del = new Link("delete")
+
+            Link<String> del = new Link<String>("delete")
             {
+                private static final long serialVersionUID = 1L;
 
                 public void onClick()
                 {
-                    ApplicationsListHome home = (ApplicationsListHome) this
-                            .getPage();
+                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                    PortletRegistry registry = locator.getPortletRegistry();
+                    ApplicationServerManager asm = locator.getApplicationServerManager();
+                    AuditActivity auditActivity = locator.getAuditActivity();
+                    PortletApplicationManagement pam = locator.getPortletApplicationManager();
+
                     ApplicationBean pab = (ApplicationBean) model.getObject();
-                    PortletApplication pa = home.getServiceLocator()
-                            .getPortletRegistry().getPortletApplication(
-                                    pab.getApplicationName());
-                    ApplicationServerManager asm = home.getServiceLocator()
-                            .getApplicationServerManager();
-                    PortletApplicationManagement pam = home.getServiceLocator()
-                            .getPortletApplicationManager();
-                    FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
-                    if (isServerReady(asm, feed, "remove from registry", pa,
-                            pab))
+                    PortletApplication pa = registry.getPortletApplication(pab.getApplicationName());
+                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
+                    
+                    if (isServerReady(asm, feed, "remove from registry", pa, pab))
                     {
                         try
                         {
                             pam.unregisterPortletApplication(pa.getName());
                             feed.info(messageSubstition("deleteOK",
-                                    new String[]
-                                    { "path"}, new Object[]
-                                    { pab.getPath()}));
-                            home.getServiceLocator().getAuditActivity()
-                                    .logAdminRegistryActivity(
-                                            getAuthenticatedUsername(),
-                                            getIPAddress(),
-                                            AuditActivity.REGISTRY_DELETE,
-                                            PORTLET_REGISTRY_MANAGER);
-                        } catch (Exception e)
+                                                        new String[] { "path" }, 
+                                                        new Object[] { pab.getPath() } ));
+                            auditActivity.logAdminRegistryActivity(
+                                                                   ((AbstractAdminWebApplication)
getApplication()).getUserPrincipalName(),
+                                                                   ((AbstractAdminWebApplication)
getApplication()).getIPAddress(),
+                                                                   AuditActivity.REGISTRY_DELETE,
+                                                                   PORTLET_REGISTRY_MANAGER
+                                                                   );
+                        }
+                        catch (Exception e)
                         {
                             feed.error(messageSubstition("deleteFailure",
-                                    new String[]
-                                    { "path", "msg"}, new Object[]
-                                    { pab.getPath(), e.getMessage()}));
+                                                         new String[] { "path", "msg" },

+                                                         new Object[] { pab.getPath(), e.getMessage()}
));
                         }
                     }
                 }
             };
-            del.setVisible(!(isLocal || isAdmin) && !pab.isRunning());
+
             add(start);
             add(stop);
             add(undeploy);
@@ -462,75 +506,74 @@
         }
     }
 
-    protected boolean isServerReady(ApplicationServerManager asm,
-            FeedbackPanel feedback, String operation, PortletApplication pa,
-            ApplicationBean pab)
+    protected boolean isServerReady( ApplicationServerManager asm,
+                                     FeedbackPanel feedback, 
+                                     String operation, 
+                                     PortletApplication pa,
+                                     ApplicationBean pab )
     {
         if (pa == null)
         {
-            feedback.error(messageSubstition("serverReadyFailure", new String[]
-            { "path", "operation"}, new Object[]
-            { pab.getPath(), operation}));
+            feedback.error(messageSubstition("serverReadyFailure", 
+                                             new String[] { "path", "operation" }, 
+                                             new Object[] { pab.getPath(), operation } ));
             return false;
-        } else if (asm == null || !asm.isConnected())
+        } 
+        else if (asm == null || !asm.isConnected())
         {
-            feedback.error(messageSubstition("serverNotAvailable", new String[]
-            { "path", "operation"}, new Object[]
-            { pab.getPath(), operation}));
+            feedback.error(messageSubstition("serverNotAvailable", 
+                                             new String[] { "path", "operation" }, 
+                                             new Object[] { pab.getPath(), operation }));
             return false;
         }
+        
         return true;
     }
 
-    @SuppressWarnings(
-    { "unchecked", "serial"})
     private class SearchForm extends Form<Void>
     {
-
+        private static final long serialVersionUID = 1L;
+        
         private String appSearchField;
 
         public SearchForm(String name)
         {
             super(name);
 
-            add(new TextField("appSearchField", new PropertyModel(this,
-                    "appSearchField")));
+            add(new TextField("appSearchField", new PropertyModel(this, "appSearchField")));
+            
             add(new Button("appSearchButton", new ResourceModel("search"))
             {
-
                 @Override
                 public void onSubmit()
                 {
-                    DataView view = (DataView) this.getParent().getParent()
-                            .get(APP_TABLE);
-                    ApplicationDataProvider dp = (ApplicationDataProvider) view
-                            .getDataProvider();
+                    DataView view = (DataView) getPage().get(APP_TABLE);
+                    ApplicationDataProvider dp = (ApplicationDataProvider) view.getDataProvider();
                     dp.searchApplications(getAppSearchField());
                 }
             });
-            add(new Link("appDeploy")
+            
+            add(new Link<String>("appDeploy")
             {
+                private static final long serialVersionUID = 1L;
 
                 @Override
                 public void onClick()
                 {
-                    ApplicationsListHome home = (ApplicationsListHome) this
-                            .getPage();
-                    UploadPortletApp upa = new UploadPortletApp(home
-                            .getServiceLocator().getDeploymentManager());
+                    UploadPortletApp upa = new UploadPortletApp((((AbstractAdminWebApplication)
getApplication()).getServiceLocator().getDeploymentManager()));
                     this.setResponsePage(upa);
                 }
             });
-            add(new Link("appHome")
+            
+            add(new Link<String>("appHome")
             {
+                private static final long serialVersionUID = 1L;
 
                 @Override
                 public void onClick()
                 {
-                    DataView view = (DataView) this.getParent().getParent()
-                            .get(APP_TABLE);
-                    ApplicationDataProvider dp = (ApplicationDataProvider) view
-                            .getDataProvider();
+                    DataView<ApplicationBean> view = (DataView<ApplicationBean>)
getPage().get(APP_TABLE);
+                    ApplicationDataProvider dp = (ApplicationDataProvider) view.getDataProvider();
                     dp.setSearchMode(false);
                     dp.refresh();
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message