2
0
Fork 0

Refactored internal api

This commit is contained in:
Willem Cazander 2012-06-04 22:49:12 +02:00
parent 3f31bb8a3a
commit 6ccd763d1f
361 changed files with 23049 additions and 4498 deletions

View file

@ -5,9 +5,7 @@
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
</parent>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-petstore-j2ee5-ejb</artifactId>
<version>0.3.5-SNAPSHOT</version>
<packaging>ejb</packaging>
<name>vasc-demo-petstore-j2ee5-ejb</name>
<description>vasc-demo-petstore-j2ee5-ejb</description>
@ -24,16 +22,11 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${el-api.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>

View file

@ -25,7 +25,7 @@ abstract public class AbstractPetStoreFieldTemplates {
@VascI18n(name="generic.id.labelText",description="generic.id.toolTipText")
@VascStyle(sizeList=50)
@VascField(create=false,editReadOnly=true)
@VascFieldOrder(orderIndex=0)
@VascFieldOrder(order=0)
abstract public Integer getId();
/**
@ -36,7 +36,7 @@ abstract public class AbstractPetStoreFieldTemplates {
@VascObjectNotNull
@VascStringLength(min=4,max=128)
@VascStyle(sizeList=250,sizeEdit=40)
@VascFieldOrder(orderIndex=1)
@VascFieldOrder(order=1)
abstract public String getName();
/**
@ -48,7 +48,7 @@ abstract public class AbstractPetStoreFieldTemplates {
@VascField(list=false)
@VascStringLength(max=4096)
@VascObjectNotNull
@VascFieldOrder(orderIndex=2)
@VascFieldOrder(order=2)
abstract public String getDescription();
/**
@ -57,7 +57,7 @@ abstract public class AbstractPetStoreFieldTemplates {
@VascI18n(name="generic.active.labelText",description="generic.active.toolTipText")
@VascDefaultValue(value="true")
@VascObjectNotNull
@VascFieldOrder(orderIndex=4)
@VascFieldOrder(order=4)
@VascField(create=false)
@VascRoles(rolesEdit="datafeedsPowerRole",rolesList="datafeedsPowerRole")
abstract public Boolean getActive();

View file

@ -14,7 +14,6 @@
<module>vasc-demo-tech-build</module>
<module>vasc-demo-tech-editor</module>
<module>vasc-demo-tech-web</module>
<module>vasc-demo-tech-ui</module>
<module>vasc-demo-tech-core</module>
</modules>
</project>

View file

@ -15,9 +15,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>ui-dist-assembly</id>
@ -38,7 +36,12 @@
<dependencies>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-ui</artifactId>
<artifactId>vasc-demo-tech-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View file

@ -63,6 +63,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<fileSet>
<directory>${project.basedir}/src/main/directory/</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>conf/logback-server-console.xml</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Default context for all applications. -->
<Context>
<!-- Link global resources in local java:comp/env namespace -->
<ResourceLink name="config/START_GUI" global="config/START_GUI" type="java.lang.Boolean"/>
<ResourceLink name="config/START_EDITOR" global="config/START_EDITOR" type="java.lang.Boolean"/>
<ResourceLink name="config/DEPLOY_DEBUG" global="config/DEPLOY_DEBUG" type="java.lang.Boolean"/>
<ResourceLink name="config/DEPLOY_PATH" global="config/DEPLOY_PATH" type="java.lang.String"/>
<ResourceLink name="jdbc/DemoManagerDataDS" global="jdbc/DemoManagerDataDS" type="javax.sql.DataSource"/>
<ResourceLink name="vasc/DemoVascController" global="vasc/DemoVascController" type="net.forwardfire.vasc.core.VascController" />
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Disable session persistence across restarts -->
<Manager pathname="" />
</Context>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/http-access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/http-access-%d{yyyy-MM-dd}.log.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>combined</pattern>
</encoder>
</appender>
<appender-ref ref="FILE" />
</configuration>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="90 seconds">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<jmxConfigurator/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/vasc-demo-tech.log</file>
<encoder>
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
<!-- Limit some startup messages. -->
<logger level="WARN" name="org.apache.catalina.startup.Catalina"/>
<logger level="WARN" name="org.apache.catalina.startup.ContextConfig"/>
<logger level="ERROR" name="org.apache.catalina.startup.ClassLoaderFactory"/>
<logger level="WARN" name="org.apache.catalina.core.AprLifecycleListener"/>
<logger level="WARN" name="org.ajax4jsf.cache.LRUMapCacheFactory"/>
<logger level="WARN" name="javax.enterprise.resource.webcontainer.jsf.application"/>
<logger level="WARN" name="net.jawr.web.resource.bundle.factory.BundlesHandlerFactory"/>
</configuration>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="90 seconds">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<jmxConfigurator/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/vasc-demo-tech.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/vasc-demo-tech-%d{yyyy-MM-dd}.log.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
</root>
<!-- Limit some startup messages. -->
<logger level="WARN" name="org.apache.catalina.startup.Catalina"/>
<logger level="WARN" name="org.apache.catalina.startup.ContextConfig"/>
<logger level="ERROR" name="org.apache.catalina.startup.ClassLoaderFactory"/>
<logger level="WARN" name="org.apache.catalina.core.AprLifecycleListener"/>
<logger level="WARN" name="org.ajax4jsf.cache.LRUMapCacheFactory"/>
<logger level="WARN" name="javax.enterprise.resource.webcontainer.jsf.application"/>
<logger level="WARN" name="net.jawr.web.resource.bundle.factory.BundlesHandlerFactory"/>
</configuration>

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8805" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<!-- Config Vasc Tech Demo -->
<Environment name="config/START_GUI" value="true" type="java.lang.Boolean"/>
<Environment name="config/START_EDITOR" value="true" type="java.lang.Boolean"/>
<Environment name="config/DEPLOY_DEBUG" value="true" type="java.lang.Boolean"/>
<Environment name="config/DEPLOY_PATH" value="/demo" type="java.lang.String"/>
<!-- Config Vasc Tech DataSource -->
<Resource name="jdbc/DemoManagerDataDS" auth="Container" type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="1" minIdle="1"
driverClassName="org.h2.Driver"
url="jdbc:h2:tcp://localhost:9092/vasc-demo"
/>
<!-- Config The Vasc Demo Controller -->
<Resource name="vasc/DemoVascController" auth="Container" type="net.forwardfire.vasc.core.VascController" singleton="true" scope="Shareable"
factory="net.forwardfire.vasc.impl.jndi.JndiVascControllerFactory"
vascControllerProvider="net.forwardfire.vasc.demo.tech.core.VascTechDemoControllerConfig"
removeLocal="false"
/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8899" protocol="HTTP/1.1" connectionTimeout="5000" redirectPort="9988" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/DemoManagerDataDS"
userTable="vasc_user"
userRoleTable="vasc_user_role"
userNameCol="username"
userCredCol="password"
roleNameCol="role"
digestEncoding="UTF-8"
/>
<!--
<Realm className="net.forwardfire.vasc.demo.tech.core.service.tomcat.MongoRealm"
hostname="localhost" port="27017" database="testdb" authUser="" authPass=""
userCollection="site_user"
userField="username"
userPassField="password"
roleCollection="site_user_role"
roleField="role"
roleUserField="site_user_id"
roleUserIdRef="true"
digestEncoding="UTF-8"
/>
<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://localhost:389"
userBase="ou=people,dc=mycompany,dc=com"
userSearch="(mail={0})"
userRoleName="memberOf"
roleBase="ou=groups,dc=mycompany,dc=com"
roleName="cn"
roleSearch="(uniqueMember={0})"
/>
-->
</Realm>
<Host name="localhost" unpackWARs="true" autoDeploy="true"
appBase="workdir/webapps" workDir="workdir/work"
>
<Valve className="ch.qos.logback.access.tomcat.LogbackValve"
quiet="true" filename="conf/logback-access.xml"
/>
<Valve className="org.apache.catalina.valves.CrawlerSessionManagerValve"
crawlerUserAgents=".*[bB]ot.*|.*ahoo.*|.*oogle.*"
sessionInactiveInterval="60"
/>
<Valve className="net.forwardfire.vasc.demo.tech.core.service.tomcat.AuthSessionTimeoutValve"
logInfo="true" minTimeout="30" maxTimeout="3600" authTimeout="1200"
/>
</Host>
</Engine>
</Service>
</Server>

File diff suppressed because it is too large Load diff

View file

@ -39,7 +39,7 @@
<v:entry id="metaProject" backendId="metaProjectBackend">
<v:field id="id" list="false"/>
<v:field id="name"/>
<v:field id="decription" vascEntryFieldType="TextAreaField"/>
<v:field id="description" vascEntryFieldType="TextAreaField"/>
</v:entry>
</v:root>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
xmlns:td="http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld"
>
<!-- 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"
backendType="xmlDomFile" backendFile="conf/server.xml"
/>
<td:tomcatResource name="mmdc/server/conf/logback-server.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
backendType="xmlDomFile" backendFile="conf/logback-server.xml"
/>
<td:tomcatResource name="mmdc/server/conf/logback-access.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
backendType="xmlDomFile" backendFile="conf/logback-access.xml"
/>
<td:tomcatResource name="mmdc/server/conf/context.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
backendType="xmlDomFile" backendFile="conf/context.xml"
/>
<td:tomcatResource name="mmdc/server/conf/web.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
backendType="xmlDomFile" backendFile="conf/web.xml"
/>
<!-- Get our references to the backends. -->
<mm:jndiDataContext el.id="mmdc1" jndiName="java:mmdc/server/conf/server.xml"/>
<mm:jndiDataContext el.id="mmdc2" jndiName="java:mmdc/server/conf/logback-server.xml"/>
<mm:jndiDataContext el.id="mmdc3" jndiName="java:mmdc/server/conf/logback-access.xml"/>
<mm:jndiDataContext el.id="mmdc4" jndiName="java:mmdc/server/conf/context.xml"/>
<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" />
</v:root>

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
xmlns:td="http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld"
>
<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:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
<v:field id="username" backendName="USERNAME"/>
<v:field id="password" backendName="PASSWORD"/>
<v:field id="description" backendName="DESCRIPTION" vascEntryFieldType="TextAreaField"/>
</v:entry>
<mm:metaModelBackend id="AdminVascUserRoleBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_ROLE" tableId="ID" />
<v:entry id="AdminVascUserRole" backendId="AdminVascUserRoleBackend" >
<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"/>
</v:field>
<v:field id="role" backendNAME="ROLE"/>
</v:entry>
<mm:metaModelBackend id="AdminVascUserChangeFieldBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_CHANGE_FIELD" tableId="ID" />
<v:entry id="AdminVascUserChangeField" backendId="AdminVascUserChangeFieldBackend" adminEditReadOnly="true">
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
<v:field id="field" backendName="FIELD"/>
<v:field id="name" backendName="NAME"/>
<v:field id="active" backendNAME="ACTIVE" vascEntryFieldType="BooleanField"/>
</v:entry>
<mm:metaModelBackend id="AdminVascUserChangeLogBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_USER_CHANGE_LOG" tableId="ID" />
<v:entry id="AdminVascUserChangeLog" backendId="AdminVascUserChangeLogBackend" adminEditReadOnly="true">
<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"/>
</v:field>
<v:field id="change_field_id" backendName="CHANGE_FIELD_ID" vascEntryFieldType="ListField">
<v:vascSelectItemModel entryId="AdminVascUser" keyFieldId="id"/>
</v:field>
<v:field id="value_old" backendNAME="VALUE_OLD"/>
<v:field id="value_new" backendNAME="VALUE_NEW"/>
</v:entry>
<mm:metaModelBackend id="AdminVascMenuBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU" tableId="ID" />
<v:entry id="AdminVascMenu" backendId="AdminVascMenuBackend">
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
<v:vascSelectItemModelString nullLabel="All" data="BAR_LEFT,BAR_RIGHT,BAR_BOTTOM,PAGE_INDEX,PAGE_USER_LEFT,PAGE_USER_RIGHT,PAGE_ADMIN"/>
</v:listOption>
<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="href" backendNAME="HREF"/>
<v:field id="title" backendNAME="TITLE"/>
<v:field id="target" backendNAME="TARGET"/>
<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_type" backendNAME="MENU_TYPE" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="BAR_LEFT,BAR_RIGHT,BAR_BOTTOM,MENU0,MENU1,MENU2,PAGE_INDEX,PAGE_USER_LEFT,PAGE_USER_RIGHT,PAGE_ADMIN"/>
</v:field>
</v:entry>
<mm:metaModelBackend id="AdminVascPageBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE" tableId="ID" />
<v:entry id="AdminVascPage" backendId="AdminVascPageBackend">
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
<v:field id="slug" backendNAME="SLUG"/>
<v:field id="title" backendNAME="TITLE"/>
<v:field id="i18n_key" backendNAME="I18N_KEY" vascEntryFieldType="BooleanField"/>
<!-- <v:field id="active" backendNAME="ACTIVE" vascEntryFieldType="BooleanField"/> -->
<v:field id="sitemap" backendNAME="SITEMAP" vascEntryFieldType="BooleanField"/>
</v:entry>
<mm:metaModelBackend id="AdminVascPagePartBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE_PART" tableId="ID" />
<v:entry id="AdminVascPagePart" backendId="AdminVascPagePartBackend">
<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"/>
</v:field>
<v:field id="title" backendNAME="TITLE"/>
<v:field id="text" backendNAME="TEXT"/>
<v:field id="i18n_key" backendNAME="I18N_KEY" vascEntryFieldType="BooleanField"/>
<v:field id="active" backendNAME="ACTIVE" vascEntryFieldType="BooleanField"/>
<v:field id="sitemap" backendNAME="SITEMAP" vascEntryFieldType="BooleanField"/>
<v:field id="part_order" backendNAME="PART_ORDER" vascEntryFieldType="IntegerField"/>
<v:field id="part_type" backendNAME="PART_TYPE" vascEntryFieldType="ListField">
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.web.menu.model.VascMenuType"/>
</v:field>
</v:entry>
</v:root>

View file

@ -1 +1,7 @@
All *.xml in this dir are automaticly started.
== Deploy directory ==
-- All *.xml files are deployed on startup.
-- Directory get scanned every 3 secs.
-- Files get redeployed when md5sum changes.
-- No undeploy and no removal of vasc entries only ADD/replace.

View file

@ -0,0 +1 @@
1234-56-78 90:12:34,123 INFO [install] Thank you for trying this vasc demo tech.

View file

@ -3,4 +3,18 @@ Readme for Vasc Tech Demo application.
To start:
execute: run.sh or run.bat
execute: run.sh or run.bat
Custom i18n keys web:
Application.web.meta.robots = index, follow
Application.web.meta.description = Vasc Tech Demo Web Frontends
Application.web.meta.keywords = demo,forwardfire,x4o,vasc,java
Application.web.header.logo.alt = Vasc Tech Demo Logo
Application.web.footer.center = Vasc Tech Demo Web Based on JSF and Faclets and Richfaces.
Application.web.footer.left = Copyright &copy; 2012
Application.web.footer.right = Version 0.4.x<i>(beta)</i>

View file

@ -28,7 +28,7 @@ cd /d %~dp0
:: Config variables
set JAVA_OPTS=-Xms64m -Xmx256m
set MAIN_CLASS=net.forwardfire.vasc.demo.tech.ui.TechUI
set MAIN_CLASS=net.forwardfire.vasc.demo.tech.core.VascTechDemo
set CP=lib\*
:: Launch application

View file

@ -28,7 +28,7 @@ cd `dirname $0`;
# Config variables
JAVA="java";
JAVA_OPTS="-Xms64m -Xmx256m";
MAIN_CLASS="net.forwardfire.vasc.demo.tech.ui.TechUI";
MAIN_CLASS="net.forwardfire.vasc.demo.tech.core.VascTechDemo";
CP=`echo lib/*.jar | sed 's/ /:/g'`;
# Launch application

View file

@ -16,12 +16,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>

View file

@ -10,10 +10,214 @@
<name>vasc-demo-tech-core</name>
<description>vasc-demo-tech-core</description>
<dependencies>
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-core</artifactId>
<version>${x4o-core.version}</version>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-swing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-jsf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-export</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-cxf-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-ldap</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-mongodb</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-metamodel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-jdbc</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.lib</groupId>
<artifactId>vasc-lib-editor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.test</groupId>
<artifactId>vasc-test-i18n</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jdesktop.bsaf</groupId>
<artifactId>bsaf</artifactId>
<version>${bsaf.version}</version>
<exclusions>
<exclusion>
<artifactId>jnlp</artifactId>
<groupId>javax.jnlp</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>net.jawr</groupId>
<artifactId>jawr</artifactId>
<version>${jawr.version}</version>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.wikipedia</groupId>
<artifactId>de.tudarmstadt.ukp.wikipedia.api</artifactId>
<version>0.9.1</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- Tomcat deps -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.27</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.27</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>7.0.27</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.27</version>
</dependency>
<!-- Web tech deps
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>${javax.faces.version}</version>
</dependency>
<!-- RichFaces libraries -->
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>${rewrite-servlet.version}</version>
</dependency>
<!-- Jdbc Drivers for demo -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
</dependency>
<!-- Setup proper logging -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logback-access.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${jul-to-slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${log4j-over-slf4j.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,248 @@
/*
* 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.tech.core;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.logging.Handler;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
import org.slf4j.bridge.SLF4JBridgeHandler;
import net.forwardfire.vasc.demo.tech.core.service.DatabaseService;
import net.forwardfire.vasc.demo.tech.core.service.ServerConfigService;
import net.forwardfire.vasc.demo.tech.core.service.ServerConfigService.ServerConfigKey;
import net.forwardfire.vasc.demo.tech.core.service.tomcat.TomcatService;
import net.forwardfire.vasc.demo.tech.core.service.SwingGuiService;
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService;
import net.forwardfire.vasc.demo.tech.core.service.VascDeployService;
/**
* VascTechDemo init and starts the VascTechDemo
*
* @author Willem Cazander
* @version 1.0 May 3, 2012
*/
public class VascTechDemo {
private Logger logger = null;
private ServerConfigService serverConfigService = null;
private DatabaseService databaseService = null;
private TomcatService tomcatService = null;
private VascControllerService vascControllerService = null;
private VascDeployService vascDeployService = null;
private SwingGuiService swingGuiService = null;
static private VascTechDemo instance = null;
/**
* Starts this VascTechDemo instance
* @param args
*/
static public void main(String[] args) {
instance = new VascTechDemo();
instance.initialize(args);
instance.startup();
}
/**
* Copy copfig/etc directory stucture to root of project in maven/eclipse run.
* @throws IOException
*/
private void setupAutoDir() throws IOException {
File deployDir = new File("deploy");
File workDir = new File("workdir");
File workDirTmp = new File("workdir/tmp");
if (deployDir.exists()==false) {
deployDir.mkdir();
}
if (workDir.exists()==false) {
workDir.mkdir();
}
if (workDirTmp.exists()==false) {
workDirTmp.mkdir();
}
System.setProperty("java.io.tmpdir", workDirTmp.getAbsolutePath());
File tmpFile = File.createTempFile("test", "new-tmp");
if (tmpFile.getAbsolutePath().contains(workDirTmp.getName())==false) {
// Cant change tmp location.
}
tmpFile.delete();
File confDir = new File("conf");
if (confDir.exists()) {
return;
}
if (isMavenRun()==false) {
throw new RuntimeException("Can't start without conf dir.");
}
FileUtils.copyDirectory(new File("../vasc-demo-tech-build/src/main/directory/"), new File("."));
}
/**
* Config logging and setup logger object.
*/
private void setupLogging() {
// Set Config file property
if (System.getProperty("logback.configurationFile")==null) {
File logConfig = null;
if (isMavenRun()) {
logConfig = new File("conf/logback-server-console.xml");
} else {
logConfig = new File("conf/logback-server.xml");
}
try {
System.setProperty("logback.configurationFile", logConfig.toURI().toURL().toExternalForm());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
for (Handler h:rootLogger.getHandlers()) {
rootLogger.removeHandler(h);
}
rootLogger.addHandler(new SLF4JBridgeHandler()); // This does also the init for us.
// Logback offical init method.
//LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
//StatusPrinter.print(lc);
// Create an JUL logger for our application.
logger = Logger.getLogger(VascTechDemo.class.getName());
logger.info("Logging is ready for application log;");
}
/**
* Init all demo service beans.
* @param argu
*/
protected void initialize(String[] argu) {
long startTime = System.currentTimeMillis();
try {
Thread.currentThread().setName("startup");
setupAutoDir();
setupLogging();
logger.info("VascTechDemo initializing ...");
databaseService = new DatabaseService();
tomcatService = new TomcatService();
serverConfigService = new ServerConfigService();
vascControllerService = new VascControllerService();
vascDeployService = new VascDeployService();
vascDeployService.setDeployDir(new File("deploy"));
swingGuiService = new SwingGuiService();
long stopTime = System.currentTimeMillis();
logger.info("VascTechDemo initialized in "+(stopTime-startTime)+" ms.");
} catch (Exception e1) {
e1.printStackTrace();
System.exit(1);
}
}
/**
* Startup and deploy all service beans.
*/
protected void startup() {
try {
long startTime = System.currentTimeMillis();
databaseService.start();
tomcatService.start();
serverConfigService.start();
vascControllerService.start();
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_GUI)) {
swingGuiService.start();
}
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_EDITOR)) {
vascControllerService.startEditor();
}
vascDeployService.start();
tomcatService.deploy(serverConfigService.getServerConfigValue(ServerConfigKey.DEPLOY_PATH));
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.DEPLOY_DEBUG)) {
tomcatService.deployDebug();
}
long stopTime = System.currentTimeMillis();
logger.info("VascTechDemo startup in "+(stopTime-startTime)+" ms.");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
public void shutdown() {
if (instance==null) {
return;
}
Thread t = new Thread(new Runnable() {
public void run() {
try {
long startTime = System.currentTimeMillis();
vascDeployService.stop();
vascControllerService.stop();
serverConfigService.stop();
tomcatService.stop();
databaseService.stop();
long stopTime = System.currentTimeMillis();
logger.info("VascTechDemo shutdown in "+(stopTime-startTime)+" ms.");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
} finally {
instance = null;
}
}
});
t.setName("shutdown");
t.start();
}
static public VascTechDemo getInstance() {
return instance;
}
public boolean isMavenRun() {
return System.getProperty("java.class.path").contains("classes");
}
public VascControllerService getVascControllerService() {
return vascControllerService;
}
public VascDeployService getVascDeployService() {
return vascDeployService;
}
public TomcatService getTomcatService() {
return tomcatService;
}
public SwingGuiService getSwingGuiService() {
return swingGuiService;
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.tech.core;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascControllerProvider;
import net.forwardfire.vasc.core.VascEntryConfigControllerLocal;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterJR4O;
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
/**
* DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo.
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class VascTechDemoControllerConfig implements VascControllerProvider {
/**
* @see net.forwardfire.vasc.core.VascControllerProvider#getVascController()
*/
public VascController getVascController() {
try {
VascController vascController = DefaultVascFactory.getDefaultVascController();
VascEntryConfigControllerLocal vecc = (VascEntryConfigControllerLocal)vascController.getVascEntryConfigController();
// Config all report export engines for demo.
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfLandscape",JRExportType.PDF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfPortrait",JRExportType.PDF,"generic-portrait","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrRtf",JRExportType.RTF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXls",JRExportType.XLS,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXml",JRExportType.XML,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrCsv",JRExportType.CSV,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
// Config root bundle to load all resources.
vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle");
// Increase some config defaults
vecc.getMasterVascBackendState().setPageSize(200);
vecc.getMasterVascBackendState().setPageSizeMax(2000);
return vascController;
} catch (VascException e) {
throw new RuntimeException(e);
}
}
}

View file

@ -0,0 +1,149 @@
/*
* 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.tech.core.service;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.h2.tools.Server;
/**
* DatabaseService starts and stops the embedded H2 demo database.
*
* @author Willem Cazander
* @version 1.0 May 13, 2012
*/
public class DatabaseService {
private Logger logger = null;
private Server server = null;
public DatabaseService() {
logger = Logger.getLogger(DatabaseService.class.getName());
}
public void start() {
List<String> argu = new ArrayList<String>(10);
argu.add("-tcp");
argu.add("-tcpPort"); argu.add("9092");
argu.add("-tcpPassword"); argu.add("stopSecret");
argu.add("-baseDir"); argu.add("data/db");
String[] args = new String[argu.size()];
args = argu.toArray(args);
StringBuffer buf = new StringBuffer();
for (String a:args) {
buf.append(a);
buf.append(" ");
}
logger.info("Start H2 Server with: "+buf);
try {
server = Server.createTcpServer(args).start();
} catch (SQLException e) {
e.printStackTrace();
}
if (server.isRunning(true)) {
initDB();
}
}
public void stop() {
if (server==null) {
return;
}
logger.info("Stopping H2 Server");
server.stop();
}
private void initDB() {
Connection conn = null;
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl==null) {
cl = this.getClass().getClassLoader();
}
cl.loadClass("org.h2.Driver");
conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9092/vasc-demo");
ResultSet rs = conn.prepareStatement("show tables").executeQuery();
if (rs.next()) {
logger.info("Tables found so skipping auto init.");
rs.close();
return;
}
rs.close();
String allSql = readResourceAsString("net/forwardfire/vasc/demo/tech/core/service/resources/init-db.sql");
String[] allSqlData = allSql.split(";");
for(String sql:allSqlData) {
sql = sql.trim();
if (sql.isEmpty()) {
continue;
}
conn.prepareStatement(sql+";").executeUpdate();
}
logger.info("Done auto init total statements done: "+allSqlData.length);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (conn!=null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
private String readResourceAsString(String resource) throws IOException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl==null) {
cl = this.getClass().getClassLoader();
}
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new InputStreamReader(cl.getResourceAsStream(resource)));
try {
char[] buf = new char[1024];
int numRead=0;
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
}
} finally {
if (reader!=null) {
reader.close();
}
}
return fileData.toString();
}
}

