-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
2,253 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
target | ||
# ignore Maven generated target folders | ||
target | ||
|
||
# ignore eclipse files and folders | ||
.project | ||
.classpath | ||
.settings | ||
.metadata | ||
.scala_dependencies | ||
.externalToolBuilders | ||
/.metadata | ||
/RemoteSystemsTempFiles | ||
|
||
# ignore IDEA files | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea | ||
atlassian-ide-plugin.xml | ||
|
||
# Compiled python files | ||
*.pyc | ||
|
||
# REST client module bin folder | ||
/tools/org.modeshape.eclipse.jcr.rest.client/bin | ||
|
||
# Presentation Keynote files | ||
/docs/presentations/*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# ModeShape DDL Parsing Example | ||
|
||
The [ModeShape DDL Sequencer library](http://docs.jboss.org/modeshape/latest/manuals/reference/html_single/reference-guide-en.html#ddl-file-sequencer) | ||
contains a DDL parser capable of parsing many common DDL statements conforming to SQL-92, MySQL, Oracle, PostgreSQL, | ||
Sybase, DB2, and Derby. The sequencer uses this parser to build an internal AST representation of the DDL statements, and then the sequencer | ||
turns that AST representation into a graph representation (which ModeShape then persists as part of the sequencing service). | ||
|
||
However, this DDL parser can be used on its own, as long as one understands the parsers limitations and is willing to process the very generic AST representation | ||
for DDL statements that can vary wildly. | ||
|
||
It is also important to understand that DDL statements actually describe operations to be performed against a database schema. | ||
Many of us are familiar with DDL that creates a set of tables and views, and transforming such statements into a model of a database | ||
is relatively straightforward. But this transformation becomes more complicated when the DDL contain ALTER, DROP, ADD COLUMN and other such | ||
statements. | ||
|
||
This example shows how to use the DDL parser to produce a simplistic model of a database schema. It generally works against the more common | ||
create-type DDL statements, although some ALTER statements are supported. The example also does not process primary keys, indexes, foreign keys, | ||
and other more detailed statements; these are left to the reader, but we'd welcome pull-requests with improvements or changes. | ||
|
||
# Building | ||
|
||
This project is self-contained and can be built at the top level of your local clone of the Git repository, | ||
or by simply building this project using Maven 3: | ||
|
||
$ mvn clean install | ||
|
||
This will compile the code and run the unit tests. Note this example does not currently have a `main` method. It is intended for you to play | ||
with the code, and to turn on printing in the parser for more verbose output. Try adding your own DDL files and looking at the output, | ||
and then use the example to help use this DDL parser in your own applications. | ||
|
||
See [this ModeShape community article](http://community.jboss.org/wiki/ModeShapeandMaven) for help on how to install Maven 3. | ||
|
||
# The ModeShape project | ||
|
||
ModeShape is an open source implementation of the JCR 2.0 ([JSR-283](http://www.jcp.org/en/jsr/detail?id=283])) specification and standard API. | ||
To your applications, ModeShape looks and behaves like a regular JCR repository. Applications can search, query, navigate, change, version, listen for changes, etc. | ||
But ModeShape can store that content in a variety of back-end stores (including relational databases, Infinispan data grids, JBoss Cache, etc.), or it can | ||
access and update existing content from *other* kinds of systems (including file systems, SVN repositories, JDBC database metadata, and other JCR repositories). | ||
ModeShape's connector architecture means that you can write custom connectors to access any kind of system. And ModeShape can even federate multiple back-end systems | ||
into a single, unified virtual repository. | ||
|
||
For more information on ModeShape, including getting started guides, reference guides, and downloadable binaries, visit the project's website at [http://www.modeshape.org]() | ||
or follow us on our [blog](http://modeshape.wordpress.org) or on [Twitter](http://twitter.com/modeshape). Or hop into our [IRC chat room](http://www.jboss.org/modeshape/chat) | ||
and talk our community of contributors and users. | ||
|
||
The official Git repository for the project is also on GitHub at [http://github.com/ModeShape/modeshape](). | ||
|
||
# Need help? | ||
|
||
ModeShape is open source software with a dedicated community. If you have any questions or problems, post a question in our | ||
[user forum](http://community.jboss.org/en/modeshape) or hop into our [IRC chat room](http://www.jboss.org/modeshape/chat) and talk our community of contributors and users. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
<?xml version="1.0"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.modeshape.example</groupId> | ||
<artifactId>modeshape-ddl-parser-example</artifactId> | ||
<packaging>jar</packaging> | ||
<name>ModeShape DDL Parser Example</name> | ||
<description>A simple demo application that parses DDL using the ModeShape DDL sequencer library.</description> | ||
<version>1.0-SNAPSHOT</version> | ||
<properties> | ||
<!-- Instruct the build to use only UTF-8 encoding for source code --> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<!-- | ||
Global dependency version information | ||
--> | ||
<modeshape.version>2.5.0.Final</modeshape.version> | ||
<slf4j.api.version>1.5.11</slf4j.api.version> | ||
<slf4j.log4j.version>1.5.11</slf4j.log4j.version> | ||
<log4j.version>1.2.16</log4j.version> | ||
<junit.version>4.8.2</junit.version> | ||
<!-- | ||
Maven plugin versions | ||
--> | ||
<maven.surefire.report.plugin.version>2.4.3</maven.surefire.report.plugin.version> | ||
<maven.surefire.plugin.version>2.7.1</maven.surefire.plugin.version> | ||
<maven.assembly.plugin.version>2.2</maven.assembly.plugin.version> | ||
<maven.install.plugin.version>2.3.1</maven.install.plugin.version> | ||
<maven.jar.plugin.version>2.3.1</maven.jar.plugin.version> | ||
<maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version> | ||
<maven.source.plugin.version>2.1.2</maven.source.plugin.version> | ||
<maven.resources.plugin.version>2.4.3</maven.resources.plugin.version> | ||
</properties> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**</include> | ||
</includes> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<includes> | ||
<include>**/*Test.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<!-- Specify the compiler options and settings --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven.compiler.plugin.version}</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
<showDeprecation>false</showDeprecation> | ||
<showWarnings>false</showWarnings> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven.surefire.plugin.version}</version> | ||
<configuration> | ||
<includes> | ||
<include>**/*TestCase.java</include> | ||
<include>**/*Test.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
<!-- Produce source jars during the 'verify' phase --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven.source.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- | ||
Build a test-jar for each project, so that src/test/* resources and | ||
classes can be used in other projects. Also customize how the jar | ||
files are assembled. | ||
--> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>${maven.jar.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>test-jar</id> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>${maven.resources.plugin.version}</version> | ||
<configuration> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<!-- DDL sequencer and required ModeShape libraries --> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-sequencer-ddl</artifactId> | ||
<version>${modeshape.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-graph</artifactId> | ||
<version>${modeshape.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-common</artifactId> | ||
<version>${modeshape.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<!-- Logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.api.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>${slf4j.log4j.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>${log4j.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<!-- Testing (note the scope) --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>JBoss-Releases</id> | ||
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url> | ||
</repository> | ||
</repositories> | ||
</project> |
Oops, something went wrong.