XwikiNaming

GradSoft Ltd. http://www.gradsoft.ua

Ruslan Shevchenko

Introduction

XwikiNaming is xwiki plugin which integrate xwiki with external naming system (usually supplied by J2EE application container). In addition, xwikinaming can be used with integration of xwiki with spring IOC framework, by providing jndi api to access spring internal name system and special JNDI provider, which search at first in IOC container, than in default JNDI.

So, with this plugin it is it is easy call J2EE or spring beans from xwiki pages with help of groovy or velocity templates.

Download

You can download project artifacts from google project space:

License is GPL-v3.

Installation

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="jndi" class="org.apache.xbean.spring.jndi.DefaultContext">
<property name="entries">
<map>
<entry key="my-bean">
<bean id="UsedBean" class="ua.gradsoft.xwikinamingtest.spring1.UsedBean">
</bean>
</entry>
</map>
</property>
</bean>
</beans>
xwikinaming.chain=1
xwikinaming.chain.first=spring
xwikinaming.chain.second=default

in this case xwikinaming plugin will search for naming object at first in spring namespace, than in jndi. In addition you can set location of spring configuration and jndi options (see Detailed Configuration sections for details)

Usage:

Very simple: just use lookup method.

I.e. for velocity:

#set ($mybean =  $xwiki.naming.lookup('my-bean'))
#if (“$!mybean” == “”)
object mybean is not bound in JNDI
#else
#set ($result = $mybean.methodCall())
#end


For groovy:


<% mybean = xwiki.getPlugin(“naming”).lookup(“my-bean”); %>
<% if (mybean==null) { %>
object mybean is not bound in JNDI
<% } else { %>
#set ($result = $mybean.methodCall())
<% } %>


Detailed Configuration

In xwiki.cfg next variables can be set:

In addtion, logging can be configured through log4j framework, so to enable debug

add to xwiki log4j.properties next string:

log4j.logger.ua.gradsoft.xwikinaming=debug

Other issues

You can call GradSoft for commercial support or request for enhancements.

Our url is http://www.gradsoft.ua