String message = "Could not find given entry ";
logger.error( message );
return new StringElement( message );
}
Portlet portlet = null;
try {
portlet = PortletFactory.getPortlet( portletName, "0" );
} catch (PortletException e) {
logger.error("Exception", e);
return new StringElement( e.getMessage() );
}
Table t = new Table();
t.addElement( this.getRow( "Portlet name: " + portlet.getName() ) );
String url = portlet.getPortletConfig().getURL();
if ( url != null ) {
t.addElement( this.getRow( "From URL: " + url ) );
try {
long urlUpdated = JetspeedDiskCache.getInstance().getEntry( url ).getLastModified();
t.addElement( this.getRow( "URL last updated: " + df.format( new Date(urlUpdated) ) ) );
long urlExpires = JetspeedDiskCache.getInstance().getEntry( url ).getExpirationTime();
t.addElement( this.getRow( "URL expires: " + df.format( new Date(urlExpires) ) ) );
} catch ( IOException e ) {
logger.error("Exception", e);
}
}
t.addElement( this.getRow( "Portlet last updated: " + df.format( new Date(portlet.getCreationTime()) ) ) );
//BEGIN 3RD PARTY REPL
t.addElement( new TR().addElement( new TD()
.addElement( new B().addElement( "Actions:" ) ) ) );
String internal = null;
JetspeedLink jsLink = null;
try
{
jsLink = JetspeedLinkFactory.getInstance(rundata);
String mtype = rundata.getParameters().getString("mtype");
if (mtype != null)
{
jsLink.setMediaType(mtype);
jsLink.addQueryData("mtype", mtype);
}
String js_peid = rundata.getParameters().getString("js_peid");
// FIX ME: If the portlet is viewed in Avantgo and then portlet info is restored, the portlet will
// be maximized (similar to customizing certain portlet types. The desired effect would be to
// set the portlet's mode to normal.
internal = jsLink.addPathInfo("js_peid", js_peid).setAction("controls.Maximize").toString();
}
catch (Exception e)
{
logger.error("Exception", e);
}
JetspeedLinkFactory.putInstance(jsLink);
StringBuffer external = new StringBuffer( getPortletConfig().getInitParameter( THIRDPARTY_PORTLETRENDERER_URL_KEY ) );
//this is the parameters of what so specify to the 3rd party provider
external.append("&title=" + URLEncoder.encode( portlet.getTitle() ) );
external.append("&url=" + URLEncoder.encode(internal));
String message = getPortletConfig().getInitParameter( THIRDPARTY_PORTLETRENDERER_CAPTION_KEY );
t.addElement( new TR()
.addElement( new TD()
.addElement( new A( external.toString() ).setTarget("_blank").addElement( message ) ) ) );
//END 3RD PARTY REPL
// BEGIN MIME TYPE SUPPORT
/* RL: Temporarily disable mime support while changing registry
t.addElement( new TR().addElement( new TD()
.addElement( new B().addElement( "Mime Types:" ) ) ) );
MimeType[] mts = portlet.getPortletConfig().getCapabilityMap().getMimeTypes();
for ( int i = 0; i < mts.length; ++i ) {
t.addElement( new TR()
.addElement( new TD( mts[i].toString() ) ) );
}
*/
//END MIME TYPE SUPPORT
//BEGIN PROPERTIES SECTION
Iterator names= portlet.getPortletConfig().getInitParameterNames();
if ( names.hasNext() ) {
//OK... add the Properties from the Portet to this info set...
t.addElement( new TR().addElement( new TD()
.addElement( new B().addElement( "Properties:" ) ) ) );
}
while ( names.hasNext() ) {
String name = (String)names.next();
String value = (String)portlet.getPortletConfig().getInitParameter( name );
t.addElement( new TR()
.addElement( new TD( name + ": " + value ) ) );
}