View file

@ -0,0 +1,87 @@
/*
* 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.tech.core.service;
import javax.naming.Context;
import javax.naming.NamingException;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
/**
* ServerConfigService reads demo server config parameters from jndi.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class ServerConfigService {
public ServerConfigService() {
}
public void start() {
}
public void stop() {
}
private Object readConfigKey(ServerConfigKey key) {
try {
Context context = VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext();
return context.lookup("config/"+key.name());
} catch (NamingException e) {
throw new IllegalStateException("Naming error:"+e.getMessage()+" from key: "+key.name(),e);
}
}
public String getServerConfigValue(ServerConfigKey key) {
if (key==null) {
throw new NullPointerException("Can't get value for null key.");
}
Object v = readConfigKey(key);
if (v==null) {
return key.getDefaultValue();
}
return v.toString();
}
public boolean isServerConfigValueTrue(ServerConfigKey key) {
String value = getServerConfigValue(key);
return "true".equalsIgnoreCase(value);
}
public enum ServerConfigKey {
START_GUI("true"),
START_EDITOR("true"),
DEPLOY_DEBUG("true"),
DEPLOY_PATH("/demo");
private String defaultValue = null;
private ServerConfigKey(String defaultValue) {
this.defaultValue=defaultValue;
}
public String getDefaultValue() {
return defaultValue;
}
}
}

View file

@ -0,0 +1,58 @@
/*
* 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.tech.core.service;
import javax.swing.JTabbedPane;
import net.forwardfire.vasc.demo.tech.core.ui.JApplication;
import net.forwardfire.vasc.demo.tech.core.ui.JMainPanel;
import org.jdesktop.application.Application;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.SingleFrameApplication;
/**
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class SwingGuiService {
public void start() {
Application.launch(JApplication.class, new String[] {});
}
public void stop() {
}
// move
public JTabbedPane getTabPane() {
SingleFrameApplication a = (SingleFrameApplication)JApplication.getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
FrameView mainView = a.getMainView();
JMainPanel mainPanel = (JMainPanel)mainView.getComponent();
return mainPanel.getTabPane();
}
}

View file

@ -0,0 +1,130 @@
/*
* 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.tech.core.service;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.x4o.VascParser;
/**
* VascControllerService manages the demo vasc controller which gets init by jndi factory.
*
* @author Willem Cazander
* @version 1.0 May 18, 2012
*/
public class VascControllerService {
private Logger logger = null;
private VascController vascController = null;
private List<VascServiceListener> vascServiceListeners = null;
public VascControllerService() {
logger = Logger.getLogger(VascControllerService.class.getName());
vascServiceListeners = new ArrayList<VascServiceListener>(10);
}
public void start() {
logger.finer("Starting vascmanager");
if (vascController!=null) {
throw new RuntimeException("VascManager is already started.");
}
try {
// Fetch from jndi
vascController = (VascController)VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext().lookup("vasc/DemoVascController");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void stop() {
if (vascController==null) {
return;
}
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
backends.clearAndStopBackends();
vascController = null;
logger.info("Stop manager, cleared all.");
}
public void startEditor() {
try {
VascParser parser = new VascParser(vascController);
parser.addGlobalELBean("vascController", vascController);
parser.parseResource("net/forwardfire/vasc/lib/editor/vasc-edit.xml");
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
} finally {
fireChangeEvent();
}
}
public void openFile(File file) {
logger.info("Vasc open file: "+file.getAbsoluteFile());
try {
VascParser parser = new VascParser(vascController);
//File f = File.createTempFile("test-vasc", ".xml");
//parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file);
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
} finally {
fireChangeEvent();
}
}
public VascController getVascController() {
return vascController;
}
public void fireChangeEvent() {
for (VascServiceListener listener:vascServiceListeners) {
listener.changeEvent();
}
}
public void addVascServiceListener(VascServiceListener listener) {
vascServiceListeners.add(listener);
}
public interface VascServiceListener {
public void changeEvent();
}
}

View file

@ -0,0 +1,223 @@
/*
* 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.tech.core.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.NamingException;
import org.apache.catalina.Server;
import org.apache.naming.ContextBindings;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
/**
* VascDeployService parses "deploy/*.xml" automaticly for hotdeployments.
*
* @author Willem Cazander
* @version 1.0 May 10, 2012
*/
public class VascDeployService {
private Logger logger = null;
private File deployDir = null;
private int scanPeriod = 3;
private AutoDeployManager autoDeployManager = null;
private Map<File,String> fileCheckSums = null;
public VascDeployService() {
logger = Logger.getLogger(VascDeployService.class.getName());
fileCheckSums = new HashMap<File,String>(20);
}
public void start() {
if (deployDir==null) {
throw new NullPointerException("Can't deploy with null deployDir.");
}
if (deployDir.exists()==false) {
throw new IllegalStateException("Can't deploy with non-existing deployDir.");
}
if (deployDir.isDirectory()==false) {
throw new IllegalStateException("Can't deploy with non-directory deployDir.");
}
// Start scan thread for auto (re)deployments
Thread scanThread = new Thread(new AutoDeployManager());
scanThread.setName("hotdeploy-scanner");
scanThread.start();
}
public void stop() {
if (autoDeployManager==null) {
return;
}
autoDeployManager.stop();
}
public String createMd5Sum(File file) throws IOException, NoSuchAlgorithmException {
FileInputStream in = new FileInputStream(file.getAbsolutePath());
try {
byte[] b = new byte[1024 * 64];
int num = 0;
MessageDigest md = MessageDigest.getInstance("MD5");
while ((num = in.read(b)) != -1) {
md.update(b, 0, num);
}
byte[] hashBytes = md.digest();
BigInteger hashResult = new BigInteger(hashBytes);
String hashString = hashResult.toString(16);
return hashString;
} finally {
if (in != null) {
in.close();
}
}
}
private void hotDeployVasc() throws NoSuchAlgorithmException, IOException {
int deployed = 0;
long startTime = System.currentTimeMillis();
for (File file:deployDir.listFiles()) {
if (file.canRead()==false) {
continue;
}
if (file.getName().endsWith("xml")==false) {
continue;
}
String md5File = createMd5Sum(file);
String md5Deploy = fileCheckSums.get(file);
if (md5Deploy!=null && md5Deploy.equals(md5File)) {
continue;
}
fileCheckSums.put(file, md5File);
deployed++;
VascTechDemo.getInstance().getVascControllerService().openFile(file);
}
if (deployed > 0) {
long stopTime = System.currentTimeMillis();
logger.info("Done deploying total files read: "+deployed+" in "+(stopTime-startTime)+" ms.");
/*
try {
StringBuffer buf = new StringBuffer();
InitialContext context = new InitialContext();
JdniTreePrinter jndi = new JdniTreePrinter();
jndi.printJNDITree(context, "java:", buf);
logger.info("JDNI Tree:\n"+buf.toString());
} catch (Exception e) {
e.printStackTrace();
} */
}
}
protected class AutoDeployManager implements Runnable {
private volatile boolean run = true;
public void run() {
try {
Thread.sleep(2000); // let gui+tomcat start
logger.info("AutoDeployManager started");
Server server = VascTechDemo.getInstance().getTomcatService().getServer();
Object token = "secretToken";
String bindName = "autoDeployThread";
try {
ContextBindings.bindContext(bindName, server.getGlobalNamingContext(),token);
ContextBindings.bindThread(bindName,token);
} catch (NamingException e) {
e.printStackTrace();
}
while(run) {
try {
hotDeployVasc();
} catch (Exception e) {
logger.log(Level.WARNING,"Error while depoying: "+e.getMessage(),e);
}
if (scanPeriod == 0) {
scanPeriod = 1;
}
try {
Thread.sleep(1000*scanPeriod);
} catch (InterruptedException ie) {
logger.info("Interrupted sleep");
break;
}
}
ContextBindings.unbindThread(bindName,token);
ContextBindings.unbindContext(bindName,token);
} catch (Exception e) {
logger.log(Level.SEVERE,"Error in run: "+e.getMessage(),e);
} finally {
logger.info("AutoDeployManager stoped");
}
}
public void stop() {
run = false;
this.notify();
}
}
/**
* @return the deployDir
*/
public File getDeployDir() {
return deployDir;
}
/**
* @param deployDir the deployDir to set
*/
public void setDeployDir(File deployDir) {
this.deployDir = deployDir;
}
/**
* @return the scanPeriod
*/
public int getScanPeriod() {
return scanPeriod;
}
/**
* @param scanPeriod the scanPeriod to set
*/
public void setScanPeriod(int scanPeriod) {
this.scanPeriod = scanPeriod;
}
}

View file

@ -0,0 +1,126 @@
/*
* 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.tech.core.service.tomcat;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
/**
* AuthSessionTimeoutValve sets sessions timeout for Sessions which has user pricaiap.
*
* @author Willem Cazander
* @version 1.0 May 27, 2012
*/
public class AuthSessionTimeoutValve extends ValveBase {
private boolean logInfo = false;
private int minTimeout = 60;
private int maxTimeout = 60*60;
private int authTimeout = 60*20;
/**
* The descriptive information about this implementation.
*/
protected static final String info = AuthSessionTimeoutValve.class.getName()+"/1.0";
@Override
public void invoke(Request request, Response response) throws IOException,ServletException {
getNext().invoke(request, response);
HttpSession session = request.getSession(false);
if (session==null) {
return;
}
int curSessionTimeout = session.getMaxInactiveInterval();
int newSessionTimeout = curSessionTimeout;
if (curSessionTimeout < minTimeout) {
newSessionTimeout = minTimeout;
}
if (curSessionTimeout > maxTimeout) {
newSessionTimeout = maxTimeout;
}
if (request.getUserPrincipal()!=null) {
newSessionTimeout = authTimeout;
}
if (curSessionTimeout != newSessionTimeout) {
session.setMaxInactiveInterval(newSessionTimeout);
logChange(session.getId(),curSessionTimeout,newSessionTimeout);
}
}
private void logChange(String sessionId,int curSessionTimeout,int newSessionTimeout) {
String log = "Changed session: "+sessionId+" from timeout: "+curSessionTimeout+" to: "+newSessionTimeout;
if (logInfo) {
getContainer().getLogger().info(log);
} else {
getContainer().getLogger().debug(log);
}
}
/**
* @return the minTimeout
*/
public int getMinTimeout() {
return minTimeout;
}
/**
* @param minTimeout the minTimeout to set
*/
public void setMinTimeout(int minTimeout) {
this.minTimeout = minTimeout;
}
/**
* @return the maxTimeout
*/
public int getMaxTimeout() {
return maxTimeout;
}
/**
* @param maxTimeout the maxTimeout to set
*/
public void setMaxTimeout(int maxTimeout) {
this.maxTimeout = maxTimeout;
}
/**
* @return the authTimeout
*/
public int getAuthTimeout() {
return authTimeout;
}
/**
* @param authTimeout the authTimeout to set
*/
public void setAuthTimeout(int authTimeout) {
this.authTimeout = authTimeout;
}
}

View file

@ -0,0 +1,52 @@
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
import javax.naming.NameClassPair;
import javax.naming.NamingException;
public class JdniTreePrinter {
public JdniTreePrinter() {
}
public void printJNDITree(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 {
while (ne.hasMoreElements()) {
NameClassPair next = (NameClassPair) ne.nextElement();
printEntry(next,buf);
increaseIndent();
printJNDITree(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(" ");
}
}
}

View file

@ -0,0 +1,39 @@
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
import java.io.IOException;
import java.io.PrintWriter;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
public class JndiDebugServlet extends HttpServlet {
private static final long serialVersionUID = -7624183395089913214L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
try {
Context context = new InitialContext();
if (req.getRequestURI().endsWith("global")) {
context = VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext();
}
StringBuffer buf = new StringBuffer();
JdniTreePrinter jndi = new JdniTreePrinter();
if (req.getRequestURI().endsWith("global")) {
jndi.printJNDITree(context,"",buf);
} else {
jndi.printJNDITree(context,"java:",buf);
}
PrintWriter out = response.getWriter();
out.append(buf.toString());
out.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,343 @@
/*
* 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.tech.core.service.tomcat;
import java.net.UnknownHostException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.realm.RealmBase;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.MongoOptions;
import com.mongodb.ServerAddress;
/**
* MongoRealm does auth to mongo collections.
*
* @author Willem Cazander
* @version 1.0 May 13, 2012
*/
public class MongoRealm extends RealmBase {
private Logger logger = Logger.getLogger(MongoRealm.class.getName());
private String hostname = "localhost";
private int port = 27017;
private String database = null;
private String authUser = null;
private String authPass = null;
private String userCollection = null;
private String userField = "username";
private String userPassField = "password";
private String roleCollection = null;
private String roleField = "role";
private String roleUserField = userField;
private boolean roleUserIdRef = false;
private Mongo mongo = null;
private DB db = null;
@Override
protected String getName() {
return this.getClass().getSimpleName();
}
@Override
protected String getPassword(String username) {
DBObject user = getUser(username);
if (user==null) {
return null;
}
String password = (String) user.get(getUserPassField());
return password;
}
protected DBObject getUser(String username) {
DBCollection coll = db.getCollection(getUserCollection());
DBObject query = new BasicDBObject();
query.put(getUserField(), username);
DBCursor cur = coll.find(query);
if (cur.hasNext()==false) {
return null;
}
DBObject user = cur.next();
return user;
}
@Override
protected Principal getPrincipal(String username) {
String password = getPassword(username);
if (password==null) {
return null;
}
DBCollection coll = db.getCollection(getRoleCollection());
DBObject query = new BasicDBObject();
if (isRoleUserIdRef()) {
DBObject user = getUser(username);
query.put(getRoleUserField(), user.get("_id"));
} else {
query.put(getRoleUserField(), username);
}
DBCursor cur = coll.find(query);
if (cur.hasNext()==false) {
return null;
}
List<String> roles = new ArrayList<String>(30);
while (cur.hasNext()) {
DBObject row = cur.next();
String role = (String)row.get(getRoleField());
roles.add(role);
}
return new GenericPrincipal(username, password, roles);
}
/**
* @see org.apache.catalina.realm.RealmBase#startInternal()
*/
@Override
protected void startInternal() throws LifecycleException {
super.startInternal();
if (database==null) {
throw new LifecycleException("database is null.");
}
if (userCollection==null) {
throw new LifecycleException("userCollection is null.");
}
if (roleCollection==null) {
throw new LifecycleException("roleCollection is null.");
}
createMongoConnection();
logger.fine("Started mongo realm to database: "+getDatabase());
}
/**
* @see org.apache.catalina.realm.RealmBase#stopInternal()
*/
@Override
protected void stopInternal() throws LifecycleException {
super.stopInternal();
if (mongo==null) {
return;
}
mongo.close();
logger.fine("Stopped mongo realm.");
}
private void createMongoConnection() throws LifecycleException {
ServerAddress server;
try {
server = new ServerAddress(hostname,port);
} catch (UnknownHostException e) {
throw new LifecycleException(e);
}
MongoOptions options = new MongoOptions();
mongo = new Mongo(server,options);
db = mongo.getDB(database);
if (authUser!=null && authUser.isEmpty()==false && authPass!=null && authPass.isEmpty()==false) {
boolean auth = db.authenticate(authUser, authPass.toCharArray());
authPass = null;
if (auth==false) {
throw new LifecycleException("Could not auth to db: "+database+" with username: "+authUser);
}
}
db.setReadOnly(true);
logger.finer("Connection to: "+db.getName());
}
/**
* @return the hostname
*/
public String getHostname() {
return hostname;
}
/**
* @param hostname the hostname to set
*/
public void setHostname(String hostname) {
this.hostname = hostname;
}
/**
* @return the port
*/
public int getPort() {
return port;
}
/**
* @param port the port to set
*/
public void setPort(int port) {
this.port = port;
}
/**
* @return the database
*/
public String getDatabase() {
return database;
}
/**
* @param database the database to set
*/
public void setDatabase(String database) {
this.database = database;
}
/**
* @return the authUser
*/
public String getAuthUser() {
return authUser;
}
/**
* @param authUser the authUser to set
*/
public void setAuthUser(String authUser) {
this.authUser = authUser;
}
/**
* @return the authPass
*/
public String getAuthPass() {
return authPass;
}
/**
* @param authPass the authPass to set
*/
public void setAuthPass(String authPass) {
this.authPass = authPass;
}
/**
* @return the userCollection
*/
public String getUserCollection() {
return userCollection;
}
/**
* @param userCollection the userCollection to set
*/
public void setUserCollection(String userCollection) {
this.userCollection = userCollection;
}
/**
* @return the userField
*/
public String getUserField() {
return userField;
}
/**
* @param userField the userField to set
*/
public void setUserField(String userField) {
this.userField = userField;
}
/**
* @return the roleCollection
*/
public String getRoleCollection() {
return roleCollection;
}
/**
* @param roleCollection the roleCollection to set
*/
public void setRoleCollection(String roleCollection) {
this.roleCollection = roleCollection;
}
/**
* @return the roleField
*/
public String getRoleField() {
return roleField;
}
/**
* @param roleField the roleField to set
*/
public void setRoleField(String roleField) {
this.roleField = roleField;
}
/**
* @return the roleUserField
*/
public String getRoleUserField() {
return roleUserField;
}
/**
* @param roleUserField the roleUserField to set
*/
public void setRoleUserField(String roleUserField) {
this.roleUserField = roleUserField;
}
/**
* @return the userPassField
*/
public String getUserPassField() {
return userPassField;
}
/**
* @param userPassField the userPassField to set
*/
public void setUserPassField(String userPassField) {
this.userPassField = userPassField;
}
/**
* @return the roleUserIdRef
*/
public boolean isRoleUserIdRef() {
return roleUserIdRef;
}
/**
* @param roleUserIdRef the roleUserIdRef to set
*/
public void setRoleUserIdRef(boolean roleUserIdRef) {
this.roleUserIdRef = roleUserIdRef;
}
}

View file

@ -0,0 +1,218 @@
/*
* 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.tech.core.service.tomcat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Logger;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Bootstrap;
import org.apache.catalina.startup.ContextConfig;
import org.apache.naming.resources.VirtualDirContext;
/**
* TomcatService config and starts Tomcat in semi embedded mode.
*
* @author Willem Cazander
* @version 1.0 May 10, 2012
*/
public class TomcatService {
private Logger logger = null;
private Server server = null;
private ClassLoader commonLoader = null;
private Context applicationContext = null;
public TomcatService() {
logger = Logger.getLogger(TomcatService.class.getName());
}
public void start() throws Exception {
Bootstrap boot = new Bootstrap();
boot.setCatalinaHome(System.getProperty("user.dir"));
boot.init();
boot.start();
/// After startup get the server object from private method.
for (Method m:boot.getClass().getDeclaredMethods()) {
if (m.getName().equals("getServer")) {
m.setAccessible(true);
server = (Server)m.invoke(boot);
}
}
if (server==null) {
throw new RuntimeException("Could not get server by reflection from BootStrap.");
}
for (Field f:boot.getClass().getDeclaredFields()) {
if (f.getName().equals("commonLoader")) {
f.setAccessible(true);
commonLoader = (ClassLoader)f.get(boot);
}
}
}
public void deploy(String deployContext) throws Exception {
Service service = server.findService("Catalina");
Host host = (Host)service.getContainer().findChild("localhost");
String deployPath = null;
if (VascTechDemo.getInstance().isMavenRun()) {
String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/";
deployPath = new File(webappPathLocation).getAbsolutePath();
logger.info("Deploy demo app from workspace path: "+deployPath);
} else {
File techWarFile = null;
for (File file:new File("lib").listFiles()) {
if (file.getName().contains("vasc-demo-tech-web")) {
techWarFile = file;
break;
}
}
if (techWarFile==null) {
throw new NullPointerException("Could not locate war file in lib directory.");
}
File destDir = new File("workdir","tomcat.wars"+File.separator+techWarFile.getName());
if (destDir.exists()==false) {
destDir.mkdirs();
JarFile jar = new JarFile(techWarFile);
Enumeration<JarEntry> jars = jar.entries();
while (jars.hasMoreElements()) {
JarEntry file = jars.nextElement();
File f = new File(destDir+File.separator+file.getName());
if (file.isDirectory()) {
f.mkdir();
continue;
}
InputStream is = jar.getInputStream(file);
FileOutputStream fos = new FileOutputStream(f);
while (is.available() > 0) {
fos.write(is.read()); // slow copy
}
fos.close();
is.close();
}
}
deployPath = destDir.getAbsolutePath();
logger.info("Deploy war path: "+deployPath);
}
Context ctx = new StandardContext();
ctx.setName(deployContext);
ctx.setPath(deployContext);
ctx.setDocBase(deployPath);
//ctx.setParentClassLoader(commonLoader);
ctx.setConfigured(true);
ContextConfig ctxCfg = new ContextConfig();
ctx.addLifecycleListener(ctxCfg);
VirtualDirContext vDir = new VirtualDirContext();
vDir.setExtraResourcePaths("../vasc-demo-tech-web/target/classes");
ctx.setResources(vDir);
//VirtualWebappLoader loader = new VirtualWebappLoader();
//String cl = System.getProperty("java.class.path").replace(":", ";");
//logger.info("Virtal class path: "+cl);
//loader.setVirtualClasspath(cl);
//loader.setSearchVirtualFirst(true);
//ctx.setLoader(loader);
//ctx.getJarScanner().scan
host.addChild(ctx);
applicationContext = ctx;
}
public void deployDebug() throws Exception {
if (applicationContext==null) {
throw new NullPointerException("Can only deploy debug after deploy.");
}
long startTime = System.currentTimeMillis();
addServlet(applicationContext,"jdbcConsole","org.h2.server.web.WebServlet");
applicationContext.addServletMapping("/debug/jdbc/console/*", "jdbcConsole");
addServlet(applicationContext,"jndiView","net.forwardfire.vasc.demo.tech.core.service.tomcat.JndiDebugServlet");
applicationContext.addServletMapping("/debug/jndi/view", "jndiView");
applicationContext.addServletMapping("/debug/jndi/view/global", "jndiView");
addServlet(applicationContext,"logbackClassicStatus","ch.qos.logback.classic.ViewStatusMessagesServlet");
applicationContext.addServletMapping("/debug/logback/status/classic", "logbackClassicStatus");
addServlet(applicationContext,"logbackAccessStatus","ch.qos.logback.access.ViewStatusMessagesServlet");
applicationContext.addServletMapping("/debug/logback/status/access", "logbackAccessStatus");
long stopTime = System.currentTimeMillis();
logger.info("Deployed all debug resources in: "+(stopTime-startTime)+" ms.");
}
public Wrapper addServlet(Context ctx,String servletName,String servletClass) {
Wrapper sw = ctx.createWrapper();
sw.setServletClass(servletClass);
sw.setName(servletName);
ctx.addChild(sw);
return sw;
}
public void stop() throws Exception {
if (server==null) {
return;
}
server.stop();
}
public ClassLoader getClassLoaderCommon() {
return commonLoader;
}
public Server getServer() {
return server;
}
/**
* @return the applicationContext
*/
public Context getApplicationContext() {
return applicationContext;
}
}

View file

@ -0,0 +1,35 @@
package net.forwardfire.vasc.demo.tech.core.ui;
import java.awt.Dimension;
import java.util.EventObject;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.SingleFrameApplication;
public class JApplication extends SingleFrameApplication {
protected void startup() {
addExitListener(new ShutdownManager());
FrameView mainView = getMainView();
mainView.setComponent(new JMainPanel());
mainView.setMenuBar(new JMainPanelMenuBar());
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
show(mainView);
}
static public JApplication getInstance() {
return getInstance(JApplication.class);
}
class ShutdownManager implements ExitListener {
public boolean canExit(EventObject e) {
return true;
}
public void willExit(EventObject event) {
VascTechDemo.getInstance().shutdown();
}
}
}

View file

@ -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.tech.core.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.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SpringLayout;
import javax.swing.SwingUtilities;
/**
* JConsolePanel binds to JUL and display log messages in texteara.
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class JConsolePanel extends JPanel implements ActionListener {
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);
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
logHandler = new UILogHandler();
logHandler.setFormatter(new SimpleFormatter());
rootLogger.addHandler(logHandler);
}
/**
* This needs release if playing the the this tab add/removal very multiple times.
*/
public void release() {
Logger rootLogger = Logger.getAnonymousLogger();
while (rootLogger.getParent()!=null) {
rootLogger = rootLogger.getParent();
}
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);
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
}
}
}
}
class UILogHandler extends Handler {
@Override
public void close() throws SecurityException {
}
@Override
public void flush() {
}
@Override
public void publish(LogRecord record) {
final String recordStr = getFormatter().format(record);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
logTextArea.append(recordStr);
if (logTextArea.getLineCount() > logLinesMax) {
String t = logTextArea.getText();
int l = 0;
int rm = logLinesMax/2;
for (int i=0;i<rm;i++) {
int ll = t.indexOf('\n',l+1);
if (ll==-1) {
break;
}
l = ll;
}
String tt = t.substring(l,t.length());
logTextArea.setText(tt);
}
if (autoScrollBox.isSelected()) {
logTextArea.setCaretPosition(logTextArea.getText().length());
}
}
});
}
}
}

