2
0
Fork 0

Clean demo directory layout

This commit is contained in:
Willem Cazander 2012-05-13 17:25:50 +02:00
parent b3923bd2fb
commit 7c044adb1f
61 changed files with 2334 additions and 252 deletions

4
.gitignore vendored
View file

@ -10,8 +10,8 @@
*/*/*/*/target */*/*/*/target
# Inore some artifact dirs; # Inore some artifact dirs;
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/auto vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/deploy
vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/tomcat.* vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/workdir
# Ignore leftovers of really failed release build # Ignore leftovers of really failed release build
release.properties release.properties

View file

@ -8,11 +8,24 @@
- demo menu - demo menu
- demo wiki - 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 - encodeing select model
- lcoale select model - lcoale select model
- x4o template - x4o template
- swing readonly field editor
- order by list and edit. - order by list and edit.
- vasc AUTO ID - vasc AUTO ID
- new NULL vs "" setting global+per entity - new NULL vs "" setting global+per entity
@ -25,15 +38,13 @@
- mongo missing field == string gives; VascBackendProxySort$1.compare(VascBackendProxySort.java:102) - mongo missing field == string gives; VascBackendProxySort$1.compare(VascBackendProxySort.java:102)
- make event channels work - make event channels work
- auto text converts - auto text converts
- Plugin validation
- Plugin Role Parser - Plugin Role Parser
- Finalizer plugins - Finalizer plugins
- Check user roles in frontend - Check user roles in frontend
- Default/Full Table and templating - Default/Full Table and templating
- Ckeck all validators - Ckeck all validators
- Bind to x18n
- MetaQuery support - MetaQuery support
- create JSF-extJS frontend - create JSF-extJS frontend
- create XML-RPC frontend - create XML-RPC frontend
- export interface + exports - export interface + exports
- graphs of numeric value columns - graphs of numeric value columns

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld"> <eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
<eld:elementClass tag="jdbcBackend" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcVascBackend"> <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="jdbcConnectionProvider" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderImpl"/> <eld:elementClass tag="jdbcConnectionProvider" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderImpl"/>
<eld:elementClass tag="jdbcConnectionProviderJndi" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderJdniImpl"/> <eld:elementClass tag="jdbcConnectionProviderJndi" objectClassName="net.forwardfire.vasc.backend.jdbc.JdbcConnectionProviderJdniImpl"/>

View file

@ -1,23 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld"> <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: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:elementClassAttribute attributeName="resultClass">
<eld:attributeClassConverter/> <eld:attributeClassConverter/>
</eld:elementClassAttribute> </eld:elementClassAttribute>
</eld:elementClass> </eld:elementClass>
<eld:elementClass tag="xpqlHibernateBackend" objectClassName="net.forwardfire.vasc.backends.jpa.XpqlHibernateVascBackend"> <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:elementClassAttribute attributeName="resultClass">
<eld:attributeClassConverter/> <eld:attributeClassConverter/>
</eld:elementClassAttribute> </eld:elementClassAttribute>

View file

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld"> <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="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="ldapConnectionProvider" objectClassName="net.forwardfire.vasc.backend.ldap.LdapConnectionProviderImpl"/>
</eld:root> </eld:root>

View file

