public void onClick()
{
JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
PortletRegistry registry = locator.getPortletRegistry();
ApplicationServerManager asm = locator.getApplicationServerManager();
AuditActivity auditActivity = locator.getAuditActivity();
ApplicationBean pab = (ApplicationBean) model.getObject();
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());
if (!result.isOk())
{
throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
}
else
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startOK", this, null, new Object [] { pab.getPath() } );
feed.info(resModel.getString());
auditActivity.logAdminRegistryActivity(
((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
((AbstractAdminWebApplication) getApplication()).getIPAddress(),
AuditActivity.REGISTRY_START,
PORTLET_REGISTRY_MANAGER
);
}
}
catch (Exception e)
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.startFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
feed.error(resModel.getString());
}
}
}
};
Link<String> stop = new Link<String>("stop")
{
private static final long serialVersionUID = 1L;
public void onClick()
{
JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
PortletRegistry registry = locator.getPortletRegistry();
ApplicationServerManager asm = locator.getApplicationServerManager();
AuditActivity auditActivity = locator.getAuditActivity();
ApplicationBean pab = (ApplicationBean) model.getObject();
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());
if (!result.isOk())
{
throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
}
else
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopOK", this, null, new Object [] { pab.getPath() } );
feed.info(resModel.getString());
auditActivity.logAdminRegistryActivity(
((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
((AbstractAdminWebApplication) getApplication()).getIPAddress(),
AuditActivity.REGISTRY_STOP,
PORTLET_REGISTRY_MANAGER
);
}
}
catch (Exception e)
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.stopFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
feed.error(resModel.getString());
}
}
}
};
Link<String> undeploy = new Link<String>("undeploy")
{
private static final long serialVersionUID = 1L;
public void onClick()
{
JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
PortletRegistry registry = locator.getPortletRegistry();
ApplicationServerManager asm = locator.getApplicationServerManager();
AuditActivity auditActivity = locator.getAuditActivity();
ApplicationBean pab = (ApplicationBean) model.getObject();
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());
if (!result.isOk())
{
throw new Exception(getString("pam.details.action.status.appServerNotConfigured"));
}
else
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployOK", this, null, new Object [] { pab.getPath() } );
feed.info(resModel.getString());
auditActivity.logAdminRegistryActivity(
((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
((AbstractAdminWebApplication) getApplication()).getIPAddress(),
AuditActivity.REGISTRY_UNDEPLOY,
PORTLET_REGISTRY_MANAGER
);
}
}
catch (Exception e)
{
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.undeployFailure", this, null, new Object [] { pab.getPath(), e.getMessage() } );
feed.error(resModel.getString());
}
}
}
};
Link<String> del = new Link<String>("delete")
{
private static final long serialVersionUID = 1L;
public void onClick()
{
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 = registry.getPortletApplication(pab.getApplicationName());
FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
if (isServerReady(asm, feed, "remove from registry", pa, pab))
{
try
{
pam.unregisterPortletApplication(pa.getName());
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.deleteOK", this, null, new Object [] { pab.getPath() } );
feed.info(resModel.getString());
auditActivity.logAdminRegistryActivity(
((AbstractAdminWebApplication) getApplication()).getUserPrincipalName(),
((AbstractAdminWebApplication) getApplication()).getIPAddress(),
AuditActivity.REGISTRY_DELETE,
PORTLET_REGISTRY_MANAGER
);