View file

@ -0,0 +1,377 @@
/*
* 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.tech.core.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.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.swing.BorderFactory;
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 net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryLocal;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService;
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService.VascServiceListener;
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
/**
* JMainPanel is the main panel/window of this demo.
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class JMainPanel extends JPanel implements VascServiceListener {
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;
public JMainPanel() {
this.vascManager=VascTechDemo.getInstance().getVascControllerService();
setLayout(new BorderLayout());
add(createBottomSplit(), BorderLayout.CENTER);
vascManager.addVascServiceListener(this);
}
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;
@Override
public void addTreeModelListener(TreeModelListener l) {
super.addTreeModelListener(l);
}
}
private JScrollPane createTreePane() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.NONE,null));
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();
}
}
}
});
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);
// todo move
Map<String,String> keys = new HashMap<String,String>(300);
VascBundleCheckEntryKeys checker = new VascBundleCheckEntryKeys(ResourceBundle.getBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"));
for (String veId:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(veId);
keys.putAll(checker.generateMissingKeys(ve));
}
if (keys.isEmpty()==false) {
Properties p = new Properties();
File dataDir = new File("data");
if (dataDir.exists()==false) {
dataDir.mkdirs();
}
File resourceFile = new File("data/vasc-bundle.properties");
if (resourceFile.exists()) {
readPropertiesFile(p,resourceFile);
}
for (String key:keys.keySet()) {
if (key==null) {
continue;
}
if (keys.get(key)==null) {
continue;
}
p.put(key, keys.get(key));
}
writePropertiesFile(p,resourceFile);
ResourceBundle.clearCache();
}
}
public JTabbedPane getTabPane() {
return tabPane;
}
protected void writePropertiesFile(Properties p,File file) {
try {
writePropertiesStream(p,new FileOutputStream(file));
} catch (Exception e) {
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
}
}
protected void readPropertiesFile(Properties p,File file) {
try {
readPropertiesStream(p,new FileInputStream(file));
} catch (Exception e) {
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
}
}
protected void writePropertiesStream(Properties p,OutputStream out) {
try {
p.store(out, "Saved by vasc auto i18n.");
} catch (Exception e) {
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
} finally {
if (out!=null) {
try {
out.close();
} catch (IOException e) {
}
}
}
}
protected void readPropertiesStream(Properties p,InputStream in) {
try {
p.load(in);
} catch (Exception e) {
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
} finally {
if (in!=null) {
try {
in.close();
} catch (IOException e) {
}
}
}
}
public void changeEvent() {
rebuildTree();
}
}

View file

@ -0,0 +1,188 @@
/*
* 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.tech.core.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
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.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaCsv;
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaJdbc;
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaMongodb;
/**
* JMainPanelMenuBar Adds all menu bar items.
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class JMainPanelMenuBar extends JMenuBar {
private static final long serialVersionUID = -2828428804621352725L;
JMenu fileMenu = new JMenu("File");
JMenu vascMenu = new JMenu("Vasc");
JMenu tabMenu = new JMenu("Tabs");
public JMainPanelMenuBar() {
createMenuItems();
add(fileMenu);
add(vascMenu);
add(tabMenu);
}
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();
VascTechDemo.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();
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
connectMetaCsvItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaCsv d = new JDialogMetaCsv(JApplication.getInstance().getMainFrame());
d.setVisible(true);
}
});
vascMenu.add(connectMetaCsvItem);
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
connectMetaXmlItem.setEnabled(false);
vascMenu.add(connectMetaXmlItem);
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
connectMetaMongoItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaMongodb d = new JDialogMetaMongodb(JApplication.getInstance().getMainFrame());
d.setVisible(true);
}
});
vascMenu.add(connectMetaMongoItem);
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
connectMetaJdbcItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialogMetaJdbc d = new JDialogMetaJdbc(JApplication.getInstance().getMainFrame());
d.setVisible(true);
}
});
vascMenu.add(connectMetaJdbcItem);
vascMenu.addSeparator();
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
removeEntryItem.setEnabled(false);
removeEntryItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
vascMenu.add(removeEntryItem);
JMenuItem removeAllItem = new JMenuItem("Remove all");
removeAllItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
VascBackendControllerLocal backends = (VascBackendControllerLocal)VascTechDemo.getInstance().getVascControllerService().getVascController().getVascBackendController();
VascEntryControllerLocal entries = (VascEntryControllerLocal)VascTechDemo.getInstance().getVascControllerService().getVascController().getVascEntryController();
for (String entryId:entries.getVascEntryIds()) {
if (entryId.startsWith("Vasc")) {
continue;
}
entries.removeVascEntry(entryId);
}
for (String backendId:backends.getVascBackendIds()) {
if (backendId.startsWith("Vasc")) {
continue;
}
backends.removeVascBackendById(backendId);
}
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
}
});
vascMenu.add(removeAllItem);
JMenuItem item = new JMenuItem("Close tab");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTabbedPane tabPane = VascTechDemo.getInstance().getSwingGuiService().getTabPane();
if (tabPane.getSelectedIndex()>=0) {
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
}
}
});
tabMenu.add(item);
JMenuItem itemAll = new JMenuItem("Close All tabs");
itemAll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTabbedPane tabPane = VascTechDemo.getInstance().getSwingGuiService().getTabPane();
for (int i=tabPane.getTabCount();i>0;i--) {
tabPane.removeTabAt(i-1); // todo release vasc frontend
}
}
});
tabMenu.add(itemAll);
}
}

View file

@ -0,0 +1,214 @@
/*
* 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.
*/
package net.forwardfire.vasc.demo.tech.core.ui;
import java.awt.Component;
import java.awt.Container;
import javax.swing.Spring;
import javax.swing.SpringLayout;
/**
* SpringLayoutGrid, someone should create an JCP to get these functions into
* SpringLayout object because this code is to much duplicated on many projects.
*
* A 1.4 file that provides utility methods for creating form- or grid-style
* layouts with SpringLayout. These utilities are used by several programs, such
* as SpringBox and SpringCompactGrid.
*/
public class SpringLayoutGrid {
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component is as big as the maximum
* preferred width and height of the components. The parent is made just big
* enough to fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons
.getConstraint(SpringLayout.SOUTH), yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring
.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST, Spring.sum(
Spring.constant(xPad), lastCons
.getConstraint(SpringLayout.EAST)));
}
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(int row,
int col, Container parent, int cols) {
SpringLayout layout = (SpringLayout) parent.getLayout();
Component c = parent.getComponent(row * cols + col);
return layout.getConstraints(c);
}
public static void makeCompactGrid(Container parent, int rows, int cols) {
makeCompactGrid(parent,rows,cols,6,6,6,6);
}
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component in a column is as wide as
* the maximum preferred width of the components in that column; height is
* similarly determined for each row. The parent is made just big enough to
* fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeCompactGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
}
//Align all cells in each column and make them the same width.
Spring x = Spring.constant(initialX);
for (int c = 0; c < cols; c++) {
Spring width = Spring.constant(0);
for (int r = 0; r < rows; r++) {
width = Spring.max(width, getConstraintsForCell(r, c, parent,
cols).getWidth());
}
for (int r = 0; r < rows; r++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setX(x);
constraints.setWidth(width);
}
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
}
//Align all cells in each row and make them the same height.
Spring y = Spring.constant(initialY);
for (int r = 0; r < rows; r++) {
Spring height = Spring.constant(0);
for (int c = 0; c < cols; c++) {
height = Spring.max(height, getConstraintsForCell(r, c, parent,
cols).getHeight());
}
for (int c = 0; c < cols; c++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setY(y);
constraints.setHeight(height);
}
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, y);
pCons.setConstraint(SpringLayout.EAST, x);
}
}

View file