@ -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; package net.forwardfire.vasc.backend.metamodel;
import java.io.File; import java.io.File;
@ -7,6 +29,12 @@ import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.csv.CsvConfiguration; import org.eobjects.metamodel.csv.CsvConfiguration;
import org.eobjects.metamodel.csv.CsvDataContext; 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 { public class MetaModelDataContextCsv implements MetaModelDataContextProvider {
private String file = null; private String file = null;

View file

@ -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; package net.forwardfire.vasc.backend.metamodel;
import java.sql.Connection; import java.sql.Connection;
@ -6,7 +28,12 @@ import java.sql.DriverManager;
import org.eobjects.metamodel.DataContext; import org.eobjects.metamodel.DataContext;
import org.eobjects.metamodel.jdbc.JdbcDataContext; 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 { public class MetaModelDataContextJdbc implements MetaModelDataContextProvider {
private String driverClass = null; private String driverClass = null;
@ -22,7 +49,13 @@ public class MetaModelDataContextJdbc implements MetaModelDataContextProvider {
public Connection getConnection() { public Connection getConnection() {
synchronized (this) { synchronized (this) {
try { 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()); Connection connection = DriverManager.getConnection(getConnectUrl(),getUsername(),getPassword());
return connection; return connection;
} catch (Exception e) { } catch (Exception e) {

View file

@ -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; package net.forwardfire.vasc.backend.metamodel;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -10,6 +32,12 @@ import com.mongodb.Mongo;
import com.mongodb.MongoOptions; import com.mongodb.MongoOptions;
import com.mongodb.ServerAddress; 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 { public class MetaModelDataContextMongodb implements MetaModelDataContextProvider {
private String hostname = "localhost"; private String hostname = "localhost";

View file

@ -25,7 +25,7 @@ package net.forwardfire.vasc.backend.metamodel;
import org.eobjects.metamodel.DataContext; 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 * @author Willem Cazander
* @version 1.0 Apr 25, 2012 * @version 1.0 Apr 25, 2012

View file

@ -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; import java.util.logging.Logger;
@ -8,8 +30,6 @@ import org.eobjects.metamodel.schema.Relationship;
import org.eobjects.metamodel.schema.Table; import org.eobjects.metamodel.schema.Table;
import net.forwardfire.vasc.backend.VascBackendControllerLocal; 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.VascController;
import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal; 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.DefaultVascLinkEntry;
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry; 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 Logger logger = null;
private VascController vascController = 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) { public MetaModelSchemaAutoEntry() {
logger = Logger.getLogger(VascAutoSchemaMetaModel.class.getName()); 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; 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() { private VascController getVascController() {
return vascController; 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); logger.info("Creating entry id: "+id+" of table: "+tableName);
DataContext metaDs = ds.getDataContext();
Table metaTable = null; Table metaTable = null;
if (tableName==null) { if (tableName==null) {
metaTable = metaDs.getDefaultSchema().getTable(0); metaTable = ds.getDefaultSchema().getTable(0);
} else { } else {
metaTable = metaDs.getDefaultSchema().getTableByName(tableName); metaTable = ds.getDefaultSchema().getTableByName(tableName);
} }
Column[] keys = metaTable.getPrimaryKeys(); Column[] keys = metaTable.getPrimaryKeys();
Column[] cols = metaTable.getColumns(); Column[] cols = metaTable.getColumns();
@ -54,7 +105,7 @@ public class VascAutoSchemaMetaModel {
MetaModelVascBackend backend = new MetaModelVascBackend(); MetaModelVascBackend backend = new MetaModelVascBackend();
backend.setId(id+"_backend"); backend.setId(id+"_backend");
backend.setDataContextProvider(ds); backend.setDataContextProvider(getDataContextProvider());
backend.setTable(metaTable.getName()); backend.setTable(metaTable.getName());
if (keys.length>0) { if (keys.length>0) {
backend.setTableId(keys[0].getName()); backend.setTableId(keys[0].getName());
@ -73,10 +124,10 @@ public class VascAutoSchemaMetaModel {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName()); logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (tableName.equals(rs.getForeignTable().getName())==false) { if (tableName.equals(rs.getForeignTable().getName())==false) {
logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName()); 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 { } else {
logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName()); 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(); MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend"); backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(ds); backendLink.setDataContextProvider(getDataContextProvider());
backendLink.setTable(rs2.getForeignTable().getName()); backendLink.setTable(rs2.getForeignTable().getName());
Column[] keys = rs2.getForeignTable().getPrimaryKeys(); Column[] keys = rs2.getForeignTable().getPrimaryKeys();
@ -118,10 +169,10 @@ public class VascAutoSchemaMetaModel {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName()); logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (rs2.getForeignTable().getName().equals(rs.getForeignTable().getName())==false) { if (rs2.getForeignTable().getName().equals(rs.getForeignTable().getName())==false) {
//logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName()); //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 { } else {
logger.info("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName()); 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(); MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend"); backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(ds); backendLink.setDataContextProvider(getDataContextProvider());
backendLink.setTable(rs.getPrimaryTable().getName()); backendLink.setTable(rs.getPrimaryTable().getName());
Column[] keys = rs.getPrimaryTable().getPrimaryKeys(); Column[] keys = rs.getPrimaryTable().getPrimaryKeys();
@ -187,8 +238,25 @@ public class VascAutoSchemaMetaModel {
for (Column c:cols) { for (Column c:cols) {
VascEntryField vef = new DefaultVascEntryField(c.getName()); VascEntryField vef = new DefaultVascEntryField(c.getName());
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass())); 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); ve.addVascEntryField(vef);
if (ve.getDisplayNameFieldId()==null && c.getName().equals(ve.getPrimaryKeyFieldId())==false && c.getType().getJavaEquivalentClass()==String.class) { 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;
}
} }

View file

@ -54,7 +54,7 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
/** /**
* Provides backend for metamodel. * MetaModelVascBackend provides vasc backend for metamodel.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Dec 31, 2011 * @version 1.0 Dec 31, 2011
@ -65,15 +65,23 @@ public class MetaModelVascBackend extends AbstractVascBackend {
private UpdateableDataContext dataContext = null; private UpdateableDataContext dataContext = null;
private String table = null; private String table = null;
private String tableId = null; private String tableId = null;
private UpdateableDataContext getUpdateableDataContext() { /**
if (dataContext!=null) { * @see net.forwardfire.vasc.backend.AbstractVascBackend#startBackend()
return dataContext; */
} @Override
public void startBackend() {
dataContext = (UpdateableDataContext)dataContextProvider.getDataContext(); 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() * @see net.forwardfire.vasc.backend.AbstractVascBackend#isPageable()
*/ */
@ -87,7 +95,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
*/ */
@Override @Override
public long fetchTotalExecuteSize(VascBackendState state) { public long fetchTotalExecuteSize(VascBackendState state) {
UpdateableDataContext dataContext = getUpdateableDataContext();
Schema schema = dataContext.getDefaultSchema(); Schema schema = dataContext.getDefaultSchema();
Table t = schema.getTableByName(table); Table t = schema.getTableByName(table);
Query q = createFilterQuery(state,t,true); Query q = createFilterQuery(state,t,true);
@ -105,9 +112,9 @@ public class MetaModelVascBackend extends AbstractVascBackend {
private Query createFilterQuery(VascBackendState state,Table t,boolean count) { private Query createFilterQuery(VascBackendState state,Table t,boolean count) {
Object qWhere = null; Object qWhere = null;
if (count==false) { if (count==false) {
qWhere = getUpdateableDataContext().query().from(t).select(t.getColumns()); qWhere = dataContext.query().from(t).select(t.getColumns());
} else { } else {
qWhere = getUpdateableDataContext().query().from(t).selectCount(); qWhere = dataContext.query().from(t).selectCount();
} }
Iterator<String> keys = state.getDataParameterKeys().iterator(); Iterator<String> keys = state.getDataParameterKeys().iterator();
boolean first = true; boolean first = true;
@ -154,7 +161,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
} }
public List<Object> execute(VascBackendState state) throws VascException { public List<Object> execute(VascBackendState state) throws VascException {
UpdateableDataContext dataContext = getUpdateableDataContext();
Schema schema = dataContext.getDefaultSchema(); Schema schema = dataContext.getDefaultSchema();
Table t = schema.getTableByName(table); Table t = schema.getTableByName(table);
Query q = createFilterQuery(state,t,false); Query q = createFilterQuery(state,t,false);
@ -182,7 +188,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void persist(Object object) throws VascException { public void persist(Object object) throws VascException {
final Map<String,Object> map = (Map<String,Object>)object; final Map<String,Object> map = (Map<String,Object>)object;
UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
RowInsertionBuilder query = backendImpl.insertInto(table); RowInsertionBuilder query = backendImpl.insertInto(table);
@ -193,12 +198,12 @@ public class MetaModelVascBackend extends AbstractVascBackend {
query.execute(); query.execute();
} }
}); });
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Object merge(Object object) throws VascException { public Object merge(Object object) throws VascException {
final Map<String,Object> map = (Map<String,Object>)object; final Map<String,Object> map = (Map<String,Object>)object;
UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
@ -224,7 +229,6 @@ public class MetaModelVascBackend extends AbstractVascBackend {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void delete(Object object) throws VascException { public void delete(Object object) throws VascException {
final Map<String,Object> map = (Map<String,Object>)object; final Map<String,Object> map = (Map<String,Object>)object;
UpdateableDataContext dataContext = getUpdateableDataContext();
dataContext.executeUpdate(new UpdateScript() { dataContext.executeUpdate(new UpdateScript() {
public void run(UpdateCallback backendImpl) { public void run(UpdateCallback backendImpl) {
if (map.get(tableId) instanceof Number) { if (map.get(tableId) instanceof Number) {

View file

@ -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);
}
}

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld"> <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 tag="metaModelBackend" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend"/>
</eld:elementClass>
<eld:elementClass tag="mongodbDataContext" objectClassName="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb"/> <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> </eld:root>

View file

@ -44,7 +44,7 @@ import com.mongodb.WriteConcern;
import com.mongodb.WriteResult; import com.mongodb.WriteResult;
/** /**
* Provides backend for mongodb. * MongodbVascBackend Provides backend for mongodb.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Dec 30, 2011 * @version 1.0 Dec 30, 2011
@ -60,6 +60,25 @@ public class MongodbVascBackend extends AbstractVascBackend {
logger = Logger.getLogger(MongodbVascBackend.class.getName()); 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() * @see net.forwardfire.vasc.backend.AbstractVascBackend#isPageable()
*/ */
@ -136,15 +155,6 @@ public class MongodbVascBackend extends AbstractVascBackend {
} }
private DBCollection getDBCollection() { 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); return database.getCollection(collection);
} }

View file

@ -41,15 +41,12 @@ public class MongodbVascEntryFieldValue implements VascEntryFieldValue {
public Object getValue(VascEntryField field, Object record) throws VascException { public Object getValue(VascEntryField field, Object record) throws VascException {
BasicDBObject row = (BasicDBObject)record; BasicDBObject row = (BasicDBObject)record;
Object r = row.get(field.getBackendName()); Object data = row.get(field.getBackendName());
if (r==null) { return data;
return ""; // create new value, TODO
}
return r;
} }
public String getDisplayValue(VascEntryField field, Object record) throws VascException { 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 { public void setValue(VascEntryField field, Object record, Object value) throws VascException {

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld"> <eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
<eld:elementClass tag="mongodbBackend" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbVascBackend"> <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="mongodbConnectionProvider" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbConnectionProviderImpl"/> <eld:elementClass tag="mongodbConnectionProvider" objectClassName="net.forwardfire.vasc.backend.mongodb.MongodbConnectionProviderImpl"/>
</eld:root> </eld:root>

View file

@ -53,6 +53,18 @@ abstract public class AbstractVascBackend implements VascBackend {
this.id=id; 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() * @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
*/ */

View file

@ -41,7 +41,10 @@ public interface VascBackend {
public String getId(); public String getId();
public void setId(String id); public void setId(String id);
public void startBackend();
public void stopBackend();
public List<Object> execute(VascBackendState state) throws VascException; public List<Object> execute(VascBackendState state) throws VascException;
public boolean isReadOnly(); public boolean isReadOnly();

View file

@ -31,4 +31,8 @@ package net.forwardfire.vasc.backend;
public interface VascBackendControllerLocal extends VascBackendController { public interface VascBackendControllerLocal extends VascBackendController {
public void addVascBackend(VascBackend backend); public void addVascBackend(VascBackend backend);
public void removeVascBackendById(String backendId);
public void clearAndStopBackends();
} }

View file

@ -68,6 +68,20 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
return true; 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() * @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
*/ */

View file

@ -46,6 +46,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
private int pageSizeMax = 0; private int pageSizeMax = 0;
private String sortField = null; private String sortField = null;
private boolean sortDir = true; private boolean sortDir = true;
private boolean requestFlush = false;
public VascBackendProxyCache() { public VascBackendProxyCache() {
dataState = new HashMap<String,Object>(10); dataState = new HashMap<String,Object>(10);
@ -105,9 +106,26 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
changed = true; changed = true;
} }
searchString = state.getSearchString(); searchString = state.getSearchString();
if (requestFlush) {
requestFlush = false;
changed = true;
}
return changed; 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) * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
*/ */
@ -128,4 +146,31 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
} }
return records; 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);
}
} }

View file

@ -38,6 +38,8 @@ public interface VascFrontendActions {
public void deleteObject(); public void deleteObject();
public void persistObject();
public Object mergeObject(); public Object mergeObject();
public void sortAction(VascEntryField field); public void sortAction(VascEntryField field);

View file

@ -33,7 +33,7 @@ import net.forwardfire.vasc.backend.VascBackendControllerLocal;
/** /**
* * DefaultVascBackendController stores the vasc backends.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Sep 18, 2008 * @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() { public List<String> getVascBackendIds() {
List<String> result = new ArrayList<String>(50); List<String> result = new ArrayList<String>(50);
for (String id:backends.keySet()) { for (String id:backends.keySet()) {
@ -74,5 +64,39 @@ public class DefaultVascBackendController implements VascBackendControllerLocal
Collections.sort(result); // lets do abc for consistance behauvior. Collections.sort(result); // lets do abc for consistance behauvior.
return result; 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);
}
}
} }

View file

@ -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() { public Object mergeObject() {
return saveObject(false);
}
protected Object saveObject(boolean persist) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object result = null; Object result = null;
try { try {
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object); entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
int index = removeObjectFromDataList(object); int index = removeObjectFromDataList(object);
// merge object on backend // save object on backend
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object); if (persist) {
entry.getVascFrontendData().getVascEntryState().getVascBackend().persist(object);
} else {
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
}
// put object thrue the filters // put object thrue the filters
for (VascBackendFilter filter:entry.getVascBackendFilters()) { 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 entry
* @param object * @param object
*/ */

View file

@ -4,19 +4,22 @@
<eld:elementClass tag="root" objectClassName="java.lang.Object"> <eld:elementClass tag="root" objectClassName="java.lang.Object">
<eld:elementDescription>Fake root tag</eld:elementDescription> <eld:elementDescription>Fake root tag</eld:elementDescription>
</eld:elementClass> </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.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.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.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.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.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.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.SelectItemModelBindingHandler"/>
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.impl.x4o.VascEntryFieldBindingHandler"/> <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 --> <!-- Object for building an entry -->
<eld:elementClass tag="entry" objectClassName="net.forwardfire.vasc.impl.DefaultVascEntry" > <eld:elementClass tag="entry" objectClassName="net.forwardfire.vasc.impl.DefaultVascEntry" >

View file

@ -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"> 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> <id>bin</id>
<formats> <formats>
<!-- Save some build time/space as these are about 30MB each.
<format>tar.gz</format>
<format>tar.bz2</format>
-->
<format>zip</format> <format>zip</format>
</formats> </formats>
<includeBaseDirectory>true</includeBaseDirectory> <includeBaseDirectory>true</includeBaseDirectory>
@ -40,11 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<useProjectArtifact>false</useProjectArtifact> <useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<!--
<includes>
<include>*</include>
</includes>
-->
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
<fileSets> <fileSets>
@ -62,17 +53,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<outputDirectory>/</outputDirectory> <outputDirectory>/</outputDirectory>
<fileMode>755</fileMode> <fileMode>755</fileMode>
</fileSet> </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> <fileSet>
<directory>${project.basedir}/src/main/files/</directory> <directory>${project.basedir}/src/main/files/</directory>
<outputDirectory>/</outputDirectory> <outputDirectory>/</outputDirectory>
@ -80,5 +60,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<include>readme.txt</include> <include>readme.txt</include>
</includes> </includes>
</fileSet> </fileSet>
<fileSet>
<directory>${project.basedir}/src/main/directory/</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets> </fileSets>
</assembly> </assembly>

View file

@ -0,0 +1 @@
All *.xml in this dir are automaticly started.

View file

@ -32,7 +32,7 @@ set MAIN_CLASS=net.forwardfire.vasc.demo.tech.ui.TechUI
set CP=lib\* set CP=lib\*
:: Launch application :: Launch application
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS% java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS% -gui
endlocal endlocal
:: EOF :: EOF

View file

@ -32,7 +32,7 @@ MAIN_CLASS="net.forwardfire.vasc.demo.tech.ui.TechUI";
CP=`echo lib/*.jar | sed 's/ /:/g'`; CP=`echo lib/*.jar | sed 's/ /:/g'`;
# Launch application # Launch application
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS; $JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS -gui;
# EOF # EOF

View file

@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryConfigController; import net.forwardfire.vasc.core.VascEntryConfigController;
import net.forwardfire.vasc.core.VascEntryControllerLocal; import net.forwardfire.vasc.core.VascEntryControllerLocal;
@ -82,6 +83,12 @@ public class DemoVascManager {
} }
public void stop() { public void stop() {
if (vascController==null) {
return;
}
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
backends.clearAndStopBackends();
vascController = null; vascController = null;
logger.info("Stop manager, cleared all."); logger.info("Stop manager, cleared all.");
} }
@ -103,8 +110,8 @@ public class DemoVascManager {
logger.info("Vasc open file: "+file.getAbsoluteFile()); logger.info("Vasc open file: "+file.getAbsoluteFile());
try { try {
VascParser parser = new VascParser(vascController); VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml"); //File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f)); //parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file); parser.parseFile(file);
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);

View file

@ -2,8 +2,8 @@
<x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld" <x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld" xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld"
> >
<v:virtualVascBackend id="vascEntryBackend" vascController="${vascController}" vascType="entry"/> <v:virtualVascBackend id="VascEntryBackend" vascController="${vascController}" vascType="entry"/>
<v:entry id="vascEntry" backendId="vascEntryBackend"> <v:entry id="VascEntry" backendId="VascEntryBackend">
<v:field id="id"/> <v:field id="id"/>
<v:field id="backendId"/> <v:field id="backendId"/>
<v:field id="name"/> <v:field id="name"/>

File diff suppressed because it is too large Load diff

View file

@ -31,19 +31,11 @@
<artifactId>vasc-demo-tech-editor</artifactId> <artifactId>vasc-demo-tech-editor</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </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> <dependency>
<groupId>net.forwardfire.vasc.demo</groupId> <groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId> <artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.forwardfire.vasc</groupId> <groupId>net.forwardfire.vasc</groupId>

View file

@ -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;
}
}

View file

@ -29,7 +29,10 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.ArrayList;
import java.util.EventObject; import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -49,8 +52,10 @@ import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
public class TechUI extends SingleFrameApplication { public class TechUI extends SingleFrameApplication {
private Logger logger = null; private Logger logger = null;
private boolean showGui = false;
private DemoVascManager vascManager = null; private DemoVascManager vascManager = null;
private TomcatManager tomcatManager = null; private TomcatManager tomcatManager = null;
private DeployManager deployManager = null;
static public void main(String[] args) { static public void main(String[] args) {
Application.launch(TechUI.class, args); Application.launch(TechUI.class, args);
@ -99,6 +104,7 @@ public class TechUI extends SingleFrameApplication {
public void willExit(EventObject event) { public void willExit(EventObject event) {
logger.info("Shutdown requested."); logger.info("Shutdown requested.");
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
deployManager.stop();
try { try {
tomcatManager.stop(); tomcatManager.stop();
} catch (Exception e) { } 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(); 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(); setupLogging();
logger.info("Starting Vasc-Demo-Tech-UI."); 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 = new DemoVascManager();
vascManager.start(); vascManager.start();
autoLoadVasc();
deployManager = new DeployManager();
deployManager.setDeployDir(deployDir);
deployManager.start();
tomcatManager = new TomcatManager(); tomcatManager = new TomcatManager();
tomcatManager.setWorkDir(workDir);
tomcatManager.setVascController(vascManager.getVascController()); tomcatManager.setVascController(vascManager.getVascController());
if (serverHost!=null) {
tomcatManager.setHostname(serverHost);
}
if (serverPort!=null) {
tomcatManager.setPort(new Integer(serverPort));
}
Thread t = new Thread(new Runnable() { Thread t = new Thread(new Runnable() {
public void run() { public void run() {
@ -158,11 +215,24 @@ public class TechUI extends SingleFrameApplication {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
addExitListener(new ShutdownManager()); addExitListener(new ShutdownManager());
FrameView mainView = getMainView(); if (showGui) {
mainView.setComponent(new JMainPanel()); FrameView mainView = getMainView();
mainView.setMenuBar(new JMainPanelMenuBar()); mainView.setComponent(new JMainPanel());
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128)); mainView.setMenuBar(new JMainPanelMenuBar());
show(mainView); 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(); long stopTime = System.currentTimeMillis();
logger.info("TechUI startup in "+(stopTime-startTime)+" ms total startup in "+(stopTime-startTime)+" ms."); 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() { public VascController getVascController() {
return vascManager.getVascController(); return vascManager.getVascController();
} }
public boolean isMavenRun() {
return System.getProperty("java.class.path").contains("classes");
}
} }

View file

@ -17,19 +17,24 @@ public class TomcatManager {
private Logger logger = null; private Logger logger = null;
private Tomcat tomcat = null; private Tomcat tomcat = null;
private VascController vascController = null; private VascController vascController = null;
private String hostname = null;
private Integer port = null;
private File workDir = null;
public TomcatManager() { public TomcatManager() {
logger = Logger.getLogger(TomcatManager.class.getName()); logger = Logger.getLogger(TomcatManager.class.getName());
hostname = "localhost";
port = 8899;
} }
public void start() throws Exception { public void start() throws Exception {
Tomcat tomcat = new Tomcat(); if (workDir==null) {
throw new NullPointerException("Can't start tomcat with null workDir.");
String webPort = System.getenv("PORT");
if(webPort == null || webPort.isEmpty()) {
webPort = "8899";
} }
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")) { if (System.getProperty("java.class.path").contains("classes")) {
String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/"; String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/";
@ -40,7 +45,7 @@ public class TomcatManager {
File techWarFile = null; File techWarFile = null;
for (File file:new File("lib").listFiles()) { for (File file:new File("lib").listFiles()) {
if (file.getName().endsWith("war")) { if (file.getName().contains("vasc-demo-tech-web")) {
techWarFile = file; techWarFile = file;
break; break;
} }
@ -48,7 +53,7 @@ public class TomcatManager {
if (techWarFile==null) { if (techWarFile==null) {
throw new NullPointerException("Could not locate war file in lib directory."); 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) { if (destDir.exists()==false) {
destDir.mkdirs(); destDir.mkdirs();
JarFile jar = new JarFile(techWarFile); JarFile jar = new JarFile(techWarFile);
@ -72,10 +77,7 @@ public class TomcatManager {
String deployPath = destDir.getAbsolutePath(); String deployPath = destDir.getAbsolutePath();
logger.info("Deploy war path: "+deployPath); logger.info("Deploy war path: "+deployPath);
tomcat.addWebapp("/demo",deployPath); tomcat.addWebapp("/demo",deployPath);
} }
instance = this;
tomcat.start(); tomcat.start();
} }
@ -84,12 +86,6 @@ public class TomcatManager {
return; return;
} }
tomcat.stop(); 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) { public void setVascController(VascController vascController) {
this.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;
}
} }

View file

@ -17,8 +17,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv; 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.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.JMainPanel;
public class JDialogMetaCsv extends JDialog implements ActionListener { public class JDialogMetaCsv extends JDialog implements ActionListener {
@ -64,8 +64,11 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
File file = fc.getSelectedFile(); File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv(); MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath()); 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(); ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
} }
} }

View file

@ -18,13 +18,11 @@ import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc; 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.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.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid; import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
public class JDialogMetaJdbc extends JDialog implements ActionListener { public class JDialogMetaJdbc extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L; private static final long serialVersionUID = -8638394652416472734L;
@ -89,12 +87,11 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
ds.setConnectUrl(url); ds.setConnectUrl(url);
ds.setUsername(usernameField.getText()); ds.setUsername(usernameField.getText());
ds.setPassword(passwordField.getText()); ds.setPassword(passwordField.getText());
DataContext metaDs = ds.getDataContext();
String dbName = url.substring(url.lastIndexOf('/')+1,url.length()); String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController()); MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
for (String table:metaDs.getDefaultSchema().getTableNames()) { schema.setDataContextProvider(ds);
schema.createMetaEntry(ds,dbName+"_"+table,table); schema.setEntryPrefix(dbName);
} schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
} }
}); });

View file

@ -17,8 +17,8 @@ import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb; 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.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.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid; 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.setHostname(hostNameField.getText());
ds.setPort(new Integer(hostPortField.getText())); ds.setPort(new Integer(hostPortField.getText()));
ds.setDatabase(databaseField.getText()); ds.setDatabase(databaseField.getText());
DataContext metaDs = ds.getDataContext();
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController()); MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
for (String table:metaDs.getDefaultSchema().getTableNames()) { schema.setDataContextProvider(ds);
schema.createMetaEntry(ds,ds.getDatabase()+"_"+table,table); schema.setEntryPrefix(ds.getDatabase());
} schema.autoCreateEntries(TechUI.getInstance().getVascManager().getVascController());
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
} }
}); });

View file

@ -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.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed; import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en;
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys; import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
public class JMainPanel extends JPanel { public class JMainPanel extends JPanel {
@ -291,15 +290,14 @@ public class JMainPanel extends JPanel {
} }
File resourceFile = new File("auto/data/vasc-bundle.properties"); File resourceFile = new File("auto/data/vasc-bundle.properties");
if (resourceFile.exists()) { if (resourceFile.exists()) {
readPropertiesFile(p,resourceFile); readPropertiesFile(p,resourceFile);
} }
for (String key:keys.keySet()) { for (String key:keys.keySet()) {
p.put(key, keys.get(key)); p.put(key, keys.get(key));
} }
writePropertiesFile(p,resourceFile); writePropertiesFile(p,resourceFile);
new RootApplicationBundle_en().reload(); ResourceBundle.clearCache();
RootApplicationBundle_en.clearCache();
} }
} }

View file

@ -10,6 +10,8 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JTabbedPane; 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.TechUI;
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaCsv; import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaCsv;
import net.forwardfire.vasc.demo.tech.ui.actions.JDialogMetaJdbc; 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 { public class JMainPanelMenuBar extends JMenuBar {
private static final long serialVersionUID = -2828428804621352725L;
JMenu fileMenu = new JMenu("File"); JMenu fileMenu = new JMenu("File");
JMenu connMenu = new JMenu("Connection"); JMenu vascMenu = new JMenu("Vasc");
JMenu tabMenu = new JMenu("Tabs"); JMenu tabMenu = new JMenu("Tabs");
public JMainPanelMenuBar() { public JMainPanelMenuBar() {
createMenuItems(); createMenuItems();
add(fileMenu); add(fileMenu);
add(connMenu); add(vascMenu);
add(tabMenu); add(tabMenu);
} }
@ -61,17 +64,18 @@ public class JMainPanelMenuBar extends JMenuBar {
fileMenu.add(exitItem); fileMenu.add(exitItem);
JMenuItem connectVascItem = new JMenuItem("Add Vasc"); JMenuItem connectVascItem = new JMenuItem("Add Vasc");
connectVascItem.setEnabled(false);
connectVascItem.addActionListener(new ActionListener() { connectVascItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
} }
}); });
connMenu.add(connectVascItem); vascMenu.add(connectVascItem);
JMenuItem connectLdapItem = new JMenuItem("Add Ldap"); JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
connectLdapItem.setEnabled(false); connectLdapItem.setEnabled(false);
connMenu.add(connectLdapItem); vascMenu.add(connectLdapItem);
connMenu.addSeparator(); vascMenu.addSeparator();
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv"); JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
connectMetaCsvItem.addActionListener(new ActionListener() { connectMetaCsvItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -79,9 +83,10 @@ public class JMainPanelMenuBar extends JMenuBar {
d.setVisible(true); d.setVisible(true);
} }
}); });
connMenu.add(connectMetaCsvItem); vascMenu.add(connectMetaCsvItem);
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml"); JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
connMenu.add(connectMetaXmlItem); connectMetaXmlItem.setEnabled(false);
vascMenu.add(connectMetaXmlItem);
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo"); JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
connectMetaMongoItem.addActionListener(new ActionListener() { connectMetaMongoItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -89,7 +94,7 @@ public class JMainPanelMenuBar extends JMenuBar {
d.setVisible(true); d.setVisible(true);
} }
}); });
connMenu.add(connectMetaMongoItem); vascMenu.add(connectMetaMongoItem);
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc"); JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
connectMetaJdbcItem.addActionListener(new ActionListener() { connectMetaJdbcItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -97,27 +102,39 @@ public class JMainPanelMenuBar extends JMenuBar {
d.setVisible(true); d.setVisible(true);
} }
}); });
connMenu.add(connectMetaJdbcItem); vascMenu.add(connectMetaJdbcItem);
/* vascMenu.addSeparator();
for (final String id:ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryIds()) { JMenuItem removeEntryItem = new JMenuItem("Remove entry");
JMenuItem item = new JMenuItem(id); removeEntryItem.setEnabled(false);
item.addActionListener(new ActionListener() { removeEntryItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { }
VascEntry ee = ve.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id).clone(); });
DefaultVascFactory.fillVascEntryFrontend(ee, ve.getVascFrontendData().getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null)); vascMenu.add(removeEntryItem);
spi.createNewVascView(ee);
} catch (Exception e1) { JMenuItem removeAllItem = new JMenuItem("Remove all");
e1.printStackTrace(); 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);
} }
for (String backendId:backends.getVascBackendIds()) {
}); if (backendId.startsWith("Vasc")) {
vascMenu.add(item); continue;
} }
*/ backends.removeVascBackendById(backendId);
}
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
});
vascMenu.add(removeAllItem);
JMenuItem item = new JMenuItem("Close tab"); JMenuItem item = new JMenuItem("Close tab");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View file

@ -9,7 +9,16 @@
<artifactId>vasc-demo-tech-web</artifactId> <artifactId>vasc-demo-tech-web</artifactId>
<name>vasc-demo-tech-web</name> <name>vasc-demo-tech-web</name>
<description>vasc-demo-tech-web</description> <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> <dependencies>
<!-- Vasc dep --> <!-- Vasc dep -->
<dependency> <dependency>

View file

@ -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("&amp;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;
}
}

View file

@ -23,4 +23,11 @@
<managed-bean-scope>session</managed-bean-scope> <managed-bean-scope>session</managed-bean-scope>
</managed-bean> </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> </faces-config>

View file

@ -7,16 +7,57 @@
<ui:composition template="/jsp/includes/layout.xhtml"> <ui:composition template="/jsp/includes/layout.xhtml">
<ui:define name="title">Vasc Admin</ui:define> <ui:define name="title">Vasc Admin</ui:define>
<ui:define name="content"> <ui:define name="content">
<rich:panel style="width:90%;margin-top:2em;"> <h:panelGrid columns="4" id="grid" width="100%">
<f:facet name="header"> <rich:panel style="width:80%;">
<h:outputText value="Vasc Admin" /> <f:facet name="header">
</f:facet> <h:outputText value="Vasc Admin" />
<rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}"> </f:facet>
<h:column> <rich:dataList var="info" value="#{vascFacesController.vascAdminEntries}">
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink> <h:column>
</h:column> <h:outputLink value="#{facesContext.externalContext.requestContextPath}/vasc/#{info}/list.jsf"><h:outputText value="#{info}"/></h:outputLink>
</rich:dataList> </h:column>
</rich:panel> </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:define>
</ui:composition> </ui:composition>
</html> </html>

View file

@ -55,11 +55,11 @@ public class VascCXFServlet extends CXFNonSpringServlet {
@Override @Override
public void init(ServletConfig sc) throws ServletException { public void init(ServletConfig sc) throws ServletException {
String className = getInitParameter("vascControllerProvider"); String className = sc.getInitParameter("vascControllerProvider");
if (className==null) { if (className==null) {
throw new ServletException("Can't start with null vascControllerProvider init parameter."); 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)) { if (exportTreeStr!=null && "true".equalsIgnoreCase(exportTreeStr)) {
exportTree = true; exportTree = true;
} }

View file

@ -25,7 +25,6 @@ package net.forwardfire.vasc.frontend.swing;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -197,12 +196,14 @@ public class SwingVascEditDialog extends JPanel {
//if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) { //if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) {
// return; // return;
//} //}
result = bean; result = bean;
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result); 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); panels.closeVascView(editView, SwingVascEditDialog.this.entry);
//setVisible(false); //setVisible(false);

View file

@ -167,9 +167,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
beanValue=beanValue.substring(0, 30); beanValue=beanValue.substring(0, 30);
} }
} }
JPanel editPanel = panels.initVascView(); JPanel editPanel = panels.initVascView();
SwingVascEditDialog dialog = new SwingVascEditDialog(this,editPanel,entry,rowBean,beanValue,panels); SwingVascEditDialog dialog = new SwingVascEditDialog(this,editPanel,entry,rowBean,beanValue,panels);
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
panels.openVascView(editPanel,entry); panels.openVascView(editPanel,entry);
} }

View file

@ -175,7 +175,12 @@ abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascF
this.backendId=backendId; this.backendId=backendId;
this.vascManager=vascManager; this.vascManager=vascManager;
} }
public void startBackend() {
}
public void stopBackend() {
}
public void delete(Object object) throws VascException { public void delete(Object object) throws VascException {
Object[] args = new Object[1]; Object[] args = new Object[1];
args[0]=object; args[0]=object;

View file

@ -680,7 +680,12 @@ public class JSFVascEntrySupportBean implements Serializable {
*/ */
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord()); 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 { try {
entry.getVascFrontendData().getVascFrontend().renderView(); entry.getVascFrontendData().getVascFrontend().renderView();

View file

@ -109,7 +109,7 @@ public class BundleConfigParser {
String value = properties.getProperty(key); String value = properties.getProperty(key);
result.put(key,value); 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; return result;
} }