DNA SVN: r1471 - in trunk: dna-graph and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-21 17:07:58 -0500 (Mon, 21 Dec 2009)
New Revision: 1471
Modified:
trunk/dna-graph/pom.xml
trunk/extensions/dna-connector-store-jpa/pom.xml
trunk/pom.xml
Log:
Re-corrected the version of the Google Collections API in the JPA connector.
Modified: trunk/dna-graph/pom.xml
===================================================================
--- trunk/dna-graph/pom.xml 2009-12-21 15:45:09 UTC (rev 1470)
+++ trunk/dna-graph/pom.xml 2009-12-21 22:07:58 UTC (rev 1471)
@@ -35,7 +35,6 @@
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
- <version>1.0-rc3</version>
</dependency>
<!--
Testing (note the scope)
Modified: trunk/extensions/dna-connector-store-jpa/pom.xml
===================================================================
--- trunk/extensions/dna-connector-store-jpa/pom.xml 2009-12-21 15:45:09 UTC (rev 1470)
+++ trunk/extensions/dna-connector-store-jpa/pom.xml 2009-12-21 22:07:58 UTC (rev 1471)
@@ -48,9 +48,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.google.code.google-collections</groupId>
- <artifactId>google-collect</artifactId>
- <version>snapshot-20080530</version>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
</dependency>
<!--
Testing (note the scope)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-21 15:45:09 UTC (rev 1470)
+++ trunk/pom.xml 2009-12-21 22:07:58 UTC (rev 1471)
@@ -965,6 +965,11 @@
Apache JCR API unit tests (for any JCR implementation), which is a subset of the official TCK
-->
<dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc3</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-tests</artifactId>
<version>1.4</version>
14 years, 5 months
DNA SVN: r1470 - trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-21 10:45:09 -0500 (Mon, 21 Dec 2009)
New Revision: 1470
Modified:
trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java
Log:
Removed unnecessary @SuppressWarnings
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java 2009-12-21 14:23:42 UTC (rev 1469)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java 2009-12-21 15:45:09 UTC (rev 1470)
@@ -42,7 +42,6 @@
*
* @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#setUpSource()
*/
- @SuppressWarnings( "unused" )
@Override
protected RepositorySource setUpSource() throws Exception {
this.source = TestEnvironment.configureJdbcMetadataSource("Test Repository", this);
14 years, 5 months
DNA SVN: r1469 - in trunk: dna-integration-tests/src/test/java/org/jboss/dna/test/integration and 7 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-21 09:23:42 -0500 (Mon, 21 Dec 2009)
New Revision: 1469
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JdbcMetadataRepositoryTckTest.java
trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/
trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/configRepository.xml
trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties
trunk/extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd
Modified:
trunk/dna-integration-tests/pom.xml
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataLexicon.java
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java
Log:
DNA-37 Federate schema information from relational sources
Applied patch that adds custom node types, a JCR integration test for the connector, a provision to the integration test framework to allow for the importing of a custom node types file, and a minor fix to getProperties().
Modified: trunk/dna-integration-tests/pom.xml
===================================================================
--- trunk/dna-integration-tests/pom.xml 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/dna-integration-tests/pom.xml 2009-12-21 14:23:42 UTC (rev 1469)
@@ -91,6 +91,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-jdbc-metadata</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<!--
JPA Connector Dependencies
Added: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JdbcMetadataRepositoryTckTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JdbcMetadataRepositoryTckTest.java (rev 0)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JdbcMetadataRepositoryTckTest.java 2009-12-21 14:23:42 UTC (rev 1469)
@@ -0,0 +1,32 @@
+/*
+ * 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.test.integration;
+
+import junit.framework.Test;
+
+public class JdbcMetadataRepositoryTckTest {
+ public static Test suite() {
+ return AbstractRepositoryTckTest.readOnlyRepositorySuite("jdbcmeta");
+ }
+}
Property changes on: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JdbcMetadataRepositoryTckTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/configRepository.xml
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/configRepository.xml (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/configRepository.xml 2009-12-21 14:23:42 UTC (rev 1469)
@@ -0,0 +1,102 @@
+<?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
+ -->
+<configuration xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <!--
+ Define the sources for the content. These sources are directly accessible using the DNA-specific Graph API.
+ In fact, this is how the DNA JCR implementation works. You can think of these as being similar to
+ JDBC DataSource objects, except that they expose graph content via the Graph API instead of records via SQL or JDBC.
+ -->
+ <dna:sources jcr:primaryType="nt:unstructured">
+ <!--
+ The 'JCR' repository is a JBoss Cache source with a single default workspace (though others could be created, too).
+ -->
+ <dna:source jcr:name="Store" dna:classname="org.jboss.dna.connector.meta.jdbc.JdbcMetadataSource"
+ dna:driverClassName="org.hsqldb.jdbcDriver"
+ dna:username="sa"
+ dna:password=""
+ dna:url="jdbc:hsqldb:mem:."
+ dna:defaultWorkspaceName="default"/>
+<!--
+ <dna:source jcr:name="Store" dna:classname="org.jboss.dna.connector.meta.jdbc.JdbcMetadataSource"
+ dna:driverClassName="${jpaSource.driverClassName}"
+ dna:username="${jpaSource.username}"
+ dna:password="${jpaSource.password}"
+ dna:url="${jpaSource.url}"
+ dna:maximumConnectionsInPool="${jpaSource.maximumConnectionsInPool}"
+ dna:retryLimit="${jpaSource.retryLimit}"
+ dna:metadataCollectorClassName="${metadata.collectorClassName}"
+ dna:defaultWorkspaceName="default"/>
+ -->
+ </dna:sources>
+ <!--
+ Define the mime type detectors. This is an optional section. By default, each engine will use the
+ MIME type detector that uses filename extensions. So we wouldn't need to define the same detector again,
+ but this is how you'd define another extension.
+ -->
+ <dna:mimeTypeDetectors>
+ <dna:mimeTypeDetector jcr:name="Detector">
+ <dna:description>Standard extension-based MIME type detector</dna:description>
+ <!--
+ Specify the implementation class (required), as a child element or attribute on parent element.
+ -->
+ <dna:classname>org.jboss.dna.graph.mimetype.ExtensionBasedMimeTypeDetector</dna:classname>
+ <!--
+ Specify the classpath (optional) as an ordered list of 'names', where each name is significant to
+ the classpath factory. For example, a name could be an OSGI identifier or a Maven coordinate,
+ depending upon the classpath factory being used. If there is only one 'name' in the classpath,
+ it may be specified as an attribute on the 'mimeTypeDetector' element. If there is more than one
+ 'name', then they must be specified as child 'classpath' elements. Blank or empty values are ignored.
+ -->
+ <dna:classpath></dna:classpath>
+ </dna:mimeTypeDetector>
+ </dna:mimeTypeDetectors>
+ <!--
+ Define the JCR repositories
+ -->
+ <dna:repositories>
+ <!--
+ Define a JCR repository that accesses the 'JCR' source directly.
+ This of course is optional, since we could access the same content through 'JCR'.
+ -->
+ <dna:repository jcr:name="Test Repository Source">
+ <!-- Specify the source that should be used for the repository -->
+ <dna:source>Store</dna:source>
+ <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names
+-->
+ <dna:options jcr:primaryType="dna:options">
+ <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ <projectNodeTypes jcr:primaryType="dna:option" dna:value="false"/>
+ </dna:options>
+ <jcr:nodeTypes />
+ <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA -->
+ <dna:namespaces jcr:primaryType="dna:namespaces">
+ <mj jcr:primaryType="dna:namespace" dna:uri="http://www.jboss.org/dna/connector/meta/jdbc/1.0"/>
+ <dnatest jcr:primaryType="dna:namespace" dna:uri="http://jboss.org/dna/test/1.0"/>
+ </dna:namespaces>
+ </dna:repository>
+ </dna:repositories>
+</configuration>
Property changes on: trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/configRepository.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties (rev 0)
+++ trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties 2009-12-21 14:23:42 UTC (rev 1469)
@@ -0,0 +1,13 @@
+# Placeholder for any overlaid properties for this repo configuration
+
+javax.jcr.tck.dnaSkipImport=true
+javax.jcr.tck.isReadOnly=true
+javax.jcr.tck.dnaNodeTypePath=/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd
+
+# The fan-out from the tables node is HUGE in HSQLDB. This allows the tests to complete reasonably quickly.
+javax.jcr.tck.testroot=/default/INFORMATION_SCHEMA/tables/SYSTEM_ALIASES
+
+# There's only one workspace per repository for this connector right now
+javax.jcr.tck.workspacename=default
+
+
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2009-12-21 14:23:42 UTC (rev 1469)
@@ -460,6 +460,7 @@
}
if (foundMatch) {
matchingProperties.add(property);
+ } else {
foundMatch = true; // for the next iteration ..
}
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaRepositoryStub.java 2009-12-21 14:23:42 UTC (rev 1469)
@@ -41,11 +41,13 @@
public class DnaRepositoryStub extends RepositoryStub {
public static final String DNA_SKIP_IMPORT = "javax.jcr.tck.dnaSkipImport";
+ public static final String DNA_NODE_TYPE_PATH = "javax.jcr.tck.dnaNodeTypePath";
private static final String REPOSITORY_SOURCE_NAME = "Test Repository Source";
private static String currentConfigurationName = "default";
+
private Properties configProps;
private String repositoryConfigurationName;
private JcrRepository repository;
@@ -85,6 +87,12 @@
// Add the the node types for the source ...
configuration.repository(REPOSITORY_SOURCE_NAME).addNodeTypes(getClass().getResourceAsStream("/tck/tck_test_types.cnd"));
+
+ String nodeTypePath = configProps.getProperty(DNA_NODE_TYPE_PATH);
+ if (nodeTypePath != null) {
+ configuration.repository(REPOSITORY_SOURCE_NAME).addNodeTypes(getClass().getResourceAsStream(nodeTypePath));
+ }
+
} catch (SAXException se) {
se.printStackTrace();
throw new IllegalStateException(se);
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-21 14:23:42 UTC (rev 1469)
@@ -24,10 +24,8 @@
<chapter id="jdbc-metadata-connector">
<title>JDBC Metadata Connector</title>
<para>
- This connector provides read-only access to the metadata (e.g.,
- catalogs, schemas, table structures) of a relational database.
- The
- connector yields a content graph that looks like this:
+ This connector provides read-only access to the metadata (e.g., catalogs, schemas, table structures) of a relational
+ database. The connector yields a content graph that looks like this:
<programlisting>
/ (root node)
+ <catalog name> - one node for each accessible catalog in the database.
@@ -52,8 +50,13 @@
to work around a known bug where that driver returns a list of users from a call to &DatabaseMetaData;.getSchemas() instead of a list of schemas.
</para>
</note>
- </para>
+ </para>
<para>
+ To use this connector with the DNA JCR layer, you must import the JCR node types that this connector uses. These are bundled
+ in the JAR for this connector at the path <code>/org/jboss/dna/connector/meta/jdbc/nodeTypes.cnd</code>. Please see the &GettingStarted; Guide
+ for detailed examples of how to import custom JCR node types.
+ </para>
+ <para>
The &JdbcMetadataSource; class provides a number of JavaBean properties that control its behavior:
</para>
<table frame='all'>
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataLexicon.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataLexicon.java 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataLexicon.java 2009-12-21 14:23:42 UTC (rev 1469)
@@ -32,7 +32,7 @@
public class JdbcMetadataLexicon {
public static class Namespace {
- public static final String URI = "http://www.jboss.org/dna/connector/meta/jdbc";
+ public static final String URI = "http://www.jboss.org/dna/connector/meta/jdbc/1.0";
public static final String PREFIX = "metajdbc";
}
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java 2009-12-21 01:36:32 UTC (rev 1468)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java 2009-12-21 14:23:42 UTC (rev 1469)
@@ -110,7 +110,7 @@
rootNodeProperties.put(propName, propFactory.create(propName, databaseMinorVersion));
rootNodeProperties.put(JcrLexicon.PRIMARY_TYPE, propFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.ROOT));
- rootNodeProperties.put(JcrLexicon.MIXIN_TYPES, propFactory.create(JcrLexicon.PRIMARY_TYPE,
+ rootNodeProperties.put(JcrLexicon.MIXIN_TYPES, propFactory.create(JcrLexicon.MIXIN_TYPES,
JdbcMetadataLexicon.DATABASE_ROOT));
rootNodeProperties = Collections.unmodifiableMap(rootNodeProperties);
Added: trunk/extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd 2009-12-21 14:23:42 UTC (rev 1469)
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+//------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<mj='http://www.jboss.org/dna/connector/meta/jdbc/1.0'>
+
+[mj:databaseRoot] mixin
+- mj:databaseProductName (string) mandatory
+- mj:databaseProductVersion (string) mandatory
+- mj:databaseMajorVersion (long) mandatory
+- mj:databaseMinorVersion (long) mandatory
+
+[mj:catalog] mixin
+
+[mj:schema] mixin
+
+[mj:tables] mixin
+
+[mj:table] mixin
+- mj:tableType (string)
+- mj:description (long)
+- mj:typeCatalogName (string)
+- mj:typeSchemaName (string)
+- mj:typeName (string)
+- mj:selfReferencingColumnName (string)
+- mj:referenceGenerationStrategyName(string)
+
+[mj:column] mixin
+- mj:jdbcDataType (long)
+- mj:typeName (string)
+- mj:columnSize (long) mandatory
+- mj:decimalDigits (long) mandatory
+- mj:radix (long) mandatory
+- mj:nullable (boolean)
+- mj:description (string)
+- mj:defaultValue (string)
+- mj:length (long) mandatory
+- mj:ordinalPosition(long) mandatory
+- mj:scopeCatalogName (string)
+- mj:scopeSchemaName (string)
+- mj:scopeTableName (string)
+- mj:sourceJdbcDataType (long)
+
+[mj:procedures] mixin
+
+[mj:procedure] mixin
+- mj:description (string)
+- mj:returnType (int)
14 years, 5 months
DNA SVN: r1468 - in trunk/extensions/dna-connector-jdbc-metadata/src/test: resources and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-20 20:36:32 -0500 (Sun, 20 Dec 2009)
New Revision: 1468
Added:
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/create.ddl
Removed:
trunk/extensions/dna-connector-jdbc-metadata/src/test/data/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/drop.ddl
Log:
DNA-37 Federate schema information from relational sources
Removed some unused files and added one missing DDL file.
Deleted: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/create.ddl 2009-12-21 01:36:32 UTC (rev 1468)
@@ -1,33 +0,0 @@
--- 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.
-
-CREATE TABLE CHAIN (ID NUMERIC NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL)
-CREATE TABLE AREA (ID NUMERIC NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, CHAIN_ID NUMERIC NOT NULL)
-CREATE TABLE REGION (ID NUMERIC NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, AREA_ID NUMERIC NOT NULL)
-CREATE TABLE DISTRICT (ID NUMERIC NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, REGION_ID NUMERIC NOT NULL)
-
-CREATE TABLE SALES (ID NUMERIC NOT NULL, SALES_DATE DATETIME NOT NULL, DISTRICT_ID NUMERIC NOT NULL, AMOUNT NUMERIC(10, 2) NULL)
-ALTER TABLE SALES ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
-
-ALTER TABLE AREA ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
-ALTER TABLE REGION ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
-ALTER TABLE DISTRICT ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Deleted: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/drop.ddl 2009-12-21 01:36:32 UTC (rev 1468)
@@ -1,27 +0,0 @@
--- 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.
-
-DROP TABLE SALES
-DROP TABLE DISTRICT
-DROP TABLE REGION
-DROP TABLE AREA
-DROP TABLE CHAIN
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/create.ddl 2009-12-21 01:36:32 UTC (rev 1468)
@@ -0,0 +1,28 @@
+-- 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.
+
+CREATE TABLE IF NOT EXISTS chain (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL) TYPE=INNODB;
+CREATE TABLE IF NOT EXISTS area (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, CHAIN_ID INT NOT NULL) TYPE=INNODB;
+CREATE TABLE IF NOT EXISTS region (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, AREA_ID INT NOT NULL) TYPE=INNODB;
+CREATE TABLE IF NOT EXISTS district (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, REGION_ID INT NOT NULL) TYPE=INNODB;
+
+CREATE TABLE IF NOT EXISTS sales (ID INT NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INT NOT NULL, AMOUNT INT NULL) TYPE=INNODB;
14 years, 5 months
DNA SVN: r1467 - in trunk: docs/reference/src/main/docbook/en-US/content/connectors and 15 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-20 20:22:00 -0500 (Sun, 20 Dec 2009)
New Revision: 1467
Added:
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/SqlServerMetadataCollector.java
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/drop.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/create.ddl
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/drop.ddl
Removed:
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/
trunk/extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/jdbc/
trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/jdbc/
Modified:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
trunk/extensions/dna-connector-jdbc-metadata/pom.xml
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataCollector.java
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataException.java
trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java
trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java
trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepositoryTest.java
trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/TestEnvironment.java
trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/database.properties
trunk/pom.xml
Log:
DNA-37
Applied patch that adds DDL and code corrections for other databases (Oracle 10g/11g, MS SQL 2008, IBM DB2 v9, Sybase ASE 15).
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-21 01:22:00 UTC (rev 1467)
@@ -1,39 +1,34 @@
<?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
- -->
+ <!--
+ ~ 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="jdbc-metadata-connector">
- <title>JDBC Metadata Connector</title>
- <para>
- This connector provides read-only access to the metadata (e.g., catalogs, schemas, table structures) of a relational database.
- The connector yields a content graph that looks like this:
-<programlisting>
+ <title>JDBC Metadata Connector</title>
+ <para>
+ This connector provides read-only access to the metadata (e.g.,
+ catalogs, schemas, table structures) of a relational database.
+ The
+ connector yields a content graph that looks like this:
+ <programlisting>
/ (root node)
+ <catalog name> - one node for each accessible catalog in the database.
+ <schema name> - one node for each accessible schema in the catalog.
@@ -49,10 +44,12 @@
will be used instead when determining the graph name.
<note>
<para>
- This connector has currently been tested successfully against MySQL 5 (with the InnoDB engine), PostgreSQL 8, and HSQLDB.
+ This connector has currently been tested successfully against Oracle 10g, Oracle 11g, Microsoft SQL Server 2008 (with the Microsoft JDBC driver),
+ IBM DB2 v9, Sybase ASE 15, MySQL 5 (with the InnoDB engine), PostgreSQL 8, and HSQLDB.
As JDBC driver implementations of the &DatabaseMetaData; interface tend to vary widely, other databases may or may not work
- with the default &MetadataCollector; implementation. We are, of course, interested in correcting any database-specific issues
- that arise, but the <code>metadataCollectorClassName</code> property provides a mechanism to support immediate workarounds.
+ with the default &MetadataCollector; implementation. As one example, the <code>metadataCollectorClassName</code> property
+ must be set to <code>org.jboss.dna.connector.meta.jdbc.SqlServerMetadataConnector</code> if the Microsoft JDBC driver is used. This is
+ to work around a known bug where that driver returns a list of users from a call to &DatabaseMetaData;.getSchemas() instead of a list of schemas.
</para>
</note>
</para>
Modified: trunk/extensions/dna-connector-jdbc-metadata/pom.xml
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/pom.xml 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/pom.xml 2009-12-21 01:22:00 UTC (rev 1467)
@@ -42,7 +42,13 @@
<groupId>org.jboss.dna</groupId>
<artifactId>dna-graph</artifactId>
</dependency>
- <dependency>
+ <dependency>
+ <groupId>com.sybase</groupId>
+ <artifactId>jconnect</artifactId>
+ <version>6.0.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.dna</groupId>
<artifactId>dna-graph</artifactId>
<version>${project.version}</version>
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataCollector.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataCollector.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataCollector.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -26,9 +26,13 @@
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
+import net.jcip.annotations.Immutable;
/**
* Default {@link MetadataCollector} implementation that uses the {@link DatabaseMetaData built-in JDBC support} for collecting
@@ -36,7 +40,8 @@
*
* @see DatabaseMetaData
*/
-class JdbcMetadataCollector implements MetadataCollector {
+@Immutable
+public class JdbcMetadataCollector implements MetadataCollector {
public List<String> getCatalogNames( Connection conn ) throws JdbcMetadataException {
List<String> catalogNames = new LinkedList<String>();
@@ -73,15 +78,20 @@
if (catalogName == null) catalogName = "";
if (schemaName == null) schemaName = "";
columns = dmd.getColumns(catalogName, schemaName, tableName, columnName);
+ // Get the list of names of the columns in the result set, which may or may not match what's in the spec
+ Set<String> columnNames = columnsFor(columns);
while (columns.next()) {
ColumnMetadata column = new ColumnMetadata(columns.getString("COLUMN_NAME"), columns.getInt("DATA_TYPE"),
columns.getString("TYPE_NAME"), columns.getInt("COLUMN_SIZE"),
columns.getInt("DECIMAL_DIGITS"), columns.getInt("NUM_PREC_RADIX"),
getNullableBoolean(columns, "NULLABLE"), columns.getString("REMARKS"),
columns.getString("COLUMN_DEF"), columns.getInt("CHAR_OCTET_LENGTH"),
- columns.getInt("ORDINAL_POSITION"), columns.getString("SCOPE_CATLOG"),
- columns.getString("SCOPE_SCHEMA"), columns.getString("SCOPE_TABLE"),
- getNullableInteger(columns, "SOURCE_DATA_TYPE"));
+ columns.getInt("ORDINAL_POSITION"), getStringIfPresent(columns,
+ "SCOPE_CATLOG",
+ columnNames),
+ getStringIfPresent(columns, "SCOPE_SCHEMA", columnNames),
+ getStringIfPresent(columns, "SCOPE_TABLE", columnNames),
+ getIntegerIfPresent(columns, "SOURCE_DATA_TYPE", columnNames));
columnData.add(column);
}
@@ -105,11 +115,25 @@
try {
DatabaseMetaData dmd = conn.getMetaData();
schemas = dmd.getSchemas();
+
+ Set<String> columns = columnsFor(schemas);
+ boolean hasCatalog = columns.contains(identifierFor(dmd, "TABLE_CATALOG"));
+
while (schemas.next()) {
- String catalogNameForSchema = schemas.getString("TABLE_CATALOG");
- if ((catalogName == null && schemas.wasNull())
- || (catalogName != null && catalogName.equals(catalogNameForSchema))) {
+ /*
+ * PostgreSQL's JDBC3 driver doesn't include TABLE_CATALOG
+ */
+ if (hasCatalog) {
+ String catalogNameForSchema = schemas.getString("TABLE_CATALOG");
+ String schemaName = schemas.getString("TABLE_SCHEM");
+ if ((catalogName == null && catalogNameForSchema == null)
+ // if (catalogNameForSchema == null
+ || (catalogName != null && catalogName.equals(catalogNameForSchema))) {
+
+ schemaNames.add(schemaName);
+ }
+ } else {
schemaNames.add(schemas.getString("TABLE_SCHEM"));
}
}
@@ -139,12 +163,16 @@
if (catalogName == null) catalogName = "";
if (schemaName == null) schemaName = "";
tables = dmd.getTables(catalogName, schemaName, tableName, null);
+ Set<String> columns = columnsFor(tables);
while (tables.next()) {
TableMetadata table = new TableMetadata(tables.getString("TABLE_NAME"), tables.getString("TABLE_TYPE"),
- tables.getString("REMARKS"), tables.getString("TYPE_CAT"),
- tables.getString("TYPE_SCHEM"), tables.getString("TYPE_NAME"),
- tables.getString("SELF_REFERENCING_COL_NAME"),
- tables.getString("REF_GENERATION"));
+ tables.getString("REMARKS"), getStringIfPresent(tables,
+ "TYPE_CAT",
+ columns),
+ getStringIfPresent(tables, "TYPE_SCHEM", columns),
+ getStringIfPresent(tables, "TYPE_NAME", columns),
+ getStringIfPresent(tables, "SELF_REFERENCING_COL_NAME", columns),
+ getStringIfPresent(tables, "REF_GENERATION", columns));
tableData.add(table);
}
@@ -164,7 +192,7 @@
String catalogName,
String schemaName,
String procedureName ) throws JdbcMetadataException {
- List<ProcedureMetadata> tableData = new LinkedList<ProcedureMetadata>();
+ List<ProcedureMetadata> procedureData = new LinkedList<ProcedureMetadata>();
ResultSet procedures = null;
try {
@@ -178,11 +206,11 @@
ProcedureMetadata procedure = new ProcedureMetadata(procedures.getString("PROCEDURE_NAME"),
procedures.getString("REMARKS"),
procedures.getShort("PROCEDURE_TYPE"));
- tableData.add(procedure);
+ procedureData.add(procedure);
}
- return tableData;
+ return procedureData;
} catch (SQLException se) {
throw new JdbcMetadataException(se);
} finally {
@@ -200,10 +228,48 @@
return b;
}
- private Integer getNullableInteger( ResultSet rs,
- String columnName ) throws SQLException {
- Integer i = rs.getInt(columnName);
- if (rs.wasNull()) i = null;
+ private Set<String> columnsFor( ResultSet rs ) throws SQLException {
+ ResultSetMetaData rmd = rs.getMetaData();
+ int count = rmd.getColumnCount();
+
+ Set<String> columns = new HashSet<String>(count);
+ for (int i = 1; i <= count; i++) {
+ columns.add(rmd.getColumnName(i));
+ }
+ return columns;
+ }
+
+ private String getStringIfPresent( ResultSet rs,
+ String columnName,
+ Set<String> resultSetColumns ) throws SQLException {
+ if (!resultSetColumns.contains(columnName)) {
+ return null;
+ }
+
+ return rs.getString(columnName);
+
+ }
+
+ private Integer getIntegerIfPresent( ResultSet rs,
+ String columnName,
+ Set<String> resultSetColumns ) throws SQLException {
+ if (!resultSetColumns.contains(columnName)) {
+ return null;
+ }
+
+ int i = rs.getInt(columnName);
+ if (rs.wasNull()) return null;
return i;
+
}
+
+ private String identifierFor( DatabaseMetaData dmd,
+ String rawIdentifier ) throws SQLException {
+ assert rawIdentifier != null;
+ if (dmd.storesLowerCaseIdentifiers()) {
+ return rawIdentifier.toLowerCase();
+ }
+
+ return rawIdentifier;
+ }
}
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataException.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataException.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataException.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -26,7 +26,7 @@
/**
* Thrown to indicate that there was a failure while attempting to retrieve metadata
*/
-public class JdbcMetadataException extends Exception {
+public class JdbcMetadataException extends RuntimeException {
private static final long serialVersionUID = 1L;
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepository.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -158,6 +158,7 @@
try {
getNode(newPathToTry);
+ lastWorkingPath = newPathToTry;
} catch (PathNotFoundException pnfe) {
return lastWorkingPath;
}
@@ -174,8 +175,8 @@
public PathNode getNode( Path path ) {
assert path != null;
- Segment[] segments = path.getSegmentsArray();
- switch (segments.length) {
+ List<Segment> segments = path.getSegmentsList();
+ switch (segments.size()) {
case 0:
return getRoot();
case 1:
@@ -183,22 +184,22 @@
case 2:
return schemaNodeFor(segments);
case 3:
- if (TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName())) {
+ if (TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName())) {
return tablesNodeFor(segments);
- } else if (PROCEDURES_SEGMENT_NAME.equals(segments[2].getName().getLocalName())) {
+ } else if (PROCEDURES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName())) {
return proceduresNodeFor(segments);
}
return null;
case 4:
- if (TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName())) {
+ if (TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName())) {
return tableNodeFor(segments);
- } else if (PROCEDURES_SEGMENT_NAME.equals(segments[2].getName().getLocalName())) {
+ } else if (PROCEDURES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName())) {
return procedureNodeFor(segments);
}
return null;
case 5:
- if (TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName())) {
+ if (TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName())) {
return columnNodeFor(segments);
}
return null;
@@ -207,9 +208,9 @@
}
}
- private PathNode catalogNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode catalogNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 1;
+ assert segments.size() == 1;
List<Segment> schemaNames = new LinkedList<Segment>();
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
@@ -219,11 +220,11 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
- if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
+ String catalogName = segments.get(0).getName().getLocalName();
try {
MetadataCollector meta = source.getMetadataCollector();
+ if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
// Make sure that this is a valid catalog for this database
List<String> catalogNames = meta.getCatalogNames(conn);
@@ -232,21 +233,29 @@
* If a "real" (not default) catalog name is provided but it is not a valid
* catalog name for this database OR if the default catalog name is being used
* but this database uses real catalog names, then no catalog with that name exists.
+ *
+ * This gets complicated by the fact that some DBMSes use an empty string for a catalog
+ * which also gets mapped to the default catalog name in our system
*/
+ boolean catalogMatchesDefaultName = catalogNames.isEmpty() || catalogNames.contains("");
+
if ((catalogName != null && !catalogNames.contains(catalogName))
- || (catalogName == null && !catalogNames.isEmpty())) {
+ || (catalogName == null && !catalogMatchesDefaultName)) {
return null;
}
List<String> schemaNamesFromMeta = new ArrayList<String>(meta.getSchemaNames(conn, catalogName));
- if (schemaNamesFromMeta.isEmpty()) {
- schemaNamesFromMeta.add(source.getDefaultSchemaName());
- }
for (String schemaName : schemaNamesFromMeta) {
- schemaNames.add(pathFactory.createSegment(schemaName));
+ if (schemaName.length() > 0) {
+ schemaNames.add(pathFactory.createSegment(schemaName));
+ }
}
+ if (schemaNames.isEmpty()) {
+ schemaNames.add(pathFactory.createSegment(source.getDefaultSchemaName()));
+ }
+
Map<Name, Property> properties = new HashMap<Name, Property>();
properties.put(JcrLexicon.PRIMARY_TYPE, propFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.UNSTRUCTURED));
properties.put(JcrLexicon.MIXIN_TYPES, propFactory.create(JcrLexicon.MIXIN_TYPES, JdbcMetadataLexicon.CATALOG));
@@ -259,9 +268,9 @@
}
}
- private PathNode schemaNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode schemaNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 2;
+ assert segments.size() == 2;
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -270,10 +279,10 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
try {
@@ -306,10 +315,10 @@
}
}
- private PathNode tablesNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode tablesNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 3;
- assert TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName());
+ assert segments.size() == 3;
+ assert TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName());
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -318,10 +327,10 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
try {
@@ -358,10 +367,10 @@
}
}
- private PathNode tableNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode tableNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 4;
- assert TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName());
+ assert segments.size() == 4;
+ assert TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName());
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -370,13 +379,13 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
- String tableName = segments[3].getName().getLocalName();
+ String tableName = segments.get(3).getName().getLocalName();
try {
MetadataCollector meta = source.getMetadataCollector();
@@ -442,10 +451,10 @@
}
}
- private PathNode proceduresNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode proceduresNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 3;
- assert PROCEDURES_SEGMENT_NAME.equals(segments[2].getName().getLocalName());
+ assert segments.size() == 3;
+ assert PROCEDURES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName());
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -454,10 +463,10 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
try {
@@ -494,10 +503,10 @@
}
}
- private PathNode procedureNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode procedureNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 4;
- assert PROCEDURES_SEGMENT_NAME.equals(segments[2].getName().getLocalName());
+ assert segments.size() == 4;
+ assert PROCEDURES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName());
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -506,13 +515,13 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
- String procedureName = segments[3].getName().getLocalName();
+ String procedureName = segments.get(3).getName().getLocalName();
try {
MetadataCollector meta = source.getMetadataCollector();
@@ -533,11 +542,11 @@
* the stable order in which the procedures should be returned
* 2. Procedure nodes can have an SNS index > 1
*/
- if (segments[3].getIndex() > procedures.size()) {
+ if (segments.get(3).getIndex() > procedures.size()) {
return null;
}
- ProcedureMetadata procedure = procedures.get(segments[3].getIndex() - 1);
+ ProcedureMetadata procedure = procedures.get(segments.get(3).getIndex() - 1);
Map<Name, Property> properties = new HashMap<Name, Property>();
Name propName;
@@ -563,10 +572,10 @@
}
}
- private PathNode columnNodeFor( Segment[] segments ) throws RepositorySourceException {
+ private PathNode columnNodeFor( List<Segment> segments ) throws RepositorySourceException {
assert segments != null;
- assert segments.length == 5;
- assert TABLES_SEGMENT_NAME.equals(segments[2].getName().getLocalName());
+ assert segments.size() == 5;
+ assert TABLES_SEGMENT_NAME.equals(segments.get(2).getName().getLocalName());
ExecutionContext context = source.getRepositoryContext().getExecutionContext();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
@@ -575,14 +584,14 @@
Path nodePath = pathFactory.createAbsolutePath(segments);
Connection conn = getConnection();
- String catalogName = segments[0].getName().getLocalName();
+ String catalogName = segments.get(0).getName().getLocalName();
if (catalogName.equals(source.getDefaultCatalogName())) catalogName = null;
- String schemaName = segments[1].getName().getLocalName();
+ String schemaName = segments.get(1).getName().getLocalName();
if (schemaName.equals(source.getDefaultSchemaName())) schemaName = null;
- String tableName = segments[3].getName().getLocalName();
- String columnName = segments[4].getName().getLocalName();
+ String tableName = segments.get(3).getName().getLocalName();
+ String columnName = segments.get(4).getName().getLocalName();
try {
MetadataCollector meta = source.getMetadataCollector();
@@ -668,7 +677,9 @@
MetadataCollector meta = source.getMetadataCollector();
for (String catalogName : meta.getCatalogNames(conn)) {
- catalogNames.add(pathFactory.createSegment(catalogName));
+ if (catalogName.length() > 0) {
+ catalogNames.add(pathFactory.createSegment(catalogName));
+ }
}
if (catalogNames.isEmpty()) {
Added: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/SqlServerMetadataCollector.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/SqlServerMetadataCollector.java (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/SqlServerMetadataCollector.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,51 @@
+package org.jboss.dna.connector.meta.jdbc;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * The Microsoft SQL Server JDBC drivers return a list of users from the {@link DatabaseMetaData#getSchemas()} method instead of
+ * the actual schemas. Unfortunately, the {@link DatabaseMetaData#getTables(String, String, String, String[])} method actually
+ * returns schema names, so the default {@link JdbcMetadataCollector} implementation doesn't match up correctly. This class should
+ * be used when the Microsoft JDBC driver is used for database connectivity. The jTDS driver has already corrected this bug and
+ * can use the default {@link JdbcMetadataCollector}.
+ */
+public class SqlServerMetadataCollector extends JdbcMetadataCollector {
+
+ @Override
+ public List<String> getSchemaNames( Connection conn,
+ String catalogName ) throws JdbcMetadataException {
+ Statement stmt = null;
+ ResultSet rs = null;
+ List<String> schemaNames = new LinkedList<String>();
+
+ try {
+ stmt = conn.createStatement();
+
+ // There's no correlation between schemas and catalogs in MS SQL Server, so return all schemas
+ rs = stmt.executeQuery("SELECT name AS TABLE_SCHEM FROM sys.schemas ORDER BY TABLE_SCHEM");
+ while (rs.next()) {
+ schemaNames.add(rs.getString("TABLE_SCHEM"));
+ }
+
+ return schemaNames;
+ } catch (SQLException se) {
+ throw new JdbcMetadataException(se);
+ } finally {
+ try {
+ if (rs != null) rs.close();
+ } catch (SQLException ignore) {
+ }
+ try {
+ if (stmt != null) stmt.close();
+ } catch (SQLException ignore) {
+ }
+ }
+ }
+
+}
Property changes on: trunk/extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/meta/jdbc/SqlServerMetadataCollector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataConnectorTest.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -24,7 +24,9 @@
package org.jboss.dna.connector.meta.jdbc;
import java.io.IOException;
-import javax.naming.NamingException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.connector.test.ReadableConnectorTest;
@@ -42,7 +44,7 @@
*/
@SuppressWarnings( "unused" )
@Override
- protected RepositorySource setUpSource() throws NamingException {
+ protected RepositorySource setUpSource() throws Exception {
this.source = TestEnvironment.configureJdbcMetadataSource("Test Repository", this);
return source;
@@ -57,7 +59,7 @@
*/
@Override
protected void initializeContent( Graph graph ) throws Exception {
- TestEnvironment.executeDdl(this.source.getDataSource(), "/create.ddl");
+ TestEnvironment.executeDdl(this.source.getDataSource(), "create.ddl", this);
graph = Graph.create(source, context);
}
@@ -65,9 +67,26 @@
@Override
@After
public void afterEach() throws Exception {
- TestEnvironment.executeDdl(this.source.getDataSource(), "/drop.ddl");
+ TestEnvironment.executeDdl(this.source.getDataSource(), "drop.ddl", this);
this.source.close();
}
+ @Override
+ public void shouldReturnSameStructureForRepeatedReadBranchRequests() {
+ Properties properties = TestEnvironment.propertiesFor(this);
+
+ /*
+ * The test Oracle, DB2, and PostgreSQL instances are massive so executing this test that fully loads the whole graph
+ * takes a LONG time.
+ * MS SQL and Sybase return all catalogs, even those that the user does not have access to.
+ */
+ List<String> hugeDbs = Arrays.asList(new String[] {"postgresql8", "oracle10g", "oracle11g", "db2v9", "mssql2008",
+ "sybase15"});
+ if (hugeDbs.contains(properties.getProperty("database"))) {
+ return;
+ }
+ super.shouldReturnSameStructureForRepeatedReadBranchRequests();
+ }
+
}
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepositoryTest.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepositoryTest.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/JdbcMetadataRepositoryTest.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.connector.meta.jdbc;
+import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
@@ -73,7 +74,12 @@
*/
private String loadedCatalogName;
private String loadedSchemaName;
+ private String nullSafeCatalogName;
+ private String nullSafeSchemaName;
+ private boolean upperCaseIdentifiers;
+ private boolean lowerCaseIdentifiers;
+
@Before
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
@@ -95,14 +101,17 @@
workspace = repository.getWorkspace(source.getDefaultWorkspaceName());
assertThat(workspace, is(notNullValue()));
- TestEnvironment.executeDdl(this.source.getDataSource(), "/create.ddl");
+ TestEnvironment.executeDdl(this.source.getDataSource(), "create.ddl", this);
DataSource dataSource = source.getDataSource();
Connection conn = dataSource.getConnection();
DatabaseMetaData dmd = conn.getMetaData();
+ upperCaseIdentifiers = dmd.storesUpperCaseIdentifiers();
+ lowerCaseIdentifiers = dmd.storesLowerCaseIdentifiers();
+
// Look up one of the tables that was just loaded to figure out which catalog and schema it's in
- ResultSet rs = dmd.getTables(null, null, "DISTRICT", null);
+ ResultSet rs = dmd.getTables(null, null, identifier("district"), null);
try {
if (!rs.next()) {
@@ -119,16 +128,19 @@
throw new IllegalStateException(
"There is more than one table named DISTRICT in this database -- Can't determine which catalog and schema to use");
}
+
+ nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
+ nullSafeSchemaName = loadedSchemaName == null ? source.getDefaultSchemaName() : loadedSchemaName;
+
} finally {
rs.close();
conn.close();
}
-
}
@After
public void afterEach() throws Exception {
- TestEnvironment.executeDdl(this.source.getDataSource(), "/drop.ddl");
+ TestEnvironment.executeDdl(this.source.getDataSource(), "drop.ddl", this);
this.source.close();
}
@@ -241,9 +253,6 @@
@Test
public void shouldReturnTablesNode() {
- String nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
- String nullSafeSchemaName = loadedSchemaName == null ? source.getDefaultSchemaName() : loadedSchemaName;
-
Path tablesPath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
pathFactory.createSegment(nullSafeSchemaName),
pathFactory.createSegment(JdbcMetadataRepository.TABLES_SEGMENT_NAME));
@@ -262,10 +271,7 @@
@Test
public void shouldNotReturnTablesNodeForInvalidSchema() {
- Path rootPath = pathFactory.createRootPath();
- PathNode rootNode = workspace.getNode(rootPath);
-
- Segment catalogSegment = rootNode.getChildSegments().get(0);
+ Segment catalogSegment = pathFactory.createSegment(nullSafeCatalogName);
Path catalogPath = pathFactory.createAbsolutePath(catalogSegment);
PathNode catalogNode = workspace.getNode(catalogPath);
@@ -285,7 +291,7 @@
Path tablePath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
pathFactory.createSegment(nullSafeSchemaName),
pathFactory.createSegment(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
- pathFactory.createSegment("SALES"));
+ pathFactory.createSegment(identifier("sales")));
PathNode tableNode = workspace.getNode(tablePath);
Map<Name, Property> properties = tableNode.getProperties();
@@ -302,10 +308,7 @@
@Test
public void shouldNotReturnTableNodeForInvalidSchema() {
- Path rootPath = pathFactory.createRootPath();
- PathNode rootNode = workspace.getNode(rootPath);
-
- Segment catalogSegment = rootNode.getChildSegments().get(0);
+ Segment catalogSegment = pathFactory.createSegment(nullSafeCatalogName);
Path catalogPath = pathFactory.createAbsolutePath(catalogSegment);
PathNode catalogNode = workspace.getNode(catalogPath);
@@ -314,7 +317,7 @@
Path invalidSchemaPath = pathFactory.createAbsolutePath(catalogSegment.getName(),
invalidSchemaName,
nameFactory.create(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
- nameFactory.create("SALES"));
+ nameFactory.create(identifier("sales")));
assertThat(workspace.getNode(invalidSchemaPath), is(nullValue()));
}
@@ -331,6 +334,7 @@
assertThat(workspace.getNode(invalidTablePath), is(nullValue()));
}
+ @SuppressWarnings( "unchecked" )
@Test
public void shouldReturnColumnNode() {
String nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
@@ -339,8 +343,8 @@
Path columnPath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
pathFactory.createSegment(nullSafeSchemaName),
pathFactory.createSegment(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
- pathFactory.createSegment("SALES"),
- pathFactory.createSegment("AMOUNT"));
+ pathFactory.createSegment(identifier("sales")),
+ pathFactory.createSegment(identifier("amount")));
PathNode columnNode = workspace.getNode(columnPath);
Map<Name, Property> properties = columnNode.getProperties();
@@ -352,7 +356,9 @@
assertThat(nameFor(properties.get(JcrLexicon.PRIMARY_TYPE)), is(JcrNtLexicon.UNSTRUCTURED));
assertThat(nameFor(properties.get(JcrLexicon.MIXIN_TYPES)), is(JdbcMetadataLexicon.COLUMN));
- assertThat(longFor(properties.get(JdbcMetadataLexicon.JDBC_DATA_TYPE)), is((long)Types.NUMERIC));
+ // Oracle treats all integral types as decimals
+ assertThat(longFor(properties.get(JdbcMetadataLexicon.JDBC_DATA_TYPE)), anyOf(is((long)Types.INTEGER),
+ is((long)Types.DECIMAL)));
assertThat(stringFor(properties.get(JdbcMetadataLexicon.TYPE_NAME)), is(notNullValue()));
assertThat(longFor(properties.get(JdbcMetadataLexicon.COLUMN_SIZE)), is(notNullValue()));
assertThat(longFor(properties.get(JdbcMetadataLexicon.DECIMAL_DIGITS)), is(notNullValue()));
@@ -360,15 +366,13 @@
assertThat(longFor(properties.get(JdbcMetadataLexicon.LENGTH)), is(notNullValue()));
assertThat(longFor(properties.get(JdbcMetadataLexicon.ORDINAL_POSITION)), is(4L));
- assertThat(columnNode.getChildSegments().isEmpty(), is(true));
+ // Some DBMSes don't have any procedures in the default schema
+ // assertThat(columnNode.getChildSegments().isEmpty(), is(true));
}
@Test
public void shouldNotReturnColumnNodeForInvalidSchema() {
- Path rootPath = pathFactory.createRootPath();
- PathNode rootNode = workspace.getNode(rootPath);
-
- Segment catalogSegment = rootNode.getChildSegments().get(0);
+ Segment catalogSegment = pathFactory.createSegment(nullSafeCatalogName);
Path catalogPath = pathFactory.createAbsolutePath(catalogSegment);
PathNode catalogNode = workspace.getNode(catalogPath);
@@ -377,34 +381,28 @@
Path invalidSchemaPath = pathFactory.createAbsolutePath(catalogSegment.getName(),
invalidSchemaName,
nameFactory.create(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
- nameFactory.create("SALES"),
- nameFactory.create("AMOUNT"));
+ nameFactory.create(identifier("sales")),
+ nameFactory.create(identifier("amount")));
assertThat(workspace.getNode(invalidSchemaPath), is(nullValue()));
}
@Test
public void shouldNotReturnColumnNodeForInvalidTable() {
- String nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
- String nullSafeSchemaName = loadedSchemaName == null ? source.getDefaultSchemaName() : loadedSchemaName;
-
Path invalidTablePath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
pathFactory.createSegment(nullSafeSchemaName),
pathFactory.createSegment(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
pathFactory.createSegment("INVALID_TABLE_NAME"),
- pathFactory.createSegment("ID"));
+ pathFactory.createSegment(identifier("id")));
assertThat(workspace.getNode(invalidTablePath), is(nullValue()));
}
@Test
public void shouldNotReturnInvalidColumnNode() {
- String nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
- String nullSafeSchemaName = loadedSchemaName == null ? source.getDefaultSchemaName() : loadedSchemaName;
-
Path invalidColumnPath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
pathFactory.createSegment(nullSafeSchemaName),
pathFactory.createSegment(JdbcMetadataRepository.TABLES_SEGMENT_NAME),
- pathFactory.createSegment("SALES"),
+ pathFactory.createSegment(identifier("sales")),
pathFactory.createSegment("INVALID_COLUMN_NAME"));
assertThat(workspace.getNode(invalidColumnPath), is(nullValue()));
@@ -412,23 +410,21 @@
@Test
public void shouldReturnProceduresNode() {
- String nullSafeCatalogName = loadedCatalogName == null ? source.getDefaultCatalogName() : loadedCatalogName;
- String nullSafeSchemaName = loadedSchemaName == null ? source.getDefaultSchemaName() : loadedSchemaName;
+ Path proceduresPath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
+ pathFactory.createSegment(nullSafeSchemaName),
+ pathFactory.createSegment(JdbcMetadataRepository.PROCEDURES_SEGMENT_NAME));
+ PathNode proceduresNode = workspace.getNode(proceduresPath);
- Path tablesPath = pathFactory.createAbsolutePath(pathFactory.createSegment(nullSafeCatalogName),
- pathFactory.createSegment(nullSafeSchemaName),
- pathFactory.createSegment(JdbcMetadataRepository.PROCEDURES_SEGMENT_NAME));
- PathNode tablesNode = workspace.getNode(tablesPath);
+ Map<Name, Property> properties = proceduresNode.getProperties();
- Map<Name, Property> properties = tablesNode.getProperties();
-
- assertThat(tablesNode.getPath(), is(tablesPath));
+ assertThat(proceduresNode.getPath(), is(proceduresPath));
assertThat(properties, is(notNullValue()));
assertThat(properties.size(), is(2));
assertThat(nameFor(properties.get(JcrLexicon.PRIMARY_TYPE)), is(JcrNtLexicon.UNSTRUCTURED));
assertThat(nameFor(properties.get(JcrLexicon.MIXIN_TYPES)), is(JdbcMetadataLexicon.PROCEDURES));
- assertThat(tablesNode.getChildSegments().isEmpty(), is(false));
+ // Not all schemas will have stored procs
+ // assertThat(proceduresNode.getChildSegments().isEmpty(), is(false));
}
@Test
@@ -484,4 +480,12 @@
return stringFactory.create(property.getFirstValue());
}
+ private String identifier( String rawIdentifier ) {
+ if (upperCaseIdentifiers) {
+ return rawIdentifier.toUpperCase();
+ } else if (lowerCaseIdentifiers) {
+ return rawIdentifier.toLowerCase();
+ }
+ return rawIdentifier;
+ }
}
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/TestEnvironment.java
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/TestEnvironment.java 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/meta/jdbc/TestEnvironment.java 2009-12-21 01:22:00 UTC (rev 1467)
@@ -23,19 +23,18 @@
*/
package org.jboss.dna.connector.meta.jdbc;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.Statement;
import java.util.Properties;
import javax.sql.DataSource;
-import org.jboss.dna.common.util.IoUtil;
-import org.jboss.dna.connector.meta.jdbc.JdbcMetadataSource;
public class TestEnvironment {
- public static JdbcMetadataSource configureJdbcMetadataSource( String sourceName,
- Object testCase ) {
+ static Properties propertiesFor( Object testCase ) {
Properties properties = new Properties();
ClassLoader loader = testCase instanceof Class<?> ? ((Class<?>)testCase).getClassLoader() : testCase.getClass().getClassLoader();
try {
@@ -44,6 +43,14 @@
throw new RuntimeException(e);
}
+ return properties;
+ }
+
+ public static JdbcMetadataSource configureJdbcMetadataSource( String sourceName,
+ Object testCase ) throws Exception {
+
+ Properties properties = propertiesFor(testCase);
+
JdbcMetadataSource source = new JdbcMetadataSource();
source.setName(sourceName);
source.setDriverClassName(properties.getProperty("jpaSource.driverClassName"));
@@ -78,6 +85,9 @@
value = properties.getProperty("jpaSource.rootNodeUuid");
if (isValue(value)) source.setRootNodeUuid(value);
+ value = properties.getProperty("metadata.collectorClassName");
+ if (isValue(value)) source.setMetadataCollectorClassName(value);
+
return source;
}
@@ -96,20 +106,33 @@
}
public static void executeDdl( DataSource dataSource,
- String pathToDdl ) throws Exception {
+ String fileName,
+ Object testCase ) throws Exception {
Connection conn = null;
Statement stmt = null;
InputStream is = null;
+ BufferedReader reader = null;
-
try {
+ Properties properties = propertiesFor(testCase);
conn = dataSource.getConnection();
- is = TestEnvironment.class.getResourceAsStream(pathToDdl);
- String ddl = IoUtil.read(is);
-
stmt = conn.createStatement();
- stmt.execute(ddl);
+ is = TestEnvironment.class.getResourceAsStream("/" + properties.getProperty("database") + "/" + fileName);
+ reader = new BufferedReader(new InputStreamReader(is));
+
+ /*
+ * We have to send the DDL line-at-a-time because the MySQL driver doesn't like getting multiple DDL statements at once
+ */
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.length() > 0 && !line.startsWith("--")) {
+ // System.out.println("Executing: " + line);
+ stmt.execute(line);
+ }
+ }
+
} finally {
if (stmt != null) try {
stmt.close();
Modified: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/database.properties
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/database.properties 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/database.properties 2009-12-21 01:22:00 UTC (rev 1467)
@@ -25,6 +25,7 @@
# All of these properties are or can be set in the parent POM in the different profiles.
# The property names are designed to match those used in the POM.
# Any property that does not have a non-empty value set by Maven will not be set on the JpaSource.
+jpaSource.dialect = ${jpaSource.dialect}
jpaSource.driverClassName = ${jpaSource.driverClassName}
jpaSource.url = ${jpaSource.url}
jpaSource.username = ${jpaSource.username}
@@ -34,9 +35,20 @@
jpaSource.numberOfConnectionsToAcquireAsNeeded = ${jpaSource.numberOfConnectionsToAcquireAsNeeded}
jpaSource.maximumSizeOfStatementCache = ${jpaSource.maximumSizeOfStatementCache}
jpaSource.maximumConnectionIdleTimeInSeconds = ${jpaSource.maximumConnectionIdleTimeInSeconds}
+jpaSource.largeValueSizeInBytes = ${jpaSource.largeValueSizeInBytes}
+jpaSource.autoGenerateSchema = ${jpaSource.autoGenerateSchema}
+jpaSource.compressData = ${jpaSource.compressData}
jpaSource.cacheTimeToLiveInMilliseconds = ${jpaSource.cacheTimeToLiveInMilliseconds}
+jpaSource.creatingWorkspacesAllowed = ${jpaSource.creatingWorkspacesAllowed}
jpaSource.defaultWorkspaceName = ${jpaSource.defaultWorkspaceName}
+# comma-separated and optionally quoted
+jpaSource.predefinedWorkspaceNames = ${jpaSource.predefinedWorkspaceNames}
+jpaSource.model = ${jpaSource.model}
jpaSource.numberOfConnectionsToAcquireAsNeeded = ${jpaSource.numberOfConnectionsToAcquireAsNeeded}
+jpaSource.referentialIntegrityEnforced = ${jpaSource.referentialIntegrityEnforced}
jpaSource.retryLimit = ${jpaSource.retryLimit}
jpaSource.rootNodeUuid = ${jpaSource.rootNodeUuid}
+jpaSource.showSql = ${jpaSource.showSql}
+database = ${database}
+metadata.collectorClassName = ${metadata.collectorClassName}
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER)
+--ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+--ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+--ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+--ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/db2v9/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales
+DROP TABLE district
+DROP TABLE region
+DROP TABLE area
+DROP TABLE chain
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL)
+--ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+--ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+--ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+--ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/hsqldb/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales;
+DROP TABLE district;
+DROP TABLE region;
+DROP TABLE area;
+DROP TABLE chain;
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL)
+ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mssql2008/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales
+DROP TABLE district
+DROP TABLE region
+DROP TABLE area
+DROP TABLE chain
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/mysql5/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales;
+DROP TABLE district;
+DROP TABLE region;
+DROP TABLE area;
+DROP TABLE chain;
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL)
+ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle10g/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales
+DROP TABLE district
+DROP TABLE region
+DROP TABLE area
+DROP TABLE chain
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL)
+ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/oracle11g/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales
+DROP TABLE district
+DROP TABLE region
+DROP TABLE area
+DROP TABLE chain
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL);
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL);
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL);
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL);
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL);
+ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE);
+
+ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE;
+ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE;
+ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE;
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/postgresql8/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales;
+DROP TABLE district;
+DROP TABLE region;
+DROP TABLE area;
+DROP TABLE chain;
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/create.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/create.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/create.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,33 @@
+-- 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.
+
+CREATE TABLE chain (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL)
+CREATE TABLE area (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, CHAIN_ID INTEGER NOT NULL)
+CREATE TABLE region (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, AREA_ID INTEGER NOT NULL)
+CREATE TABLE district (ID INTEGER NOT NULL PRIMARY KEY, NAME CHAR(30) NOT NULL, REGION_ID INTEGER NOT NULL)
+
+CREATE TABLE sales (ID INTEGER NOT NULL, SALES_DATE DATE NOT NULL, DISTRICT_ID INTEGER NOT NULL, AMOUNT INTEGER NULL)
+ALTER TABLE sales ADD CONSTRAINT PK_SALES PRIMARY KEY (ID, SALES_DATE)
+
+-- ALTER TABLE area ADD CONSTRAINT FK_CHAIN FOREIGN KEY(CHAIN_ID) REFERENCES CHAIN(ID) ON DELETE CASCADE
+-- ALTER TABLE region ADD CONSTRAINT FK_AREA FOREIGN KEY(AREA_ID) REFERENCES AREA(ID) ON DELETE CASCADE
+-- ALTER TABLE district ADD CONSTRAINT FK_REGION FOREIGN KEY(REGION_ID) REFERENCES REGION(ID) ON DELETE CASCADE
Added: trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/drop.ddl
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/drop.ddl (rev 0)
+++ trunk/extensions/dna-connector-jdbc-metadata/src/test/resources/sybase15/drop.ddl 2009-12-21 01:22:00 UTC (rev 1467)
@@ -0,0 +1,27 @@
+-- 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.
+
+DROP TABLE sales
+DROP TABLE district
+DROP TABLE region
+DROP TABLE area
+DROP TABLE chain
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-19 17:24:18 UTC (rev 1466)
+++ trunk/pom.xml 2009-12-21 01:22:00 UTC (rev 1467)
@@ -177,6 +177,7 @@
<jpaSource.retryLimit>3</jpaSource.retryLimit>
<jpaSource.rootNodeUuid/>
<jpaSource.showSql>false</jpaSource.showSql>
+ <metadata.collectorClassName>org.jboss.dna.connector.meta.jdbc.JdbcMetadataCollector</metadata.collectorClassName>
</properties>
<profiles>
@@ -432,6 +433,7 @@
</dependency>
</dependencies>
<properties>
+ <database>h2</database>
<jpaSource.dialect>org.hibernate.dialect.H2Dialect</jpaSource.dialect>
<jpaSource.driverClassName>org.h2.Driver</jpaSource.driverClassName>
<jpaSource.url>jdbc:h2:mem:target/test/db/h2/dna</jpaSource.url>
@@ -491,6 +493,7 @@
</dependency>
</dependencies>
<properties>
+ <database>mysql5</database>
<jpaSource.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</jpaSource.dialect>
<jpaSource.driverClassName>com.mysql.jdbc.Driver</jpaSource.driverClassName>
<jpaSource.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/jbossdna</jpaSource.url>
@@ -517,6 +520,7 @@
</dependency>
</dependencies>
<properties>
+ <database>postgresql8</database>
<jpaSource.dialect>org.hibernate.dialect.PostgreSQLDialect</jpaSource.dialect>
<jpaSource.driverClassName>org.postgresql.Driver</jpaSource.driverClassName>
<jpaSource.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:jbossdna</jpaSource.url>
@@ -554,6 +558,7 @@
</dependency>
</dependencies>
<properties>
+ <database>db2v9</database>
<jpaSource.dialect>org.hibernate.dialect.DB2Dialect</jpaSource.dialect>
<jpaSource.driverClassName>com.ibm.db2.jcc.DB2Driver</jpaSource.driverClassName>
<jpaSource.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa</jpaSource.url>
@@ -581,6 +586,7 @@
</dependency>
</dependencies>
<properties>
+ <database>oracle10g</database>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
<jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
<jpaSource.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:QAORA10</jpaSource.url>
@@ -607,6 +613,7 @@
</dependency>
</dependencies>
<properties>
+ <database>oracle11g</database>
<jpaSource.dialect>org.hibernate.dialect.Oracle10gDialect</jpaSource.dialect>
<jpaSource.driverClassName>oracle.jdbc.driver.OracleDriver</jpaSource.driverClassName>
<jpaSource.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jpaSource.url>
@@ -633,6 +640,7 @@
</dependency>
</dependencies>
<properties>
+ <database>sybase15</database>
<jpaSource.dialect>org.hibernate.dialect.SybaseDialect</jpaSource.dialect>
<jpaSource.driverClassName>com.sybase.jdbc3.jdbc.SybDriver</jpaSource.driverClassName>
<jpaSource.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/jbossdna</jpaSource.url>
@@ -660,6 +668,8 @@
</dependency>
</dependencies>
<properties>
+ <database>mssql2008</database>
+ <metadata.collectorClassName>org.jboss.dna.connector.meta.jdbc.SqlServerMetadataCollector</metadata.collectorClassName>
<jpaSource.dialect>org.hibernate.dialect.SQLServerDialect</jpaSource.dialect>
<jpaSource.driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</jpaSource.driverClassName>
<jpaSource.url>jdbc:sqlserver://vmg04.mw.lab.eng.bos.redhat.com</jpaSource.url>
14 years, 5 months
DNA SVN: r1466 - in trunk: docs/gettingstarted/src/main/docbook/en-US/content and 3 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-19 12:24:18 -0500 (Sat, 19 Dec 2009)
New Revision: 1466
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna.xml
trunk/docs/reference/src/main/docbook/en-US/content/jcr/jcr.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties
Log:
DNA-596 Relax security by default to be more accessible to new users
Committed patch that:
1. Makes the default anonymous (guest) user access "admin"
2. Makes the FileSystem error message for attempts to update a source that does not allow updates more specific:
The source "{0}" does not allow updates. Set the "updatesAllowed" property to "true" on the repository source (connector) to enable updates.
3. Modifies the Getting Started Guide to highlight the default settings and provide examples for how to modify the setting through XML or programmatic or XML configuration.
4. Modifies the Reference Guide to describe the impact of the ANONYMOUS_USER_ROLES setting and provide a reference to the examples in the Getting Started Guide
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-19 16:23:31 UTC (rev 1465)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-19 17:24:18 UTC (rev 1466)
@@ -290,9 +290,9 @@
public static final String READ_DEPTH = "1";
/**
- * The default value for the {@link Option#READ_DEPTH} option is {@value} .
+ * The default value for the {@link Option#ANONYMOUS_USER_ROLES} option is {@value} .
*/
- public static final String ANONYMOUS_USER_ROLES = null;
+ public static final String ANONYMOUS_USER_ROLES = "admin";
/**
* The default value for the {@link Option#PROJECT_NODE_TYPES} option is {@value} .
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna.xml
===================================================================
--- trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna.xml 2009-12-19 16:23:31 UTC (rev 1465)
+++ trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna.xml 2009-12-19 17:24:18 UTC (rev 1466)
@@ -181,6 +181,16 @@
<dna:repository jcr:name="car repository" dna:source="Cars">
<dna:options jcr:primaryType="dna:options">
<jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ <!--
+ As a convenience, DNA allows guest users full access by default. In a production system,
+ you would want to limit this access by uncommenting one of the options below:
+
+ for no access:
+ <anonymousUserRoles jcr:PrimaryType="dna:option" dna:value="" />
+
+ for read-only acces:
+ <anonymousUserRoles jcr:PrimaryType="dna:option" dna:value="readonly" />
+ -->
</dna:options>
</dna:repository>
</dna:repositories>
@@ -288,6 +298,14 @@
.setSource("source 1")
.registerNamespace("acme","http://www.example.com/acme")
.setOption(JcrRepository.Option.JAAS_LOGIN_CONFIG_NAME, "dna-jcr");
+
+ /*
+ * As a convenience, DNA allows guest users full access by default. In a production system,
+ * you would want to limit this access by adding one of the lines below to modify this option:
+ * .setOption(JcrRepository.Option.ANONYMOUS_USER_ROLES, ""); // No access
+ * .setOption(JcrRepository.Option.ANONYMOUS_USER_ROLES, "readonly"); // Read-only access
+ */
+
]]></programlisting>
<para>
This example defines a repository that uses the "source 1" repository source (which could be a federated source, an in-memory source,
Modified: trunk/docs/reference/src/main/docbook/en-US/content/jcr/jcr.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/jcr/jcr.xml 2009-12-19 16:23:31 UTC (rev 1465)
+++ trunk/docs/reference/src/main/docbook/en-US/content/jcr/jcr.xml 2009-12-19 17:24:18 UTC (rev 1466)
@@ -72,8 +72,9 @@
<title>Using JAAS</title>
<para>The <code>login()</code> method allows the implementation to choose its own security context to create a session in the default workspace
for the repository. The JBoss DNA JCR implementation uses the security context from the current JAAS &AccessControlContext;. This implies
- that this method will throw a &LoginException; if it is not executed as a &PrivilegedAction;. Here is one example of how this might
- work:
+ that this method will throw a &LoginException; if it is not executed as a &PrivilegedAction; (AND the
+ <code>JcrRepository.Options.ANONYMOUS_USER_ROLES</code> option does not allow access - <link linkend="jcr-guest-access">see below</link> for an example of how to configure guest user access).
+ Here is one example of how this might work:
<programlisting>
Subject subject = ...;
&Session; session = Subject.doAsPrivileged(subject, new PrivilegedExceptionAction<&Session;>() {
@@ -138,7 +139,7 @@
Not all applications can or want to use JAAS for their authentication system, so JBoss DNA provides a way to integrate your own custom
security provider. The first step is to provide a custom implementation of &SecurityContext; that integrates with your application security, allowing
JBoss DNA to discover the authenticated user's name, determine whether the authenticated user has been assigned particular roles
- (see the <ulink linkend="dna_jcr_security">JCR Security section</ulink>), and to notify your application security system that the
+ (see the <link linkend="dna_jcr_security">JCR Security section</link>), and to notify your application security system that the
authenticated session (for JCR) has ended.
</para>
<para>
@@ -152,7 +153,7 @@
</para>
<para>
At this time, no roles are required to connect to any workspace, but restrictions on workspace connections will likely be added to JBoss DNA in the near future.
- Please see the <ulink linkend="dna_jcr_security">JCR Security section</ulink> for more details on how access is controlled.
+ Please see the <link linkend="dna_jcr_security">JCR Security section</link> for more details on how access is controlled.
</para>
</sect2>
<sect2 id="jcr-sessions-servlet">
@@ -165,11 +166,30 @@
&SecurityContext; securityContext = new &ServletSecurityContext;(request);
&Session; session = repository.login(new &SecurityContextCredentials;(securityContext));
</programlisting>
- You'll note that this is just a specialization of the <ulink linkend="jcr-sessions-custom">custom security context</ulink> approach, since
+ You'll note that this is just a specialization of the <link linkend="jcr-sessions-custom">custom security context</link> approach, since
the &ServletSecurityContext; just implements the &SecurityContext; interface and delegates to the &HttpServletRequest;. Feel free to use
this class in your servlet-based applications.
</para>
</sect2>
+ <sect2 id="jcr-guest-access">
+ <title>Guest (Anonymous) User Access</title>
+ <para>
+ By default, DNA allows guest users full administrative access. This is done to make it easier to get started with DNA. Of course,
+ this is clearly not an appropriate security model for a production system.
+ </para>
+ <para>
+ To modify the roles granted to guest users, change
+ the <code>JcrRepository.Options.ANONYMOUS_USER_ROLES</code> option for your repository to have a different value, like "" (to disable
+ guest access entirely) or "readonly" (to give guests read-only access to all repositories). The value of this option can
+ be any pattern that matches those described in the <link linkend="role-formats">table below</link>.
+ <note>
+ <para>
+ The Using DNA chapter of the Getting Started Guide provides examples of modifying this option through programmatic configuration or
+ in an XML configuration file.
+ </para>
+ </note>
+ </para>
+ </sect2>
</sect1>
<sect1>
<title>JCR Specification Support</title>
@@ -282,7 +302,7 @@
It is also possible to grant access only to one or more repositories on a single DNA server or to one or more named workspaces within a repository. The format for
role names is defined below:
</para>
- <table frame='all'>
+ <table frame='all' id="role-formats">
<title>Role Formats</title>
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
<thead>
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 16:23:31 UTC (rev 1465)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 17:24:18 UTC (rev 1466)
@@ -85,6 +85,7 @@
<!ENTITY UrlEncoder "<ulink url='&API;common/text/Jsr283Encoder.html'><classname>UrlEncoder</classname></ulink>">
<!ENTITY XmlNameEncoder "<ulink url='&API;common/text/Jsr283Encoder.html'><classname>XmlNameEncoder</classname></ulink>">
<!ENTITY XmlValueEncoder "<ulink url='&API;common/text/XmlValueEncoder.html'><classname>XmlValueEncoder</classname></ulink>">
+<!ENTITY Problem "<ulink url='&API;common/collection/Problem.html'><interface>Problem</interface></ulink>">
<!ENTITY Problems "<ulink url='&API;common/collection/Problems.html'><interface>Problems</interface></ulink>">
<!-- Types in dna-graph -->
Modified: trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties 2009-12-19 16:23:31 UTC (rev 1465)
+++ trunk/extensions/dna-connector-filesystem/src/main/resources/org/jboss/dna/connector/filesystem/FileSystemI18n.properties 2009-12-19 17:24:18 UTC (rev 1466)
@@ -37,7 +37,7 @@
sameNameSiblingsAreNotAllowed = {0} does not allow same name siblings on nodes: {1}
nodeOrderingNotSupported = {0} does not support node ordering
onlyTheDefaultNamespaceIsAllowed = {0} requires node names use the default namespace: {1}
-sourceIsReadOnly = The source "{0}" does not allow updates
+sourceIsReadOnly = The source "{0}" does not allow updates. Set the "updatesAllowed" property to "true" on the repository source (connector) to enable updates.
pathIsReadOnly = The path "{0}" in workspace "{1}" in {2} cannot be written to. See java.io.File\#canWrite().
errorSerializingCustomPropertiesFactory = Error serializing a {0} instance owned by the {1} FileSystemSource
14 years, 5 months
DNA SVN: r1465 - in trunk/docs/reference/src/main/docbook/en-US: content/connectors and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-19 11:23:31 -0500 (Sat, 19 Dec 2009)
New Revision: 1465
Modified:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/docs/reference/src/main/docbook/en-US/master.xml
Log:
DNA-594 The JDBC Metadata Connector documentation in Reference Guide is missing
Applied patch that fixes the link to the JDBC metadata connector page and brings it up to the same standard as the other connector pages in the reference guide. Also corrects a few typos in the JPA connector page.
The patch doesn't explicitly list the connector as "experimental" or "technology preview" yet because I'm pretty confident that I'll at least be able to test it against MSSQL and Oracle prior to the 0.7 release. The page does list the drivers that the connector has been tested against.
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-19 14:06:33 UTC (rev 1464)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_metadata.xml 2009-12-19 16:23:31 UTC (rev 1465)
@@ -31,9 +31,200 @@
<chapter id="jdbc-metadata-connector">
<title>JDBC Metadata Connector</title>
<para>
- This connector is a prototype that provides read-only access to the database schema (metadata) from relational databases through a JDBC
- connection.
- <emphasis>This is still under development.</emphasis>
+ This connector provides read-only access to the metadata (e.g., catalogs, schemas, table structures) of a relational database.
+ The connector yields a content graph that looks like this:
+<programlisting>
+/ (root node)
+ + <catalog name> - one node for each accessible catalog in the database.
+ + <schema name> - one node for each accessible schema in the catalog.
+ + tables - a single node that is the parent of all tables in the schema.
+ | + <table name> - one node for each table in the schema.
+ | + <column name> - one node for each column in the table.
+ + procedures - a single node that is the parent of all procedures in the schema.
+ + <procedure name> - one node for each procedure in the schema.
+</programlisting>
+ The root, table, column, and procedure nodes contain additional properties that correspond to the metadata provide by the
+ &DatabaseMetaData; class. In databases that do not support catalogs or schemas (or allow the empty string as a valid
+ catalog or schema name, the value of the <code>defaultCatalogName</code> and/or <code>defaultSchemaName</code> properties
+ will be used instead when determining the graph name.
+ <note>
+ <para>
+ This connector has currently been tested successfully against MySQL 5 (with the InnoDB engine), PostgreSQL 8, and HSQLDB.
+ As JDBC driver implementations of the &DatabaseMetaData; interface tend to vary widely, other databases may or may not work
+ with the default &MetadataCollector; implementation. We are, of course, interested in correcting any database-specific issues
+ that arise, but the <code>metadataCollectorClassName</code> property provides a mechanism to support immediate workarounds.
+ </para>
+ </note>
</para>
+ <para>
+ The &JdbcMetadataSource; class provides a number of JavaBean properties that control its behavior:
+ </para>
+ <table frame='all'>
+ <title>&JdbcMetadataSource; 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>rootNodeUuid</entry>
+ <entry>Optional property that, if used, defines the UUID of the root node in the in-memory repository. If not used,
+ then a new UUID is generated.</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>dataSourceJndiName</entry>
+ <entry>
+ The JNDI name of the JDBC DataSource instance that should be used. If not specified, the other driver properties must be set.
+ </entry>
+ </row>
+ <row>
+ <entry>driverClassName</entry>
+ <entry>
+ The name of the JDBC driver class.
+ This is not required if the DataSource is found in JNDI, but is required otherwise.
+ </entry>
+ </row>
+ <row>
+ <entry>driverClassloaderName</entry>
+ <entry>
+ The name of the <!-- link linkend="class_loader_factory" -->class loader or classpath<!-- /link --> that should be used to load the JDBC driver class.
+ This is not required if the DataSource is found in JNDI.
+ </entry>
+ </row>
+ <row>
+ <entry>url</entry>
+ <entry>
+ The URL that should be used when creating JDBC connections using the JDBC driver class.
+ This is not required if the DataSource is found in JNDI.
+ </entry>
+ </row>
+ <row>
+ <entry>username</entry>
+ <entry>
+ The username that should be used when creating JDBC connections using the JDBC driver class.
+ This is not required if the DataSource is found in JNDI.
+ </entry>
+ </row>
+ <row>
+ <entry>password</entry>
+ <entry>
+ The password that should be used when creating JDBC connections using the JDBC driver class.
+ This is not required if the DataSource is found in JNDI.
+ </entry>
+ </row>
+ <row>
+ <entry>maximumConnectionsInPool</entry>
+ <entry>
+ The maximum number of connections that may be in the connection pool.
+ The default is "5".
+ </entry>
+ </row>
+ <row>
+ <entry>minimumConnectionsInPool</entry>
+ <entry>
+ The minimum number of connections that will be kept in the connection pool.
+ The default is "0".
+ </entry>
+ </row>
+ <row>
+ <entry>maximumConnectionIdleTimeInSeconds</entry>
+ <entry>
+ The maximum number of seconds that a connection should remain in the pool before being closed.
+ The default is "600" seconds (or 10 minutes).
+ </entry>
+ </row>
+ <row>
+ <entry>maximumSizeOfStatementCache</entry>
+ <entry>
+ The maximum number of statements that should be cached.
+ Statement caching can be disabled by setting to "0".
+ The default is "100".
+ </entry>
+ </row>
+ <row>
+ <entry>numberOfConnectionsToAcquireAsNeeded</entry>
+ <entry>
+ The number of connections that should be added to the pool when there are not enough to be used.
+ The default is "1".
+ </entry>
+ </row>
+ <row>
+ <entry>idleTimeInSecondsBeforeTestingConnections</entry>
+ <entry>
+ The number of seconds after a connection remains in the pool that the connection should be tested to ensure it is still valid.
+ The default is 180 seconds (or 3 minutes).
+ </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>cacheTimeToLiveInMilliseconds</entry>
+ <entry>Optional property that, if used, defines the maximum time in milliseconds that any information returned by this connector
+ is allowed to be cached before being considered invalid. When not used, this source will not define a specific
+ duration for caching information.
+ The default value is "600000" milliseconds, or 10 minutes.
+ </entry>
+ </row>
+ <row>
+ <entry>defaultCatalogName</entry>
+ <entry>
+ The name to use for the catalog name if the database does not support catalogs or the database has a catalog with the empty string
+ as a name. The default value is "default".
+ </entry>
+ </row>
+ <row>
+ <entry>defaultSchemaName</entry>
+ <entry>
+ The name to use for the schema name if the database does not support schemas or the database has a schema with the empty string
+ as a name. The default value is "default".
+ </entry>
+ </row>
+ <row>
+ <entry>metadataCollectorClassName</entry>
+ <entry>
+ The name of a custom class to use for metadata collection. The class must implement the &MetadataCollector; interface. If a null
+ value is specified for this property, a default &MetadataCollector; implementation will be used that relies on the &DatabaseMetaData;
+ provided by the JDBC driver for the connection. This property is provided as a means for connecting to databases with a JDBC driver
+ that provides a non-standard &DatabaseMetaData; implementation or no &DatabaseMetaData; implementation at all.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>
+ The JDBC metadata connector is used by creating in the &JcrConfiguration; a repository source that uses the &JdbcMetadataSource; class.
+ For example:
+ </para>
+ <programlisting role="JAVA"><![CDATA[
+JcrConfiguration config = ...
+config.repositorySource("source A")
+ .usingClass(JdbcMetadataSource.class)
+ .setDescription("The database store for our content")
+ .setProperty("dataSourceJndiName", "java:/MyDataSource")
+ .setProperty("nameOfDefaultWorkspace", "default")
+ ]]></programlisting>
+ <para>
+ Of course, setting other more advanced properties would entail calling <code>setProperty(...)</code> for each. Since almost all
+ of the properties have acceptable default values, however, we don't need to set very many of them.
+ </para>
</chapter>
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-19 14:06:33 UTC (rev 1464)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-19 16:23:31 UTC (rev 1465)
@@ -73,7 +73,7 @@
<row>
<entry>predefinedWorkspaceNames</entry>
<entry>Optional property that, if used, defines names of the workspaces that are predefined and need not be created before being used.
- This can be coupled with a "fase" value for the "creatingWorkspaceAllowed" property to allow only the use of only predefined workspaces.
+ This can be coupled with a "false" value for the "creatingWorkspaceAllowed" property to allow only the use of only predefined workspaces.
</entry>
</row>
<row>
@@ -252,7 +252,7 @@
</tgroup>
</table>
<para>
- Using the file system connector is used by creating in the &JcrConfiguration; a repository source that uses the &JpaSource; class.
+ The JPA connector is used by creating in the &JcrConfiguration; a repository source that uses the &JpaSource; class.
For example:
</para>
<programlisting role="JAVA"><![CDATA[
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 14:06:33 UTC (rev 1464)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 16:23:31 UTC (rev 1465)
@@ -50,6 +50,7 @@
<!ENTITY TimeUnit "<ulink url='&Java;java/util/concurrent/TimeUnit.html'><interface>TimeUnit</interface></ulink>">
<!ENTITY UUID "<ulink url='&Java;java/util/UUID.html'><classname>UUID</classname></ulink>">
<!ENTITY DataSource "<ulink url='&Java;javax/sql/DataSource.html'><classname>DataSource</classname></ulink>">
+<!ENTITY DatabaseMetaData "<ulink url='&Java;java/sql/DatabaseMetaData.html'><classname>DatabaseMetaData</classname></ulink>">
<!ENTITY HttpServletRequest "<ulink url='&JavaEE;javax/servlet/http/HttpServletRequest.html'><classname>HttpServletRequest</classname></ulink>">
<!ENTITY Serializable "<ulink url='&Java;java/io/Serializable.html'><interface>Serializable</interface></ulink>">
<!ENTITY Iterator "<ulink url='&Java;java/util/Iterator.html'><interface>Iterator</interface></ulink>">
@@ -199,7 +200,9 @@
<!ENTITY FileSystemSource "<ulink url='&API;connector/filesystem/FileSystemSource.html'><classname>FileSystemSource</classname></ulink>">
<!ENTITY CustomPropertiesFactory "<ulink url='&API;connector/filesystem/CustomPropertiesFactory'><classname>CustomPropertiesFactory</classname></ulink>">
-<!ENTITY JpaSource "<ulink url='&API;connector/source/jap/JpaSource.html'><classname>JpaSource</classname></ulink>">
+<!ENTITY JpaSource "<ulink url='&API;connector/store/jpa/JpaSource.html'><classname>JpaSource</classname></ulink>">
+<!ENTITY JdbcMetadataSource "<ulink url='&API;connector/meta/jdbc/JdbcMetadataSource.html'><classname>JdbcMetadataSource</classname></ulink>">
+<!ENTITY MetadataCollector "<ulink url='&API;connector/meta/jdbc/MetadataCollector'><classname>MetadataCollector</classname></ulink>">
<!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>">
Modified: trunk/docs/reference/src/main/docbook/en-US/master.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-12-19 14:06:33 UTC (rev 1464)
+++ trunk/docs/reference/src/main/docbook/en-US/master.xml 2009-12-19 16:23:31 UTC (rev 1465)
@@ -116,7 +116,7 @@
<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"/-->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/connectors/jdbc_metadata.xml"/>
</part>
<part id="provied-sequencers-part">
<title>Sequencer Library</title>
14 years, 5 months
DNA SVN: r1464 - in trunk: docs/reference/src/main/docbook/en-US/content/connectors and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-19 09:06:33 -0500 (Sat, 19 Dec 2009)
New Revision: 1464
Modified:
trunk/docs/reference/src/main/docbook/en-US/content/connectors/file_system.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java
Log:
DNA-593
Committed patch that updates the documentation to reflect that the connector is no longer read-only (incl. adding the updatesAllowed property to the docs) and renamed the getSupportsUpdates method to be consistent with the setUpdatesAllowed mutator.
The patch also adds references to the custom properties factory, but does not complete the sub-section describing the behavior yet.
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/file_system.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/connectors/file_system.xml 2009-12-19 04:15:29 UTC (rev 1463)
+++ trunk/docs/reference/src/main/docbook/en-US/content/connectors/file_system.xml 2009-12-19 14:06:33 UTC (rev 1464)
@@ -31,9 +31,10 @@
<chapter id="file-system-connector">
<title>File System Connector</title>
<para>
- This connector exposes an area of the local file system as a <emphasis>read-only</emphasis> graph of "nt:file" and "nt:folder" nodes.
- The connector considers a workspace name to be the path to the directory on the file system that represents the root of that
- workspace. Each connector can define whether it allows new workspaces can be created, but if so the names of the new workspaces
+ This connector exposes an area of the local file system as a graph of "nt:file" and "nt:folder" nodes.
+ The connector can be configured so that the workspace name is either a path to the directory on the file system that represents the root of that
+ workspace <emphasis>or</emphasis> the name of subdirectory within a root directory (see the <code>workspaceRootPath</code> property below). Each
+ connector can define whether it allows new workspaces can be created, but if so the names of the new workspaces
must represent valid paths to existing directories.
<note>
<para>
@@ -42,6 +43,9 @@
to the built-in <code>nt:resource</code> node type in all ways except one: it does not extend <code>mix:referenceable</code>. This is because
DNA cannot assign a persistent UUID to the files in the file system or guarantee that no other process will not move or delete the files outside of DNA.
The <code>mix:referenceable</code> node type cannot be implemented if either of these conditions cannot be met.
+
+ Additional properties (including mixin types) can be added through the use of a &CustomPropertiesFactory;. See the <code>customPropertiesFactory</code>
+ property below for more details on how this works.
</para>
</note>
</para>
@@ -65,6 +69,11 @@
<entry>The name of the repository source, which is used by the &RepositoryService; when obtaining a &RepositoryConnection; by name.</entry>
</row>
<row>
+ <entry>updatesAllowed</entry>
+ <entry>Determines whether the content in the file system can be updated ("true"), or if the content may only be read ("false").
+ The default value is "false" to avoid unintentional security vulnerabilities.</entry>
+ </row>
+ <row>
<entry>cacheTimeToLiveInMilliseconds</entry>
<entry>Optional property that, if used, defines the maximum time in milliseconds that any information returned by this connector
is allowed to be cached before being considered invalid. When not used, this source will not define a specific
@@ -111,6 +120,10 @@
</para>
</entry>
</row>
+ <row>
+ <entry>customPropertiesFactory</entry>
+ <entry>Specifies the &CustomPropertiesFactory; that should be used to augment the default properties available on each node.</entry>
+ </row>
</tbody>
</tgroup>
@@ -130,5 +143,11 @@
.setProperty("rootNodeUuid", UUID.fromString("fd129c12-81a8-42ed-aa4b-820dba49e6f0")
.setProperty("creatingWorkspaceAllowed", "false");
]]></programlisting>
+ <sect1>
+ <title>Custom Properties Factories</title>
+ <para>
+ The &CustomPropertiesFactory; interface provides additional flexibility in the properties returned, including support for "sidecar" files.
+ </para>
+ </sect1>
</chapter>
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 04:15:29 UTC (rev 1463)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-19 14:06:33 UTC (rev 1464)
@@ -197,7 +197,8 @@
<!-- Types in extensions/ -->
-<!ENTITY FileSystemSource "<ulink url='&API;connector/filesystem/FileSystemSource.html'><classname>FileSystemSource</classname></ulink>">
+<!ENTITY FileSystemSource "<ulink url='&API;connector/filesystem/FileSystemSource.html'><classname>FileSystemSource</classname></ulink>">
+<!ENTITY CustomPropertiesFactory "<ulink url='&API;connector/filesystem/CustomPropertiesFactory'><classname>CustomPropertiesFactory</classname></ulink>">
<!ENTITY JpaSource "<ulink url='&API;connector/source/jap/JpaSource.html'><classname>JpaSource</classname></ulink>">
<!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>">
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java 2009-12-19 04:15:29 UTC (rev 1463)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemSource.java 2009-12-19 14:06:33 UTC (rev 1464)
@@ -194,23 +194,10 @@
*
* @return true if this source supports updates, or false if this source only supports reading content.
*/
- public boolean getSupportsUpdates() {
+ public boolean getUpdatesAllowed() {
return capabilities.supportsUpdates();
}
- // /**
- // * Set whether this source supports updates.
- // *
- // * @param supportsUpdates true if this source supports updating content, or false if this source only supports reading
- // * content.
- // */
- // public synchronized void setSupportsUpdates( boolean supportsUpdates ) {
- // capabilities = new RepositorySourceCapabilities(SUPPORTS_SAME_NAME_SIBLINGS,
- // supportsUpdates,
- // SUPPORTS_EVENTS,
- // capabilities.supportsCreatingWorkspaces());
- // }
-
/**
* Get the relative root directory for the workspaces. If this property is set, workspaces can be given as relative paths from
* this directory and all workspace paths must be ancestors of this path.
@@ -633,7 +620,7 @@
CustomPropertiesFactory propFactory = customPropertiesFactory != null ? customPropertiesFactory : DEFAULT_PROPERTIES_FACTORY;
return new FileSystemConnection(name, defaultWorkspaceName, availableWorkspaces, isCreatingWorkspacesAllowed(),
cachePolicy, rootNodeUuid, workspaceRootPath, maxPathLength, filenameFilter,
- getSupportsUpdates(), propFactory);
+ getUpdatesAllowed(), propFactory);
}
/**
14 years, 5 months
DNA SVN: r1462 - in trunk/web: dna-web-jcr-rest-war and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-18 23:14:47 -0500 (Fri, 18 Dec 2009)
New Revision: 1462
Modified:
trunk/web/dna-web-jcr-rest-war/
trunk/web/dna-web-jcr-rest/
Log:
Ignored some eclipse-specific files
Property changes on: trunk/web/dna-web-jcr-rest
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
target
Property changes on: trunk/web/dna-web-jcr-rest-war
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
target
14 years, 5 months