@ -0,0 +1,112 @@
/*
* 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.tech.core.ui.actions;
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.tech.core.VascTechDemo;
/**
* JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class JDialogMetaCsv extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
public JDialogMetaCsv(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);
}
public void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
//result.setLayout(new SpringLayout());
result.add(new JLabel("File"));
JButton fileButton = new JButton("Open");
fileButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog((JButton)e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath());
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
schema.setDataContextProvider(ds);
schema.setEntryPrefix(file.getName());
schema.autoCreateEntries(VascTechDemo.getInstance().getVascControllerService().getVascController());
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
}
}
});
result.add(fileButton);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,136 @@
/*
* 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.tech.core.ui.actions;
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 javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.demo.tech.core.ui.SpringLayoutGrid;
/**
* JDialogMetaJdbc Add and runs MetaModel Schema Auto Entry code.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class JDialogMetaJdbc extends JDialog implements ActionListener {
private static final long serialVersionUID = -8638394652416472734L;
private JComboBox driverClassBox = null;
private JTextField connectUrlField = null;
private JTextField usernameField = null;
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 void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
result.setLayout(new SpringLayout());
result.add(new JLabel("Driver"));
driverClassBox = new JComboBox(new String[] {"org.postgresql.Driver","com.mysql.jdbc.Driver","org.apache.derby.jdbc.EmbeddedDriver","org.hsqldb.jdbcDriver","org.sqlite.JDBC"});
driverClassBox.setSelectedIndex(0);
result.add(driverClassBox);
result.add(new JLabel("Url"));
connectUrlField = new JTextField("jdbc:postgresql://localhost/dellstore2");
result.add(connectUrlField);
result.add(new JLabel("Username"));
usernameField = new JTextField("postgres");
result.add(usernameField);
result.add(new JLabel("Password"));
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(VascTechDemo.getInstance().getVascControllerService().getVascController());
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
}
});
result.add(fileButton);
result.add(new JLabel(""));
SpringLayoutGrid.makeCompactGrid(result, 5, 2);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,126 @@
/*
* 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.tech.core.ui.actions;
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 javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.demo.tech.core.ui.SpringLayoutGrid;
/**
* JDialogMetaMongodb Add and runs MetaModel Schema Auto Entry code.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class JDialogMetaMongodb extends JDialog implements 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 void clearAndHide() {
setVisible(false);
}
public JPanel createPanelCenter() {
JPanel result = new JPanel();
result.setLayout(new SpringLayout());
result.add(new JLabel("Hostname"));
hostNameField = new JTextField("localhost");
result.add(hostNameField);
result.add(new JLabel("Port"));
hostPortField = new JTextField("27017");
result.add(hostPortField);
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(VascTechDemo.getInstance().getVascControllerService().getVascController());
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
}
});
result.add(fileButton);
result.add(new JLabel(""));
SpringLayoutGrid.makeCompactGrid(result, 4, 2);
return result;
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,103 @@
/*
* 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.tech.core.x4o.vasc;
import java.util.Map;
import java.util.logging.Logger;
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
import net.forwardfire.vasc.demo.tech.core.service.tomcat.TomcatService;
import org.apache.catalina.Server;
import org.apache.catalina.deploy.ContextResource;
import org.apache.catalina.deploy.NamingResources;
import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException;
/**
* TomcatResourceElement Add a global DataSource to tomcat jndi context.
*
* @author Willem Cazander
* @version 1.0 May 13, 2012
*/
public class TomcatResourceElement extends AbstractElement {
private Logger logger = Logger.getLogger(TomcatResourceElement.class.getName());
/**
* @see org.x4o.xml.element.AbstractElement#doElementRun()
*/
@Override
public void doElementRun() throws ElementException {
// Check needed attributes
Map<String,String> attr = getAttributes();
if (attr.containsKey("name")==false) {
throw new ElementException("No attribute name found.");
}
if (attr.containsKey("auth")==false) {
throw new ElementException("No attribute auth found.");
}
if (attr.containsKey("type")==false) {
throw new ElementException("No attribute type found.");
}
// Set resource object fields.
ContextResource resource = new ContextResource();
String name = attr.remove("name");
resource.setName(name);
String auth = attr.remove("auth");
resource.setAuth(auth);
String type = attr.remove("type");
resource.setType(type);
String scope = attr.remove("scope");
if (scope!=null) {
resource.setScope(scope);
}
String closeMethod = attr.remove("closeMethod");
if (closeMethod!=null) {
resource.setCloseMethod(closeMethod);
}
String singleton = attr.remove("singleton");
if (singleton!=null) {
resource.setSingleton("true".equalsIgnoreCase(singleton));
}
String description = attr.remove("description");
if (description!=null) {
resource.setDescription(description);
}
// copy other stuff
for (String key:attr.keySet()) {
String value = attr.get(key);
resource.setProperty(key, value);
}
// add to tomcat
TomcatService tm = VascTechDemo.getInstance().getTomcatService();
Server server = tm.getServer();
NamingResources jndiContext = server.getGlobalNamingResources();
jndiContext.addResource(resource);
logger.info("Added jndi global resource: "+resource.getName());
}
}

View file

@ -0,0 +1,11 @@
config.charset=UTF-8
config.bundles=bundle1,bundle2
# bundle list to merge and load
bundle1.uri=net.forwardfire.vasc.demo.tech.core.ui.resources.JApplication
bundle2.uri=data/vasc-bundle.properties
bundle2.type=FILE
bundle2.optional=true

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>
Vasc namespace for the vasc tech demo
</comment>
<entry key="eld.http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld">vasc-tech-demo.eld</entry>
</properties>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
<eld:elementClass tag="tomcatResource" elementClassName="net.forwardfire.vasc.demo.tech.core.x4o.vasc.TomcatResourceElement"/>
</eld:root>

View file

