Author: bcarothers
Date: 2009-07-12 18:08:43 -0400 (Sun, 12 Jul 2009)
New Revision: 1090
Added:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/infinispan.xml
trunk/extensions/dna-connector-infinispan/
trunk/extensions/dna-connector-infinispan/.classpath
trunk/extensions/dna-connector-infinispan/.project
trunk/extensions/dna-connector-infinispan/pom.xml
trunk/extensions/dna-connector-infinispan/src/
trunk/extensions/dna-connector-infinispan/src/main/
trunk/extensions/dna-connector-infinispan/src/main/java/
trunk/extensions/dna-connector-infinispan/src/main/java/org/
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanSource.java
trunk/extensions/dna-connector-infinispan/src/main/resources/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/infinispan/
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.properties
trunk/extensions/dna-connector-infinispan/src/test/
trunk/extensions/dna-connector-infinispan/src/test/java/
trunk/extensions/dna-connector-infinispan/src/test/java/org/
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18nTest.java
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorReadableTest.java
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorWritableTest.java
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanSourceTest.java
trunk/extensions/dna-connector-infinispan/src/test/resources/
trunk/extensions/dna-connector-infinispan/src/test/resources/aircraft.xml
trunk/extensions/dna-connector-infinispan/src/test/resources/cars.xml
trunk/extensions/dna-connector-infinispan/src/test/resources/log4j.properties
Modified:
trunk/docs/reference/src/main/docbook/en-US/content/developers/tools.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/docs/reference/src/main/docbook/en-US/master.xml
trunk/pom.xml
Log:
DNA-474
Applied patch implements a connector based on the map repository framework that uses one
Infinispan cache per workspace and uses each Infinispan cache as a map of UUIDs to
MapNodes. It plagiarizes liberally from the JBoss Cache connector and offers comparable
functionality and configuration points.
The committed change differs from the patch attached to the JIRA issue because of the
minor rename of setNameOfDefaultWorkspace and getNameOfDefaultWorkspace to
setDefaultWorkspaceName and getDefaultWorkspaceName in the InfinispanSource. This
corresponds to the fixes in DNA-485.
Added: trunk/docs/reference/src/main/docbook/en-US/content/connectors/infinispan.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/infinispan.xml
(rev 0)
+++
trunk/docs/reference/src/main/docbook/en-US/content/connectors/infinispan.xml 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (
http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../custom.dtd">
+%CustomDTD;
+]>
+<chapter id="infinispan-connector">
+ <title>Infinispan Connector</title>
+ <para>
+ The Infinispan repository connector allows a <ulink
url="http://www.jboss.org/infinispan/">Infinispan</ulink> instance to
be
+ used as a JBoss DNA (and thus JCR) repository. This provides a repository that is an
effective, scalable, and distributed cache,
+ and is often paired with other repository sources to provide a local or <link
linkend="federation-connector">federated</link>
+ repository.
+ </para>
+ <para>
+ The &InfinispanSource; class provides a number of JavaBean properties that control
its behavior:
+ </para>
+ <table frame='all'>
+ <title>&InfinispanSource; properties</title>
+ <tgroup cols='2' align='left' colsep='1'
rowsep='1'>
+ <colspec colname='c1' colwidth="1*"/>
+ <colspec colname='c2' colwidth="1*"/>
+ <thead>
+ <row>
+ <entry>Property</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>name</entry>
+ <entry>The name of the repository source, which is used by the
&RepositoryService; when obtaining a &RepositoryConnection; by
name.</entry>
+ </row>
+ <row>
+ <entry>cacheManagerJndiName</entry>
+ <entry>Optional property that, if used, specifies the name in JNDI where an
existing Infinispan Cache Manager instance can be found.
+ That factory would then be used if needed to create an Infinispan Cache instance.
If no value is provided, then the
+ Infinispan <code>DefaultCacheManager</code> class is
used.</entry>
+ </row>
+ <row>
+ <entry>cacheConfigurationName</entry>
+ <entry>Optional property that, if used, specifies the name of the
configuration that is supplied to the cache manager
+ when creating a new Infinispan CacheManager instance.</entry>
+ </row>
+ <row>
+ <entry>retryLimit</entry>
+ <entry>Optional property that, if used, defines the number of times that any
single operation on a &RepositoryConnection; to this source should be retried
+ following a communication failure. The default value is '0'.</entry>
+ </row>
+ <row>
+ <entry>defaultCachePolicy</entry>
+ <entry>Optional property that, if used, defines the default for how long this
information provided by this source may to be
+ cached by other, higher-level components. The default value of null implies that
this source does not define a specific
+ duration for caching information provided by this repository source.</entry>
+ </row>
+ <row>
+ <entry>nameOfDefaultWorkspace</entry>
+ <entry>Optional property that is initialized to an empty string and which
defines the name for the workspace that will be used by default
+ if none is specified.</entry>
+ </row>
+ <row>
+ <entry>predefinedWorkspaceNames</entry>
+ <entry>Optional property that defines the names of the workspaces that exist
and that are available for use without having to create them.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+</chapter>
+
Property changes on:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/infinispan.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/docs/reference/src/main/docbook/en-US/content/developers/tools.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/developers/tools.xml 2009-07-12
22:01:21 UTC (rev 1089)
+++ trunk/docs/reference/src/main/docbook/en-US/content/developers/tools.xml 2009-07-12
22:08:43 UTC (rev 1090)
@@ -488,9 +488,9 @@
<programlisting>$ svn checkout
https://anonsvn.jboss.org/repos/dna/tags/dna-{release-number}/</progra...
<para>
Then, go into the new directory, and perform a Maven deploy:
+ </para>
+ <programlisting>$ mvn clean deploy</programlisting>
<para>
- <programlisting>$ mvn clean deploy</programlisting>
- <para>
This will rebuild all the artifacts (from your local copy of the
<emphasis>tagged</emphasis> source) and deploy them
to the local file system, which is comprised of a local checkout of the JBoss Maven2
repository
in a location specified by a combination of the
<code><distributionManagement></code> section of several
<code>pom.xml</code>
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-07-12 22:01:21 UTC (rev
1089)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-07-12 22:08:43 UTC (rev
1090)
@@ -188,6 +188,7 @@
<!ENTITY SVNRepositorySource "<ulink
url='&API;connector/svn/SVNRepositorySource.html'><classname>SVNRepositorySource</classname></ulink>">
<!ENTITY JBossCacheRepository "<ulink
url='&API;connector/jbosscache/JBossCacheRepository.html'><classname>JBossCacheRepository</classname></ulink>">
<!ENTITY JBossCacheSource "<ulink
url='&API;connector/jbosscache/JBossCacheSource.html'><classname>JBossCacheSource</classname></ulink>">
+<!ENTITY InfinispanSource "<ulink
url='&API;connector/infinispan/InfinispanSource.html'><classname>InfinispanSource</classname></ulink>">
<!ENTITY ImageMetadataSequencer "<ulink
url='&API;sequencer/image/ImageMetadataSequencer.html'><classname>ImageMetadataSequencer</classname></ulink>">
<!ENTITY ImageMetadata "<ulink
url='&API;sequencer/image/ImageMetadata.html'><classname>ImageMetadata</classname></ulink>">
<!ENTITY ImageSequencerI18n "<ulink
url='&API;sequencer/image/ImageSequencerI18n.html'><classname>ImageSequencerI18n</classname></ulink>">
Modified: trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-07-12 22:01:21 UTC (rev
1089)
+++ trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-07-12 22:08:43 UTC (rev
1090)
@@ -115,6 +115,7 @@
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/federation.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/subversion.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/jboss_cache.xml"/>
+ <xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/infinispan.xml"/>
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="content/connectors/jdbc_metadata.xml"/>
</part>
<part id="provied-sequencers-part">
Added: trunk/extensions/dna-connector-infinispan/.classpath
===================================================================
--- trunk/extensions/dna-connector-infinispan/.classpath (rev 0)
+++ trunk/extensions/dna-connector-infinispan/.classpath 2009-07-12 22:08:43 UTC (rev
1090)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/resources"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/extensions/dna-connector-infinispan/.project
===================================================================
--- trunk/extensions/dna-connector-infinispan/.project (rev 0)
+++ trunk/extensions/dna-connector-infinispan/.project 2009-07-12 22:08:43 UTC (rev 1090)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dna-connector-infinispan</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: trunk/extensions/dna-connector-infinispan/pom.xml
===================================================================
--- trunk/extensions/dna-connector-infinispan/pom.xml (rev 0)
+++ trunk/extensions/dna-connector-infinispan/pom.xml 2009-07-12 22:08:43 UTC (rev 1090)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna</artifactId>
+ <version>0.6-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <!-- The groupId and version values are inherited from parent -->
+ <artifactId>dna-connector-infinispan</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss DNA Connector to JBoss Infinispan</name>
+ <description>JBoss DNA Connector that accesses an in-process JBoss Infinispan
instance.</description>
+ <
url>http://labs.jboss.org/dna</url>
+
+ <!--
+ Define the dependencies. Note that all version and scopes default to those
+ defined in the dependencyManagement section of the parent pom.
+ -->
+ <dependencies>
+ <!--
+ Common
+ -->
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-graph</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-common</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-graph</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ JBoss Cache
+ -->
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>4.0.0.ALPHA5</version>
+ </dependency>
+ <!--
+ Testing (note the scope)
+ -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ </dependency>
+ <!--
+ Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for
testing)
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <!--
+ Java Concurrency in Practice annotations
+ -->
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
\ No newline at end of file
Property changes on: trunk/extensions/dna-connector-infinispan/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,43 @@
+package org.jboss.dna.connector.infinispan;
+
+import java.util.Locale;
+import java.util.Set;
+import org.jboss.dna.common.i18n.I18n;
+
+public final class InfinispanConnectorI18n {
+
+ public static I18n connectorName;
+ public static I18n nodeDoesNotExist;
+ public static I18n propertyIsRequired;
+ public static I18n errorSerializingCachePolicyInSource;
+ public static I18n objectFoundInJndiWasNotCacheManager;
+ // public static I18n unableToCloneWorkspaces;
+ // public static I18n unableToCreateWorkspaces;
+ public static I18n unableToCreateWorkspace;
+ public static I18n workspaceAlreadyExists;
+ public static I18n workspaceDoesNotExist;
+ public static I18n workspaceNameWasNotValidConfiguration;
+ public static I18n defaultCacheManagerConfigurationNameWasNotValidConfiguration;
+
+
+ static {
+ try {
+ I18n.initialize(InfinispanConnectorI18n.class);
+ } catch (final Exception err) {
+ System.err.println(err);
+ }
+ }
+
+ public static Set<Locale> getLocalizationProblemLocales() {
+ return I18n.getLocalizationProblemLocales(InfinispanConnectorI18n.class);
+ }
+
+ public static Set<String> getLocalizationProblems() {
+ return I18n.getLocalizationProblems(InfinispanConnectorI18n.class);
+ }
+
+ public static Set<String> getLocalizationProblems( Locale locale ) {
+ return I18n.getLocalizationProblems(InfinispanConnectorI18n.class, locale);
+ }
+
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,82 @@
+package org.jboss.dna.connector.infinispan;
+
+import java.util.UUID;
+import org.infinispan.Cache;
+import org.infinispan.manager.CacheManager;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.connector.map.AbstractMapWorkspace;
+import org.jboss.dna.graph.connector.map.MapNode;
+import org.jboss.dna.graph.connector.map.MapRepository;
+import org.jboss.dna.graph.connector.map.MapWorkspace;
+
+public class InfinispanRepository extends MapRepository {
+
+ private final CacheManager cacheManager;
+
+ public InfinispanRepository( String sourceName,
+ UUID rootNodeUuid,
+ CacheManager cacheManager ) {
+ super(sourceName, rootNodeUuid, null);
+ assert cacheManager != null;
+ this.cacheManager = cacheManager;
+ initialize();
+ }
+
+ public InfinispanRepository( String sourceName,
+ UUID rootNodeUuid,
+ String defaultWorkspaceName,
+ CacheManager cacheManager ) {
+ super(sourceName, rootNodeUuid, defaultWorkspaceName);
+
+ assert cacheManager != null;
+ this.cacheManager = cacheManager;
+
+ initialize();
+ }
+
+ @Override
+ protected MapWorkspace createWorkspace( ExecutionContext context,
+ String name ) {
+ assert name != null;
+ assert cacheManager != null;
+ Cache<UUID, MapNode> newWorkspaceCache = cacheManager.getCache(name);
+ return new Workspace(this, name, newWorkspaceCache);
+ }
+
+ protected class Workspace extends AbstractMapWorkspace {
+ private final Cache<UUID, MapNode> workspaceCache;
+
+ public Workspace( MapRepository repository,
+ String name,
+ Cache<UUID, MapNode> workspaceCache ) {
+ super(repository, name);
+
+ this.workspaceCache = workspaceCache;
+ initialize();
+ }
+
+ @Override
+ protected void addNodeToMap( MapNode node ) {
+ assert node != null;
+ workspaceCache.put(node.getUuid(), node);
+ }
+
+ @Override
+ protected MapNode removeNodeFromMap( UUID nodeUuid ) {
+ assert nodeUuid != null;
+ return workspaceCache.remove(nodeUuid);
+ }
+
+ @Override
+ protected void removeAllNodesFromMap() {
+ workspaceCache.clear();
+ }
+
+ @Override
+ public MapNode getNode( UUID nodeUuid ) {
+ assert nodeUuid != null;
+ return workspaceCache.get(nodeUuid);
+ }
+ }
+
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanRepository.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanSource.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanSource.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanSource.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,555 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.connector.infinispan;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.naming.BinaryRefAddr;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+import javax.naming.spi.ObjectFactory;
+import net.jcip.annotations.ThreadSafe;
+import org.infinispan.Cache;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.DefaultCacheManager;
+import org.jboss.dna.common.i18n.I18n;
+import org.jboss.dna.common.util.StringUtil;
+import org.jboss.dna.graph.cache.CachePolicy;
+import org.jboss.dna.graph.connector.RepositoryConnection;
+import org.jboss.dna.graph.connector.RepositoryContext;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.jboss.dna.graph.connector.RepositorySourceCapabilities;
+import org.jboss.dna.graph.connector.RepositorySourceException;
+import org.jboss.dna.graph.connector.map.MapRepositoryConnection;
+import org.jboss.dna.graph.connector.map.MapRepositorySource;
+import org.jboss.dna.graph.observe.Observer;
+import org.jboss.dna.graph.request.CreateWorkspaceRequest.CreateConflictBehavior;
+
+/**
+ * A repository source that uses an Infinispan instance to manage the content. This
source is capable of using an existing
+ * {@link CacheManager} or creating a new cache manager. This process is controlled
entirely by the JavaBean properties of the
+ * InfinispanSource instance.
+ * <p>
+ * This source first attempts to find an existing cache manager found in {@link
#getCacheManagerJndiName() JNDI} (or the
+ * {@link DefaultCacheManager} if no such manager is available) and the {@link
#getCacheConfigurationName() cache configuration
+ * name} if supplied or the default configuration if not set.
+ * </p>
+ * <p>
+ * Like other {@link RepositorySource} classes, instances of JBossCacheSource can be
placed into JNDI and do support the creation
+ * of {@link Referenceable JNDI referenceable} objects and resolution of references into
JBossCacheSource.
+ * </p>
+ */
+@ThreadSafe
+public class InfinispanSource implements MapRepositorySource, ObjectFactory {
+
+ private static final long serialVersionUID = 2L;
+ /**
+ * The default limit is {@value} for retrying {@link RepositoryConnection connection}
calls to the underlying source.
+ */
+ public static final int DEFAULT_RETRY_LIMIT = 0;
+
+ /**
+ * The initial {@link #getDefaultWorkspaceName() name of the default workspace} is
"{@value} ", unless otherwise specified.
+ */
+ public static final String DEFAULT_NAME_OF_DEFAULT_WORKSPACE = "default";
+
+ protected static final String ROOT_NODE_UUID = "rootNodeUuid";
+ protected static final String SOURCE_NAME = "sourceName";
+ protected static final String DEFAULT_CACHE_POLICY = "defaultCachePolicy";
+ protected static final String CACHE_CONFIGURATION_NAME =
"cacheConfigurationName";
+ protected static final String CACHE_FACTORY_JNDI_NAME =
"cacheManagerJndiName";
+ protected static final String RETRY_LIMIT = "retryLimit";
+ protected static final String DEFAULT_WORKSPACE = "defaultWorkspace";
+ protected static final String PREDEFINED_WORKSPACE_NAMES =
"predefinedWorkspaceNames";
+ protected static final String ALLOW_CREATING_WORKSPACES =
"allowCreatingWorkspaces";
+
+ private volatile String name;
+ private volatile UUID rootNodeUuid = UUID.randomUUID();
+ private volatile CachePolicy defaultCachePolicy;
+ private volatile String cacheConfigurationName;
+ private volatile String cacheManagerJndiName;
+ private volatile int retryLimit = DEFAULT_RETRY_LIMIT;
+ private volatile String defaultWorkspace;
+ private volatile String[] predefinedWorkspaces = new String[] {};
+ private volatile RepositorySourceCapabilities capabilities = new
RepositorySourceCapabilities(true, true, false, true, false);
+ private transient InfinispanRepository repository;
+ private transient Context jndiContext;
+ private transient RepositoryContext repositoryContext;
+
+ /**
+ * Create a repository source instance.
+ */
+ public InfinispanSource() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.graph.connector.RepositorySource#initialize(org.jboss.dna.graph.connector.RepositoryContext)
+ */
+ public void initialize( RepositoryContext context ) throws RepositorySourceException
{
+ this.repositoryContext = context;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.RepositorySource#getCapabilities()
+ */
+ public RepositorySourceCapabilities getCapabilities() {
+ return capabilities;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.RepositorySource#getRetryLimit()
+ */
+ public int getRetryLimit() {
+ return retryLimit;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.RepositorySource#setRetryLimit(int)
+ */
+ public synchronized void setRetryLimit( int limit ) {
+ retryLimit = limit < 0 ? 0 : limit;
+ }
+
+ /**
+ * Set the name of this source
+ *
+ * @param name the name for this source
+ */
+ public synchronized void setName( String name ) {
+ if (this.name == name || this.name != null && this.name.equals(name))
return; // unchanged
+ this.name = name;
+ }
+
+ /**
+ * Get the default cache policy for this source, or null if the global default cache
policy should be used
+ *
+ * @return the default cache policy, or null if this source has no explicit default
cache policy
+ */
+ public CachePolicy getDefaultCachePolicy() {
+ return defaultCachePolicy;
+ }
+
+ /**
+ * @param defaultCachePolicy Sets defaultCachePolicy to the specified value.
+ */
+ public synchronized void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) {
+ if (this.defaultCachePolicy == defaultCachePolicy || this.defaultCachePolicy !=
null
+ && this.defaultCachePolicy.equals(defaultCachePolicy)) return; //
unchanged
+ this.defaultCachePolicy = defaultCachePolicy;
+ }
+
+ /**
+ * Get the name in JNDI of a {@link CacheManager} instance that should be used to
create the cache for this source.
+ * <p>
+ * This source first attempts to find a cache instance using the {@link CacheManager}
found in
+ * {@link #getCacheManagerJndiName() JNDI} (or the {@link DefaultCacheManager} if no
such manager is available) and the
+ * {@link #getCacheConfigurationName() cache configuration name} if supplied or the
default configuration if not set.
+ * </p>
+ *
+ * @return the JNDI name of the {@link CacheManager} instance that should be used, or
null if the {@link DefaultCacheManager}
+ * should be used if a cache is to be created
+ * @see #setCacheManagerJndiName(String)
+ * @see #getCacheConfigurationName()
+ */
+ public String getCacheManagerJndiName() {
+ return cacheManagerJndiName;
+ }
+
+ /**
+ * Set the name in JNDI of a {@link CacheManager} instance that should be used to
obtain the {@link Cache} instance used by
+ * this source.
+ * <p>
+ * This source first attempts to find a cache instance using the {@link CacheManager}
found in
+ * {@link #getCacheManagerJndiName() JNDI} (or the {@link DefaultCacheManager} if no
such manager is available) and the
+ * {@link #getCacheConfigurationName() cache configuration name} if supplied or the
default configuration if not set.
+ * </p>
+ *
+ * @param jndiName the JNDI name of the {@link CacheManager} instance that should be
used, or null if the
+ * {@link DefaultCacheManager} should be used if a cache is to be created
+ * @see #setCacheManagerJndiName(String)
+ * @see #getCacheConfigurationName()
+ */
+ public synchronized void setCacheManagerJndiName( String jndiName ) {
+ if (this.cacheManagerJndiName == jndiName || this.cacheManagerJndiName != null
+ && this.cacheManagerJndiName.equals(jndiName)) return; // unchanged
+ this.cacheManagerJndiName = jndiName;
+ }
+
+ /**
+ * Get the name of the configuration that should be used if a {@link Cache cache} is
to be created using the
+ * {@link CacheManager} found in JNDI or the {@link DefaultCacheManager} if needed.
+ * <p>
+ * This source first attempts to find a cache instance using the {@link CacheManager}
found in
+ * {@link #getCacheManagerJndiName() JNDI} (or the {@link DefaultCacheManager} if no
such manager is available) and the
+ * {@link #getCacheConfigurationName() cache configuration name} if supplied or the
default configuration if not set.
+ * </p>
+ *
+ * @return the name of the configuration that should be passed to the {@link
CacheManager}, or null if the default
+ * configuration should be used
+ * @see #setCacheConfigurationName(String)
+ * @see #getCacheManagerJndiName()
+ */
+ public String getCacheConfigurationName() {
+ return cacheConfigurationName;
+ }
+
+ /**
+ * Get the name of the configuration that should be used if a {@link Cache cache} is
to be created using the
+ * {@link CacheManager} found in JNDI or the {@link DefaultCacheManager} if needed.
+ * <p>
+ * This source first attempts to find a cache instance using the {@link CacheManager}
found in
+ * {@link #getCacheManagerJndiName() JNDI} (or the {@link DefaultCacheManager} if no
such manager is available) and the
+ * {@link #getCacheConfigurationName() cache configuration name} if supplied or the
default configuration if not set.
+ * </p>
+ *
+ * @param cacheConfigurationName the name of the configuration that should be passed
to the {@link CacheManager}, or null if
+ * the default configuration should be used
+ * @see #getCacheConfigurationName()
+ * @see #getCacheManagerJndiName()
+ */
+ public synchronized void setCacheConfigurationName( String cacheConfigurationName )
{
+ if (this.cacheConfigurationName == cacheConfigurationName ||
this.cacheConfigurationName != null
+ && this.cacheConfigurationName.equals(cacheConfigurationName))
return; // unchanged
+ this.cacheConfigurationName = cacheConfigurationName;
+ }
+
+ /**
+ * Get the UUID of the root node for the cache. If the cache exists, this UUID is not
used but is instead set to the UUID of
+ * the existing root node.
+ *
+ * @return the UUID of the root node for the cache.
+ */
+ public String getRootNodeUuid() {
+ return this.rootNodeUuid.toString();
+ }
+
+ /**
+ * Get the UUID of the root node for the cache. If the cache exists, this UUID is not
used but is instead set to the UUID of
+ * the existing root node.
+ *
+ * @return the UUID of the root node for the cache.
+ */
+ public UUID getRootNodeUuidObject() {
+ return this.rootNodeUuid;
+ }
+
+ /**
+ * Set the UUID of the root node in this repository. If the cache exists, this UUID
is not used but is instead set to the UUID
+ * of the existing root node.
+ *
+ * @param rootNodeUuid the UUID of the root node for the cache, or null if the UUID
should be randomly generated
+ */
+ public synchronized void setRootNodeUuid( String rootNodeUuid ) {
+ UUID uuid = null;
+ if (rootNodeUuid == null) uuid = UUID.randomUUID();
+ else uuid = UUID.fromString(rootNodeUuid);
+ if (this.rootNodeUuid.equals(uuid)) return; // unchanged
+ this.rootNodeUuid = uuid;
+ }
+
+ /**
+ * Get the name of the default workspace.
+ *
+ * @return the name of the workspace that should be used by default; never null
+ */
+ public String getDefaultWorkspaceName() {
+ return defaultWorkspace;
+ }
+
+ /**
+ * Set the name of the workspace that should be used when clients don't specify a
workspace.
+ *
+ * @param nameOfDefaultWorkspace the name of the workspace that should be used by
default, or null if the
+ * {@link #DEFAULT_NAME_OF_DEFAULT_WORKSPACE default name} should be used
+ */
+ public synchronized void setDefaultWorkspaceName( String nameOfDefaultWorkspace ) {
+ this.defaultWorkspace = nameOfDefaultWorkspace != null ? nameOfDefaultWorkspace :
DEFAULT_NAME_OF_DEFAULT_WORKSPACE;
+ }
+
+ /**
+ * Gets the names of the workspaces that are available when this source is created.
+ *
+ * @return the names of the workspaces that this source starts with, or null if there
are no such workspaces
+ * @see #setPredefinedWorkspaceNames(String[])
+ * @see #setCreatingWorkspacesAllowed(boolean)
+ */
+ public synchronized String[] getPredefinedWorkspaceNames() {
+ String[] copy = new String[predefinedWorkspaces.length];
+ System.arraycopy(predefinedWorkspaces, 0, copy, 0, predefinedWorkspaces.length);
+ return copy;
+ }
+
+ /**
+ * Sets the names of the workspaces that are available when this source is created.
+ *
+ * @param predefinedWorkspaceNames the names of the workspaces that this source
should start with, or null if there are no
+ * such workspaces
+ * @see #setCreatingWorkspacesAllowed(boolean)
+ * @see #getPredefinedWorkspaceNames()
+ */
+ public synchronized void setPredefinedWorkspaceNames( String[]
predefinedWorkspaceNames ) {
+ this.predefinedWorkspaces = predefinedWorkspaceNames;
+ }
+
+ /**
+ * Get whether this source allows workspaces to be created dynamically.
+ *
+ * @return true if this source allows workspaces to be created by clients, or false
if the
+ * {@link #getPredefinedWorkspaceNames() set of workspaces} is fixed
+ * @see #setPredefinedWorkspaceNames(String[])
+ * @see #getPredefinedWorkspaceNames()
+ * @see #setCreatingWorkspacesAllowed(boolean)
+ */
+ public boolean isCreatingWorkspacesAllowed() {
+ return capabilities.supportsCreatingWorkspaces();
+ }
+
+ /**
+ * Set whether this source allows workspaces to be created dynamically.
+ *
+ * @param allowWorkspaceCreation true if this source allows workspaces to be created
by clients, or false if the
+ * {@link #getPredefinedWorkspaceNames() set of workspaces} is fixed
+ * @see #setPredefinedWorkspaceNames(String[])
+ * @see #getPredefinedWorkspaceNames()
+ * @see #isCreatingWorkspacesAllowed()
+ */
+ public synchronized void setCreatingWorkspacesAllowed( boolean allowWorkspaceCreation
) {
+ capabilities = new RepositorySourceCapabilities(true,
capabilities.supportsUpdates(), false, allowWorkspaceCreation,
+
capabilities.supportsReferences());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.RepositorySource#getConnection()
+ */
+ public synchronized RepositoryConnection getConnection() throws
RepositorySourceException {
+ if (getName() == null) {
+ I18n msg = InfinispanConnectorI18n.propertyIsRequired;
+ throw new RepositorySourceException(getName(), msg.text("name"));
+ }
+ if (this.repository == null) {
+ Context context = getContext();
+ if (context == null) {
+ try {
+ context = new InitialContext();
+ } catch (NamingException err) {
+ throw new RepositorySourceException(name, err);
+ }
+ }
+
+ // Look for a cache manager in JNDI ...
+ CacheManager cacheManager = null;
+ String jndiName = getCacheManagerJndiName();
+ if (jndiName != null && jndiName.trim().length() != 0) {
+ Object object = null;
+ try {
+ object = context.lookup(jndiName);
+ if (object != null) cacheManager = (CacheManager)object;
+ } catch (ClassCastException err) {
+ I18n msg =
InfinispanConnectorI18n.objectFoundInJndiWasNotCacheManager;
+ String className = object != null ? object.getClass().getName() :
"null";
+ throw new RepositorySourceException(getName(), msg.text(jndiName,
this.getName(), className), err);
+ } catch (Throwable err) {
+ if (err instanceof RuntimeException) throw (RuntimeException)err;
+ throw new RepositorySourceException(getName(), err);
+ }
+ }
+ if (cacheManager == null) cacheManager = new DefaultCacheManager();
+
+ // Now create the repository ...
+ this.repository = new InfinispanRepository(this.name, this.rootNodeUuid,
this.defaultWorkspace, cacheManager);
+
+ // Create the set of initial names ...
+ for (String initialName : getPredefinedWorkspaceNames())
+ repository.createWorkspace(null, initialName,
CreateConflictBehavior.DO_NOT_CREATE);
+
+ }
+
+ return new MapRepositoryConnection(this, this.repository);
+ }
+
+ /**
+ * @return repositoryContext
+ */
+ public RepositoryContext getRepositoryContext() {
+ return repositoryContext;
+ }
+
+ protected Observer getObserver() {
+ return repositoryContext != null ? repositoryContext.getObserver() : null;
+ }
+
+ protected Context getContext() {
+ return this.jndiContext;
+ }
+
+ protected synchronized void setContext( Context context ) {
+ this.jndiContext = context;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (obj == this) return true;
+ if (obj instanceof InfinispanSource) {
+ InfinispanSource that = (InfinispanSource)obj;
+ if (this.getName() == null) {
+ if (that.getName() != null) return false;
+ } else {
+ if (!this.getName().equals(that.getName())) return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized Reference getReference() {
+ String className = getClass().getName();
+ String managerClassName = this.getClass().getName();
+ Reference ref = new Reference(className, managerClassName, null);
+
+ ref.add(new StringRefAddr(SOURCE_NAME, getName()));
+ ref.add(new StringRefAddr(ROOT_NODE_UUID, getRootNodeUuid().toString()));
+ ref.add(new StringRefAddr(CACHE_FACTORY_JNDI_NAME, getCacheManagerJndiName()));
+ ref.add(new StringRefAddr(CACHE_CONFIGURATION_NAME,
getCacheConfigurationName()));
+ ref.add(new StringRefAddr(RETRY_LIMIT, Integer.toString(getRetryLimit())));
+ ref.add(new StringRefAddr(DEFAULT_WORKSPACE, getDefaultWorkspaceName()));
+ ref.add(new StringRefAddr(ALLOW_CREATING_WORKSPACES,
Boolean.toString(isCreatingWorkspacesAllowed())));
+ String[] workspaceNames = getPredefinedWorkspaceNames();
+ if (workspaceNames != null && workspaceNames.length != 0) {
+ ref.add(new StringRefAddr(PREDEFINED_WORKSPACE_NAMES,
StringUtil.combineLines(workspaceNames)));
+ }
+ if (getDefaultCachePolicy() != null) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ CachePolicy policy = getDefaultCachePolicy();
+ try {
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(policy);
+ ref.add(new BinaryRefAddr(DEFAULT_CACHE_POLICY, baos.toByteArray()));
+ } catch (IOException e) {
+ I18n msg = InfinispanConnectorI18n.errorSerializingCachePolicyInSource;
+ throw new RepositorySourceException(getName(),
msg.text(policy.getClass().getName(), getName()), e);
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getObjectInstance( Object obj,
+ javax.naming.Name name,
+ Context nameCtx,
+ Hashtable<?, ?> environment ) throws Exception
{
+ if (obj instanceof Reference) {
+ Map<String, Object> values = new HashMap<String, Object>();
+ Reference ref = (Reference)obj;
+ Enumeration<?> en = ref.getAll();
+ while (en.hasMoreElements()) {
+ RefAddr subref = (RefAddr)en.nextElement();
+ if (subref instanceof StringRefAddr) {
+ String key = subref.getType();
+ Object value = subref.getContent();
+ if (value != null) values.put(key, value.toString());
+ } else if (subref instanceof BinaryRefAddr) {
+ String key = subref.getType();
+ Object value = subref.getContent();
+ if (value instanceof byte[]) {
+ // Deserialize ...
+ ByteArrayInputStream bais = new
ByteArrayInputStream((byte[])value);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ value = ois.readObject();
+ values.put(key, value);
+ }
+ }
+ }
+ String sourceName = (String)values.get(SOURCE_NAME);
+ String rootNodeUuidString = (String)values.get(ROOT_NODE_UUID);
+ String cacheManagerJndiName = (String)values.get(CACHE_FACTORY_JNDI_NAME);
+ String cacheConfigurationName =
(String)values.get(CACHE_CONFIGURATION_NAME);
+ Object defaultCachePolicy = values.get(DEFAULT_CACHE_POLICY);
+ String retryLimit = (String)values.get(RETRY_LIMIT);
+ String defaultWorkspace = (String)values.get(DEFAULT_WORKSPACE);
+ String createWorkspaces = (String)values.get(ALLOW_CREATING_WORKSPACES);
+
+ String combinedWorkspaceNames =
(String)values.get(PREDEFINED_WORKSPACE_NAMES);
+ String[] workspaceNames = null;
+ if (combinedWorkspaceNames != null) {
+ List<String> paths =
StringUtil.splitLines(combinedWorkspaceNames);
+ workspaceNames = paths.toArray(new String[paths.size()]);
+ }
+
+ // Create the source instance ...
+ InfinispanSource source = new InfinispanSource();
+ if (sourceName != null) source.setName(sourceName);
+ if (rootNodeUuidString != null) source.setRootNodeUuid(rootNodeUuidString);
+ if (cacheManagerJndiName != null)
source.setCacheManagerJndiName(cacheManagerJndiName);
+ if (cacheConfigurationName != null)
source.setCacheConfigurationName(cacheConfigurationName);
+ if (defaultCachePolicy instanceof CachePolicy) {
+ source.setDefaultCachePolicy((CachePolicy)defaultCachePolicy);
+ }
+ if (retryLimit != null) source.setRetryLimit(Integer.parseInt(retryLimit));
+ if (defaultWorkspace != null)
source.setDefaultWorkspaceName(defaultWorkspace);
+ if (createWorkspaces != null)
source.setCreatingWorkspacesAllowed(Boolean.parseBoolean(createWorkspaces));
+ if (workspaceNames != null && workspaceNames.length != 0)
source.setPredefinedWorkspaceNames(workspaceNames);
+ return source;
+ }
+ return null;
+ }
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/main/java/org/jboss/dna/connector/infinispan/InfinispanSource.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.properties
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.properties
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/main/resources/org/jboss/dna/connector/infinispan/InfinispanConnectorI18n.properties 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,36 @@
+#
+# JBoss DNA (
http://www.jboss.org/dna)
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+# See the AUTHORS.txt file in the distribution for a full listing of
+# individual contributors.
+#
+# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+# is licensed to you under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# JBoss DNA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+#
+
+connectorName = Infinispan Connector
+nodeDoesNotExist = Could not find an existing node at {0}
+propertyIsRequired = The {0} property is required but has no value
+errorSerializingCachePolicyInSource = Error serializing a {0} instance owned by the {1}
InfinispanSource
+objectFoundInJndiWasNotCacheManager = Object in JNDI at {0} found by InfinispanSource {1}
was expected to be a org.infinispan.CacheManager but instead was {2}
+#unableToCloneWorkspaces = The InfinispanSource {0} does not allow creating workspaces,
so unable to clone workspace "{1}" into "{2}"
+#unableToCreateWorkspaces = The InfinispanSource {0} does not allow creating workspaces,
so unable to create workspace "{1}"
+unableToCreateWorkspace = Unable to create new workspace "{1}" in the
InfinispanSource {0}
+workspaceAlreadyExists = The workspace "{1}" already exists in the
InfinispanSource {0}
+workspaceDoesNotExist = The workspace "{1}" does not exist in the
InfinispanSource {0}
+workspaceNameWasNotValidConfiguration = The workspace name "{0}" was not a
valid Infinispan Cache Manager configuration name: {1}
+defaultCacheManagerConfigurationNameWasNotValidConfiguration = "{0}" is not a
valid Infinispan Cache Manager configuration name
Added:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18nTest.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18nTest.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18nTest.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,36 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.connector.infinispan;
+
+import org.jboss.dna.common.AbstractI18nTest;
+
+/**
+ * @author Randall Hauch
+ */
+public class InfinispanConnectorI18nTest extends AbstractI18nTest {
+
+ public InfinispanConnectorI18nTest() {
+ super(InfinispanConnectorI18n.class);
+ }
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorI18nTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorReadableTest.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorReadableTest.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorReadableTest.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,58 @@
+package org.jboss.dna.connector.infinispan;
+
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.stub;
+import java.io.File;
+import java.io.IOException;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.jboss.dna.graph.connector.test.ReadableConnectorTest;
+import org.xml.sax.SAXException;
+
+public class InfinispanConnectorReadableTest extends ReadableConnectorTest {
+
+ private Context mockJndi;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#setUpSource()
+ */
+ @Override
+ protected RepositorySource setUpSource() throws NamingException {
+ // Set the connection properties to be use the content of
"./src/test/resources/repositories" as a repository ...
+ String[] predefinedWorkspaceNames = new String[] {"aircraft",
"cars"};
+ InfinispanSource source = new InfinispanSource();
+ source.setName("Test Repository");
+ source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
+ source.setCreatingWorkspacesAllowed(false);
+
+ // Set up the mock JNDI ...
+ mockJndi = mock(Context.class);
+ stub(mockJndi.lookup(anyString())).toReturn(null);
+ source.setContext(mockJndi);
+
+ return source;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @throws SAXException
+ * @throws IOException
+ * @see
org.jboss.dna.graph.connector.test.AbstractConnectorTest#initializeContent(org.jboss.dna.graph.Graph)
+ */
+ @Override
+ protected void initializeContent( Graph graph ) throws IOException, SAXException {
+ graph.useWorkspace("aircraft");
+ graph.importXmlFrom(new
File("src/test/resources/aircraft.xml")).into("/");
+
+ graph.useWorkspace("cars");
+ graph.importXmlFrom(new
File("src/test/resources/cars.xml")).into("/");
+ }
+
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorReadableTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorWritableTest.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorWritableTest.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorWritableTest.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,53 @@
+package org.jboss.dna.connector.infinispan;
+
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.stub;
+import java.io.IOException;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.jboss.dna.graph.connector.test.WritableConnectorTest;
+import org.xml.sax.SAXException;
+
+public class InfinispanConnectorWritableTest extends WritableConnectorTest {
+
+ private Context mockJndi;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#setUpSource()
+ */
+ @Override
+ protected RepositorySource setUpSource() throws NamingException {
+ String[] predefinedWorkspaceNames = new String[] {"default"};
+ InfinispanSource source = new InfinispanSource();
+ source.setName("Test Repository");
+ source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
+ source.setDefaultWorkspaceName(predefinedWorkspaceNames[0]);
+ source.setCreatingWorkspacesAllowed(true);
+
+ // Set up the mock JNDI ...
+ mockJndi = mock(Context.class);
+ stub(mockJndi.lookup(anyString())).toReturn(null);
+ source.setContext(mockJndi);
+
+ Graph graph = Graph.create(source, context);
+ graph.useWorkspace("default");
+
+ return source;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @throws SAXException
+ * @throws IOException
+ * @see
org.jboss.dna.graph.connector.test.AbstractConnectorTest#initializeContent(org.jboss.dna.graph.Graph)
+ */
+ @Override
+ protected void initializeContent( Graph graph ) throws IOException, SAXException {
+ }
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanConnectorWritableTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanSourceTest.java
===================================================================
---
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanSourceTest.java
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanSourceTest.java 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,218 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.connector.infinispan;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.hamcrest.core.IsNull.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.stub;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+import org.infinispan.manager.CacheManager;
+import org.jboss.dna.graph.cache.BasicCachePolicy;
+import org.jboss.dna.graph.connector.RepositoryConnection;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoAnnotations.Mock;
+
+/**
+ */
+public class InfinispanSourceTest {
+
+ private InfinispanSource source;
+ private RepositoryConnection connection;
+ private String validName;
+ private String validCacheConfigurationName;
+ private String validCacheManagerJndiName;
+ private UUID validRootNodeUuid;
+ @Mock
+ private Context jndiContext;
+ @Mock
+ private CacheManager cacheManager;
+
+ @Before
+ public void beforeEach() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ validName = "cache source";
+ validCacheConfigurationName = "cache config name";
+ validCacheManagerJndiName = "cache factory jndi name";
+ validRootNodeUuid = UUID.randomUUID();
+ source = new InfinispanSource();
+
+ // Set up the fake JNDI context ...
+ source.setContext(jndiContext);
+ stub(jndiContext.lookup(validCacheManagerJndiName)).toReturn(cacheManager);
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+
+ @Test
+ public void shouldReturnNonNullCapabilities() {
+ assertThat(source.getCapabilities(), is(notNullValue()));
+ }
+
+ @Test
+ public void shouldSupportSameNameSiblings() {
+ assertThat(source.getCapabilities().supportsSameNameSiblings(), is(true));
+ }
+
+ @Test
+ public void shouldSupportUpdates() {
+ assertThat(source.getCapabilities().supportsUpdates(), is(true));
+ }
+
+ @Test
+ public void shouldHaveNullSourceNameUponConstruction() {
+ source = new InfinispanSource();
+ assertThat(source.getName(), is(nullValue()));
+ }
+
+ @Test
+ public void shouldAllowSettingName() {
+ source.setName("Something");
+ assertThat(source.getName(), is("Something"));
+ source.setName("another name");
+ assertThat(source.getName(), is("another name"));
+ }
+
+ @Test
+ public void shouldAllowSettingNameToNull() {
+ source.setName("some name");
+ source.setName(null);
+ assertThat(source.getName(), is(nullValue()));
+ }
+
+ @Test
+ public void shouldHaveDefaultRetryLimit() {
+ assertThat(source.getRetryLimit(), is(InfinispanSource.DEFAULT_RETRY_LIMIT));
+ }
+
+ @Test
+ public void shouldSetRetryLimitToZeroWhenSetWithNonPositiveValue() {
+ source.setRetryLimit(0);
+ assertThat(source.getRetryLimit(), is(0));
+ source.setRetryLimit(-1);
+ assertThat(source.getRetryLimit(), is(0));
+ source.setRetryLimit(-100);
+ assertThat(source.getRetryLimit(), is(0));
+ }
+
+ @Test
+ public void shouldAllowRetryLimitToBeSet() {
+ for (int i = 0; i != 100; ++i) {
+ source.setRetryLimit(i);
+ assertThat(source.getRetryLimit(), is(i));
+ }
+ }
+
+ @Test
+ public void shouldCreateJndiReferenceAndRecreatedObjectFromReference() throws
Exception {
+ BasicCachePolicy cachePolicy = new BasicCachePolicy();
+ cachePolicy.setTimeToLive(1000L, TimeUnit.MILLISECONDS);
+ convertToAndFromJndiReference(validName,
+ validRootNodeUuid,
+ validCacheConfigurationName,
+ validCacheManagerJndiName,
+ cachePolicy,
+ 100);
+ }
+
+ @Test
+ public void
shouldCreateJndiReferenceAndRecreatedObjectFromReferenceWithNullProperties() throws
Exception {
+ BasicCachePolicy cachePolicy = new BasicCachePolicy();
+ cachePolicy.setTimeToLive(1000L, TimeUnit.MILLISECONDS);
+ convertToAndFromJndiReference("some source", null, null, null, null,
100);
+ convertToAndFromJndiReference(null, null, null, null, null, 100);
+ }
+
+ private void convertToAndFromJndiReference( String sourceName,
+ UUID rootNodeUuid,
+ String cacheConfigName,
+ String cacheManagerJndiName,
+ BasicCachePolicy cachePolicy,
+ int retryLimit ) throws Exception {
+ source.setRetryLimit(retryLimit);
+ source.setName(sourceName);
+ source.setCacheConfigurationName(cacheConfigName);
+ source.setCacheManagerJndiName(cacheManagerJndiName);
+ source.setDefaultCachePolicy(cachePolicy);
+ source.setRootNodeUuid(rootNodeUuid != null ? rootNodeUuid.toString() : null);
+
+ Reference ref = source.getReference();
+ assertThat(ref.getClassName(), is(InfinispanSource.class.getName()));
+ assertThat(ref.getFactoryClassName(), is(InfinispanSource.class.getName()));
+
+ Map<String, Object> refAttributes = new HashMap<String, Object>();
+ Enumeration<RefAddr> enumeration = ref.getAll();
+ while (enumeration.hasMoreElements()) {
+ RefAddr addr = enumeration.nextElement();
+ refAttributes.put(addr.getType(), addr.getContent());
+ }
+
+ // Recreate the object, use a newly constructed source ...
+ ObjectFactory factory = new InfinispanSource();
+ Name name = mock(Name.class);
+ Context context = mock(Context.class);
+ Hashtable<?, ?> env = new Hashtable<Object, Object>();
+ InfinispanSource recoveredSource =
(InfinispanSource)factory.getObjectInstance(ref, name, context, env);
+ assertThat(recoveredSource, is(notNullValue()));
+
+ assertThat(recoveredSource.getName(), is(source.getName()));
+ assertThat(recoveredSource.getRootNodeUuid(), is(source.getRootNodeUuid()));
+ assertThat(recoveredSource.getRetryLimit(), is(source.getRetryLimit()));
+ assertThat(recoveredSource.getCacheManagerJndiName(),
is(source.getCacheManagerJndiName()));
+ assertThat(recoveredSource.getCacheConfigurationName(),
is(source.getCacheConfigurationName()));
+ assertThat(recoveredSource.getDefaultCachePolicy(),
is(source.getDefaultCachePolicy()));
+
+ assertThat(recoveredSource.equals(source), is(true));
+ assertThat(source.equals(recoveredSource), is(true));
+ }
+
+ @Test
+ public void
shouldCreateCacheUsingDefaultCacheManagerWhenNoCacheOrCacheManagerOrCacheConfigurationNameIsFound()
+ throws Exception {
+ source.setName(validName);
+ connection = source.getConnection();
+ assertThat(connection, is(notNullValue()));
+ // assertThat(connection.getCache(), is(notNullValue()));
+ }
+}
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/java/org/jboss/dna/connector/infinispan/InfinispanSourceTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/extensions/dna-connector-infinispan/src/test/resources/aircraft.xml
===================================================================
--- trunk/extensions/dna-connector-infinispan/src/test/resources/aircraft.xml
(rev 0)
+++ trunk/extensions/dna-connector-infinispan/src/test/resources/aircraft.xml 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (
http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<Aircraft
xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <Business>
+ <aircraft jcr:name="Gulfstream V" maker="Gulfstream"
model="G-V" introduced="1995" range="5800nm"
cruiseSpeed="488kt" crew="2" emptyWeight="46200lb"
url="http://en.wikipedia.org/wiki/Gulfstream_V"/>
+ <aircraft jcr:name="Learjet 45" maker="Learjet"
model="LJ45" introduced="1995" numberBuilt="264+"
crew="2" emptyWeight="13695lb" range="2120nm"
cruiseSpeed="457kt"
url="http://en.wikipedia.org/wiki/Learjet_45"/>
+ </Business>
+ <Commercial>
+ <aircraft jcr:name="Boeing 777" maker="Boeing"
model="777-200LR" introduced="1995" numberBuilt="731+"
maxRange="7500nm" emptyWeight="326000lb"
cruiseSpeed="560mph"
url="http://en.wikipedia.org/wiki/Boeing_777"/>
+ <aircraft jcr:name="Boeing 767" maker="Boeing"
model="767-200" introduced="1982" numberBuilt="966+"
maxRange="3950nm" emptyWeight="176650lb"
cruiseSpeed="530mph"
url="http://en.wikipedia.org/wiki/Boeing_767"/>
+ <aircraft jcr:name="Boeing 787" maker="Boeing"
model="787-3" introduced="2009" range="3050nm"
emptyWeight="223000lb" cruiseSpeed="561mph"
url="http://en.wikipedia.org/wiki/Boeing_787"/>
+ <aircraft jcr:name="Boeing 757" maker="Boeing"
model="757-200" introduced="1983" numberBuilt="1050"
range="3900nm" maxWeight="255000lb" cruiseSpeed="530mph"
url="http://en.wikipedia.org/wiki/Boeing_757"/>
+ <aircraft jcr:name="Airbus A380" maker="Airbus"
model="A380-800" introduced="2007" numberBuilt="18"
range="8200nm" maxWeight="1235000lb" cruiseSpeed="647mph"
url="http://en.wikipedia.org/wiki/Airbus_a380"/>
+ <aircraft jcr:name="Airbus A340" maker="Airbus"
model="A340-200" introduced="1993" numberBuilt="354"
range="8000nm" maxWeight="606300lb" cruiseSpeed="557mph"
url="http://en.wikipedia.org/wiki/Airbus_A-340"/>
+ <aircraft jcr:name="Airbus A310" maker="Airbus"
model="A310-200" introduced="1983" numberBuilt="255"
cruiseSpeed="850km/h" emptyWeight="176312lb" range="3670nm"
url="http://en.wikipedia.org/wiki/Airbus_A-310"/>
+ <aircraft jcr:name="Embraer RJ-175" maker="Embraer"
model="ERJ170-200" introduced="2004" range="3334km"
cruiseSpeed="481kt" emptyWeight="21810kg"
url="http://en.wikipedia.org/wiki/EMBRAER_170"/>
+ </Commercial>
+ <Vintage>
+ <aircraft jcr:name="Fokker Trimotor" maker="Fokker"
model="F.VII" introduced="1925" cruiseSpeed="170km/h"
emptyWeight="3050kg" crew="2"
url="http://en.wikipedia.org/wiki/Fokker_trimotor"/>
+ <aircraft jcr:name="P-38 Lightning" maker="Lockheed"
model="P-38" designedBy="Kelly Johnson" introduced="1941"
numberBuilt="10037" rateOfClimb="4750ft/min" range="1300mi"
emptyWeight="12780lb" crew="1"
url="http://en.wikipedia.org/wiki/P-38_Lightning"/>
+ <aircraft jcr:name="A6M Zero" maker="Mitsubishi"
model="A6M" designedBy="Jiro Horikoshi" introduced="1940"
numberBuilt="11000" crew="1" emptyWeight="3704lb"
serviceCeiling="33000ft" maxSpeed="331mph" range="1929mi"
rateOfClimb="3100ft/min"
url="http://en.wikipedia.org/wiki/A6M_Zero"/>
+ <aircraft jcr:name="Bf 109" maker="Messerschmitt"
model="Bf 109" introduced="1937"
url="http://en.wikipedia.org/wiki/BF_109"/>
+ <aircraft jcr:name="Wright Flyer" maker="Wright Brothers"
introduced="1903" range="852ft" maxSpeed="30mph"
emptyWeight="605lb" crew="1"/>
+ </Vintage>
+ <Homebuilt>
+ <aircraft jcr:name="Long-EZ" maker="Rutan Aircraft
Factory" model="61" emptyWeight="760lb"
fuelCapacity="200L" maxSpeed="185kt" since="1976"
range="1200nm"
url="http://en.wikipedia.org/wiki/Rutan_Long-EZ"/>
+ <aircraft jcr:name="Cirrus VK-30" maker="Cirrus Design"
model="VK-30" emptyWeight="2400lb" maxLoad="1200lb"
maxSpeed="250mph" rateOfClimb="1500ft/min" range="1300mi"
url="http://en.wikipedia.org/wiki/Cirrus_VK-30"/>
+ <aircraft jcr:name="Van's RV-4" maker="Van's
Aircraft" model="RV-4" introduced="1980"
emptyWeight="905lb" maxLoad="500lb" maxSpeed="200mph"
rateOfClimb="2450ft/min" range="725mi"
url="http://en.wikipedia.org/wiki/Van%27s_Aircraft_RV-4"/>
+ </Homebuilt>
+</Aircraft>
\ No newline at end of file
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/resources/aircraft.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/extensions/dna-connector-infinispan/src/test/resources/cars.xml
===================================================================
--- trunk/extensions/dna-connector-infinispan/src/test/resources/cars.xml
(rev 0)
+++ trunk/extensions/dna-connector-infinispan/src/test/resources/cars.xml 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss DNA (
http://www.jboss.org/dna)
+ ~
+ ~ See the COPYRIGHT.txt file distributed with this work for information
+ ~ regarding copyright ownership. Some portions may be licensed
+ ~ to Red Hat, Inc. under one or more contributor license agreements.
+ ~ See the AUTHORS.txt file in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ ~ is licensed to you under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ JBoss DNA is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<Cars
xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <Hybrid>
+ <car jcr:name="Toyota Prius" maker="Toyota"
model="Prius" year="2008" msrp="$21,500"
userRating="4.2" valueRating="5" mpgCity="48"
mpgHighway="45"/>
+ <car jcr:name="Toyota Highlander" maker="Toyota"
model="Highlander" year="2008" msrp="$34,200"
userRating="4" valueRating="5" mpgCity="27"
mpgHighway="25"/>
+ <car jcr:name="Nissan Altima" maker="Nissan"
model="Altima" year="2008" msrp="$18,260"
mpgCity="23" mpgHighway="32"/>
+ </Hybrid>
+ <Sports>
+ <car jcr:name="Aston Martin DB9" maker="Aston Martin"
model="DB9" year="2008" msrp="$171,600"
userRating="5" mpgCity="12" mpgHighway="19"
lengthInInches="185.5" wheelbaseInInches="108.0" engine="5,935 cc
5.9 liters V 12"/>
+ <car jcr:name="Infiniti G37" maker="Infiniti"
model="G37" year="2008" msrp="$34,900"
userRating="3.5" valueRating="4" mpgCity="18"
mpgHighway="24" />
+ </Sports>
+ <Luxury>
+ <car jcr:name="Cadillac DTS" maker="Cadillac"
model="DTS" year="2008" engine="3.6-liter V6"
userRating="0"/>
+ <car jcr:name="Bentley Continental" maker="Bentley"
model="Continental" year="2008" msrp="$170,990"
mpgCity="10" mpgHighway="17" />
+ <car jcr:name="Lexus IS350" maker="Lexus"
model="IS350" year="2008" msrp="$36,305"
mpgCity="18" mpgHighway="25" userRating="4"
valueRating="5" />
+ </Luxury>
+ <Utility>
+ <car jcr:name="Land Rover LR2" maker="Land Rover"
model="LR2" year="2008" msrp="$33,985"
userRating="4.5" valueRating="5" mpgCity="16"
mpgHighway="23" />
+ <car jcr:name="Land Rover LR3" maker="Land Rover"
model="LR3" year="2008" msrp="$48,525"
userRating="5" valueRating="2" mpgCity="12"
mpgHighway="17" />
+ <car jcr:name="Hummer H3" maker="Hummer"
model="H3" year="2008" msrp="$30,595"
userRating="3.5" valueRating="4" mpgCity="13"
mpgHighway="16" />
+ <car jcr:name="Ford F-150" maker="Ford"
model="F-150" year="2008" msrp="$23,910"
userRating="4" valueRating="1" mpgCity="14"
mpgHighway="20" />
+ </Utility>
+</Cars>
\ No newline at end of file
Property changes on:
trunk/extensions/dna-connector-infinispan/src/test/resources/cars.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/extensions/dna-connector-infinispan/src/test/resources/log4j.properties
===================================================================
--- trunk/extensions/dna-connector-infinispan/src/test/resources/log4j.properties
(rev 0)
+++
trunk/extensions/dna-connector-infinispan/src/test/resources/log4j.properties 2009-07-12
22:08:43 UTC (rev 1090)
@@ -0,0 +1,15 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Root logger option
+log4j.rootLogger=INFO, stdout
+
+# Set up the default logging to be INFO level, then override specific units
+log4j.logger.org.jboss.dna=INFO
+
+# JBoss Cache logging
+log4j.logger.org.infinispan=WARN, stdout
+
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-07-12 22:01:21 UTC (rev 1089)
+++ trunk/pom.xml 2009-07-12 22:08:43 UTC (rev 1090)
@@ -137,6 +137,7 @@
<module>extensions/dna-sequencer-zip</module>
<module>extensions/dna-connector-federation</module>
<module>extensions/dna-connector-filesystem</module>
+ <module>extensions/dna-connector-infinispan</module>
<module>extensions/dna-connector-jbosscache</module>
<module>extensions/dna-connector-svn</module>
<module>extensions/dna-connector-store-jpa</module>
@@ -596,7 +597,7 @@
</plugin>
</plugins>
</reporting>
-
+
<repositories>
<repository>
<id>apiviz.release</id>