portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sean Taylor <da...@bluesunrise.com>
Subject Re: jetspeed API
Date Wed, 26 Jan 2005 12:04:12 GMT
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: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message