@ -0,0 +1,136 @@
--
-- Create vasc demo database.
--
CREATE TABLE vasc_user (
id IDENTITY not null primary key,
username varchar not null,
password varchar not null,
description varchar not null,
);
CREATE UNIQUE INDEX vasc_user_username_idx ON vasc_user(username);
CREATE TABLE vasc_user_role (
id IDENTITY not null primary key,
username varchar not null,
role varchar not null
);
CREATE INDEX vasc_user_role_username_idx ON vasc_user_role(username);
CREATE TABLE vasc_user_change_field (
id IDENTITY not null primary key,
field varchar not null,
name varchar not null,
active boolean not null
);
CREATE INDEX vasc_user_change_field_active_idx ON vasc_user_change_field(active);
CREATE TABLE vasc_user_change_log (
id IDENTITY not null primary key,
user_id integer not null,
change_field_id integer not null,
value_old varchar not null,
value_new varchar not null
);
CREATE INDEX vasc_user_change_log_user_id_idx ON vasc_user_change_log(user_id);
CREATE INDEX vasc_user_change_log_id_idx ON vasc_user_change_log(user_id);
CREATE TABLE vasc_page (
id IDENTITY not null primary key,
slug varchar not null,
title varchar not null,
i18n_key boolean not null,
active boolean not null,
sitemap boolean not null,
roles varchar not null
);
CREATE INDEX vasc_page_slug_idx ON vasc_page(slug);
CREATE INDEX vasc_page_sitemap_idx ON vasc_page(sitemap);
CREATE TABLE vasc_page_part (
id IDENTITY not null primary key,
page_id integer not null,
title varchar not null,
text varchar not null,
i18n_key boolean not null,
active boolean not null,
sitemap boolean not null,
part_order integer not null,
part_type varchar not null,
roles varchar not null
);
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 (
id IDENTITY not null primary key,
href varchar not null,
title varchar not null,
target varchar not null,
active BOOLEAN NOT NULL,
roles varchar not null,
menu_order integer not null,
menu_type varchar not null
);
CREATE INDEX vasc_menu_active_idx ON vasc_menu(active);
CREATE INDEX vasc_menu_type_idx ON vasc_menu(menu_type);
--
-- Insert demo data.
--
INSERT INTO vasc_user VALUES(1, 'admin','admin123','Demo Admin user');
INSERT INTO vasc_user VALUES(2, 'demo', 'demo123', 'Demo user');
INSERT INTO vasc_user_role VALUES(1, 'admin', 'login');
INSERT INTO vasc_user_role VALUES(2, 'admin', 'admin');
INSERT INTO vasc_user_role VALUES(3, 'demo', 'login');
INSERT INTO vasc_user_change_field VALUES(1,'Username', 'username', TRUE);
INSERT INTO vasc_user_change_field VALUES(2,'Password', 'password', TRUE);
INSERT INTO vasc_user_change_field VALUES(3,'Description', 'description', TRUE);
INSERT INTO vasc_user_change_field VALUES(4,'Birthdate', 'date_age', TRUE);
-- ID SLUG TITLE I18N ACTIVE SITEMAP
INSERT INTO vasc_page VALUES(4, 'debug', 'Debug', FALSE, TRUE, FALSE);
INSERT INTO vasc_page VALUES(5, 'contact', '', TRUE, TRUE, TRUE);
INSERT INTO vasc_page VALUES(6, 'help', '', TRUE, TRUE, TRUE);
INSERT INTO vasc_page_part VALUES(1, 4, 'vasc', '', TRUE,TRUE,TRUE,1,'HTML');
INSERT INTO vasc_page_part VALUES(2, 4, 'jdbc', '', TRUE,TRUE,TRUE,2,'HTML');
INSERT INTO vasc_page_part VALUES(3, 4, 'jndi', '', TRUE,TRUE,TRUE,3,'HTML');
INSERT INTO vasc_page_part VALUES(4, 4, 'logback', '', TRUE,TRUE,TRUE,3,'HTML');
INSERT INTO vasc_page_part VALUES(5, 5, 'project', '', TRUE,TRUE,TRUE,1,'WIKI');
INSERT INTO vasc_page_part VALUES(6, 5, 'support', '', TRUE,TRUE,TRUE,2,'WIKI');
INSERT INTO vasc_page_part VALUES(7, 5, 'location', '', TRUE,TRUE,TRUE,3,'HTML');
INSERT INTO vasc_page_part VALUES(8, 6, 'server', '', TRUE,TRUE,TRUE,1,'WIKI');
INSERT INTO vasc_page_part VALUES(9, 6, 'vasc', '', TRUE,TRUE,TRUE,2,'WIKI');
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 VALUES(1, '/html/index.jsf','Home','',true,'',1,'BAR_RIGHT');
INSERT INTO vasc_menu VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
INSERT INTO vasc_menu VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
INSERT INTO vasc_menu VALUES(4, '/html/index.jsf','Home', '',true,'',1,'BAR_BOTTOM');
INSERT INTO vasc_menu VALUES(5, '/html/index.jsf','Contact', '',true,'',2,'BAR_BOTTOM');
INSERT INTO vasc_menu VALUES(6, '/html/index.jsf','Help', '',true,'',3,'BAR_BOTTOM');
INSERT INTO vasc_menu VALUES(7, '/html/index.jsf','Techno', '',true,'',3,'BAR_BOTTOM');
INSERT INTO vasc_menu VALUES(8, '/html/index.jsf','Licences', '',true,'',3,'BAR_BOTTOM');
INSERT INTO vasc_menu VALUES(10, '/vasc/AdminVascUser/list.jsf', 'Users', '',true,'admin',4,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(11, '/vasc/AdminVascUserRole/list.jsf', 'UserRoles', '',true,'admin',5,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(12, '/vasc/AdminVascUserChangeField/list.jsf', 'ChangeField', '',true,'admin',5,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(13, '/vasc/AdminVascUserChangeLog/list.jsf', 'ChangeFieldLog', '',true,'admin',5,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(14, '/vasc/AdminVascPage/list.jsf', 'Pages', '',true,'admin',5,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(15, '/vasc/AdminVascPagePart/list.jsf', 'PageParts', '',true,'admin',5,'PAGE_ADMIN');
INSERT INTO vasc_menu VALUES(16, '/vasc/AdminVascMenu/list.jsf', 'Menu', '',true,'admin',4,'PAGE_ADMIN');

View file

@ -0,0 +1,148 @@
#
# 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
Application.web.meta.robots = index, follow
Application.web.meta.description = Vasc Tech Demo Web Frontends
Application.web.meta.keywords = demo,forwardfire,x4o,vasc,java
Application.web.header.logo.alt = Vasc Tech Demo Logo
Application.web.header.login = Login
Application.web.header.logout = Logout
Application.web.footer.center = Vasc Tech Demo Web Based on JSF and Faclets and Richfaces.
Application.web.footer.left = Copyright &copy; 2012
Application.web.footer.right = Version 0.4.x<i>(beta)</i>
generic.active.labelText = active
generic.active.toolTipText = active
generic.createdDate.labelText = createdDate
generic.createdDate.toolTipText = createdDate
generic.description.labelText = description
generic.description.toolTipText = description
generic.id.labelText = id
generic.id.toolTipText = id
generic.modifiedDate.labelText = modifiedDate
generic.modifiedDate.toolTipText = modifiedDate
generic.name.labelText = name
generic.name.toolTipText = name
generic.orderNumber.labelText = orderNumber
generic.orderNumber.toolTipText = orderNumber
# hibernate validators
validator.assertFalse=assertion failed
validator.assertTrue=assertion failed
validator.future=Date must lie in the future
validator.length=Field must contain between {min} and {max} characters.
validator.max=Value must be equal to or lower than {value}
validator.min=Value must be equal to or higher than {value}
validator.notNull=A value must be entered
validator.past=Date must lie in the future
validator.pattern=Value must conform to "{regex}"
validator.range=Value must lie between {min} and {max}
validator.size=There must be between {min} and {max} characters
validator.email=The value must be a valid e-mail address
# vasc validators
vasc.validator.VascDateFutureValidator=The date must lie in the future.
vasc.validator.VascDatePastValidator=The date must lie in the past.
vasc.validator.VascIntSizeValidator=Value must lie between {0} and {1}
vasc.validator.VascLongSizeValidator=Value must lie between {0} and {1}
vasc.validator.VascObjectNotNullValidator=A value must be entered
vasc.validator.VascObjectNullValidator=No value may be entered
vasc.validator.VascStringEmailValidator=The value must be a valid e-mail address
vasc.validator.VascStringLengthValidator=There must be at least {0} and at most {1} items
vasc.validator.VascStringRegexValidator=Value must conform to "{0}"
vasc.validator.VascStringZipCodeValidator=Value must be a valid post code.
# Vasc actions labels
vasc.action.addRowAction.description = add a new record
vasc.action.addRowAction.name = Add
vasc.action.deleteRowAction.description = delete
vasc.action.deleteRowAction.name = delete
vasc.action.downloadAction.description = Select this record.
vasc.action.downloadAction.name = Select
vasc.action.editRowAction.description = edit
vasc.action.editRowAction.name = Edit
vasc.action.csvExportAction.description = CSV
vasc.action.csvExportAction.name = CSV
vasc.action.xmlExportAction.description = XML
vasc.action.xmlExportAction.name = XML
vasc.action.xmltreeExportAction.description = XMLTree
vasc.action.xmltreeExportAction.name = XMLTree
vasc.action.jrPdfLandscapeExportAction.description = jrPdfLandscape
vasc.action.jrPdfLandscapeExportAction.name = PDF-Landscape
vasc.action.jrPdfPortraitExportAction.description = jrPdfPortrait
vasc.action.jrPdfPortraitExportAction.name = PDF-Portrait
vasc.action.jrRtfExportAction.description = RTF
vasc.action.jrRtfExportAction.name = RTF
vasc.action.jrXlsExportAction.description = XLS
vasc.action.jrXlsExportAction.name = XLS
vasc.action.jrXmlExportAction.description = JR-XML
vasc.action.jrXmlExportAction.name = JR-XML
vasc.action.jrCsvExportAction.description = JR-CSV
vasc.action.jrCsvExportAction.name = JR-CSV
# Temp jsf
generic.vasc.jsf.listOption.header = Searchoptions
generic.vasc.jsf.listOption.search = Searh\:
generic.vasc.jsf.listOption.sumbit = Search
generic.vasc.jsf.pager.previous = Previous
generic.vasc.jsf.pager.next = Next
generic.vasc.jsf.table.rows = Row Numbers\:
generic.vasc.jsf.table.pagerDirect = Go to\:
generic.vasc.jsf.table.downloadDirect = Download\:
generic.vasc.jsf.table.resultText = Results {0}-{1} from {2} rows
generic.vasc.jsf.table.download.img = Save table data.
generic.vasc.jsf.table.printer.img = Shows the table in printer friendly format.
generic.vasc.jsf.table.export.select = ...
generic.vasc.jsf.table.export.select.alt = Select Export
generic.vasc.jsf.table.page.select = ...
generic.vasc.jsf.table.page.select.alt = Select Page
generic.vasc.jsf.table.page.name = Page:
generic.vasc.jsf.table.page.description = Goto page:
generic.vasc.jsf.tableHeader.fields = Fields
generic.vasc.jsf.tableHeader.links = Links
generic.vasc.jsf.tableHeader.actions = Actions
generic.vasc.jsf.multiAction.selectAll = Select all:
generic.vasc.jsf.multiAction.name = ...
generic.vasc.jsf.multiAction.description = Select Action
generic.vasc.jsf.action.save = Save
generic.vasc.jsf.action.cancel = Cancel
generic.vasc.jsf.action.back = Back
generic.vasc.jsf.parentSelected = Selected:
vasc.dialog.edit.message = Edit
vasc.dialog.save.name = Save
vasc.dialog.cancel.name = Cancel

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech-editor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -1,12 +0,0 @@
<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>
<artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech-editor</artifactId>
<name>vasc-demo-tech-editor</name>
<description>vasc-demo-tech-editor</description>
</project>

View file

@ -1,189 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<x4o:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
xmlns:x4o="http://eld.x4o.org/eld/x4o-lang.eld"
>
<v:virtualVascBackend id="VascEntryBackend" vascController="${vascController}" vascType="entry"/>
<v:entry id="VascEntry" backendId="VascEntryBackend">
<v:field id="id"/>
<v:field id="backendId"/>
<v:field id="name"/>
<v:field id="helpId" list="false"/>
<v:field id="image" list="false"/>
<v:field id="listDescription" list="false"/>
<v:field id="listImage" list="false"/>
<v:field id="editDescription" list="false"/>
<v:field id="editImage" list="false"/>
<v:field id="deleteDescription" list="false"/>
<v:field id="deleteImage" list="false"/>
<v:field id="createDescription" list="false"/>
<v:field id="createImage" list="false"/>
<v:field id="primaryKeyFieldId" list="false"/>
<v:field id="displayNameFieldId" list="false"/>
<v:field id="vascDisplayOnly" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="vascAdminList" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="vascAdminEdit" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="vascAdminCreate" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="vascAdminDelete" list="false" vascEntryFieldType="BooleanField"/>
<v:link id="VascEntryField" vascEntryId="VascEntryFieldLink">
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
</v:link>
<v:link id="VascEntryFieldSet" vascEntryId="VascEntryFieldSetLink">
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
</v:link>
<v:link id="VascLinkEntry" vascEntryId="VascLinkEntryLink">
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
</v:link>
<v:link id="VascListOption" vascEntryId="VascListOptionLink">
<v:linkEntryCreateFieldValue valueFieldId="vascEntry"/>
<v:linkEntryParameter name="entry_id" valueFieldId="id"/>
</v:link>
</v:entry>
<v:virtualVascBackend id="VascEntryFieldLinkBackend" vascController="${vascController}" vascType="field" />
<v:entry id="VascEntryFieldLink" backendId="VascEntryFieldLinkBackend">
<v:field id="id"/>
<v:field id="backendName" list="false"/>
<v:field id="displayName" list="false"/>
<v:field id="vascEntryFieldType" list="false" editReadOnly="true"/>
<v:field id="vascEntryFieldValue" list="false" editReadOnly="true"/>
<v:field id="name"/>
<v:field id="description" list="false"/>
<v:field id="helpId" list="false"/>
<v:field id="image" list="false"/>
<v:field id="orderIndex" vascEntryFieldType="IntegerField"/>
<v:field id="defaultValue"/>
<v:field id="sizeList" list="false" vascEntryFieldType="IntegerField"/>
<v:field id="sizeEdit" list="false" vascEntryFieldType="IntegerField"/>
<v:field id="styleList" list="false"/>
<v:field id="styleEdit" list="false"/>
<v:field id="choices" list="false"/>
<v:field id="choicesAsRadio" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="view" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="create" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="edit" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="editReadOnly" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="editBlank" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="list" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="rolesCreate" list="false"/>
<v:field id="rolesEdit" list="false"/>
<v:field id="rolesEditReadOnly" list="false"/>
<v:field id="rolesList" list="false"/>
<v:field id="sortable" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="sumable" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="graphable" list="false" vascEntryFieldType="BooleanField"/>
<!-- private List<VascValidator> vascValidators = null; -->
</v:entry>
<v:virtualVascBackend id="VascEntryFieldSetLinkBackend" vascController="${vascController}" vascType="fieldset" />
<v:entry id="VascEntryFieldSetLink" backendId="VascEntryFieldSetLinkBackend">
<v:field id="id"/>
<v:field id="name"/>
<v:field id="description" list="false"/>
<v:field id="helpId" list="false"/>
<v:field id="image" list="false"/>
<v:field id="styleList" list="false"/>
<v:field id="styleEdit" list="false"/>
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
<!-- private List<String> vascEntryFieldIds = null; -->
</v:entry>
<v:virtualVascBackend id="VascLinkEntryLinkBackend" vascController="${vascController}" vascType="linkentries" />
<v:entry id="VascLinkEntryLink" backendId="VascLinkEntryLinkBackend">
<v:field id="id"/>
<v:field id="vascEntryId"/>
<v:field id="vascLinkEntryType" list="false" vascEntryFieldType="ListField">
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.core.VascLinkEntryType"/>
</v:field>
<v:field id="doActionId" list="false"/>
<v:field id="name" list="false"/>
<!--
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
-->
</v:entry>
<v:virtualVascBackend id="VascListOptionLinkBackend" vascController="${vascController}" vascType="listoptions" />
<v:entry id="VascListOptionLink" backendId="VascListOptionLinkBackend">
<v:field id="id"/>
<v:field id="name"/>
<v:field id="description" list="false"/>
<v:field id="helpId" list="false"/>
<v:field id="image" list="false"/>
<v:field id="styleList" list="false"/>
<v:field id="styleEdit" list="false"/>
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
<!-- private List<String> vascEntryFieldIds = null; -->
</v:entry>
<!--
<m:mongodbConnectionProvider
el.id="lefiona_connection"
hostname="localhost"
database="lefiona"
/>
<m:mongodbBackend
id="dg2_smiles_backend"
connectionProvider="${lefiona_connection}"
collection="dg2_smiles"
/>
<v:entry id="dg2_smiles" backendId="dg2_smiles_backend">
<v:field id="_id" readOnly="true" list="false"/>
<v:field id="text" vascEntryFieldType="TextAreaField"/>
<v:field id="profile_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
</v:field>
<v:field id="cron_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="BASE,DAILY,WEEKLY,MONTLY"/>
</v:field>
<v:field id="group"/>
<v:field id="active" vascEntryFieldType="BooleanField"/>
</v:entry>
<m:mongodbBackend
id="dg2_profiles_backend"
connectionProvider="${lefiona_connection}"
collection="dg2_profiles"
/>
<v:entry id="dg2_profiles" backendId="dg2_profiles_backend">
<v:field id="_id" readOnly="true" list="false"/>
<v:field id="url"/>
<v:field id="name"/>
<v:field id="active" vascEntryFieldType="BooleanField"/>
<v:field id="body_text" list="false" vascEntryFieldType="TextAreaField"/>
<v:field id="profile_type" vascEntryFieldType="ListField">
<v:vascSelectItemModelString data="MALE,FEMALE,BOTH"/>
</v:field>
<v:field id="send_jokers" vascEntryFieldType="IntegerField"/>
<v:field id="run_date" vascEntryFieldType="DateField"/>
</v:entry>
-->
</x4o:root>

View file

@ -20,7 +20,7 @@
</resources>
</build>
<dependencies>
<!-- Vasc dep -->
<!-- All is on provided because we run in embedded mode without class loader isolation -->
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-jsf</artifactId>
@ -28,37 +28,45 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-core</artifactId>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-metamodel</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Web tech deps -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.15.B1</version>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>${javax.faces.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_12</version>
<scope>provided</scope>
<groupId>net.jawr</groupId>
<artifactId>jawr</artifactId>
<version>${jawr.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2_12</version>
<scope>provided</scope>
<groupId>de.tudarmstadt.ukp.wikipedia</groupId>
<artifactId>de.tudarmstadt.ukp.wikipedia.api</artifactId>
<version>0.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>${rewrite-servlet.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,46 @@
/*
* Copyright 2009-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.tech.web.beans;
import javax.faces.context.FacesContext;
/**
* ContextPathController removes the / from application.contextPath so root and non-root deployments work correct.
* This a workaround of bug in servlet impl or jsf impl.
*
* @author Willem Cazander
* @version 1.0 May 16, 2012
*/
//@ManagedBean(name="contextPathController",eager=true)
//@ApplicationScoped
public class ContextPathController {
public String getRootPath() {
FacesContext context = FacesContext.getCurrentInstance();
String contextPath = context.getExternalContext().getRequestContextPath();
if (contextPath.endsWith("/")==false) {
return contextPath;
}
return contextPath.substring(0,contextPath.length()-1);
}
}

View file

@ -6,8 +6,7 @@ import java.util.List;
import javax.faces.model.SelectItem;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
import net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider;
import net.forwardfire.vasc.impl.jndi.JndiVascControllerProvider;
public class ExportController {
@ -17,15 +16,25 @@ public class ExportController {
private VascController vascController = null;
public ExportController() {
DemoVascControllerProvider provider = new DemoVascControllerProvider();
vascController = provider.getVascController();
try {
JndiVascControllerProvider p = new JndiVascControllerProvider();
p.setJndiName("java:comp/env/vasc/DemoVascController");
vascController = p.getVascController();
} catch (Exception e) {
e.printStackTrace();
}
}
public List<SelectItem> getEntryIdSelectItems() {
List<SelectItem> result = new ArrayList<SelectItem>();
for (String entryId:vascController.getVascEntryController().getVascEntryIds()) {
SelectItem i = new SelectItem();
i.setLabel(entryId);
String label = entryId;
while (label.length()>40) {
label = label.substring(10);
}
i.setLabel("..."+label);
i.setDescription(entryId);
i.setValue(entryId);
result.add(i);
}
@ -34,10 +43,10 @@ public class ExportController {
public List<SelectItem> getExportTypeSelectItems() {
List<SelectItem> result = new ArrayList<SelectItem>();
for (VascEntryExporter ex:vascController.getVascEntryConfigController().getVascEntryExporters()) {
for (String exportId:vascController.getVascEntryConfigController().getVascEntryExporterIds()) {
SelectItem i = new SelectItem();
i.setLabel(ex.getId());
i.setValue(ex.getId());
i.setLabel(exportId);
i.setValue(exportId);
result.add(i);
}
return result;
@ -46,7 +55,7 @@ public class ExportController {
public String getBuildExportUrl() {
StringBuilder buff = new StringBuilder();
if (exportTree) {
buff.append("export-tree/");
buff.append("export/");
buff.append(getEntryId());
buff.append('/');
buff.append(getExportType());
@ -101,6 +110,4 @@ public class ExportController {
public void setExportTree(boolean exportTree) {
this.exportTree = exportTree;
}
}

View file

@ -22,8 +22,13 @@
package net.forwardfire.vasc.demo.tech.web.beans;
import java.io.IOException;
import java.io.Serializable;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpSession;
import net.forwardfire.vasc.demo.tech.web.models.WebUser;
/**
@ -34,39 +39,69 @@ import net.forwardfire.vasc.demo.tech.web.models.WebUser;
public class UserController implements Serializable {
private static final long serialVersionUID = 1L;
private WebUser webUser = null;
static public final String WEB_USER_SESSION_KEY = "webUser";
public void loginFilter() {
public String getWebUserName() {
WebUser user = getWebUser();
if (user!=null) {
return user.getFullName();
}
return "No-name";
}
public WebUser getWebUser() {
WebUser user = (WebUser)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(WEB_USER_SESSION_KEY);
if (user!=null) {
return user;
}
if (isUserLoggedin()==false) {
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("/demo/html/auth/error.jsf");
} catch (IOException ioe) {
throw new RuntimeException("Could not redirect user to login-form.: "+ioe.getMessage(),ioe);
}
}
HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true);
session.setMaxInactiveInterval(20*60); // 20 minutes.
// fetch user info and settings/etc/etc from db.
user = new WebUser();
user.setId(123l);
user.setFullName(FacesContext.getCurrentInstance().getExternalContext().getRemoteUser());
user.setLoginName(FacesContext.getCurrentInstance().getExternalContext().getRemoteUser());
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(WEB_USER_SESSION_KEY, user);
return user;
}
public void logoutAction(ActionEvent event) {
HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true);
session.invalidate();
try {
//logUser = loginManager.getUser();
//logRightRoles = loginManager.getClientRoles();
webUser = new WebUser();
webUser.setLoginName( "test123");
webUser.setFullName( "test1234567890");
} catch (Exception e) {
throw new RuntimeException(e);
FacesContext.getCurrentInstance().getExternalContext().redirect("/demo/html/auth/logout.jsf");
} catch (IOException ioe) {
throw new RuntimeException("Could not redirect user to login-form.: "+ioe.getMessage(),ioe);
}
}
public void logoutFilter() {
webUser = null;
//logRightRoles = null;
public boolean hasUserPrincipal() {
return FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal()!=null;
}
public boolean hasUserRole(String role) {
return FacesContext.getCurrentInstance().getExternalContext().isUserInRole(role);
}
public boolean isUserLoggedin() {
if (webUser==null) {
return false;
}
return true;
return hasUserRole("login");
}
public WebUser getUser() {
return webUser;
public boolean isRoleUserLogin() {
return hasUserRole("login");
}
//public List<LogRightRole> getRightRoles() {
// return logRightRoles;
//}
public boolean isRoleUserAdmin() {
return hasUserRole("admin");
}
}

View file

@ -0,0 +1,137 @@
package net.forwardfire.vasc.demo.tech.web.faces;
import java.io.InputStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicReference;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.PreRenderViewEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
import org.richfaces.resource.ResourceKey;
import com.sun.faces.renderkit.html_basic.ScriptRenderer;
import com.sun.faces.renderkit.html_basic.StylesheetRenderer;
/**
* <p>
* Satisfies that links for selected RichFaces won't be put to renderer view.
* </p>
*
* <p>
* Resource which should not be loaded are selected by condition in {@link #shouldNotBeLoaded(ResourceKey, String)}.
* </p>
*
* @author Lukas Fryc
*/
public class NoneLoadStyleResourceEventListener implements SystemEventListener {
private static final String STATIC_MAPPING_FILE = "META-INF/richfaces/staticResourceMapping/Static.properties";
private AtomicReference<Properties> propertiesRef = new AtomicReference<Properties>();
public void processEvent(SystemEvent event) throws AbortProcessingException {
if (event instanceof PreRenderViewEvent) {
putSelectedResourceKeysToContextMap();
}
}
public boolean isListenerForSource(Object source) {
return source instanceof UIViewRoot;
}
/**
* <p>
* Adds all keys of resources which meets {@link #shouldNotBeLoaded(ResourceKey, String)} condition to context map.
* </p>
*
* <p>
* Adding resource key to context map ensures that {@link ScriptRenderer} {@link StylesheetRenderer} won't render the link
* to page.
* </p>
*/
private void putSelectedResourceKeysToContextMap() {
FacesContext facesContext = FacesContext.getCurrentInstance();
loadStaticResourceMappingProperties();
for (Entry<Object, Object> entry : propertiesRef.get().entrySet()) {
ResourceKey resourceKey = ResourceKey.create((String) entry.getKey());
if (shouldNotBeLoaded(resourceKey)) {
putResourceKeyToContextMap(facesContext, resourceKey);
}
}
}
/**
* Loads configuration of static resource mapping which lists all RichFaces resources.
*/
private void loadStaticResourceMappingProperties() {
if (propertiesRef.get() == null) {
Properties loadedProperties = new Properties();
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(STATIC_MAPPING_FILE);
try {
loadedProperties.load(inputStream);
} catch (Exception e) {
throw new RuntimeException("Unable to load resource-mapping configuration file", e);
}
propertiesRef.compareAndSet(null, loadedProperties);
}
}
/**
* <p>
* Adds resource key to context map.
* </p>
*
* <p>
* Adding resource key to context map ensures that {@link ScriptRenderer} {@link StylesheetRenderer} won't render the link
* to page.
* </p>
*
* @param facesContext the current {@link FacesContext} instance
* @param resourceKey the key of the resource
*/
private void putResourceKeyToContextMap(FacesContext facesContext, ResourceKey resourceKey) {
Map<Object, Object> contextMap = facesContext.getAttributes();
String resourceName = resourceKey.getResourceName();
String libraryName = resourceKey.getLibraryName();
String key = resourceName + libraryName;
if (!contextMap.containsKey(key)) { // stylesheets (with this name + library) will not be rendered multiple
// times per request
contextMap.put(key, Boolean.TRUE);
}
if (libraryName == null || libraryName.isEmpty()) { // also store this in the context map with library as
// "null"
libraryName = "null";
key = resourceName + libraryName;
if (!contextMap.containsKey(key)) {
contextMap.put(key, Boolean.TRUE);
}
}
}
/**
* Returns true if given resourceKey should not be loaded for current view.
*
* @param resourceKey the key of the resource
* @return true if given resourceKey should not be loaded for current view; false otherwise
*/
private boolean shouldNotBeLoaded(ResourceKey resourceKey) {
String resourceName = resourceKey.getResourceName();
return resourceName.endsWith(".js") || resourceName.endsWith(".css") || resourceName.endsWith(".ecss");
}
}

View file

@ -0,0 +1,103 @@
package net.forwardfire.vasc.demo.tech.web.faces;
import javax.servlet.ServletContext;
import org.ocpsoft.rewrite.config.And;
import org.ocpsoft.rewrite.config.Condition;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.config.Direction;
import org.ocpsoft.rewrite.config.Operation;
import org.ocpsoft.rewrite.context.EvaluationContext;
import org.ocpsoft.rewrite.event.Rewrite;
import org.ocpsoft.rewrite.servlet.config.Forward;
import org.ocpsoft.rewrite.servlet.config.HttpCondition;
import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
import org.ocpsoft.rewrite.servlet.config.Path;
import org.ocpsoft.rewrite.servlet.config.Redirect;
import org.ocpsoft.rewrite.servlet.config.rule.Join;
import org.ocpsoft.rewrite.servlet.http.event.HttpServletRewrite;
public class UrlRewriteConfigurationProvider extends HttpConfigurationProvider {
public Configuration getConfiguration(ServletContext context) {
HttpCondition authUser = new HttpCondition() {
@Override
public boolean evaluateHttp(HttpServletRewrite httpRewrite,EvaluationContext context) {
return httpRewrite.getRequest().getUserPrincipal()!=null;
}
};
HttpCondition authUserAdmin = new HttpCondition() {
@Override
public boolean evaluateHttp(HttpServletRewrite httpRewrite,EvaluationContext context) {
return httpRewrite.getRequest().isUserInRole("admin");
}
};
return ConfigurationBuilder.begin()
.addRule(Join.path("/yoyo").to("/html/index.jsf"))
.defineRule()
.when(Direction.isInbound().
and(Path.matches("/login")).
andNot(authUser)
).
perform(
Redirect.temporary("/html/user/index.jsf")
)
.defineRule()
.when(Direction.isInbound().
and(Path.matches("/login")).
and(authUser)
).
perform(
Forward.to("/html/user/index.jsf")
)
.defineRule()
.when(Direction.isInbound().
and(Path.matches("/home")).
andNot(authUser)
).
perform(
Forward.to("/html/index.jsf")
)
.defineRule()
.when(Direction.isInbound().
and(Path.matches("/home")).
and(authUserAdmin)
).
perform(
Forward.to("/html/admin/index.jsf")
)
.defineRule()
.when(Direction.isInbound().
and(Path.matches("/home")).
and(authUser)
).
perform(
Forward.to("/html/user/index.jsf")
)
;
/*
.addRule(Join.path("/").to("/pages/loggedOffHome.xhtml")
.when(loggedIn)
.defineRule()
.when(Direction.isInbound()
.and(Path.matches("/(signup|login)")
.andNot(loggedIn)))
.perform(Redirect.temporary(context.getContextPath() + "/"));
*/
}
public int priority() {
return 0;
}
}

View file

@ -0,0 +1,212 @@
/*
* Copyright 2009-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.tech.web.menu;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import net.forwardfire.vasc.demo.tech.web.beans.UserController;
import net.forwardfire.vasc.demo.tech.web.menu.model.VascMenu;
import net.forwardfire.vasc.demo.tech.web.menu.model.VascMenuType;
/**
* MenuController Shows the menu for the user.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class MenuController implements Serializable {
private static final long serialVersionUID = -6820749860984575869L;
private List<VascMenu> userVascMenu = null;
private VascMenuComparator vascMenuComparator = null;
private UserController userController = null;
public List<VascMenu> fetchVascMenu() {
//if (userVascMenu!=null) {
// return userVascMenu;
//}
vascMenuComparator = new VascMenuComparator();
userVascMenu = new ArrayList<VascMenu>(50);
/*
MetaModelDataContextJndiDataSource dsFactory = new MetaModelDataContextJndiDataSource();
dsFactory.setJndiName("java:comp/env/jdbc/vascDemoDS");
DataContext ds = dsFactory.getDataContext();
Table table = ds.getDefaultSchema().getTableByName("vasc_menu");
DataSet data = ds.query().from(table).select(table.getColumns()).execute();
List<VascMenu> result = new ArrayList<VascMenu>(50);
Iterator<Row> i = data.iterator();
while (i.hasNext()) {
Row row = i.next();
}*/
Connection connection = null;
try {
DataSource ds = getDataSource("java:comp/env/jdbc/DemoManagerDataDS");
connection = ds.getConnection();
Statement s = connection.createStatement();
s.execute("SELECT * FROM VASC_MENU");
ResultSet rs = s.getResultSet();
//int cols = rs.getMetaData().getColumnCount();
while (rs.next()) {
VascMenu menu = new VascMenu();
menu.setId(rs.getInt(1));
menu.setHref(rs.getString(2));
menu.setTitle(rs.getString(3));
menu.setTarget(rs.getString(4));
menu.setActive(rs.getBoolean(5));
menu.setRoles(rs.getString(6));
menu.setMenuOrder(rs.getInt(7));
menu.setMenuType(VascMenuType.valueOf(rs.getString(8)));
if (filterVascMenuRoles(menu)==false) {
continue;
}
userVascMenu.add(menu);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (connection!=null) {
try {
connection.close();
} catch (Exception e) {
}
}
}
return userVascMenu;
}
private DataSource getDataSource(String name) throws SQLException {
try {
Context initialContext = new InitialContext();
DataSource datasource = (DataSource)initialContext.lookup(name);
if ( datasource == null ) {
throw new SQLException("Cannot lookup datasource: "+name);
}
return datasource;
} catch ( NamingException e ) {
throw new SQLException("Cannot get connection " + e,e);
}
}
private boolean filterVascMenuRoles(VascMenu menu) {
if (menu.getActive()!=null && menu.getActive()==false) {
return false;
}
if (menu.getRoles()!=null && menu.getRoles().isEmpty()==false) {
String[] roles = menu.getRoles().split(",");
for (String role:roles) {
if (role.isEmpty()) {
continue;
}
if (userController.hasUserRole(role)==false) {
return false;
}
}
}
return true;
}
private List<VascMenu> getMenuFiltered(VascMenuType type) {
if (type==null) {
throw new NullPointerException("Can't filter on null type.");
}
List<VascMenu> result = new ArrayList<VascMenu>(15);
for (VascMenu menu:fetchVascMenu()) {
if (type.equals(menu.getMenuType())) {
result.add(menu);
}
}
Collections.sort(result,vascMenuComparator);
return result;
}
public List<VascMenu> getMenuBarLeft() {
return getMenuFiltered(VascMenuType.BAR_LEFT);
}
public List<VascMenu> getMenuBarRight() {
return getMenuFiltered(VascMenuType.BAR_RIGHT);
}
public List<VascMenu> getMenuBarBottom() {
return getMenuFiltered(VascMenuType.BAR_BOTTOM);
}
public List<VascMenu> getMenuPageIndex() {
return getMenuFiltered(VascMenuType.PAGE_INDEX);
}
public List<VascMenu> getMenuPageUserLeft() {
return getMenuFiltered(VascMenuType.PAGE_USER_LEFT);
}
public List<VascMenu> getMenuPageUserRight() {
return getMenuFiltered(VascMenuType.PAGE_USER_RIGHT);
}
public List<VascMenu> getMenuPageAdmin() {
return getMenuFiltered(VascMenuType.PAGE_ADMIN);
}
public List<VascMenu> getMenu0() {
return getMenuFiltered(VascMenuType.MENU0);
}
public List<VascMenu> getMenu1() {
return getMenuFiltered(VascMenuType.MENU1);
}
public List<VascMenu> getMenu2() {
return getMenuFiltered(VascMenuType.MENU2);
}
/**
* @return the userController
*/
public UserController getUserController() {
return userController;
}
/**
* @param userController the userController to set
*/
public void setUserController(UserController userController) {
this.userController = userController;
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2009-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.tech.web.menu;
import java.io.Serializable;
import java.util.Comparator;
import net.forwardfire.vasc.demo.tech.web.menu.model.VascMenu;
/**
* VascMenuComparator orders the menu items.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class VascMenuComparator implements Serializable,Comparator<VascMenu> {
private static final long serialVersionUID = 386631856823832371L;
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());
}
}

View file

@ -0,0 +1,153 @@
/*
* Copyright 2009-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.tech.web.menu.model;
/**
* VascMenu stores menu item information.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class VascMenu {
private Integer id = null;
private String href = null;
private String title = null;
private String target = null;
private Boolean active = null;
private String roles = null;
private Integer menuOrder = null;
private VascMenuType menuType = null;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the href
*/
public String getHref() {
return href;
}
/**
* @param href the href to set
*/
public void setHref(String href) {
this.href = href;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the target
*/
public String getTarget() {
return target;
}
/**
* @param target the target to set
*/
public void setTarget(String target) {
this.target = target;
}
/**
* @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;
}
/**
* @return the menuType
*/
public VascMenuType getMenuType() {
return menuType;
}
/**
* @param menuType the menuType to set
*/
public void setMenuType(VascMenuType menuType) {
this.menuType = menuType;
}
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2009-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.tech.web.menu.model;
/**
* VascMenuType defines all menu lists on page.
*
* @author Willem Cazander
* @version 1.0 May 26, 2012
*/
public enum VascMenuType {
BAR_LEFT,
BAR_RIGHT,
BAR_BOTTOM,
MENU0,
MENU1,
MENU2,
PAGE_INDEX,
PAGE_USER_LEFT,
PAGE_USER_RIGHT,
PAGE_ADMIN,
PAGE_HELP
}

View file

@ -1,16 +1,24 @@
package net.forwardfire.vasc.demo.tech.web.models;
import java.util.ArrayList;
import java.util.List;
public class WebUser {
private Long id = null;
private String loginName = null;
private String fullName = null;
private List<String> groups = null;
public WebUser() {
groups = new ArrayList<String>(20);
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
@ -40,11 +48,4 @@ public class WebUser {
public void setFullName(String fullName) {
this.fullName = fullName;
}
/**
* @return the groups
*/
public List<String> getGroups() {
return groups;
}
}

View file

@ -0,0 +1,167 @@
/*
* Copyright 2009-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.tech.web.pages;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import net.forwardfire.vasc.demo.tech.web.beans.UserController;
import net.forwardfire.vasc.demo.tech.web.menu.VascMenuComparator;
/**
* MenuController Shows the menu for the user.
*
* @author Willem Cazander
* @version 1.0 May 19, 2012
*/
public class VascPageController implements Serializable {
private static final long serialVersionUID = -6820749860984575869L;
//private List<VascMenu> userVascMenu = null;
//private VascMenuComparator vascMenuComparator = null;
private UserController userController = null;
/*
public List<VascMenu> fetchVascPage() {
vascMenuComparator = new VascMenuComparator();
userVascMenu = new ArrayList<VascMenu>(50);
Connection connection = null;
try {
DataSource ds = getDataSource("java:comp/env/jdbc/DemoManagerDataDS");
connection = ds.getConnection();
Statement s = connection.createStatement();
s.execute("SELECT * FROM VASC_MENU");
ResultSet rs = s.getResultSet();
//int cols = rs.getMetaData().getColumnCount();
while (rs.next()) {
VascMenu menu = new VascMenu();
menu.setId(rs.getInt(1));
menu.setHref(rs.getString(2));
menu.setTitle(rs.getString(3));
menu.setTarget(rs.getString(4));
menu.setActive(rs.getBoolean(5));
menu.setRoles(rs.getString(6));
menu.setMenuOrder(rs.getInt(7));
menu.setMenuType(VascMenuType.valueOf(rs.getString(8)));
if (filterVascMenuRoles(menu)==false) {
continue;
}
userVascMenu.add(menu);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (connection!=null) {
try {
connection.close();
} catch (Exception e) {
}
}
}
return userVascMenu;
}
private DataSource getDataSource(String name) throws SQLException {
try {
Context initialContext = new InitialContext();
DataSource datasource = (DataSource)initialContext.lookup(name);
if ( datasource == null ) {
throw new SQLException("Cannot lookup datasource: "+name);
}
return datasource;
} catch ( NamingException e ) {
throw new SQLException("Cannot get connection " + e,e);
}
}
private boolean filterVascMenuRoles(VascMenu menu) {
if (menu.getActive()!=null && menu.getActive()==false) {
return false;
}
if (menu.getRoles()!=null && menu.getRoles().isEmpty()==false) {
String[] roles = menu.getRoles().split(",");
for (String role:roles) {
if (role.isEmpty()) {
continue;
}
if (userController.hasUserRole(role)==false) {
return false;
}
}
}
return true;
}
private List<VascMenu> getMenuFiltered(VascMenuType type) {
if (type==null) {
throw new NullPointerException("Can't filter on null type.");
}
List<VascMenu> result = new ArrayList<VascMenu>(15);
for (VascMenu menu:fetchVascMenu()) {
if (type.equals(menu.getMenuType())) {
result.add(menu);
}
}
Collections.sort(result,vascMenuComparator);
return result;
}
public List<VascMenu> getMenuBarLeft() {
return getMenuFiltered(VascMenuType.BAR_LEFT);
}
public List<VascMenu> getMenuBarRight() {
return getMenuFiltered(VascMenuType.BAR_RIGHT);
}
*/
/**
* @return the userController
*/
public UserController getUserController() {
return userController;
}
/**
* @param userController the userController to set
*/
public void setUserController(UserController userController) {
this.userController = userController;
}
}

View file

@ -0,0 +1,139 @@
/*
* Copyright 2009-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.tech.web.pages.model;
/**
* VascPage stores dynamic page information.
*
* @author Willem Cazander
* @version 1.0 May 31, 2012
*/
public class VascPage {
private Integer id = null;
private String slug = null;
private String title = null;
private Boolean i18nKey = null;
private Boolean active = null;
private Boolean sitemap = null;
private String roles = null;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the slug
*/
public String getSlug() {
return slug;
}
/**
* @param slug the slug to set
*/
public void setSlug(String slug) {
this.slug = slug;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the i18nKey
*/
public Boolean getI18nKey() {
return i18nKey;
}
/**
* @param i18nKey the i18nKey to set
*/
public void setI18nKey(Boolean i18nKey) {
this.i18nKey = i18nKey;
}
/**
* @return the active
*/
public Boolean getActive() {
return active;
}
/**
* @param active the active to set
*/
public void setActive(Boolean active) {
this.active = active;
}
/**
* @return the sitemap
*/
public Boolean getSitemap() {
return sitemap;
}
/**
* @param sitemap the sitemap to set
*/
public void setSiteMap(Boolean sitemap) {
this.sitemap = sitemap;
}
/**
* @return the roles
*/
public String getRoles() {
return roles;
}
/**
* @param roles the roles to set
*/
public void setRoles(String roles) {
this.roles = roles;
}
}

View file

@ -0,0 +1,185 @@
/*
* Copyright 2009-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.tech.web.pages.model;
/**
* VascPage stores dynamic page part data.
*
* @author Willem Cazander
* @version 1.0 May 31, 2012
*/
public class VascPagePart {
private Integer id = null;
private VascPage vascPage = null;
private String title = null;
private String text = null;
private Boolean i18nKey = null;
private Boolean active = null;
private Boolean sitemap = null;
private Integer partOrder = null;
private VascPagePartType partType = null;
private String roles = null;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the vascPage
*/
public VascPage getVascPage() {
return vascPage;
}
/**
* @param vascPage the vascPage to set
*/
public void setVascPage(VascPage vascPage) {
this.vascPage = vascPage;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the text
*/
public String getText() {
return text;
}
/**
* @param text the text to set
*/
public void setText(String text) {
this.text = text;
}
/**
* @return the i18nKey
*/
public Boolean getI18nKey() {
return i18nKey;
}
/**
* @param i18nKey the i18nKey to set
*/
public void setI18nKey(Boolean i18nKey) {
this.i18nKey = i18nKey;
}
/**
* @return the active
*/
public Boolean getActive() {
return active;
}
/**
* @param active the active to set
*/
public void setActive(Boolean active) {
this.active = active;
}
/**
* @return the sitemap
*/
public Boolean getSitemap() {
return sitemap;
}
/**
* @param sitemap the sitemap to set
*/
public void setSitemap(Boolean sitemap) {
this.sitemap = sitemap;
}
/**
* @return the partOrder
*/
public Integer getPartOrder() {
return partOrder;
}
/**
* @param partOrder the partOrder to set
*/
public void setPartOrder(Integer partOrder) {
this.partOrder = partOrder;
}
/**
* @return the partType
*/
public VascPagePartType getPartType() {
return partType;
}
/**
* @param partType the partType to set
*/
public void setPartType(VascPagePartType partType) {
this.partType = partType;
}
/**
* @return the roles
*/
public String getRoles() {
return roles;
}
/**
* @param roles the roles to set
*/
public void setRoles(String roles) {
this.roles = roles;
}
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2009-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.tech.web.pages.model;
/**
* VascPagePartType defines value type of text.
*
* @author Willem Cazander
* @version 1.0 May 31, 2012
*/
public enum VascPagePartType {
HTML,
PRE,
WIKI
}

View file

@ -0,0 +1,34 @@
package net.forwardfire.vasc.demo.tech.web.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name="testServlet",value={"/test"})
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = -7624183395089913214L;
/**
* Prints test
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
try {
StringBuffer buf = new StringBuffer();
buf.append("test");
PrintWriter out = response.getWriter();
out.append(buf.toString());
out.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,87 @@
#
# Vasc Tech Demo Jawr config file.
#
# Takes care of our js and css of this web site.
#
# Common jawr properties
jawr.gzip.on=true
jawr.gzip.ie6.on=false
jawr.charset.name=UTF-8
jawr.debug.overrideKey=jawr_debug
jawr.config.reload.refreshKey=jawr_refresh
# Development mode flags
jawr.debug.on=true
jawr.config.reload.interval=3
#
# Define common js properties
#
jawr.js.bundle.basedir=/js
#jawr.js.bundle.factory.bundlepostprocessors=YUI,license
# Define js bundle mappings
jawr.js.bundle.names=map_default,map_vasc,map_wiki,map_skin
jawr.js.bundle.map_default.id=/jawr/default.js
jawr.js.bundle.map_default.composite=true
jawr.js.bundle.map_default.child.names=richfaces
jawr.js.bundle.map_vasc.id=/jawr/vasc.js
jawr.js.bundle.map_vasc.composite=true
jawr.js.bundle.map_vasc.child.names=richfaces,vasc
jawr.js.bundle.map_wiki.id=/jawr/wiki.js
jawr.js.bundle.map_wiki.composite=true
jawr.js.bundle.map_wiki.child.names=richfaces,richfaces-ckeditor
jawr.js.bundle.map_skin.id=/jawr/skin.js
jawr.js.bundle.map_skin.composite=true
jawr.js.bundle.map_skin.child.names=richfaces,skin-switcher
# Define js bundle resources
jawr.js.bundle.skin-switcher.mappings=skinSwitcher:switcher.js
jawr.js.bundle.vasc.mappings=/js/vasc-jsf.js
jawr.js.bundle.richfaces.mappings=\
jar:/META-INF/resources/jquery.js,\
jar:/META-INF/resources/jquery.focus.js,\
jar:/META-INF/resources/jquery.position.js,\
jar:/META-INF/resources/richfaces.js,\
jar:/META-INF/resources/richfaces-base-component.js,\
jar:/META-INF/resources/richfaces-utils.js,\
jar:/META-INF/resources/richfaces-queue.js,\
jar:/META-INF/resources/richfaces-event.js,\
jar:/META-INF/resources/richfaces-selection.js,\
jar:/META-INF/resources/richfaces-jsf-event.js,\
jar:/META-INF/resources/richfaces-jsf-log.js
jawr.js.bundle.richfaces-atmosphere.mappings=\
jar:/META-INF/resources/net.java.dev.atmosphere/jquery-atmosphere.js
jawr.js.bundle.richfaces-ckeditor.mappings=\
jar:/META-INF/resources/org.richfaces.ckeditor/ckeditor.js
#
# Define common css properties
#
jawr.css.bundle.basedir=/css
jawr.csslinks.flavor=xhtml_ext
jawr.css.skin.default.root.dirs=/css/skins/default
# Define css bundle mappings
jawr.css.bundle.names=map_default
jawr.css.bundle.map_default.id=/jawr/default.css
jawr.css.bundle.map_default.composite=true
jawr.css.bundle.map_default.child.names=html,skin
# Define css bundles resources
jawr.css.bundle.html.mappings=/css/html.css
jawr.css.bundle.skin.mappings=\
skin:/css/skins/default/layout.css,\
skin:/css/skins/default/style.css,\
skin:/css/skins/default/richfaces.css,\
skin:/css/skins/default/vasc-jsf.css,\
skin:/css/skins/default/theme.css

View file

@ -0,0 +1 @@
net.forwardfire.vasc.demo.tech.web.faces.UrlRewriteConfigurationProvider

View file

@ -0,0 +1,65 @@
<?xml version="1.0"?>
<faces-config version="2.0" metadata-complete="false"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
>
<application>
<resource-bundle>
<base-name>net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle</base-name>
<var>i18n</var>
</resource-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<system-event-listener>
<system-event-listener-class>net.forwardfire.vasc.demo.tech.web.faces.NoneLoadStyleResourceEventListener</system-event-listener-class>
<system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
</system-event-listener>
</application>
<managed-bean>
<description>Fixes the context path for root vs non-root deployments.</description>
<managed-bean-name>contextPathController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.ContextPathController</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<description>Controls the Users</description>
<managed-bean-name>userController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.UserController</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<description>Controls the display of the dynamic menus.</description>
<managed-bean-name>menuController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.menu.MenuController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userController</property-name>
<value>#{userController}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>Controls Vasc Export Url Generator</description>
<managed-bean-name>exportController</managed-bean-name>
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.beans.ExportController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<!-- This should be in jawr jar file faces so it gets automatic done. -->
<component>
<component-type>jawr.JavascriptBundle</component-type>
<component-class>net.jawr.web.taglib.jsf.JavascriptBundleTag</component-class>
</component>
<component>
<component-type>jawr.CSSBundle</component-type>
<component-class>net.jawr.web.taglib.jsf.CSSBundleTag</component-class>
</component>
</faces-config>

View file

@ -0,0 +1,18 @@
<ui:composition template="/WEB-INF/template/page-no-js.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="page_title">
<ui:insert name="error_title"/>
</ui:define>
<ui:define name="page_content">
<ui:insert name="error_title">
<rich:panel style="width: 315px">
<ui:insert name="error_text"/>
</rich:panel>
</ui:insert>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,3 @@
<ui:composition template="/WEB-INF/template/structure/main.xhtml" xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:define name="main_head_js"/>
</ui:composition>

View file

@ -0,0 +1,7 @@
<ui:composition template="/WEB-INF/template/structure/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
</ui:composition>

View file

@ -0,0 +1,7 @@
<ui:composition template="/WEB-INF/template/structure/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
</ui:composition>

View file

@ -0,0 +1,307 @@
<ui:composition template="/WEB-INF/template/structure/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:jawr="https://jawr.dev.java.net/jsf/facelets"
xmlns:v="http://vasc.forwardfire.net/vasc.tld"
>
<ui:define name="page_title">
<h:outputText value="#{i18n[requestScopeVascEntry.name]}" />
</ui:define>
<ui:define name="main_head_js">
<jawr:script src="/jawr/vasc.js" />
</ui:define>
<ui:define name="page_content">
<v:vascEntry entrySupportVar="entrySupport"
tableRecordVar="tableRecord"
injectEditFieldsId="injectEditFieldsId"
injectTableOptionsId="itoi"
injectTableColumnsId="itci"
disableLinkColumns="true"
>
<f:facet name="deleteView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.deleteDescription]}" escape="false">
<f:param value="#{entrySupport.selectedDisplayName}" />
</h:outputFormat>
</p>
<h:form>
<h:commandButton actionListener="#{entrySupport.deleteAction}" value="#{entrySupport.i18nMap['vasc.action.deleteRowAction.name']}"/>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="exportView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.exportDescription]}" escape="false">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="editView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.editDescription]}" escape="false" rendered="#{!entrySupport.vascEntry.vascFrontendController.vascEntryState.editCreate}">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.createDescription]}" escape="false" rendered="#{entrySupport.vascEntry.vascFrontendController.vascEntryState.editCreate}">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<ul class="actionboxtab">
<li><a class="active"><h:outputText value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}"/></a></li>
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTab}" rendered="#{!entrySupport.vascEntry.vascFrontendController.vascEntryState.editCreate}">
<li><h:commandLink actionListener="#{entrySupport.linkEditAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}"/></li>
</ui:repeat>
</ul>
<h:panelGrid columns="1" styleClass="actionbox">
<h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
</h:panelGrid>
</h:form>
<br/>
<h:form>
<h:panelGrid columns="3" id="injectEditFieldsId" styleClass="actionbox"/>
<p>
<h:commandButton actionListener="#{entrySupport.saveAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.save']}"/>
<h:commandButton actionListener="#{entrySupport.cancelAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.action.cancel']}" />
</p>
</h:form>
</h:panelGroup>
</f:facet>
<f:facet name="listView" >
<h:panelGroup>
<!-- <h1><h:outputText value="#{entrySupport.i18nMap[entrySupport.vascEntry.name]}"/></h1> -->
<p>
<h:outputFormat value="#{entrySupport.i18nMap[entrySupport.vascEntry.listDescription]}" escape="false">
<f:param value="#{entrySupport.vascEntry.name}" />
</h:outputFormat>
</p>
<h:form>
<p><!-- rendered="{entrySupport.vascEntry.vascAdminCreate}" -->
<h:commandButton actionListener="#{entrySupport.addAction}"
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"
/>
<h:commandButton actionListener="#{entrySupport.backAction}"
rendered="#{entrySupport.renderBackAction}"
value="#{entrySupport.i18nMap['generic.vasc.jsf.action.back']}"
/>
</p>
</h:form>
<h:form>
<rich:dataTable id="itci" var="tableRecord" value="#{entrySupport.tableDataModel}" rowClasses="odd,even">
<f:facet name="header">
<rich:columnGroup>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
<ul class="actionboxtab">
<li>
<h:panelGroup rendered="#{!entrySupport.renderBackAction}">
<a class="active"><h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.header']}"/></a>
</h:panelGroup>
<h:commandLink actionListener="#{entrySupport.backEditAction}" value="#{entrySupport.i18nMap['vasc.action.editRowAction.name']}" rendered="#{entrySupport.renderBackEditAction}"/>
</li>
<ui:repeat var="link" value="#{entrySupport.vascLinkEntriesEditTabParentState}">
<li><h:commandLink actionListener="#{entrySupport.linkListAction}" value="#{entrySupport.i18nMap[link.name]}" type="#{link.id}" styleClass="#{link.vascEntryId==entrySupport.vascEntry.id?'active':''}"/></li>
</ui:repeat>
</ul>
<h:panelGrid columns="1" styleClass="actionbox">
<h:panelGrid columns="2" id="itoi"/>
<h:panelGroup>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.search']}"/>
<h:inputText value="#{entrySupport.searchString}"/>
<h:commandButton actionListener="#{entrySupport.searchAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.listOption.sumbit']}"/>
</h:panelGroup>
</h:panelGrid>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakRowBefore="true">
<ul class="paging">
<li class="paging_atstart">
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
actionListener="#{entrySupport.pagePreviousAction}"/>
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
</li>
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li class="paging_atend">
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
actionListener="#{entrySupport.pageNextAction}"/>
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
</li>
</ul>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakRowBefore="true">
<h:panelGroup styleClass="table_options_top">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendController.vascEntryState.vascBackendState.pageSize}" size="4"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
<f:selectItems value="#{entrySupport.directPageItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
<f:selectItems value="#{entrySupport.globalExportItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
<f:param value="#{entrySupport.pageStartCount}" />
<f:param value="#{entrySupport.pageStopCount}" />
<f:param value="#{entrySupport.pageTotalRecordCount}" />
</h:outputFormat>
</h:panelGroup>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakRowBefore="true" rendered="#{entrySupport.hasMultiRowActions}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.multiAction.selectAll']}"/>
<h:selectBooleanCheckbox id="selectAllBox" required="false" onchange="javascript:selectAllCheckboxes(this);return false;" value="#{entrySupport.selectAllValue}"/>
<h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:selectOneMenu id="multiAction" required="false" value="#{entrySupport.selectedMultiRowAction}" onchange="javascript:this.form.submit(); return false;" valueChangeListener="#{entrySupport.processMultiRowActionChange}">
<f:selectItems value="#{entrySupport.multiRowActionItems}" />
</h:selectOneMenu>
</rich:column>
<rich:column colspan="#{entrySupport.totalFieldColumnCount}" breakRowBefore="true">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.fields']}" styleClass="table_sub_header"/>
</rich:column>
<rich:column colspan="#{entrySupport.totalLinkColumnCount}" rendered="#{entrySupport.totalLinkColumnCount != 0}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.links']}" styleClass="table_sub_header"/>
</rich:column>
<rich:column colspan="#{entrySupport.totalActionColumnCount}" rendered="#{entrySupport.totalActionColumnCount != 0}">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.tableHeader.actions']}" styleClass="table_sub_header"/>
</rich:column>
</rich:columnGroup>
</f:facet>
<f:facet name="footer">
<rich:columnGroup>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left">
<h:panelGroup styleClass="table_options_bottom">
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.rows']}" />
<h:inputText required="false" value="#{entrySupport.vascEntry.vascFrontendController.vascEntryState.vascBackendState.pageSize}" size="4"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.pagerDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedDirectPage}" valueChangeListener="#{entrySupport.processDirectPageChange}">
<f:selectItems value="#{entrySupport.directPageItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_download.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.download.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputText value="#{entrySupport.i18nMap['generic.vasc.jsf.table.downloadDirect']}" />
<h:selectOneMenu onchange="javascript:this.form.submit(); return false;" value="#{entrySupport.selectedExporterAction}" valueChangeListener="#{entrySupport.processDirectDownloadChange}">
<f:selectItems value="#{entrySupport.globalExportItems}" />
</h:selectOneMenu>
<img src="#{facesContext.externalContext.requestContextPath}/img/icon_print.png" alt="#{entrySupport.i18nMap['generic.vasc.jsf.table.printer.img']}" width="15" height="15" /><h:outputText value="&amp;nbsp;&amp;nbsp;" escape="false"/>
<h:outputFormat value="#{entrySupport.i18nMap['generic.vasc.jsf.table.resultText']}">
<f:param value="#{entrySupport.pageStartCount}" />
<f:param value="#{entrySupport.pageStopCount}" />
<f:param value="#{entrySupport.pageTotalRecordCount}" />
</h:outputFormat>
</h:panelGroup>
</rich:column>
<rich:column colspan="#{entrySupport.totalColumnCount}" styleClass="text_left" breakRowBefore="true">
<ul class="paging">
<li class="paging_atstart">
<h:commandLink rendered="#{entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}"
actionListener="#{entrySupport.pagePreviousAction}"/>
<h:outputText rendered="#{!entrySupport.hasPagePreviousAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.previous']}" />
</li>
<ui:repeat var="page" value="#{entrySupport.tablePagesDataModel}" rendered="#{!entrySupport.hasExtendedPageMode}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageMode}">
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedBegin}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
<h:panelGroup rendered="#{entrySupport.hasExtendedPageModeCenter}">
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedCenter}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li><span class="text">...</span></li>
<ui:repeat var="page" value="#{entrySupport.tablePagesExtendedEnd}">
<li>
<h:commandLink actionListener="#{entrySupport.pageAction}" value="#{page.pageNumber}" type="#{page.pageNumber}" rendered="#{!page.selected}"/>
<h:outputText styleClass="paging_thispage" value="#{page.pageNumber}" rendered="#{page.selected}"/>
</li>
</ui:repeat>
</h:panelGroup>
<li class="paging_atend">
<h:commandLink rendered="#{entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}"
actionListener="#{entrySupport.pageNextAction}"/>
<h:outputText rendered="#{!entrySupport.hasPageNextAction}" value="#{entrySupport.i18nMap['generic.vasc.jsf.pager.next']}" />
</li>
</ul>
</rich:column>
</rich:columnGroup>
</f:facet>
</rich:dataTable>
</h:form>
<h:form>
<p> <!-- rendered="{entrySupport.vascEntry.vascAdminCreate}" -->
<h:commandButton actionListener="#{entrySupport.addAction}"
value="#{entrySupport.i18nMap['vasc.action.addRowAction.name']}"
title="#{entrySupport.i18nMap['vasc.action.addRowAction.description']}"/>
</p>
</h:form>
</h:panelGroup>
</f:facet>
</v:vascEntry>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,18 @@
<ui:composition template="/WEB-INF/template/structure/main.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:jawr="https://jawr.dev.java.net/jsf/facelets"
>
<ui:define name="page_title">
<h:outputText value="#{vascPageController.pageTitle}" />
</ui:define>
<ui:insert name="main_head_js">
<jawr:script src="/jawr/wiki.js" />
</ui:insert>
<ui:define name="page_content">
<ui:repeat var="part" value="#{vascPageController.pageParts}">
<h2><h:outputText value="#{part.title}"/></h2>
<h:outputText value="#{vascPageController.renderContent(part)}" escape="false"/>
</ui:repeat>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,52 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<div id="body-deco-logo">
<div id="body-deco-logo-div">
<span>
<h:outputLink rendered="#{facesContext.externalContext.isUserInRole('login') == false}" value="#{contextPathController.rootPath}/html/index.jsf">
<img src="#{contextPathController.rootPath}/img/logo.png" alt="#{i18n['Application.web.header.logo.alt']}" />
</h:outputLink>
<h:outputLink rendered="#{facesContext.externalContext.isUserInRole('login') == true}" value="#{contextPathController.rootPath}/html/user/index.jsf">
<img src="#{contextPathController.rootPath}/img/logo.png" alt="#{i18n['Application.web.header.logo.alt']}" />
</h:outputLink>
</span>
</div>
</div>
<div id="body-deco-menu">
<div id="body-deco-menu0-div">
<h4>
<span><h:outputText value="menu0"/></span>
</h4>
<ul>
<ui:repeat var="menuEntry" value="#{menuController.menu0}">
<li><a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a></li>
</ui:repeat>
</ul>
</div>
<div id="body-deco-menu1-div">
<h4>
<span><h:outputText value="menu1"/></span>
</h4>
<ul>
<ui:repeat var="menuEntry" value="#{menuController.menu1}">
<li><a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a></li>
</ui:repeat>
</ul>
</div>
<div id="body-deco-menu2-div">
<h4>
<span><h:outputText value="menu2"/></span>
</h4>
<ul>
<ui:repeat var="menuEntry" value="#{menuController.menu2}">
<li><a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a></li>
</ui:repeat>
</ul>
</div>
</div>
</ui:composition>

View file

@ -0,0 +1,27 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<div id="body-footer">
<div id="body-footer-text">
<span><h:outputText value="#{i18n['Application.web.footer.center']}"/></span>
</div>
<div id="body-footer-menu">
<span>
<h:outputText value="- "/>
<ui:repeat var="menuEntry" value="#{menuController.menuBarBottom}">
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a><h:outputText value=" - "/>
</ui:repeat>
</span>
</div>
<div id="body-footer-copyright">
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.left']}"/></span>
</div>
<div id="body-footer-version">
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.right']}"/></span>
</div>
</div>
</ui:composition>

View file

@ -0,0 +1,36 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<div id="page-header">
<div id="page-header-left">
<ui:repeat var="menuEntry" value="#{menuController.menuBarLeft}">
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a>
</ui:repeat>
</div>
<div id="page-header-right">
<ui:repeat var="menuEntry" value="#{menuController.menuBarRight}">
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a>
</ui:repeat>
</div>
<div id="page-header-info">
<div id="page-header-info-body">
<h:form>
<h:outputLink rendered="#{facesContext.externalContext.isUserInRole('login') == false}" value="#{contextPathController.rootPath}/html/user/index.jsf">
<h:outputText value="#{i18n['Application.web.header.login']}"/>
</h:outputLink>
<h:panelGroup rendered="#{facesContext.externalContext.isUserInRole('login') == true}">
<h:commandLink actionListener="#{userController.logoutAction}">
<h:outputText value="#{i18n['Application.web.header.logout']}"/>
</h:commandLink>
<h:outputText value=" - "/>
<h:outputText value="#{userController.webUserName}"/>
</h:panelGroup>
</h:form>
</div>
</div>
</div>
</ui:composition>

View file

@ -0,0 +1,30 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<f:view>
<div id="body-view">
<ui:insert name="main_body_header">
<ui:include src="/WEB-INF/template/structure/main-body-header.xhtml"/>
</ui:insert>
<ui:insert name="main_body_content">
<div id="body-content">
<h1><ui:insert name="page_title"/></h1>
<h:messages globalOnly="true" />
<ui:insert name="page_content"/>
<ui:insert name="main_body_footer">
<ui:include src="/WEB-INF/template/structure/main-body-footer.xhtml"/>
</ui:insert>
<ui:insert name="main_body_decorator">
<ui:include src="/WEB-INF/template/structure/main-body-decorator.xhtml"/>
</ui:insert>
</div>
</ui:insert>
</div>
<div id="themeDiv1"><span></span></div><div id="themeDiv2"><span></span></div><div id="themeDiv3"><span></span></div>
<div id="themeDiv4"><span></span></div><div id="themeDiv5"><span></span></div><div id="themeDiv6"><span></span></div>
</f:view>
</ui:composition>

View file

@ -0,0 +1,28 @@
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:jawr="https://jawr.dev.java.net/jsf/facelets"
>
<ui:insert name="main_head_content_type">
<meta http-equiv="content-type" content="application/xhtml+xml;charset=UTF-8" />
</ui:insert>
<ui:insert name="main_head_meta">
<meta name="robots" content="#{i18n['Application.web.meta.robots']}"/>
<meta name="description" content="#{i18n['Application.web.meta.description']}"/>
<meta name="keywords" content="#{i18n['Application.web.meta.keywords']}"/>
</ui:insert>
<title>
<ui:insert name="main_head_title">
<ui:insert name="page_title"/>
</ui:insert>
</title>
<ui:insert name="main_head_css">
<jawr:style src="/jawr/default.css" media="all" displayAlternate="false"/>
</ui:insert>
<ui:insert name="main_head_js">
<jawr:script src="/jawr/default.js" />
</ui:insert>
</ui:composition>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<h:head>
<ui:insert name="main_head">
<ui:include src="/WEB-INF/template/structure/main-head.xhtml"/>
</ui:insert>
</h:head>
<body>
<ui:insert name="main_body">
<ui:include src="/WEB-INF/template/structure/main-body.xhtml"/>
</ui:insert>
</body>
</html>

View file

@ -1,84 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
<web-app version="3.0" metadata-complete="false"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<!-- http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd -->
<display-name>Vasc Demo Tech Web Application</display-name>
<welcome-file-list>
<welcome-file>/jsp/index_jsp.jsp</welcome-file>
<welcome-file>/html/index.jsf</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>4</session-timeout>
<!-- An 4min session, we increase it after login to 20min. -->
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<web-resource-collection>
<web-resource-name>Include files</web-resource-name>
<description>No direct access to include files.</description>
<url-pattern>/jsp/includes/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description>No direct browser access to include files.</description>
<role-name>inaccessible</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!--
<security-constraint>
<display-name>User Required</display-name>
<web-resource-collection>
<web-resource-name>User pages</web-resource-name>
<url-pattern>/jsp/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Admin User Required</display-name>
<web-resource-collection>
<web-resource-name>Admin pages</web-resource-name>
<url-pattern>/jsp/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin-company</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Sytem User Required</display-name>
<web-resource-collection>
<web-resource-name>System pages</web-resource-name>
<url-pattern>/jsp/system/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin-system</role-name>
</auth-constraint>
</security-constraint>
-->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>VascDemoSecurity</realm-name>
<form-login-config>
<form-login-page>/jsp/login/login.jsf</form-login-page>
<form-error-page>/jsp/login/login-error.jsf</form-error-page>
</form-login-config>
</login-config>
<security-role>
<security-role>
<role-name>user</role-name>
</security-role>
<security-role>
@ -91,6 +26,83 @@
<role-name>inaccessible</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protect Resources</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<security-constraint>
<display-name>User Required</display-name>
<web-resource-collection>
<web-resource-name>User pages</web-resource-name>
<url-pattern>/html/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>login</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Admin User Required</display-name>
<web-resource-collection>
<web-resource-name>Admin pages</web-resource-name>
<url-pattern>/html/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>VascDemoSecurity</realm-name>
<form-login-config>
<form-login-page>/html/auth/login.jsf</form-login-page>
<form-error-page>/html/auth/error.jsf</form-error-page>
</form-login-config>
</login-config>
<error-page>
<error-code>400</error-code>
<location>/html/error/status/400-bad-request.jsf</location>
</error-page>
<error-page>
<error-code>401</error-code>
<location>/html/error/status/401-unauthorized.jsf</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/html/error/status/403-forbidden.jsf</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/html/error/status/404-not-found.jsf</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/html/error/status/405-method-not-allowed.jsf</location>
</error-page>
<error-page>
<error-code>414</error-code>
<location>/html/error/status/414-request-uri-too-long.jsf</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/html/error/status/500-internal-error.jsf</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/html/error/view-expired.jsf</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/html/error/throwable.jsf</location>
</error-page>
<!-- =============== USER CONFIG ===================================
<filter>
<display-name>User Filter</display-name>
@ -105,39 +117,19 @@
</filter-mapping>
-->
<!-- =============== JSF CONFIG =================================== -->
<!-- =============== CONFIG =================================== -->
<!-- JSF 2.0 -->
<context-param>
<description>
Comma separated list of URIs of (additional) faces
config files.(e.g./WEB-INF/my-config.xml) See JSF1.0 PRD 2,10.3.2
</description>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces.xml</param-value>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value> <!-- workaround for custum view handlers ? -->
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<description>The JSF Servlet</description>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
@ -146,100 +138,121 @@
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- Plugin our own richfaces skin -->
<!-- Richfaces -->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>vasc-demo-tech</param-value>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>false</param-value>
</context-param>
<!-- Jawr -->
<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<servlet>
<servlet-name>JsServlet</servlet-name>
<servlet-class>net.jawr.web.servlet.JawrServlet</servlet-class>
<init-param>
<param-name>configLocation</param-name>
<param-value>/META-INF/jawr.properties</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>/_js/</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>CssServlet</servlet-name>
<servlet-class>net.jawr.web.servlet.JawrServlet</servlet-class>
<init-param>
<param-name>configLocation</param-name>
<param-value>/META-INF/jawr.properties</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>/_css/</param-value>
</init-param>
<init-param>
<param-name>type</param-name>
<param-value>css</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JsServlet</servlet-name>
<url-pattern>/_js/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CssServlet</servlet-name>
<url-pattern>/_css/*</url-pattern>
</servlet-mapping>
<!-- Defining and mapping the RichFaces filter -->
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>facesServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- =============== VASC CONFIG =================================== -->
<!-- Vasc -->
<filter>
<display-name>VASC Filter</display-name>
<filter-name>vascFilter</filter-name>
<filter-class>net.forwardfire.vasc.frontend.web.jsf.VascRequestFacesFilter</filter-class>
<init-param>
<param-name>templateFile</param-name>
<param-value>/jsp/includes/vasc-template.jsf</param-value>
<param-value>/WEB-INF/template/page-vasc.jsf</param-value>
</init-param>
<init-param>
<param-name>resourceBundle</param-name>
<param-value>net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle</param-value>
<param-name>vascControllerProvider</param-name>
<param-value>java:comp/env/vasc/DemoVascController@net.forwardfire.vasc.impl.jndi.JndiVascControllerProvider</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>vascFilter</filter-name>
<url-pattern>/vasc/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<!-- <dispatcher>FORWARD</dispatcher> -->
</filter-mapping>
<servlet>
<servlet-name>vascExportServlet</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.web.export.VascExportServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
<param-value>java:comp/env/vasc/DemoVascController@net.forwardfire.vasc.impl.jndi.JndiVascControllerProvider</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>vascExportServlet</servlet-name>
<url-pattern>/export</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>vascExportServletTree</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.web.export.VascExportServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
</init-param>
<init-param>
<param-name>exportTree</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>vascExportServletTree</servlet-name>
<url-pattern>/export-tree/*</url-pattern>
<servlet-name>vascExportServlet</servlet-name>
<url-pattern>/export/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>vascCXFServlet</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.cxf.server.web.VascCXFServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
<param-value>java:comp/env/vasc/DemoVascController@net.forwardfire.vasc.impl.jndi.JndiVascControllerProvider</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>vascCXFServlet</servlet-name>
<url-pattern>/cxf/*</url-pattern>
</servlet-mapping>
<!-- Debug
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>net.forwardfire.vasc.demo.tech.web.servlets.TestServlet</servlet-class>
<load-on-startup>6</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
-->
</web-app>

View file

@ -0,0 +1,19 @@
* {
margin:0px;
padding:0px;
}
ul {
margin-left:1em;
padding-left:1em;
}
a {
text-decoration:none;
}
object, embed {
outline:0;
}

View file

@ -1,18 +1,7 @@
/* HTML STYLES */
* {
margin:0px;
padding:0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
color: #000000;
margin: 0px;
padding: 0px;
background-color:white;
color:#000000;
background-color:#FFFFFF;
}
h1 {
@ -22,26 +11,19 @@ h1 {
}
h2 {
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
border-radius:3px;
display:block;
font-size:1.0em;
font-weight:bold;
padding:10px 10px 10px 10px;
}
a {
color:#004DEB;
text-decoration:underline;
}
p {
margin:10px 10px 10px 10px;
}
img {
border: none;
border:none;
vertical-align: middle;
}
@ -49,42 +31,13 @@ ul {
margin-left:10px;
}
a {
text-decoration:underline;
}
/* DIVS */
#page_wrap{
margin:10px;
margin-top:0px;
float:none;
}
#page_header{
height:80px;
font-size:18px;
border-bottom:1px solid #DDCCCC;
position:relative;
}
#page_header a img{
border:none;
padding-right:10px;
vertical-align:middle;
}
#page_content {
margin-top:5px;
}
#page_footer {
margin-top:35px;
padding: 5px;
font-size: 12px;
border-color:#e5e5e5;
border-style:solid;
border-width:1px 1px 1px 1px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
}
/* MENU */
@ -139,88 +92,6 @@ ul {
}
.actionbox{
background-color:#DDCCCC;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
border:none;
-moz-border-radius-topleft:0;
-webkit-border-top-left-radius:0;
-khtml-border-radius-topleft:0;
clear:both;
padding:3px 0 3px 3px;
display:block;
}
.actionbox label{display:inline;}
ul.actionboxtab{margin:0;padding:0;}
ul.actionboxtab li{list-style-type:none;float:left;margin:0;padding:0;}
ul.actionboxtab li a {
border:solid 1px #ddd;
border-bottom-width:0;
-moz-border-radius-topleft:3px;
-moz-border-radius-topright:3px;
-khtml-border-radius-topright:3px;
-webkit-border-top-left-radius:3px;
-webkit-border-top-right-radius:3px;
-khtml-border-radius-topleft:3px;
font-weight:700;
display:block;
margin-right:5px;color:#000;
padding:3px 15px;
}
ul.actionboxtab li a.active{background-color:#DDCCCC;border:solid 1px #DDCCCC;text-decoration:none;}
ul.actionboxtab li a:hover{background-color:#DDCCCC;border:solid 1px #DDCCCC;text-decoration:none;}
td.tableactions{border-bottom-color:#bbb;text-align:left;}
ul.paging{
clear:both;
margin-bottom:5px;
margin-top:5px;
display:block;
float:left;
padding-top:3px;
padding-bottom:3px;
width:100%;
list-style:none;
}
ul.paging li,ul.paging span{float:left;margin:0 2px 0 2px;}
.paging_thispage{font-weight:700;padding:0 6px;}
ul.paging .paging_atstart{margin-right:10px;}ul.paging .paging_atend{margin-left:10px;}
ul.paging .paging_atstart a,ul.paging .nolink.paging_atstart{
padding-left:15px;
}
ul.paging .paging_atend a,ul.paging .nolink.paging_atend{
padding-right:15px;
}
ul.paging .paging_next{
margin-left:20px;
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_prev{
margin-right:20px;
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging a,ul.paging .paging_link{
border:1px solid #DDD;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_break{
font-weight:700;padding:2px 6px;
}
@ -311,50 +182,9 @@ table.table5 tr:nth-child(even) {
}
.rich-table-subheader {
background-color:#DDCCCC;
border-top: 1px solid #C0C0C0;
border-left: 1px solid #C0C0C0;
}
.rich-table {
border-top: none;
border-left: none;
}
.rich-table-row {
border-left: 1px solid #C0C0C0;
}
.rich-table-headercell,.rich-table-footercell {
background-color: #FFF;
border: none;
padding-left: 0px;
padding-right: 0px;
font-weight: none;
}
.rich-table-thead {
border: none;
}
.rich-table-header {
background: none;
}
.homepage_stats {
margin-top:10px;
margin-bottom:10px;
}
.homepage_stats_big {
color:#004DEB;
margin-top:5px;
margin-bottom:5px;
font-size: 20px;
display:block;
font-weight: normal;
}
/* MESSAGES */
@ -436,41 +266,7 @@ table.table5 tr:nth-child(even) {
/* LOGINBOX */
/* Text styles */
.text_justify {
text-align:justify;
}
.text_left {
text-align:left;
}
.text_right {
text-align:right;
}
.text_center {
text-align:center;
}
.text_middle {
vertical-align:middle!important;
}
.text_top {
vertical-align:top;
}
/* OTHER STYLES */
.no_wrap {
white-space: nowrap;
}
.no_border {
border:none;
}
/*

View file

@ -0,0 +1,54 @@
body {
margin: 10px;
}
#body-content {
margin: 10px auto;
padding: 10px;
}
#page-header {
height: 1.5em;
}
#page-header-left {
float:left;
}
#page-header-info {
float:right;
padding-right: 20%;
}
#page-header-right {
float:right;
}
#page-header-left,#page-header-right {
padding-top: 10px;
}
#body-footer {
text-align: center;
padding: 5px;
margin-left:20em;
margin-right:20em;
margin-top:1em;
}
#body-deco-logo {
position: absolute;
right: 20px;
top: 50px;
}
#body-deco-menu {
position: absolute;
right: 20px;
top: 150px;
}

View file

@ -0,0 +1,34 @@
.rf-p {
padding: 10px;
}
.rf-p-hdr {
padding-bottom: 10px;
}
.rf-p-b {
}
.rf-dt-shdr {
}
.rf-dt {
}
.rf-dt-r {
}
.rf-dt-hdr {
}
.rf-dt-hdr-c,.rf-dt-ftr-c {
}
.rf-dt-thd {
}

View file

@ -0,0 +1,34 @@
.text-justify {
text-align:justify;
}
.text-left {
text-align:left;
}
.text-right {
text-align:right;
}
.text-center {
text-align:center;
}
.text-middle {
vertical-align:middle!important;
}
.text-top {
vertical-align:top;
}
.no-wrap {
white-space: nowrap;
}
.no-border {
border:none;
}

View file

@ -0,0 +1,170 @@
body {
font-size:85%;
font-family: Georgia, serif;
color: #462102;
background-image: url(/demo/img/skin/default/body-bg.jpg);
}
#body-content {
border: 1px solid #ccc;
background-image: url(/demo/img/skin/default/body-view-bg.png);
}
#page-header-left a,#page-header-right a,#page-header-info-body {
padding:10px;
padding-bottom:5px;
}
#page-header-left a,#page-header-right a,#page-header-info-body {
background-color:#DDCCCC;
font-weight:bold;
border-top-left-radius:5px;
border-top-right-radius:5px;
}
#body-footer {
border-color:#e5e5e5;
border-style:solid;
border-width:1px 1px 1px 1px;
border-radius:3px;
}
h1 {
padding: 0;
font-style: italic;
color: #2d1100;
font-size: xx-large;
}
h2 {
font-style: italic;
float: right;
margin-top: -45px;
padding: 10px;
color: #2d1100;
}
h3 {
font-family: Georgia, serif;
color: #2d1100;
font-style: italic;
margin-top: 20px;
margin-bottom: 5px;
}
h3 span {
border-top-left-radius:5px;
border-left: 1px solid #BBBBBB;
border-top: 1px solid #BBBBBB;
padding-top:2px;
padding-left:5px;
padding-right: 40px;
padding-bottom: 4x;
}
/*
#summary {
float: left;
width: 200px;
margin-right: 15px;
text-align: center;
border: 1px solid #ccc;
padding: 5px;
font-family: Georgia, serif;
font-style: italic;
}
*/
#body-deco-logo {
}
#body-deco-menu {
padding:10px;
}
#body-deco-logo-div,#body-deco-menu0-div,#body-deco-menu1-div,#body-deco-menu2-div {
/*
font: 10px verdana, sans-serif;
padding: 10px;
margin-top: 130px;
width: 130px;
border: 1px solid #ccc;
background-image: url(../../../img/skin/default/wrapper2.png);
*/
}
#body-deco-menu {
border-radius:5px;
border: 1px solid #BBBBBB;
}
.rf-p {
border-radius:5px;
border: 1px solid #BBBBBB;
margin: 5px;
padding: 0px;
}
.rf-p-hdr {
padding:5px;
border-bottom: 1px solid #BBBBBB;
font-weight:bold;
}
.rf-p-b {
padding-top:10px;
padding-left:5px;
padding-bottom:10px;
padding-right:5px;
}
input,textarea,select{
padding: 3px;
background: none repeat scroll 0 0 transparent;
border: 2px solid rgba(66, 60, 24, 0.6);
border-radius:3px;
margin-right: 5px;
margin-bottom: 2px;
}
input:hover,textarea:hover,select:hover{
border: 2px solid rgba(200, 224, 64, 0.6);
}
.even {
background-color:rgba(170, 180, 60, 0.6);
}
.odd {
background-color:rgba(210, 230, 120, 0.6);
}
#page-header-left a,#page-header-right a,#page-header-info-body,.rf-dt-shdr-c a,.table_sub_header {
background-color:rgba(218, 247, 82, 0.6);
}
.table_options_bottom, .table_options_top, .actionbox, ul.actionboxtab li a.active,.rf-p-hdr {
background-color:rgba(200, 224, 64, 0.6);
}
ul.actionboxtab li a:hover,#page-header-left a:hover,#page-header-right a:hover,#page-header-info-body:hover {
background-color:rgba(165, 182, 33, 0.6);
}

View file

@ -0,0 +1,168 @@
.actionbox{
background-color:#DDCCCC;
border-radius:3px;
border-top-left-radius:0;
border:none;
clear:both;
padding:3px 0 3px 3px;
/* display:block; */
}
.actionbox label{display:inline;}
ul.actionboxtab{margin:0;padding:0;}
ul.actionboxtab li{list-style-type:none;float:left;margin:0;padding:0;}
ul.actionboxtab li a {
background-color:rgba(218, 247, 82, 0.6);
border-bottom-width:0;
border-top-left-radius:3px;
border-top-right-radius:3px;
font-weight:700;
display:block;
margin-right:5px;color:#000;
padding:3px 15px;
}
ul.actionboxtab li a.active{background-color:#DDCCCC;text-decoration:none;}
ul.actionboxtab li a:hover{background-color:#DDCCCC;text-decoration:none;}
td.tableactions{border-bottom-color:#bbb;text-align:left;}
ul.paging{
clear:both;
margin-bottom:5px;
margin-top:5px;
display:block;
float:left;
padding-top:3px;
padding-bottom:3px;
width:100%;
list-style:none;
}
ul.paging li,ul.paging span{float:left;margin:0 2px 0 2px;}
.paging_thispage{font-weight:700;padding:0 6px;}
ul.paging .paging_atstart{margin-right:10px;}ul.paging .paging_atend{margin-left:10px;}
ul.paging .paging_atstart a,ul.paging .nolink.paging_atstart{
padding-left:15px;
}
ul.paging .paging_atend a,ul.paging .nolink.paging_atend{
padding-right:15px;
}
ul.paging .paging_next{
margin-left:20px;
border:1px solid #DDD;
border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_prev{
margin-right:20px;
border:1px solid #DDD;
border-radius:3px;
padding:2px 6px;
}
ul.paging a,ul.paging .paging_link{
border:1px solid #DDD;
border-radius:3px;
padding:2px 6px;
}
ul.paging .paging_break{
font-weight:700;padding:2px 6px;
}
.rf-dt-shdr {
border-top:1px solid #BBBBBB;
}
.rf-dt-shdr-c a {
background-color:rgba(233, 233, 233, 0.6);
border-bottom-left-radius:5px;
border-bottom-right-radius:5px;
border-left: 1px solid #BBBBBB;
border-right: 1px solid #BBBBBB;
border-bottom: 1px solid #BBBBBB;
padding-left:5px;
padding-right:5px;
padding-bottom:2px;
display: block;
}
.rf-dt-shdr-c {
font-size:14px;
font-weight:700;
padding-top:0px;
padding-bottom:5px;
}
.rf-dt {
border-collapse:collapse;
}
.rf-dt-r {
}
.rf-dt-c {
padding:3px 7px 2px 7px;
border-left: 1px solid #BBBBBB;
border-right: 1px solid #BBBBBB;
}
.rf-dt-hdr {
background: none;
}
.rf-dt-hdr-c,.rf-dt-ftr-c {
/* background-color: #FFF; */
border: none;
padding-left: 0px;
padding-right: 0px;
font-weight: none;
}
.rf-dt-thd {
border: none;
}
.table_options_top {
border-top-left-radius:3px;
border-top-right-radius:3px;
background-color:#DDCCCC;
font-size:12px;
font-weight:700;
padding:6px 15px;
display: block;
}
.table_options_bottom {
border-bottom-left-radius:3px;
border-bottom-right-radius:3px;
background-color:#DDCCCC;
font-size:12px;
font-weight:700;
padding:6px 15px;
margin-top:5px;
display: block;
}
.table_sub_header {
border-top-left-radius:5px;
border-top-right-radius:5px;
background-color:rgba(233, 233, 233, 0.6);
border-top:1px solid #BBBBBB;
border-left:1px solid #BBBBBB;
border-right:1px solid #BBBBBB;
display:block;
font-size:14px;
font-weight:700;
margin-left:0px;
margin-right:0px;
margin-top:2px;
padding-top:2px;
text-align:center;
}

View file

@ -0,0 +1,5 @@
body {
color: #00FF00;
}

View file

@ -0,0 +1,42 @@
<ui:composition template="/WEB-INF/template/page-user.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="page_title">Debug Style</ui:define>
<ui:define name="page_content">
<div>
<h3><span><h:outputText value="Debug Css Styles" /></span></h3>
<p>Here all css styles should be showed to tune.</p>
</div>
<div>
<h1><span><h:outputText value="This is h1" /></span></h1>
<p>Sample text</p>
</div>
<div>
<h2><span><h:outputText value="This is h2" /></span></h2>
<p>Sample text</p>
</div>
<div>
<h3><span><h:outputText value="This is h3" /></span></h3>
<p>Sample text</p>
</div>
<div>
<h4><span><h:outputText value="This is h4" /></span></h4>
<p>Sample text</p>
</div>
<div>
<h5><span><h:outputText value="This is h5" /></span></h5>
<p>Sample text</p>
</div>
<div>
<h6><span><h:outputText value="This is h6" /></span></h6>
<p>Sample text</p>
</div>
<div>
<h1><span>etc</span></h1>
</div>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,45 @@
<ui:composition template="/WEB-INF/template/page-user.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="page_title">Debug Tools</ui:define>
<ui:define name="page_content">
<div>
<h3><span><h:outputText value="Vasc Demo Admin" /></span></h3>
<p>Here is is possible to edit all editable tables.</p>
<p>
<h:outputLink value="#{contextPathController.rootPath}/vasc/VascEntry/list.jsf"><h:outputText value="VascEnties"/></h:outputLink>
</p>
</div>
<div>
<h3><span><h:outputText value="Jndi" /></span></h3>
<p>Check all resources in jndi tree's.</p>
<p>
<ul>
<li><h:outputLink value="#{contextPathController.rootPath}/debug/jndi/view"><h:outputText value="Jndi Tree "/></h:outputLink></li>
<li><h:outputLink value="#{contextPathController.rootPath}/debug/jndi/view/global"><h:outputText value="Jndi Tree Global"/></h:outputLink></li>
</ul>
</p>
</div>
<div>
<h3><span><h:outputText value="Jdbc" /></span></h3>
<p>Raw access to the embedded db.</p>
<p>
<h:outputLink value="#{contextPathController.rootPath}/debug/jdbc/console/"><h:outputText value="(H2) Jdbc Console"/></h:outputLink>
</p>
</div>
<div>
<h3><span><h:outputText value="Logback" /></span></h3>
<p>Status servlet of logback.</p>
<p>
<ul>
<li><h:outputLink value="#{contextPathController.rootPath}/debug/logback/status/access"><h:outputText value="Access Log Status"/></h:outputLink></li>
<li><h:outputLink value="#{contextPathController.rootPath}/debug/logback/status/classic"><h:outputText value="Server Log Status"/></h:outputLink></li>
</ul>
</p>
</div>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,63 @@
<ui:composition template="/WEB-INF/template/page-user.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
>
<ui:define name="page_title">Admin Index</ui:define>
<ui:define name="page_content">
<h:panelGrid columns="4" id="grid" width="100%">
<rich:panel>
<f:facet name="header">
<h:outputText value="Vasc Admin" />
</f:facet>
<p>Manage you data.</p>
<ul>
<ui:repeat var="menuEntry" value="#{menuController.menuPageAdmin}">
<li><a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a></li>
</ui:repeat>
</ul>
</rich:panel>
<rich:panel>
<f:facet name="header">
<h:outputText value="Export Servlet" />
</f:facet>
<h:form>
<h:panelGrid columns="2" width="100%">
<h:outputText value="Entry:"/>
<h:selectOneMenu value="#{exportController.entryId}" onchange="javascript:this.form.submit(); return false;">
<f:selectItems value="#{exportController.entryIdSelectItems}"/>
</h:selectOneMenu>
<h:outputText value="Type:"/>
<h:selectOneMenu value="#{exportController.exportType}" onchange="javascript:this.form.submit(); return false;">
<f:selectItems value="#{exportController.exportTypeSelectItems}"/>
</h:selectOneMenu>
<h:outputText value="tree-url:"/>
<h:selectBooleanCheckbox value="#{exportController.exportTree}" onchange="javascript:this.form.submit(); return false;"/>
</h:panelGrid>
<h:panelGrid columns="2" width="100%">
<h:outputText value="Url:"/>
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}">
<h:outputText value="#{facesContext.externalContext.requestContextPath}/#{exportController.buildExportUrl}"/>
</h:outputLink>
</h:panelGrid>
</h:form>
</rich:panel>
<rich:panel>
<f:facet name="header">
<h:outputText value="WebService Servlet" />
</f:facet>
<h:outputText value="todo" />
</rich:panel>
<rich:panel>
<f:facet name="header">
<h:outputText value="WebStart" />
</f:facet>
<h:outputText value="todo" />
</rich:panel>
</h:panelGrid>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,11 @@
<ui:composition template="/WEB-INF/template/page-no-js.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="page_title">Error</ui:define>
<ui:define name="page_content">
<h:outputText value="Could not login" />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,11 @@
<ui:composition template="/WEB-INF/template/page-no-js.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="page_title">Forgot</ui:define>
<ui:define name="page_content">
<h:outputText value="Could forgot my login, send it to me" />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,26 @@
<ui:composition template="/WEB-INF/template/page-public.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="page_title">Login</ui:define>
<ui:define name="page_content">
<form method="post" action="j_security_check" id="j_security_check">
<h:panelGrid columns="2">
<h:column><h:outputText value="Username:" /></h:column>
<h:column><input type="text" name="j_username" id="j_username"/></h:column>
<h:column><h:outputText value="Password:" /></h:column>
<h:column><input type="password" name="j_password" id="j_password"/></h:column>
</h:panelGrid>
<input type="submit" value="Login"/>
</form>
<h:outputLink value="#{contextPathController.rootPath}/html/auth/forgot.jsf">
<h:outputText value="Forgot my login." />
</h:outputLink>
<script>
document.getElementById('j_security_check:j_username').focus();
</script>
</ui:define>
</ui:composition>

View file

@ -0,0 +1,11 @@
<ui:composition template="/WEB-INF/template/page-no-js.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<ui:define name="page_title">Logout</ui:define>
<ui:define name="page_content">
<h:outputText value="Succesfully logged out." />
</ui:define>
</ui:composition>

View file

@ -0,0 +1,7 @@
<ui:composition template="/WEB-INF/template/page-error.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
>
<ui:define name="error_title"> <h:outputText value="#{i18n['web.error.status.400.title']}" /></ui:define>
<ui:define name="error_text"> <h:outputText value="#{i18n['web.error.status.400.text']}" /></ui:define>
</ui:composition>

View file

@ -0,0 +1,7 @@
<ui:composition template="/WEB-INF/template/page-error.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
>
<ui:define name="error_title"> <h:outputText value="#{i18n['web.error.status.404.title']}" /></ui:define>
<ui:define name="error_text"> <h:outputText value="#{i18n['web.error.status.404.text']}" /></ui:define>
</ui:composition>

Some files were not shown because too many files have changed in this diff Show more