raphael 2002/11/08 02:05:19
Modified: src/java/org/apache/jetspeed/modules/actions/portlets
PsmlUpdateAction.java
src/java/org/apache/jetspeed/portal/portlets
AggregatePortlet.java ContainerTestPortlet.java
src/java/org/apache/jetspeed/services/jsp/tags
JetspeedPortletTag.java
src/java/org/apache/jetspeed/services/portaltoolkit
JetspeedPortalToolkitService.java
src/java/org/apache/jetspeed/services/psmlmanager
CastorPsmlManagerService.java
src/java/org/apache/jetspeed/services/psmlmanager/db
DatabasePsmlManagerService.java
src/java/org/apache/jetspeed/services/security/ldap
LDAPGroupManagement.java LDAPRoleManagement.java
LDAPUserManagement.java
src/java/org/apache/jetspeed/services/security/turbine
TurbineGroupManagement.java
TurbineRoleManagement.java
TurbineUserManagement.java
src/java/org/apache/jetspeed/services/template
JetspeedTemplateLocatorService.java
src/java/org/apache/jetspeed/test TestBasicSecurity.java
Log:
Ensure all classes now use Profiler factory methods instead of instanciating
directly implementation classes
Revision Changes Path
1.11 +67 -69
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/PsmlUpdateAction.java
Index: PsmlUpdateAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/PsmlUpdateAction.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PsmlUpdateAction.java 4 Sep 2002 16:06:37 -0000 1.10
+++ PsmlUpdateAction.java 8 Nov 2002 10:05:18 -0000 1.11
@@ -78,8 +78,6 @@
//Jetspeed
import org.apache.jetspeed.modules.actions.portlets.security.SecurityConstants;
-import org.apache.jetspeed.om.profile.BaseProfile;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.om.profile.QueryLocator;
@@ -161,7 +159,7 @@
// get the bad entered data and put it back for convenient update
ProfileLocator locator =
(ProfileLocator)rundata.getUser().getTemp(TEMP_LOCATOR);
if (locator != null)
- context.put("profile", new BaseProfile(locator));
+ context.put("profile", Profiler.createProfile(locator));
}
String mode =
rundata.getParameters().getString(SecurityConstants.PARAM_MODE);
@@ -170,7 +168,7 @@
if(mode != null && mode.equals(SecurityConstants.PARAM_MODE_DELETE))
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.createFromPath(path);
Profile profile = Profiler.getProfile(locator);
if (profile != null)
@@ -196,7 +194,7 @@
}
else
{
- ProfileLocator tmpLocator = new BaseProfileLocator();
+ ProfileLocator tmpLocator = Profiler.createLocator();
tmpLocator.createFromPath(path);
Profile profile = Profiler.getProfile(tmpLocator);
if (profile != null)
@@ -240,27 +238,27 @@
if (msgid == null)
{
String tmpPath =
JetspeedResources.getString(JetspeedResources.TEMP_DIRECTORY_KEY, "/tmp");
- String exportPath =
JetspeedResources.getString("psml.export.default.path",
+ String exportPath =
JetspeedResources.getString("psml.export.default.path",
TurbineServlet.getRealPath(tmpPath));
if(path == null)
{
context.put(COPY_TO, exportPath);
- context.put(COPY_FROM,
- Profiler.PARAM_USER +
- File.separator +
+ context.put(COPY_FROM,
+ Profiler.PARAM_USER +
+ File.separator +
Profiler.PARAM_ANON +
File.separator +
Profiler.PARAM_MEDIA_TYPE +
File.separator +
- "html" +
- File.separator +
- Profiler.PARAM_PAGE +
+ "html" +
+ File.separator +
+ Profiler.PARAM_PAGE +
File.separator +
Profiler.FULL_DEFAULT_PROFILE);
}
else
{
- ProfileLocator tmpLocator = new BaseProfileLocator();
+ ProfileLocator tmpLocator = Profiler.createLocator();
tmpLocator.createFromPath(path);
Profile profile = Profiler.getProfile(tmpLocator);
if (profile != null)
@@ -314,7 +312,7 @@
context.put(COPY_TO, rundata.getUser().getTemp(COPY_TO));
}
}
-
+
if(mode != null && mode.equals("import"))
{
org.apache.jetspeed.om.registry.Registry mediaTypes =
Registry.get(Registry.MEDIA_TYPE);
@@ -331,24 +329,24 @@
{
context.put(CATEGORY_NAME, Profiler.PARAM_USER);
context.put("categoryValue", Profiler.PARAM_ANON);
- context.put("copyFrom",
- root +
- File.separator +
- Profiler.PARAM_USER +
- File.separator +
+ context.put("copyFrom",
+ root +
+ File.separator +
+ Profiler.PARAM_USER +
+ File.separator +
Profiler.PARAM_ANON +
File.separator +
Profiler.PARAM_MEDIA_TYPE +
File.separator +
- "html" +
- File.separator +
- Profiler.PARAM_PAGE +
+ "html" +
+ File.separator +
+ Profiler.PARAM_PAGE +
File.separator +
Profiler.FULL_DEFAULT_PROFILE);
}
else
{
- ProfileLocator tmpLocator = new BaseProfileLocator();
+ ProfileLocator tmpLocator = Profiler.createLocator();
tmpLocator.createFromPath(path);
Profile profile = Profiler.getProfile(tmpLocator);
if (profile != null)
@@ -439,7 +437,7 @@
//
//create a new locator and set its values according to users input
//
- locator = new BaseProfileLocator();
+ locator = Profiler.createLocator();
if (categoryName.equalsIgnoreCase(Profiler.PARAM_GROUP))
{
locator.setGroupByName(categoryValue);
@@ -509,7 +507,7 @@
//
// retrieve the profile to clone
//
- ProfileLocator baseLocator = new BaseProfileLocator();
+ ProfileLocator baseLocator = Profiler.createLocator();
baseLocator.createFromPath(copyFrom);
Profile baseProfile = Profiler.getProfile(baseLocator);
@@ -645,7 +643,7 @@
//
// retrieve the profile to clone
//
- ProfileLocator baseLocator = new BaseProfileLocator();
+ ProfileLocator baseLocator = Profiler.createLocator();
baseLocator.createFromPath(copyFrom);
Profile baseProfile = Profiler.getProfile(baseLocator);
@@ -728,7 +726,7 @@
copyToFile.append(File.separator);
copyToFile.append(profile.getGroupName());
copyToFile.append(File.separator);
- }
+ }
else if (profile.getRoleName() != null)
{
copyToFile.append("role");
@@ -797,7 +795,7 @@
}
/** Save the PSML document on disk to the specififed fileOrUrl
- *
+ *
* @param fileOrUrl a String representing either an absolute URL
* or an absolute filepath
* @param doc the document to save
@@ -805,7 +803,7 @@
private boolean saveDocument(String fileOrUrl, PSMLDocument doc)
{
boolean success = false;
-
+
if (doc == null) return false;
File f = new File(fileOrUrl);
File d = new File(f.getParent());
@@ -816,17 +814,17 @@
try
{
writer = new FileWriter(f);
- // create the serializer output format
+ // create the serializer output format
OutputFormat format = new OutputFormat();
format.setIndenting(true);
format.setIndent(4);
- Serializer serializer = new XMLSerializer(writer,format);
+ Serializer serializer = new XMLSerializer(writer,format);
Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
marshaller.setMapping(this.loadMapping());
marshaller.marshal(doc.getPortlets());
success = true;
- }
+ }
catch (MarshalException e)
{
Log.error("PSMLUpdateAction: Could not marshal the file " +
f.getAbsolutePath(), e);
@@ -849,21 +847,21 @@
}
finally
{
- try
- {
- writer.close();
- }
- catch (IOException e)
+ try
+ {
+ writer.close();
+ }
+ catch (IOException e)
{
}
- }
-
+ }
+
return success;
}
/**
* Loads psml mapping file
- *
+ *
* @exception Exception
*/
private Mapping loadMapping()
@@ -875,8 +873,8 @@
// test the mapping file and create the mapping object
Mapping mapping = null;
- String mapFile =
serviceConf.getString("mapping","${webappRoot}/WEB-INF/conf/psml-mapping.xml");
- mapFile = TurbineServlet.getRealPath( mapFile );
+ String mapFile =
serviceConf.getString("mapping","${webappRoot}/WEB-INF/conf/psml-mapping.xml");
+ mapFile = TurbineServlet.getRealPath( mapFile );
if (mapFile != null)
{
File map = new File(mapFile);
@@ -932,7 +930,7 @@
//
//create a new locator and set its values according to users input
//
- locator = new BaseProfileLocator();
+ locator = Profiler.createLocator();
if (categoryName.equalsIgnoreCase(Profiler.PARAM_GROUP))
{
locator.setGroupByName(categoryValue);
@@ -1097,7 +1095,7 @@
for (Iterator it = files.iterator(); it.hasNext(); )
{
// If error occurs processing one entry, continue on with the others
- try
+ try
{
String psml = ((File) it.next()).getPath();
String path = psml.substring(copyFrom.length() + 1);
@@ -1127,7 +1125,7 @@
rundata.setMessage("Profile for [" + locator.getPath() + "] has
been imported from file [" + psml + "]");
setRefreshPsmlFlag(rundata, TRUE);
}
- catch (Exception ouch)
+ catch (Exception ouch)
{
Log.error(ouch);
}
@@ -1161,7 +1159,7 @@
/**
* This method recursively collect all .psml documents starting at the given
root
- *
+ *
* @param v Vector to put the file into
* @param root Root directory for import
*/
@@ -1186,28 +1184,28 @@
/**
* Creates profile locator from a given path in the format:
- *
+ *
* user/<name>/<mediaType>/<language>/<country>/<page>/
- *
+ *
* group/ ""
* role/ ""
- *
+ *
* @param path The formatted profiler path string.
* @param path fully qualified .psml file name
* @return profile locator
*/
- private ProfileLocator mapFileToLocator(String path)
+ private ProfileLocator mapFileToLocator(String path)
throws Exception
{
if (Log.getLogger().isDebugEnabled())
{
Log.debug("PsmlUpdateAction.createFromPath: processing path = " + path);
}
- ProfileLocator result = new BaseProfileLocator();
+ ProfileLocator result = Profiler.createLocator();
// Tokenize the file path into elements
StringTokenizer tok = new StringTokenizer(path, File.separator);
-
+
// Load path elements into a vector for random access
Vector tokens = new Vector();
while (tok.hasMoreTokens())
@@ -1226,11 +1224,11 @@
}
else if (type.equals(Profiler.PARAM_GROUP))
{
- result.setGroup(JetspeedSecurity.getGroup(name));
+ result.setGroup(JetspeedSecurity.getGroup(name));
}
else if (type.equals(Profiler.PARAM_ROLE))
{
- result.setRole(JetspeedSecurity.getRole(name));
+ result.setRole(JetspeedSecurity.getRole(name));
}
}
@@ -1266,7 +1264,7 @@
/**
* Maps a ProfileLocator to a file.
- *
+ *
* @param locator The profile locator describing the PSML resource to be found.
* @return the String path of the file.
*/
@@ -1350,8 +1348,8 @@
return path.toString();
}
-
- /**
+
+ /**
* Load a PSMLDOcument from disk
*
* @param fileOrUrl a String representing either an absolute URL or an
@@ -1363,8 +1361,8 @@
if (fileOrUrl != null)
{
-
- // we'll assume the name is the the location of the file
+
+ // we'll assume the name is the the location of the file
File f = null;
f = new File(fileOrUrl);
@@ -1372,7 +1370,7 @@
if (!f.exists())
{
return null;
- }
+ }
doc = new BasePSMLDocument();
doc.setName(fileOrUrl);
@@ -1383,10 +1381,10 @@
try
{
reader = new FileReader(f);
-
+
Unmarshaller unmarshaller = new Unmarshaller(this.loadMapping());
portlets = (Portlets) unmarshaller.unmarshal(reader);
-
+
doc.setPortlets(portlets);
}
@@ -1412,16 +1410,16 @@
}
finally
{
- try
- {
- reader.close();
- }
- catch (IOException e)
+ try
+ {
+ reader.close();
+ }
+ catch (IOException e)
{
}
}
}
-
+
return doc;
}
1.5 +9 -10
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AggregatePortlet.java
Index: AggregatePortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AggregatePortlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AggregatePortlet.java 29 Oct 2002 18:39:39 -0000 1.4
+++ AggregatePortlet.java 8 Nov 2002 10:05:18 -0000 1.5
@@ -57,7 +57,6 @@
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.portal.PortletConfig;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.Profile;
@@ -80,7 +79,7 @@
/**
Aggregate Portlet aggregates the content of other portlets.
-
+
This portlet is a test for an alternate aggregation algorithm (from getSet)
@author <A HREF="mailto:taylor@;apache.org">David Sean Taylor</A>
@@ -98,9 +97,9 @@
*/
public ConcreteElement getContent(RunData rundata)
{
- String key = ((JetspeedRunData)rundata).getProfile().getId()
+ String key = ((JetspeedRunData)rundata).getProfile().getId()
+ "." + this.getID();
-
+
String path = (String)rundata.getUser().getTemp(key);
if (path == null)
{
@@ -111,20 +110,20 @@
{
return new JetspeedClearElement("Path parameter not set");
}
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.createFromPath(path);
String id = locator.getId();
-
+
try
{
- Profile profile = Profiler.getProfile(locator);
+ Profile profile = Profiler.getProfile(locator);
PSMLDocument doc = profile.getDocument();
if (doc == null)
{
return null;
}
- Portlets portlets = doc.getPortlets();
+ Portlets portlets = doc.getPortlets();
PortletSet ps = PortalToolkit.getSet(portlets);
return ps.getContent(rundata);
}
@@ -132,7 +131,7 @@
{
Log.error( e );
return new JetspeedClearElement("Error in aggregation portlet: " +
e.toString());
- }
+ }
}
1.5 +23 -24
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java
Index: ContainerTestPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ContainerTestPortlet.java 27 Sep 2002 19:54:26 -0000 1.4
+++ ContainerTestPortlet.java 8 Nov 2002 10:05:18 -0000 1.5
@@ -57,7 +57,6 @@
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.portal.PortletConfig;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.Profile;
@@ -84,9 +83,9 @@
/**
Aggregate Portlet aggregates the content of other portlets.
-
+
This portlet is a test for an alternate aggregation algorithm
-
+
UNDER CONSTRUCTION
@author <A HREF="mailto:taylor@;apache.org">David Sean Taylor</A>
@@ -111,7 +110,7 @@
/**
- Holds instances of ConcreteElements (Portlet output/content)
+ Holds instances of ConcreteElements (Portlet output/content)
based on its current CapabilityMap.
*/
// protected Hashtable content = new Hashtable();
@@ -120,7 +119,7 @@
The time this portlet was created.
*/
private long creationTime;
-
+
/**
Returns a name for this portlet. This is used by PSML to identify a Portlet
within the PortletRegistry
@@ -160,7 +159,7 @@
{
return this.title;
}
-
+
/**
* t a title for this instance of the portlet. This method is called
* from the context variable portlet_instance and from PortletInstance
@@ -227,7 +226,7 @@
*/
public void setDescription( String description )
{
- this.description = description;
+ this.description = description;
}
/**
@@ -249,7 +248,7 @@
return instanceImage;
return getImage();
}
-
+
public void setImage( String image )
{
this.image = image;
@@ -262,9 +261,9 @@
*/
public ConcreteElement getContent(RunData rundata)
{
- String key = ((JetspeedRunData)rundata).getProfile().getId()
+ String key = ((JetspeedRunData)rundata).getProfile().getId()
+ "." + this.getID();
-
+
String path = (String)rundata.getUser().getTemp(key);
if (path == null)
{
@@ -276,19 +275,19 @@
return new JetspeedClearElement("Path parameter not set");
}
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.createFromPath(path);
String id = locator.getId();
-
+
try
{
- Profile profile = Profiler.getProfile(locator);
+ Profile profile = Profiler.getProfile(locator);
PSMLDocument doc = profile.getDocument();
if (doc == null)
{
return null;
}
- Portlets portlets = doc.getPortlets();
+ Portlets portlets = doc.getPortlets();
//PortletContainer.aggregate(portlets);
return new JetspeedClearElement("XXX Under Construction :)");
}
@@ -296,7 +295,7 @@
{
Log.error( e );
return new JetspeedClearElement("Error in aggregation portlet: " +
e.toString());
- }
+ }
}
/**
@@ -356,10 +355,10 @@
*/
public long getCreationTime()
{
-
+
return this.creationTime;
}
-
+
/**
Set the creation time for this Portlet
*/
@@ -368,12 +367,12 @@
System.out.println("setting creating time");
this.creationTime = creationTime;
}
-
+
/**
Returns true portlet is able to output content for given mimetype
*/
public boolean supportsType( MimeType mimeType )
- {
+ {
return true;
}
@@ -430,7 +429,7 @@
/**
- Retrieve a unique portlet id
+ Retrieve a unique portlet id
*/
public String getID()
{
@@ -449,7 +448,7 @@
{
return false;
}
-
+
/** Returns TRUE if the title bar in should be displayed. The title bar includes
* the portlet title and action buttons. This
*
@@ -459,6 +458,6 @@
{
return true;
}
-
-
+
+
}
1.6 +15 -16
jakarta-jetspeed/src/java/org/apache/jetspeed/services/jsp/tags/JetspeedPortletTag.java
Index: JetspeedPortletTag.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/jsp/tags/JetspeedPortletTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JetspeedPortletTag.java 30 Oct 2002 22:56:13 -0000 1.5
+++ JetspeedPortletTag.java 8 Nov 2002 10:05:18 -0000 1.6
@@ -58,7 +58,7 @@
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
-// Turbine Classes
+// Turbine Classes
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.Log;
import org.apache.turbine.services.jsp.JspService;
@@ -70,20 +70,19 @@
import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.om.profile.Entry;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.services.Profiler;
/**
* Supporting class for the portlet tag.
- * Builds the output of a portlet (with conrol) and insert it within the
+ * Builds the output of a portlet (with conrol) and insert it within the
* current JSP page
*
* @author <a href="mailto:raphael@;apache.org">Rapha�l Luta</a>
* @version $Id$
*/
-public class JetspeedPortletTag extends TagSupport
+public class JetspeedPortletTag extends TagSupport
{
private String name = null;
private String psml = null;
@@ -92,17 +91,17 @@
{
this.name = name;
}
-
+
public String getName()
{
return this.name;
}
-
+
public void setPsml(String psml)
{
this.psml = psml;
}
-
+
public String getPsml()
{
return this.psml;
@@ -114,18 +113,18 @@
*
* @return SKIP_BODY, as it is intended to be a single tag.
*/
- public int doStartTag() throws JspException
+ public int doStartTag() throws JspException
{
JetspeedRunData data =
(JetspeedRunData)pageContext.getAttribute(JspService.RUNDATA,
PageContext.REQUEST_SCOPE);
-
+
// if called without arguments, use the default request parameter
if (this.name == null)
{
this.name = data.getPortlet();
}
-
+
try
- {
+ {
pageContext.getOut().flush();
ConcreteElement result = new ConcreteElement();
@@ -133,7 +132,7 @@
if (this.psml != null)
{
- ProfileLocator baseLocator = new BaseProfileLocator();
+ ProfileLocator baseLocator = Profiler.createLocator();
baseLocator.createFromPath(this.psml);
Profile baseProfile = Profiler.getProfile(baseLocator);
if (baseProfile != null)
@@ -147,12 +146,12 @@
entry = data.getProfile().getDocument().getEntry(name);
Log.debug("JetspeedPortletTag: retrieved [" + entry + "] from
current psml");
}
-
+
if (entry != null)
{
result = PortletFactory.getPortlet(entry).getContent(data);
}
-
+
// Check whether this is an "old" screen (that returns a
ConcreteElement)
// or a "new" one that returns null.
if ( result != null )
@@ -173,7 +172,7 @@
{
data.getOut().print("Error processing portlet '" + name + "'. See
log for more information.");
}
- catch(java.io.IOException ioe) {}
+ catch(java.io.IOException ioe) {}
}
return SKIP_BODY;
}
1.23 +67 -67
jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java
Index: JetspeedPortalToolkitService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- JetspeedPortalToolkitService.java 3 Oct 2002 21:50:41 -0000 1.22
+++ JetspeedPortalToolkitService.java 8 Nov 2002 10:05:18 -0000 1.23
@@ -84,7 +84,7 @@
/**
* Simple implementation of the PortalFactoryService.
- *
+ *
* @author <a href="mailto:raphael@;apache.org">Rapha�l Luta</a>
* @author <a href="mailto:taylor@;apache.org">David Sean Taylor</a>
*
@@ -99,12 +99,12 @@
/** The default controller to use when none is specified */
private String defaultController = null;
-
+
/** The default skin to use when none is specified */
private String defaultSkin = null;
-
+
/**
- * This is the early initialization method called by the
+ * This is the early initialization method called by the
* Turbine <code>Service</code> framework
*/
public void init( ServletConfig conf ) throws InitializationException
@@ -116,13 +116,13 @@
this.defaultControl = serviceConf.getString("default.control");
this.defaultController = serviceConf.getString("default.controller");
this.defaultSkin = serviceConf.getString("default.skin");
-
+
setInit(true);
}
-
+
/**
- * Instanciates a PortletControl based on a Registry entry, if available
+ * Instanciates a PortletControl based on a Registry entry, if available
* or directly from a classname.
*
* @param name a PortletControl name available in the registry or a classname
@@ -132,14 +132,14 @@
{
PortletControl pc = null;
PortletControlEntry entry = null;
-
+
if (name != null)
{
entry =
(PortletControlEntry)Registry.getEntry(Registry.PORTLET_CONTROL, name);
}
-
+
Map params = null;
-
+
try
{
if (entry == null)
@@ -167,7 +167,7 @@
{
return getControl( defaultControl );
}
-
+
PortletControlConfig pcConf = new BasePortletControlConfig();
pcConf.setName( name );
pcConf.setInitParameters(params);
@@ -201,8 +201,8 @@
return pc;
}
-
-
+
+
protected PortletControl getControl( Control control, PortletEntry entry )
{
PortletControl pc = null;
@@ -232,7 +232,7 @@
/**
- * Instanciates a PortletController based on a Registry entry, if available
+ * Instanciates a PortletController based on a Registry entry, if available
* or directly from a classname.
*
* @param name a PortletController name available in the registry or a classname
@@ -242,16 +242,16 @@
{
PortletController pc = null;
PortletControllerEntry entry = null;
-
-
+
+
if (name != null)
{
entry = (PortletControllerEntry)Registry
.getEntry(Registry.PORTLET_CONTROLLER,
name);
}
-
+
Map params = null;
-
+
try
{
if (entry == null)
@@ -273,19 +273,19 @@
Log.error("Unable to instanciate controller "+name+", using default");
}
- if ( (pc == null)
+ if ( (pc == null)
&& (defaultController != null)
&& (!defaultController.equals(name)) )
{
return getController( defaultController );
}
-
+
PortletControllerConfig pcConf = new BasePortletControllerConfig();
pcConf.setName( name );
pcConf.setInitParameters(params);
pc.setConfig(pcConf);
pc.init();
-
+
return pc;
}
@@ -329,7 +329,7 @@
BasePortletSkin result = new BasePortletSkin();
SkinEntry entry = null;
-
+
if (name!=null)
{
entry = (SkinEntry)Registry.getEntry(Registry.SKIN, name);
@@ -342,14 +342,14 @@
{
entry = (SkinEntry)Registry.getEntry(Registry.SKIN, this.defaultSkin);
}
-
+
if (entry!=null)
{
// build the PortletSkin object
result.setName(entry.getName());
result.putAll(entry.getParameterMap());
}
-
+
return result;
}
@@ -370,10 +370,10 @@
// create the PortletSkin corresponding to this entry
result = getSkin( name );
-
+
// override the values with the locally defined properties
result.putAll(getParameters(skin));
-
+
}
return result;
@@ -388,9 +388,9 @@
public PortletSet getSet( Portlets portlets )
{
VariableInteger lastID = new VariableInteger(0);
- return getSet( portlets, new VariableInteger(0) );
+ return getSet( portlets, new VariableInteger(0) );
}
-
+
/**
* Creates a PortletSet from a PSML portlets description, updating
* the portletset name based on its position within the tree
@@ -412,11 +412,11 @@
}
else
set.setName(String.valueOf(theCount.getValue()));
-
+
set.setID(portlets.getId());
-
+
theCount.setValue(theCount.getValue()+1);
-
+
//FIXME: this sucks ! we should either associate the portlet set
//with its portlets peer or set the porpoerties directly on the portlet
//set object
@@ -448,7 +448,7 @@
Entry psmlEntry = (Entry)eit.next();
PortletEntry entry = (PortletEntry)Registry.getEntry(
Registry.PORTLET, psmlEntry.getParent() );
-
+
if ( entry != null )
{
Portlet p = PortletFactory.getPortlet( psmlEntry );
@@ -457,15 +457,15 @@
{
Map constraints = getParameters(psmlEntry.getLayout());
int position = getPosition( psmlEntry.getLayout() );
-
+
PortletControl control =
getControl(psmlEntry.getControl(), entry);
-
+
set.addPortlet( initControl(control,p),
controller.getConstraints( constraints ),
position );
}
}
- else
+ else
{
Log.error(" The portlet "+psmlEntry.getParent()+" does not
exist in the Registry ");
continue;
@@ -483,7 +483,7 @@
if ( portlets.getControl() != null )
{
PortletControl control = getControl(portlets.getControl());
- return initControl(control,set);
+ return initControl(control,set);
}
set.sortPortletSet();
@@ -520,50 +520,50 @@
/**
Given a PSML Portlets, get the value of what its PortletConfig would be.
-
+
@param entry the Portlets containing the config
@return the newly created PortletConfig object
*/
protected PortletConfig getPortletConfig( Portlets portlets )
{
-
+
PortletConfig pc = new BasePortletConfig();
pc.setName( portlets.getName() );
pc.setInitParameters( getParameters( portlets ) );
-
+
if (portlets.getSkin()!=null)
{
pc.setPortletSkin( getSkin( portlets.getSkin() ) );
}
-
+
pc.setSecurityRef( portlets.getSecurityRef() );
pc.setMetainfo( getMetaData( portlets ) );
-
+
return pc;
}
-
+
/**
* Fetches the parameters out of a PSML Portlets entry
*
* @param portlets the Portlets entry to check for parameters
- * @return a Map containing the parameters names/values, an empty Dictionary
+ * @return a Map containing the parameters names/values, an empty Dictionary
* is returned if there are no parameters
*/
protected static Map getParameters( Portlets portlets )
{
Hashtable hash = new Hashtable();
-
+
if (portlets != null)
{
Parameter[] props = portlets.getParameter();
-
+
for(int i = 0; i < props.length; ++i)
{
hash.put(props[i].getName(), props[i].getValue() );
}
}
-
+
return hash;
}
@@ -610,10 +610,10 @@
}
return hash;
}
-
+
/**
* Retrieves a parameter Map from an array of PSML Layout object
- *
+ *
* @param layout the Layout object to use
* @return a Map containing the names/values, an empty map
* is returned if there are no properties
@@ -625,19 +625,19 @@
if (layout!=null)
{
Parameter[] props = layout.getParameter();
-
+
for(int i = 0; i < props.length; ++i)
{
hash.put(props[i].getName(), props[i].getValue() );
}
}
-
+
return hash;
- }
+ }
/**
* Retrieves a parameter Map from a PSML skin object
- *
+ *
* @param skin the Skin object to use
* @return a Map containing the names/values, an empty map
* is returned if there are no properties
@@ -649,19 +649,19 @@
if (skin!=null)
{
Parameter[] props = skin.getParameter();
-
+
for(int i = 0; i < props.length; ++i)
{
hash.put(props[i].getName(), props[i].getValue() );
}
}
-
+
return hash;
- }
+ }
/**
Create a MetaData object from a PSML Metainfo object
-
+
@param meta the Metainfo to copy
@return the new MetaData object, empty if meta is null
@@ -703,31 +703,31 @@
protected static int getPosition(Layout layout)
{
int pos=-1;
-
+
try {
pos=(int)layout.getPosition();
} catch (RuntimeException e) {
// either layout is null or the position isn't an integer
// keep the default value
}
-
+
return pos;
}
protected static class VariableInteger
{
int value;
-
+
public VariableInteger(int value)
{
this.value = value;
}
-
+
public int getValue()
{
return this.value;
}
-
+
public void setValue(int value)
{
this.value=value;
@@ -739,22 +739,22 @@
*
* @param locatorPath ProfileLocator resource path identifier
* @return a portlets collection from the PSML resource
- */
+ */
public Portlets getReference(String locatorPath)
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.createFromPath(locatorPath);
String id = locator.getId();
-
+
try
{
- Profile profile = Profiler.getProfile(locator);
+ Profile profile = Profiler.getProfile(locator);
PSMLDocument doc = profile.getDocument();
if (doc == null)
{
return null;
}
- Portlets portlets = doc.getPortlets();
+ Portlets portlets = doc.getPortlets();
return portlets;
}
catch (Exception e)
1.34 +7 -6
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
Index: CastorPsmlManagerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- CastorPsmlManagerService.java 3 Nov 2002 15:11:17 -0000 1.33
+++ CastorPsmlManagerService.java 8 Nov 2002 10:05:18 -0000 1.34
@@ -60,6 +60,7 @@
import org.apache.jetspeed.om.profile.QueryLocator;
import org.apache.jetspeed.util.FileCopy;
import org.apache.jetspeed.util.DirectoryUtils;
+import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.services.security.UserException;
@@ -934,7 +935,7 @@
*/
public void removeUserDocuments( JetspeedUser user )
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.setUser(user);
StringBuffer buffer = new StringBuffer();
buffer.append(PATH_USER);
@@ -990,7 +991,7 @@
*/
public void removeRoleDocuments( Role role )
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.setRole(role);
StringBuffer buffer = new StringBuffer();
buffer.append(PATH_ROLE);
@@ -1045,7 +1046,7 @@
*/
public void removeGroupDocuments( Group group )
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
locator.setGroup(group);
StringBuffer buffer = new StringBuffer();
buffer.append(PATH_GROUP);
@@ -1320,7 +1321,7 @@
if (importFlag)
return new ImportProfile(this, this.consumer);
else
- return new BaseProfile();
+ return Profiler.createProfile();
}
protected Profile createProfile(ProfileLocator locator)
@@ -1328,7 +1329,7 @@
if (importFlag)
return new ImportProfile(this, this.consumer, locator);
else
- return new BaseProfile(locator);
+ return Profiler.createProfile(locator);
}
/** Query for a collection of profiles given a profile locator criteria.
1.30 +6 -7
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java
Index: DatabasePsmlManagerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- DatabasePsmlManagerService.java 15 Oct 2002 17:35:32 -0000 1.29
+++ DatabasePsmlManagerService.java 8 Nov 2002 10:05:18 -0000 1.30
@@ -67,9 +67,8 @@
// Profile and ProfileLocator interface
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.profile.ProfileLocator;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.om.profile.QueryLocator;
+import org.apache.jetspeed.services.Profiler;
//Castor defined API
import org.apache.jetspeed.om.profile.Portlets;
@@ -459,7 +458,7 @@
private ProfileLocator stringToLocator(String locstr) throws Exception
{
- ProfileLocator locator = new BaseProfileLocator();
+ ProfileLocator locator = Profiler.createLocator();
String entity = null;
if (Log.getLogger().isDebugEnabled())
@@ -1201,7 +1200,7 @@
*/
public Profile createUserProfile(JetspeedUserProfile entity, Portlets portlets)
{
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
try
{
JetspeedUser user = JetspeedSecurity.getUser(entity.getUserName());
@@ -1233,7 +1232,7 @@
*/
public Profile createGroupProfile(JetspeedGroupProfile entity, Portlets
portlets)
{
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
try
{
Group group = JetspeedSecurity.getGroup(entity.getGroupName());
@@ -1264,7 +1263,7 @@
*/
public Profile createRoleProfile(JetspeedRoleProfile entity, Portlets portlets)
{
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
try
{
Role role = JetspeedSecurity.getRole(entity.getRoleName());
1.2 +3 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPGroupManagement.java
Index: LDAPGroupManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPGroupManagement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LDAPGroupManagement.java 21 Oct 2002 22:31:15 -0000 1.1
+++ LDAPGroupManagement.java 8 Nov 2002 10:05:18 -0000 1.2
@@ -94,7 +94,6 @@
// Profile
import org.apache.jetspeed.om.profile.Profile;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.ProfileException;
@@ -113,8 +112,8 @@
/**
*
* @author <a href="mailto:ender@;kilicoglu.nom.tr">Ender KILICOGLU</a>
- * @version $Id$
- *
+ * @version $Id$
+ *
*/
public class LDAPGroupManagement extends TurbineBaseService
implements GroupManagement
@@ -262,7 +261,7 @@
(JetspeedRunDataService)TurbineServices.getInstance()
.getService(RunDataService.SERVICE_NAME);
JetspeedRunData rundata = runDataService.getCurrentRunData();
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setGroup(group);
profile.setMediaType("html");
Profiler.createProfile(rundata, profile);
1.2 +3 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPRoleManagement.java
Index: LDAPRoleManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPRoleManagement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LDAPRoleManagement.java 21 Oct 2002 22:31:15 -0000 1.1
+++ LDAPRoleManagement.java 8 Nov 2002 10:05:18 -0000 1.2
@@ -95,7 +95,6 @@
// Profile
import org.apache.jetspeed.om.profile.Profile;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.ProfileException;
@@ -114,8 +113,8 @@
/**
*
* @author <a href="mailto:ender@;kilicoglu.nom.tr">Ender KILICOGLU</a>
- * @version $Id$
- *
+ * @version $Id$
+ *
*/
public class LDAPRoleManagement extends TurbineBaseService
implements RoleManagement
@@ -266,7 +265,7 @@
(JetspeedRunDataService)TurbineServices.getInstance()
.getService(RunDataService.SERVICE_NAME);
JetspeedRunData rundata = runDataService.getCurrentRunData();
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setRole(role);
profile.setMediaType("html");
Profiler.createProfile(rundata, profile);
1.2 +3 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPUserManagement.java
Index: LDAPUserManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/ldap/LDAPUserManagement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LDAPUserManagement.java 21 Oct 2002 22:31:15 -0000 1.1
+++ LDAPUserManagement.java 8 Nov 2002 10:05:18 -0000 1.2
@@ -86,7 +86,6 @@
import org.apache.turbine.services.rundata.RunDataService;
import org.apache.jetspeed.services.resources.JetspeedResources;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.om.profile.Profile;
import java.security.Principal;
@@ -100,8 +99,8 @@
/**
*
* @author <a href="mailto:ender@;kilicoglu.nom.tr">Ender KILICOGLU</a>
- * @version $Id$
- *
+ * @version $Id$
+ *
*/
public class LDAPUserManagement extends TurbineBaseService
implements UserManagement,
@@ -271,7 +270,7 @@
JetspeedRunData rundata = getRunData();
if (rundata != null)
{
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setUser(user);
profile.setMediaType("html");
Profiler.createProfile(getRunData(), profile);
1.5 +4 -5
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineGroupManagement.java
Index: TurbineGroupManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineGroupManagement.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TurbineGroupManagement.java 18 Oct 2002 19:16:32 -0000 1.4
+++ TurbineGroupManagement.java 8 Nov 2002 10:05:18 -0000 1.5
@@ -90,7 +90,6 @@
// Profile
import org.apache.jetspeed.om.profile.Profile;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.ProfileException;
@@ -276,7 +275,7 @@
(JetspeedRunDataService)TurbineServices.getInstance()
.getService(RunDataService.SERVICE_NAME);
JetspeedRunData rundata = runDataService.getCurrentRunData();
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setGroup(group);
profile.setMediaType("html");
Profiler.createProfile(rundata, profile);
@@ -366,9 +365,9 @@
TurbineGroupPeer.doDelete(criteria, conn);
PsmlManager.removeGroupDocuments(group);
-
+
conn.commit();
-
+
}
catch(Exception e)
{
1.6 +5 -6
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineRoleManagement.java
Index: TurbineRoleManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineRoleManagement.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineRoleManagement.java 18 Oct 2002 19:16:32 -0000 1.5
+++ TurbineRoleManagement.java 8 Nov 2002 10:05:18 -0000 1.6
@@ -94,7 +94,6 @@
// Profile
import org.apache.jetspeed.om.profile.Profile;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.services.Profiler;
import org.apache.jetspeed.om.profile.ProfileException;
@@ -158,7 +157,7 @@
{
if (cachingEnable)
{
- Iterator result = JetspeedSecurityCache.getRoles(username);
+ Iterator result = JetspeedSecurityCache.getRoles(username);
if (null != result)
{
return result;
@@ -284,7 +283,7 @@
(JetspeedRunDataService)TurbineServices.getInstance()
.getService(RunDataService.SERVICE_NAME);
JetspeedRunData rundata = runDataService.getCurrentRunData();
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setRole(role);
profile.setMediaType("html");
Profiler.createProfile(rundata, profile);
@@ -378,8 +377,8 @@
TurbineRolePeer.doDelete(criteria, conn);
PsmlManager.removeRoleDocuments(role);
-
- conn.commit();
+
+ conn.commit();
if (cachingEnable)
{
1.7 +44 -45
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineUserManagement.java
Index: TurbineUserManagement.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/turbine/TurbineUserManagement.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TurbineUserManagement.java 15 Oct 2002 17:35:33 -0000 1.6
+++ TurbineUserManagement.java 8 Nov 2002 10:05:18 -0000 1.7
@@ -64,7 +64,7 @@
import org.apache.torque.util.Criteria;
import org.apache.torque.om.NumberKey;
-// Turbine
+// Turbine
import org.apache.turbine.util.Log;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.TurbineServices;
@@ -76,7 +76,6 @@
import org.apache.jetspeed.om.security.turbine.TurbineUserPeer;
-import org.apache.jetspeed.om.profile.BaseProfile;
import org.apache.jetspeed.om.profile.Profile;
// Jetspeed Security
@@ -108,11 +107,11 @@
/**
- * Default Jetspeed-Turbine User Management implementation
+ * Default Jetspeed-Turbine User Management implementation
+ *
*
- *
* @author <a href="mailto:david@;bluesunrise.com">David Sean Taylor</a>
- * @author <a href="mailto:morciuch@;apache.org">Mark Orciuch</a>
+ * @author <a href="mailto:morciuch@;apache.org">Mark Orciuch</a>
* @version $Id$
*/
@@ -127,7 +126,7 @@
String passwordsAlgorithm = "SHA";
private final static String CONFIG_NEWUSER_ROLES = "newuser.roles";
- private final static String [] DEFAULT_CONFIG_NEWUSER_ROLES =
+ private final static String [] DEFAULT_CONFIG_NEWUSER_ROLES =
{ "user" };
String roles[] = null;
@@ -144,7 +143,7 @@
* The principal can be any valid Jetspeed Security Principal:
* <code>org.apache.jetspeed.om.security.UserNamePrincipal</code>
* <code>org.apache.jetspeed.om.security.UserIdPrincipal</code>
- *
+ *
* The security service may optionally check the current user context
* to determine if the requestor has permission to perform this action.
*
@@ -153,7 +152,7 @@
* @exception UserException when the security provider has a general failure
retrieving a user.
* @exception UnknownUserException when the security provider cannot match
* the principal identity to a user.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public JetspeedUser getUser(Principal principal)
throws JetspeedSecurityException
@@ -180,7 +179,7 @@
}
catch(Exception e)
{
- throw new UserException("Failed to retrieve user '" +
+ throw new UserException("Failed to retrieve user '" +
principal.getName() + "'", e);
}
if ( users.size() > 1 )
@@ -203,7 +202,7 @@
*
* @return a collection of <code>JetspeedUser</code> entities.
* @exception UserException when the security provider has a general failure
retrieving users.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public Iterator getUsers()
throws JetspeedSecurityException
@@ -217,19 +216,19 @@
catch(Exception e)
{
throw new UserException("Failed to retrieve users ", e);
- }
+ }
return users.iterator();
}
/**
- * Retrieves a collection of <code>JetspeedUser</code>s filtered by a security
+ * Retrieves a collection of <code>JetspeedUser</code>s filtered by a security
* provider-specific query string. For example SQL, OQL, JDOQL.
* The security service may optionally check the current user context
* to determine if the requestor has permission to perform this action.
*
* @return a collection of <code>JetspeedUser</code> entities.
* @exception UserException when the security provider has a general failure
retrieving users.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public Iterator getUsers(String filter)
throws JetspeedSecurityException
@@ -245,18 +244,18 @@
catch(Exception e)
{
throw new UserException("Failed to retrieve users ", e);
- }
+ }
return users.iterator();
}
/**
- * Saves a <code>JetspeedUser</code>'s attributes into permanent storage.
+ * Saves a <code>JetspeedUser</code>'s attributes into permanent storage.
* The user's account is required to exist in the storage.
* The security service may optionally check the current user context
* to determine if the requestor has permission to perform this action.
*
* @exception UserException when the security provider has a general failure
retrieving users.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public void saveUser(JetspeedUser user)
throws JetspeedSecurityException
@@ -280,23 +279,23 @@
/**
- * Adds a <code>JetspeedUser</code> into permanent storage.
+ * Adds a <code>JetspeedUser</code> into permanent storage.
* The security service can throw a <code>NotUniqueUserException</code> when
the public
* credentials fail to meet the security provider-specific unique constraints.
* The security service may optionally check the current user context
* to determine if the requestor has permission to perform this action.
*
* @exception UserException when the security provider has a general failure
retrieving users.
- * @exception NotUniqueUserException when the public credentials fail to meet
+ * @exception NotUniqueUserException when the public credentials fail to meet
* the security provider-specific unique
constraints.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public void addUser(JetspeedUser user)
throws JetspeedSecurityException
{
if(accountExists(user))
{
- throw new NotUniqueUserException("The account '" +
+ throw new NotUniqueUserException("The account '" +
user.getUserName() + "' already exists");
}
String initialPassword = user.getPassword();
@@ -306,7 +305,7 @@
try
{
- NumberKey key = (NumberKey)TurbineUserPeer.doInsert(criteria);
+ NumberKey key = (NumberKey)TurbineUserPeer.doInsert(criteria);
((BaseJetspeedUser)user).setUserId(key.toString());
@@ -325,7 +324,7 @@
* are assigned to the new user.
*
* @param user The new user.
- * @throws
+ * @throws
*/
protected void addDefaultPSML(JetspeedUser user)
throws JetspeedSecurityException
@@ -334,7 +333,7 @@
{
try
{
- JetspeedSecurity.grantRole(user.getUserName(),
+ JetspeedSecurity.grantRole(user.getUserName(),
JetspeedSecurity.getRole(roles[ix]).getName());
}
catch(Exception e)
@@ -347,7 +346,7 @@
JetspeedRunData rundata = getRunData();
if (rundata != null && Profiler.useRoleProfileMerging() == false)
{
- Profile profile = new BaseProfile();
+ Profile profile = Profiler.createProfile();
profile.setUser(user);
profile.setMediaType("html");
Profiler.createProfile(getRunData(), profile);
@@ -370,7 +369,7 @@
* @exception UserException when the security provider has a general failure
retrieving a user.
* @exception UnknownUserException when the security provider cannot match
* the principal identity to a user.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public void removeUser(Principal principal)
throws JetspeedSecurityException
@@ -408,20 +407,20 @@
///////////////////////////////////////////////////////////////////////////
// Credentials Management
///////////////////////////////////////////////////////////////////////////
-
+
/**
* Allows for a user to change their own password.
*
- * @param user the JetspeedUser to change password
+ * @param user the JetspeedUser to change password
* @param oldPassword the current password supplied by the user.
* @param newPassword the current password requested by the user.
* @exception UserException when the security provider has a general failure
retrieving a user.
* @exception UnknownUserException when the security provider cannot match
* the principal identity to a user.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public void changePassword( JetspeedUser user,
- String oldPassword,
+ String oldPassword,
String newPassword )
throws JetspeedSecurityException
{
@@ -431,7 +430,7 @@
String encrypted = JetspeedSecurity.encryptPassword(oldPassword);
if(!accountExists(user))
{
- throw new UnknownUserException("The account '" +
+ throw new UnknownUserException("The account '" +
user.getUserName() + "' does not exist");
}
if(!user.getPassword().equals(encrypted))
@@ -447,7 +446,7 @@
// save the changes in the database immediately, to prevent the password
// being 'reverted' to the old value if the user data is lost somehow
- // before it is saved at session's expiry.
+ // before it is saved at session's expiry.
saveUser(user);
}
@@ -458,26 +457,26 @@
* compromised passwords. Certain implementatations of this feature
* would require administrative level access to the authenticating
* server / program.
- *
+ *
* @param user the user to change the password for.
- * @param password the new password.
+ * @param password the new password.
* @exception UserException when the security provider has a general failure
retrieving a user.
* @exception UnknownUserException when the security provider cannot match
* the principal identity to a user.
- * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
+ * @exception InsufficientPrivilegeException when the requestor is denied due
to insufficient privilege
*/
public void forcePassword( JetspeedUser user, String password )
throws JetspeedSecurityException
{
if(!accountExists(user))
{
- throw new UnknownUserException("The account '" +
+ throw new UnknownUserException("The account '" +
user.getUserName() + "' does not exist");
}
user.setPassword(JetspeedSecurity.encryptPassword(password));
- // save the changes in the database immediately, to prevent the
- // password being 'reverted' to the old value if the user data
- // is lost somehow before it is saved at session's expiry.
+ // save the changes in the database immediately, to prevent the
+ // password being 'reverted' to the old value if the user data
+ // is lost somehow before it is saved at session's expiry.
saveUser(user);
}
@@ -531,14 +530,14 @@
/**
- * This is the early initialization method called by the
+ * This is the early initialization method called by the
* Turbine <code>Service</code> framework
* @param conf The <code>ServletConfig</code>
* @exception throws a <code>InitializationException</code> if the service
* fails to initialize
*/
- public synchronized void init(ServletConfig conf)
- throws InitializationException
+ public synchronized void init(ServletConfig conf)
+ throws InitializationException
{
if (getInit()) return;
@@ -559,7 +558,7 @@
}
catch (Exception e)
{}
-
+
if (null == roles || roles.length == 0)
{
roles = DEFAULT_CONFIG_NEWUSER_ROLES;
@@ -584,8 +583,8 @@
* @param user the user to be checked.
* @param checkUniqueId make sure that we aren't overwriting another user with
different id
* @return true if the specified account exists
- * @throws UserException if there was a general db access error
- *
+ * @throws UserException if there was a general db access error
+ *
*/
protected boolean accountExists( JetspeedUser user )
throws UserException
1.13 +26 -27
jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java
Index: JetspeedTemplateLocatorService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JetspeedTemplateLocatorService.java 24 Oct 2002 16:17:21 -0000 1.12
+++ JetspeedTemplateLocatorService.java 8 Nov 2002 10:05:19 -0000 1.13
@@ -85,7 +85,6 @@
// jetspeed.capability
import org.apache.jetspeed.capability.CapabilityMap;
-import org.apache.jetspeed.capability.CapabilityMapFactory;
// jetspeed.util
import org.apache.jetspeed.util.MimeType;
@@ -133,7 +132,7 @@
// the template root directories, webapp relative
private String[] templateRoots;
-
+
// use the name cache when looking up a template
private boolean useNameCache = true;
@@ -141,7 +140,7 @@
private Map templateMap = null;
/**
- * This is the early initialization method called by the
+ * This is the early initialization method called by the
* Turbine <code>Service</code> framework
* @param conf The <code>ServletConfig</code>
* @exception throws a <code>InitializationException</code> if the service
@@ -152,7 +151,7 @@
// already initialized
if (getInit()) return;
- initConfiguration();
+ initConfiguration();
// initialization done
setInit(true);
@@ -173,7 +172,7 @@
}
/**
- * This is the shutdown method called by the
+ * This is the shutdown method called by the
* Turbine <code>Service</code> framework
*/
public void shutdown() {
@@ -194,7 +193,7 @@
String path = localizeTemplateName(data);
String located = locateTemplate(data, DIR_SCREENS, path, template);
- if (null == located)
+ if (null == located)
{
// Try to locate it directly on file system, perhaps it was recently
added
useNameCache = false;
@@ -230,7 +229,7 @@
String path = localizeTemplateName(data);
String located = locateTemplate(data, DIR_LAYOUTS, path, template);
- if (null == located)
+ if (null == located)
{
// Try to locate it directly on file system, perhaps it was recently
added
useNameCache = false;
@@ -243,7 +242,7 @@
else
{
template = "/default." + getTemplateExtension(template);
- located = locateTemplate(data, DIR_LAYOUTS, path, template);
+ located = locateTemplate(data, DIR_LAYOUTS, path, template);
}
useNameCache = true;
}
@@ -484,7 +483,7 @@
return located;
}
-
+
/**
* General template location algorithm. Starts with the most specific resource,
* including mediatype + nls specification, and fallsback to least specific.
@@ -524,7 +523,7 @@
{
template = PATH_SEPARATOR + template;
}
-
+
StringBuffer fullPath = new StringBuffer( templateRoot );
if (!templateRoot.endsWith(PATH_SEPARATOR))
@@ -532,7 +531,7 @@
fullPath.append(getTemplateExtension(template));
fullPath.append(resourceType);
-
+
String basePath = fullPath.toString();
String realPath = null;
String workingPath = null;
@@ -560,7 +559,7 @@
}
}
while (path != null);
-
+
return null;
}
@@ -607,50 +606,50 @@
data.getUser().setTemp("locale", tmplocale);
StringBuffer templatePath = new StringBuffer();
-
+
// set the content type (including charset)
String type = data.getParameters().getString(Profiler.PARAM_MEDIA_TYPE,
null);
- CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( data );
+ CapabilityMap cm = ((JetspeedRunData)data).getCapability();
if (null == type)
{
type = cm.getPreferredType().getCode();
}
- //data.setContentType( cm.getPreferredType().toString() );
- if ((type != null) && (type.length() > 0))
+ //data.setContentType( cm.getPreferredType().toString() );
+ if ((type != null) && (type.length() > 0))
templatePath.append(PATH_SEPARATOR).append(type);
-
+
// Grab the Locale from the temporary storage in the User object
Locale locale = (Locale)data.getUser().getTemp("locale");
String language = locale.getLanguage();
String country = locale.getCountry();
- if ((language != null) && (language.length() > 0))
+ if ((language != null) && (language.length() > 0))
templatePath.append(PATH_SEPARATOR).append(language);
- if ((country != null) && (country.length() > 0))
+ if ((country != null) && (country.length() > 0))
templatePath.append(PATH_SEPARATOR).append(country);
return templatePath.toString();
}
- /**
+ /**
* Returns the extension for the specified template
*
* @param template the template name to scan for an extension
- * @return the template extension if it exists or the default
+ * @return the template extension if it exists or the default
* template extension
*/
private String getTemplateExtension(String template)
{
String ext = TurbineTemplate.getDefaultExtension();
-
+
int idx = template.lastIndexOf(".");
-
+
if (idx > 0)
{
ext = template.substring(idx+1);
}
-
+
return ext;
}
-
+
/**
* Checks for the existence of a template resource given a key.
* The key are absolute paths to the templates, and are cached
@@ -686,7 +685,7 @@
if ((templateRoots == null) || (templateRoots.length == 0))
throw new InitializationException(
MSG_MISSING_PARAMETER + CONFIG_TEMPLATE_ROOT);
-
+
templateMap = new HashMap();
for (int i = 0; i < templateRoots.length; i++) {
1.3 +46 -47
jakarta-jetspeed/src/java/org/apache/jetspeed/test/TestBasicSecurity.java
Index: TestBasicSecurity.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/test/TestBasicSecurity.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestBasicSecurity.java 28 Jun 2002 05:37:36 -0000 1.2
+++ TestBasicSecurity.java 8 Nov 2002 10:05:19 -0000 1.3
@@ -76,7 +76,6 @@
// Jetspeed imports
import org.apache.jetspeed.capability.CapabilityMap;
-import org.apache.jetspeed.om.profile.BaseProfileLocator;
import org.apache.jetspeed.om.profile.Control;
import org.apache.jetspeed.om.profile.Controller;
import org.apache.jetspeed.om.profile.Profile;
@@ -121,9 +120,9 @@
private static String TEST_TURBINE_PASSWORD ="turbine";
private static String TEST_TURBINE_USER = "turbine";
private static String USER_PORTLET = "SkinBrowser"; // Portlet accessable by
general user, role = user
-
+
private RunData rundata = null;
-
+
/**
* Defines the testcase name for JUnit.
*
@@ -133,7 +132,7 @@
{
super( name );
}
-
+
/**
* Start the tests.
*
@@ -144,7 +143,7 @@
TestRunner.main( new String[]
{ TestBasicSecurity.class.getName() } );
}
-
+
/**
* Creates the test suite.
*
@@ -156,7 +155,7 @@
// All methods starting with "test" will be executed in the test suite.
return new TestSuite( TestBasicSecurity.class );
}
-
+
/**
* Sets up the test case.
*
@@ -164,7 +163,7 @@
protected void setUp() throws Exception
{
}
-
+
/**
* Test: PageURL
* With the page URL "/page/apache"
@@ -180,7 +179,7 @@
, null ,"action=JLoginUser&username="+ TEST_ADMIN_USER + "&password=" +
TEST_ADMIN_PASSWORD);
System.out.println("post set URL = " + theRequest.getURL());
}
-
+
/**
* Create a PSML in the TEST_GROUP with 3 entries.
* 1) ST_01.all no role
@@ -197,27 +196,27 @@
PsmlController controller = null;
PsmlPortlets portlets = null;
PsmlSkin skin = null;
-
+
// Create the RunData object to be used during testing.
rundata = RunDataFactory.getRunData( request, response, config );
assertNotNull( "Got rundata", rundata);
-
+
TurbineTestUtilities.setupRunData(rundata);
// Verify we have a profile
Profile profile = Profiler.getProfile(rundata);
assertNotNull( "Got profile from Profiler", profile);
-
+
// Verify the profile location information in the profile
if (profile instanceof ProfileLocator)
{
currentLocator = (ProfileLocator) profile;
}
-
- newLocator = new BaseProfileLocator();
+
+ newLocator = Profiler.createLocator();
newLocator.setGroupByName(TEST_GROUP);
newLocator.setMediaType(currentLocator.getMediaType());
newLocator.setName(TEST_SECURITY_PAGE);
-
+
// Create portlet set
portlets = new PsmlPortlets();
controller = new PsmlController();
@@ -227,39 +226,39 @@
skin.setName("orange-red");
portlets.setSkin(skin);
rootPortletSet = portlets;
-
+
portlets = new PsmlPortlets();
// Add entries
portlets.addEntry( createEntry(ALL_PORTLET, "ST_01.all"));
portlets.addEntry( createEntry(USER_PORTLET, "ST_01.user"));
portlets.addEntry( createEntry(ADMIN_PORTLET, "ST_01.admin"));
rootPortletSet.addPortlets(portlets);
-
+
Profile newProfile = Profiler.createProfile(newLocator, rootPortletSet);
PSMLDocument doc = newProfile.getDocument();
System.out.println("doc = " + doc.getName());
-
+
// this only works with the default configuration (Castor/Filebased)
File file = new File(doc.getName());
assertTrue(file.exists());
//file.delete();
-
+
TurbineTestUtilities.generatePage(rundata);
TurbineTestUtilities.outputPage(rundata);
-
+
// Return the used RunData to the factory for recycling.
RunDataFactory.putRunData(rundata);
}
-
+
public void endCreateTestPSML(WebResponse theResponse)
{
System.out.println("text length = " + theResponse.getText().length());
// System.out.println("text length = " + theResponse.getText());
}
-
+
/**
* This test verifies that no "Actions" like minimize are displayed for
- * the anonymous user. The ID is used to determine if an action is on
+ * the anonymous user. The ID is used to determine if an action is on
* the page for an entry.
*/
public void beginAnonymousUser(WebRequest theRequest)
@@ -269,19 +268,19 @@
, "/group/" + TEST_GROUP + "/page/" + TEST_SECURITY_PAGE , null );
System.out.println("post set URL = " + theRequest.getURL());
}
-
+
public void testAnonymousUser() throws Exception
{
// Create the RunData object to be used during testing.
rundata = RunDataFactory.getRunData( request, response, config );
assertNotNull( "Got rundata", rundata);
-
+
TurbineTestUtilities.setupRunData(rundata);
-
+
// Verify we have a profile
Profile profile = Profiler.getProfile(rundata);
assertNotNull( "Got profile from Profiler", profile);
-
+
// Verify the profile location information in the profile
if (profile instanceof ProfileLocator)
{
@@ -296,11 +295,11 @@
}
TurbineTestUtilities.generatePage(rundata);
TurbineTestUtilities.outputPage(rundata);
-
+
// Return the used RunData to the factory for recycling.
RunDataFactory.putRunData(rundata);
}
-
+
public void endAnonymousUser(WebResponse theResponse)
{
assertEquals("Verify resulting page does not contain 'ST_01.all'",
theResponse.getText().indexOf("ST_01.all"),-1);
@@ -309,9 +308,9 @@
System.out.println("text length = " + theResponse.getText().length());
// System.out.println("text length = " + theResponse.getText());
}
-
+
/**
- * This test verifies that only protlets with a role of User has "Actions"
+ * This test verifies that only protlets with a role of User has "Actions"
* like minimize are displayed a logged in user with a role = user. The
* ID is used to determine if an action is on the page for an entry.
*/
@@ -322,19 +321,19 @@
, "/group/" + TEST_GROUP + "/page/" + TEST_SECURITY_PAGE ,
"action=JLoginUser&username="+ TEST_TURBINE_USER + "&password=" +
TEST_TURBINE_PASSWORD);
System.out.println("post set URL = " + theRequest.getURL());
}
-
+
public void testTurbineUser() throws Exception
{
// Create the RunData object to be used during testing.
rundata = RunDataFactory.getRunData( request, response, config );
assertNotNull( "Got rundata", rundata);
-
+
TurbineTestUtilities.setupRunData(rundata);
-
+
// Verify we have a profile
Profile profile = Profiler.getProfile(rundata);
assertNotNull( "Got profile from Profiler", profile);
-
+
// Verify the profile location information in the profile
if (profile instanceof ProfileLocator)
{
@@ -349,11 +348,11 @@
}
TurbineTestUtilities.generatePage(rundata);
TurbineTestUtilities.outputPage(rundata);
-
+
// Return the used RunData to the factory for recycling.
RunDataFactory.putRunData(rundata);
}
-
+
public void endTurbineUser(WebResponse theResponse)
{
assertTrue("Verify resulting page contains 'ST_01.all'",
theResponse.getText().indexOf("ST_01.all") > -1);
@@ -362,11 +361,11 @@
System.out.println("text length = " + theResponse.getText().length());
// System.out.println("text length = " + theResponse.getText());
}
-
+
/**
* This test verifies that only protlets with a role of User or admin have
- * "Actions" like minimize are displayed a logged in user with a
- * role = user and admin. The ID is used to determine if an action is on
+ * "Actions" like minimize are displayed a logged in user with a
+ * role = user and admin. The ID is used to determine if an action is on
* the page for an entry.
*/
public void beginAdminUser(WebRequest theRequest)
@@ -376,19 +375,19 @@
, "/group/" + TEST_GROUP + "/page/" + TEST_SECURITY_PAGE ,
"action=JLoginUser&username="+ TEST_ADMIN_USER + "&password=" + TEST_ADMIN_PASSWORD);
System.out.println("post set URL = " + theRequest.getURL());
}
-
+
public void testAdminUser() throws Exception
{
// Create the RunData object to be used during testing.
rundata = RunDataFactory.getRunData( request, response, config );
assertNotNull( "Got rundata", rundata);
-
+
TurbineTestUtilities.setupRunData(rundata);
-
+
// Verify we have a profile
Profile profile = Profiler.getProfile(rundata);
assertNotNull( "Got profile from Profiler", profile);
-
+
// Verify the profile location information in the profile
if (profile instanceof ProfileLocator)
{
@@ -403,11 +402,11 @@
}
TurbineTestUtilities.generatePage(rundata);
TurbineTestUtilities.outputPage(rundata);
-
+
// Return the used RunData to the factory for recycling.
RunDataFactory.putRunData(rundata);
}
-
+
public void endAdminUser(WebResponse theResponse)
{
assertTrue("Verify resulting page contains 'ST_01.all'",
theResponse.getText().indexOf("ST_01.all") > -1);
@@ -425,5 +424,5 @@
entry.setId( id);
return entry;
}
-
+
}
--
To unsubscribe, e-mail: <mailto:jetspeed-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@;jakarta.apache.org>