You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Ze maria <ze...@gmail.com> on 2005/04/29 02:32:55 UTC
Portlets in portal
How can i get all the portlets available in my portal ?
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: Portlets in portal
Posted by Ze maria <ze...@gmail.com>.
Well i did it another way:
org.apache.jetspeed.modules.actions.portlets.CustomizeSetAction.buildPortletList(rundata,
set, "html",resutl);
and it worked, my new problem is this: i've every portlet available in
my portal and i've selected that one's i require , but how can i say
"you appear" and "you don't appear" in a velocity action ?
On 4/29/05, Sven Thiergen <s....@itcampus.de> wrote:
> >
> > How can i get all the portlets available in my portal ?
> >
>
>
> Put a "jetspeed-portlet.xml" into your portlet's WEB-INF/ directory with
> the
> following content:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <portlet-app id="PortletID" version="1.0"
> xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
> xmlns:js="http://portals.apache.org/jetspeed"
> xmlns:dc="http://www.purl.org/dc">
>
> <dc:title>My Portlet</dc:title>
> <dc:title xml:lang="en">My Portlet</dc:title>
> <dc:creator>MySelf</dc:creator>
>
> <js:services>
> <js:service name='PortletRegistryComponent'/>
> <js:service name='ApplicationServerManager'/>
> <js:service name='PortletFactory'/>
> <js:service name='DeploymentManager'/>
> </js:services>
>
> </portlet-app>
>
> _____________________________________
>
> The point are the <js:services> entries. All Services bound as <js:service>
> elements are available then in your portlet; e.g. during initialisation:
>
>
> public class MyPortlet extends GenericPortlet
> {
> // you access the bound service with the prefix 'cps:' and the name used
> in the
> // <js:service> element
> private final static String CPS_REGISTRY_COMPONENT =
> "cps:PortletRegistryComponent";
> ...
>
> public void init(PortletConfig p_oConfig) throws PortletException
> {
> super.init(p_oConfig);
>
> // Trying to get the portlet registry
> PortletContext context = getPortletContext();
> PortletRegistry registry = (PortletRegistry)
> context.getAttribute(CPS_REGISTRY_COMPONENT);
> if (registry != null)
> {
> Collection<PortletDefinition> portletDefs =
> registry.getAllPortletDefinitions();
> for (PortletDefinition pDef: portletDefs) {
> log.info(pDef.getName());
> }
> }
> }
>
> ...
> }
>
>
> Sven.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
AW: Portlets in portal
Posted by Sven Thiergen <s....@itcampus.de>.
>
> How can i get all the portlets available in my portal ?
>
Put a "jetspeed-portlet.xml" into your portlet's WEB-INF/ directory with the
following content:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app id="PortletID" version="1.0"
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
xmlns:js="http://portals.apache.org/jetspeed"
xmlns:dc="http://www.purl.org/dc">
<dc:title>My Portlet</dc:title>
<dc:title xml:lang="en">My Portlet</dc:title>
<dc:creator>MySelf</dc:creator>
<js:services>
<js:service name='PortletRegistryComponent'/>
<js:service name='ApplicationServerManager'/>
<js:service name='PortletFactory'/>
<js:service name='DeploymentManager'/>
</js:services>
</portlet-app>
_____________________________________
The point are the <js:services> entries. All Services bound as <js:service>
elements are available then in your portlet; e.g. during initialisation:
public class MyPortlet extends GenericPortlet
{
// you access the bound service with the prefix 'cps:' and the name used
in the
// <js:service> element
private final static String CPS_REGISTRY_COMPONENT =
"cps:PortletRegistryComponent";
...
public void init(PortletConfig p_oConfig) throws PortletException
{
super.init(p_oConfig);
// Trying to get the portlet registry
PortletContext context = getPortletContext();
PortletRegistry registry = (PortletRegistry)
context.getAttribute(CPS_REGISTRY_COMPONENT);
if (registry != null)
{
Collection<PortletDefinition> portletDefs =
registry.getAllPortletDefinitions();
for (PortletDefinition pDef: portletDefs) {
log.info(pDef.getName());
}
}
}
...
}
Sven.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org