Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/rxm.git

Renamed entry point to RXM.

AuthorDave Jarvis <email>
Date2015-03-01 21:04:42 GMT-0800
Commitd81183a0f813218843a1c30e6bae3cd7ac5c449f
Parentd0fd40e
README.md
file using:
- gradle clean build run -Pargs=test/people.rxm
+ gradle clean build javadoc run -Pargs=test/people.rxm
# Usage
```
-import com.whitemagicsoftware.rxm.RelationMap;
+import com.whitemagicsoftware.rxm.RXM;
public class QueryTest {
public static void main( String args[] ) throws Exception {
- RelationMap rxm = new RelationMap(
+ RXM rxm = new RXM(
"root > people," +
"person > person," +
```
-import com.whitemagicsoftware.rxm.RelationMap;
+import com.whitemagicsoftware.rxm.RXM;
public class QueryTest {
public static void main( String args[] ) throws Exception {
- RelationMap rxm = new RelationMap(
+ RXM rxm = new RXM(
"module person," +
"person > person," +
source/java/com/whitemagicsoftware/rxm/RelationMap.java
-package com.whitemagicsoftware.rxm;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Abstracts SQL statement code into a terse mapping format.
- */
-public class RelationMap {
- /** The SQL statement to execute. */
- private String query;
-
- /** The RXM expressions, which can include module names and mappings. */
- private Set<String> expressions;
-
- /**
- * Creates a new Relation eXpression Map (<b>rxm</b>). This will parse
- * content and update both the query and the modules as necessary.
- *
- * @param map The <b>rxm</b> to parse.
- */
- public RelationMap( String map ) {
- map( map );
- }
-
- public String toXML( Connection connection ) throws SQLException {
- return "";
- }
-
- public String toJSON( Connection connection ) throws SQLException {
- return "";
- }
-
- /**
- * Adds an <b>rxm</b> to the set of mappings.
- *
- * @param map The <b>rxm</b> to map.
- */
- public void map( String map ) {
- getExpressions().add( map );
- }
-
- /**
- * Walks through the <b>rxm</b> list and creates the equivalent
- * SQL statement.
- *
- * @return A SQL statement based on the current set of expressions.
- */
- private String parse() {
- return "";
- }
-
- /**
- * Returns a set of Relational eXpression Maps.
- *
- * @return An non-null set, possibly empty.
- */
- private Set<String> getExpressions() {
- Set<String> result = this.expressions;
-
- if( result == null ) {
- result = createExpressions();
- setExpressions( result );
- }
-
- return this.expressions;
- }
-
- /**
- * Sets the container to hold the expressions. Subclasses should override
- * createExpressions to introduce new behaviour.
- */
- private void setExpressions( Set<String> expressions ) {
- if( expressions == null ) {
- expressions = createExpressions();
- }
-
- this.expressions = expressions;
- }
-
- /**
- * Returns the container to hold all expressions.
- *
- * @return A non-null HashSet by default.
- */
- protected Set<String> createExpressions() {
- return new HashSet<String>();
- }
-
- /**
- * Sets the SQL statement to execute when calling one of the toX()
- * methods.
- */
- private String getQuery() {
- return this.query;
- }
-
- /**
- * Stores the SQL statement after parsing the expression mappings.
- *
- * @param query The SQL statement to store
- */
- private void setQuery( String query ) {
- this.query = query;
- }
-}
-
Delta5 lines added, 116 lines removed, 111-line decrease