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

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


        List list = new LinkedList();
        Iterator portlets = registry.getAllPortletDefinitions().iterator();
        while ( portlets.hasNext() )
        {
            PortletDefinitionComposite portlet = (PortletDefinitionComposite)portlets.next();
            MutablePortletApplication muta = (MutablePortletApplication)portlet.getPortletApplicationDefinition();
            String appName = muta.getName();
            if ( appName == null )
                continue;
            if ( ! appName.equals( "jetspeed-layouts" ) )
                continue;
View Full Code Here


    /* (non-Javadoc)
     * @see org.apache.pluto.factory.PortletInvokerFactory#getPortletInvoker(org.apache.pluto.om.portlet.PortletDefinition)
     */
    public PortletInvoker getPortletInvoker(PortletDefinition portletDefinition)
    {
        MutablePortletApplication app = (MutablePortletApplication)portletDefinition.getPortletApplicationDefinition();
        if(app == null)
        {
          throw new IllegalStateException("Portlet definition \""+portletDefinition.getName()+"\" is not assigned to a portlet application.");
        }
       
        if (app.getApplicationType() == MutablePortletApplication.LOCAL)
        {
            LocalPortletInvoker localPortletInvoker = localPortletInvokerFactory.createInstance();
            localPortletInvoker.activate(portletFactory, portletDefinition, servletConfig);
            return localPortletInvoker;          
        }
View Full Code Here

        {
            log.debug(PortletRequest.USER_INFO + " is set to null");
            return null;
        }

        MutablePortletApplication pa = registry.getPortletApplication(oid);
        if (null == pa)
        {
            log.debug(PortletRequest.USER_INFO + " is set to null");
            return null;
        }
        Preferences userInfoPrefs = userPrefs.node(userInfoPropertySet);
        Collection userAttributes = pa.getUserAttributes();
        Collection userAttributeRefs = pa.getUserAttributeRefs();
        Map userInfoMap = mapUserInfo(userInfoPrefs, userAttributes, userAttributeRefs);

        return userInfoMap;
    }
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(paClassLoader);

      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);
           
            // Make sure existing entities are refreshed with the most
            // recent PortletDefintion.
            Collection portletDefs = pa.getPortletDefinitions();
            if(portletDefs != null && portletDefs.size() > 0)
            {
                Iterator pdItr = portletDefs.iterator();
                while(pdItr.hasNext())
                {
                    PortletDefinition pd = (PortletDefinition) pdItr.next();
                    Collection portletEntites = entityAccess.getPortletEntities(pd);
                    if(portletEntites != null && portletEntites.size() > 0)
                    {
                        Iterator peItr = portletEntites.iterator();
                        while(peItr.hasNext())
                        {
                            PortletEntityCtrl portletEntity = (PortletEntityCtrl) peItr.next();
                            portletEntity.setPortletDefinition(pd);
                        }
                    }
                }
            }
    }
    catch (Exception e)
    {
      String msg = "Failed to load portlet application for "
        + paWar.getPortletApplicationName();
      log.error(msg, e);
      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
      this.updateSearchEngine(false, pa);
     
      // and add to the current node info
      nodeManager.addNode(new Long(pa.getId().toString()), pa.getName());
           
            // grant default permissions to portlet application
      grantDefaultPermissions(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

                    throw new RegistryException(e);
                }
                register = false;
            }

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

            if (pa != null)
            {
                if ( pa.getApplicationType() != getApplicationType(local) )
                {
                    if ( local )
                    {
                        throw new RegistryException("Cannot start local portlet application "+contextName+": it is not a local application");
                    }
                    else
                    {
                        throw new RegistryException("Cannot start portlet application "+contextName+": it is a local application");
                    }                   
                }
                DescriptorChangeMonitor changeMonitor = this.monitor;
                if (!monitored && changeMonitor != null)
                {
                    changeMonitor.remove(contextName);
                }
                portletFactory.unregisterPortletApplication(pa);                       
            }
