Clean demo directory layout
This commit is contained in:
parent
b3923bd2fb
commit
7c044adb1f
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -10,8 +10,8 @@
|
|||
*/*/*/*/target
|
||||
|
||||
# Inore some artifact dirs;
|
||||
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/auto
|
||||
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/tomcat.*
|
||||
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/deploy
|
||||
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/workdir
|
||||
|
||||
# Ignore leftovers of really failed release build
|
||||
release.properties
|
||||
|
|
19
todo.txt
19
todo.txt
|
@ -8,11 +8,24 @@
|
|||
- demo menu
|
||||
- demo wiki
|
||||
|
||||
- hotdeploy
|
||||
- null list option mongo query
|
||||
- sql conn limit
|
||||
- mongo backend limit
|
||||
|
||||
Build layout:
|
||||
lib/
|
||||
demo/
|
||||
deploy/
|
||||
config/
|
||||
workdir/
|
||||
logs/
|
||||
|
||||
|
||||
|
||||
- encodeing select model
|
||||
- lcoale select model
|
||||
- x4o template
|
||||
- swing readonly field editor
|
||||
- order by list and edit.
|
||||
- vasc AUTO ID
|
||||
- new NULL vs "" setting global+per entity
|
||||
|
@ -25,15 +38,13 @@
|
|||
- mongo missing field == string gives; VascBackendProxySort$1.compare(VascBackendProxySort.java:102)
|
||||
- make event channels work
|
||||
- auto text converts
|
||||
- Plugin validation
|
||||
- Plugin Role Parser
|
||||
- Finalizer plugins
|
||||
- Check user roles in frontend
|
||||
- Default/Full Table and templating
|
||||
- Ckeck all validators
|
||||
- Bind to x18n
|
||||
- MetaQuery support
|
||||
- create JSF-extJS frontend
|
||||
- create XML-RPC frontend
|
||||
- export interface + exports
|
||||
- graphs of numeric value columns
|
||||
- graphs of numeric value columns
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementClass tag="jdbcBackend" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="jdbcBackend" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcVascBackend"/>
|
||||
<eld:elementClass tag="jdbcConnectionProvider" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderImpl"/>
|
||||
<eld:elementClass tag="jdbcConnectionProviderJndi" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderJdniImpl"/>
|
||||
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<!--
|
||||
<eld:elementClass tag="ldapBackend" objectClassName="net.forwardfire.vasc.backend.ldap.LdapVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="ldapConnectionProvider" objectClassName="net.forwardfire.vasc.backend.ldap.LdapConnectionProviderImpl"/>
|
||||
-->
|
||||
|
||||
|
||||
<eld:elementClass tag="xpqlPersistanceBackend" objectClassName="net.forwardfire.vasc.backends.jpa.XpqlPersistanceVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
<eld:elementClassAttribute attributeName="resultClass">
|
||||
<eld:attributeClassConverter/>
|
||||
</eld:elementClassAttribute>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementClass tag="xpqlHibernateBackend" objectClassName="net.forwardfire.vasc.backends.jpa.XpqlHibernateVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
<eld:elementClassAttribute attributeName="resultClass">
|
||||
<eld:attributeClassConverter/>
|
||||
</eld:elementClassAttribute>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementClass tag="ldapBackend" objectClassName="net.forwardfire.vasc.backend.ldap.LdapVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
<eld:elementClass tag="ldapBackend" objectClassName="net.forwardfire.vasc.backend.ldap.LdapVascBackend"/>
|
||||
<eld:elementClass tag="ldapConnectionProvider" objectClassName="net.forwardfire.vasc.backend.ldap.LdapConnectionProviderImpl"/>
|
||||
|
||||
</eld:root>
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/*
|
||||
* 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;
|
||||
|
@ -7,6 +29,12 @@ import org.eobjects.metamodel.DataContext;
|
|||
import org.eobjects.metamodel.csv.CsvConfiguration;
|
||||
import org.eobjects.metamodel.csv.CsvDataContext;
|
||||
|
||||
/**
|
||||
* MetaModelDataContextCsv provides csv file/url backend.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2012
|
||||
*/
|
||||
public class MetaModelDataContextCsv implements MetaModelDataContextProvider {
|
||||
|
||||
private String file = null;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/*
|
||||
* 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.sql.Connection;
|
||||
|
@ -6,7 +28,12 @@ import java.sql.DriverManager;
|
|||
import org.eobjects.metamodel.DataContext;
|
||||
import org.eobjects.metamodel.jdbc.JdbcDataContext;
|
||||
|
||||
|
||||
/**
|
||||
* MetaModelDataContextJdbc provides basic jdbc connection for meta model data context.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2012
|
||||
*/
|
||||
public class MetaModelDataContextJdbc implements MetaModelDataContextProvider {
|
||||
|
||||
private String driverClass = null;
|
||||
|
@ -22,7 +49,13 @@ public class MetaModelDataContextJdbc implements MetaModelDataContextProvider {
|
|||
public Connection getConnection() {
|
||||
synchronized (this) {
|
||||
try {
|
||||
Class.forName(getDriverClass());
|
||||
if (getDriverClass()!=null) {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl==null) {
|
||||
cl = this.getClass().getClassLoader();
|
||||
}
|
||||
cl.loadClass(getDriverClass());
|
||||
}
|
||||
Connection connection = DriverManager.getConnection(getConnectUrl(),getUsername(),getPassword());
|
||||
return connection;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/*
|
||||
* 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.net.UnknownHostException;
|
||||
|
@ -10,6 +32,12 @@ import com.mongodb.Mongo;
|
|||
import com.mongodb.MongoOptions;
|
||||
import com.mongodb.ServerAddress;
|
||||
|
||||
/**
|
||||
* MetaModelDataContextMongodb provides basic mongo connection support for data context.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 2, 2012
|
||||
*/
|
||||
public class MetaModelDataContextMongodb implements MetaModelDataContextProvider {
|
||||
|
||||
private String hostname = "localhost";
|
||||
|
|
|
@ -25,7 +25,7 @@ package net.forwardfire.vasc.backend.metamodel;
|
|||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
/**
|
||||
* Provides an metamodel datacontext object to the metamodel backend.
|
||||
* MetaModelDataContextProvider provides an meta model data context object to the meta model back-end.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 25, 2012
|
||||
|
|
|
@ -1,4 +1,26 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui;
|
||||
/*
|
||||
* 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.util.logging.Logger;
|
||||
|
||||
|
@ -8,8 +30,6 @@ import org.eobjects.metamodel.schema.Relationship;
|
|||
import org.eobjects.metamodel.schema.Table;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
|
@ -23,28 +43,59 @@ import net.forwardfire.vasc.impl.DefaultVascFactory;
|
|||
import net.forwardfire.vasc.impl.DefaultVascLinkEntry;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
|
||||
public class VascAutoSchemaMetaModel {
|
||||
/**
|
||||
* MetaModelSchemaAutoEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 2, 2012
|
||||
*/
|
||||
public class MetaModelSchemaAutoEntry {
|
||||
|
||||
private Logger logger = null;
|
||||
private VascController vascController = null;
|
||||
private MetaModelDataContextProvider dataContextProvider = null;
|
||||
private String tableInclude = null;
|
||||
private String tableExclude = null;
|
||||
private String entryPrefix = null;
|
||||
|
||||
public VascAutoSchemaMetaModel(VascController vascController) {
|
||||
logger = Logger.getLogger(VascAutoSchemaMetaModel.class.getName());
|
||||
public MetaModelSchemaAutoEntry() {
|
||||
logger = Logger.getLogger(MetaModelSchemaAutoEntry.class.getName());
|
||||
}
|
||||
|
||||
public void autoCreateEntries(VascController vascController) {
|
||||
if (getDataContextProvider()==null) {
|
||||
throw new NullPointerException("Can't auto create entries with null dataContextProvider.");
|
||||
}
|
||||
if (getEntryPrefix()==null) {
|
||||
throw new NullPointerException("Can't auto create with null entryPrefix.");
|
||||
}
|
||||
this.vascController=vascController;
|
||||
|
||||
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.");
|
||||
continue;
|
||||
}
|
||||
if (getTableExclude()!=null && table.matches(getTableExclude())) {
|
||||
logger.fine("Excluding table: "+table+" from exclude rule.");
|
||||
continue;
|
||||
}
|
||||
createMetaEntry(ds,getEntryPrefix()+"_"+table,table);
|
||||
}
|
||||
}
|
||||
|
||||
private VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
public void createMetaEntry(MetaModelDataContextProvider ds,String id,String tableName) {
|
||||
private void createMetaEntry(DataContext ds,String id,String tableName) {
|
||||
logger.info("Creating entry id: "+id+" of table: "+tableName);
|
||||
DataContext metaDs = ds.getDataContext();
|
||||
Table metaTable = null;
|
||||
if (tableName==null) {
|
||||
metaTable = metaDs.getDefaultSchema().getTable(0);
|
||||
metaTable = ds.getDefaultSchema().getTable(0);
|
||||
} else {
|
||||
metaTable = metaDs.getDefaultSchema().getTableByName(tableName);
|
||||
metaTable = ds.getDefaultSchema().getTableByName(tableName);
|
||||
}
|
||||
Column[] keys = metaTable.getPrimaryKeys();
|
||||
Column[] cols = metaTable.getColumns();
|
||||
|
@ -54,7 +105,7 @@ public class VascAutoSchemaMetaModel {
|
|||
|
||||
MetaModelVascBackend backend = new MetaModelVascBackend();
|
||||
backend.setId(id+"_backend");
|
||||
backend.setDataContextProvider(ds);
|
||||
backend.setDataContextProvider(getDataContextProvider());
|
||||
backend.setTable(metaTable.getName());
|
||||
if (keys.length>0) {
|
||||
backend.setTableId(keys[0].getName());
|
||||
|
@ -73,10 +124,10 @@ public class VascAutoSchemaMetaModel {
|
|||
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());
|
||||
createLinkEntry(ds,rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
|
||||
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());
|
||||
createListEntry(ds,rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,10 +142,10 @@ public class VascAutoSchemaMetaModel {
|
|||
}
|
||||
}
|
||||
|
||||
private void createLinkEntry(MetaModelDataContextProvider ds,Relationship rs2,VascEntry ve,Table metaTable,String id) {
|
||||
private void createLinkEntry(Relationship rs2,VascEntry ve,Table metaTable,String id) {
|
||||
MetaModelVascBackend backendLink = new MetaModelVascBackend();
|
||||
backendLink.setId(id+"_backend");
|
||||
backendLink.setDataContextProvider(ds);
|
||||
backendLink.setDataContextProvider(getDataContextProvider());
|
||||
backendLink.setTable(rs2.getForeignTable().getName());
|
||||
|
||||
Column[] keys = rs2.getForeignTable().getPrimaryKeys();
|
||||
|
@ -118,10 +169,10 @@ public class VascAutoSchemaMetaModel {
|
|||
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
|
||||
if (rs2.getForeignTable().getName().equals(rs.getForeignTable().getName())==false) {
|
||||
//logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
|
||||
//createLinkEntry(ds,rs,ve,rs2.getForeignTable(),id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
|
||||
//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());
|
||||
createListEntry(ds,rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,10 +193,10 @@ public class VascAutoSchemaMetaModel {
|
|||
}
|
||||
}
|
||||
|
||||
private void createListEntry(MetaModelDataContextProvider ds,Relationship rs,VascEntry ve,Table metaTable,String id) {
|
||||
private void createListEntry(Relationship rs,VascEntry ve,Table metaTable,String id) {
|
||||
MetaModelVascBackend backendLink = new MetaModelVascBackend();
|
||||
backendLink.setId(id+"_backend");
|
||||
backendLink.setDataContextProvider(ds);
|
||||
backendLink.setDataContextProvider(getDataContextProvider());
|
||||
backendLink.setTable(rs.getPrimaryTable().getName());
|
||||
|
||||
Column[] keys = rs.getPrimaryTable().getPrimaryKeys();
|
||||
|
@ -187,8 +238,25 @@ public class VascAutoSchemaMetaModel {
|
|||
for (Column c:cols) {
|
||||
VascEntryField vef = new DefaultVascEntryField(c.getName());
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass()));
|
||||
if (c.getName().toLowerCase().contains("desc") || c.getName().toLowerCase().contains("text")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextAreaField"));
|
||||
|
||||
if (vef.getId().equals(ve.getPrimaryKeyFieldId())) {
|
||||
vef.setEditReadOnly(true);
|
||||
// vef.setCreate(false); mmm
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()==null || "TextField".equals(vef.getVascEntryFieldType().getId())) {
|
||||
if (c.getName().toLowerCase().contains("desc") || c.getName().toLowerCase().contains("text")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextAreaField"));
|
||||
}
|
||||
if (c.getName().toLowerCase().contains("active")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("BooleanField"));
|
||||
} /* todo
|
||||
if (c.getName().toLowerCase().contains("email")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("EmailField"));
|
||||
}
|
||||
if (c.getName().toLowerCase().contains("url")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("URLField"));
|
||||
} */
|
||||
}
|
||||
ve.addVascEntryField(vef);
|
||||
if (ve.getDisplayNameFieldId()==null && c.getName().equals(ve.getPrimaryKeyFieldId())==false && c.getType().getJavaEquivalentClass()==String.class) {
|
||||
|
@ -196,4 +264,60 @@ public class VascAutoSchemaMetaModel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataContextProvider
|
||||
*/
|
||||
public MetaModelDataContextProvider getDataContextProvider() {
|
||||
return dataContextProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataContextProvider the dataContextProvider to set
|
||||
*/
|
||||
public void setDataContextProvider(MetaModelDataContextProvider dataContextProvider) {
|
||||
this.dataContextProvider = dataContextProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tableInclude
|
||||
*/
|
||||
public String getTableInclude() {
|
||||
return tableInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableInclude the tableInclude to set
|
||||
*/
|
||||
public void setTableInclude(String tableInclude) {
|
||||
this.tableInclude = tableInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tableExclude
|
||||
*/
|
||||
public String getTableExclude() {
|
||||
return tableExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableExclude the tableExclude to set
|
||||
*/
|
||||
public void setTableExclude(String tableExclude) {
|
||||
this.tableExclude = tableExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryPrefix
|
||||
*/
|
||||
public String getEntryPrefix() {
|
||||
return entryPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryPrefix the entryPrefix to set
|
||||
*/
|
||||
public void setEntryPrefix(String entryPrefix) {
|
||||
this.entryPrefix = entryPrefix;
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
|||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
|
||||
/**
|
||||
* Provides backend for metamodel.
|
||||
* MetaModelVascBackend provides vasc backend for metamodel.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 31, 2011
|
||||
|
@ -65,15 +65,23 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
private UpdateableDataContext dataContext = null;
|
||||
private String table = null;
|
||||
private String tableId = null;
|
||||
|
||||
private UpdateableDataContext getUpdateableDataContext() {
|
||||
if (dataContext!=null) {
|
||||
return dataContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#startBackend()
|
||||
*/
|
||||
@Override
|
||||
public void startBackend() {
|
||||
dataContext = (UpdateableDataContext)dataContextProvider.getDataContext();
|
||||
return dataContext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#stopBackend()
|
||||
*/
|
||||
@Override
|
||||
public void stopBackend() {
|
||||
dataContext = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#isPageable()
|
||||
*/
|
||||
|
@ -87,7 +95,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
UpdateableDataContext dataContext = getUpdateableDataContext();
|
||||
Schema schema = dataContext.getDefaultSchema();
|
||||
Table t = schema.getTableByName(table);
|
||||
Query q = createFilterQuery(state,t,true);
|
||||
|
@ -105,9 +112,9 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
private Query createFilterQuery(VascBackendState state,Table t,boolean count) {
|
||||
Object qWhere = null;
|
||||
if (count==false) {
|
||||
qWhere = getUpdateableDataContext().query().from(t).select(t.getColumns());
|
||||
qWhere = dataContext.query().from(t).select(t.getColumns());
|
||||
} else {
|
||||
qWhere = getUpdateableDataContext().query().from(t).selectCount();
|
||||
qWhere = dataContext.query().from(t).selectCount();
|
||||
}
|
||||
Iterator<String> keys = state.getDataParameterKeys().iterator();
|
||||
boolean first = true;
|
||||
|
@ -154,7 +161,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
UpdateableDataContext dataContext = getUpdateableDataContext();
|
||||
Schema schema = dataContext.getDefaultSchema();
|
||||
Table t = schema.getTableByName(table);
|
||||
Query q = createFilterQuery(state,t,false);
|
||||
|
@ -182,7 +188,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void persist(Object object) throws VascException {
|
||||
final Map<String,Object> map = (Map<String,Object>)object;
|
||||
UpdateableDataContext dataContext = getUpdateableDataContext();
|
||||
dataContext.executeUpdate(new UpdateScript() {
|
||||
public void run(UpdateCallback backendImpl) {
|
||||
RowInsertionBuilder query = backendImpl.insertInto(table);
|
||||
|
@ -193,12 +198,12 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
query.execute();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object merge(Object object) throws VascException {
|
||||
final Map<String,Object> map = (Map<String,Object>)object;
|
||||
UpdateableDataContext dataContext = getUpdateableDataContext();
|
||||
dataContext.executeUpdate(new UpdateScript() {
|
||||
public void run(UpdateCallback backendImpl) {
|
||||
|
||||
|
@ -224,7 +229,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void delete(Object object) throws VascException {
|
||||
final Map<String,Object> map = (Map<String,Object>)object;
|
||||
UpdateableDataContext dataContext = getUpdateableDataContext();
|
||||
dataContext.executeUpdate(new UpdateScript() {
|
||||
public void run(UpdateCallback backendImpl) {
|
||||
if (map.get(tableId) instanceof Number) {
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.x4o;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementConfigurator;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
/**
|
||||
* SchemaAutoEntryElementConfigurator runs the autoCreateEntries method the MetaModelSchemaAutoEntry bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class SchemaAutoEntryElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementConfigurator#doConfigEndTag(org.x4o.xml.element.Element)
|
||||
*/
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
|
||||
if (element.getElementObject()==null) {
|
||||
throw new ElementConfiguratorException(this,"ElementObject is null");
|
||||
}
|
||||
if ((element.getElementObject() instanceof MetaModelSchemaAutoEntry)==false) {
|
||||
throw new ElementConfiguratorException(this,"ElementObject is not MetaModelSchemaAutoEntry object.");
|
||||
}
|
||||
MetaModelSchemaAutoEntry autoEntry = (MetaModelSchemaAutoEntry)element.getElementObject();
|
||||
VascController vascController = VascParser.getVascController(element.getElementContext());
|
||||
autoEntry.autoCreateEntries(vascController);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
<eld:elementClass tag="metaModelBackend" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementClass tag="metaModelBackend" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend"/>
|
||||
<eld:elementClass tag="mongodbDataContext" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb"/>
|
||||
<eld:elementClass tag="csvDataContext" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv"/>
|
||||
<eld:elementClass tag="jdbcDataContext" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc"/>
|
||||
<eld:elementClass tag="csvDataContext" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv"/>
|
||||
<eld:elementClass tag="schemaAutoEntry" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.backend.metamodel.x4o.SchemaAutoEntryElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
|
||||
</eld:root>
|
||||
|
|
|
@ -44,7 +44,7 @@ import com.mongodb.WriteConcern;
|
|||
import com.mongodb.WriteResult;
|
||||
|
||||
/**
|
||||
* Provides backend for mongodb.
|
||||
* MongodbVascBackend Provides backend for mongodb.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 30, 2011
|
||||
|
@ -60,6 +60,25 @@ public class MongodbVascBackend extends AbstractVascBackend {
|
|||
logger = Logger.getLogger(MongodbVascBackend.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#startBackend()
|
||||
*/
|
||||
@Override
|
||||
public void startBackend() {
|
||||
if (connectionProvider==null) {
|
||||
throw new NullPointerException("Can't start backend with null connectionProvider.");
|
||||
}
|
||||
database = connectionProvider.getMongodbConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#stopBackend()
|
||||
*/
|
||||
@Override
|
||||
public void stopBackend() {
|
||||
database = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#isPageable()
|
||||
*/
|
||||
|
@ -136,15 +155,6 @@ public class MongodbVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
|
||||
private DBCollection getDBCollection() {
|
||||
if (database!=null) {
|
||||
return database.getCollection(collection);
|
||||
}
|
||||
if (connectionProvider==null) {
|
||||
throw new RuntimeException("Can't get DBCollection from null connectionProvider.");
|
||||
}
|
||||
synchronized (connectionProvider) {
|
||||
database = connectionProvider.getMongodbConnection();
|
||||
}
|
||||
return database.getCollection(collection);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,15 +41,12 @@ public class MongodbVascEntryFieldValue implements VascEntryFieldValue {
|
|||
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
BasicDBObject row = (BasicDBObject)record;
|
||||
Object r = row.get(field.getBackendName());
|
||||
if (r==null) {
|
||||
return ""; // create new value, TODO
|
||||
}
|
||||
return r;
|
||||
Object data = row.get(field.getBackendName());
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
return ""+getValue(field,record); // not supported TODO
|
||||
return ""+getValue(field,record);
|
||||
}
|
||||
|
||||
public void setValue(VascEntryField field, Object record, Object value) throws VascException {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
<eld:elementClass tag="mongodbBackend" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbVascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="mongodbBackend" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbVascBackend"/>
|
||||
<eld:elementClass tag="mongodbConnectionProvider" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbConnectionProviderImpl"/>
|
||||
</eld:root>
|
||||
|
|
|
@ -53,6 +53,18 @@ abstract public class AbstractVascBackend implements VascBackend {
|
|||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#startBackend()
|
||||
*/
|
||||
public void startBackend() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#stopBackend()
|
||||
*/
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,10 @@ public interface VascBackend {
|
|||
|
||||
public String getId();
|
||||
public void setId(String id);
|
||||
|
||||
|
||||
public void startBackend();
|
||||
public void stopBackend();
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException;
|
||||
|
||||
public boolean isReadOnly();
|
||||
|
|
|
@ -31,4 +31,8 @@ package net.forwardfire.vasc.backend;
|
|||
public interface VascBackendControllerLocal extends VascBackendController {
|
||||
|
||||
public void addVascBackend(VascBackend backend);
|
||||
|
||||
public void removeVascBackendById(String backendId);
|
||||
|
||||
public void clearAndStopBackends();
|
||||
}
|
|
@ -68,6 +68,20 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#startBackend()
|
||||
*/
|
||||
public void startBackend() {
|
||||
backend.startBackend();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#stopBackend()
|
||||
*/
|
||||
public void stopBackend() {
|
||||
backend.stopBackend();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
|
||||
*/
|
||||
|
|
|
@ -46,6 +46,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
private int pageSizeMax = 0;
|
||||
private String sortField = null;
|
||||
private boolean sortDir = true;
|
||||
private boolean requestFlush = false;
|
||||
|
||||
public VascBackendProxyCache() {
|
||||
dataState = new HashMap<String,Object>(10);
|
||||
|
@ -105,9 +106,26 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
changed = true;
|
||||
}
|
||||
searchString = state.getSearchString();
|
||||
|
||||
if (requestFlush) {
|
||||
requestFlush = false;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#stopBackend()
|
||||
*/
|
||||
@Override
|
||||
public void stopBackend() {
|
||||
super.stopBackend();
|
||||
data.clear();
|
||||
dataState.clear();
|
||||
requestFlush = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
|
@ -128,4 +146,31 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
super.delete(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
return super.merge(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
super.persist(object);
|
||||
}
|
||||
}
|
|
@ -38,6 +38,8 @@ public interface VascFrontendActions {
|
|||
|
||||
public void deleteObject();
|
||||
|
||||
public void persistObject();
|
||||
|
||||
public Object mergeObject();
|
||||
|
||||
public void sortAction(VascEntryField field);
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* DefaultVascBackendController stores the vasc backends.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
|
@ -54,18 +54,8 @@ public class DefaultVascBackendController implements VascBackendControllerLocal
|
|||
}
|
||||
|
||||
/**
|
||||
* Local
|
||||
* @see net.forwardfire.vasc.backend.VascBackendController#getVascBackendIds()
|
||||
*/
|
||||
public void addVascBackend(VascBackend backend) {
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("backend must not be null.");
|
||||
}
|
||||
if (backend.getId()==null) {
|
||||
throw new IllegalArgumentException("The backend must have an id.");
|
||||
}
|
||||
backends.put(backend.getId(), backend);
|
||||
}
|
||||
|
||||
public List<String> getVascBackendIds() {
|
||||
List<String> result = new ArrayList<String>(50);
|
||||
for (String id:backends.keySet()) {
|
||||
|
@ -74,5 +64,39 @@ public class DefaultVascBackendController implements VascBackendControllerLocal
|
|||
Collections.sort(result); // lets do abc for consistance behauvior.
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#addVascBackend(net.forwardfire.vasc.backend.VascBackend)
|
||||
*/
|
||||
public void addVascBackend(VascBackend backend) {
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("backend must not be null.");
|
||||
}
|
||||
if (backend.getId()==null) {
|
||||
throw new IllegalArgumentException("The backend must have an id.");
|
||||
}
|
||||
backend.startBackend();
|
||||
backends.put(backend.getId(), backend);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#removeVascBackendById(java.lang.String)
|
||||
*/
|
||||
public void removeVascBackendById(String backendId) {
|
||||
VascBackend backend = getVascBackendById(backendId);
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("Could not find backend to remove with id: "+backendId);
|
||||
}
|
||||
backend.stopBackend();
|
||||
backends.remove(backendId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#clearAndStopBackends()
|
||||
*/
|
||||
public void clearAndStopBackends() {
|
||||
for (String backendId:getVascBackendIds()) {
|
||||
removeVascBackendById(backendId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -120,17 +120,32 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#mergeObject(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#persistObject()
|
||||
*/
|
||||
public void persistObject() {
|
||||
saveObject(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#mergeObject()
|
||||
*/
|
||||
public Object mergeObject() {
|
||||
return saveObject(false);
|
||||
}
|
||||
|
||||
protected Object saveObject(boolean persist) {
|
||||
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
Object result = null;
|
||||
try {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
|
||||
int index = removeObjectFromDataList(object);
|
||||
|
||||
// merge object on backend
|
||||
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
|
||||
// save object on backend
|
||||
if (persist) {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().persist(object);
|
||||
} else {
|
||||
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
|
||||
}
|
||||
|
||||
// put object thrue the filters
|
||||
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
|
||||
|
@ -148,7 +163,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes the selected row object from the list and fires event.
|
||||
* Deletes the selected row object from the back-end and list and fires events.
|
||||
* @param entry
|
||||
* @param object
|
||||
*/
|
||||
|
|
|
@ -4,19 +4,22 @@
|
|||
<eld:elementClass tag="root" objectClassName="java.lang.Object">
|
||||
<eld:elementDescription>Fake root tag</eld:elementDescription>
|
||||
</eld:elementClass>
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.VascEntryFieldSet" method="addVascEntryFieldSet"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.VascLinkEntry" method="addVascLinkEntry"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.backend.VascBackendFilter" method="addVascBackendFilter"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.GlobalVascAction" method="addGlobalAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.RowVascAction" method="addRowAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.ColumnVascAction" method="addColumnAction"/>
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntryField" childClass="net.forwardfire.vasc.validators.VascValidator" method="addVascValidator"/>
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntryField" childClass="net.forwardfire.vasc.validators.VascValidator" method="addVascValidator"/>
|
||||
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.impl.x4o.SelectItemModelBindingHandler"/>
|
||||
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.impl.x4o.VascEntryFieldBindingHandler"/>
|
||||
|
||||
<eld:elementInterface interfaceClass="net.forwardfire.vasc.backend.VascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementInterface>
|
||||
|
||||
|
||||
<!-- Object for building an entry -->
|
||||
<eld:elementClass tag="entry" objectClassName="net.forwardfire.vasc.impl.DefaultVascEntry" >
|
||||
|
|
|
@ -26,10 +26,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<!-- Save some build time/space as these are about 30MB each.
|
||||
<format>tar.gz</format>
|
||||
<format>tar.bz2</format>
|
||||
-->
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
@ -40,11 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
<!--
|
||||
<includes>
|
||||
<include>*</include>
|
||||
</includes>
|
||||
-->
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
|
@ -62,17 +53,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<outputDirectory>/</outputDirectory>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/files/</directory>
|
||||
<outputDirectory>/auto</outputDirectory>
|
||||
<includes>
|
||||
<include>auto-readme.txt</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/demo/</directory>
|
||||
<outputDirectory>/demo</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/files/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
|
@ -80,5 +60,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<include>readme.txt</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/directory/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1,4 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
|
|
@ -0,0 +1 @@
|
|||
All *.xml in this dir are automaticly started.
|
|
@ -32,7 +32,7 @@ set MAIN_CLASS=net.forwardfire.vasc.demo.tech.ui.TechUI
|
|||
set CP=lib\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS% -gui
|
||||
|
||||
endlocal
|
||||
:: EOF
|
||||
|
|
|
@ -32,7 +32,7 @@ MAIN_CLASS="net.forwardfire.vasc.demo.tech.ui.TechUI";
|
|||
CP=`echo lib/*.jar | sed 's/ /:/g'`;
|
||||
|
||||
# Launch application
|
||||
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS;
|
||||
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS -gui;
|
||||
|
||||
# EOF
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntryConfigController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
|
@ -82,6 +83,12 @@ public class DemoVascManager {
|
|||
}
|
||||
|
||||
public void stop() {
|
||||
if (vascController==null) {
|
||||
return;
|
||||
}
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
|
||||
backends.clearAndStopBackends();
|
||||
|
||||
vascController = null;
|
||||
logger.info("Stop manager, cleared all.");
|
||||
}
|
||||
|
@ -103,8 +110,8 @@ public class DemoVascManager {
|
|||
logger.info("Vasc open file: "+file.getAbsoluteFile());
|
||||
try {
|
||||
VascParser parser = new VascParser(vascController);
|
||||
File f = File.createTempFile("test-vasc", ".xml");
|
||||
parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
//File f = File.createTempFile("test-vasc", ".xml");
|
||||
//parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
parser.parseFile(file);
|
||||
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld"
|
||||
>
|
||||
<v:virtualVascBackend id="vascEntryBackend" vascController="${vascController}" vascType="entry"/>
|
||||
<v:entry id="vascEntry" backendId="vascEntryBackend">
|
||||
<v:virtualVascBackend id="VascEntryBackend" vascController="${vascController}" vascType="entry"/>
|
||||
<v:entry id="VascEntry" backendId="VascEntryBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="backendId"/>
|
||||
<v:field id="name"/>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,19 +31,11 @@
|
|||
<artifactId>vasc-demo-tech-editor</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
package net.forwardfire.vasc.demo.tech.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
|
||||
public class DeployManager {
|
||||
|
||||
private Logger logger = null;
|
||||
private File deployDir = null;
|
||||
private int scanPeriod = 3;
|
||||
private AutoDeployManager autoDeployManager = null;
|
||||
private Map<File,String> fileCheckSums = null;
|
||||
|
||||
public DeployManager() {
|
||||
logger = Logger.getLogger(DeployManager.class.getName());
|
||||
fileCheckSums = new HashMap<File,String>(20);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (deployDir==null) {
|
||||
throw new NullPointerException("Can't deploy with null deployDir.");
|
||||
}
|
||||
if (deployDir.exists()==false) {
|
||||
throw new IllegalStateException("Can't deploy with non-existing deployDir.");
|
||||
}
|
||||
if (deployDir.isDirectory()==false) {
|
||||
throw new IllegalStateException("Can't deploy with non-directory deployDir.");
|
||||
}
|
||||
Thread scanThread = new Thread(new AutoDeployManager());
|
||||
scanThread.setName("hotdeploy-scanner");
|
||||
scanThread.start();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (autoDeployManager==null) {
|
||||
return;
|
||||
}
|
||||
autoDeployManager.stop();
|
||||
}
|
||||
|
||||
|
||||
public String createMd5Sum(File file) throws IOException, NoSuchAlgorithmException {
|
||||
FileInputStream in = new FileInputStream(file.getAbsolutePath());
|
||||
try {
|
||||
byte[] b = new byte[1024 * 64];
|
||||
int num = 0;
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
while ((num = in.read(b)) != -1) {
|
||||
md.update(b, 0, num);
|
||||
}
|
||||
byte[] hashBytes = md.digest();
|
||||
BigInteger hashResult = new BigInteger(hashBytes);
|
||||
String hashString = hashResult.toString(16);
|
||||
return hashString;
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void hotDeployVasc() throws NoSuchAlgorithmException, IOException {
|
||||
boolean deployed = false;
|
||||
for (File file:deployDir.listFiles()) {
|
||||
if (file.canRead()==false) {
|
||||
continue;
|
||||
}
|
||||
if (file.getName().endsWith("xml")==false) {
|
||||
continue;
|
||||
}
|
||||
String md5File = createMd5Sum(file);
|
||||
String md5Deploy = fileCheckSums.get(file);
|
||||
if (md5Deploy!=null && md5Deploy.equals(md5File)) {
|
||||
continue;
|
||||
}
|
||||
fileCheckSums.put(file, md5File);
|
||||
deployed = true;
|
||||
TechUI.getInstance().getVascManager().openFile(file);
|
||||
}
|
||||
if (deployed) {
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
}
|
||||
|
||||
protected class AutoDeployManager implements Runnable {
|
||||
private volatile boolean run = true;
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(5000); // let gui+tomcat start
|
||||
logger.info("AutoDeployManager started");
|
||||
while(run) {
|
||||
try {
|
||||
hotDeployVasc();
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error while depoying: "+e.getMessage(),e);
|
||||
}
|
||||
|
||||
if (scanPeriod == 0) {
|
||||
scanPeriod = 1;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000*scanPeriod);
|
||||
} catch (InterruptedException ie) {
|
||||
logger.info("Interrupted sleep");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE,"Error in run: "+e.getMessage(),e);
|
||||
} finally {
|
||||
logger.info("AutoDeployManager stoped");
|
||||
}
|
||||
}
|
||||
public void stop() {
|
||||
run = false;
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deployDir
|
||||
*/
|
||||
public File getDeployDir() {
|
||||
return deployDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deployDir the deployDir to set
|
||||
*/
|
||||
public void setDeployDir(File deployDir) {
|
||||
this.deployDir = deployDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanPeriod
|
||||
*/
|
||||
public int getScanPeriod() {
|
||||
return scanPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scanPeriod the scanPeriod to set
|
||||
*/
|
||||
public void setScanPeriod(int scanPeriod) {
|
||||
this.scanPeriod = scanPeriod;
|
||||
}
|
||||
}
|
|
@ -29,7 +29,10 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
@ -49,8 +52,10 @@ import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
|
|||
public class TechUI extends SingleFrameApplication {
|
||||
|
||||
private Logger logger = null;
|
||||
private boolean showGui = false;
|
||||
private DemoVascManager vascManager = null;
|
||||
private TomcatManager tomcatManager = null;
|
||||
private DeployManager deployManager = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
Application.launch(TechUI.class, args);
|
||||
|
@ -99,6 +104,7 @@ public class TechUI extends SingleFrameApplication {
|
|||
public void willExit(EventObject event) {
|
||||
logger.info("Shutdown requested.");
|
||||
long startTime = System.currentTimeMillis();
|
||||
deployManager.stop();
|
||||
try {
|
||||
tomcatManager.stop();
|
||||
} catch (Exception e) {
|
||||
|
@ -110,32 +116,83 @@ public class TechUI extends SingleFrameApplication {
|
|||
}
|
||||
}
|
||||
|
||||
private void autoLoadVasc() {
|
||||
File autoLoadDir = new File("auto");
|
||||
if (autoLoadDir.exists()==false) {
|
||||
return;
|
||||
}
|
||||
for (File file:autoLoadDir.listFiles()) {
|
||||
if (file.canRead()==false) {
|
||||
continue;
|
||||
}
|
||||
if (file.getName().endsWith("xml")==false) {
|
||||
continue;
|
||||
}
|
||||
vascManager.openFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void initialize(String[] args) {
|
||||
protected void initialize(String[] argu) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// First parse user program arguments.
|
||||
String serverHost = null;
|
||||
String serverPort = null;
|
||||
List<String> arguList = new ArrayList<String>(argu.length);
|
||||
for (String a:argu) {
|
||||
arguList.add(a);
|
||||
}
|
||||
Iterator<String> arguIterator = arguList.iterator();
|
||||
while (arguIterator.hasNext()) {
|
||||
String arg = arguIterator.next();
|
||||
if ("-v".equals(arg)) {
|
||||
System.out.println();
|
||||
System.out.println("Optional:");
|
||||
System.out.println(" -host <ip> Sets the http hostname.");
|
||||
System.out.println(" -port <port> Sets the http port.");
|
||||
System.out.println(" -gui Sets gui mode.");
|
||||
System.out.println(" -h Print help. (this)");
|
||||
System.out.println();
|
||||
System.exit(1);
|
||||
}
|
||||
if ("-gui".equals(arg)) {
|
||||
showGui = true;
|
||||
}
|
||||
if ("-port".equals(arg)) {
|
||||
if (arguIterator.hasNext()==false) {
|
||||
System.out.println("No argument for -port given.");
|
||||
return;
|
||||
}
|
||||
serverPort = arguIterator.next();
|
||||
System.exit(1);
|
||||
}
|
||||
if ("-host".equals(arg)) {
|
||||
if (arguIterator.hasNext()==false) {
|
||||
System.out.println("No argument for -host given.");
|
||||
return;
|
||||
}
|
||||
serverHost = arguIterator.next();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
setupLogging();
|
||||
logger.info("Starting Vasc-Demo-Tech-UI.");
|
||||
|
||||
File deployDir = new File("deploy");
|
||||
File workDir = new File("workdir");
|
||||
if (isMavenRun()) {
|
||||
if (deployDir.exists()==false) {
|
||||
deployDir.mkdir();
|
||||
}
|
||||
if (workDir.exists()==false) {
|
||||
workDir.mkdir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vascManager = new DemoVascManager();
|
||||
vascManager.start();
|
||||
autoLoadVasc();
|
||||
|
||||
deployManager = new DeployManager();
|
||||
deployManager.setDeployDir(deployDir);
|
||||
deployManager.start();
|
||||
|
||||
tomcatManager = new TomcatManager();
|
||||
tomcatManager.setWorkDir(workDir);
|
||||
tomcatManager.setVascController(vascManager.getVascController());
|
||||
if (serverHost!=null) {
|
||||
tomcatManager.setHostname(serverHost);
|
||||
}
|
||||
if (serverPort!=null) {
|
||||
tomcatManager.setPort(new Integer(serverPort));
|
||||
}
|
||||
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -158,11 +215,24 @@ public class TechUI extends SingleFrameApplication {
|
|||
long startTime = System.currentTimeMillis();
|
||||
addExitListener(new ShutdownManager());
|
||||
|
||||
FrameView mainView = getMainView();
|
||||
mainView.setComponent(new JMainPanel());
|
||||
mainView.setMenuBar(new JMainPanelMenuBar());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
|
||||
show(mainView);
|
||||
if (showGui) {
|
||||
FrameView mainView = getMainView();
|
||||
mainView.setComponent(new JMainPanel());
|
||||
mainView.setMenuBar(new JMainPanelMenuBar());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
|
||||
show(mainView);
|
||||
} else {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
while(true)
|
||||
try {
|
||||
Thread.sleep(3333);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("TechUI startup in "+(stopTime-startTime)+" ms total startup in "+(stopTime-startTime)+" ms.");
|
||||
|
@ -188,4 +258,8 @@ public class TechUI extends SingleFrameApplication {
|
|||
public VascController getVascController() {
|
||||
return vascManager.getVascController();
|
||||
}
|
||||
|
||||
public boolean isMavenRun() {
|
||||
return System.getProperty("java.class.path").contains("classes");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,19 +17,24 @@ public class TomcatManager {
|
|||
private Logger logger = null;
|
||||
private Tomcat tomcat = null;
|
||||
private VascController vascController = null;
|
||||
private String hostname = null;
|
||||
private Integer port = null;
|
||||
private File workDir = null;
|
||||
|
||||
public TomcatManager() {
|
||||
logger = Logger.getLogger(TomcatManager.class.getName());
|
||||
hostname = "localhost";
|
||||
port = 8899;
|
||||
}
|
||||
|
||||
public void start() throws Exception {
|
||||
Tomcat tomcat = new Tomcat();
|
||||
|
||||
String webPort = System.getenv("PORT");
|
||||
if(webPort == null || webPort.isEmpty()) {
|
||||
webPort = "8899";
|
||||
if (workDir==null) {
|
||||
throw new NullPointerException("Can't start tomcat with null workDir.");
|
||||
}
|
||||
tomcat.setPort(Integer.valueOf(webPort));
|
||||
Tomcat tomcat = new Tomcat();
|
||||
tomcat.setBaseDir(workDir.getAbsolutePath());
|
||||
tomcat.setPort(getPort());
|
||||
tomcat.setHostname(getHostname());
|
||||
|
||||
if (System.getProperty("java.class.path").contains("classes")) {
|
||||
String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/";
|
||||
|
@ -40,7 +45,7 @@ public class TomcatManager {
|
|||
|
||||
File techWarFile = null;
|
||||
for (File file:new File("lib").listFiles()) {
|
||||
if (file.getName().endsWith("war")) {
|
||||
if (file.getName().contains("vasc-demo-tech-web")) {
|
||||
techWarFile = file;
|
||||
break;
|
||||
}
|
||||
|
@ -48,7 +53,7 @@ public class TomcatManager {
|
|||
if (techWarFile==null) {
|
||||
throw new NullPointerException("Could not locate war file in lib directory.");
|
||||
}
|
||||
File destDir = new File("tomcat.wars"+File.separator+techWarFile.getName());
|
||||
File destDir = new File(workDir,"tomcat.wars"+File.separator+techWarFile.getName());
|
||||
if (destDir.exists()==false) {
|
||||
destDir.mkdirs();
|
||||
JarFile jar = new JarFile(techWarFile);
|
||||
|
@ -72,10 +77,7 @@ public class TomcatManager {
|
|||
String deployPath = destDir.getAbsolutePath();
|
||||
logger.info("Deploy war path: "+deployPath);
|
||||
tomcat.addWebapp("/demo",deployPath);
|
||||
}
|
||||
|
||||
instance = this;
|
||||
|
||||
}
|
||||
tomcat.start();
|
||||
}
|
||||
|
||||
|
@ -84,12 +86,6 @@ public class TomcatManager {
|
|||
return;
|
||||
}
|
||||
tomcat.stop();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
static private TomcatManager instance = null;
|
||||
static public TomcatManager getInstance() {
|
||||
return instance; // hackje to rm mvn 1-1 dep with ui
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,4 +101,46 @@ public class TomcatManager {
|
|||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hostname
|
||||
*/
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hostname the hostname to set
|
||||
*/
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port
|
||||
*/
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param port the port to set
|
||||
*/
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the workDir
|
||||
*/
|
||||
public File getWorkDir() {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workDir the workDir to set
|
||||
*/
|
||||
public void setWorkDir(File workDir) {
|
||||
this.workDir = workDir;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
|
||||
public class JDialogMetaCsv extends JDialog implements ActionListener {
|
||||
|
@ -64,8 +64,11 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
|
|||
File file = fc.getSelectedFile();
|
||||
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
|
||||
ds.setFile(file.getAbsolutePath());
|
||||
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
|
||||
schema.createMetaEntry(ds,file.getName(),null);
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(file.getName());
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,11 @@ import javax.swing.JTextField;
|
|||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
|
@ -89,12 +87,11 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
ds.setConnectUrl(url);
|
||||
ds.setUsername(usernameField.getText());
|
||||
ds.setPassword(passwordField.getText());
|
||||
DataContext metaDs = ds.getDataContext();
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
|
||||
for (String table:metaDs.getDefaultSchema().getTableNames()) {
|
||||
schema.createMetaEntry(ds,dbName+"_"+table,table);
|
||||
}
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(dbName);
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,8 +17,8 @@ import javax.swing.JTextField;
|
|||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
|
||||
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
|
||||
|
||||
|
@ -79,11 +79,11 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
ds.setHostname(hostNameField.getText());
|
||||
ds.setPort(new Integer(hostPortField.getText()));
|
||||
ds.setDatabase(databaseField.getText());
|
||||
DataContext metaDs = ds.getDataContext();
|
||||
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
|
||||
for (String table:metaDs.getDefaultSchema().getTableNames()) {
|
||||
schema.createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
|
||||
}
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(ds.getDatabase());
|
||||
schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -58,7 +58,6 @@ import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
|||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
public class JMainPanel extends JPanel {
|
||||
|
@ -291,15 +290,14 @@ public class JMainPanel extends JPanel {
|
|||
}
|
||||
File resourceFile = new File("auto/data/vasc-bundle.properties");
|
||||
if (resourceFile.exists()) {
|
||||
readPropertiesFile(p,resourceFile);
|
||||
readPropertiesFile(p,resourceFile);
|
||||
}
|
||||
for (String key:keys.keySet()) {
|
||||
p.put(key, keys.get(key));
|
||||
}
|
||||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
new RootApplicationBundle_en().reload();
|
||||
RootApplicationBundle_en.clearCache();
|
||||
ResourceBundle.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import javax.swing.JMenuBar;
|
|||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.demo.tech.ui.TechUI;
|
||||
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaCsv;
|
||||
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaJdbc;
|
||||
|
@ -17,14 +19,15 @@ import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaMongodb;
|
|||
|
||||
public class JMainPanelMenuBar extends JMenuBar {
|
||||
|
||||
private static final long serialVersionUID = -2828428804621352725L;
|
||||
JMenu fileMenu = new JMenu("File");
|
||||
JMenu connMenu = new JMenu("Connection");
|
||||
JMenu vascMenu = new JMenu("Vasc");
|
||||
JMenu tabMenu = new JMenu("Tabs");
|
||||
|
||||
public JMainPanelMenuBar() {
|
||||
createMenuItems();
|
||||
add(fileMenu);
|
||||
add(connMenu);
|
||||
add(vascMenu);
|
||||
add(tabMenu);
|
||||
}
|
||||
|
||||
|
@ -61,17 +64,18 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
fileMenu.add(exitItem);
|
||||
|
||||
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
|
||||
connectVascItem.setEnabled(false);
|
||||
connectVascItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
connMenu.add(connectVascItem);
|
||||
vascMenu.add(connectVascItem);
|
||||
|
||||
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
|
||||
connectLdapItem.setEnabled(false);
|
||||
connMenu.add(connectLdapItem);
|
||||
connMenu.addSeparator();
|
||||
vascMenu.add(connectLdapItem);
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
|
||||
connectMetaCsvItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -79,9 +83,10 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
connMenu.add(connectMetaCsvItem);
|
||||
vascMenu.add(connectMetaCsvItem);
|
||||
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
|
||||
connMenu.add(connectMetaXmlItem);
|
||||
connectMetaXmlItem.setEnabled(false);
|
||||
vascMenu.add(connectMetaXmlItem);
|
||||
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
|
||||
connectMetaMongoItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -89,7 +94,7 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
connMenu.add(connectMetaMongoItem);
|
||||
vascMenu.add(connectMetaMongoItem);
|
||||
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
|
||||
connectMetaJdbcItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -97,27 +102,39 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
connMenu.add(connectMetaJdbcItem);
|
||||
vascMenu.add(connectMetaJdbcItem);
|
||||
|
||||
/*
|
||||
for (final String id:ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
JMenuItem item = new JMenuItem(id);
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
VascEntry ee = ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id).clone();
|
||||
DefaultVascFactory.fillVascEntryFrontend(ee, ve.getVascFrontendData().getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
|
||||
spi.createNewVascView(ee);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
|
||||
removeEntryItem.setEnabled(false);
|
||||
removeEntryItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeEntryItem);
|
||||
|
||||
JMenuItem removeAllItem = new JMenuItem("Remove all");
|
||||
removeAllItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)TechUI.getInstance().getVascManager().getVascController().getVascBackendController();
|
||||
VascEntryControllerLocal entries = (VascEntryControllerLocal)TechUI.getInstance().getVascManager().getVascController().getVascEntryController();
|
||||
for (String entryId:entries.getVascEntryIds()) {
|
||||
if (entryId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
entries.removeVascEntry(entryId);
|
||||
}
|
||||
|
||||
});
|
||||
vascMenu.add(item);
|
||||
}
|
||||
*/
|
||||
|
||||
for (String backendId:backends.getVascBackendIds()) {
|
||||
if (backendId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
backends.removeVascBackendById(backendId);
|
||||
}
|
||||
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeAllItem);
|
||||
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
|
|
@ -9,7 +9,16 @@
|
|||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<name>vasc-demo-tech-web</name>
|
||||
<description>vasc-demo-tech-web</description>
|
||||
<packaging>war</packaging>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/webapp</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- Vasc dep -->
|
||||
<dependency>
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
package net.forwardfire.vasc.demo.tech.web.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.model.SelectItem;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider;
|
||||
|
||||
public class ExportController {
|
||||
|
||||
private String entryId = "VascEntry";
|
||||
private String exportType = "xml";
|
||||
private boolean exportTree = true;
|
||||
private VascController vascController = null;
|
||||
|
||||
public ExportController() {
|
||||
DemoVascControllerProvider provider = new DemoVascControllerProvider();
|
||||
vascController = provider.getVascController();
|
||||
}
|
||||
|
||||
public List<SelectItem> getEntryIdSelectItems() {
|
||||
List<SelectItem> result = new ArrayList<SelectItem>();
|
||||
for (String entryId:vascController.getVascEntryController().getVascEntryIds()) {
|
||||
SelectItem i = new SelectItem();
|
||||
i.setLabel(entryId);
|
||||
i.setValue(entryId);
|
||||
result.add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<SelectItem> getExportTypeSelectItems() {
|
||||
List<SelectItem> result = new ArrayList<SelectItem>();
|
||||
for (VascEntryExporter ex:vascController.getVascEntryConfigController().getVascEntryExporters()) {
|
||||
SelectItem i = new SelectItem();
|
||||
i.setLabel(ex.getId());
|
||||
i.setValue(ex.getId());
|
||||
result.add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getBuildExportUrl() {
|
||||
StringBuilder buff = new StringBuilder();
|
||||
if (exportTree) {
|
||||
buff.append("export-tree/");
|
||||
buff.append(getEntryId());
|
||||
buff.append('/');
|
||||
buff.append(getExportType());
|
||||
} else {
|
||||
buff.append("export");
|
||||
buff.append("?ve=");
|
||||
buff.append(getEntryId());
|
||||
buff.append("&et=");
|
||||
buff.append(getExportType());
|
||||
}
|
||||
return buff.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryId
|
||||
*/
|
||||
public String getEntryId() {
|
||||
return entryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryId the entryId to set
|
||||
*/
|
||||
public void setEntryId(String entryId) {
|
||||
this.entryId = entryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the exportType
|
||||
*/
|
||||
public String getExportType() {
|
||||
return exportType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exportType the exportType to set
|
||||
*/
|
||||
public void setExportType(String exportType) {
|
||||
this.exportType = exportType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the exportTree
|
||||
*/
|
||||
public boolean isExportTree() {
|
||||
return exportTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exportTree the exportTree to set
|
||||
*/
|
||||
public void setExportTree(boolean exportTree) {
|
||||
this.exportTree = exportTree;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -23,4 +23,11 @@
|
|||
<managed-bean-scope>session</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>Controls Vasc Export Url Generator</description>
|
||||
<managed-bean-name>exportController</managed-bean-name>
|
||||
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.ExportController</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
</faces-config>
|
|
@ -7,16 +7,57 @@
|
|||
<ui:composition template="/jsp/includes/layout.xhtml">
|
||||
<ui:define name="title">Vasc Admin</ui:define>
|
||||
<ui:define name="content">
|
||||
<rich:panel style="width:90%;margin-top:2em;">
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Vasc Admin" />
|
||||
</f:facet>
|
||||
<rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}">
|
||||
<h:column>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink>
|
||||
</h:column>
|
||||
</rich:dataList>
|
||||
</rich:panel>
|
||||
<h:panelGrid columns="4" id="grid" width="100%">
|
||||
<rich:panel style="width:80%;">
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Vasc Admin" />
|
||||
</f:facet>
|
||||
<rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}">
|
||||
<h:column>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink>
|
||||
</h:column>
|
||||
</rich:dataList>
|
||||
</rich:panel>
|
||||
<rich:panel style="width:80%;">
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Export Servlet" />
|
||||
</f:facet>
|
||||
<h:form>
|
||||
<h:panelGrid columns="2" width="100%">
|
||||
<h:outputText value="Entry:"/>
|
||||
<h:selectOneMenu value="#{exportController.entryId}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{exportController.entryIdSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
|
||||
<h:outputText value="Type:"/>
|
||||
<h:selectOneMenu value="#{exportController.exportType}" onchange="javascript:this.form.submit(); return false;">
|
||||
<f:selectItems value="#{exportController.exportTypeSelectItems}"/>
|
||||
</h:selectOneMenu>
|
||||
|
||||
<h:outputText value="tree-url:"/>
|
||||
<h:selectBooleanCheckbox value="#{exportController.exportTree}" onchange="javascript:this.form.submit(); return false;"/>
|
||||
</h:panelGrid>
|
||||
<h:panelGrid columns="2" width="100%">
|
||||
<h:outputText value="Url:"/>
|
||||
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}">
|
||||
<h:outputText value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}"/>
|
||||
</h:outputLink>
|
||||
</h:panelGrid>
|
||||
</h:form>
|
||||
</rich:panel>
|
||||
<rich:panel>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="WebService Servlet" />
|
||||
</f:facet>
|
||||
<h:outputText value="todo" />
|
||||
</rich:panel>
|
||||
<rich:panel>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="WebStart" />
|
||||
</f:facet>
|
||||
<h:outputText value="todo" />
|
||||
</rich:panel>
|
||||
</h:panelGrid>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
|
|
@ -55,11 +55,11 @@ public class VascCXFServlet extends CXFNonSpringServlet {
|
|||
@Override
|
||||
public void init(ServletConfig sc) throws ServletException {
|
||||
|
||||
String className = getInitParameter("vascControllerProvider");
|
||||
String className = sc.getInitParameter("vascControllerProvider");
|
||||
if (className==null) {
|
||||
throw new ServletException("Can't start with null vascControllerProvider init parameter.");
|
||||
}
|
||||
String exportTreeStr = getInitParameter("exportTree");
|
||||
String exportTreeStr = sc.getInitParameter("exportTree");
|
||||
if (exportTreeStr!=null && "true".equalsIgnoreCase(exportTreeStr)) {
|
||||
exportTree = true;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ package net.forwardfire.vasc.frontend.swing;
|
|||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
@ -197,12 +196,14 @@ public class SwingVascEditDialog extends JPanel {
|
|||
//if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) {
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
result = bean;
|
||||
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result);
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
|
||||
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
entry.getVascFrontendData().getVascFrontendActions().persistObject();
|
||||
} else {
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
}
|
||||
|
||||
panels.closeVascView(editView, SwingVascEditDialog.this.entry);
|
||||
//setVisible(false);
|
||||
|
|
|
@ -167,9 +167,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
}
|
||||
|
||||
JPanel editPanel = panels.initVascView();
|
||||
SwingVascEditDialog dialog = new SwingVascEditDialog(this,editPanel,entry,rowBean,beanValue,panels);
|
||||
|
||||
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
|
||||
panels.openVascView(editPanel,entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,12 @@ abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascF
|
|||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
|
|
|
@ -680,7 +680,12 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
*/
|
||||
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord());
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
|
||||
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
entry.getVascFrontendData().getVascFrontendActions().persistObject();
|
||||
} else {
|
||||
entry.getVascFrontendData().getVascFrontendActions().mergeObject();
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontend().renderView();
|
||||
|
|
|
@ -109,7 +109,7 @@ public class BundleConfigParser {
|
|||
String value = properties.getProperty(key);
|
||||
result.put(key,value);
|
||||
}
|
||||
logger.info("Loaded "+bundle.getName()+" with total keys: "+result.size());
|
||||
logger.fine("Loaded "+bundle.getName()+" with total keys: "+result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue