diff --git a/.gitignore b/.gitignore
index 26d57f9..0298f94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,12 @@
*/*/*/*/target
# Inore some artifact dirs;
-vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/deploy
-vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/workdir
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/conf
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/data
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/demo
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/deploy
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/logs
+vasc-demo/vasc-demo-tech/vasc-demo-tech-core/workdir
# Ignore leftovers of really failed release build
release.properties
diff --git a/pom.xml b/pom.xml
index 5d0b207..437faf8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,15 +37,10 @@
vasc-lib
- https://...vasc/
- file://${project.build.directory}/target-maven-repo
UTF-8
- 2.1.0
- 5.8
- 0.8.2-SNAPSHOT
- 4.3
+ 1.5
-
+
1.2
2.3.1
2.4
@@ -53,59 +48,121 @@
1.0-beta-3
3.2
1.0-beta-3
+ 2.3
+ 2.0-beta-2
+ 2.2.1
+ 2.3.1
2.1
2.3
2.4.2
- 2.0.2
+ 2.3.2
+ 2.4.1
+ 2.7.1
+ 2.3.1
2.1.2
- 2.7
- 2.1
- 2.5
- 3.0-beta-3
+ 2.5
+ 2.8.1
+ 2.2.2
+ 2.6
+ 3.0
2.0
2.5
1.0
- 2.4
- 2.5
+ 2.12
+ 2.6
2.5
1.0-beta-1
- 2.2
+ 2.4
+ 5.8
+ 2.1.0
-
- 2.4
+
+ 0.8.2-SNAPSHOT
+
+
+ 4.3
+
+
+ 3.0-beta7-SNAPSHOT
+
+
+ 2.7.3
+
+
+ 2.6.0
+
+
+ 0.4.4.1
+
+
+ 3.3.0-I20070606-0010
+
+
+ 4.5.1
+
+
+ 1.0.3
+ 1.0.3
+ 1.6.4
+ 1.6.4
+ 2.3
+ 1.9.2
+
+
+ 9.1-901.jdbc4
+ 5.1.20
+ 1.3.167
+ 10.8.2.2
+
+
+ 3.1.0.CR1
+ 3.5.6-Final
+
+
+ 6.0
+ 3.0
+ 1.1
+ 1.0.2
+ 3.0-alpha-1
+ 1.0-MR1
1.2
- 2.1
+ 2.2.1-b03
+ 2.1
+ 2.1.6
+
+
+ 4.1.0.Final
+ 3.3.3
+ 1.0.6-SNAPSHOT
+ 3.3.3
+
+
1.1.2
- 1.2_12
- 1.2_12
- 1.1.15.B1
- 3.3.3.Final
- 3.3.3.Final
- 3.3.3.Final
1.2
- 1.2
-
-
- 3.0
- 1.0
- 3.4.0.GA
+ 2.2.1-b04
1.6.3
+ 3.0.0.CR2
+ 6.0.0.Final
9.1.0.8
2.8.1
1.0.b2
-
-
- 3.0.0.CR2
- 6.0.0.Final
-
-
- 1.9.2
+
+
+
+ org.richfaces
+ richfaces-bom
+ ${richfaces.version}
+ import
+ pom
+
+
+
+
-
org.testng
testng
@@ -113,26 +170,25 @@
jdk15
test
-
-
-
maven-compiler-plugin
+ ${maven-compiler-plugin.version}
- UTF-8
-
- 1.5
+ ${project.build.sourceEncoding}
+
+ ${project.build.sourceVersion}
maven-source-plugin
+ ${maven-source-plugin.version}
attach-sources
@@ -144,9 +200,9 @@
maven-site-plugin
- 2.0-beta-7
+ ${maven-site-plugin.version}
- UTF-8
+ ${project.build.sourceEncoding}
@@ -154,97 +210,55 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.4
+ ${maven-surefire-plugin.version}
-
-
-
- com.agilejava.docbkx
- docbkx-maven-plugin
-
-
-
- src/main/docbook/
- target/site/docbook/
-
-
- *.xml
-
-
-
- true
-
-
- version
- ${version}
-
-
-
-
- true
-
-
-
-
-
-
-
- create-pdf-docs
- site
- generate-pdf
-
-
- file:///${basedir}/src/main/docbook/
-
-
-
-
- create-html-docs
- site
- generate-html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.docbook
- docbook-xml
- 4.4
- runtime
-
-
-
org.apache.maven.plugins
maven-release-plugin
- 2.1
clean install verify
-
- clean install javadoc:javadoc deploy
- -Prelease -DaltDeploymentRepository="${altDeploymentRepository}"
+
+ clean install -P notest
+
+ maven-clean-plugin
+ ${maven-clean-plugin.version}
+
+
+ maven-changes-plugin
+ ${maven-changes-plugin.version}
+
+
+ maven-install-plugin
+ ${maven-install-plugin.version}
+
+
+ maven-resources-plugin
+ ${maven-resources-plugin.version}
+
+
+ maven-jar-plugin
+ ${maven-jar-plugin.version}
+
+
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+
+ maven-deploy-plugin
+ ${maven-deploy-plugin.version}
+
- org.apache.maven.plugins
maven-release-plugin
- 2.1
+ ${maven-release-plugin.version}
@@ -255,19 +269,23 @@
org.codehaus.mojo
- cobertura-maven-plugin
+ cobertura-maven-plugin
+ ${cobertura-maven-plugin}
org.apache.maven.plugins
- maven-surefire-report-plugin
+ maven-surefire-report-plugin
+ ${maven-surefire-report-plugin.version}
org.apache.maven.plugins
- maven-javadoc-plugin
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin}
org.apache.maven.plugins
maven-project-info-reports-plugin
+ ${maven-project-info-reports-plugin.version}
@@ -280,21 +298,23 @@
org.codehaus.mojo
- jxr-maven-plugin
+ jxr-maven-plugin
+ ${jxr-maven-plugin.version}
org.apache.maven.plugins
maven-surefire-report-plugin
- 2.4.2
+ ${maven-surefire-report-plugin.version}
org.codehaus.mojo
- jdepend-maven-plugin
+ jdepend-maven-plugin
+ ${jdepend-maven-plugin.version}
org.apache.maven.plugins
maven-changes-plugin
- 2.0
+ ${maven-changes-plugin.version}
${basedir}/src/site/changes.xml
@@ -313,7 +333,7 @@
jboss
JBoss Repository Switchboard
default
- http://repository.jboss.com/maven2/
+ http://repository.jboss.com/
true
false
@@ -324,6 +344,11 @@
http://repository.ops4j.org/maven2/
false
+
+ sonatype-snapshots
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
@@ -363,146 +389,13 @@
-
- release
+
+ notest
- file://${project.build.directory}/dummy-hg-repo
- release-repo-hudson::default::${staging.mvn.repo.url}
+ true
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
- clean-release-dirs
- initialize
-
- exec
-
- false
-
- rm
-
- -rf
- ${project.build.directory}/dummy-hg-repo
- ${project.build.directory}/target-maven-repo
-
-
-
-
- create-release-dirs
- initialize
-
- exec
-
- false
-
- mkdir
-
- -p
- ${project.build.directory}/dummy-hg-repo
- ${project.build.directory}/target-maven-repo
-
-
-
-
- init-dummy-hg-repo
- initialize
-
- exec
-
- false
-
- hg
- ${project.build.directory}/dummy-hg-repo
-
- init
-
-
-
-
-
-
-
-
-
- release-commit
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
- push-hg
- initialize
-
- exec
-
- false
-
- hg
-
- push
-
-
-
-
-
-
- org.codehaus.mojo
- wagon-maven-plugin
-
-
- ${project.distributionManagement.repository.url}
- ${project.distributionManagement.repository.id}
-
-
-
- merge-repo
- initialize
-
- merge-maven-repos
-
- false
-
-
-
-
-
-
-
- release-cancel
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
-
-
- strip-hg
- initialize
-
- exec
-
- false
-
-
- rm
-
- -rf
- .hg
-
-
-
-
-
-
-
-
+
-
\ No newline at end of file
+
diff --git a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcConnectionProviderJdniImpl.java b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcConnectionProviderJdniImpl.java
index 65a4570..5d705b0 100644
--- a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcConnectionProviderJdniImpl.java
+++ b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcConnectionProviderJdniImpl.java
@@ -61,9 +61,6 @@ public class JdbcConnectionProviderJdniImpl implements JdbcConnectionProvider {
try {
Context initialContext = new InitialContext();
- if ( initialContext == null ) {
- throw new SQLException("Cannot get Initial Context");
- }
DataSource datasource = (DataSource)initialContext.lookup(dataSourceContext+name);
if ( datasource == null ) {
throw new SQLException("Cannot lookup datasource: "+name);
diff --git a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java
index 073a823..f7c4834 100644
--- a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java
+++ b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java
@@ -51,10 +51,19 @@ public class JdbcVascBackend extends AbstractVascBackend {
private JdbcConnectionProvider jdbcConnectionProvider = null;
private String sqlList = null;
- private String idColumn = null;
- private String sqlDelete = null;
- private String sqlUpdate = null;
- private String sqlInsert = null;
+ //private String idColumn = null;
+ //private String sqlDelete = null;
+ //private String sqlUpdate = null;
+ //private String sqlInsert = null;
+
+
+ /**
+ * @see net.forwardfire.vasc.backend.AbstractVascBackend#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
/**
* @return the JdbcConnectionProvider
diff --git a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java
index c821710..0d3c12e 100644
--- a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java
+++ b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java
@@ -54,6 +54,14 @@ public class JdbcVascBackendXpql extends AbstractVascBackend {
private net.forwardfire.vasc.xpql.query.Query query = null;
+ /**
+ * @see net.forwardfire.vasc.backend.AbstractVascBackend#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
/**
* @return the JdbcConnectionProvider
*/
diff --git a/vasc-backend/vasc-backend-jpa/pom.xml b/vasc-backend/vasc-backend-jpa/pom.xml
index 44d781a..057923e 100644
--- a/vasc-backend/vasc-backend-jpa/pom.xml
+++ b/vasc-backend/vasc-backend-jpa/pom.xml
@@ -19,13 +19,13 @@
javax.persistence
persistence-api
- 1.0
+ ${persistence-api.version}
provided
org.hibernate
hibernate-annotations
- 3.4.0.GA
+ ${hibernate-annotations.version}
provided
diff --git a/vasc-backend/vasc-backend-metamodel/pom.xml b/vasc-backend/vasc-backend-metamodel/pom.xml
index ed0e903..a614963 100644
--- a/vasc-backend/vasc-backend-metamodel/pom.xml
+++ b/vasc-backend/vasc-backend-metamodel/pom.xml
@@ -18,7 +18,19 @@
org.eobjects.metamodel
MetaModel-full
- 3.0-SNAPSHOT
+ ${metamodel.version}
+
+ com.h2database
+ h2
+ ${h2.version}
+ test
+
+
+ postgresql
+ postgresql
+ ${postgresql.version}
+ test
+
\ No newline at end of file
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataContext.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataContext.java
new file mode 100644
index 0000000..335785a
--- /dev/null
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataContext.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2007-2012 forwardfire.net All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.forwardfire.vasc.backend.metamodel;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.eobjects.metamodel.DataContext;
+
+/**
+ * MetaModelDataContextJndiDataContext provides a data context from jndi.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 22, 2012
+ */
+public class MetaModelDataContextJndiDataContext implements MetaModelDataContextProvider {
+
+ private String jndiName = null;
+
+ public DataContext getDataContext() {
+ return getDataContextJndi();
+ }
+
+ private DataContext getDataContextJndi() {
+ try {
+ InitialContext context = new InitialContext();
+ DataContext dataContext = (DataContext)context.lookup(jndiName);
+ if (dataContext == null) {
+ throw new NullPointerException("Cannot lookup dataContext: "+jndiName);
+ }
+ return dataContext;
+ } catch (NamingException e) {
+ throw new IllegalStateException("Naming error:"+e.getMessage(),e);
+ }
+ }
+
+ /**
+ * @return the jndiName
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ /**
+ * @param jndiName the jndiName to set
+ */
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataSource.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataSource.java
new file mode 100644
index 0000000..b225659
--- /dev/null
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextJndiDataSource.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2007-2012 forwardfire.net All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.forwardfire.vasc.backend.metamodel;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.eobjects.metamodel.DataContext;
+import org.eobjects.metamodel.jdbc.JdbcDataContext;
+
+/**
+ * MetaModelDataContextJndiDataSource provides a connection from datasource for meta model data context.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 15, 2012
+ */
+public class MetaModelDataContextJndiDataSource implements MetaModelDataContextProvider {
+
+ private String jndiName = null;
+
+ public DataContext getDataContext() {
+ JdbcDataContext dataContext = new JdbcDataContext(getDataSource());
+ return dataContext;
+ }
+
+ private DataSource getDataSource() {
+ try {
+ InitialContext context = new InitialContext();
+ DataSource datasource = (DataSource)context.lookup(jndiName);
+ if (datasource == null) {
+ throw new NullPointerException("Cannot lookup datasource: "+jndiName);
+ }
+ return datasource;
+ } catch (NamingException e) {
+ throw new IllegalStateException("Naming error:"+e.getMessage(),e);
+ }
+ }
+
+ /**
+ * @return the jndiName
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ /**
+ * @param jndiName the jndiName to set
+ */
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextMongodb.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextMongodb.java
index fc24a07..ee27275 100644
--- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextMongodb.java
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextMongodb.java
@@ -26,6 +26,7 @@ import java.net.UnknownHostException;
import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.mongodb.MongoDbDataContext;
+import org.eobjects.metamodel.mongodb.MongoDbDataContextBean;
import com.mongodb.DB;
import com.mongodb.Mongo;
@@ -48,10 +49,15 @@ public class MetaModelDataContextMongodb implements MetaModelDataContextProvider
private boolean readonly = false;
protected Mongo mongo = null;
- //protected DB db = null;
public DataContext getDataContext() {
- MongoDbDataContext dataContext = new MongoDbDataContext(getMongodbConnection());
+ MongoDbDataContextBean dataContext = new MongoDbDataContextBean(getMongodbConnection());
+ dataContext.setRegisterMBean(true);
+ dataContext.start();
+ //MongoDbDataContextSchemaDetector detector = new MongoDbDataContextSchemaDetector();
+ //detector.setDataCheckSize(10);
+ //detector.setSearchReference(true);
+ //DataContext dataContext = detector.new MongoDbDataContextExtended(getMongodbConnection(),detector);
return dataContext;
}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlDom.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlDom.java
new file mode 100644
index 0000000..0a45e57
--- /dev/null
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlDom.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2007-2012 forwardfire.net All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.forwardfire.vasc.backend.metamodel;
+
+import java.io.File;
+
+import org.eobjects.metamodel.DataContext;
+import org.eobjects.metamodel.xml.XmlDomDataContext;
+
+/**
+ * MetaModelDataContextXmlDom provides basic auto xml editing support.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 20, 2012
+ */
+public class MetaModelDataContextXmlDom implements MetaModelDataContextProvider {
+
+ private String file = null;
+ private boolean autoFlattenTables = true;
+
+
+ public DataContext getDataContext() {
+ if (file==null) {
+ throw new NullPointerException("Can's provided data context with null file.");
+ }
+ XmlDomDataContext dataContext = new XmlDomDataContext(new File(file),autoFlattenTables);
+ return dataContext;
+ }
+
+
+ /**
+ * @return the file
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * @param file the file to set
+ */
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ /**
+ * @return the autoFlattenTables
+ */
+ public boolean isAutoFlattenTables() {
+ return autoFlattenTables;
+ }
+
+ /**
+ * @param autoFlattenTables the autoFlattenTables to set
+ */
+ public void setAutoFlattenTables(boolean autoFlattenTables) {
+ this.autoFlattenTables = autoFlattenTables;
+ }
+}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlSax.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlSax.java
new file mode 100644
index 0000000..3d3734d
--- /dev/null
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelDataContextXmlSax.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2007-2012 forwardfire.net All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.forwardfire.vasc.backend.metamodel;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eobjects.metamodel.DataContext;
+import org.eobjects.metamodel.xml.XmlSaxDataContext;
+import org.eobjects.metamodel.xml.XmlSaxTableDef;
+
+/**
+ * MetaModelDataContextXml provides basic xml editing support.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 3, 2012
+ */
+public class MetaModelDataContextXmlSax implements MetaModelDataContextProvider {
+
+ private String file = null;
+ private List tableSchemas = null;
+
+ public MetaModelDataContextXmlSax() {
+ tableSchemas = new ArrayList(5);
+ }
+
+ public DataContext getDataContext() {
+ if (file==null) {
+ throw new NullPointerException("Can's provided data context with null file.");
+ }
+ if (tableSchemas.isEmpty()) {
+ throw new IllegalStateException("Can't provided data context with zero table schemas.");
+ }
+ XmlSaxTableDef[] args = new XmlSaxTableDef[tableSchemas.size()];
+ XmlSaxDataContext dataContext = new XmlSaxDataContext(new File(file),tableSchemas.toArray(args));
+ return dataContext;
+ }
+
+ public void addTableSchema(XmlSaxTableDef tableSchema) {
+ tableSchemas.add(tableSchema);
+ }
+
+ public void removeTableSchema(XmlSaxTableDef tableSchema) {
+ tableSchemas.remove(tableSchema);
+ }
+
+ public List getTableSchemas() {
+ return tableSchemas;
+ }
+
+ public void setFile(String file) {
+ this.file=file;
+ }
+
+ public String getFile() {
+ return file;
+ }
+}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java
index e0af677..83e18f4 100644
--- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java
@@ -33,14 +33,13 @@ import net.forwardfire.vasc.backend.VascBackendControllerLocal;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
-import net.forwardfire.vasc.core.VascEntryField;
-import net.forwardfire.vasc.core.VascLinkEntry;
-import net.forwardfire.vasc.core.VascLinkEntryType;
+import net.forwardfire.vasc.core.VascEntryFieldLocal;
+import net.forwardfire.vasc.core.VascEntryLinkType;
+import net.forwardfire.vasc.core.VascEntryLocal;
import net.forwardfire.vasc.impl.DefaultVascEntry;
import net.forwardfire.vasc.impl.DefaultVascEntryField;
-import net.forwardfire.vasc.impl.DefaultVascFactory;
-import net.forwardfire.vasc.impl.DefaultVascLinkEntry;
+import net.forwardfire.vasc.impl.DefaultVascEntryLink;
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
/**
@@ -74,11 +73,11 @@ public class MetaModelSchemaAutoEntry {
DataContext ds = getDataContextProvider().getDataContext();
for (String table:ds.getDefaultSchema().getTableNames()) {
if (getTableInclude()!=null && table.matches(getTableInclude())==false) {
- logger.fine("Excluding table: "+table+" from include rule.");
+ logger.finer("Excluding table: "+table+" from include rule.");
continue;
}
if (getTableExclude()!=null && table.matches(getTableExclude())) {
- logger.fine("Excluding table: "+table+" from exclude rule.");
+ logger.finer("Excluding table: "+table+" from exclude rule.");
continue;
}
createMetaEntry(ds,getEntryPrefix()+"_"+table,table);
@@ -90,7 +89,7 @@ public class MetaModelSchemaAutoEntry {
}
private void createMetaEntry(DataContext ds,String id,String tableName) {
- logger.info("Creating entry id: "+id+" of table: "+tableName);
+ logger.fine("Creating entry id: "+id+" of table: "+tableName);
Table metaTable = null;
if (tableName==null) {
metaTable = ds.getDefaultSchema().getTable(0);
@@ -114,7 +113,7 @@ public class MetaModelSchemaAutoEntry {
//TODO backend.setRequestReadOnly(true);
}
- VascEntry ve = new DefaultVascEntry();
+ DefaultVascEntry ve = new DefaultVascEntry();
ve.setId(id);
ve.setBackendId(id+"_backend");
ve.setPrimaryKeyFieldId(backend.getTableId());
@@ -123,10 +122,10 @@ public class MetaModelSchemaAutoEntry {
for (Relationship rs:metaTable.getRelationships()) {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (tableName.equals(rs.getForeignTable().getName())==false) {
- logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
+ logger.finer("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
createLinkEntry(rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
- logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
+ logger.finer("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
@@ -134,15 +133,12 @@ public class MetaModelSchemaAutoEntry {
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
-
- // mm TODO rm this fill which adds the global actions ... and show updated tree in editor
- DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) getVascController().getVascEntryController(), getVascController());
} catch (Exception ee) {
ee.printStackTrace();
}
}
- private void createLinkEntry(Relationship rs2,VascEntry ve,Table metaTable,String id) {
+ private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable,String id) {
MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(getDataContextProvider());
@@ -159,7 +155,7 @@ public class MetaModelSchemaAutoEntry {
backendLink.setTableId(cols[0].getName());
}
- VascEntry veLink = new DefaultVascEntry();
+ DefaultVascEntry veLink = new DefaultVascEntry();
veLink.setId(id);
veLink.setBackendId(id+"_backend");
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
@@ -171,7 +167,7 @@ public class MetaModelSchemaAutoEntry {
//logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
//createLinkEntry(rs,ve,rs2.getForeignTable(),id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
- logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
+ logger.fine("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
@@ -180,13 +176,13 @@ public class MetaModelSchemaAutoEntry {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
- VascLinkEntry vle = new DefaultVascLinkEntry();
+ DefaultVascEntryLink vle = new DefaultVascEntryLink();
vle.setId(id+"Link");
- vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE);
+ vle.setVascLinkEntryType(VascEntryLinkType.DEFAULT_TYPE);
vle.setVascEntryId(id);
vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
- ve.addVascLinkEntry(vle);
+ ve.addVascEntryLink(vle);
} catch (Exception e) {
e.printStackTrace();
@@ -209,13 +205,13 @@ public class MetaModelSchemaAutoEntry {
} else {
backendLink.setTableId(cols[0].getName());
}
- VascEntry veLink = new DefaultVascEntry();
+ DefaultVascEntry veLink = new DefaultVascEntry();
veLink.setId(id);
veLink.setBackendId(id+"_backend");
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
createFields(veLink,cols);
try {
- VascEntryField vef = ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
+ VascEntryFieldLocal vef = (VascEntryFieldLocal)ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
if (vef==null) {
logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
return;
@@ -234,9 +230,10 @@ public class MetaModelSchemaAutoEntry {
}
}
- private void createFields(VascEntry ve,Column[] cols) {
+ private void createFields(VascEntryLocal ve,Column[] cols) {
for (Column c:cols) {
- VascEntryField vef = new DefaultVascEntryField(c.getName());
+ DefaultVascEntryField vef = new DefaultVascEntryField();
+ vef.setId(c.getName());
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass()));
if (vef.getId().equals(ve.getPrimaryKeyFieldId())) {
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java
index 7a3c0fc..e2571be 100644
--- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java
@@ -24,29 +24,27 @@ package net.forwardfire.vasc.backend.metamodel;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+import java.util.logging.Logger;
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.UpdateScript;
+import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.UpdateableDataContext;
import org.eobjects.metamodel.data.DataSet;
import org.eobjects.metamodel.data.Row;
-import org.eobjects.metamodel.insert.RowInsertionBuilder;
import org.eobjects.metamodel.query.Query;
import org.eobjects.metamodel.query.SelectItem;
import org.eobjects.metamodel.query.builder.SatisfiedQueryBuilder;
import org.eobjects.metamodel.query.builder.SatisfiedWhereBuilder;
import org.eobjects.metamodel.schema.Schema;
import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.update.RowUpdationBuilder;
import net.forwardfire.vasc.backend.AbstractVascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
-import net.forwardfire.vasc.backend.data.MapVascEntryFieldValue;
-import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator;
+import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext;
+import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
+import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContextImpl;
+import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRowMapImpl;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
@@ -61,19 +59,55 @@ import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
*/
public class MetaModelVascBackend extends AbstractVascBackend {
+ private Logger logger = Logger.getLogger(MetaModelVascBackend.class.getName());
private MetaModelDataContextProvider dataContextProvider = null;
- private UpdateableDataContext dataContext = null;
+ private DataContext dataContext = null;
+ private CrudDataContext crudDataContext = null;
private String table = null;
private String tableId = null;
+ /**
+ * Returns casted version of data context.
+ */
+ private UpdateableDataContext getUpdateableDataContext() {
+ return (UpdateableDataContext)dataContext;
+ }
+
+ /**
+ * Returns true when data context in updateable.
+ */
+ private boolean isUpdateableDataContext() {
+ return dataContext instanceof UpdateableDataContext;
+ }
+
+ /**
+ * @see net.forwardfire.vasc.backend.AbstractVascBackend#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return isUpdateableDataContext()==false;
+ }
+
/**
* @see net.forwardfire.vasc.backend.AbstractVascBackend#startBackend()
*/
@Override
public void startBackend() {
- dataContext = (UpdateableDataContext)dataContextProvider.getDataContext();
+ if (table==null) {
+ throw new NullPointerException("Can't start with null table.");
+ }
+ if (table.isEmpty()) {
+ throw new NullPointerException("Can't start with empty table.");
+ }
+ long startTime = System.currentTimeMillis();
+ dataContext = dataContextProvider.getDataContext();
+ if (isUpdateableDataContext()) {
+ crudDataContext = new CrudDataContextImpl(getUpdateableDataContext());
+ }
+ long stopTime = System.currentTimeMillis();
+ logger.info(dataContext.getClass().getSimpleName()+" created for: "+table+" in: "+(stopTime-startTime)+" ms.");
}
-
+
/**
* @see net.forwardfire.vasc.backend.AbstractVascBackend#stopBackend()
*/
@@ -163,89 +197,68 @@ public class MetaModelVascBackend extends AbstractVascBackend {
public List