Package org.apache.pluto.descriptors.portlet

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


    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


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

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

        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

        } catch (PortletContainerException ex) {
            throw new ServletException(ex);
        }

        PortletDD portletDD = portletConfig.getPortletDefinition();
        // Create and initialize the portlet wrapped in the servlet.
        try {
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            Class clazz = loader.loadClass((portletDD.getPortletClass()));
            portlet = (Portlet) clazz.newInstance();
            portlet.init(portletConfig);
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
            throw new ServletException(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.equalsIgnoreCase(mode.toString())) {
View Full Code Here

   private void createPortletDDList()  {
    final String METHOD_NAME = "createPortletDDList";
    portletDDList = new ArrayList();
      NodeList portlets = _doc.getElementsByTagName("portlet");
      Element portlet = null;
      PortletDD portletDD = null;
      NodeList roleRefs = null;
      ArrayList refList = null;
      String name = null;
      String className = null;
      Element ref = null;
      String refName = null;
      String refLink = null;
    if (portlets != null) {
      for (int i = 0; i < portlets.getLength(); i++) {
        portletDD = new PortletDD();
        portlet = (Element)portlets.item(i);
        //portlet-name is required
        name = portlet.getElementsByTagName("portlet-name").item(0).getChildNodes().item(0).getNodeValue();
        if (name == null) {
          IllegalStateException e = 
            new IllegalStateException("The portlet-name element is required in portlet.xml");
              PlutoAdminLogger.logError(CLASS_NAME, METHOD_NAME, e);
              throw e;
        }
        portletDD.setPortletName(name);
        //portlet-class is required
        className = portlet.getElementsByTagName("portlet-class").item(0).getChildNodes().item(0).getNodeValue();
        if (className == null) {
          IllegalStateException e = 
            new IllegalStateException("The portlet-class element is required in portlet.xml");
              PlutoAdminLogger.logError(CLASS_NAME, METHOD_NAME, e);
              throw e;
        }
        portletDD.setPortletClass(className);
        roleRefs = portlet.getElementsByTagName("security-role-ref");
        refList = new ArrayList();
        if (roleRefs != null && roleRefs.getLength() != 0) {
          for (int j = 0; j < roleRefs.getLength(); j++) {
            ref = (Element)roleRefs.item(j);
            refName = ref.getElementsByTagName("role-name").item(0).getChildNodes().item(0).getNodeValue();
            //role-link is optional
            if (ref.getElementsByTagName("role-link").item(0) != null) {
              refLink = ref.getElementsByTagName("role-link").item(0).getChildNodes().item(0).getNodeValue();
            }
            refList.add(new RoleRef(refName, refLink))
          }
        }

        portletDD.setSecurityRoleRefs(refList);
        portletDDList.add(portletDD)
       
      }
    } else {
      IllegalStateException e = 
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

        for (Iterator it = portletAppDD.getPortlets().iterator();
                it.hasNext(); ) {

            // Read portlet definition.
            PortletDD portlet = (PortletDD) it.next();
            String name = portlet.getPortletName();

            ServletDD servlet = new ServletDD();
            servlet.setServletName(name);

            servlet.setServletClass(dispatchServletClass);
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

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.