You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Marek Nowak <ma...@op.pl> on 2005/01/26 11:53:32 UTC

jetspeed API

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

Re: jetspeed API

Posted by David Sean Taylor <da...@bluesunrise.com>.
Marek Nowak wrote:
> Thank you. Do you have any piece of code of application that 
> communicates with any portlet? For example using 
> "PortletEntityAccessComponent"?
> 
> Marek

There are plenty of examples of using the entity access component in the 
Jetspeed /portals code.

Using the PortletEntityAccessComponent would be a Jetspeed-specific 
implementation, and thats the drawback.

I've started work on a simple abstraction for portlet communication 
based on a simple messaging abstraction. It only communicates over the 
logged in session, as this was the common use case I was seeing more 
than anything else.

http://cvs.apache.org/viewcvs.cgi/jakarta-jetspeed-2/portals-bridges/common/src/java/org/apache/portals/messaging/

Also, I believe Peter Meir has a portlet messaging implementation that 
may be much more thorough than the abstraction above, although I haven't 
seen the code yet...



> 
> 
> ----- Original Message ----- From: "David Sean Taylor" 
> <da...@bluesunrise.com>
> To: "Jetspeed Developers List" <je...@jakarta.apache.org>
> 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: jetspeed-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
> 
> 
> 


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: jetspeed API

Posted by Marek Nowak <ma...@op.pl>.
Thank you. Do you have any piece of code of application that communicates 
with any portlet? For example using "PortletEntityAccessComponent"?

Marek


----- Original Message ----- 
From: "David Sean Taylor" <da...@bluesunrise.com>
To: "Jetspeed Developers List" <je...@jakarta.apache.org>
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: jetspeed-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: jetspeed API

Posted by David Sean Taylor <da...@bluesunrise.com>.
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