//            if (register && (pa == null || checksum != pa.getChecksum()))
            if (register)
            {
              if (pa == null)
              {
                // new
                  try
                  {
                      pa = registerPortletApplication(paWar, pa, local, paClassLoader);
                  }
                  catch (Exception e)
                  {
                      // don't register the pa
                      register = false;
                  }
              }
              else
              {
                int status = nodeManager.checkNode(new Long(pa.getId().toString()), pa.getName());
              boolean reregister = false;
              boolean deploy = false;
              switch (status)
              {
                case  NodeManager.NODE_NEW:
                {
                    //only reason is that the file got somehow corrupted
                    // so we really do not know what is going on here...
                    // the best chance at this point is to reregister (which might be the absolute wrong choice)
                    log.warn("The portlet application " + pa.getName() + " is registered in the database but not locally .... we will reregister");
                    reregister = true;
                  if (checksum != pa.getChecksum())
                  {
                        log.warn("The provided portlet application " + pa.getName() + " is a different version than in the database (db-checksum=" + pa.getChecksum() + ", local-checksum=: " + checksum + ") .... we will redeploy (also to the database)");
                  deploy = true;
                  }
                  break;
                }
                case  NodeManager.NODE_SAVED:
                {
                  if (checksum != pa.getChecksum())
                        { 
                        log.warn("The provided portlet application " + pa.getName() + " is a different version than in the local node info and the database (db-checksum=" + pa.getChecksum() + ", local-checksum=: " + checksum + ") .... we will reregister AND redeploy (also to the database)");
                    //database and local node info are in synch, so we assume that this is a brand new
                    // war .... let's deploy
                    reregister = true;
                    deploy = true;
                        }
                  break;
                }
                case  NodeManager.NODE_OUTDATED:
                {
                    //database version is older (determined by id) than the database
                  //let's deploy and reregister
                  if (checksum != pa.getChecksum())
                        log.error("The portlet application " + pa.getName() + " provided for the upgrade IS WRONG. The database checksum= " + pa.getChecksum() + ", but the local=" + checksum + "....THIS NEEDS TO BE CORRECTED");
                   reregister = true;
                  break;
                }
              }
              if (deploy)
                      pa = registerPortletApplication(paWar, pa, local, paClassLoader);
              else
                if (reregister)
                {
                  // add to search engine result
                  this.updateSearchEngine(true, pa);
                  this.updateSearchEngine(false, pa);
                 
                  // and add to the current node info
                  try
                  {
                    nodeManager.addNode(new Long(pa.getId().toString()), pa.getName());
                  } catch (Exception e)
                  {
                    log.error("Adding node for portlet application " + pa.getName() + " caused exception" , e);
                  }
                }
               
             
              }
View Full Code Here

    public MutablePortletApplication getPortletApplication( ObjectID id )
    {
        Criteria c = new Criteria();
        c.addEqualTo("id", new Long(id.toString()));
        MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
                QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
        postLoad(app);
        return app;
    }
View Full Code Here

    public MutablePortletApplication getPortletApplication(String name)
    {
        Criteria c = new Criteria();
        c.addEqualTo("name", name);
        MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
                QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
        postLoad(app);
        return app;
    }
View Full Code Here

    public MutablePortletApplication getPortletApplicationByIdentifier( String identifier )
    {
        Criteria c = new Criteria();
        c.addEqualTo("applicationIdentifier", identifier);
        MutablePortletApplication app = (MutablePortletApplication) getPersistenceBrokerTemplate().getObjectByQuery(
            QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c));
        postLoad(app);
        return app;
    }
View Full Code Here

        try
        {
            Map userInfoMap = new HashMap();
            Subject subject = context.getSubject();
            MutablePortletApplication pa = portletRegistry
                    .getPortletApplication(oid);
//System.out.println("*** PA = " + pa);           
            if (null == pa)
            {
                log.debug(PortletRequest.USER_INFO + " is set to null");
                return null;
            }
            Collection userAttributes = pa.getUserAttributes();
            Collection userAttributeRefs = pa.getUserAttributeRefs();
            Collection linkedUserAttributes = mapLinkedUserAttributes(
                    userAttributes, userAttributeRefs);
            for (Iterator iter = sources.iterator(); iter.hasNext();)
            {
                UserAttributeSource source = (UserAttributeSource) iter.next();
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.