made first demo almost fully working
This commit is contained in:
parent
2a0d992642
commit
01b3b5cc54
|
@ -58,8 +58,8 @@ zie tables statline.cbs.nl voor bs asielverzoeken nl
|
|||
- Extjs
|
||||
- Swing
|
||||
- WS
|
||||
- SWT via SwingWT
|
||||
- JSF (met utr plugin)
|
||||
- SWT
|
||||
- JSF
|
||||
|
||||
|
||||
|
||||
|
@ -167,34 +167,6 @@ public class BlogPost {
|
|||
|
||||
|
||||
|
||||
<servlet>
|
||||
<name>vasc</name>
|
||||
<class></class>
|
||||
<property>admin=true</property>
|
||||
<property>backend=extjs</property>
|
||||
<property>path=/js/extjs/*</property>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<name>vasc</name>
|
||||
<mapping>/vasc/*</mapping>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
EmployeeDataSource dataSource = new EmployeeDataSource();
|
||||
dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
|
||||
FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
|
||||
JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
|
||||
public Serializable getEntity() {
|
||||
Object object = ((Row)getModel().getRowData()).getObject();
|
||||
EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
|
||||
Employee employee = new Employee();
|
||||
employee.setId(employeeReportObject.getId());
|
||||
return employee;
|
||||
}
|
||||
};
|
||||
|
||||
return adapter;
|
||||
|
||||
EVt;
|
||||
|
||||
<a4j:form id="blogForm" enctype="multipart/form-data">
|
||||
|
@ -223,46 +195,8 @@ EVt;
|
|||
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "serial" })
|
||||
@Bean(scope = DefaultScopes.SESSION)
|
||||
public JsfCrudAdapter empRecordCrud() {
|
||||
EmployeeDataSource dataSource = new EmployeeDataSource();
|
||||
dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
|
||||
FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
|
||||
JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
|
||||
public Serializable getEntity() {
|
||||
Object object = ((Row)getModel().getRowData()).getObject();
|
||||
EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
|
||||
Employee employee = new Employee();
|
||||
employee.setId(employeeReportObject.getId());
|
||||
return employee;
|
||||
}
|
||||
};
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
<a4j:form id="employeeListingForm">
|
||||
<a4j:outputPanel ajaxRendered="true">
|
||||
<h:panelGroup rendered="${empRecordCrud.controller.showForm}">
|
||||
<crank:form
|
||||
crud="${empRecordCrud.controller}"
|
||||
parentForm="employeeListingForm"
|
||||
propertyNames="firstName,lastName,numberOfPromotions,age,department" ajax="${true}" />
|
||||
</h:panelGroup>
|
||||
</a4j:outputPanel>
|
||||
|
||||
<crank:listing
|
||||
jsfCrudAdapter="${empRecordCrud}"
|
||||
propertyNames="firstName,lastName"
|
||||
parentForm="employeeListingForm"
|
||||
/>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
<h:form id="expListForm" rendered="#{controllerBean.showListing}">
|
||||
<crank:listing paginator="${paginators['Employee']}"
|
||||
<vasc:listing paginator="${paginators['Employee']}"
|
||||
jsfCrudAdapter="${cruds['Employee']}"
|
||||
propertyNames="firstName,lastName,active,dob,age,phone,email,department.name,description"
|
||||
pageTitle="Employees"
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
|
||||
package net.forwardfire.vasc.backend.metamodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
@ -29,11 +34,14 @@ import org.eobjects.metamodel.schema.Column;
|
|||
import org.eobjects.metamodel.schema.Relationship;
|
||||
import org.eobjects.metamodel.schema.Table;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryAccessType;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryGroupLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
|
||||
|
@ -53,15 +61,25 @@ public class MetaModelSchemaAutoEntry {
|
|||
private Logger logger = null;
|
||||
private VascController vascController = null;
|
||||
private MetaModelDataContextProvider dataContextProvider = null;
|
||||
private List<String> tables = null;
|
||||
private String tableInclude = null;
|
||||
private String tableExclude = null;
|
||||
private String entryPrefix = null;
|
||||
private String vascGroupId = null;
|
||||
|
||||
private Map<String,VascEntryLocal> resultEntries = null;
|
||||
private Map<String,VascEntryGroupLocal> resultEntryGroups = null;
|
||||
private Map<String,MetaModelVascBackend> resultBackends = null;
|
||||
|
||||
public MetaModelSchemaAutoEntry() {
|
||||
logger = Logger.getLogger(MetaModelSchemaAutoEntry.class.getName());
|
||||
tables = new ArrayList<String>();
|
||||
resultEntries = new HashMap<String,VascEntryLocal>();
|
||||
resultEntryGroups = new HashMap<String,VascEntryGroupLocal>();
|
||||
resultBackends = new HashMap<String,MetaModelVascBackend>();
|
||||
}
|
||||
|
||||
public void autoCreateEntries(VascController vascController) {
|
||||
public void autoFillResult(VascController vascController) {
|
||||
if (getDataContextProvider()==null) {
|
||||
throw new NullPointerException("Can't auto create entries with null dataContextProvider.");
|
||||
}
|
||||
|
@ -72,6 +90,10 @@ public class MetaModelSchemaAutoEntry {
|
|||
|
||||
DataContext ds = getDataContextProvider().getDataContext();
|
||||
for (String table:ds.getDefaultSchema().getTableNames()) {
|
||||
if (tables.isEmpty()==false && tables.contains(table)==false) {
|
||||
logger.finer("Excluding table: "+table+" because not in table list.");
|
||||
continue;
|
||||
}
|
||||
if (getTableInclude()!=null && table.matches(getTableInclude())==false) {
|
||||
logger.finer("Excluding table: "+table+" from include rule.");
|
||||
continue;
|
||||
|
@ -84,10 +106,22 @@ public class MetaModelSchemaAutoEntry {
|
|||
}
|
||||
}
|
||||
|
||||
public void autoAddResultToController() {
|
||||
for (VascBackend backend:resultBackends.values()) {
|
||||
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
|
||||
}
|
||||
for (VascEntryLocal ve:resultEntries.values()) {
|
||||
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
|
||||
}
|
||||
for (VascEntryGroupLocal veg:resultEntryGroups.values()) {
|
||||
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntryGroup(veg);
|
||||
}
|
||||
}
|
||||
|
||||
private VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
|
||||
private void createMetaEntry(DataContext ds,String id,String tableName) {
|
||||
logger.fine("Creating entry id: "+id+" of table: "+tableName);
|
||||
Table metaTable = null;
|
||||
|
@ -117,28 +151,28 @@ public class MetaModelSchemaAutoEntry {
|
|||
ve.setId(id);
|
||||
ve.setBackendId(id+"_backend");
|
||||
ve.setPrimaryKeyFieldId(backend.getTableId());
|
||||
ve.setVascGroupId(getVascGroupId());
|
||||
createFields(ve,cols);
|
||||
|
||||
for (Relationship rs:metaTable.getRelationships()) {
|
||||
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
|
||||
if (tableName.equals(rs.getForeignTable().getName())==false) {
|
||||
logger.finer("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
|
||||
createLinkEntry(rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
|
||||
createLinkEntry(rs,ve,metaTable);
|
||||
//createLinkEntry(rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
|
||||
} else {
|
||||
logger.finer("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
|
||||
createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
createListEntry(rs,ve,metaTable);
|
||||
//createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
|
||||
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
}
|
||||
resultBackends.put(backend.getId(),backend);
|
||||
resultEntries.put(ve.getId(),ve);
|
||||
}
|
||||
|
||||
private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable,String id) {
|
||||
private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable) {
|
||||
String id = getEntryPrefix()+"_"+metaTable.getName()+"_link";
|
||||
MetaModelVascBackend backendLink = new MetaModelVascBackend();
|
||||
backendLink.setId(id+"_backend");
|
||||
backendLink.setDataContextProvider(getDataContextProvider());
|
||||
|
@ -159,6 +193,8 @@ public class MetaModelSchemaAutoEntry {
|
|||
veLink.setId(id);
|
||||
veLink.setBackendId(id+"_backend");
|
||||
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
|
||||
veLink.setVascGroupId(getVascGroupId());
|
||||
veLink.setAccessType(VascEntryAccessType.ENTRY_LIST);
|
||||
createFields(veLink,cols);
|
||||
|
||||
for (Relationship rs:rs2.getForeignTable().getRelationships()) {
|
||||
|
@ -168,32 +204,31 @@ public class MetaModelSchemaAutoEntry {
|
|||
//createLinkEntry(rs,ve,rs2.getForeignTable(),id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
|
||||
} else {
|
||||
logger.fine("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
|
||||
createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
createListEntry(rs,veLink,rs2.getForeignTable());
|
||||
//createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
|
||||
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
|
||||
|
||||
DefaultVascEntryLink vle = new DefaultVascEntryLink();
|
||||
vle.setId(id+"Link");
|
||||
vle.setVascLinkEntryType(VascEntryLinkType.DEFAULT_TYPE);
|
||||
vle.setVascEntryId(id);
|
||||
vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
|
||||
|
||||
ve.addVascEntryLink(vle);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (resultBackends.containsKey(backendLink.getId())==false) {
|
||||
resultBackends.put(backendLink.getId(),backendLink);
|
||||
resultEntries.put(veLink.getId(),veLink);
|
||||
}
|
||||
|
||||
DefaultVascEntryLink vle = new DefaultVascEntryLink();
|
||||
vle.setId(id+"Link");
|
||||
vle.setVascEntryLinkType(VascEntryLinkType.DEFAULT_TYPE);
|
||||
vle.setVascEntryId(id);
|
||||
vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
|
||||
|
||||
ve.addVascEntryLink(vle);
|
||||
}
|
||||
|
||||
private void createListEntry(Relationship rs,VascEntry ve,Table metaTable,String id) {
|
||||
MetaModelVascBackend backendLink = new MetaModelVascBackend();
|
||||
backendLink.setId(id+"_backend");
|
||||
backendLink.setDataContextProvider(getDataContextProvider());
|
||||
backendLink.setTable(rs.getPrimaryTable().getName());
|
||||
private void createListEntry(Relationship rs,VascEntry ve,Table metaTable) {
|
||||
String id = getEntryPrefix()+"_"+metaTable.getName()+"_list";
|
||||
MetaModelVascBackend backendList = new MetaModelVascBackend();
|
||||
backendList.setId(id+"_backend");
|
||||
backendList.setDataContextProvider(getDataContextProvider());
|
||||
backendList.setTable(rs.getPrimaryTable().getName());
|
||||
|
||||
Column[] keys = rs.getPrimaryTable().getPrimaryKeys();
|
||||
Column[] cols = rs.getPrimaryTable().getColumns();
|
||||
|
@ -201,33 +236,35 @@ public class MetaModelSchemaAutoEntry {
|
|||
return;
|
||||
}
|
||||
if (keys.length>0) {
|
||||
backendLink.setTableId(keys[0].getName());
|
||||
backendList.setTableId(keys[0].getName());
|
||||
} else {
|
||||
backendLink.setTableId(cols[0].getName());
|
||||
backendList.setTableId(cols[0].getName());
|
||||
}
|
||||
DefaultVascEntry veLink = new DefaultVascEntry();
|
||||
veLink.setId(id);
|
||||
veLink.setBackendId(id+"_backend");
|
||||
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
|
||||
createFields(veLink,cols);
|
||||
try {
|
||||
VascEntryFieldLocal vef = (VascEntryFieldLocal)ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
|
||||
if (vef==null) {
|
||||
logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
|
||||
return;
|
||||
}
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
|
||||
|
||||
VascSelectItemModelEntry itemModel = new VascSelectItemModelEntry();
|
||||
itemModel.setEntryId(veLink.getId());
|
||||
itemModel.setDisplayFieldId(veLink.getDisplayNameFieldId());
|
||||
vef.getVascEntryFieldType().setDataObject(itemModel);
|
||||
|
||||
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
|
||||
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DefaultVascEntry veList = new DefaultVascEntry();
|
||||
veList.setId(id);
|
||||
veList.setBackendId(id+"_backend");
|
||||
veList.setPrimaryKeyFieldId(backendList.getTableId());
|
||||
veList.setVascGroupId(getVascGroupId());
|
||||
veList.setAccessType(VascEntryAccessType.ENTRY_LIST);
|
||||
createFields(veList,cols);
|
||||
|
||||
if (resultBackends.containsKey(backendList.getId())==false) {
|
||||
resultBackends.put(backendList.getId(),backendList);
|
||||
resultEntries.put(veList.getId(),veList);
|
||||
}
|
||||
|
||||
VascEntryFieldLocal vef = (VascEntryFieldLocal)ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
|
||||
if (vef==null) {
|
||||
logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
|
||||
return;
|
||||
}
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
|
||||
|
||||
VascSelectItemModelEntry itemModel = new VascSelectItemModelEntry();
|
||||
itemModel.setEntryId(veList.getId());
|
||||
itemModel.setDisplayFieldId(veList.getDisplayNameFieldId());
|
||||
vef.getVascEntryFieldType().setDataObject(itemModel);
|
||||
|
||||
}
|
||||
|
||||
private void createFields(VascEntryLocal ve,Column[] cols) {
|
||||
|
@ -317,4 +354,53 @@ public class MetaModelSchemaAutoEntry {
|
|||
public void setEntryPrefix(String entryPrefix) {
|
||||
this.entryPrefix = entryPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascGroupId
|
||||
*/
|
||||
public String getVascGroupId() {
|
||||
return vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascGroupId the vascGroupId to set
|
||||
*/
|
||||
public void setVascGroupId(String vascGroupId) {
|
||||
this.vascGroupId = vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultEntries
|
||||
*/
|
||||
public Collection<VascEntryLocal> getResultEntries() {
|
||||
return resultEntries.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultEntryGroups
|
||||
*/
|
||||
public Collection<VascEntryGroupLocal> getResultEntryGroups() {
|
||||
return resultEntryGroups.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultBackends
|
||||
*/
|
||||
public Collection<MetaModelVascBackend> getResultBackends() {
|
||||
return resultBackends.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tables
|
||||
*/
|
||||
public List<String> getTables() {
|
||||
return tables;
|
||||
}
|
||||
|
||||
public void addTable(String table) {
|
||||
tables.add(table);
|
||||
}
|
||||
public void removeTable(String table) {
|
||||
tables.remove(table);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class SchemaAutoEntryElementConfigurator extends AbstractElementConfigura
|
|||
}
|
||||
MetaModelSchemaAutoEntry autoEntry = (MetaModelSchemaAutoEntry)element.getElementObject();
|
||||
VascController vascController = VascParser.getVascController(element.getElementLanguage());
|
||||
autoEntry.autoCreateEntries(vascController);
|
||||
autoEntry.autoFillResult(vascController);
|
||||
autoEntry.autoAddResultToController();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
* 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.ejb3;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
|
||||
/**
|
||||
* VascServiceRemoteBackend wraps VascBasckend to the ejb3 context.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 18 Nov 2012
|
||||
*/
|
||||
public class VascServiceRemoteBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
|
||||
public VascServiceRemoteBackend(VascServiceManager vascManager,String backendId) {
|
||||
if (vascManager==null) {
|
||||
throw new NullPointerException("Can't be remote backend on null VascServiceManager.");
|
||||
}
|
||||
if (backendId==null) {
|
||||
throw new NullPointerException("Can't be remote backend on null backendId.");
|
||||
}
|
||||
this.vascManager=vascManager;
|
||||
this.backendId=backendId;
|
||||
|
||||
}
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
try {
|
||||
field = ((VascEntryFieldLocal)field).clone(); // RM...
|
||||
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> executePageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "executePageSummary", args);
|
||||
return (Map<String, Object>)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "executeTotalSummary", args);
|
||||
return (Map<String, Object>)result;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isReadOnly", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
}
|
|
@ -98,40 +98,28 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
|
|||
// resourceBundle = ResourceBundle.getBundle(value);
|
||||
//}
|
||||
}
|
||||
/*
|
||||
if (entityManager==null) {
|
||||
new NullPointerException("Have no entityManager");
|
||||
}
|
||||
if (xpqlController==null) {
|
||||
new NullPointerException("Have no xpqlController");
|
||||
}*/
|
||||
//if (resourceBundle==null) {
|
||||
// new NullPointerException("Have no resourceBundle");
|
||||
//}
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
|
||||
// get local jvm plugging controller
|
||||
if (vascController==null) {
|
||||
vascController = DefaultVascFactory.getDefaultVascController();
|
||||
}
|
||||
|
||||
for (String key:keys.keySet()) {
|
||||
String value = keys.get(key);
|
||||
if (key.startsWith("load")) {
|
||||
// TODO made reuse working.
|
||||
VascParser vp = new VascParser(vascController);
|
||||
if (xpqlController!=null) {
|
||||
vp.addELBean("xpqlController", new XpqlController());
|
||||
}
|
||||
if (entityManager!=null) {
|
||||
vp.addELBean("entityManagerProvider", new LocalEntityManagerProvider());
|
||||
}
|
||||
vp.parseResource(value);
|
||||
}
|
||||
}
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
|
||||
|
||||
for (String key:keys.keySet()) {
|
||||
String value = keys.get(key);
|
||||
if (key.startsWith("load")) {
|
||||
// TODO made reuse working.
|
||||
VascParser vp = new VascParser(vascController);
|
||||
if (xpqlController!=null) {
|
||||
vp.addELBean("xpqlController", new XpqlController());
|
||||
}
|
||||
if (entityManager!=null) {
|
||||
vp.addELBean("entityManagerProvider", new LocalEntityManagerProvider());
|
||||
}
|
||||
vp.parseResource(value);
|
||||
}
|
||||
}
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
|
||||
long t = System.currentTimeMillis()-s;
|
||||
logger.info("Total loaded vasc entries: "+vascController.getVascEntryController().getVascEntryIds().size()+" in "+t+" ms.");
|
||||
} catch (Exception e) {
|
||||
|
@ -139,56 +127,53 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
|
|||
throw new RuntimeException("Error while init resources error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
|
||||
*/
|
||||
protected Map<String,String> loadKeys() throws IOException {
|
||||
|
||||
Properties properties = new Properties();
|
||||
|
||||
logger.fine("Getting urls");
|
||||
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("META-INF/vasc-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/vasc-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/vasc-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading root namespaces of: "+u+" for: /META-INF/vasc-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.fine("done loading");
|
||||
|
||||
Map<String,String> result = new HashMap<String,String>(20);
|
||||
for (Object key:properties.keySet()) {
|
||||
if (key instanceof String) {
|
||||
String key2 = (String) key;
|
||||
String value = properties.getProperty(key2);
|
||||
result.put(key2, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
|
||||
*/
|
||||
protected Map<String,String> loadKeys() throws IOException {
|
||||
Properties properties = new Properties();
|
||||
logger.fine("Getting urls");
|
||||
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("META-INF/vasc-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/vasc-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/vasc-ejb3.xml");
|
||||
while(e.hasMoreElements()) {
|
||||
URL u = e.nextElement();
|
||||
logger.finer("Loading root namespaces of: "+u+" for: /META-INF/vasc-ejb3.xml");
|
||||
InputStream in = u.openStream();
|
||||
try {
|
||||
properties.loadFromXML(in);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.fine("done loading");
|
||||
|
||||
Map<String,String> result = new HashMap<String,String>(20);
|
||||
for (Object key:properties.keySet()) {
|
||||
if (key instanceof String) {
|
||||
String key2 = (String) key;
|
||||
String value = properties.getProperty(key2);
|
||||
result.put(key2, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
public Map<String,String> getResourceBundle(String locale) {
|
||||
Map<String,String> result = new HashMap<String,String>(resourceBundle.keySet().size());
|
||||
|
@ -199,7 +184,7 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
|
|||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public List<String> getVascEntryIds() {
|
||||
VascController v = getVascController();
|
||||
if (v==null) {
|
||||
|
@ -291,7 +276,7 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public void putAll(Map m) {
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,11 @@ import java.util.Map;
|
|||
abstract public class AbstractVascEntryControllerLocal implements VascEntryControllerLocal {
|
||||
|
||||
private Map<String,VascEntryLocal> entries = null;
|
||||
private Map<String,VascEntryGroupLocal> groups = null;
|
||||
|
||||
public AbstractVascEntryControllerLocal() {
|
||||
entries = new HashMap<String,VascEntryLocal>(1000);
|
||||
entries = Collections.synchronizedMap(new HashMap<String,VascEntryLocal>(1000));
|
||||
groups = Collections.synchronizedMap(new HashMap<String,VascEntryGroupLocal>(100));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,4 +95,74 @@ abstract public class AbstractVascEntryControllerLocal implements VascEntryContr
|
|||
Collections.sort(result); // lets do abc for consistance behauvior.
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryController#getVascEntryByGroupId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public List<String> getVascEntryByGroupId(String groupId) {
|
||||
if (groupId==null) {
|
||||
throw new NullPointerException("Can't search null groupId.");
|
||||
}
|
||||
List<String> result = new ArrayList<String>(40);
|
||||
for (VascEntryLocal entry:entries.values()) {
|
||||
if (groupId.equals(entry.getVascGroupId())) {
|
||||
result.add(entry.getId());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryController#getVascEntryGroupById(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public VascEntryGroup getVascEntryGroupById(String id) {
|
||||
VascEntryGroupLocal result = groups.get(id);
|
||||
if (result==null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return result.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new NullPointerException("Could not clone entry: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryController#getVascEntryGroupIds()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getVascEntryGroupIds() {
|
||||
List<String> result = new ArrayList<String>(groups.keySet());
|
||||
Collections.sort(result); // lets do abc for consistance behauvior.
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascEntryControllerLocal#addVascEntryGroup(net.forwardfire.vasc.core.VascEntryGroupLocal)
|
||||
*/
|
||||
@Override
|
||||
public void addVascEntryGroup(VascEntryGroupLocal group) {
|
||||
if (group==null) {
|
||||
throw new NullPointerException("Can't add null VascEntryGroup.");
|
||||
}
|
||||
if (group.getId()==null) {
|
||||
throw new NullPointerException("Can't add VascEntryGroup with null Id.");
|
||||
}
|
||||
|
||||
// TODO: move
|
||||
if (group.getName()==null) {
|
||||
group.setName("vasc.entry.group."+group.getId()+".name");
|
||||
}
|
||||
if (group.getDescription()==null) {
|
||||
group.setDescription("vasc.entry.group."+group.getId()+".description");
|
||||
}
|
||||
if (group.getImage()==null) {
|
||||
group.setImage("vasc.entry.group."+group.getId()+".image");
|
||||
}
|
||||
//group.getHelpId()
|
||||
|
||||
groups.put(group.getId(), group);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import net.forwardfire.vasc.core.base.AbstractVascBaseIdRoleViewOrderMetaLocal;
|
||||
|
||||
/**
|
||||
* AbstractVascEntryGroupLocal
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 23, 2012
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
abstract public class AbstractVascEntryGroupLocal extends AbstractVascBaseIdRoleViewOrderMetaLocal implements VascEntryGroupLocal {
|
||||
|
||||
@Override
|
||||
public VascEntryGroupLocal clone() throws CloneNotSupportedException {
|
||||
Object clone = cloneCreate();
|
||||
cloneFields(clone);
|
||||
return (VascEntryGroupLocal)clone;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void cloneFields(Object cloneObject) throws CloneNotSupportedException {
|
||||
super.cloneFields(cloneObject);
|
||||
VascEntryGroupLocal clone = (VascEntryGroupLocal)cloneObject;
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -41,7 +41,7 @@ abstract public class AbstractVascEntryLinkLocal extends AbstractVascBaseIdRoleV
|
|||
private String vascEntryId = null;
|
||||
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
|
||||
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
|
||||
private VascEntryLinkType vascLinkEntryType = null;
|
||||
private VascEntryLinkType vascEntryLinkType = null;
|
||||
private String doActionId = null;
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ abstract public class AbstractVascEntryLinkLocal extends AbstractVascBaseIdRoleV
|
|||
VascEntryLinkLocal clone = (VascEntryLinkLocal)cloneObject;
|
||||
clone.setVascEntryId(getVascEntryId());
|
||||
clone.setDoActionId(getDoActionId());
|
||||
clone.setVascLinkEntryType(getVascLinkEntryType());
|
||||
clone.setVascEntryLinkType(getVascEntryLinkType());
|
||||
for (String key:getEntryParameterFieldIdKeys()) {
|
||||
clone.addEntryParameterFieldId(key, getEntryParameterFieldId(key));
|
||||
}
|
||||
|
@ -104,15 +104,15 @@ abstract public class AbstractVascEntryLinkLocal extends AbstractVascBaseIdRoleV
|
|||
/**
|
||||
* @return the vascLinkEntryType
|
||||
*/
|
||||
public VascEntryLinkType getVascLinkEntryType() {
|
||||
return vascLinkEntryType;
|
||||
public VascEntryLinkType getVascEntryLinkType() {
|
||||
return vascEntryLinkType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascLinkEntryType the vascLinkEntryType to set
|
||||
*/
|
||||
public void setVascLinkEntryType(VascEntryLinkType vascLinkEntryType) {
|
||||
this.vascLinkEntryType = vascLinkEntryType;
|
||||
public void setVascEntryLinkType(VascEntryLinkType vascEntryLinkType) {
|
||||
this.vascEntryLinkType = vascEntryLinkType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,8 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
private Boolean vascDisplayOnly = null; // todo rename
|
||||
private Boolean delete = null;
|
||||
private String rolesDelete = null;
|
||||
|
||||
private VascEntryAccessType accessType = null;
|
||||
|
||||
private List<VascEntryFieldLocal> vascFields = null;
|
||||
private List<RowVascActionLocal> rowActions = null;
|
||||
private List<ColumnVascActionLocal> columnActions = null;
|
||||
|
@ -75,8 +76,8 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
private List<GlobalVascActionLocal> exportActions = null;
|
||||
private List<VascEntryFieldSetLocal> vascEntryFieldSets = null;
|
||||
private List<VascEntryLinkLocal> vascEntryLinks = null;
|
||||
|
||||
private Map<String,Object> entryParameters = null;
|
||||
|
||||
private Map<String,Object> entryParameters = null;
|
||||
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
|
||||
private Map<String,List<String>> eventEntryFrontendEventListeners = null;
|
||||
private List<String> eventEntryBackendEventListeners = null;
|
||||
|
@ -85,6 +86,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
private Map<String,List<String>> eventEntryFrontendActions = null;
|
||||
|
||||
private String backendId = null;
|
||||
private String vascGroupId = null;
|
||||
private VascFrontendController vascFrontendData = null;
|
||||
|
||||
public AbstractVascEntryLocal() {
|
||||
|
@ -134,6 +136,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
|
||||
clone.setDelete(getDelete());
|
||||
clone.setRolesDelete(getRolesDelete());
|
||||
clone.setAccessType(getAccessType());
|
||||
|
||||
for (VascEntryFieldLocal field:getVascEntryFieldsLocal()) {
|
||||
VascEntryFieldLocal fieldClone = field.clone();
|
||||
|
@ -185,6 +188,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
}
|
||||
}
|
||||
clone.setBackendId(getBackendId());
|
||||
clone.setVascGroupId(getVascGroupId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -900,4 +904,32 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
public void setVascDisplayOnly(Boolean vascDisplayOnly) {
|
||||
this.vascDisplayOnly = vascDisplayOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascGroupId
|
||||
*/
|
||||
public String getVascGroupId() {
|
||||
return vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascGroupId the vascGroupId to set
|
||||
*/
|
||||
public void setVascGroupId(String vascGroupId) {
|
||||
this.vascGroupId = vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the accessType
|
||||
*/
|
||||
public VascEntryAccessType getAccessType() {
|
||||
return accessType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accessType the accessType to set
|
||||
*/
|
||||
public void setAccessType(VascEntryAccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,11 @@ public interface VascEntry extends VascBaseIdRoleCrud {
|
|||
*/
|
||||
public String getRolesDelete();
|
||||
|
||||
/**
|
||||
* @return the accessType
|
||||
*/
|
||||
public VascEntryAccessType getAccessType();
|
||||
|
||||
/**
|
||||
* @return the vascFields
|
||||
*/
|
||||
|
@ -196,6 +201,8 @@ public interface VascEntry extends VascBaseIdRoleCrud {
|
|||
|
||||
public String getBackendId();
|
||||
|
||||
public String getVascGroupId();
|
||||
|
||||
/**
|
||||
* @return the vascDisplayOnly
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
* 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:
|
||||
|
@ -20,30 +20,22 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
package net.forwardfire.vasc.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuComparator orders the menu group.
|
||||
* The type of a VascEntryAccessType
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 nov 17, 2012
|
||||
* @version 1.0 Nov 25, 2012
|
||||
*/
|
||||
public class VascMenuComparator implements Serializable,Comparator<VascMenu> {
|
||||
public enum VascEntryAccessType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
DIRECT,
|
||||
DIRECT_PARAMETER,
|
||||
ENTRY_LIST,
|
||||
ENTRY_LINK;
|
||||
|
||||
public int compare(VascMenu m1, VascMenu m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
public static VascEntryAccessType DEFAULT_TYPE = VascEntryAccessType.DIRECT;
|
||||
}
|
|
@ -35,4 +35,10 @@ public interface VascEntryController {
|
|||
public VascEntry getVascEntryById(String id);
|
||||
|
||||
public List<String> getVascEntryIds();
|
||||
|
||||
public List<String> getVascEntryByGroupId(String groupId);
|
||||
|
||||
public VascEntryGroup getVascEntryGroupById(String id);
|
||||
|
||||
public List<String> getVascEntryGroupIds();
|
||||
}
|
|
@ -37,4 +37,6 @@ public interface VascEntryControllerLocal extends VascEntryController {
|
|||
public void removeVascEntry(String entryId);
|
||||
|
||||
public VascEntryLocal getMasterVascEntryById(String entryId);
|
||||
|
||||
public void addVascEntryGroup(VascEntryGroupLocal group);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import net.forwardfire.vasc.core.base.VascBaseIdRoleViewOrderMeta;
|
||||
|
||||
/**
|
||||
* VascLinkGroup binds multiple entries as one group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nove 23, 2012
|
||||
*/
|
||||
public interface VascEntryGroup extends VascBaseIdRoleViewOrderMeta {
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import net.forwardfire.vasc.core.base.VascBaseIdRoleViewOrderMetaLocal;
|
||||
|
||||
/**
|
||||
* VascEntryGroupLocal
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 23, 2012
|
||||
*/
|
||||
public interface VascEntryGroupLocal extends VascEntryGroup,VascBaseIdRoleViewOrderMetaLocal {
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public VascEntryGroupLocal clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -51,7 +51,7 @@ public interface VascEntryLink extends VascBaseIdRoleViewOrderMeta {
|
|||
/**
|
||||
* @return the vascLinkEntryType
|
||||
*/
|
||||
public VascEntryLinkType getVascLinkEntryType();
|
||||
public VascEntryLinkType getVascEntryLinkType();
|
||||
|
||||
/**
|
||||
* @return the doActionId
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface VascEntryLinkLocal extends VascEntryLink,VascBaseIdRoleViewOrde
|
|||
/**
|
||||
* @param vascLinkEntryType the vascLinkEntryType to set
|
||||
*/
|
||||
public void setVascLinkEntryType(VascEntryLinkType vascLinkEntryType);
|
||||
public void setVascEntryLinkType(VascEntryLinkType vascLinkEntryType);
|
||||
|
||||
/**
|
||||
* @param doActionId the doActionId to set
|
||||
|
|
|
@ -116,6 +116,11 @@ public interface VascEntryLocal extends VascEntry,VascBaseIdRoleCrudLocal {
|
|||
*/
|
||||
public void setRolesDelete(String rolesDelete);
|
||||
|
||||
/**
|
||||
* @param accessType the accessType to set
|
||||
*/
|
||||
public void setAccessType(VascEntryAccessType accessType);
|
||||
|
||||
/**
|
||||
* @param vascField the vascField to add
|
||||
*/
|
||||
|
@ -221,12 +226,12 @@ public interface VascEntryLocal extends VascEntry,VascBaseIdRoleCrudLocal {
|
|||
*/
|
||||
public Collection<VascEntryLinkLocal> getVascEntryLinksLocal();
|
||||
|
||||
|
||||
public void setVascFrontendController(VascFrontendController vascFrontendData);
|
||||
|
||||
public void setVascFrontendController(VascFrontendController vascFrontendData);
|
||||
|
||||
public void setBackendId(String backendId);
|
||||
|
||||
public void setBackendId(String backendId);
|
||||
|
||||
public void setVascGroupId(String groupId);
|
||||
|
||||
/**
|
||||
* @param vascDisplayOnly the vascDisplayOnly to set
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import net.forwardfire.vasc.core.AbstractVascEntryGroupLocal;
|
||||
|
||||
/**
|
||||
* DefaultVascEntryGroup
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 23, 2012
|
||||
*/
|
||||
public class DefaultVascEntryGroup extends AbstractVascEntryGroupLocal {
|
||||
|
||||
private static final long serialVersionUID = 853182253019347410L;
|
||||
}
|
|
@ -182,8 +182,8 @@ public class VascDefaultsFinalizer implements VascEntryConfigFinalizer {
|
|||
if (vle.getVascEntryId()==null) {
|
||||
throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id);
|
||||
}
|
||||
if (vle.getVascLinkEntryType()==null) {
|
||||
vle.setVascLinkEntryType(VascEntryLinkType.DEFAULT_TYPE);
|
||||
if (vle.getVascEntryLinkType()==null) {
|
||||
vle.setVascEntryLinkType(VascEntryLinkType.DEFAULT_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
result.add(link);
|
||||
continue;
|
||||
}
|
||||
if (type.equals(link.getVascLinkEntryType())) {
|
||||
if (type.equals(link.getVascEntryLinkType())) {
|
||||
result.add(link);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import net.forwardfire.vasc.core.VascEntryConfigController;
|
|||
import net.forwardfire.vasc.core.VascEntryController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldTypeController;
|
||||
import net.forwardfire.vasc.core.VascEntryGroup;
|
||||
import net.forwardfire.vasc.core.VascEventChannelController;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
|
||||
|
@ -139,6 +140,15 @@ public class JndiVascControllerFactory implements ObjectFactory {
|
|||
public VascEntry getVascEntryById(String id) {
|
||||
return entryController.getVascEntryById(id);
|
||||
}
|
||||
public List<String> getVascEntryByGroupId(String groupId) {
|
||||
return entryController.getVascEntryByGroupId(groupId);
|
||||
}
|
||||
public VascEntryGroup getVascEntryGroupById(String id) {
|
||||
return entryController.getVascEntryGroupById(id);
|
||||
}
|
||||
public List<String> getVascEntryGroupIds() {
|
||||
return entryController.getVascEntryGroupIds();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ package net.forwardfire.vasc.impl.x4o;
|
|||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntryController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryGroupLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementConfigurator;
|
||||
|
@ -43,14 +44,22 @@ public class VascEntryElementConfigurator extends AbstractElementConfigurator {
|
|||
* @see org.x4o.xml.element.AbstractElementConfigurator#doConfigEndTag(org.x4o.xml.element.Element)
|
||||
*/
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
VascEntryLocal entry = (VascEntryLocal)element.getElementObject();
|
||||
Object elementObject = element.getElementObject();
|
||||
VascController vascController = VascParser.getVascController(element.getElementLanguage());
|
||||
VascEntryController entryController = vascController.getVascEntryController();
|
||||
|
||||
if (entryController instanceof VascEntryControllerLocal) {
|
||||
((VascEntryControllerLocal)entryController).addVascEntry(entry);
|
||||
if (elementObject instanceof VascEntryLocal) {
|
||||
VascEntryLocal entry = (VascEntryLocal)elementObject;
|
||||
((VascEntryControllerLocal)entryController).addVascEntry(entry);
|
||||
} else if (elementObject instanceof VascEntryGroupLocal) {
|
||||
VascEntryGroupLocal entryGroup = (VascEntryGroupLocal)elementObject;
|
||||
((VascEntryControllerLocal)entryController).addVascEntryGroup(entryGroup);
|
||||
} else {
|
||||
throw new ElementConfiguratorException(this,"ElementObject is unknown instance: "+elementObject);
|
||||
}
|
||||
} else {
|
||||
throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface.");
|
||||
throw new ElementConfiguratorException(this,"Can not run configurator because we have no access to VascEntryControllerLocal interface.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,8 +47,14 @@
|
|||
>
|
||||
|
||||
<!-- Object for building an entry -->
|
||||
<eld:element tag="entryGroup" objectClass="net.forwardfire.vasc.impl.DefaultVascEntryGroup" >
|
||||
<eld:configurator id="entryGroup-VascEntryElementConfigurator" bean.class="net.forwardfire.vasc.impl.x4o.VascEntryElementConfigurator" configAction="true"/>
|
||||
</eld:element>
|
||||
<eld:element tag="entry" objectClass="net.forwardfire.vasc.impl.DefaultVascEntry" >
|
||||
<eld:configurator id="entry-VascEntryElementConfigurator" bean.class="net.forwardfire.vasc.impl.x4o.VascEntryElementConfigurator" configAction="true"/>
|
||||
<eld:attribute name="accessType">
|
||||
<conv:enumConverter enumClass="net.forwardfire.vasc.core.VascEntryAccessType"/>
|
||||
</eld:attribute>
|
||||
</eld:element>
|
||||
<eld:element tag="field" objectClass="net.forwardfire.vasc.impl.DefaultVascEntryField" elementClass="net.forwardfire.vasc.impl.x4o.VascEntryFieldElement">
|
||||
<eld:attribute name="vascEntryFieldType" runBeanFill="false"/>
|
||||
|
|
|
@ -13,5 +13,6 @@
|
|||
<modules>
|
||||
<module>vasc-demo-server-build</module>
|
||||
<module>vasc-demo-server-core</module>
|
||||
<module>vasc-demo-server-build-client-swing</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-server-build-client-swing</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,42 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-server</artifactId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-server-build-client-swing</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-demo-server-build-client-swing</name>
|
||||
<description>vasc-demo-server-build-client-swing</description>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>${maven-assembly-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-clients-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/bin.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-client-swing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2011, Willem Cazander
|
||||
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.
|
||||
-->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
<baseDirectory>vasc-demo-server-build-client-swing-${project.version}</baseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/libs</outputDirectory>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/scripts/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1,38 @@
|
|||
::
|
||||
:: Copyright (c) 2011, Willem Cazander
|
||||
:: 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.
|
||||
::
|
||||
@echo off
|
||||
setlocal enableextensions
|
||||
|
||||
:: Run in app dir
|
||||
cd /d %~dp0
|
||||
|
||||
:: Config variables
|
||||
set JAVA_OPTS=-Xms128m -Xmx512m -XX:MaxPermSize=128m
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.client.swing.VascDemoSwingClient
|
||||
set CP=libs\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
||||
|
||||
endlocal
|
||||
:: EOF
|
|
@ -27,8 +27,8 @@ cd `dirname $0`;
|
|||
|
||||
# Config variables
|
||||
JAVA="java";
|
||||
JAVA_OPTS="-Xms64m -Xmx256m";
|
||||
MAIN_CLASS="net.forwardfire.vasc.demo.server.core.VascTechDemoStartup";
|
||||
JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=128m";
|
||||
MAIN_CLASS="net.forwardfire.vasc.demo.client.swing.VascDemoSwingClient";
|
||||
CP=`echo libs/*.jar | sed 's/ /:/g'`;
|
||||
|
||||
# Launch application
|
|
@ -91,5 +91,11 @@
|
|||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-server-build-client-swing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -50,7 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/scripts/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<outputDirectory>/bin</outputDirectory>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
|
@ -71,5 +71,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<directory>${project.basedir}/target/docs/</directory>
|
||||
<outputDirectory>/docs</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.parent.basedir}/vasc-demo-server-build-client-swing/target/</directory>
|
||||
<outputDirectory>/clients</outputDirectory>
|
||||
<includes>
|
||||
<include>vasc-demo-server-build-client-swing-${project.version}-bin.zip</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -8,14 +8,9 @@
|
|||
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
|
||||
<Listener className="net.forwardfire.vasc.demo.server.tomcat.JndiVascDeployerListener"
|
||||
vascControllerName="vasc/server-tech"
|
||||
scanPath="conf/server-tech"
|
||||
scanPath="conf/vasc.d"
|
||||
scanTime="3"
|
||||
/>
|
||||
<Listener className="net.forwardfire.vasc.demo.server.tomcat.JndiVascDeployerListener"
|
||||
vascControllerName="vasc/server-admin"
|
||||
scanPath="conf/server-admin"
|
||||
scanTime="9"
|
||||
/>
|
||||
<GlobalNamingResources>
|
||||
<!-- Config Vasc Tech Demo -->
|
||||
<Environment name="config/START_GUI" value="true" type="java.lang.Boolean"/>
|
||||
|
@ -36,11 +31,6 @@
|
|||
vascControllerProvider="net.forwardfire.vasc.demo.server.core.VascTechDemoControllerConfig"
|
||||
removeLocal="false"
|
||||
/>
|
||||
<Resource name="vasc/server-admin" auth="Container" type="net.forwardfire.vasc.core.VascController" singleton="true" scope="Shareable"
|
||||
factory="net.forwardfire.vasc.impl.jndi.JndiVascControllerFactory"
|
||||
vascControllerProvider="net.forwardfire.vasc.demo.server.core.VascTechDemoControllerConfig"
|
||||
removeLocal="false"
|
||||
/>
|
||||
</GlobalNamingResources>
|
||||
<Service name="Catalina">
|
||||
<Connector port="8899" protocol="HTTP/1.1" connectionTimeout="5000" redirectPort="9988" />
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
>
|
||||
|
||||
|
||||
<v:entryGroup
|
||||
id="demo-csv"
|
||||
rolesView="login"
|
||||
/>
|
||||
|
||||
<mm:csvDataContext
|
||||
el.id="metaPeopleDS"
|
||||
file="data/demo/meta-people.csv"
|
||||
|
@ -11,10 +16,10 @@
|
|||
<mm:metaModelBackend
|
||||
id="metaPeopleBackend"
|
||||
dataContextProvider="${metaPeopleDS}"
|
||||
table="meta_people"
|
||||
table="meta-people"
|
||||
tableId="id"
|
||||
/>
|
||||
<v:entry id="metaPeople" backendId="metaPeopleBackend">
|
||||
<v:entry id="metaPeople" backendId="metaPeopleBackend" vascGroupId="demo-csv">
|
||||
<v:field id="id" list="false"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="age"/>
|
||||
|
@ -33,10 +38,10 @@
|
|||
<mm:metaModelBackend
|
||||
id="metaProjectBackend"
|
||||
dataContextProvider="${metaProjectDS}"
|
||||
table="meta_project"
|
||||
table="meta-project"
|
||||
tableId="id"
|
||||
/>
|
||||
<v:entry id="metaProject" backendId="metaProjectBackend">
|
||||
<v:entry id="metaProject" backendId="metaProjectBackend" vascGroupId="demo-csv">
|
||||
<v:field id="id" list="false"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" vascEntryFieldType="TextAreaField"/>
|
|
@ -25,12 +25,6 @@
|
|||
</v:entry>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc_pf}" entryPrefix="pf" />
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<td:tomcatResource name="mmdc/mongo/laura" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
|
@ -4,11 +4,15 @@
|
|||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
<v:entryGroup
|
||||
id="tech-admin"
|
||||
rolesView="admin"
|
||||
/>
|
||||
<mm:jndiDataSourceDataContext el.id="DemoManagerDataDC" jndiName="java:jdbc/DemoManagerDataDS" />
|
||||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascUserBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER" tableId="ID" />
|
||||
<v:entry id="AdminVascUser" backendId="AdminVascUserBackend" displayNameFieldId="username">
|
||||
<v:entry id="AdminVascUser" backendId="AdminVascUserBackend" displayNameFieldId="username" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="username" backendName="USERNAME"/>
|
||||
<v:field id="password" backendName="PASSWORD"/>
|
||||
|
@ -17,7 +21,7 @@
|
|||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascUserRoleBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_ROLE" tableId="ID" />
|
||||
<v:entry id="AdminVascUserRole" backendId="AdminVascUserRoleBackend" >
|
||||
<v:entry id="AdminVascUserRole" backendId="AdminVascUserRoleBackend" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="username" backendName="USERNAME" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModel entryId="AdminVascUser" keyFieldId="username"/>
|
||||
|
@ -27,7 +31,7 @@
|
|||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascUserChangeFieldBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_CHANGE_FIELD" tableId="ID" />
|
||||
<v:entry id="AdminVascUserChangeField" backendId="AdminVascUserChangeFieldBackend" adminEditReadOnly="true">
|
||||
<v:entry id="AdminVascUserChangeField" backendId="AdminVascUserChangeFieldBackend" adminEditReadOnly="true" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="field" backendName="FIELD"/>
|
||||
<v:field id="name" backendName="NAME"/>
|
||||
|
@ -36,7 +40,7 @@
|
|||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascUserChangeLogBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_CHANGE_LOG" tableId="ID" />
|
||||
<v:entry id="AdminVascUserChangeLog" backendId="AdminVascUserChangeLogBackend" adminEditReadOnly="true">
|
||||
<v:entry id="AdminVascUserChangeLog" backendId="AdminVascUserChangeLogBackend" adminEditReadOnly="true" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="user_id" backendName="USER_ID" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModel entryId="AdminVascUser" keyFieldId="id"/>
|
||||
|
@ -49,7 +53,7 @@
|
|||
</v:entry>
|
||||
|
||||
<mm:metaModelBackend id="AdminVascPageBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE" tableId="ID" />
|
||||
<v:entry id="AdminVascPage" backendId="AdminVascPageBackend">
|
||||
<v:entry id="AdminVascPage" backendId="AdminVascPageBackend" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="slug" backendName="SLUG"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
|
@ -60,7 +64,7 @@
|
|||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascPagePartBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE_PART" tableId="ID" />
|
||||
<v:entry id="AdminVascPagePart" backendId="AdminVascPagePartBackend">
|
||||
<v:entry id="AdminVascPagePart" backendId="AdminVascPagePartBackend" vascGroupId="tech-admin">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="page_id" backendName="PAGE_ID" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModel entryId="AdminVascPage" keyFieldId="id" displayFieldId="slug"/>
|
||||
|
@ -78,7 +82,7 @@
|
|||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuWebBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_WEB" tableId="ID" />
|
||||
<v:entry id="AdminVascMenuWeb" backendId="AdminVascMenuWebBackend">
|
||||
<v:entry id="AdminVascMenuWeb" backendId="AdminVascMenuWebBackend" vascGroupId="tech-admin">
|
||||
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
|
||||
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType"/>
|
||||
</v:listOption>
|
||||
|
@ -97,31 +101,4 @@
|
|||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuGroupBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_GROUP" tableId="ID" />
|
||||
<v:entry id="AdminVascMenuGroup" backendId="AdminVascMenuGroupBackend">
|
||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||
</v:listOption>
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
<v:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="roles" backendName="ROLES"/>
|
||||
<v:field id="menu_order" backendName="MENU_ORDER" vascEntryFieldType="IntegerField"/>
|
||||
</v:entry>
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU" tableId="ID" />
|
||||
<v:entry id="AdminVascMenu" backendId="AdminVascMenuBackend">
|
||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||
</v:listOption>
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="vascEntryId" backendName="VASC_ENTRY_ID"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
<v:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="roles" backendName="ROLES"/>
|
||||
<v:field id="menu_order" backendName="MENU_ORDER" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="menu_group" backendName="MENU_GROUP">
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
</vasc:root>
|
|
@ -5,6 +5,11 @@
|
|||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
|
||||
<v:entryGroup
|
||||
id="tech-server"
|
||||
rolesView="admin"
|
||||
/>
|
||||
|
||||
<!-- Load jndi factories into tomcat. -->
|
||||
<td:tomcatResource name="mmdc/server/conf/server.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
|
@ -35,10 +40,10 @@
|
|||
<mm:jndiDataContext el.id="mmdc5" jndiName="java:mmdc/server/conf/web.xml"/>
|
||||
|
||||
<!-- Auto config schema from MetaModel backends. -->
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc1}" entryPrefix="AdminConfServer" />
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc2}" entryPrefix="AdminConfLogServer" />
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc3}" entryPrefix="AdminConfLogAccess" />
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc4}" entryPrefix="AdminConfConfig" />
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc5}" entryPrefix="AdminConfWeb" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc1}" entryPrefix="AdminConfServer" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc2}" entryPrefix="AdminConfLogServer" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc3}" entryPrefix="AdminConfLogAccess" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc4}" entryPrefix="AdminConfConfig" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc5}" entryPrefix="AdminConfWeb" />
|
||||
|
||||
</vasc:root>
|
|
@ -25,11 +25,12 @@ setlocal enableextensions
|
|||
|
||||
:: Run in app dir
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
|
||||
:: Config variables
|
||||
set JAVA_OPTS=-Xms64m -Xmx256m
|
||||
set JAVA_OPTS=-Xms128m -Xmx768m -XX:MaxPermSize=256m
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.server.core.VascTechDemoStartup
|
||||
set CP=libs\*
|
||||
set CP=libs\tomcat-el-api-* libs\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Run in app dir
|
||||
cd `dirname $0`/..;
|
||||
|
||||
# Config variables
|
||||
JAVA="java";
|
||||
JAVA_OPTS="-Xms128m -Xmx768m -XX:MaxPermSize=256m";
|
||||
MAIN_CLASS="org.apache.catalina.startup.Bootstrap";
|
||||
CP=`echo libs/tomcat-* | sed 's/ /:/g'`;
|
||||
|
||||
# Launch application
|
||||
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS stop;
|
||||
|
||||
# EOF
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
::
|
||||
:: Copyright (c) 2011, Willem Cazander
|
||||
:: 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.
|
||||
::
|
||||
@echo off
|
||||
setlocal enableextensions
|
||||
|
||||
:: Run in app dir
|
||||
cd /d %~dp0
|
||||
cd ..
|
||||
|
||||
:: Config variables
|
||||
set JAVA_OPTS=-Xms128m -Xmx768m -XX:MaxPermSize=256m
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.server.core.VascTechDemoStartup
|
||||
set CP=libs\tomcat-el-api-* libs\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
||||
|
||||
endlocal
|
||||
:: EOF
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Run in app dir
|
||||
cd `dirname $0`/..;
|
||||
|
||||
# Config variables
|
||||
JAVA="java";
|
||||
JAVA_OPTS="-Xms128m -Xmx768m -XX:MaxPermSize=256m";
|
||||
MAIN_CLASS="net.forwardfire.vasc.demo.server.core.VascTechDemoStartup";
|
||||
CP=`echo libs/tomcat-el-api-* libs/*.jar | sed 's/ /:/g'`;
|
||||
# todo: tomcat-el-api needs loaded before javaee-api for ELResolver config.
|
||||
|
||||
# Launch application
|
||||
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS;
|
||||
|
||||
# EOF
|
||||
|
|
@ -170,11 +170,7 @@
|
|||
<exclusion>
|
||||
<artifactId>myfaces-impl</artifactId>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
</exclusion><!--
|
||||
<exclusion>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
</exclusion> -->
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -205,6 +205,7 @@ public class VascTechDemoStartup {
|
|||
serverConfigService.stop();
|
||||
tomcatService.stop();
|
||||
databaseService.stop();
|
||||
swingGuiService.stop();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("VascTechDemo shutdown in "+(stopTime-startTime)+" ms.");
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -28,22 +28,29 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sun.faces.application.ApplicationAssociate;
|
||||
import com.sun.faces.application.ApplicationResourceBundle;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryGroup;
|
||||
import net.forwardfire.vasc.core.VascEventChannelControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEventControllerListener;
|
||||
import net.forwardfire.vasc.core.VascEventControllerType;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
/**
|
||||
|
@ -127,6 +134,10 @@ public class VascControllerService {
|
|||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
for (String groupId:vascController.getVascEntryController().getVascEntryGroupIds()) {
|
||||
VascEntryGroup veg = vascController.getVascEntryController().getVascEntryGroupById(groupId);
|
||||
keys.putAll(checker.generateMissingKeys(veg));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("data");
|
||||
|
@ -150,6 +161,21 @@ public class VascControllerService {
|
|||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
ResourceBundle.clearCache();
|
||||
|
||||
//ApplicationResourceBundle appBundle = ApplicationAssociate.getCurrentInstance().getResourceBundles().get(RootApplicationBundle.class.getName());
|
||||
//Map<Locale, ResourceBundle> resources = getFieldValue(appBundle, "resources");
|
||||
//resources.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T getFieldValue(Object object, String fieldName) {
|
||||
try {
|
||||
Field field = object.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return (T) field.get(object);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@ import java.util.jar.JarEntry;
|
|||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.ejb.embeddable.EJBContainer;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.apache.catalina.Container;
|
||||
|
|
|
@ -22,23 +22,12 @@
|
|||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
@ -52,25 +41,19 @@ import javax.swing.SwingUtilities;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JConsolePanel extends JPanel implements ActionListener {
|
||||
public class JConsolePanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 485766723433479054L;
|
||||
private UILogHandler logHandler = null;
|
||||
private JButton clearButton = null;
|
||||
private JComboBox levelBox = null;
|
||||
private JTextArea logTextArea = null;
|
||||
private JCheckBox autoScrollBox = null;
|
||||
private int logLinesMax = 255;
|
||||
|
||||
public JConsolePanel() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new SpringLayout());
|
||||
wrap.add(createHeader());
|
||||
wrap.add(createEditor());
|
||||
SpringLayoutGrid.makeCompactGrid(wrap,2,1);
|
||||
add(wrap);
|
||||
|
||||
setLayout(new SpringLayout());
|
||||
setBorder(new JFireBorder("Console Log",this));
|
||||
add(createEditor());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
|
||||
Logger rootLogger = Logger.getAnonymousLogger();
|
||||
while (rootLogger.getParent()!=null) {
|
||||
rootLogger = rootLogger.getParent();
|
||||
|
@ -93,53 +76,14 @@ public class JConsolePanel extends JPanel implements ActionListener {
|
|||
rootLogger.removeHandler(logHandler);
|
||||
}
|
||||
|
||||
private JPanel createHeader() {
|
||||
JPanel result = new JPanel();
|
||||
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
|
||||
result.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
result.add(new JLabel("Log Level"));
|
||||
levelBox = new JComboBox(new Level[] {Level.OFF,Level.SEVERE,Level.WARNING,Level.INFO,Level.FINE,Level.FINER,Level.FINEST,Level.ALL});
|
||||
levelBox.setSelectedItem(Level.INFO);
|
||||
levelBox.addActionListener(this);
|
||||
result.add(levelBox);
|
||||
clearButton = new JButton("Clear");
|
||||
clearButton.addActionListener(this);
|
||||
result.add(clearButton);
|
||||
autoScrollBox = new JCheckBox("Autoscroll");
|
||||
autoScrollBox.setSelected(true);
|
||||
result.add(autoScrollBox);
|
||||
return result;
|
||||
}
|
||||
|
||||
private JPanel createEditor() {
|
||||
JPanel result = new JPanel();
|
||||
result.setBorder(BorderFactory.createLineBorder(Color.BLUE));
|
||||
logTextArea = new JTextArea(5, 80);
|
||||
private JComponent createEditor() {
|
||||
logTextArea = new JTextArea(6, 80);
|
||||
logTextArea.setAutoscrolls(true);
|
||||
logTextArea.setEditable(false);
|
||||
JScrollPane logScrollPane = new JScrollPane(logTextArea);
|
||||
logScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
logScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
logScrollPane.getViewport().setOpaque(false);
|
||||
result.add(logScrollPane);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (clearButton.equals(e.getSource())) {
|
||||
logTextArea.setText("");
|
||||
} else if (levelBox.equals(e.getSource()) && levelBox.getSelectedIndex()!=-1) {
|
||||
Level level = (Level)levelBox.getSelectedItem();
|
||||
logHandler.setLevel(level);
|
||||
Enumeration<String> loggers = LogManager.getLogManager().getLoggerNames();
|
||||
while (loggers.hasMoreElements()) {
|
||||
String name = loggers.nextElement();
|
||||
Logger logger = LogManager.getLogManager().getLogger(name);
|
||||
if (logger!=null && name.contains("pulsefire")) {
|
||||
logger.setLevel(level); // only set pulsefire code loggers
|
||||
}
|
||||
}
|
||||
}
|
||||
JScrollPane scrollPane = new JScrollPane(logTextArea);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
class UILogHandler extends Handler {
|
||||
|
@ -169,9 +113,7 @@ public class JConsolePanel extends JPanel implements ActionListener {
|
|||
String tt = t.substring(l,t.length());
|
||||
logTextArea.setText(tt);
|
||||
}
|
||||
if (autoScrollBox.isSelected()) {
|
||||
logTextArea.setCaretPosition(logTextArea.getText().length());
|
||||
}
|
||||
logTextArea.setCaretPosition(logTextArea.getText().length());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
/**
|
||||
* JFireBorder
|
||||
*
|
||||
* @author Willem Cazander
|
||||
*/
|
||||
public class JFireBorder implements Border,MouseListener {
|
||||
|
||||
private int radius;
|
||||
boolean entered = false;
|
||||
private JComponent comp = null;
|
||||
private String title;
|
||||
static private JFireBorder lastFireBorder = null;
|
||||
private GradientPaint gradientNormal = null;
|
||||
private GradientPaint gradientEntered = null;
|
||||
private int gradientWidth = 0;
|
||||
|
||||
public JFireBorder(String title,JComponent comp) {
|
||||
this.radius = 10;
|
||||
this.comp=comp;
|
||||
this.title = title;
|
||||
comp.addMouseListener(this);
|
||||
}
|
||||
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(getTitleHeight(c)+1, 1, radius-2, 1);
|
||||
}
|
||||
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
int titleHeight = getTitleHeight(c);
|
||||
|
||||
if (gradientWidth!=width) {
|
||||
gradientNormal = null;
|
||||
gradientEntered = null;
|
||||
}
|
||||
gradientWidth = width;
|
||||
|
||||
Color endColor = UIManager.getColor("control");
|
||||
if (endColor==null) {
|
||||
endColor = c.getBackground();
|
||||
}
|
||||
Color startColor = UIManager.getColor("nimbusBorder");
|
||||
if (startColor==null) {
|
||||
startColor = c.getForeground();
|
||||
}
|
||||
|
||||
//BufferedImage titleImage = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);
|
||||
if (gradientNormal==null) {
|
||||
gradientNormal = new GradientPaint(
|
||||
0, 0, startColor,
|
||||
titleHeight*5, width/3,endColor,
|
||||
false);
|
||||
}
|
||||
if (gradientEntered==null) {
|
||||
startColor = UIManager.getColor("nimbusFocus");
|
||||
if (startColor==null) {
|
||||
startColor = c.getForeground();
|
||||
}
|
||||
gradientEntered = new GradientPaint(
|
||||
0, 0, startColor,
|
||||
titleHeight*5, width/3,endColor,
|
||||
false);
|
||||
}
|
||||
if (entered) {
|
||||
g2.setPaint(gradientEntered);
|
||||
} else {
|
||||
g2.setPaint(gradientNormal);
|
||||
}
|
||||
g2.fillRoundRect(x, y, width, titleHeight, radius, radius);
|
||||
g2.fillRect(x,titleHeight/2,radius+1, titleHeight/2);
|
||||
g2.drawRoundRect(x,y,width-1,height-1,radius,radius);
|
||||
|
||||
if (title==null) {
|
||||
return;
|
||||
}
|
||||
Font font = UIManager.getFont("TitledBorder.font");
|
||||
g2.setColor(c.getForeground());
|
||||
FontMetrics metrics = c.getFontMetrics(font);
|
||||
g2.setFont(font);
|
||||
g2.drawString(title,x+8,y+(titleHeight-metrics.getHeight())/2 +metrics.getAscent());
|
||||
}
|
||||
|
||||
protected int getTitleHeight(Component c) {
|
||||
Font font = UIManager.getFont("TitledBorder.font");
|
||||
FontMetrics metrics = c.getFontMetrics(font);
|
||||
return (int)(metrics.getHeight() * 1.40);
|
||||
}
|
||||
|
||||
public GradientPaint getGradient() {
|
||||
if (entered) {
|
||||
return gradientEntered;
|
||||
} else {
|
||||
return gradientNormal;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (entered==true && lastFireBorder==this) {
|
||||
return;
|
||||
}
|
||||
entered = true;
|
||||
if (comp!=null) {
|
||||
comp.repaint();
|
||||
if (lastFireBorder!=null) {
|
||||
lastFireBorder.entered = false;
|
||||
lastFireBorder.comp.repaint();
|
||||
}
|
||||
lastFireBorder = this;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
public class JStartupPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -2880272130103870144L;
|
||||
private JProgressBar bar = null;
|
||||
|
||||
public JStartupPanel() {
|
||||
|
||||
JLabel label = new JLabel("Starting up....");
|
||||
add(label);
|
||||
|
||||
bar = new JProgressBar();
|
||||
add(bar);
|
||||
}
|
||||
}
|
|
@ -22,262 +22,295 @@
|
|||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.Serializable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.ThreadInfo;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.Server;
|
||||
import org.apache.catalina.Service;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.demo.server.ui.load.JLoadDialog;
|
||||
import net.forwardfire.vasc.demo.server.ui.load.JLoadDialog.LoadType;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
* JStatusPanel is the main panel/window of this demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JStatusPanel extends JPanel {
|
||||
public class JStatusPanel extends JPanel implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
private VascControllerService vascManager = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
private JButton stopButton = null;
|
||||
private JButton playButton = null;
|
||||
private JButton shutdownButton = null;
|
||||
private JButton restartButton = null;
|
||||
private JButton importJdbcButton = null;
|
||||
private JButton importMongoButton = null;
|
||||
private JButton importDataFileButton = null;
|
||||
private JButton importDataPathButton = null;
|
||||
private JLabel infoStatus = null;
|
||||
private JLabel infoThreads = null;
|
||||
private JLabel infoWorkers = null;
|
||||
private JLabel infoSessions = null;
|
||||
private JLabel infoHttpPort = null;
|
||||
private JLabel infoVascGroups = null;
|
||||
private JLabel infoVascEntries = null;
|
||||
private JLabel infoVascBackends= null;
|
||||
|
||||
public JStatusPanel() {
|
||||
this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
public JStatusPanel() {
|
||||
setLayout(new SpringLayout());
|
||||
|
||||
JPanel main = new JPanel();
|
||||
main.setLayout(new SpringLayout());
|
||||
main.add(createPanelInfoServer());
|
||||
main.add(createPanelInfoVasc());
|
||||
main.add(createPanelAction());
|
||||
main.add(createPanelImport());
|
||||
SpringLayoutGrid.makeCompactGrid(main, 2,2,0,0,6,6);
|
||||
|
||||
JConsolePanel consolePanel = new JConsolePanel();
|
||||
add(main);
|
||||
add(consolePanel);
|
||||
SpringLayoutGrid.makeCompactGrid(this, 2,1,6,6,0,0);
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
JSplitPane sp0 = createTreeSplit();
|
||||
JPanel sp1 = new JConsolePanel();
|
||||
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
|
||||
bottomSplitPane.setOneTouchExpandable(true);
|
||||
bottomSplitPane.setResizeWeight(0.2);
|
||||
bottomSplitPane.setDividerLocation(700);
|
||||
sp0.setMinimumSize(new Dimension(400, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 150));
|
||||
return bottomSplitPane;
|
||||
}
|
||||
|
||||
private JSplitPane createTreeSplit() {
|
||||
JScrollPane sp0 = createTreePane();
|
||||
JScrollPane sp1 = createContentPane();
|
||||
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
|
||||
treeSplitPane.setOneTouchExpandable(true);
|
||||
treeSplitPane.setResizeWeight(0.7);
|
||||
treeSplitPane.setDividerLocation(200);
|
||||
sp0.setMinimumSize(new Dimension(200, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 400));
|
||||
return treeSplitPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class VascTreeModel extends DefaultTreeModel {
|
||||
public VascTreeModel(TreeNode root) {
|
||||
super(root);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7436681803506994277L;
|
||||
private JPanel createPanelInfoVasc() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Info Vasc",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
infoVascGroups = new JLabel("0");
|
||||
infoVascEntries = new JLabel("0");
|
||||
infoVascBackends = new JLabel("0");
|
||||
|
||||
statusPanel.add(new JLabel("Artifact:"));
|
||||
statusPanel.add(new JLabel("vasc-demo-server-core"));
|
||||
|
||||
statusPanel.add(new JLabel("Version:"));
|
||||
statusPanel.add(new JLabel("0.X.X"));
|
||||
|
||||
statusPanel.add(new JLabel("Groups:"));
|
||||
statusPanel.add(infoVascGroups);
|
||||
|
||||
statusPanel.add(new JLabel("Entries:"));
|
||||
statusPanel.add(infoVascEntries);
|
||||
|
||||
statusPanel.add(new JLabel("Backends:"));
|
||||
statusPanel.add(infoVascBackends);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel, 5, 2);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
private JPanel createPanelInfoServer() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Info Server",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
infoStatus = new JLabel("booting");
|
||||
infoThreads = new JLabel("0");
|
||||
infoWorkers = new JLabel("0");
|
||||
infoSessions = new JLabel("0");
|
||||
infoHttpPort = new JLabel("0");
|
||||
|
||||
statusPanel.add(new JLabel("Running:"));
|
||||
statusPanel.add(infoStatus);
|
||||
|
||||
statusPanel.add(new JLabel("HttpPort:"));
|
||||
statusPanel.add(infoHttpPort);
|
||||
|
||||
statusPanel.add(new JLabel("Threads:"));
|
||||
statusPanel.add(infoThreads);
|
||||
|
||||
statusPanel.add(new JLabel("Workers:"));
|
||||
statusPanel.add(infoWorkers);
|
||||
|
||||
statusPanel.add(new JLabel("Sessions:"));
|
||||
statusPanel.add(infoSessions);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel, 5, 2);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
super.addTreeModelListener(l);
|
||||
private JPanel createPanelImport() {
|
||||
JPanel statusPanel = new JPanel();
|
||||
statusPanel.setBorder(new JFireBorder("Import",statusPanel));
|
||||
statusPanel.setLayout(new SpringLayout());
|
||||
|
||||
importJdbcButton = new JButton("Jdbc");
|
||||
importMongoButton = new JButton("Mongo");
|
||||
importDataFileButton = new JButton("DataFile");
|
||||
importDataPathButton = new JButton("DataPath");
|
||||
|
||||
importJdbcButton.addActionListener(this);
|
||||
importMongoButton.addActionListener(this);
|
||||
importDataFileButton.addActionListener(this);
|
||||
importDataPathButton.addActionListener(this);
|
||||
|
||||
importJdbcButton.setEnabled(false);
|
||||
importMongoButton.setEnabled(false);
|
||||
importDataFileButton.setEnabled(false);
|
||||
importDataPathButton.setEnabled(false);
|
||||
|
||||
statusPanel.add(new JLabel("Import Jdbc:"));
|
||||
statusPanel.add(importJdbcButton);
|
||||
|
||||
statusPanel.add(new JLabel("Import Mongo:"));
|
||||
statusPanel.add(importMongoButton);
|
||||
|
||||
statusPanel.add(new JLabel("Import File:"));
|
||||
statusPanel.add(importDataFileButton);
|
||||
|
||||
statusPanel.add(new JLabel("Data Directory:"));
|
||||
statusPanel.add(importDataPathButton);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(statusPanel,2,4,6,6,0,0);
|
||||
return statusPanel;
|
||||
}
|
||||
|
||||
private JPanel createPanelAction() {
|
||||
JPanel actionPanel = new JPanel();
|
||||
actionPanel.setBorder(new JFireBorder("Actions",actionPanel));
|
||||
actionPanel.setLayout(new SpringLayout());
|
||||
|
||||
actionPanel.add(new JLabel("Catalina:"));
|
||||
|
||||
playButton = new JButton("Play");
|
||||
playButton.setEnabled(false);
|
||||
playButton.addActionListener(this);
|
||||
actionPanel.add(playButton);
|
||||
|
||||
stopButton = new JButton("Stop");
|
||||
stopButton.setEnabled(false);
|
||||
stopButton.addActionListener(this);
|
||||
actionPanel.add(stopButton);
|
||||
|
||||
actionPanel.add(new JLabel("Application:"));
|
||||
|
||||
restartButton = new JButton("Restart");
|
||||
restartButton.setEnabled(false);
|
||||
restartButton.addActionListener(this);
|
||||
actionPanel.add(restartButton);
|
||||
|
||||
shutdownButton = new JButton("Shutdown");
|
||||
shutdownButton.setEnabled(false);
|
||||
shutdownButton.addActionListener(this);
|
||||
actionPanel.add(shutdownButton);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(actionPanel,2,3,6,6,0,0);
|
||||
return actionPanel;
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
infoStatus.setText("running");
|
||||
|
||||
//restartButton.setEnabled(true);
|
||||
shutdownButton.setEnabled(true);
|
||||
|
||||
importJdbcButton.setEnabled(true);
|
||||
importMongoButton.setEnabled(true);
|
||||
//importDataFileButton.setEnabled(true);
|
||||
//importDataPathButton.setEnabled(true);
|
||||
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(shutdownButton)) {
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
} else if (e.getSource().equals(importJdbcButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importMongoButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.MONGODB);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importDataFileButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
} else if (e.getSource().equals(importDataPathButton)) {
|
||||
JLoadDialog dialog = new JLoadDialog(ServerGuiApplication.getInstance().getMainFrame(),LoadType.JDBC);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private JScrollPane createTreePane() {
|
||||
public void updateInfo() {
|
||||
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
if (vc==null) {
|
||||
return;
|
||||
}
|
||||
Server server = VascTechDemoStartup.getInstance().getTomcatService().getServer();
|
||||
if (server==null) {
|
||||
return; // still booting
|
||||
}
|
||||
Service service = server.findService("Catalina");
|
||||
if (service==null) {
|
||||
return;
|
||||
}
|
||||
Context demoContext = VascTechDemoStartup.getInstance().getTomcatService().getApplicationContext();
|
||||
|
||||
vascTree = new JTree(new VascTreeModel(root));
|
||||
vascTree.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
super.mouseClicked(e);
|
||||
if (e.getClickCount() == 2 && vascTree.getSelectionModel().isSelectionEmpty()==false) {
|
||||
try {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)vascTree.getSelectionModel().getSelectionPath().getLastPathComponent();
|
||||
if (node.getUserObject() instanceof String) {
|
||||
return;
|
||||
}
|
||||
VascTreeNode vascNode = (VascTreeNode)node.getUserObject();
|
||||
if (vascNode != null) {
|
||||
if (vascNode.type == VascTreeNodeType.ENTRY) {
|
||||
VascEntryLocal ee = (VascEntryLocal)vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id);
|
||||
vascManager.getVascController().getVascEntryConfigController().configVascFrontendController(vascManager.getVascController(), ee);
|
||||
spi.createNewVascView(ee);
|
||||
}
|
||||
}
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
infoVascGroups.setText(""+vc.getVascEntryController().getVascEntryGroupIds().size());
|
||||
infoVascEntries.setText(""+vc.getVascEntryController().getVascEntryIds().size());
|
||||
infoVascBackends.setText(""+vc.getVascBackendController().getVascBackendIds().size());
|
||||
|
||||
int httpPort = service.findConnectors()[0].getPort();
|
||||
infoHttpPort.setText(""+httpPort);
|
||||
infoThreads.setText(""+Thread.activeCount());
|
||||
|
||||
int sessions = 0;
|
||||
int workers = 0;
|
||||
|
||||
if (demoContext!=null) {
|
||||
sessions = demoContext.getManager().getActiveSessions();
|
||||
}
|
||||
|
||||
ThreadMXBean man = ManagementFactory.getThreadMXBean();
|
||||
ThreadInfo[] infos = man.getThreadInfo(man.getAllThreadIds());
|
||||
for (ThreadInfo info:infos) {
|
||||
if (info.getThreadName()!=null && info.getThreadName().startsWith("http")) {
|
||||
workers++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
infoWorkers.setText(""+workers);
|
||||
infoSessions.setText(""+sessions);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
JMenuItem openXmlItem = new JMenuItem("Import Xml");
|
||||
openXmlItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JPanel treePanel = new JPanel();
|
||||
treePanel.setLayout(new GridLayout(1,0));
|
||||
JScrollPane p = createJScrollPane(treePanel);
|
||||
p.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
p.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
treePanel.add(vascTree);
|
||||
|
||||
rebuildTree();
|
||||
return p;
|
||||
}
|
||||
|
||||
private JScrollPane createContentPane() {
|
||||
JPanel contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayout(1,0));
|
||||
JScrollPane p = createJScrollPane(contentPane);
|
||||
|
||||
tabPane = new JTabbedPane();
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private JScrollPane createJScrollPane(JPanel innerPanel) {
|
||||
JScrollPane scrollPane = new JScrollPane(innerPanel);
|
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.getVerticalScrollBar().setUnitIncrement(10);
|
||||
scrollPane.getHorizontalScrollBar().setUnitIncrement(10);
|
||||
//innerPanel.setParentScrollPane(scrollPane);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
class VascTreeNode implements Serializable {
|
||||
private static final long serialVersionUID = -1177727401194030822L;
|
||||
public VascTreeNode() {}
|
||||
public VascTreeNode(VascTreeNodeType type,String id) { this.type=type;this.id=id; }
|
||||
public VascTreeNode(VascTreeNodeType type,String id,String entryId) { this.type=type;this.id=id;this.entryId=entryId; }
|
||||
VascTreeNodeType type;
|
||||
String id;
|
||||
String entryId;
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
enum VascTreeNodeType {
|
||||
NONE,
|
||||
FIELD_TYPE,
|
||||
BACKEND,
|
||||
ENTRY
|
||||
}
|
||||
|
||||
public void rebuildTree() {
|
||||
|
||||
DefaultMutableTreeNode root = (DefaultMutableTreeNode)vascTree.getModel().getRoot();
|
||||
root.removeAllChildren();
|
||||
|
||||
DefaultMutableTreeNode fieldTypes = new DefaultMutableTreeNode("VascFieldTypes");
|
||||
for (String id:vascManager.getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
|
||||
DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.FIELD_TYPE,id));
|
||||
fieldTypes.add(typeNode);
|
||||
}
|
||||
root.add(fieldTypes);
|
||||
|
||||
DefaultMutableTreeNode backends = new DefaultMutableTreeNode("VascBackends");
|
||||
for (String id:vascManager.getVascController().getVascBackendController().getVascBackendIds()) {
|
||||
DefaultMutableTreeNode backendNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.BACKEND,id));
|
||||
backends.add(backendNode);
|
||||
}
|
||||
root.add(backends);
|
||||
|
||||
DefaultMutableTreeNode entries = new DefaultMutableTreeNode("VascEntries");
|
||||
for (String id:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
//VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(id);
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,id));
|
||||
entries.add(entryNode);
|
||||
/*
|
||||
DefaultMutableTreeNode fields = new DefaultMutableTreeNode("Fields");
|
||||
for (VascEntryField vef:ve.getVascEntryFields()) {
|
||||
DefaultMutableTreeNode vefNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD,vef.getId(),id));
|
||||
fields.add(vefNode);
|
||||
}
|
||||
entryNode.add(fields);
|
||||
|
||||
DefaultMutableTreeNode fieldSets = new DefaultMutableTreeNode("FieldSets");
|
||||
for (VascEntryFieldSet vefs:ve.getVascEntryFieldSets()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vefs.getId(),id));
|
||||
fieldSets.add(vefsNode);
|
||||
}
|
||||
entryNode.add(fieldSets);
|
||||
|
||||
DefaultMutableTreeNode links = new DefaultMutableTreeNode("Links");
|
||||
for (VascLinkEntry vle:ve.getVascLinkEntries()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vle.getId()));
|
||||
links.add(vefsNode);
|
||||
}
|
||||
entryNode.add(links);
|
||||
|
||||
DefaultMutableTreeNode filters = new DefaultMutableTreeNode("Backend Filters");
|
||||
for (VascBackendFilter vbf:ve.getVascBackendFilters()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vbf.getClass().getSimpleName()));
|
||||
filters.add(vefsNode);
|
||||
}
|
||||
entryNode.add(links);
|
||||
|
||||
DefaultMutableTreeNode param = new DefaultMutableTreeNode("Backend Parameters");
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,key));
|
||||
param.add(vefsNode);
|
||||
}
|
||||
entryNode.add(param);
|
||||
|
||||
|
||||
DefaultMutableTreeNode options = new DefaultMutableTreeNode("List Options");
|
||||
for (VascEntryField vef:ve.getListOptions()) {
|
||||
DefaultMutableTreeNode vefsNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY_FIELD_SET,vef.getId()));
|
||||
options.add(vefsNode);
|
||||
}
|
||||
entryNode.add(options);
|
||||
*/
|
||||
}
|
||||
root.add(entries);
|
||||
|
||||
SwingUtilities.updateComponentTreeUI(vascTree);
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void changeEvent() {
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -23,28 +23,32 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.CheckboxMenuItem;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.Menu;
|
||||
import java.awt.Font;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.EventObject;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
import org.jdesktop.application.Application.ExitListener;
|
||||
|
||||
/**
|
||||
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
|
||||
|
@ -54,77 +58,113 @@ import org.jdesktop.application.Application.ExitListener;
|
|||
*/
|
||||
public class ServerGuiApplication extends SingleFrameApplication {
|
||||
|
||||
private Logger logger = null;
|
||||
private JStatusPanel statusPanel = null;
|
||||
private ImageIcon serverIcon = null;
|
||||
|
||||
public ServerGuiApplication() {
|
||||
logger = Logger.getLogger(ServerGuiApplication.class.getName());
|
||||
}
|
||||
|
||||
protected void startup() {
|
||||
addExitListener(new ShutdownManager());
|
||||
installColorsLaF();
|
||||
addExitListener(new CloseWindowExitListener());
|
||||
serverIcon = createImageIcon("/net/forwardfire/vasc/demo/server/ui/resources/icon.png", "Vasc Icon");
|
||||
statusPanel = new JStatusPanel();
|
||||
FrameView mainView = getMainView();
|
||||
|
||||
mainView.setComponent(new JStartupPanel());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(600,200));
|
||||
//mainView.getFrame().setResizable(false);
|
||||
mainView.setComponent(statusPanel);
|
||||
mainView.getFrame().setMinimumSize(new Dimension(640,480));
|
||||
mainView.getFrame().setMaximumSize(new Dimension(800,600));
|
||||
mainView.getFrame().addWindowListener(new UpdateInfoListener());
|
||||
|
||||
show(mainView);
|
||||
|
||||
startSystemTray();
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
getMainFrame().setVisible(false);
|
||||
class UpdateInfoListener extends WindowAdapter {
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
System.out.println("vis: opened -ac");
|
||||
statusPanel.updateInfo();
|
||||
}
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
System.out.println("vis: closed - ac");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CloseWindowExitListener implements ExitListener {
|
||||
@Override
|
||||
public boolean canExit(EventObject event) {
|
||||
if (event!=null && event.getSource().equals(ServerGuiApplication.this)) {
|
||||
return true;
|
||||
} else {
|
||||
ServerGuiApplication.getInstance().getMainFrame().setVisible(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void willExit(EventObject event) {
|
||||
}
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
statusPanel.startupDone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop if requested from service
|
||||
*/
|
||||
public void stop() {
|
||||
exit();
|
||||
//shutdown();
|
||||
exit(new EventObject(this));
|
||||
}
|
||||
|
||||
public ImageIcon getServerIcon() {
|
||||
return serverIcon;
|
||||
}
|
||||
|
||||
static public ServerGuiApplication getInstance() {
|
||||
return getInstance(ServerGuiApplication.class);
|
||||
}
|
||||
|
||||
class ShutdownManager implements ExitListener {
|
||||
public boolean canExit(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
public void willExit(EventObject event) {
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startSystemTray() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
return;
|
||||
}
|
||||
final PopupMenu popup = new PopupMenu();
|
||||
final TrayIcon trayIcon = new TrayIcon(createImage("/net/forwardfire/vasc/demo/server/ui/resources/tray-icon.png", "tray icon"));
|
||||
final TrayIcon trayIcon = new TrayIcon(createImageIcon("/net/forwardfire/vasc/demo/server/ui/resources/tray-icon.png", "tray icon").getImage());
|
||||
final SystemTray tray = SystemTray.getSystemTray();
|
||||
|
||||
MenuItem aboutItem = new MenuItem("About");
|
||||
MenuItem statusItem = new MenuItem("View Status");
|
||||
MenuItem logItem = new MenuItem("View Log");
|
||||
|
||||
|
||||
Menu displayMenu = new Menu("Launch");
|
||||
MenuItem errorItem = new MenuItem("Web client");
|
||||
MenuItem warningItem = new MenuItem("Swing client");
|
||||
MenuItem infoItem = new MenuItem("Swt client");
|
||||
MenuItem noneItem = new MenuItem("None");
|
||||
|
||||
aboutItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(ServerGuiApplication.getInstance().getMainFrame(), "Vasc Demo Tech Server:\nIs build to test and demo different parts of the vasc package.", "About Vasc Demo", JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
});
|
||||
MenuItem statusItem = new MenuItem("Open Status");
|
||||
statusItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getMainFrame().setVisible(true);
|
||||
}
|
||||
});
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
exit();
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
popup.add(aboutItem);
|
||||
popup.addSeparator();
|
||||
popup.add(statusItem);
|
||||
popup.add(logItem);
|
||||
popup.addSeparator();
|
||||
popup.add(displayMenu);
|
||||
displayMenu.add(errorItem);
|
||||
displayMenu.add(warningItem);
|
||||
displayMenu.add(infoItem);
|
||||
displayMenu.add(noneItem);
|
||||
|
||||
popup.add(exitItem);
|
||||
popup.addSeparator();
|
||||
popup.add(aboutItem);
|
||||
popup.add(statusItem);
|
||||
|
||||
trayIcon.setPopupMenu(popup);
|
||||
|
||||
|
@ -135,11 +175,45 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
|||
}
|
||||
}
|
||||
|
||||
protected static Image createImage(String path, String description) {
|
||||
protected static ImageIcon createImageIcon(String path, String description) {
|
||||
URL imageURL = ServerGuiApplication.class.getResource(path);
|
||||
if (imageURL == null) {
|
||||
throw new NullPointerException("Could not find resource: "+path);
|
||||
}
|
||||
return (new ImageIcon(imageURL, description)).getImage();
|
||||
return new ImageIcon(imageURL, description);
|
||||
}
|
||||
|
||||
private String installColorsLaF() {
|
||||
UIManager.put("TabbedPane.font", Font.decode("SansSerif-BOLD-12"));
|
||||
UIManager.put("TitledBorder.font", Font.decode("SansSerif-BOLD-16"));
|
||||
UIManager.put("FireDial.font", Font.decode("SansSerif-9"));
|
||||
|
||||
String colorName = "laf-colors";
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl==null) {
|
||||
cl = this.getClass().getClassLoader();
|
||||
}
|
||||
InputStream in = cl.getResourceAsStream("net/forwardfire/vasc/demo/server/ui/resources/"+colorName+".properties");
|
||||
if (in==null) {
|
||||
logger.warning("Color schema not found: "+colorName);
|
||||
return "unknown";
|
||||
}
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.load(in);
|
||||
for (Object key:p.keySet()) {
|
||||
String value = p.getProperty(key.toString());
|
||||
Color colorValue = Color.decode(value);
|
||||
UIManager.put(key,colorValue);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.warning("Could not load color schema: "+colorName+" error: "+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
return colorName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.eobjects.metamodel.jdbc.JdbcDataContext;
|
||||
import org.eobjects.metamodel.mongodb.MongoDbDataContext;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.JFireBorder;
|
||||
import net.forwardfire.vasc.demo.server.ui.ServerGuiApplication;
|
||||
|
||||
/**
|
||||
* JLoadDialog mini wizzard for loading.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JLoadDialog extends JDialog implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JButton prev = null;
|
||||
private JButton next = null;
|
||||
private JButton cancel = null;
|
||||
private List<LoadStep> steps = null;
|
||||
private int currentStep = 0;
|
||||
private LoadStepData model = null;
|
||||
private JPanel centerPanel = null;
|
||||
private JLabel topLabel = null;
|
||||
|
||||
public enum LoadType {
|
||||
CSV,
|
||||
JDBC,
|
||||
MONGODB
|
||||
}
|
||||
|
||||
public JLoadDialog(Frame aFrame,LoadType type) {
|
||||
setTitle("Load Edit Data");
|
||||
setIconImage(ServerGuiApplication.getInstance().getServerIcon().getImage());
|
||||
setMinimumSize(new Dimension(640,400));
|
||||
setPreferredSize(new Dimension(640,400));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
// mainPanel.setBorder();
|
||||
// mainPanel.setLayout(new SpringLayout());
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
mainPanel.add(createPanelTop(),BorderLayout.PAGE_START);
|
||||
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new GridLayout(1,1));
|
||||
wrap.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
|
||||
centerPanel = new JPanel();
|
||||
//centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
centerPanel.setLayout(new GridLayout(1,1));
|
||||
centerPanel.setBorder(new JFireBorder(null,centerPanel));
|
||||
|
||||
wrap.add(centerPanel);
|
||||
mainPanel.add(wrap,BorderLayout.CENTER);
|
||||
|
||||
model = new LoadStepData();
|
||||
steps = new ArrayList<LoadStep>(10);
|
||||
|
||||
switch(type) {
|
||||
case CSV:
|
||||
break;
|
||||
case JDBC:
|
||||
steps.add(new JLoadStepMetaJdbc());
|
||||
break;
|
||||
case MONGODB:
|
||||
steps.add(new JLoadStepMetaMongodb());
|
||||
break;
|
||||
}
|
||||
steps.add(new JLoadStepSelectTables());
|
||||
steps.add(new JLoadStepMiscInfo());
|
||||
steps.add(new JLoadStepWriteFile());
|
||||
|
||||
centerPanel.add(steps.get(0).getPanel());
|
||||
|
||||
mainPanel.add(createPanelBottom(),BorderLayout.PAGE_END);
|
||||
//SpringLayoutGrid.makeCompactGrid(mainPanel, 3, 1,6,6,6,6);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
|
||||
// clean up connection
|
||||
if (model.dc instanceof JdbcDataContext) {
|
||||
JdbcDataContext dc = (JdbcDataContext)model.dc;
|
||||
try {
|
||||
dc.getConnection().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (model.dc instanceof MongoDbDataContext) {
|
||||
MongoDbDataContext dc = (MongoDbDataContext)model.dc;
|
||||
dc.getMongoDb().getMongo().close();
|
||||
}
|
||||
}
|
||||
|
||||
public JPanel createPanelTop() {
|
||||
JPanel top = new JPanel();
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
top.setLayout(new GridLayout(1,1));
|
||||
JPanel wrap = new JPanel();
|
||||
wrap.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
wrap.setBorder(new JFireBorder("Load",top));
|
||||
topLabel = new JLabel("Load data to edit...");
|
||||
wrap.add(topLabel);
|
||||
top.add(wrap);
|
||||
return top;
|
||||
}
|
||||
|
||||
public JPanel createPanelBottom() {
|
||||
JPanel bottom = new JPanel();
|
||||
bottom.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
|
||||
prev = new JButton("Prev");
|
||||
next = new JButton("Next");
|
||||
cancel = new JButton("Cancel");
|
||||
|
||||
prev.addActionListener(this);
|
||||
next.addActionListener(this);
|
||||
cancel.addActionListener(this);
|
||||
|
||||
prev.setEnabled(false);
|
||||
|
||||
bottom.add(prev);
|
||||
bottom.add(next);
|
||||
bottom.add(cancel);
|
||||
|
||||
return bottom;
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(prev)) {
|
||||
gotoStepPrev();
|
||||
} else if (e.getSource().equals(next)) {
|
||||
gotoStepNext();
|
||||
} if (e.getSource().equals(cancel)) {
|
||||
clearAndHide();
|
||||
}
|
||||
}
|
||||
|
||||
public void gotoStepPrev() {
|
||||
if (currentStep <= 0) {
|
||||
return;
|
||||
}
|
||||
currentStep--;
|
||||
centerPanel.removeAll();
|
||||
LoadStep step = steps.get(currentStep);
|
||||
centerPanel.add(step.getPanel());
|
||||
topLabel.setText(step.getStepTitle());
|
||||
step.setupStep(model);
|
||||
SwingUtilities.updateComponentTreeUI(centerPanel);
|
||||
if (currentStep==0) {
|
||||
prev.setEnabled(false);
|
||||
}
|
||||
next.setText("Next");
|
||||
}
|
||||
|
||||
public void gotoStepNext() {
|
||||
if (currentStep == steps.size()-1) {
|
||||
// perform last step
|
||||
LoadStep step = steps.get(currentStep);
|
||||
boolean result = step.performStep(model);
|
||||
if (result==false) {
|
||||
return;
|
||||
}
|
||||
clearAndHide();
|
||||
return;
|
||||
}
|
||||
if (currentStep > steps.size()-1) {
|
||||
return;
|
||||
}
|
||||
LoadStep step = steps.get(currentStep);
|
||||
boolean result = step.performStep(model);
|
||||
if (result==false) {
|
||||
return;
|
||||
}
|
||||
currentStep++;
|
||||
centerPanel.removeAll();
|
||||
step = steps.get(currentStep);
|
||||
centerPanel.add(step.getPanel());
|
||||
topLabel.setText(step.getStepTitle());
|
||||
step.setupStep(model);
|
||||
SwingUtilities.updateComponentTreeUI(centerPanel);
|
||||
if (currentStep==steps.size()-1) {
|
||||
next.setText("Finish");
|
||||
}
|
||||
prev.setEnabled(true);
|
||||
}
|
||||
}
|
|
@ -20,27 +20,23 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code.
|
||||
|
@ -48,29 +44,21 @@ import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaCsv extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaCsv extends JPanel implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
|
||||
public JDialogMetaCsv(Frame aFrame) {
|
||||
setTitle("Add csv file");
|
||||
public JLoadStepMetaCsv(Frame aFrame) {
|
||||
//setTitle("Add csv file");
|
||||
setMinimumSize(new Dimension(640,480));
|
||||
setPreferredSize(new Dimension(999,666));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
add(mainPanel);
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
|
@ -95,7 +83,7 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
|
|||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(file.getName());
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
}
|
|
@ -20,28 +20,21 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.FlowLayout;
|
||||
import java.sql.Connection;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.eobjects.metamodel.jdbc.JdbcDataContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +43,7 @@ import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaJdbc extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JComboBox driverClassBox = null;
|
||||
|
@ -59,31 +52,19 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
private JTextField passwordField = null;
|
||||
|
||||
|
||||
public JDialogMetaJdbc(Frame aFrame) {
|
||||
setTitle("Add jdbc");
|
||||
setMinimumSize(new Dimension(300,200));
|
||||
setPreferredSize(new Dimension(500,400));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
public JLoadStepMetaJdbc() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
public String getStepTitle() {
|
||||
return "Connect to database.";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
@ -105,32 +86,41 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
passwordField = new JTextField("postgresql");
|
||||
result.add(passwordField);
|
||||
|
||||
JButton fileButton = new JButton("Connect");
|
||||
fileButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String url = connectUrlField.getText();
|
||||
MetaModelDataContextJdbc ds = new MetaModelDataContextJdbc();
|
||||
ds.setDriverClass((String)driverClassBox.getSelectedItem());
|
||||
ds.setConnectUrl(url);
|
||||
ds.setUsername(usernameField.getText());
|
||||
ds.setPassword(passwordField.getText());
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(dbName);
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 5, 2);
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
public void setupStep(LoadStepData model) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
String url = connectUrlField.getText();
|
||||
MetaModelDataContextJdbc ds = new MetaModelDataContextJdbc();
|
||||
ds.setDriverClass((String)driverClassBox.getSelectedItem());
|
||||
ds.setConnectUrl(url);
|
||||
ds.setUsername(usernameField.getText());
|
||||
ds.setPassword(passwordField.getText());
|
||||
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
|
||||
|
||||
try {
|
||||
Connection c = ds.getConnection();
|
||||
c.close();
|
||||
|
||||
if (model.dc instanceof JdbcDataContext) {
|
||||
JdbcDataContext dc = (JdbcDataContext)model.dc;
|
||||
dc.getConnection().close();
|
||||
}
|
||||
|
||||
model.dcProvider = ds;
|
||||
model.dc=ds.getDataContext();
|
||||
model.name=dbName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Fatal connect error:\n"+e.getMessage(), "Jdbc Connect Error", JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -20,65 +20,49 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.eobjects.metamodel.mongodb.MongoDbDataContext;
|
||||
|
||||
import com.mongodb.DB;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JDialogMetaMongodb Add and runs MetaModel Schema Auto Entry code.
|
||||
* JLoadStepMetaMongodb Add and runs MetaModel Schema Auto Entry code.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
||||
public class JLoadStepMetaMongodb extends JPanel implements LoadStep,ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextField hostNameField = null;
|
||||
private JTextField hostPortField = null;
|
||||
private JTextField databaseField = null;
|
||||
|
||||
public JDialogMetaMongodb(Frame aFrame) {
|
||||
setTitle("Add mongodb");
|
||||
setMinimumSize(new Dimension(300,200));
|
||||
setPreferredSize(new Dimension(400,300));
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent we) {
|
||||
clearAndHide();
|
||||
}
|
||||
});
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
//mainPanel.add(createPanelTop(),BorderLayout.NORTH);
|
||||
mainPanel.add(createPanelCenter(),BorderLayout.CENTER);
|
||||
//mainPanel.add(createPanelBottom(),BorderLayout.SOUTH);
|
||||
getContentPane().add(mainPanel);
|
||||
pack();
|
||||
setLocationRelativeTo(aFrame);
|
||||
public JLoadStepMetaMongodb() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public void clearAndHide() {
|
||||
setVisible(false);
|
||||
public String getStepTitle() {
|
||||
return "Connect to mongodb.";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
|
@ -86,7 +70,7 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
result.setLayout(new SpringLayout());
|
||||
|
||||
result.add(new JLabel("Hostname"));
|
||||
hostNameField = new JTextField("localhost");
|
||||
hostNameField = new JTextField("localhost",25);
|
||||
result.add(hostNameField);
|
||||
|
||||
result.add(new JLabel("Port"));
|
||||
|
@ -96,31 +80,45 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
result.add(new JLabel("Database"));
|
||||
databaseField = new JTextField("lefiona");
|
||||
result.add(databaseField);
|
||||
|
||||
JButton fileButton = new JButton("Connect");
|
||||
fileButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
|
||||
ds.setHostname(hostNameField.getText());
|
||||
ds.setPort(new Integer(hostPortField.getText()));
|
||||
ds.setDatabase(databaseField.getText());
|
||||
|
||||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(ds.getDatabase());
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
result.add(new JLabel(""));
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 3, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
|
||||
MetaModelDataContextMongodb ds = new MetaModelDataContextMongodb();
|
||||
ds.setHostname(hostNameField.getText());
|
||||
ds.setPort(new Integer(hostPortField.getText()));
|
||||
ds.setDatabase(databaseField.getText());
|
||||
|
||||
try {
|
||||
DB mongoDB = ds.getMongodbConnection();
|
||||
mongoDB.getMongo().close();
|
||||
|
||||
if (model.dc instanceof MongoDbDataContext) {
|
||||
MongoDbDataContext dc = (MongoDbDataContext)model.dc;
|
||||
dc.getMongoDb().getMongo().close();
|
||||
}
|
||||
|
||||
model.dcProvider = ds;
|
||||
model.dc=ds.getDataContext();
|
||||
model.name=ds.getDatabase();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Fatal connect error:\n"+e.getMessage(), "Jdbc Connect Error", JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JLoadStepMiscInfo
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class JLoadStepMiscInfo extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextField filenameField = null;
|
||||
private JTextField groupIdField = null;
|
||||
private JTextField rolesGroupField = null;
|
||||
private JTextField rolesEntryField = null;
|
||||
|
||||
public JLoadStepMiscInfo() {
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
add(createPanelCenter());
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Info";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel createPanelCenter() {
|
||||
JPanel result = new JPanel();
|
||||
result.setLayout(new SpringLayout());
|
||||
|
||||
filenameField = new JTextField();
|
||||
groupIdField = new JTextField();
|
||||
rolesGroupField = new JTextField();
|
||||
rolesEntryField = new JTextField();
|
||||
|
||||
result.add(new JLabel("Filename:"));
|
||||
result.add(filenameField);
|
||||
result.add(new JLabel("groupId:"));
|
||||
result.add(groupIdField);
|
||||
result.add(new JLabel("rolesGroup:"));
|
||||
result.add(rolesGroupField);
|
||||
result.add(new JLabel("rolesEntry:"));
|
||||
result.add(rolesEntryField);
|
||||
|
||||
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
filenameField.setText(model.name+".xml");
|
||||
groupIdField.setText(model.name);
|
||||
rolesGroupField.setText("login,admin");
|
||||
rolesEntryField.setText("login,admin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
model.filename = filenameField.getText();
|
||||
model.groupId = groupIdField.getText();
|
||||
model.rolesGroup = rolesGroupField.getText();
|
||||
model.rolesEntry = rolesEntryField.getText();
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
|
||||
/**
|
||||
* JLoadStepSelectTables select tables to load.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 9, 2012
|
||||
*/
|
||||
public class JLoadStepSelectTables extends JPanel implements LoadStep {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTable table = null;
|
||||
private MetaModelTableModel tableModel = null;
|
||||
private DataContext dcOld = null;
|
||||
|
||||
public JLoadStepSelectTables() {
|
||||
setLayout(new SpringLayout());
|
||||
add(createPanelCenter());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Tables";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JComponent createPanelCenter() {
|
||||
tableModel = new MetaModelTableModel();
|
||||
table = new JTable(tableModel);
|
||||
table.setFillsViewportHeight(true);
|
||||
table.setShowHorizontalLines(true);
|
||||
table.setAutoscrolls(true);
|
||||
//((JComponent) table.getDefaultRenderer(Boolean.class)).setOpaque(true);// let backgroup color work correctly
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
if (model.tables.isEmpty() | (dcOld!=null && dcOld!=model.dc)) {
|
||||
tableModel.setData(Arrays.asList(model.dc.getDefaultSchema().getTableNames()));
|
||||
dcOld = model.dc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
model.tables.clear();
|
||||
for (TableRow row:tableModel.getData()) {
|
||||
if (row.load) {
|
||||
model.tables.add(row.table);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class TableRow {
|
||||
String table;
|
||||
boolean load = true;
|
||||
}
|
||||
|
||||
class MetaModelTableModel extends AbstractTableModel {
|
||||
|
||||
private static final long serialVersionUID = 5487313677918103654L;
|
||||
private List<TableRow> data = new ArrayList<TableRow>();
|
||||
|
||||
public void setData(List<String> tables) {
|
||||
data.clear();
|
||||
for (String table:tables) {
|
||||
TableRow row = new TableRow();
|
||||
row.table=table;
|
||||
data.add(row);
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public List<TableRow> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (columnIndex==0) {
|
||||
return String.class;
|
||||
} else {
|
||||
return Boolean.class;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
if (columnIndex==0) {
|
||||
return "TableName";
|
||||
} else {
|
||||
return "Import";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
TableRow row = data.get(rowIndex);
|
||||
if (columnIndex==0) {
|
||||
return row.table;
|
||||
} else {
|
||||
return new Boolean(row.load);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return columnIndex>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object value, int rowIndex, int columnIndex) {
|
||||
if (columnIndex==1) {
|
||||
TableRow row = data.get(rowIndex);
|
||||
if (value instanceof Boolean) {
|
||||
row.load = (Boolean)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import org.x4o.xml.sax.XMLWriter;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.ui.SpringLayoutGrid;
|
||||
|
||||
/**
|
||||
* JLoadStepWriteFile writes the file.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class JLoadStepWriteFile extends JPanel implements LoadStep,ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -8638394652416472734L;
|
||||
private JTextArea text = null;
|
||||
|
||||
public JLoadStepWriteFile() {
|
||||
setLayout(new SpringLayout());
|
||||
add(createPanelCenter());
|
||||
SpringLayoutGrid.makeCompactGrid(this, 1, 1, 6, 6, 6, 6);
|
||||
}
|
||||
|
||||
public String getStepTitle() {
|
||||
return "Select Tables";
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public JComponent createPanelCenter() {
|
||||
text = new JTextArea(13,45);
|
||||
text.setAutoscrolls(true);
|
||||
JScrollPane scrollPane = new JScrollPane(text);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setupStep(LoadStepData model) {
|
||||
try {
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
StringWriter out = new StringWriter();
|
||||
XMLWriter outXml = new XMLWriter(out);
|
||||
LoadVascXmlWriter writer = new LoadVascXmlWriter(outXml,vc);
|
||||
writer.writeXml(model);
|
||||
|
||||
text.setText(out.getBuffer().toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performStep(LoadStepData model) {
|
||||
|
||||
try {
|
||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
||||
File tmpFile = new File("conf/vasc.d/"+model.filename);// File.createTempFile("vasc","xml");
|
||||
System.out.println("write to : "+tmpFile);
|
||||
Writer out = new OutputStreamWriter(new FileOutputStream(tmpFile));
|
||||
XMLWriter outXml = new XMLWriter(out);
|
||||
LoadVascXmlWriter writer = new LoadVascXmlWriter(outXml,vc);
|
||||
writer.writeXml(model);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
* 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:
|
||||
|
@ -20,30 +20,24 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuGroupComparator orders the menu group.
|
||||
* LoadStep are the load wizzard steps.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 nov 17, 2012
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class VascMenuGroupComparator implements Serializable,Comparator<VascMenuGroup> {
|
||||
package net.forwardfire.vasc.demo.server.ui.load;
|
||||
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public interface LoadStep {
|
||||
|
||||
JPanel getPanel();
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
String getStepTitle();
|
||||
|
||||
public int compare(VascMenuGroup m1, VascMenuGroup m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
}
|
||||
void setupStep(LoadStepData model);
|
||||
|
||||
boolean performStep(LoadStepData model);
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
|
||||
|
||||
/**
|
||||
* LoadStepData Simple model to load wizzard steps.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class LoadStepData {
|
||||
|
||||
public String name = null;
|
||||
public MetaModelDataContextProvider dcProvider = null;
|
||||
public DataContext dc = null;
|
||||
|
||||
public String filename = null;
|
||||
public String groupId = null;
|
||||
public String rolesGroup = null;
|
||||
public String rolesEntry = null;
|
||||
public List<String> tables = new ArrayList<String>();
|
||||
|
||||
}
|
|
@ -0,0 +1,242 @@
|
|||
/*
|
||||
* 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.demo.server.ui.load;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldType;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.DefaultHandler2;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* LoadVascXmlWriter writes the xml tags.
|
||||
* note: need to move this to x4o
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 22, 2012
|
||||
*/
|
||||
public class LoadVascXmlWriter {
|
||||
|
||||
private VascController vc = null;
|
||||
private DefaultHandler2 xmlWriter = null;
|
||||
|
||||
static private final String URI_VASC_ROOT = "http://vasc.forwardfire.net/xml/ns/vasc-root";
|
||||
static private final String URI_VASC_LANG = "http://vasc.forwardfire.net/xml/ns/vasc-lang";
|
||||
static private final String URI_META_MODEL = "http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel";
|
||||
static private final String URI_VASC_DEMO = "http://vasc.forwardfire.net/xml/ns/vasc-tech-demo";
|
||||
|
||||
public LoadVascXmlWriter(DefaultHandler2 xmlWriter,VascController vc) {
|
||||
this.xmlWriter=xmlWriter;
|
||||
this.vc=vc;
|
||||
}
|
||||
|
||||
public void writeXml(LoadStepData model) throws SAXException {
|
||||
|
||||
MetaModelSchemaAutoEntry autoEntry = new MetaModelSchemaAutoEntry();
|
||||
autoEntry.setVascGroupId(model.groupId);
|
||||
autoEntry.setEntryPrefix(model.name);
|
||||
autoEntry.setDataContextProvider(model.dcProvider);
|
||||
autoEntry.getTables().addAll(model.tables);
|
||||
|
||||
autoEntry.autoFillResult(vc);
|
||||
|
||||
xmlWriter.startDocument();
|
||||
|
||||
char[] msg;
|
||||
msg = "\n".toCharArray();
|
||||
xmlWriter.ignorableWhitespace(msg,0,msg.length);
|
||||
|
||||
xmlWriter.startPrefixMapping("vasc", URI_VASC_ROOT);
|
||||
xmlWriter.startPrefixMapping("v", URI_VASC_LANG);
|
||||
xmlWriter.startPrefixMapping("mm", URI_META_MODEL);
|
||||
xmlWriter.startPrefixMapping("td", URI_VASC_DEMO);
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
xmlWriter.startElement (URI_VASC_ROOT, "root", "", atts);
|
||||
|
||||
msg = "Auto generated vasc xml example.".toCharArray();
|
||||
xmlWriter.comment(msg,0,msg.length);
|
||||
|
||||
writeGroup(model.groupId,model.rolesGroup);
|
||||
writeMetaProvider(model);
|
||||
|
||||
for (MetaModelVascBackend vb:autoEntry.getResultBackends()) {
|
||||
writeEntryBackend(vb,model);
|
||||
}
|
||||
for (VascEntry ve:autoEntry.getResultEntries()) {
|
||||
writeEntry(ve,model);
|
||||
}
|
||||
|
||||
|
||||
xmlWriter.endElement(URI_VASC_ROOT, "root", "");
|
||||
xmlWriter.endDocument();
|
||||
}
|
||||
|
||||
private void writeMetaProvider(LoadStepData model) throws SAXException {
|
||||
AttributesImpl atts = null;
|
||||
if (model.dcProvider instanceof MetaModelDataContextMongodb) {
|
||||
MetaModelDataContextMongodb mongo = (MetaModelDataContextMongodb)model.dcProvider;
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "el.id", "", "", model.name+"DC");
|
||||
if (mongo.getHostname()!=null) {
|
||||
atts.addAttribute ("", "hostname", "", "", mongo.getHostname());
|
||||
}
|
||||
if (mongo.getDatabase()!=null) {
|
||||
atts.addAttribute ("", "database", "", "", mongo.getDatabase());
|
||||
}
|
||||
if (mongo.getUsername()!=null) {
|
||||
atts.addAttribute ("", "username", "", "", mongo.getUsername());
|
||||
}
|
||||
if (mongo.getPassword()!=null) {
|
||||
atts.addAttribute ("", "password", "", "", mongo.getPassword());
|
||||
}
|
||||
atts.addAttribute ("", "port", "", "", ""+mongo.getPort());
|
||||
|
||||
xmlWriter.startElement (URI_META_MODEL, "mongodbDataContext", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "mongodbDataContext", "");
|
||||
|
||||
} else if (model.dcProvider instanceof MetaModelDataContextJdbc) {
|
||||
MetaModelDataContextJdbc jdbc = (MetaModelDataContextJdbc)model.dcProvider;
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "name", "", "", "jdbc/load/"+model.name+"DS");
|
||||
atts.addAttribute ("", "auth", "", "", "Container");
|
||||
atts.addAttribute ("", "type", "", "", "javax.sql.DataSource");
|
||||
atts.addAttribute ("", "factory", "", "", "org.apache.tomcat.jdbc.pool.DataSourceFactory");
|
||||
atts.addAttribute ("", "initialSize", "", "", "1");
|
||||
atts.addAttribute ("", "minIdle", "", "", "1");
|
||||
atts.addAttribute ("", "username", "", "", jdbc.getUsername());
|
||||
atts.addAttribute ("", "password", "", "", jdbc.getPassword());
|
||||
atts.addAttribute ("", "driverClassName", "", "", jdbc.getDriverClass());
|
||||
atts.addAttribute ("", "url", "", "", jdbc.getConnectUrl());
|
||||
xmlWriter.startElement (URI_VASC_DEMO, "tomcatResource", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_DEMO, "tomcatResource", "");
|
||||
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "el.id", "", "", model.name+"DC");
|
||||
atts.addAttribute ("", "jndiName", "", "", "java:jdbc/load/"+model.name+"DS");
|
||||
xmlWriter.startElement (URI_META_MODEL, "jndiDataSourceDataContext", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "jndiDataSourceDataContext", "");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeGroup(String groupId,String roles) throws SAXException {
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", groupId);
|
||||
atts.addAttribute ("", "rolesView", "", "", roles);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "entryGroup", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "entryGroup", "");
|
||||
}
|
||||
|
||||
private void writeEntryBackend(MetaModelVascBackend vb,LoadStepData model) throws SAXException {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", vb.getId());
|
||||
atts.addAttribute ("", "dataContextProvider", "", "", "${"+model.name+ "DC}");
|
||||
atts.addAttribute ("", "table", "", "", vb.getTable());
|
||||
atts.addAttribute ("", "tableId", "", "", vb.getTableId());
|
||||
|
||||
xmlWriter.startElement (URI_META_MODEL, "metaModelBackend", "", atts);
|
||||
xmlWriter.endElement(URI_META_MODEL, "metaModelBackend", "");
|
||||
}
|
||||
|
||||
private void writeEntry(VascEntry ve,LoadStepData model) throws SAXException {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", ve.getId());
|
||||
atts.addAttribute ("", "backendId", "", "", ve.getBackendId());
|
||||
atts.addAttribute ("", "primaryKeyFieldId", "", "", ve.getPrimaryKeyFieldId());
|
||||
if (ve.getDisplayNameFieldId()!=null) {
|
||||
atts.addAttribute ("", "displayNameFieldId", "", "", ve.getDisplayNameFieldId());
|
||||
}
|
||||
if (ve.getVascGroupId()!=null) {
|
||||
atts.addAttribute ("", "vascGroupId", "", "", ve.getVascGroupId());
|
||||
}
|
||||
if (ve.getAccessType()!=null) {
|
||||
atts.addAttribute ("", "accessType", "", "", ve.getAccessType().name());
|
||||
}
|
||||
xmlWriter.startElement (URI_VASC_LANG, "entry", "", atts);
|
||||
createFields(ve);
|
||||
|
||||
for (VascEntryLink vel:ve.getVascEntryLinks()) {
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", vel.getId());
|
||||
if (vel.getVascEntryLinkType()!=null && vel.getVascEntryLinkType()!=VascEntryLinkType.DEFAULT_TYPE) {
|
||||
atts.addAttribute ("", "vascEntryLinkType", "", "", ""+vel.getVascEntryLinkType());
|
||||
}
|
||||
atts.addAttribute ("", "vascEntryId", "", "", vel.getVascEntryId());
|
||||
xmlWriter.startElement (URI_VASC_LANG, "link", "", atts);
|
||||
|
||||
for (String key:vel.getEntryParameterFieldIdKeys()) {
|
||||
String value = vel.getEntryParameterFieldId(key);
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "name", "", "", key);
|
||||
atts.addAttribute ("", "valueFieldId", "", "", value);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "linkParameter", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "linkParameter", "");
|
||||
}
|
||||
xmlWriter.endElement(URI_VASC_LANG, "link", "");
|
||||
}
|
||||
xmlWriter.endElement(URI_VASC_LANG, "entry", "");
|
||||
}
|
||||
|
||||
private void createFields(VascEntry ve) throws SAXException {
|
||||
for (VascEntryField f:ve.getVascEntryFields()) {
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "id", "", "", f.getId());
|
||||
VascEntryFieldType type = f.getVascEntryFieldType();
|
||||
if (type!=null) {
|
||||
atts.addAttribute ("", "vascEntryFieldType", "", "", type.getId());
|
||||
}
|
||||
if (f.getEditReadOnly()!=null) {
|
||||
atts.addAttribute ("", "editReadOnly", "", "", ""+f.getEditReadOnly());
|
||||
}
|
||||
//atts.addAttribute ("", "vascGroupId", "", "", model.groupId);
|
||||
xmlWriter.startElement (URI_VASC_LANG, "field", "", atts);
|
||||
|
||||
if (type!=null && "ListField".equals(type.getId())) {
|
||||
VascSelectItemModelEntry link = (VascSelectItemModelEntry)type.getDataObject();
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "entryId", "", "", ""+link.getEntryId());
|
||||
atts.addAttribute ("", "displayFieldId", "", "", ""+link.getDisplayFieldId());
|
||||
xmlWriter.startElement (URI_VASC_LANG, "vascSelectItemModel", "", atts);
|
||||
xmlWriter.endElement(URI_VASC_LANG, "vascSelectItemModel", "");
|
||||
}
|
||||
|
||||
|
||||
xmlWriter.endElement(URI_VASC_LANG, "field", "");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,27 +63,6 @@ CREATE INDEX vasc_page_part_page_id_idx ON vasc_page_part(page_id);
|
|||
CREATE INDEX vasc_page_part_active_idx ON vasc_page_part(active);
|
||||
CREATE INDEX vasc_page_part_sitemap_idx ON vasc_page_part(sitemap);
|
||||
|
||||
|
||||
CREATE TABLE vasc_menu_group (
|
||||
id varchar not null primary key,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
);
|
||||
CREATE INDEX vasc_menu_group_active_idx ON vasc_menu_group(active);
|
||||
|
||||
CREATE TABLE vasc_menu (
|
||||
id IDENTITY not null primary key,
|
||||
vasc_entry_id varchar not null,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
menu_group varchar not null
|
||||
);
|
||||
CREATE INDEX vasc_menu_active_idx ON vasc_menu(active);
|
||||
|
||||
CREATE TABLE vasc_menu_web (
|
||||
id IDENTITY not null primary key,
|
||||
href varchar not null,
|
||||
|
@ -135,22 +114,6 @@ INSERT INTO vasc_page_part VALUES(10,6, 'metamodel','', TRUE,TRUE,TRUE,3,'WIKI',
|
|||
|
||||
-- INSERT INTO vasc_page VALUES(1, 'home','home','Welcome to the vasc demo, please login as admin to view all stuff.');
|
||||
|
||||
INSERT INTO vasc_menu_group VALUES('demo', 'Demo',true,'',1);
|
||||
INSERT INTO vasc_menu_group VALUES('meta', 'Meta',true,'',2);
|
||||
|
||||
INSERT INTO vasc_menu VALUES(1,'metaPeople', 'People', true,'',1,'meta');
|
||||
INSERT INTO vasc_menu VALUES(2,'metaProjects', 'Projects',true,'',2,'meta');
|
||||
|
||||
INSERT INTO vasc_menu VALUES(3,'AdminVascUser', 'Users', true,'',1,'demo');
|
||||
INSERT INTO vasc_menu VALUES(4,'AdminVascUserRole', 'UserRole',true,'',2,'demo');
|
||||
INSERT INTO vasc_menu VALUES(5,'AdminVascUserChangeField','ChangeField', true,'',3,'demo');
|
||||
INSERT INTO vasc_menu VALUES(6,'AdminVascUserChangeLog', 'ChangeLog',true,'',4,'demo');
|
||||
INSERT INTO vasc_menu VALUES(7,'AdminVascPage', 'Pages', true,'',5,'demo');
|
||||
INSERT INTO vasc_menu VALUES(8,'AdminVascPagePart', 'PagesPart',true,'',6,'demo');
|
||||
INSERT INTO vasc_menu VALUES( 9,'AdminVascMenuWeb', 'MenuWeb', true,'',7,'demo');
|
||||
INSERT INTO vasc_menu VALUES(10,'AdminVascMenuGroup', 'MenuGroup',true,'',8,'demo');
|
||||
INSERT INTO vasc_menu VALUES(11,'AdminVascMenu', 'Menu', true,'',9,'demo');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(1, '/html/index.jsf','Home', '',true,'',1,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
|
||||
|
|
|
@ -29,7 +29,7 @@ Application.homepage = http://vasc.forwardfire.org/
|
|||
Application.vendorId = vasc
|
||||
Application.id = vascdemotech
|
||||
Application.lookAndFeel = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
|
||||
#Application.icon = images/icon.png
|
||||
Application.icon = icon.png
|
||||
|
||||
Application.web.meta.robots = index, follow
|
||||
Application.web.meta.description = Vasc Tech Demo Web Frontends
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 264 B |
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# Default dark red color thema for pulsefire
|
||||
#
|
||||
text=#DF0A0A
|
||||
info=#370A00
|
||||
control=#0A1428
|
||||
nimbusBase=#00050A
|
||||
nimbusFocus=#0A6428
|
||||
nimbusOrange=#00960A
|
||||
nimbusBorder=#34415E
|
||||
nimbusDisabledText=#850F0F
|
||||
nimbusLightBackground=#050A28
|
Binary file not shown.
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 400 B |
|
@ -28,6 +28,11 @@
|
|||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
|
|
|
@ -27,27 +27,10 @@ import java.awt.Dimension;
|
|||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
|
@ -60,32 +43,22 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
|||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
import net.forwardfire.vasc.annotations.VascModelReference;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendController;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryConfigControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceRemoteBackend;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascController;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
|
@ -96,199 +69,23 @@ import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
|||
public class JMainPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
//private VascControllerService vascManager = null;
|
||||
private VascController vc = null;
|
||||
private VascMenuController vmc = null;
|
||||
private VascServiceManager vsm = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
|
||||
|
||||
public JMainPanel(VascServiceManager vsm,VascMenuController vmc) {
|
||||
//this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
this.vsm = vsm;
|
||||
this.vmc = vmc;
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
|
||||
vc = createVascController(vsm);
|
||||
|
||||
//vascManager.addVascServiceListener(this);
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
setLayout(new BorderLayout());
|
||||
add(createTreeSplit(), BorderLayout.CENTER);
|
||||
|
||||
public RemoteVascBackend(String backendId,VascServiceManager vascManager) {
|
||||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
field = ((VascEntryFieldLocal)field).clone(); // RM...
|
||||
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
vc = createVascController(vsm);
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,7 +98,8 @@ public class JMainPanel extends JPanel {
|
|||
|
||||
// get local jvm plugging controller
|
||||
VascController c = DefaultVascFactory.getDefaultVascController();
|
||||
|
||||
|
||||
((VascEntryConfigControllerLocal)c.getVascEntryConfigController()).setResourceBundle(RootApplicationBundle.class.getName());
|
||||
/*
|
||||
DefaultVascEntryController con = new DefaultVascEntryController() {
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
|
@ -323,7 +121,7 @@ public class JMainPanel extends JPanel {
|
|||
for (String id:entryIds) {
|
||||
VascEntryLocal ve = (VascEntryLocal)vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
VascBackend vb = new VascServiceRemoteBackend(vascManager,backendId);
|
||||
|
||||
/*
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
|
@ -360,32 +158,18 @@ public class JMainPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
JSplitPane sp0 = createTreeSplit();
|
||||
JPanel sp1 = new JPanel();//JConsolePanel();
|
||||
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
|
||||
bottomSplitPane.setOneTouchExpandable(true);
|
||||
bottomSplitPane.setResizeWeight(0.2);
|
||||
bottomSplitPane.setDividerLocation(700);
|
||||
sp0.setMinimumSize(new Dimension(400, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 150));
|
||||
return bottomSplitPane;
|
||||
}
|
||||
|
||||
private JSplitPane createTreeSplit() {
|
||||
JScrollPane sp0 = createTreePane();
|
||||
JScrollPane sp1 = createContentPane();
|
||||
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
|
||||
treeSplitPane.setOneTouchExpandable(true);
|
||||
treeSplitPane.setResizeWeight(0.7);
|
||||
treeSplitPane.setDividerLocation(200);
|
||||
treeSplitPane.setResizeWeight(0.2);
|
||||
treeSplitPane.setDividerLocation(170);
|
||||
sp0.setMinimumSize(new Dimension(200, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 400));
|
||||
return treeSplitPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class VascTreeModel extends DefaultTreeModel {
|
||||
public VascTreeModel(TreeNode root) {
|
||||
super(root);
|
||||
|
@ -450,9 +234,9 @@ public class JMainPanel extends JPanel {
|
|||
JScrollPane p = createJScrollPane(contentPane);
|
||||
|
||||
tabPane = new JTabbedPane();
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
spi = new SwingPanelTabbed(tabPane);
|
||||
contentPane.add(tabPane);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -500,9 +284,9 @@ public class JMainPanel extends JPanel {
|
|||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.GROUP,group.getTitle()));
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.GROUP,VascDemoSwingClient.getInstance().i18n(group.getTitleKey())));
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,vm.getVascEntryId()));
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,VascDemoSwingClient.getInstance().i18n(vm.getTitleKey())));
|
||||
groupNode.add(entryNode);
|
||||
}
|
||||
root.add(groupNode);
|
||||
|
|
|
@ -24,22 +24,14 @@ package net.forwardfire.vasc.demo.client.swing;
|
|||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
|
||||
|
||||
/**
|
||||
* JMainPanelMenuBar Adds all menu bar items.
|
||||
|
@ -50,85 +42,73 @@ import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
|||
public class JMainPanelMenuBar extends JMenuBar implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -2828428804621352725L;
|
||||
private VascMenuController vmc = null;
|
||||
private JMainPanel mainPanel = null;
|
||||
private List<JMenu> vascMenus = null;
|
||||
//private List<JMenu> vascMenus = null;
|
||||
private JMenu clientFileMenu = null;
|
||||
private JMenu clientTabMenu = null;
|
||||
|
||||
public JMainPanelMenuBar(VascMenuController vmc,JMainPanel mainPanel) {
|
||||
this.vmc=vmc;
|
||||
this.mainPanel=mainPanel;
|
||||
|
||||
clientFileMenu = new JMenu("File");
|
||||
add(clientFileMenu);
|
||||
|
||||
JMenuItem logoutItem = new JMenuItem("Logout");
|
||||
logoutItem.addActionListener(new ActionListener() {
|
||||
JMenuItem logoutItem = new JMenuItem("Logout");
|
||||
logoutItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
/*
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
*/
|
||||
VascDemoSwingClient.getInstance().logout();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientFileMenu.add(logoutItem);
|
||||
clientFileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
});
|
||||
clientFileMenu.add(logoutItem);
|
||||
clientFileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascDemoSwingClient.getInstance().exit();
|
||||
}
|
||||
});
|
||||
clientFileMenu.add(exitItem);
|
||||
|
||||
});
|
||||
clientFileMenu.add(exitItem);
|
||||
|
||||
/*
|
||||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
JMenu menu = new JMenu(group.getTitle());
|
||||
JMenu menu = new JMenu(group.getTitleKey());
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
JMenuItem item = new JMenuItem(vm.getTitle());
|
||||
JMenuItem item = new JMenuItem(vm.getTitleKey());
|
||||
item.putClientProperty("vascEntryId", vm.getVascEntryId());
|
||||
item.addActionListener(this);
|
||||
menu.add(item);
|
||||
}
|
||||
add(menu);
|
||||
}
|
||||
*/
|
||||
|
||||
clientTabMenu = new JMenu("Tabs");
|
||||
add(clientTabMenu);
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
if (tabPane.getSelectedIndex()>=0) {
|
||||
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientTabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
});
|
||||
clientTabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
for (int i=tabPane.getTabCount();i>0;i--) {
|
||||
tabPane.removeTabAt(i-1); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
});
|
||||
clientTabMenu.add(itemAll);
|
||||
});
|
||||
clientTabMenu.add(itemAll);
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
|
@ -148,66 +128,4 @@ public class JMainPanelMenuBar extends JMenuBar implements ActionListener {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private void createMenuItems() {
|
||||
JMenuItem openXmlItem = new JMenuItem("Import Xml");
|
||||
openXmlItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
fileMenu.add(openXmlItem);
|
||||
//JMenuItem closeXmlItem = new JMenuItem("Close");
|
||||
//fileMenu.add(closeXmlItem);
|
||||
fileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//JApplication.getInstance().exit();
|
||||
}
|
||||
});
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
JMenuItem connectVascItem = new JMenuItem("Add Vasc");
|
||||
connectVascItem.setEnabled(false);
|
||||
connectVascItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectVascItem);
|
||||
|
||||
JMenuItem connectLdapItem = new JMenuItem("Add Ldap");
|
||||
connectLdapItem.setEnabled(false);
|
||||
vascMenu.add(connectLdapItem);
|
||||
vascMenu.addSeparator();
|
||||
|
||||
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
|
||||
removeEntryItem.setEnabled(false);
|
||||
removeEntryItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeEntryItem);
|
||||
|
||||
|
||||
|
||||
|
||||
tabMenu.add(itemAll);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
/*
|
||||
* 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.demo.client.swing;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -20,63 +33,58 @@ import java.util.logging.Logger;
|
|||
import javax.naming.CommunicationException;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingException;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.login.LoginContext;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserController;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
/**
|
||||
* VascDemoSwingClient is the main swing remote client.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 10, 2012
|
||||
*/
|
||||
public class VascDemoSwingClient extends SingleFrameApplication {
|
||||
|
||||
private static VascDemoSwingClient instance = null;
|
||||
static protected Context context = null;
|
||||
static protected LoginContext loginContext = null;
|
||||
private Logger logger = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
/*
|
||||
instance = new VascDemoSwingClient();
|
||||
instance.initialize(args);
|
||||
instance.startup();
|
||||
*/
|
||||
Application.launch(VascDemoSwingClient.class, new String[] {});
|
||||
}
|
||||
|
||||
static public VascDemoSwingClient getInstance() {
|
||||
return (VascDemoSwingClient)SingleFrameApplication.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startup() {
|
||||
|
||||
logger = Logger.getLogger(VascDemoSwingClient.class.getName());
|
||||
createContext();
|
||||
try {
|
||||
setJaasConfig();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
doLogin();
|
||||
|
||||
|
||||
JdniTreePrinter printer = new JdniTreePrinter(false);
|
||||
StringBuffer buf = new StringBuffer();
|
||||
printer.printJNDITree(context, "", buf);
|
||||
System.out.println(buf);
|
||||
|
||||
VascServiceManager vc = null;
|
||||
LoginUserController luc = null;
|
||||
ClientUserController cuc = null;
|
||||
VascMenuController vmc = null;
|
||||
try {
|
||||
vc = (VascServiceManager)context.lookup("vascServiceManagerRemote");
|
||||
System.out.println("ob: "+vc);
|
||||
|
||||
luc = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
System.out.println("fll: "+luc.doClientLogin());
|
||||
cuc = (ClientUserController)context.lookup("clientUserControllerRemote");
|
||||
System.out.println("fll: "+cuc.doClientLogin());
|
||||
|
||||
// i18n fixme !!
|
||||
RootApplicationBundle bundle = (RootApplicationBundle)ResourceBundle.getBundle(RootApplicationBundle.class.getName());
|
||||
bundle.addBundleData(cuc.getResourceBundle(bundle.getLocale()));
|
||||
|
||||
vmc = (VascMenuController)context.lookup("vascMenuControllerRemote");
|
||||
} catch (Exception e) {
|
||||
|
@ -86,126 +94,48 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
JMainPanel mainPanel = new JMainPanel(vc,vmc);
|
||||
SingleFrameApplication a = (VascDemoSwingClient)getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
|
||||
mainView.getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
mainView.setComponent(mainPanel);
|
||||
mainView.setMenuBar(new JMainPanelMenuBar(vmc,mainPanel));
|
||||
mainView.getFrame().setSize(600, 800);
|
||||
mainView.getFrame().setSize(1000, 600);
|
||||
mainView.getFrame().setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created an context to the showplanner server.
|
||||
*/
|
||||
private void createContext() {
|
||||
Properties props = new Properties();
|
||||
String connectUrl = "http://localhost:8899/demo/ejb"; //System.getProperty("javaws.connecturl");
|
||||
logger.info("Connecting to: "+connectUrl);
|
||||
props.put(Context.PROVIDER_URL, connectUrl );
|
||||
props.put("openejb.authentication.realmName", "vasc-auth-server");
|
||||
props.put(Context.SECURITY_PRINCIPAL,"admin");
|
||||
props.put(Context.SECURITY_CREDENTIALS,"admin123");
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
|
||||
public void logout() {
|
||||
SingleFrameApplication a = (VascDemoSwingClient)getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
mainView.getFrame().setVisible(false);
|
||||
|
||||
try {
|
||||
context = new InitialContext(props);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//logger.log(Level.WARNING,e.getMessage(),e);
|
||||
//ExceptionDialog err = new ExceptionDialog(e,true);
|
||||
//err.showOpenDialog(null,i18n(VascDemoSwingClient.class,"dialogTitle"),i18n(VascDemoSwingClient.class,"dialogContext"));
|
||||
}
|
||||
startup(); // ugly ..
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets our jaas config path
|
||||
*/
|
||||
private void setJaasConfig() throws IOException {
|
||||
|
||||
// tomee
|
||||
String path = System.getProperty("java.security.auth.login.config");
|
||||
if (path == null) {
|
||||
URL url = VascDemoSwingClient.class.getClassLoader().getResource("META-INF/client.login.conf");
|
||||
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
String urlString = "file:"+tempFile.getAbsolutePath();
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
logger.info("Setting jaas config property to url: "+urlString);
|
||||
/*
|
||||
if (resource != null) {
|
||||
path = URLDecoder.decode(resource.getFile());
|
||||
System.setProperty("java.security.auth.login.config", path);
|
||||
|
||||
} else {
|
||||
logger.warning("Could not find client.login.conf");
|
||||
}*/
|
||||
}
|
||||
|
||||
/* jboss
|
||||
URL url = Thread.currentThread().getContextClassLoader().getResource("META-INF/jaas.config");
|
||||
String urlString = url.toExternalForm();
|
||||
|
||||
// jdk1.6 update10 has different classloader, so just copy for the moment..... ..
|
||||
if (urlString.startsWith("jar:")) {
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
urlString = "file:"+tempFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
*/
|
||||
}
|
||||
|
||||
private void copyFile(InputStream in, File out) throws IOException {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(1024*4);
|
||||
byte[] bufferArray = buffer.array();
|
||||
FileChannel outputChannel = new FileOutputStream(out).getChannel();
|
||||
while (true) {
|
||||
buffer.clear();
|
||||
int lim = in.read(bufferArray);
|
||||
if (lim < 0) {
|
||||
break; // could not read anymore
|
||||
}
|
||||
buffer.flip();
|
||||
buffer.limit(lim);
|
||||
while (buffer.hasRemaining()) {
|
||||
outputChannel.write(buffer);
|
||||
}
|
||||
}
|
||||
outputChannel.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do an login on the server
|
||||
*/
|
||||
private void doLogin() {
|
||||
VascDemoUserLoginDialog loginHandler = new VascDemoUserLoginDialog();
|
||||
try {
|
||||
loginContext = new LoginContext("vasc-auth-client", loginHandler);
|
||||
loginContext.login();
|
||||
loginHandler.setConnectUrl("http://localhost:8899/demo");
|
||||
/*
|
||||
try {
|
||||
loginContext = new LoginContext("vasc-auth-client", loginHandler);
|
||||
loginContext.login();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, i18n(this,"dialogNoLoginContext"),i18n(this,"dialogTitle"), JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
try {
|
||||
// Subject subject = loginContext.getSubject();
|
||||
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
loginHandler.handle();
|
||||
if(doLoginContext(loginHandler)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -234,25 +164,45 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if we have 'login' role on server.
|
||||
* Create naming context and check if we have 'login' role on server.
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean doLoginTest() throws Exception {
|
||||
private boolean doLoginContext(VascDemoUserLoginDialog loginHandler) throws Exception {
|
||||
Properties props = new Properties();
|
||||
String connectUrl = loginHandler.getConnectUrl()+"/ejb";
|
||||
logger.info("Connecting to: "+connectUrl);
|
||||
props.put(Context.PROVIDER_URL, connectUrl );
|
||||
props.put("openejb.authentication.realmName", "vasc-auth-server");
|
||||
props.put(Context.SECURITY_PRINCIPAL,loginHandler.getUsername());
|
||||
props.put(Context.SECURITY_CREDENTIALS,loginHandler.getPassword());
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
|
||||
try {
|
||||
LoginUserController loginManager = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
loginManager.doClientLogin();
|
||||
return true;
|
||||
context = new InitialContext(props);
|
||||
ClientUserController loginManager = (ClientUserController)context.lookup("clientUserControllerRemote");
|
||||
loginManager.doClientLogin();
|
||||
return true;
|
||||
} catch (javax.naming.NameNotFoundException e) {
|
||||
JOptionPane.showMessageDialog(null, "Server is not deployed.\nPlease wait a couple of minuts and try again.");
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Server error: "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Server error: "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String i18n(Object obj,String key,Object...params) {
|
||||
if(obj==null) { throw new NullPointerException("Can't get key of null obj"); }
|
||||
if (key==null) { throw new NullPointerException("key may not be null"); }
|
||||
if(obj instanceof Class) {
|
||||
key=((Class<?>)obj).getName()+"."+key;
|
||||
} else {
|
||||
key=obj.getClass().getName()+"."+key;
|
||||
}
|
||||
return i18n(key,params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some simple hardcoded i18n function here
|
||||
*
|
||||
|
@ -260,102 +210,16 @@ public class VascDemoSwingClient extends SingleFrameApplication {
|
|||
* @param params
|
||||
* @return
|
||||
*/
|
||||
static protected String i18n(Object obj,String key,Object...params) {
|
||||
if(obj==null) { throw new NullPointerException("Can't get key of null obj"); }
|
||||
if (key==null) { throw new NullPointerException("key may not be null"); }
|
||||
if(obj instanceof Class) {
|
||||
key=((Class<?>)obj).getName()+"."+key;
|
||||
} else {
|
||||
key=obj.getClass().getName()+"."+key;
|
||||
}
|
||||
return key;
|
||||
/*
|
||||
public String i18n(String key,Object...params) {
|
||||
try {
|
||||
String text = ResourceBundle.getBundle("resources.i18n.root").getString(key);
|
||||
String text = ResourceBundle.getBundle(RootApplicationBundle.class.getName()).getString(key);
|
||||
if (params != null) {
|
||||
MessageFormat mf = new MessageFormat(text);
|
||||
text = mf.format(params, new StringBuffer(), null).toString();
|
||||
}
|
||||
return text;
|
||||
} catch(MissingResourceException e){
|
||||
return "MISSING: '"+key+"'";
|
||||
return key;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class JdniTreePrinter {
|
||||
|
||||
boolean printXml = true;
|
||||
|
||||
public JdniTreePrinter(boolean printXml) {
|
||||
this.printXml=printXml;
|
||||
}
|
||||
|
||||
public void printJNDITree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
if (printXml) {
|
||||
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
buf.append("<NamingRoot name=\""+ct+"\">\n");
|
||||
}
|
||||
printTree(context,ct,buf);
|
||||
if (printXml) {
|
||||
buf.append("</NamingRoot>\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void printTree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
try {
|
||||
printNE(context,context.list(ct), ct,buf);
|
||||
} catch (NamingException e) {
|
||||
//ignore leaf node exception
|
||||
}
|
||||
}
|
||||
|
||||
private void printNE(javax.naming.Context context,javax.naming.NamingEnumeration<?> ne, String parentctx,StringBuffer buf) throws NamingException {
|
||||
if (ne==null) {
|
||||
return;
|
||||
}
|
||||
while (ne.hasMoreElements()) {
|
||||
NameClassPair next = (NameClassPair) ne.nextElement();
|
||||
if (printXml) {
|
||||
printIndent(buf);
|
||||
buf.append("<NamingRoot name=\""+next.getName()+"\" className=\""+next.getClassName()+"\">\n");
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
|
||||
printIndent(buf);
|
||||
buf.append("</NamingRoot>\n");
|
||||
} else {
|
||||
printEntry(next,buf);
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printEntry(javax.naming.NameClassPair next,StringBuffer buf) {
|
||||
printIndent(buf);
|
||||
buf.append("-->");
|
||||
buf.append(next);
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
|
||||
private int indentLevel = 0;
|
||||
|
||||
private void increaseIndent() {
|
||||
indentLevel += 4;
|
||||
}
|
||||
|
||||
private void decreaseIndent() {
|
||||
indentLevel -= 4;
|
||||
}
|
||||
|
||||
private void printIndent(StringBuffer buf) {
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
buf.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,27 @@
|
|||
/*
|
||||
* @(#)DialogCallbackHandler.java 1.9 03/12/19
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
* 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.demo.client.swing;
|
||||
|
||||
import javax.security.auth.callback.Callback;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.callback.ConfirmationCallback;
|
||||
import javax.security.auth.callback.NameCallback;
|
||||
import javax.security.auth.callback.PasswordCallback;
|
||||
import javax.security.auth.callback.TextOutputCallback;
|
||||
import javax.security.auth.callback.UnsupportedCallbackException;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
|
@ -59,14 +66,15 @@ import javax.swing.JTextField;
|
|||
*
|
||||
* @see javax.security.auth.callback
|
||||
*/
|
||||
public class VascDemoUserLoginDialog implements CallbackHandler {
|
||||
public class VascDemoUserLoginDialog {
|
||||
|
||||
/* The parent window, or null if using the default parent */
|
||||
private Component parentComponent;
|
||||
private static final int JPasswordFieldLen = 8;
|
||||
private int loginTry = 0;
|
||||
private String userName = null;
|
||||
|
||||
private String connectUrl = null;
|
||||
private String username = null;
|
||||
private String password = null;
|
||||
|
||||
/**
|
||||
* Creates a callback dialog with the default parent window.
|
||||
*/
|
||||
|
@ -93,15 +101,9 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handles the specified set of callbacks.
|
||||
*
|
||||
* @param callbacks
|
||||
* the callbacks to handle
|
||||
* @throws UnsupportedCallbackException
|
||||
* if the callback is not an instance of NameCallback or
|
||||
* PasswordCallback
|
||||
* Handles the login dialog
|
||||
*/
|
||||
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
|
||||
public void handle() {
|
||||
this.loginTry++;
|
||||
/* Collect messages to display in the dialog */
|
||||
final JPanel loginDesign = new JPanel();
|
||||
|
@ -110,32 +112,28 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
final JPanel logoPanel = new JPanel() {
|
||||
private static final long serialVersionUID = 10l;
|
||||
protected void paintComponent(Graphics g) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
// for antialiasing geometric shapes
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// for antialiasing text
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// to go for quality over speed
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
|
||||
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
|
||||
|
||||
// Paint the default look of the panel.
|
||||
super.paintComponent(g2d);
|
||||
super.paintComponent(g2d);
|
||||
|
||||
int offsetX = 0; // for windows systems
|
||||
int offsetX = 0; // for windows systems
|
||||
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1;
|
||||
if (isWindows) {
|
||||
offsetX += 25;
|
||||
}
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.fillRect(0,0,getWidth(),getHeight());
|
||||
g2d.setColor(new Color(238,212,1));
|
||||
|
||||
//int w = (getWidth()/2)-(logoImage.getWidth(null)/2);
|
||||
//int h = (getHeight()/2)-(logoImage.getHeight(null)/2);
|
||||
//g2d.drawImage(logoImage, w, h, this);
|
||||
}
|
||||
//int w = (getWidth()/2)-(logoImage.getWidth(null)/2);
|
||||
//int h = (getHeight()/2)-(logoImage.getHeight(null)/2);
|
||||
//g2d.drawImage(logoImage, w, h, this);
|
||||
}
|
||||
};
|
||||
logoPanel.setPreferredSize(new Dimension(200, 170));
|
||||
logoPanel.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
||||
|
@ -148,92 +146,64 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
loginDesign.add(namePanel);
|
||||
loginDesign.add(Box.createVerticalStrut(5));
|
||||
|
||||
final GridLayout messagesLayout = new GridLayout(2,2);
|
||||
final GridLayout messagesLayout = new GridLayout(3,2);
|
||||
final JPanel messages = new JPanel();
|
||||
messages.setLayout(messagesLayout);
|
||||
|
||||
/* Collection actions to perform if the user clicks OK */
|
||||
final List<Action> okActions = new ArrayList<Action>(2);
|
||||
ConfirmationInfo confirmation = new ConfirmationInfo();
|
||||
|
||||
// Add server field
|
||||
JLabel serverName = new JLabel("Server:");
|
||||
final JTextField serverField = new JTextField(getConnectUrl());
|
||||
messages.add(serverName);
|
||||
messages.add(serverField);
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
connectUrl = serverField.getText();
|
||||
}
|
||||
});
|
||||
|
||||
// hackje for focus
|
||||
final JTextField name = new JTextField();
|
||||
confirmation.initialValue=name;
|
||||
final JPasswordField pass = new JPasswordField(JPasswordFieldLen);
|
||||
|
||||
for (int i = 0; i < callbacks.length; i++) {
|
||||
if (callbacks[i] instanceof TextOutputCallback) {
|
||||
TextOutputCallback tc = (TextOutputCallback) callbacks[i];
|
||||
|
||||
switch (tc.getMessageType()) {
|
||||
case TextOutputCallback.INFORMATION:
|
||||
confirmation.messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.WARNING:
|
||||
confirmation.messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.ERROR:
|
||||
confirmation.messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized message type");
|
||||
}
|
||||
messages.add(new JLabel(tc.getMessage()));
|
||||
|
||||
} else if (callbacks[i] instanceof NameCallback) {
|
||||
final NameCallback nc = (NameCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(nc.getPrompt());
|
||||
String defaultName = nc.getDefaultName();
|
||||
|
||||
// if (check some property)
|
||||
defaultName = "";
|
||||
if (defaultName != null) {
|
||||
name.setText(defaultName);
|
||||
}
|
||||
// default to last user name
|
||||
if (userName !=null ) {
|
||||
name.setText(userName);
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(name);
|
||||
|
||||
/* Store the name back into the callback if OK */
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
nc.setName(name.getText());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof PasswordCallback) {
|
||||
final PasswordCallback pc = (PasswordCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(pc.getPrompt());
|
||||
|
||||
final JPasswordField password = new JPasswordField(JPasswordFieldLen);
|
||||
if (!pc.isEchoOn()) {
|
||||
password.setEchoChar('*');
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(password);
|
||||
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
pc.setPassword(password.getPassword());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof ConfirmationCallback) {
|
||||
ConfirmationCallback cc = (ConfirmationCallback) callbacks[i];
|
||||
|
||||
confirmation.setCallback(cc);
|
||||
if (cc.getPrompt() != null) {
|
||||
messages.add(new JLabel(cc.getPrompt()));
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
|
||||
}
|
||||
JLabel prompt = new JLabel("Username:");
|
||||
String defaultName = null;
|
||||
|
||||
// if (check some property)
|
||||
defaultName = "";
|
||||
if (defaultName != null) {
|
||||
name.setText(defaultName);
|
||||
}
|
||||
// default to last user name
|
||||
if (username !=null ) {
|
||||
name.setText(username);
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(name);
|
||||
|
||||
/* Store the name back into the callback if OK */
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
username = name.getText();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
prompt = new JLabel("Password:");
|
||||
|
||||
//if (!pc.isEchoOn()) {
|
||||
pass.setEchoChar('*');
|
||||
//}
|
||||
messages.add(prompt);
|
||||
messages.add(pass);
|
||||
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
password = new String(pass.getPassword());
|
||||
}
|
||||
});
|
||||
|
||||
if (this.loginTry>1) {
|
||||
JPanel messagesPanel = new JPanel();
|
||||
|
@ -251,25 +221,17 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
loginDesign.add(messagesPanel);
|
||||
/* Display the dialog */
|
||||
|
||||
Object[] options = null;
|
||||
/// JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
|
||||
JOptionPane jop = new JOptionPane(loginDesign, JOptionPane.PLAIN_MESSAGE,confirmation.optionType,null,
|
||||
confirmation.options,confirmation.initialValue);
|
||||
JOptionPane jop = new JOptionPane(loginDesign, JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,null,options,name);
|
||||
|
||||
JDialog dialog = jop.createDialog(parentComponent,"Vasc Demo Login");
|
||||
|
||||
// We alway request focus after the windows gets focus
|
||||
dialog.addWindowFocusListener(new WindowFocusListener() {
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowGainedFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowGainedFocus(WindowEvent arg0) {
|
||||
//System.out.println("request focus window focus");
|
||||
name.requestFocus();
|
||||
name.requestFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowLostFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowLostFocus(WindowEvent arg0) {
|
||||
}
|
||||
});
|
||||
|
@ -299,10 +261,7 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
// is null when escaping by window closing
|
||||
result = JOptionPane.CANCEL_OPTION;
|
||||
}
|
||||
|
||||
// copy user name for next try
|
||||
userName = name.getText();
|
||||
|
||||
|
||||
/* Perform the OK actions */
|
||||
if (result == JOptionPane.OK_OPTION || result == JOptionPane.YES_OPTION) {
|
||||
Iterator<Action> iterator = okActions.iterator();
|
||||
|
@ -312,97 +271,34 @@ public class VascDemoUserLoginDialog implements CallbackHandler {
|
|||
} else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.NO_OPTION) {
|
||||
System.exit(1);
|
||||
}
|
||||
confirmation.handleResult(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Provides assistance with translating between JAAS and Swing confirmation
|
||||
* dialogs.
|
||||
* @return the username
|
||||
*/
|
||||
private static class ConfirmationInfo {
|
||||
|
||||
private int[] translations;
|
||||
|
||||
int optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
Object[] options = null;
|
||||
Object initialValue = null;
|
||||
|
||||
int messageType = JOptionPane.QUESTION_MESSAGE;
|
||||
|
||||
private ConfirmationCallback callback;
|
||||
|
||||
/* Set the confirmation callback handler */
|
||||
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException {
|
||||
this.callback = callback;
|
||||
|
||||
int confirmationOptionType = callback.getOptionType();
|
||||
switch (confirmationOptionType) {
|
||||
case ConfirmationCallback.YES_NO_OPTION:
|
||||
optionType = JOptionPane.YES_NO_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.YES_NO_CANCEL_OPTION:
|
||||
optionType = JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION,
|
||||
ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.OK_CANCEL_OPTION:
|
||||
optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION,
|
||||
ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.UNSPECIFIED_OPTION:
|
||||
options = callback.getOptions();
|
||||
/*
|
||||
* There's no way to know if the default option means to
|
||||
* cancel the login, but there isn't a better way to guess
|
||||
* this.
|
||||
*/
|
||||
translations = new int[] {
|
||||
JOptionPane.CLOSED_OPTION, callback.getDefaultOption()
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized option type: " + confirmationOptionType);
|
||||
}
|
||||
|
||||
int confirmationMessageType = callback.getMessageType();
|
||||
switch (confirmationMessageType) {
|
||||
case ConfirmationCallback.WARNING:
|
||||
messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.ERROR:
|
||||
messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.INFORMATION:
|
||||
messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized message type: " + confirmationMessageType);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process the result returned by the Swing dialog */
|
||||
void handleResult(int result) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < translations.length; i += 2) {
|
||||
if (translations[i] == result) {
|
||||
result = translations[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
callback.setSelectedIndex(result);
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the connectUrl
|
||||
*/
|
||||
public String getConnectUrl() {
|
||||
return connectUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connectUrl the connectUrl to set
|
||||
*/
|
||||
public void setConnectUrl(String connectUrl) {
|
||||
this.connectUrl = connectUrl;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
vasc-auth-client {
|
||||
org.apache.openejb.client.ClientLoginModule required
|
||||
debug=true
|
||||
openejb.server.uri="http://localhost:8899/demo/ejb";
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
config.charset=UTF-8
|
||||
config.bundles=bundle1
|
||||
#,bundle2
|
||||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.client.swing.resources.VascDemoSwingClient
|
||||
|
||||
#bundle2.uri=data/vasc-bundle.properties
|
||||
#bundle2.type=FILE
|
||||
#bundle2.optional=true
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Application's properties
|
||||
Application.name = Vasc Demo Tech
|
||||
Application.title = VascDemoTech
|
||||
Application.vendor = Willem Cazander
|
||||
Application.homepage = http://vasc.forwardfire.org/
|
||||
Application.vendorId = vasc
|
||||
Application.id = vascdemotech
|
||||
Application.lookAndFeel = com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
|
||||
#Application.icon = images/icon.png
|
|
@ -9,11 +9,29 @@
|
|||
<name>vasc-demo-tech-ejb3</name>
|
||||
<description>vasc-demo-tech-ejb3</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -37,9 +37,11 @@ import javax.naming.InitialContext;
|
|||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryAccessType;
|
||||
import net.forwardfire.vasc.core.VascEntryGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroupComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
||||
|
@ -54,17 +56,12 @@ import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
|||
public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuControllerRemote {
|
||||
|
||||
private VascMenuWebComparator vascMenuWebComparator = null;
|
||||
private VascMenuGroupComparator vascMenuGroupComparator = null;
|
||||
private VascMenuComparator vascMenuComparator = null;
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
||||
|
||||
public VascMenuControllerImpl() {
|
||||
vascMenuWebComparator = new VascMenuWebComparator();
|
||||
vascMenuGroupComparator = new VascMenuGroupComparator();
|
||||
vascMenuComparator = new VascMenuComparator();
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> fetchVascMenuWeb() {
|
||||
|
@ -104,78 +101,7 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenuGroup> fetchVascMenuGroup() {
|
||||
List<VascMenuGroup> result = new ArrayList<VascMenuGroup>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU_GROUP");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenuGroup menu = new VascMenuGroup();
|
||||
menu.setId(rs.getString(1));
|
||||
menu.setTitle(rs.getString(2));
|
||||
menu.setActive(rs.getBoolean(3));
|
||||
menu.setRoles(rs.getString(4));
|
||||
menu.setMenuOrder(rs.getInt(5));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenu> fetchVascMenu() {
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenu menu = new VascMenu();
|
||||
menu.setId(rs.getInt(1));
|
||||
menu.setVascEntryId(rs.getString(2));
|
||||
menu.setTitle(rs.getString(3));
|
||||
menu.setActive(rs.getBoolean(4));
|
||||
menu.setRoles(rs.getString(5));
|
||||
menu.setMenuOrder(rs.getInt(6));
|
||||
menu.setMenuGroup(rs.getString(7));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private DataSource getDataSource(String name) throws SQLException {
|
||||
try {
|
||||
|
@ -210,11 +136,28 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
}
|
||||
|
||||
public List<VascMenuGroup> getFilteredMenuGroup() {
|
||||
List<VascMenuGroup> result = fetchVascMenuGroup();
|
||||
for (VascMenuGroup group:result) {
|
||||
group.setMenus(getFilteredMenu(group.getId()));
|
||||
|
||||
VascController vc = null;
|
||||
try {
|
||||
Context initialContext = new InitialContext();
|
||||
vc = (VascController)initialContext.lookup("openejb:Resource/vasc/server-tech");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Collections.sort(result,vascMenuGroupComparator);
|
||||
|
||||
List<VascMenuGroup> result = new ArrayList<VascMenuGroup>(20);
|
||||
for (String groupdId:vc.getVascEntryController().getVascEntryGroupIds()) {
|
||||
VascEntryGroup veg = vc.getVascEntryController().getVascEntryGroupById(groupdId);
|
||||
if (filterVascMenuRoles(veg.getView(),veg.getRolesView())==false) {
|
||||
continue;
|
||||
}
|
||||
VascMenuGroup group = new VascMenuGroup();
|
||||
group.setId(veg.getId());
|
||||
group.setTitleKey(veg.getName());
|
||||
group.setMenus(getFilteredMenu(group.getId()));
|
||||
result.add(group);
|
||||
}
|
||||
// Collections.sort(result,vascMenuGroupComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -222,13 +165,33 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
|||
if (groupId==null) {
|
||||
throw new NullPointerException("Can't filter on null groupId.");
|
||||
}
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
||||
for (VascMenu menu:fetchVascMenu()) {
|
||||
if (groupId.equals(menu.getMenuGroup())) {
|
||||
result.add(menu);
|
||||
}
|
||||
VascController vc = null;
|
||||
try {
|
||||
Context initialContext = new InitialContext();
|
||||
vc = (VascController)initialContext.lookup("openejb:Resource/vasc/server-tech");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Collections.sort(result,vascMenuComparator);
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
||||
for (String vascEntryId:vc.getVascEntryController().getVascEntryByGroupId(groupId)) {
|
||||
VascEntry ve = vc.getVascEntryController().getVascEntryById(vascEntryId);
|
||||
if (ve.getAccessType()!=null && (
|
||||
ve.getAccessType()==VascEntryAccessType.ENTRY_LINK |
|
||||
ve.getAccessType()==VascEntryAccessType.ENTRY_LIST
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (filterVascMenuRoles(ve.getView(),ve.getRolesView())==false) {
|
||||
continue;
|
||||
}
|
||||
VascMenu menu = new VascMenu();
|
||||
menu.setVascEntryId(ve.getId());
|
||||
menu.setVascGroupId(ve.getVascGroupId());
|
||||
menu.setTitleKey(ve.getName());
|
||||
result.add(menu);
|
||||
}
|
||||
// Collections.sort(result,vascMenuComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,109 +33,43 @@ import java.io.Serializable;
|
|||
public class VascMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5087600835051760512L;
|
||||
private Integer id = null;
|
||||
private String vascEntryId = null;
|
||||
private String title = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private String menuGroup = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private String titleKey = null;
|
||||
private String vascGroupId = null;
|
||||
/**
|
||||
* @return the vascEntryId
|
||||
*/
|
||||
public String getVascEntryId() {
|
||||
return vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryId the vascEntryId to set
|
||||
*/
|
||||
public void setVascEntryId(String vascEntryId) {
|
||||
this.vascEntryId = vascEntryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
* @return the titleKey
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public String getTitleKey() {
|
||||
return titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
* @param titleKey the titleKey to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
public void setTitleKey(String titleKey) {
|
||||
this.titleKey = titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
* @return the vascGroupId
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
public String getVascGroupId() {
|
||||
return vascGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
* @param vascGroupId the vascGroupId to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuGroup
|
||||
*/
|
||||
public String getMenuGroup() {
|
||||
return menuGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuGroup the menuGroup to set
|
||||
*/
|
||||
public void setMenuGroup(String menuGroup) {
|
||||
this.menuGroup = menuGroup;
|
||||
public void setVascGroupId(String vascGroupId) {
|
||||
this.vascGroupId = vascGroupId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,7 @@ public class VascMenuGroup implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -9154803561816570868L;
|
||||
private String id = null;
|
||||
private String title = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private String titleKey = null;
|
||||
private List<VascMenu> menus = null;
|
||||
|
||||
/**
|
||||
|
@ -54,61 +51,19 @@ public class VascMenuGroup implements Serializable {
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titleKey
|
||||
*/
|
||||
public String getTitleKey() {
|
||||
return titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
* @param titleKey the titleKey to set
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
public void setTitleKey(String titleKey) {
|
||||
this.titleKey = titleKey;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ClientUserController {
|
||||
|
||||
String doClientLogin();
|
||||
|
||||
Map<String,String> getResourceBundle(Locale locale);
|
||||
|
||||
List<Locale> getResourceBundleLocales();
|
||||
|
||||
/*
|
||||
void doClientLogout();
|
||||
|
||||
User getUser() throws Exception;
|
||||
|
||||
List<RightRole> getClientRoles() throws Exception;
|
||||
*/
|
||||
}
|
|
@ -1,12 +1,19 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.ejb.SessionContext;
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless(name="loginUserController")
|
||||
public class LoginUserControllerImpl implements LoginUserControllerLocal,LoginUserControllerRemote {
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle;
|
||||
|
||||
@Stateless(name="clientUserController")
|
||||
public class ClientUserControllerImpl implements ClientUserControllerLocal,ClientUserControllerRemote {
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
@ -54,4 +61,22 @@ public class LoginUserControllerImpl implements LoginUserControllerLocal,LoginUs
|
|||
return u.getUsername();
|
||||
*/
|
||||
}
|
||||
|
||||
public Map<String,String> getResourceBundle(Locale locale) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(RootApplicationBundle.class.getName(), locale);
|
||||
if (bundle instanceof RootApplicationBundle) {
|
||||
RootApplicationBundle appBundle = (RootApplicationBundle)bundle;
|
||||
return appBundle.getBundleData();
|
||||
}
|
||||
throw new IllegalStateException("Loaded bundle: "+bundle+" is not RootApplicationBundle.");
|
||||
}
|
||||
|
||||
public List<Locale> getResourceBundleLocales() {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(RootApplicationBundle.class.getName());
|
||||
if (bundle instanceof RootApplicationBundle) {
|
||||
RootApplicationBundle appBundle = (RootApplicationBundle)bundle;
|
||||
return appBundle.getApplicationSupportedLocales();
|
||||
}
|
||||
throw new IllegalStateException("Loaded bundle: "+bundle+" is not RootApplicationBundle.");
|
||||
}
|
||||
}
|
|
@ -3,6 +3,6 @@ package net.forwardfire.vasc.demo.tech.ejb3.user;
|
|||
import javax.ejb.Local;
|
||||
|
||||
@Local
|
||||
public interface LoginUserControllerLocal extends LoginUserController {
|
||||
public interface ClientUserControllerLocal extends ClientUserController {
|
||||
|
||||
}
|
|
@ -3,6 +3,6 @@ package net.forwardfire.vasc.demo.tech.ejb3.user;
|
|||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface LoginUserControllerRemote extends LoginUserController {
|
||||
public interface ClientUserControllerRemote extends ClientUserController {
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
|
||||
public interface LoginUserController {
|
||||
|
||||
public String doClientLogin();
|
||||
|
||||
/*
|
||||
public void doClientLogout();
|
||||
|
||||
public User getUser() throws Exception;
|
||||
|
||||
public List<RightRole> getClientRoles() throws Exception;
|
||||
*/
|
||||
}
|
|
@ -39,21 +39,7 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
|
|
|
@ -32,7 +32,7 @@ import javax.naming.Context;
|
|||
import javax.naming.InitialContext;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserController;
|
||||
import net.forwardfire.vasc.demo.tech.web.models.WebUser;
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<transaction-type>Container</transaction-type>
|
||||
</session>
|
||||
<session>
|
||||
<ejb-name>loginUserController</ejb-name>
|
||||
<business-local>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerLocal</business-local>
|
||||
<business-remote>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerRemote</business-remote>
|
||||
<ejb-class>net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserControllerImpl</ejb-class>
|
||||
<ejb-name>clientUserController</ejb-name>
|
||||
<business-local>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerLocal</business-local>
|
||||
<business-remote>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerRemote</business-remote>
|
||||
<ejb-class>net.forwardfire.vasc.demo.tech.ejb3.user.ClientUserControllerImpl</ejb-class>
|
||||
<session-type>Stateless</session-type>
|
||||
<transaction-type>Container</transaction-type>
|
||||
</session>
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<ui:repeat var="menuGroup" value="#{menuController.vascMenuGroup}">
|
||||
<div id="body-deco-menu-group">
|
||||
<h4>
|
||||
<span><h:outputText value="#{menuGroup.title}"/></span>
|
||||
<span><h:outputText value="#{i18n[menuGroup.titleKey]}"/></span>
|
||||
</h4>
|
||||
<ul>
|
||||
<ui:repeat var="menu" value="#{menuGroup.menus}">
|
||||
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list,jsf" title="#{menu.title}">#{menu.title}</a></li>
|
||||
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list,jsf" title="#{i18n[menu.titleKey]}">#{i18n[menu.titleKey]}</a></li>
|
||||
</ui:repeat>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -22,38 +22,25 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceRemoteBackend;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
||||
|
||||
|
||||
|
@ -166,174 +153,6 @@ abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascF
|
|||
* @return
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
|
||||
public RemoteVascBackend(String backendId,VascServiceManager vascManager) {
|
||||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
/*
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
*/
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
|
@ -370,7 +189,7 @@ abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascF
|
|||
for (String id:entryIds) {
|
||||
VascEntryLocal ve = (VascEntryLocal)vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
VascBackend vb = new VascServiceRemoteBackend(vascManager,backendId);
|
||||
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
Object value = ve.getEntryParameter(key);
|
||||
|
|
|
@ -59,6 +59,15 @@ public class MergeableResourceBundle extends ResourceBundle {
|
|||
bundleData.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns copy of data of this loaded merged bundle.
|
||||
*/
|
||||
public Map<String,String> getBundleData() {
|
||||
Map<String,String> result = new HashMap<String,String>(bundleData.size());
|
||||
result.putAll(bundleData);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.util.ResourceBundle#handleGetObject(java.lang.String)
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_by extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_by extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_da extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_da extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_de extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_de extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_en extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_en extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_es extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_es extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_fr extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_fr extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_it extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_it extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_nl extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_nl extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_pl extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_pl extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_pt extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_pt extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
package net.forwardfire.vasc.lib.i18n.bundle;
|
||||
|
||||
import net.forwardfire.vasc.lib.i18n.AbstractRootApplicationBundle;
|
||||
import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ import net.forwardfire.vasc.lib.i18n.SupportedBundleLocale;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 8, 2012
|
||||
*/
|
||||
public class RootApplicationBundle_ro extends AbstractRootApplicationBundle {
|
||||
public class RootApplicationBundle_ro extends RootApplicationBundle {
|
||||
|
||||
@Override
|
||||
public SupportedBundleLocale getSupportedBundleLocale() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue