Package org.apache.jetspeed.portlets

Examples of org.apache.jetspeed.portlets.JetspeedServiceLocator


        @Override
        protected void onBeforeRender()
        {
            ApplicationBean pab = (ApplicationBean) getDefaultModelObject();
           
            final JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
            ApplicationServerManager asm = locator.getApplicationServerManager();
            PortletApplication pa = locator.getPortletRegistry().getPortletApplication(pab.getApplicationName());
           
            boolean isRunning = (pa != null && locator.getPortletFactory().isPortletApplicationRegistered(pa));
            boolean isLocal = (pa != null && pa.getApplicationType() == PortletApplication.LOCAL);
            boolean isAdmin = ((pa != null) && (pa.getContextPath().equals(((AbstractAdminWebApplication) getApplication()).getPortletRequest().getContextPath())));

            get("start").setVisible(
                                    (asm != null && !isRunning) && !(isLocal || isAdmin)
View Full Code Here


            {
                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, "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");
                   
View Full Code Here

                    PortletDefinitionBean pdb = (PortletDefinitionBean) model.getObject();
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    try
                    {
                        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                        PortletRegistry registry = locator.getPortletRegistry();
                        PortletDefinition def = registry.getPortletDefinitionByUniqueName(pdb.getUniqueName());

                        CloneModalWindow modalWindow = (CloneModalWindow) getPage().get("modalwindow");
                        RequestContext rc = ((AbstractAdminWebApplication) getApplication()).getPortalRequestContext();
                        final String pagePath = rc.getPortalURL().getBasePath() + clonePopupPagePath + "?portlet=" + def.getUniqueName();
                        modalWindow.setPageCreator(new ModalWindow.PageCreator()
                        {
                            private static final long serialVersionUID = 1L;

                            public Page createPage()
                            {
                                return new RedirectPage(pagePath);
                            }
                        });
                        ((ApplicationsListHome) getPage()).setCurrentModalWindowCloseScript(modalWindow.getCloseJavacript());
                        target.addComponent(getPage().get("modalWindowCloseScript"));
                        modalWindow.show(target);
                    }
                    catch (Exception e)
                    {
                        logger.error("Failed to remove a cloned portlet, {}. {}", pdb.getUniqueName(), e);
                        StringResourceModel resModel = new StringResourceModel("pam.details.action.status.clonePortletFailure", this, null, new Object [] { pdb.getUniqueName(), e.getMessage() } );
                        feed.error(resModel.getString());
                    }
                }
            };

            add(clone);
           
            Link<String> del = new Link<String>("delete")
            {
                private static final long serialVersionUID = 1L;

                public void onClick()
                {
                    PortletDefinitionBean pdb = (PortletDefinitionBean) model.getObject();
                    FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");
                   
                    try
                    {
                        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
                        PortletRegistry registry = locator.getPortletRegistry();
                        PortletDefinition def = registry.getPortletDefinitionByUniqueName(pdb.getUniqueName());
                       
                        if (def != null && def.isClone()) {
                            registry.removeClone(def);
                           
View Full Code Here

    public DetailsPanel(String id, final PortletApplicationNodeBean paNodeBean)
    {
        super(id);

        detailList = new ArrayList<KeyVal>();
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
       
        detailList.add(new KeyVal("Name", app.getName()));
        detailList.add(new KeyVal("Version", app.getVersion()));
        detailList.add(new KeyVal("Description", getDescription(app)));
        detailList.add(new KeyVal("Type", getType(app)));
View Full Code Here

        form.add(new TextField<Integer>("expirationCache", new PropertyModel<Integer>(this, "expirationCache")));
        form.add(new Label("uniqueName", definition.getUniqueName()));
        form.add(new Label("preferenceValidator", definition.getPreferenceValidatorClassname()));
        form.add(new Label("className", definition.getPortletClass()));
       
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
       
        form.add(new LocalizedDisplayNameEditor("localizationEditor", locator, paNodeBean)
        {

            @Override
View Full Code Here

   
    public JetspeedServiceLocator getServiceLocator()
    {
        if (serviceLocator == null)
        {
            serviceLocator = new JetspeedServiceLocator();
        }
       
        return serviceLocator;
    }
View Full Code Here

    public DetailsPanel(String id, final PortletApplicationNodeBean paNodeBean)
    {
        super(id);

        detailList = new ArrayList<KeyVal>();
        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
       
        detailList.add(new KeyVal("Name", app.getName()));
        detailList.add(new KeyVal("Version", app.getVersion()));
        detailList.add(new KeyVal("Description", getDescription(app)));
        detailList.add(new KeyVal("Type", getType(app)));
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.portlets.JetspeedServiceLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.