Package org.apache.pluto.descriptors.portlet

Examples of org.apache.pluto.descriptors.portlet.PortletDD


        assertNotNull( "Portlet Application Descriptor was null.", portletApp );
        assertTrue( "Portlet Application Descriptor doesn't define any portlets.", portletApp.getPortlets().size() > 0 );
        assertTrue( "Web Application Descriptor doesn't define any servlets.", webApp.getServlets().size() > 0 );
        assertTrue( "Web Application Descriptor doesn't define any servlet mappings.", webApp.getServletMappings().size() > 0 );

        PortletDD portlet = (PortletDD) portletApp.getPortlets().iterator().next();
        assertTrue( "Unable to retrieve test portlet named [" + testPortletName + "]", portlet.getPortletName().equals( testPortletName ) );

        ServletDD servlet = webApp.getServlet( testPortletName );
        assertNotNull( "Unable to retrieve portlet dispatch for portlet named [" + testPortletName + "]", servlet );       
        assertEquals( "Dispatcher servlet incorrect for test portlet [" + testPortletName + "]",  Assembler.DISPATCH_SERVLET_CLASS, servlet.getServletClass() );
    }
View Full Code Here


    public String register(ServletConfig config) throws PortletContainerException {
        InternalPortletContext portletContext = register(config.getServletContext());

        PortletAppDD portletAppDD =
            portletContext.getPortletApplicationDefinition();
        PortletDD portletDD = null;

        LOG.info("Registering "+portletAppDD.getPortlets().size()+" portlets for context "+portletContext.getApplicationId());

        for (Iterator it = portletAppDD.getPortlets().iterator(); it.hasNext();) {
            portletDD = (PortletDD) it.next();
            portletConfigs.put(
                portletContext.getApplicationId() + "/" + portletDD.getPortletName(),
                new PortletConfigImpl(config, portletContext, portletDD)
            );
        }

        return portletContext.getApplicationId();
View Full Code Here

        PortletAppDD dd = service.read(in);
        assertEquals("1.0", dd.getVersion());
        assertEquals(1, dd.getPortlets().size());

        PortletDD pd = (PortletDD)dd.getPortlets().get(0);
        assertEquals(2, pd.getDisplayNames().size());
        assertEquals(1, pd.getDescriptions().size());
        assertEquals("About Portlet", ((DisplayNameDD)pd.getDisplayNames().get(0)).getDisplayName());
        assertEquals("en", ((DisplayNameDD)pd.getDisplayNames().get(0)).getLang());
        assertEquals("fr", ((DisplayNameDD)pd.getDisplayNames().get(1)).getLang());
        assertEquals(30, pd.getExpirationCache());
        assertEquals(1, pd.getSupportedLocales().size());
        assertEquals("en", pd.getSupportedLocales().get(0));
        assertEquals(1, pd.getInitParams().size());
        assertEquals(1, ((InitParamDD)pd.getInitParams().get(0)).getDescriptions().size());

        assertEquals(2, dd.getCustomPortletModes().size());
        assertEquals(2, dd.getCustomWindowStates().size());
        assertEquals(1, dd.getUserAttributes().size());
        assertEquals(1, dd.getSecurityConstraints().size());
View Full Code Here

        // supported by a portlet, even if not defined in the descriptor
        if (mode.equals(PortletMode.VIEW)) {
            return true;
        }

        PortletDD dd = internalPortletWindow.getPortletEntity()
            .getPortletDefinition();
        Iterator supports = dd.getSupports().iterator();
        while(supports.hasNext()) {
            SupportsDD support = (SupportsDD)supports.next();
            Iterator modes = support.getPortletModes().iterator();
            while(modes.hasNext()) {
                String md = (String)modes.next();
View Full Code Here

     * @return true if the content type is valid, false otherwise.
     */
    private boolean isValidContentType(String contentType) {
        boolean valid = false;

        PortletDD portletDD = getInternalPortletWindow().getPortletEntity()
            .getPortletDefinition();
        for (Iterator it = portletDD.getSupports().iterator();
             !valid && it.hasNext();) {

            SupportsDD supportsDD = (SupportsDD) it.next();
            String supportedType = supportsDD.getMimeType();

View Full Code Here

     *
     * @see org.apache.pluto.descriptors.portlet.PortletPreferenceDD
     */
    public InternalPortletPreference[] getDefaultPreferences() {
        if (defaultPreferences == null) {
            PortletDD portletDD = getPortletDefinition();
            PortletPreferencesDD prefsDD = portletDD.getPortletPreferences();
            if (prefsDD != null) {
              List prefs = new ArrayList();
              for (Iterator it = prefsDD.getPortletPreferences().iterator();
                  it.hasNext(); ) {
                PortletPreferenceDD prefDD = (PortletPreferenceDD) it.next();
View Full Code Here

        // Load PortletAppDD and find out the portlet definition.
        try {
            PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
                .getPortletAppDD(crossContext);
            for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
                PortletDD portletDD = (PortletDD) it.next();
                if (portletDD.getPortletName().equals(portletName)) {
                  portletDefinition = portletDD;
                  break;
                }
            }
        } catch (PortletContainerException ex) {
View Full Code Here

     * @param roleName the name of the role
     * @return true if it is determined the user has the given role.
     */
    public boolean isUserInRole(String roleName) {
        PortletEntity entity = internalPortletWindow.getPortletEntity();
        PortletDD def = entity.getPortletDefinition();

        SecurityRoleRefDD ref = null;
        Iterator refs = def.getSecurityRoleRefs().iterator();
        while (refs.hasNext()) {
            SecurityRoleRefDD r = (SecurityRoleRefDD) refs.next();
            if (r.getRoleName().equals(roleName)) {
                ref = r;
                break;
View Full Code Here

    }

    public Enumeration getResponseContentTypes() {
        if (contentTypes == null) {
            contentTypes = new Vector();
            PortletDD dd = internalPortletWindow.getPortletEntity().getPortletDefinition();
            Iterator supports = dd.getSupports().iterator();
            while (supports.hasNext()) {
                SupportsDD sup = (SupportsDD) supports.next();
                contentTypes.add(sup.getMimeType());
            }
            if (contentTypes.size() < 1) {
View Full Code Here

    private boolean isPortletModeAllowedByPortlet(PortletMode mode) {
        if (isPortletModeMandatory(mode)) {
            return true;
        }

        PortletDD dd = internalPortletWindow.getPortletEntity()
            .getPortletDefinition();

        Iterator mimes = dd.getSupports().iterator();
        while (mimes.hasNext()) {
            Iterator modes = ((SupportsDD) mimes.next()).getPortletModes().iterator();
            while (modes.hasNext()) {
                String m = (String) modes.next();
                if (m.equals(mode.toString())) {
View Full Code Here

TOP

Related Classes of org.apache.pluto.descriptors.portlet.PortletDD

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.