paulsp 2002/08/25 15:10:47
Modified: src/java/org/apache/jetspeed/portal/security/portlets
PortletWrapper.java
Log:
o Housekeeping directed by checkStyle.
No functional changes
Revision Changes Path
1.10 +66 -77
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java
Index: PortletWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PortletWrapper.java 25 Aug 2002 19:52:08 -0000 1.9
+++ PortletWrapper.java 25 Aug 2002 22:10:47 -0000 1.10
@@ -54,28 +54,25 @@
package org.apache.jetspeed.portal.security.portlets;
-//jetspeed
+// Jetspeed
import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletState;
import org.apache.jetspeed.portal.PortletConfig;
import org.apache.jetspeed.portal.PortletException;
-import org.apache.jetspeed.util.MimeType;
import org.apache.jetspeed.portal.PortletInstance;
-
import org.apache.jetspeed.services.portletcache.Cacheable;
-
import org.apache.jetspeed.services.security.PortalResource;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.util.template.JetspeedLink;
import org.apache.jetspeed.util.template.JetspeedLinkFactory;
+import org.apache.jetspeed.util.MimeType;
-
+// Turbine imports
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.TurbineRuntimeException;
-//ecs
+// ECS
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.ClearElement;
@@ -98,7 +95,7 @@
private Portlet wrappedPortlet = null;
private PortalResource portalResource = null;
- public PortletWrapper( Portlet inner )
+ public PortletWrapper(Portlet inner)
{
wrappedPortlet = inner;
portalResource = new PortalResource(wrappedPortlet);
@@ -114,10 +111,10 @@
/**
*/
- public final void setName( String name )
+ public final void setName(String name)
{
//if we want to secure this, we need a context for the check
- wrappedPortlet.setName( name );
+ wrappedPortlet.setName(name);
}
/**
@@ -129,23 +126,20 @@
/**
*/
- public final void setPortletConfig( PortletConfig pc )
+ public final void setPortletConfig(PortletConfig pc)
{
//if we want to secure this, we need a context for the check
- wrappedPortlet.setPortletConfig( pc );
+ wrappedPortlet.setPortletConfig(pc);
}
-
-
/**
*/
- public ConcreteElement getContent( RunData rundata )
+ public ConcreteElement getContent(RunData rundata)
{
- if( checkPermission(rundata,
- JetspeedSecurity.PERMISSION_VIEW ))
+ if (checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW))
{
- return wrappedPortlet.getContent( rundata );
+ return wrappedPortlet.getContent(rundata);
}
else
{
@@ -153,7 +147,6 @@
}
}
-
/**
Provide a description within PML if the user has specified one.
@@ -164,16 +157,16 @@
return wrappedPortlet.getDescription();
}
- public String getDescription( String instanceDescription)
+ public String getDescription(String instanceDescription)
{
return wrappedPortlet.getDescription(instanceDescription);
}
/**
*/
- public void setDescription( String description )
+ public void setDescription(String description)
{
- wrappedPortlet.setDescription( description );
+ wrappedPortlet.setDescription(description);
}
/**
@@ -181,7 +174,7 @@
*/
public String getImage(String instanceImage)
{
- return wrappedPortlet.getImage( instanceImage );
+ return wrappedPortlet.getImage(instanceImage);
}
/**
@@ -189,7 +182,7 @@
*/
public void setImage(String image)
{
- wrappedPortlet.setImage( image );
+ wrappedPortlet.setImage(image);
}
/**
* @see Portlet#getTitle
@@ -215,36 +208,34 @@
/**
Set the title for this Portlet
*/
- public void setTitle( String title )
+ public void setTitle(String title)
{
/* FIXME, no rundata here if( !checkPermission(rundata,
JetspeedSecurity.PERMISSION_CUSTOMIZE
) )
{ */
- wrappedPortlet.setTitle( title );
+ wrappedPortlet.setTitle(title);
/* } */
}
/**
*/
- public boolean getAllowEdit( RunData rundata )
+ public boolean getAllowEdit(RunData rundata)
{
- return checkPermission( rundata,
- JetspeedSecurity.PERMISSION_INFO );
+ return checkPermission(rundata, JetspeedSecurity.PERMISSION_INFO);
}
/**
*/
- public boolean getAllowMaximize( RunData rundata )
+ public boolean getAllowMaximize(RunData rundata)
{
- return checkPermission( rundata,
- JetspeedSecurity.PERMISSION_MAXIMIZE );
+ return checkPermission(rundata, JetspeedSecurity.PERMISSION_MAXIMIZE);
}
/**
By default don't provide any initialization
*/
- public void init( ) throws PortletException
+ public void init() throws PortletException
{
/* FIXME, no rundata here if( !checkPermission(rundata,
JetspeedSecurity.PERMISSION_CUSTOMIZE) )
@@ -256,7 +247,8 @@
/**
@see Portlet#getCreationTime
*/
- public long getCreationTime() {
+ public long getCreationTime()
+ {
/* FIXME, no rundata here if( !checkPermission(rundata,
JetspeedSecurity.PERMISSION_VIEW) )
{ */
@@ -267,23 +259,23 @@
/**
@see Portlet#setCreationTime
*/
- public void setCreationTime( long creationTime )
+ public void setCreationTime(long creationTime)
{
/* FIXME, no rundata here if( !checkPermission(rundata,
JetspeedSecurity.PERMISSION_CUSTOMIZE) )
{ */
- wrappedPortlet.setCreationTime( creationTime );
+ wrappedPortlet.setCreationTime(creationTime);
}
/**
@see Portlet#supportsType
*/
- public boolean supportsType( MimeType mimeType )
+ public boolean supportsType(MimeType mimeType)
{
/* FIXME, no rundata here if( !checkPermission(rundata,
JetspeedSecurity.PERMISSION_VIEW) )
{ */
- return wrappedPortlet.supportsType( mimeType );
+ return wrappedPortlet.supportsType(mimeType);
/* } */
}
@@ -293,8 +285,7 @@
* @param permissionName String the name of the Permission requested
* @return boolean is it granted?
*/
- protected boolean checkPermission( RunData rundata,
- String permissionName )
+ protected boolean checkPermission(RunData rundata, String permissionName)
{
try
{
@@ -308,18 +299,17 @@
portalResource.setOwner(null);
}
- Log.debug( "checking for Portlet permission: " +
- permissionName +
- " for portlet: " +
- wrappedPortlet.getName() +
- " Owner = " + portalResource.getOwner());
+ Log.debug("checking for Portlet permission: "
+ + permissionName
+ + " for portlet: "
+ + wrappedPortlet.getName()
+ + " Owner = "
+ + portalResource.getOwner());
- return JetspeedSecurity.checkPermission( (JetspeedUser) rundata.getUser(),
+ return JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
portalResource,
permissionName);
}
-
-
// utility methods
@@ -332,12 +322,12 @@
*/
public boolean isShowTitleBar(RunData rundata)
{
- if (wrappedPortlet.getPortletConfig()!=null)
+ if (wrappedPortlet.getPortletConfig() != null)
{
// Parameter can exist in PSML or <portlet-entry>
- return
Boolean.valueOf(wrappedPortlet.getPortletConfig().getInitParameter("_showtitlebar","true")).booleanValue();
+ return
Boolean.valueOf(wrappedPortlet.getPortletConfig().getInitParameter("_showtitlebar",
"true")).booleanValue();
}
- return getAttribute("_showtitlebar", "true", rundata ).equals("true");
+ return getAttribute("_showtitlebar", "true", rundata).equals("true");
}
@@ -349,42 +339,39 @@
@param rundata A RunData object
@return The attribute value
*/
- public String getAttribute( String attrName, String attrDefValue, RunData
rundata )
+ public String getAttribute(String attrName, String attrDefValue, RunData
rundata)
{
- if( checkPermission( rundata,
- JetspeedSecurity.PERMISSION_VIEW) )
+ if (checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW))
{
- return wrappedPortlet.getAttribute( attrName, attrDefValue, rundata );
+ return wrappedPortlet.getAttribute(attrName, attrDefValue, rundata);
}
else
{
//FIXME: for the moment we will allow this call to succeed...
//throw new TurbineRuntimeException( "Security check failed" );
- return wrappedPortlet.getAttribute( attrName, attrDefValue, rundata );
+ return wrappedPortlet.getAttribute(attrName, attrDefValue, rundata);
}
}
/**
- Sets a portlet attribute to persistent storage
-
- @param attrName The attribute to retrieve
- @parm attrValue The value
- @param rundata A RunData object
- @return The attribute value
- */
- public void setAttribute( String attrName, String attrValue, RunData rundata )
+ * Sets a portlet attribute to persistent storage
+ *
+ * @param attrName The attribute to retrieve
+ * @param attrValue The value
+ * @param rundata A RunData object
+ */
+ public void setAttribute(String attrName, String attrValue, RunData rundata)
{
- if( checkPermission( rundata,
- JetspeedSecurity.PERMISSION_VIEW) )
+ if (checkPermission(rundata, JetspeedSecurity.PERMISSION_VIEW))
{
- wrappedPortlet.setAttribute( attrName, attrValue, rundata );
+ wrappedPortlet.setAttribute(attrName, attrValue, rundata);
}
else
{
//FIXME: for the moment we will allow this call to succeed...
//throw new TurbineRuntimeException( "Security check failed" );
- wrappedPortlet.setAttribute( attrName, attrValue, rundata );
+ wrappedPortlet.setAttribute(attrName, attrValue, rundata);
}
}
@@ -392,6 +379,7 @@
/**
* Gets the portlet instance associated with this portlet.
*
+ * @param rundata A RunData object
* @return PortletInstance
*/
public PortletInstance getInstance(RunData rundata)
@@ -406,21 +394,22 @@
* depending on the interfaces implemented by the portlet. :-(</p>
*
*/
- public static Portlet wrap( Portlet aPortlet) {
+ public static Portlet wrap(Portlet aPortlet)
+ {
//SGP Security test
- if( aPortlet instanceof PortletState )
+ if (aPortlet instanceof PortletState)
{
- if( aPortlet instanceof Cacheable )
+ if (aPortlet instanceof Cacheable)
{
- return new CacheableStatefulPortletWrapper( aPortlet );
+ return new CacheableStatefulPortletWrapper(aPortlet);
}
- return new StatefulPortletWrapper( aPortlet );
+ return new StatefulPortletWrapper(aPortlet);
}
- if( aPortlet instanceof Cacheable )
+ if (aPortlet instanceof Cacheable)
{
- return new CacheablePortletWrapper( aPortlet );
+ return new CacheablePortletWrapper(aPortlet);
}
- return new PortletWrapper( aPortlet );
+ return new PortletWrapper(aPortlet);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>