[jboss-user] [JBoss Portal] - Re: Packaging of portlet-instances.xml

julien@jboss.com do-not-reply at jboss.com
Wed Jan 31 17:15:57 EST 2007


portlet-instances.xml file have to be packaged with a war file because they require the portlet to be present and the only way to achieve that is by doing such a deployment.

otherwise the -instances.xml file could be created before the war file containing the portlet is deployed.

you still have the option of using programmatic code that will use directly the InstanceContainer interface to create portlet instances programmatically :

public interface InstanceContainer
  | {
  | 
  | ...
  | 
  |    /**
  |     * Return the underlying portlet invoker for the instance container.
  |     *
  |     * @return the portlet invoker
  |     */
  |    PortletInvoker getPortletInvoker();
  | 
  |    /**
  |     * Create a new instance of the specified portlet.
  |     *
  |     * @param id
  |     * @param portletId the portlet id
  |     * @return the newly created instance
  |     * @throws DuplicateInstanceException if the instance already exist
  |     * @throws IllegalArgumentException   if the instance id is null
  |     */
  |    InstanceDefinition createDefinition(String id, String portletId) throws DuplicateInstanceException, IllegalArgumentException, PortletInvokerException;
  | 
  | ...
  | 
  | }

In order to find out the right portlet id to use, you should use the getPortletInvoker() method to retrieve the portlet invoker behind the instance container and on the portlet invoker you have a getPortlets() method which returns all the portlets known by the portlet invoker. It is a set of PortletInfo interface which will give you the portlet name as well as all the metadata provided by the portlet (from portlet.xml and jboss-portlet.xlm for example).


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009067#4009067

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009067



More information about the jboss-user mailing list