Marek
----- Original Message ----- From: "David Sean Taylor" <[EMAIL PROTECTED]>
To: "Jetspeed Developers List" <[email protected]>
Sent: Wednesday, January 26, 2005 1:04 PM
Subject: Re: jetspeed API
Marek Nowak wrote:Hello
Can anybody please tell if application that is deployed at the same server as JS2 is, can ccommunicate with Jetspeed2? I mean, I want my web applicaion to manage some of the portlets - create new portlet instances, manage their properties, etc.
Marek
Yes.
Examples of this in the PAM and Security portlet applications.
Basically you do this by exposing Jetspeed components in Spring, declaring requested services in the jetspeed-portlet.xml, and then getting the service in the portlet init:
jetspeed-spring.xml:
<!-- Portlet Services -->
<bean id="PortalServices"
class="org.apache.jetspeed.services.JetspeedPortletServices" >
<constructor-arg>
<map>
<entry key="PortletRegistryComponent">
<ref bean="org.apache.jetspeed.components.portletregistry.PortletRegistry" />
</entry>
<entry key="SearchComponent">
<ref bean="org.apache.jetspeed.search.SearchEngine"/>
</entry>
<entry key="PAM">
<ref bean="PAM" />
</entry> <entry key="UserManager">
<ref bean="org.apache.jetspeed.security.UserManager"/>
</entry>
<entry key="PageManager">
<ref bean="org.apache.jetspeed.page.PageManager"/>
</entry>
<entry key="RoleManager">
<ref bean="org.apache.jetspeed.security.RoleManager"/>
</entry>
<entry key="GroupManager">
<ref bean="org.apache.jetspeed.security.GroupManager"/>
</entry> <entry key="Profiler">
<ref bean="org.apache.jetspeed.profiler.Profiler"/>
</entry> <entry key="SSO">
<ref bean="org.apache.jetspeed.sso.SSOProvider"/>
</entry> <entry key="EntityAccessor">
<ref bean='org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent'/>
</entry>
</map>
</constructor-arg>
</bean>
example jetspeed-portlet.xml:
<js:services> <js:service name='UserManager'/> <js:service name='RoleManager'/> <js:service name='GroupManager'/> <js:service name="Profiler" /> <js:service name="SSO" /> </js:services>
init() of portlet:
public void init(PortletConfig config)
throws PortletException
{
super.init(config);
userManager = (UserManager)getPortletContext().getAttribute(SecurityResources.CPS_USER_MANAGER_COMPONENT);
if (null == userManager)
{
throw new PortletException("Failed to find the User Manager on portlet initialization");
}
roleManager = (RoleManager)getPortletContext().getAttribute(SecurityResources.CPS_ROLE_MANAGER_COMPONENT);
if (null == roleManager)
{
throw new PortletException("Failed to find the Role Manager on portlet initialization");
}
groupManager = (GroupManager)getPortletContext().getAttribute(SecurityResources.CPS_GROUP_MANAGER_COMPONENT);
if (null == groupManager)
{
throw new PortletException("Failed to find the Group Manager on portlet initialization");
}
profiler = (Profiler)getPortletContext().getAttribute(SecurityResources.CPS_PROFILER_COMPONENT);
if (null == profiler)
{
throw new PortletException("Failed to find the Profiler on portlet initialization");
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
