Darren Gilroy wrote:
> 
> Hi -
> 
> A bit ago, the signature for the following methods:
> org.apache.jetspeed.util.PSMLManager.getPSMLContent() and .setPSMLContent()
> 
> changed from
> (String username, MimeType mimetype)
> to
> (RunData rundata, MimeType mimetype)
> 
> I have a portal application where there is one administrative user that
> selects the portlets for other users, rather than each user selecting their
> own portlets. So, when this API changed, I had to write my own version of
> PSMLManager because the RunData object I had wasn't for the user whose psml
> file I needed to get/set.
> 
> Any chance you would be willing to bring back the old signature? Maybe
> something like this in PSMLManager:
> 
> setPSMLContent( String username, MimeType mimetype ) {
>   --- implementation
> }
> setPSMLContent( RunData data, MimeType mimetype ) {
>         setPSMLContent( data.getUser().getUserName(), mimetype );
> }
> 

In the latest CVS, I introduced a PsmlManager service which is going to completely
obsolete and replace the static PSML manager class so you can plug whatever 
implementation you want.

However, this service currently doesn't support this kind of signature since 
it's the role of the Profiler to match RequestParameters -> PSML resource object.

If I understand correctly your need, you want to be able to explicitely 
specify user/mimetype/etc... parameters which are used for locating PSML files,
is that right ?

So here is what I have in mind and tell me if it works for you (or if you have a
better idea):

- I propose to change the Profile interface to (basically swapping the current Profile
  with the BaseProfile and hiding getURL() which is implementation specific in the
  base BaseProfile implementation)

public interface Profile
{
    // do we really need this ? isn't it better to let the 
    // client object initialize the PortletSet tree if required
    // with the PortalToolkit service ?
    public PortletSet getPortletSet()
   
    // sets and retrieve the PSML document
    public PSMLDocument getDocument()

    public void setDocument(PSMLDocument doc)

    // save the document
    public boolean store()

    // these setters/getters allow you to specify or retrieve
    // all the criteria used for selecting a PSML file
    // Some of these may be mutually exclusive like username/role/group

    public String getUserName()

    public void setUserName( String group )

    public String getMediaType()

    public void setMediaType( String group )

    public String getGroup()

    public void setGroup( String group )

    public String getRole()

    public void setRole( String role )

    public String getPage()

    public void setPage( String page )
}

An instance implementing such an interface could be used by the PsmlManager
service to look for a specific PSML resource thus the PsmlManager service
interface would be :

public interface PsmlManagerService extends Service
{
    public Profile getDocument( Profile profile );

    public boolean saveDocument( Profile profile );    

    public boolean saveDocument( Profile profile, PSMLDocument doc );    
}

and the Profiler interface could stay about the same with methods 
like 

    public Profile getProfile(RunData data)

    public Profile getProfile(RunData data, String role)

    etc...

and

   // return an empty profile
   public Profile createProfile(RunData rundata, String userName)
        throws ProfileException;

   // return a profile, read the request params from request and
   // override username...
   public Profile createProfile(RunData rundata, String userName)
        throws ProfileException;

The flow for manipulating the configuration files would then be:

// create the object
Profile baseProfile = Profiler.getProfile(rundata);

PSMLDocument doc = baseProfile.getDocument(baseProfile);
// this would call PsmlManager.getDocument(baseProfile) if necessary

-- manipulate the document --

baseProfile.setUsername(<myuser>);
baseProfile.store();
// this would call PsmlManager.saveDocument(baseProfile);

(the previous snippet has actually loaded a Profile, edit its document
 and saved it as another user configuration)

The only reason why I've not yet implemented this is that it takes time
and break a few things around but I guess it's a much cleaner process and
it's not tied to a URL/file based implementation...

Comments ?

--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to