Package org.apache.pluto.om.entity

Examples of org.apache.pluto.om.entity.PortletApplicationEntity


        PortletWindow window = (PortletWindow)coplet.getAttribute("window");
        if ( window != null ) {
            coplet.removeAttribute("window");
            PortletDefinitionRegistry registry = (PortletDefinitionRegistry) environment.getContainerService(PortletDefinitionRegistry.class);
       
            PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
            ((PortletEntityListImpl)pae.getPortletEntityList()).remove(window.getPortletEntity());
        }
    }
View Full Code Here


            for ( int i=0; i < portletNames.length; ++i) {
                tokenizer =  new StringTokenizer(portletNames[i], "/");
                String appName = tokenizer.nextToken();
                String portletName = tokenizer.nextToken();
                appIt = entityList.iterator();
                PortletApplicationEntity appEntity = null;
                // search for application
                boolean found = false;
                while ( appIt.hasNext() && ! found ) {           
                    appEntity = (PortletApplicationEntity) appIt.next();
                    String displayName = appEntity.getPortletApplicationDefinition().getWebApplicationDefinition().getDisplayName(Locale.ENGLISH).getDisplayName();
                    if ( (displayName != null) && (displayName.equals(appName)) )
                      found = true;
                }
                if (!found) {
                    for (Iterator iter = definitionList.iterator(); !found && iter.hasNext();) {
                        PortletApplicationDefinition portletApp = (PortletApplicationDefinition)iter.next();
                        if (portletApp.getId().toString().equals(appName)) {
                            //PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)ControllerObjectAccess.get(entityList);
                            PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)entityList;
                            appEntity = appEntityListCtrl.add(portletApp.getId().toString());
                            log("added Portlet Application " + appName + " to PortletEntityRegistry");
                            found = true;
                        }
                    }
                }
                if ( !found ) {
                    log("Portlet Application "+appName+" not found!");
                    throw new ServletException("Portlet Application "+appName+" not found!");
                }
                portletIt = appEntity.getPortletEntityList().iterator();
                PortletEntity portlet = null;
                // search for portlet
                found = false;
                while ( portletIt.hasNext() && ! found ) {
                    portlet = (PortletEntity) portletIt.next();
                    PortletDefinition tmpPortletDef = portlet.getPortletDefinition();
                    if ( tmpPortletDef == null ) {
                      log("ERROR: Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                      log("       Portlet may not be defined in portlet.xml!");
                      throw new ServletException("Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                  }
                    String tmpPortletName = tmpPortletDef.getName();
                    //delete all existing preferences for this portlet entity
                    if (tmpPortletName != null && tmpPortletName.equals(portletName)) {
                        for (Iterator iter = portlet.getPreferenceSet().iterator(); iter.hasNext();) {
                            iter.next();
                            iter.remove();
                        }
                        found = true;
                    }
                }
                if (!found) {
                    for (Iterator appIter = definitionList.iterator(); !found && appIter.hasNext();) {
                        PortletApplicationDefinition appDef = (PortletApplicationDefinition)appIter.next();
                        if (appDef.getId().toString().equals(appName)) {
                            for (Iterator portletIter = appDef.getPortletDefinitionList().iterator(); !found && portletIter.hasNext();) {
                                PortletDefinition portletDef = (PortletDefinition)portletIter.next();
                                if (portletDef.getId().toString().equals(appName + "." + portletName)) {
                                    //PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)ControllerObjectAccess.get(appEntity.getPortletEntityList());
                                    PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)appEntity.getPortletEntityList();
                                    portlet = entityListCtrl.add(appEntity, portletDef.getId().toString());
                                    PortletEntityRegistry.refresh(portlet);
                                    log("added Portlet " + portletName + " to PortletEntityRegistry");
                                    found = true;
                                }
View Full Code Here

                PortletEntity entity = portletWindow.getPortletEntity();
                if (entity != null)
                {
                    entityID = entity.getId().toString();
                }
                PortletApplicationEntity portletAppEntity = portletWindow.getPortletEntity()
                        .getPortletApplicationEntity();
                PortletApplicationDefinition portletAppDef = entity.getPortletDefinition()
                        .getPortletApplicationDefinition();

                if (null != portletAppDef)
View Full Code Here

        final String portletEntityId = (String) getConfiguration(coplet, "portlet");
        if ( this.getLogger().isDebugEnabled() ) {
            this.getLogger().debug("Coplet " + coplet.getId() + " tries to login into portlet " + portletEntityId);
        }

        PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
        PortletEntity portletEntity = ((PortletEntityListImpl)pae.getPortletEntityList()).add(pae, portletEntityId, coplet, registry);

        if ( portletEntity.getPortletDefinition() != null ) {
            // create the window
            PortletWindow portletWindow = new PortletWindowImpl(portletEntityId);               
            ((PortletWindowCtrl)portletWindow).setId(coplet.getId());
            ((PortletWindowCtrl)portletWindow).setPortletEntity(portletEntity);
            PortletWindowList windowList = portletEntity.getPortletWindowList();       
            ((PortletWindowListCtrl)windowList).add(portletWindow);   
            coplet.setTemporaryAttribute("window", portletWindow);

            // load the portlet
            final Map objectModel = ContextHelper.getObjectModel(this.context);
            ServletRequestImpl  req = (ServletRequestImpl) objectModel.get("portlet-request");
            if ( req == null ) {
                final HttpServletResponse res = (HttpServletResponse) objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
                objectModel.put("portlet-response"new ServletResponseImpl(res));
                req = new ServletRequestImpl((HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT), null);
                objectModel.put("portlet-request",  req);               
            }
            final HttpServletResponse res = (HttpServletResponse) objectModel.get("portlet-response");
            try {
                this.portletContainer.portletLoad(portletWindow, req.getRequest(portletWindow)
                                                  res);
            } catch (Exception e) {
                this.getLogger().error("Error loading portlet " + portletEntityId + " for instance " + coplet.getId(), e);
                // remove portlet entity
                coplet.removeTemporaryAttribute("window");
                ((PortletEntityListImpl)pae.getPortletEntityList()).remove(portletEntity);
            }
        } else {
            this.getLogger().error("Error finding portlet " + portletEntityId + " for instance " + coplet.getId() + " - no definition found.");
        }
    }
View Full Code Here

        PortletWindow window = (PortletWindow)coplet.getTemporaryAttribute("window");
        if ( window != null ) {
            coplet.removeTemporaryAttribute("window");
            PortletDefinitionRegistry registry = (PortletDefinitionRegistry) portletContainerEnvironment.getContainerService(PortletDefinitionRegistry.class);

            PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
            ((PortletEntityListImpl)pae.getPortletEntityList()).remove(window.getPortletEntity());
        }
    }
View Full Code Here

    private void fill()
    {
        Iterator iterator = registry.iterator();
        while (iterator.hasNext())
        {
            PortletApplicationEntity appInst = (PortletApplicationEntity)iterator.next();

            // fill portletEntitiesKeyObjectID
            Iterator portlets = appInst.getPortletEntityList().iterator();
            while (portlets.hasNext())
            {
                PortletEntity portletInst = (PortletEntity)portlets.next();                               
                portletEntitiesKeyObjectID.put(portletInst.getId().toString(), portletInst);
View Full Code Here

            for ( int i=0; i < portletNames.length; ++i) {
                tokenizer =  new StringTokenizer(portletNames[i], "/");
                String appName = tokenizer.nextToken();
                String portletName = tokenizer.nextToken();
                appIt = entityList.iterator();
                PortletApplicationEntity appEntity = null;
                // search for application
                boolean found = false;
                while ( appIt.hasNext() && ! found ) {           
                    appEntity = (PortletApplicationEntity) appIt.next();
                    String displayName = appEntity.getPortletApplicationDefinition().getWebApplicationDefinition().getDisplayName(Locale.ENGLISH).getDisplayName();
                    if ( (displayName != null) && (displayName.equals(appName)) )
                      found = true;
                }
                if (!found) {
                    for (Iterator iter = definitionList.iterator(); !found && iter.hasNext();) {
                        PortletApplicationDefinition portletApp = (PortletApplicationDefinition)iter.next();
                        if (portletApp.getId().toString().equals(appName)) {
                            //PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)ControllerObjectAccess.get(entityList);
                            PortletApplicationEntityListCtrl appEntityListCtrl = (PortletApplicationEntityListCtrl)entityList;
                            appEntity = appEntityListCtrl.add(portletApp.getId().toString());
                            log("added Portlet Application " + appName + " to PortletEntityRegistry");
                            found = true;
                        }
                    }
                }
                if ( !found ) {
                    log("Portlet Application "+appName+" not found!");
                    throw new ServletException("Portlet Application "+appName+" not found!");
                }
                portletIt = appEntity.getPortletEntityList().iterator();
                PortletEntity portlet = null;
                // search for portlet
                found = false;
                while ( portletIt.hasNext() && ! found ) {
                    portlet = (PortletEntity) portletIt.next();
                    PortletDefinition tmpPortletDef = portlet.getPortletDefinition();
                    if ( tmpPortletDef == null ) {
                      log("ERROR: Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                      log("       Portlet may not be defined in portlet.xml!");
                      throw new ServletException("Portlet definition of portlet enity (id="+portlet.getId()+") not found!");
                  }
                    String tmpPortletName = tmpPortletDef.getName();
                    //delete all existing preferences for this portlet entity
                    if (tmpPortletName != null && tmpPortletName.equals(portletName)) {
                        for (Iterator iter = portlet.getPreferenceSet().iterator(); iter.hasNext();) {
                            iter.next();
                            iter.remove();
                        }
                        found = true;
                    }
                }
                if (!found) {
                    for (Iterator appIter = definitionList.iterator(); !found && appIter.hasNext();) {
                        PortletApplicationDefinition appDef = (PortletApplicationDefinition)appIter.next();
                        if (appDef.getId().toString().equals(appName)) {
                            for (Iterator portletIter = appDef.getPortletDefinitionList().iterator(); !found && portletIter.hasNext();) {
                                PortletDefinition portletDef = (PortletDefinition)portletIter.next();
                                if (portletDef.getId().toString().equals(appName + "." + portletName)) {
                                    //PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)ControllerObjectAccess.get(appEntity.getPortletEntityList());
                                    PortletEntityListCtrl entityListCtrl = (PortletEntityListCtrl)appEntity.getPortletEntityList();
                                    portlet = entityListCtrl.add(appEntity, portletDef.getId().toString());
                                    PortletEntityRegistry.refresh(portlet);
                                    log("added Portlet " + portletName + " to PortletEntityRegistry");
                                    found = true;
                                }
View Full Code Here

    public PortletApplicationEntity get(ObjectID objectId)
    {
        Iterator iterator = this.iterator();
        while (iterator.hasNext()) {
            PortletApplicationEntity portletApplicationEntity = (PortletApplicationEntity)iterator.next();
            if (portletApplicationEntity.getId().equals(objectId)) {
                return portletApplicationEntity;
            }
        }
        return null;
    }
View Full Code Here

    public PortletApplicationEntity get(String objectId)
    {
        Iterator iterator = this.iterator();
        while (iterator.hasNext()) {
            PortletApplicationEntity portletApplicationEntity = (PortletApplicationEntity)iterator.next();
            if (portletApplicationEntity.getId().toString().equals(objectId)) {
                return portletApplicationEntity;
            }
        }
        return null;
    }
View Full Code Here

        }
        PortletDefinitionRegistry registry = (PortletDefinitionRegistry) portletContainerEnvironment.getContainerService(PortletDefinitionRegistry.class);
       
        final String portletEntityId = (String) getConfiguration(coplet, "portlet");  
       
        PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
        PortletEntity portletEntity = ((PortletEntityListImpl)pae.getPortletEntityList()).add(pae, portletEntityId, coplet, registry);
       
        if ( portletEntity.getPortletDefinition() != null ) {
            // create the window
            PortletWindow portletWindow = new PortletWindowImpl(portletEntityId);               
            ((PortletWindowCtrl)portletWindow).setId(coplet.getId());
            ((PortletWindowCtrl)portletWindow).setPortletEntity(portletEntity);
            PortletWindowList windowList = portletEntity.getPortletWindowList();       
            ((PortletWindowListCtrl)windowList).add(portletWindow);   
            coplet.setTemporaryAttribute("window", portletWindow);
           
            // load the portlet
            final Map objectModel = ContextHelper.getObjectModel(this.context);
            ServletRequestImpl  req = (ServletRequestImpl) objectModel.get("portlet-request");
            if ( req == null ) {
                final HttpServletResponse res = (HttpServletResponse) objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
                objectModel.put("portlet-response"new ServletResponseImpl(res));
                req = new ServletRequestImpl((HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT), null);
                objectModel.put("portlet-request",  req);               
            }
            final HttpServletResponse res = (HttpServletResponse) objectModel.get("portlet-response");
            try {
                this.portletContainer.portletLoad(portletWindow, req.getRequest(portletWindow)
                                                  res);
            } catch (Exception e) {
                this.getLogger().error("Error loading portlet " + portletEntityId, e);
                // remove portlet entity
                coplet.removeTemporaryAttribute("window");
                ((PortletEntityListImpl)pae.getPortletEntityList()).remove(portletEntity);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.om.entity.PortletApplicationEntity

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.