Package org.apache.pluto.container.om.portlet

Examples of org.apache.pluto.container.om.portlet.PortletApplicationDefinition


        if (applicationName.length() > 0 )
        {
            applicationName = applicationName.substring(1);
        }
        try {
      PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
            Iterator customModes = portletApp.getCustomPortletModes().iterator();
            while (customModes.hasNext()) {
        CustomPortletModeType customMode = (CustomPortletModeType)customModes.next();
        boolean isPortletManagedMode = !customMode.isPortalManaged();
        if (isPortletManagedMode && customMode.getPortletMode().equalsIgnoreCase(mode)) {
          return true;
View Full Code Here


            if (portletRegistry == null) {
                LOG.error("Optional Portlet Registry Service not found.");
                throw new PortletContainerException("Optional Portlet Registry Service not found.");
            }
            PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
            Iterator i =  portletApp.getPortlets().iterator();
            while(i.hasNext()) {
                PortletDefinition dd = (PortletDefinition)i.next();
                if(portletName.equals(dd.getPortletName())) {
                    Iterator i2 = dd.getSupports().iterator();
                    while(i2.hasNext()) {
View Full Code Here

      .append(xmlBegin168).append(portlet168)
      .append(attrs168).append(xmlEnd);
     
          InputStream in = new ByteArrayInputStream(xml286.toString().getBytes());
         
      PortletApplicationDefinition portletApp286 = jaxb.read("test", "/test", in);
     
      in = new ByteArrayInputStream(xml168.toString().getBytes());
      PortletApplicationDefinition portletApp168 = jaxb.read("test", "/test", in);
     
      // test if portlet has the right params:
     
      // test jsr168 compliant portlets
      PortletDefinition portlet168 = (PortletDefinition)portletApp168.getPortlets().get(0);
      assertTrue(portlet168.getExpirationCache()==50);
      assertEquals(portlet168.getPortletName(),"portlet168");
      assertEquals(portlet168.getInitParams().get(0).getParamValue(),"value");
      assertEquals(portlet168.getSecurityRoleRefs().get(0).getRoleLink(), "role-link");
      assertEquals(portletApp168.getCustomPortletModes().get(0).getPortletMode(), "portlet-mode");
      assertEquals(portletApp168.getCustomWindowStates().get(0).getWindowState(), "window-state");
      assertEquals(portletApp168.getUserAttributes().get(0).getName(), "name" );
      assertEquals(portletApp168.getSecurityConstraints().get(0).getPortletNames().get(0), "portlet-name");
      assertEquals(portlet168.getExpirationCache(), 50);
      // id (isn't supported yet)
//      assertFalse(portletApp.getId().equals("id2"));
//      assertTrue(portletApp.getId().equals("id1"));
     
View Full Code Here

    }
    }

    public void testParseNoExpirationCache168() throws IOException {
        InputStream inputStream = new ByteArrayInputStream(portlet168NoCache.toString().getBytes());
        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );

        assertEquals( "1.0", portletDD.getVersion() );
        assertEquals( 1, portletDD.getPortlets().size() );

        PortletDefinition pd = (PortletDefinition) portletDD.getPortlets().get( 0 );
        assertEquals( pd.getExpirationCache(), 0 );
    }
View Full Code Here

        assertEquals( pd.getExpirationCache(), 0 );
    }

    public void testParseNoExpirationCache286() throws IOException {
        InputStream inputStream = new ByteArrayInputStream(portlet286NoCache.toString().getBytes());
        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );

        assertEquals( "2.0", portletDD.getVersion() );
        assertEquals( 1, portletDD.getPortlets().size() );

        PortletDefinition pd = (PortletDefinition) portletDD.getPortlets().get( 0 );
        assertEquals( pd.getExpirationCache(), 0 );
    }
View Full Code Here

      String contextPath = getContextPath(servletContext);
        String applicationName = contextPath.substring(1);
        if (!portletContexts.containsKey(applicationName)) {
          PortletDescriptorRegistry portletRegistry = PortletDescriptorRegistry.getRegistry();

            PortletApplicationDefinition portletApp = portletRegistry.getPortletAppDD(servletContext, applicationName, contextPath);

            DriverPortletContext portletContext = new DriverPortletContextImpl(servletContext, portletApp, rdService);

            portletContexts.put(applicationName, portletContext);

            fireRegistered(portletContext);

            if (LOG.isInfoEnabled()) {
                LOG.info("Registered portlet application for context '/" + applicationName + "'");

                LOG.info("Registering "+portletApp.getPortlets().size()+" portlets for context /"+portletContext.getApplicationName());
            }

            classLoaders.put(portletApp.getName(), Thread.currentThread().getContextClassLoader());
            for (PortletDefinition portlet: portletApp.getPortlets()) {
                String appName = portletContext.getApplicationName();
                if (appName == null) {
                    throw new PortletContainerException("Portlet application name should not be null.");
                }
                portletConfigs.put(
View Full Code Here

     * @return The portlet application deployment descriptor.
     * @throws PortletContainerException if the descriptor can not be found or parsed
     */
    public PortletApplicationDefinition getPortletAppDD(ServletContext servletContext, String name, String contextPath)
    throws PortletContainerException {
        PortletApplicationDefinition portletApp = cache.get(servletContext);
        if (portletApp == null) {
          portletApp = createDefinition(servletContext, name, contextPath);
            cache.put(servletContext, portletApp);
        }
        return portletApp;
View Full Code Here

     * @return the Portlet Application Deployment Descriptor.
     * @throws PortletContainerException
     */
    private PortletApplicationDefinition createDefinition(ServletContext servletContext, String name, String contextPath)
    throws PortletContainerException {
        PortletApplicationDefinition portletApp = null;
        try {
            InputStream paIn = servletContext.getResourceAsStream(PORTLET_XML);
            InputStream webIn = servletContext.getResourceAsStream(WEB_XML);
            if (paIn == null) {
                throw new PortletContainerException("Cannot find '" + PORTLET_XML +
View Full Code Here

    }

    private void loadApplicationPrivileges(PortletRegistryEvent evt) throws RepositoryException {
        // we must now register the namespace for the portlet, as well as refresh the privileges, to make sure
        // we load all the privileges attached to portlets.
        final PortletApplicationDefinition portletApplication = evt.getPortletApplication();
        String applicationName = portletApplication.getName();
        if (applicationName.startsWith("/")) {
            applicationName = applicationName.substring(1);
        }
        final String appName = applicationName;

        JCRTemplate.getInstance().doExecuteWithSystemSession(new JCRCallback<Object>() {
            public Object doInJCR(JCRSessionWrapper session) throws RepositoryException {
                // first we register the namespaces.

                JCRContentUtils.registerNamespace(session, getWebAppPrefix(appName), getWebAppNamespaceURI(appName));

                List<? extends PortletDefinition> portlets = portletApplication.getPortlets();
                for (PortletDefinition portlet : portlets) {
                    JCRContentUtils.registerNamespace(session, getEntryPointPrefix(appName, portlet.getPortletName()), getEntryPointNamespaceURI(appName, portlet.getPortletName()));
                }

                // now let's reload the privileges
View Full Code Here

            String applicationName = contextPath;
            if (applicationName.length() >0 )
            {
                applicationName = applicationName.substring(1);
            }
      PortletApplicationDefinition portletAppDD = null;
      try {
        portletAppDD = portletRegistry.getPortletApplication(applicationName);
        List<? extends PortletDefinition> portletDDs = portletAppDD.getPortlets();
        List<QName> aliases = getAllAliases(eventName, portletAppDD);
        for (PortletDefinition portletDD : portletDDs) {
          List<? extends EventDefinitionReference> processingEvents = portletDD.getSupportedProcessingEvents();
          if (isEventSupported(processingEvents, eventName, portletAppDD.getDefaultNamespace())) {
                        if (portletDD.getPortletName().equals(portlet.getPortletName())) {
                                                          resultSet.add(portlet.getId());
                        }
          } else {

            if (processingEvents != null) {
              for (EventDefinitionReference ref : processingEvents) {
                  QName name = ref.getQualifiedName(portletAppDD.getDefaultNamespace());
                  if (name == null)
                  {
                      continue;
                  }
                // add also grouped portlets, that ends with "."
                if (name.toString().endsWith(".")
                    && eventName.toString().startsWith(name.toString())
                    && portletDD.getPortletName().equals(portlet.getPortletName())) {
                  resultSet.add(portlet.getId());
                }
                // also look for alias names:
                if (aliases != null) {
                  for (QName alias : aliases) {
                    if (alias.toString().equals(name.toString())
                        && portletDD.getPortletName().equals(portlet.getPortletName())) {
                      resultSet.add(portlet.getId());
                    }
                  }
                }
                // also look for default namespaced events
                if (name.getNamespaceURI() == null || name.getNamespaceURI().equals("")) {
                  String defaultNamespace = portletAppDD.getDefaultNamespace();
                  QName qname = new QName(defaultNamespace, name.getLocalPart());
                  if (eventName.toString().equals(qname.toString())
                      && portletDD.getPortletName().equals(portlet.getPortletName())) {
                    resultSet.add(portlet.getId());
                  }
View Full Code Here

TOP

Related Classes of org.apache.pluto.container.om.portlet.PortletApplicationDefinition

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.