RE: Portal Services?

2005-02-07 Thread Frank Villarreal
Thanks, Scott.  You just made my week.  :-)


- Frank



-Original Message-
From: Scott T. Weaver [mailto:[EMAIL PROTECTED]
Sent: Monday, February 07, 2005 09:13 AM
To: Jetspeed Users List
Subject: Re: Portal Services?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Portal Services?

2005-02-07 Thread Scott T. Weaver
Hi Frank,
Frank Villarreal wrote:
Question about Portal Services:
I know that in Pluto, you are able to create a "Portal Service" that may be
utilized by the portlet container (and in effect, portlets within it).  I've
noted that in Jetspeed2, services are configured within the Spring file
"jetspeed-spring.xml".  Another thing that I also noticed, is that the
services defined within that assembly file did not appear to implement any
special interface ... whereas in Pluto I was under the impression that
"services" had to implement a designated "Service" interface (w/init &
destroy methods).  Is this not the case in J2's implementation?
 

No it is not the case with J2.  The Spring Framework allows us the 
flexibility of developing a service layer without having to implement 
specific lifecyclye and other interfaces.

But anyway  here is my MAIN question  HOW do you get acquire a
"reference" on a portal service instance from within a portlet's "init" or
"processAction" methods  For example, if I created a service in J2 named
"MyService", from within my portlet's init method, how do I grab a handle on
it?
 

if you look inside the jetspeed-spring.xml, you will notice this bean 
definition near the top:

 
 
class="org.apache.jetspeed.services.JetspeedPortletServices" >


  
  
  
  
  
  
  
  
   
  

  
  

  
  

  
  

   
  
  
  
  
  
  
  
   
  


 

This bean exposes pre-existing services (defined further down within the 
jetspeed-spring.xml) that can subsequently be accessed by you portlets 
through the javax.portlet.PortletContext. 

For a portlet to access an exposed service, you will need to define a 
jetspeed-portlet.xml extended deployment descriptor to your portlet 
app.  This file lives in the WEB-INF directory of your application.  
This example is taken from the the jetspeed-portlet.xml in the 
applications/pam portlet app in jetspeed:


   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";>
  
   Security Portlets
   Security Portlets
   J2 Team
  
   
   LoginPortlet
   Login Portlet
   J2 Team
   

   
   LocaleSelectorPortlet
   Locale Selector Portlet
   J2 Team
   
   
   
   
   
   
   
   
   
   
  


notice the  element, this is where you would define which, 
previously defined services should be made available to this app.

Here is an example of accessing the Portlet Registry service within a 
portlet:

PortletRegistry registry = 
(PortletRegistry)context.getAttribute("cps:PortletRegistryComponent");

Notice that all service are prefixed with "cps:" automatically to avoid 
collisions with any other attributes the might be in the portlet contenxt.

HTH,

Example 
public class MyPortlet extends GenericServletPortlet
{
   public void init(PortletConfig config)
throws PortletException
   {
   super.init(config);
   MyService myserv = (MyService) <>;
   if (null == myserv)
   {
   throw new PortletException("Could not acquire MyService!");
   }
   }
}
I'm having a very hard time finding any discussion or documentation on this
anywhere ... hey, I even bought the book by Jeff Linwood and Dave Minter
about building portals ... still no luck ...
Thanks,
- Frank
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 


--
"Great minds discuss ideas. Average minds discuss events. Small minds discuss 
people."  - Admiral Hyman Rickover
***
*   Scott T. Weaver   *
* <[EMAIL PROTECTED]> *
* *
* --  *
*   Apache Jetspeed Enterprise Portal *
* Apache Pluto Portlet Container  *
* *
* OpenEdit, Website Content Management*
*    *
***
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]