Package org.apache.jetspeed.om.common.portlet

Examples of org.apache.jetspeed.om.common.portlet.MutablePortletApplication


        String msg = "Failed to create PA WAR for " + contextName;
        log.error(msg, e);
        throw new RegistryException(msg, e);
      }

      MutablePortletApplication pa = (MutablePortletApplication) registry
        .getPortletApplication(contextName);

      if ((pa != null) && (paWar.getPortletApplicationChecksum() == pa.getChecksum()))
      {
                portletFactory.unregisterPortletApplication(pa);
      }
      else
      {
View Full Code Here


  }

  protected void stopPA(String contextName)
    throws RegistryException
  {
    MutablePortletApplication pa = null;
       
        try
        {
            pa = (MutablePortletApplication) registry.getPortletApplication(contextName);
        }
View Full Code Here

  {
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        try
        {
            MutablePortletApplication pa = null;
           
            try
            {
                pa = (MutablePortletApplication) registry.getPortletApplication(paName);
            }
View Full Code Here

    {
      unregisterPortletApplication(oldPA, false);
      oldPA = null;
    }

    MutablePortletApplication pa     = null;
    boolean            registered = false;
    String            paName     = paWar.getPortletApplicationName();

    try
    {
      log.info("Loading portlet.xml...." + paName);
      pa = paWar.createPortletApp();

      if (local)
      {
        pa.setApplicationType(MutablePortletApplication.LOCAL);
      }
      else
      {
        pa.setApplicationType(MutablePortletApplication.WEBAPP);
      }

      // load the web.xml
      log.info("Loading web.xml...." + paName);
      MutableWebApplication wa = paWar.createWebApp();
      paWar.validate();

      if (local)
      {
        wa.setContextRoot("<portal>");
      }

      pa.setWebApplicationDefinition(wa);
    }
    catch (Exception e)
    {
      String msg = "Failed to load portlet application for "
        + paWar.getPortletApplicationName();
      log.error(msg);
      throw new RegistryException(msg);
    }

    // register the portlet application
    try
    {
      registry.registerPortletApplication(pa);
      registered = true;
      log.info("Registered the portlet application " + paName);

      // add to search engine result
      if (searchEngine != null)
      {
        searchEngine.add(pa);
        searchEngine.add(pa.getPortletDefinitions());
        log.info("Registered the portlet application in the search engine... " + paName);
      }
           
            if ( autoCreateRoles && roleManager != null && pa.getWebApplicationDefinition().getSecurityRoles() != null )
            {
                try
                {
                    Iterator rolesIter = pa.getWebApplicationDefinition().getSecurityRoles().iterator();
                    SecurityRole sr;
                    while ( rolesIter.hasNext() )
                    {
                        sr = (SecurityRole)rolesIter.next();
                        if ( !roleManager.roleExists(sr.getRoleName()) )
View Full Code Here

       
        String paName = (String)
            request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA,
                                             PortletSession.APPLICATION_SCOPE);
       
        MutablePortletApplication pa = registry.getPortletApplication(paName);
       
        if (null != pa)
        {
            request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
           
            String pdefName = (String) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
            PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
           
            request.setAttribute(VIEW_PD, pdef);
           
            request.setAttribute("tabs", paTabMap.values());
            request.setAttribute("portlet_tabs", pdTabMap.values());
View Full Code Here

                        processMetadataAction(actionRequest, actionResponse, paName, pdefName, action);
                    }
                    else if(action.endsWith("portlet"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processPortletAction(actionRequest, actionResponse, pa, pdef, action);
                    }
                    else if(action.endsWith("preference"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processPreferenceAction(actionRequest, actionResponse, pa, pdef, action);
                    }
                    else if(action.endsWith("language"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processLanguage(actionRequest, actionResponse, pa, pdef, action);
                    }
                    else if(action.endsWith("parameter"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processParameter(actionRequest, actionResponse, pa, pdef, action);
                    }
                    else if(action.endsWith("security"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processSecurity(actionRequest, actionResponse, pa, pdef, action);
                    }
                    else if(action.endsWith("content_type"))
                    {

                        MutablePortletApplication pa = registry.getPortletApplication(paName);                                       

                        PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                       
                        processContentType(actionRequest, actionResponse, pa, pdef, action);
                    }
                }
                catch (RegistryException e)
View Full Code Here

        if(action.equals("edit_user_attribute"))
        {
            String userAttrName = "";
            try
            {
                MutablePortletApplication mpa = registry.getPortletApplication(paName);
                boolean modified = false;
                Iterator userAttrIter = mpa.getUserAttributes().iterator();
                while (userAttrIter.hasNext())
                {
                    UserAttribute userAttr = (UserAttribute) userAttrIter.next();
                   
                    userAttrName = userAttr.getName();
                    String description = actionRequest.getParameter(userAttrName + ":description");
                    if(!userAttr.getDescription().equals(description))
                    {
                        userAttr.setDescription(description);
                        modified = true;
                    }
                }
                if (modified)
                {
                    registry.updatePortletApplication(mpa);
                }
            }
            catch (RegistryException e)
            {
                throw new PortletException("Failed update user attribute: " + userAttrName, e);
               
            }
        }
        else if(action.equals("add_user_attribute"))
        {
            String userAttrName = actionRequest.getParameter("user_attr_name");
            String userAttrDesc = actionRequest.getParameter("user_attr_desc");
            if (userAttrName != null && userAttrName.trim().length() > 0)               
            {
                try
                {
                    MutablePortletApplication mpa = registry.getPortletApplication(paName);
                   
                    mpa.addUserAttribute(userAttrName, userAttrDesc);               
                   
                    registry.updatePortletApplication(mpa);
                }
                catch (RegistryException e)
                {
                    throw new PortletException("Failed add user attribute: " + userAttrName, e);                   
                }
            }
        }
        else if(action.equals("remove_user_attribute"))
        {
            String[] userAttrNames = actionRequest.getParameterValues("user_attr_id");
           
            if(userAttrNames != null)
            {
                String userAttrName = "";
                try
                {
                    int count = 0;
                    MutablePortletApplication mpa = registry.getPortletApplication(paName);
                    Iterator userAttrIter = mpa.getUserAttributes().iterator();
                    while (userAttrIter.hasNext())
                    {
                        UserAttribute userAttr = (UserAttribute) userAttrIter.next();
                        for(int ix = 0; ix < userAttrNames.length; ix++)
                        {
View Full Code Here

                                       String  paName,
                                       String  pdName,
                                       String action)
    throws PortletException, IOException
    {
        MutablePortletApplication pa = registry.getPortletApplication(paName);
        if (pa == null)
        {
            return;
        }       
        PortletDefinitionComposite pd = null;
        GenericMetadata meta = null;               
        if (pdName != null)
        {
            pd = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdName);
            if (pd != null)
            {
                meta = pd.getMetadata();
            }
            else
            {
                return;
            }
        }
        else
        {
            meta = pa.getMetadata();
        }
        if (meta == null)
        {
            return;
        }
View Full Code Here

      {
          control.selectNode(selectedNode);
          TreeControlNode child = control.findNode(selectedNode);
          if(child != null)
          {
              MutablePortletApplication pa = null;
             
            String domain = child.getDomain();
            if(domain.equals("PA_APP_DOMAIN"))
            {
                pa = registry.getPortletApplicationByIdentifier(selectedNode);
                if(pa != null)
                {
                    actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
                }
            }
            else if(domain.equals("PD_DOMAIN"))
            {
                TreeControlNode parent = child.getParent();
                  pa = registry.getPortletApplicationByIdentifier(parent.getName());
                 
                  //set selected tab to portlets tab
                  if(pa != null)
                  {
                      //TODO:  do we need to look up the pdef?  Could we just pass the child name into setAttribute?
                      String pdefName = child.getName().substring(pa.getName().length() + 2); //remove pa prefix
                      PortletDefinition pdef = pa.getPortletDefinitionByName(pdefName);
                      actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, pdef.getName(), PortletSession.APPLICATION_SCOPE);
                      actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, new TabBean("pa_portlets"), PortletSession.APPLICATION_SCOPE);
                  }
            }
            else
            {
                //warn about not recognized domain
            }
           
            if (pa != null)
                {
                    actionRequest.getPortletSession().setAttribute(PortletApplicationResources.PAM_CURRENT_PA, pa.getName(), PortletSession.APPLICATION_SCOPE);
                }
          }
      }
    }
  }
View Full Code Here

    root.addChild(portletApps);
   
    Iterator it = apps.iterator();
        while (it.hasNext())
        {
            MutablePortletApplication pa = (MutablePortletApplication)it.next();
            TreeControlNode appNode = new TreeControlNode(pa.getName(),
                                                          null,
                                                          pa.getName(),
                                                          PortletApplicationResources.PORTLET_URL,
                                                          null,
                                                          false,
                                                          "PA_APP_DOMAIN"  );
            portletApps.addChild(appNode);
           
            Iterator pdefIter = pa.getPortletDefinitionList().iterator();
            while (pdefIter.hasNext())
            {
                PortletDefinitionComposite portlet = (PortletDefinitionComposite) pdefIter.next();
                TreeControlNode portletNode = new TreeControlNode(pa.getName() + "::" + portlet.getName(),
                                                                  null,
                                                                  portlet.getDisplayNameText(locale),
                                                                  PortletApplicationResources.PORTLET_URL,
                                                                  null,
                                                                  false,
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.common.portlet.MutablePortletApplication

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.