portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls AbstractPortletControl.java
Date Mon, 28 May 2001 15:14:16 GMT
raphael     01/05/28 08:14:16

  Modified:    src/java/org/apache/jetspeed/portal/controls
                        AbstractPortletControl.java
  Log:
  change default implementation in AbstractPortlet and AbstractPortletControl
  to check for registry media-types and mime type support
  
  Revision  Changes    Path
  1.4       +53 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java
  
  Index: AbstractPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractPortletControl.java	2001/05/27 15:34:36	1.3
  +++ AbstractPortletControl.java	2001/05/28 15:14:15	1.4
  @@ -56,6 +56,7 @@
   
   import java.util.Map;
   import java.util.Enumeration;
  +import java.util.Iterator;
   import java.util.Vector;
   
   import org.apache.jetspeed.portal.Portlet;
  @@ -67,7 +68,12 @@
   import org.apache.jetspeed.portal.PortletController;
   import org.apache.jetspeed.portal.PortletException;
   import org.apache.jetspeed.portal.portlets.AbstractPortlet;
  +import org.apache.jetspeed.services.Registry;
  +import org.apache.jetspeed.om.newregistry.PortletControlEntry;
  +import org.apache.jetspeed.om.newregistry.MediaTypeEntry;
  +import org.apache.jetspeed.util.MimeType;
   import org.apache.turbine.util.RunData;
  +import org.apache.turbine.util.Log;
   
   import org.apache.ecs.ElementContainer;
   import org.apache.ecs.ConcreteElement;
  @@ -82,7 +88,7 @@
    * a simple portlet wherever in a PSML object tree.
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: AbstractPortletControl.java,v 1.3 2001/05/27 15:34:36 raphael Exp $
  + * @version $Id: AbstractPortletControl.java,v 1.4 2001/05/28 15:14:15 raphael Exp $
    */
   public abstract class AbstractPortletControl extends AbstractPortlet
       implements PortletControl
  @@ -361,6 +367,52 @@
       {
           if (getPortlet()==null) return new ElementContainer();
           return getPortlet().getContent( rundata );
  +    }
  +
  +    /**
  +    @see Portlet.supportsType
  +    */
  +    public boolean supportsType( MimeType mimeType )
  +    {
  +        boolean allowed = true;
  +
  +        if (getPortlet()!=null)
  +        {
  +            allowed = getPortlet().supportsType( mimeType );
  +        }
  +        
  +        // the inner portlet does not support the type, return immediately...
  +        if (allowed)
  +        {
  +            // we now need to check that the control also supports the type...
  +            PortletControlEntry entry = 
  +                (PortletControlEntry)Registry.getEntry(Registry.PORTLET_CONTROL,
  +                                                   getConfig().getName() );
  +            String baseType = mimeType.toString();
  +            Log.note("Checking type for "+getConfig().getName()+" / type "+baseType+" =>
entry "+entry);
  +
  +            if (entry!=null)
  +            {
  +                Iterator i = entry.listMediaTypes();
  +    
  +                while(i.hasNext())
  +                {
  +                    String name = (String)i.next();
  +                    MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE,
name);
  +                    Log.note(" Found type: "+media.getMimeType());
  +                    if (media != null)
  +                    {
  +                        if (baseType.equals(media.getMimeType())) 
  +                        {
  +                            allowed = true;
  +                            break;
  +                        }
  +                    }
  +                }
  +            }
  +        }
  +        
  +        return allowed;
       }
   
       // delegate the portletSet interface to the stored PortletSet
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message