hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jakarta-hivemind Wiki] Update of "CayenneIntegation" by ChristianMittendorf
Date Sun, 23 Oct 2005 17:38:24 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-hivemind Wiki" for change
notification.

The following page has been changed by ChristianMittendorf:
http://wiki.apache.org/jakarta-hivemind/CayenneIntegation

New page:
ChristianMittendorf: I've done some testing on HiveMind integration of Cayenne. My solution
requires your webapp to use servlet specification 2.4 or newer (see [http://www.objectstyle.org/cayenne/userguide/deploy/webapplicationcontextprovider.html
WebApplicationContextProvider]).

Put a listener entry to your web.xml:

{{{
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
	
	<display-name>...</display-name>
	[...]
	<listener>
	   <listener-class>org.objectstyle.cayenne.conf.WebApplicationContextProvider</listener-class>
	</listener>
	[...]
</web-app> 
}}}

Add the service to your hivemind.xml:

{{{
	<service-point id="dataContextService" interface="de.example.hivemind.DataContextService"
/>
	
	<implementation service-id="dataContextService">
	 	<invoke-factory>
			<construct class="de.example.hivemind.impl.DataContextServiceImpl" />
		</invoke-factory>
	</implementation>
}}}

Create the Interface

{{{
package de.example.hivemind;

import org.objectstyle.cayenne.access.DataContext;

public interface DataContextService
{
	public DataContext getDataContext();
}
}}}

and the Implementation

{{{
package de.example.hivemind.impl;

import org.objectstyle.cayenne.access.DataContext;

import de.example.hivemind.DataContextService;

public class DataContextServiceImpl implements DataContextService
{	
	public DataContext getDataContext()
	{
		return DataContext.getThreadDataContext();
	}
}
}}}

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


Mime
View raw message