Hi David and all,
As David recommended I'm looking at the portlet approach rather than the
velocity extension.
I've been trying to reproduce a subset of the j2-admin spaces functionality
(list only). My portlet has the following code in its init method, very similar
to the j2-admin SpacesList portlet.
PortletContext ctx = getPortletContext();
spacesService = (Spaces)
ctx.getAttribute(CommonPortletServices.CPS_SPACES_SERVICE);
if (spacesService == null)
{
throw new PortletException("Could not get instance of portal spaces
service component");
}
Unfortunately for me the spacesService always results in null. I can't seem to
access any of the Jetspeed services. Do I require any additional configuration?
Any suggestions?
Thanks!
jiri
On 10 Jul 2013, at 19:57, Jiri De Jagere <[email protected]> wrote:
> Thank you David.
>
> I had found the pages example. I'll consider either developing my own portlet
> to produce the html I need or the extension approach as you suggested.
>
>
> Kind regards,
>
>
> Jiri
>
> On 10 Jul 2013, at 19:30, David Taylor <[email protected]> wrote:
>
>> This response is probably much more info than you need, sorry for
>> blabbering on, but thought some background might help...
>>
>> In version 2.2.1, we introduced Spaces, the Space and PageNavigators, and
>> the new JetUI framework. One of the differences between the old layout
>> approach, and the new spaces/navigator approach, is navigations. With the
>> old layout approach, menus, and navigations are all provided via the
>> SiteManager, which in turn filters your view of the site navigations using
>> the Jetspeed Profile. So in layouts, you will often see macros like
>> #PageMenu (shown below) using the $site context variable. All the
>> navigational menus are preprocessed by the SiteManager, and Profiler,
>> before returning their result. With 2.2.1, and the introduction of Space
>> navigation, spaces bypassed the Site Manager and went directly to the
>> PageManager API, retrieving folders underneath spaces. The idea was to
>> simplify the entire view of the portal. So... if you want to use spaces,
>> you usually configure your portal, during the initial custom build of your
>> portal, to use the Jetui pipeline
>>
>> mvn jetspeed:mvn -Dtarget=ui
>>
>> or
>>
>> mvn jetspeed:mvn -Dtarget=min-ui
>>
>>
>> where as, if you were to create a project based on the original layouts,
>> you would do:
>>
>> mvn jetspeed:mvn -Dtarget=demo
>>
>> or
>>
>> mvn jetspeed:mvn -Dtarget=min
>>
>>
>> What Im getting at here is the old layouts don't make the spaces model
>> available to you. In fact, they use completely different folder roots as
>> you can see here
>> http://svn.apache.org/viewvc/portals/jetspeed-2/portal/tags/JETSPEED-RELEASE-2.2.2/applications/jetspeed/src/main/webapp/WEB-INF/there
>> are actually 4 folder trees, 2 for jetui, 2 for original site manager
>>
>> So if you want to use Spaces without the Jetui build, and with old layouts,
>> Its definitely possible, but would take some extension work. You would
>> need to make the Space manager available to your decorators as a velocity
>> context variable ...
>>
>> Note that the Jetui pipeline, which supports spaces, only makes use of the
>> decorator CSS, not the actual vm code for decorators. One of the
>> motivations behind Jetui was to simplify Jetspeed - and use simple portlets
>> for layout and decorator code without introducing extra technologies like
>> learning about Jetpseed layouts and decorators
>>
>>
>> #macro(PagesMenu)
>> #set($_pages = $site.getMenu("pages").elements)
>> <div id="pages-menu" class="menu">#foreach($_page in $_pages)
>> #if($_page.isSelected($site))
>> #set($_cssClass = "link page-link selected")
>> #else
>> #set($_cssClass = "link page-link")
>> #end
>> <a href="portal${_page.url}" class="$!{_cssClass}"
>> title="${_page.getTitle($preferedLocale)}">$_page.getTitle($preferedLocale)</a><span
>> class="separator"></span>#end
>> </div>
>> #end
>>
>>
>>
>> On Wed, Jul 10, 2013 at 9:23 AM, Jiri De Jagere <[email protected]> wrote:
>>
>>> Hi David,
>>>
>>>
>>> I had found the Jetspeed API docs and (think I) understand how to use
>>> them. The examples are quite useful. Thanks for those!
>>>
>>> The challenge I have is that I'm trying to put my own responsive ui in
>>> front of Jetspeed. Because of that I would actually prefer a velocity-based
>>> approach to work them into my header container. I have not yet discovered
>>> how to access and use spaces and page manager from velocity though. If you
>>> could share such an example, that would be really helpful!
>>>
>>>
>>> Kind regards,
>>>
>>>
>>> Jiri
>>>
>>> On 10 Jul 2013, at 17:51, David Taylor <[email protected]> wrote:
>>>
>>>> There are Javadocs online for all the Jetspeed API:
>>>>
>>>> Spaces:
>>>>
>>> http://portals.apache.org/jetspeed-2/apidocs/org/apache/jetspeed/spaces/Spaces.html
>>>> Page Manager (folders):
>>>>
>>> http://portals.apache.org/jetspeed-2/apidocs/org/apache/jetspeed/page/PageManager.html
>>>>
>>>> There are examples of using these APIs in the J2-Admin application. For
>>>> example, the Spaces Manager is actually a portlet, not a layout:
>>>>
>>>>
>>> http://www.jarvana.com/jarvana/view/org/apache/portals/jetspeed-2/j2-admin/2.2.2/j2-admin-2.2.2.war!/WEB-INF/view/spaces/spaces-manager.jsp?format=ok
>>>>
>>>> Portlet Applications can make use of Jetspeed API services by declaring
>>> the
>>>> services they want to use in the jetspeed-portlet.xml deployment
>>> descriptor
>>>>
>>>> <js:services>
>>>> <js:service name='PageManager' />
>>>> <js:service name='SpacesService' />
>>>>
>>>> Then, in your portlet's init method, the portlet context provides access
>>> to
>>>> all of your declared services:
>>>> (from org.apache.jetspeed.portlets.spaces.SpacesList portlet in j2-admin
>>>> app):
>>>>
>>>> public void init(PortletConfig config) throws PortletException
>>>> {
>>>> super.init(config);
>>>> PortletContext context = getPortletContext();
>>>> spacesService = (Spaces)
>>>> context.getAttribute(CommonPortletServices.CPS_SPACES_SERVICE);
>>>>
>>>> This is how the Space Manager was implemented in Jetspeed 2.2.1. If you
>>>> are more interested in developing your header with velocity templates and
>>>> layouts, let me know, I can give examples of that approach too
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jul 10, 2013 at 6:36 AM, Jiri De Jagere <[email protected]>
>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>> I'm developing my own header and footer for a Jetspeed-based
>>> application.
>>>>> I've found the API calls to list the pages for a particular view, but I
>>>>> can't find how to list the available folders and links (spaces).
>>>>>
>>>>> Could someone please point me in the right direction?
>>>>>
>>>>>
>>>>> Thanks!
>>>>>
>>>>>
>>>>> Jiri
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> David
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>> --
>> David
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]