I created a simple customization feature: there can be more than one
PSML file (both, in the case of default user and in the case of
authenticated users). Right now it searches for this file in this order,
if the custom file is specified:
1. username_customFile.psml
2. customFile.psml
3. default.psml
Otherwise it uses the old pattern:
1. username.psml
2. default.psml
I was thinking, maybe it is beneficial to also add one more fallback
mechanism, to use the following search order in the case of custom file:
1. username_customFile.psml
2. username.psml
3. customFile.psml
4. default.psml
I'm not sure about this, though. Anybody else, comments?
Ideally I would like to put different files for different users in
separate directories.
Default/default.psml
Default/customFile.psml
Neeme/default.psml
Neeme/customFile.psml
Would be cleaner solution, but it wouldn't be backwards compatible...
I was also thinking about the user personalization in the case of
current codebase (no Cocoon2, etc.).
When user specifies different files, Jetspeed tries to find the user's
personal file, if not found, would take the common file (for all users)
with that name, if that is also not found then would take the deafult
file for all users.
In case user modifies something on some page (minimizes a portlet, etc),
Jetspeed creates a copy of the common file for the user and then saves
changes to that file. This would save disk space, as quite many of the
users probably won't want to use the personalization features.
Also, this rises the issue of storing metainformation about these files:
I want to show kind of toolbar to the user with links to some or all
possible custom files.
Any comments?
Neeme
PS. I included here my overloaded PortletFactory.getInstance() method to
enable the custom file feature.
public static final PortletFactory getInstance( User user, String
customFile ) {
StringBuffer url = new
StringBuffer(JetspeedResources.getInstance().getString(
JetspeedResources.PSML_BASE_URL_KEY ));
try {
if (customFile.length() == 0)
url.append(user.getUserName());
else
{
url.append(user.getUserName()).append("_" + customFile);
}
DiskCacheEntry pde =
JetspeedDiskCache.getInstance().getEntry( url.toString() );
if (!pde.getFile().exists())
{
throw(new Exception("no user specific portlet definition
found"));
}
else
{
}
} catch (Exception e) {
Log.note("no user specific portlet definition found,
reverting to default");
if (customFile.length() == 0)
{
url = new
StringBuffer(JetspeedResources.getInstance().getString(
JetspeedResources.PSML_BASE_URL_KEY ))
.append(JetspeedResources.getInstance().getString(
JetspeedResources.PSML_DEFAULT_USER_KEY ));
}
else
{
url = new
StringBuffer(JetspeedResources.getInstance().getString(
JetspeedResources.PSML_BASE_URL_KEY ))
.append(customFile);
}
}
url.append(".psml");
return getInstance( url.toString() );
}
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]