wip made remote ejb working over http
This commit is contained in:
parent
d4e537a2bf
commit
2a0d992642
393 changed files with 8916 additions and 3872 deletions
17
vasc-demo/vasc-demo-server/.project
Normal file
17
vasc-demo/vasc-demo-server/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-server</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
17
vasc-demo/vasc-demo-server/pom.xml
Normal file
17
vasc-demo/vasc-demo-server/pom.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<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</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-server</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-demo-server</name>
|
||||
<description>Vasc Demo Server</description>
|
||||
<modules>
|
||||
<module>vasc-demo-server-build</module>
|
||||
<module>vasc-demo-server-core</module>
|
||||
</modules>
|
||||
</project>
|
||||
17
vasc-demo/vasc-demo-server/vasc-demo-server-build/.project
Normal file
17
vasc-demo/vasc-demo-server/vasc-demo-server-build/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-server-build</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
95
vasc-demo/vasc-demo-server/vasc-demo-server-build/pom.xml
Normal file
95
vasc-demo/vasc-demo-server/vasc-demo-server-build/pom.xml
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<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-server</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-server-build</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-demo-server-build</name>
|
||||
<description>Vasc Demo Server Build</description>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>${maven-assembly-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>ui-dist-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/bin.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>${maven-antrun-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>update-schema</id>
|
||||
<phase>prepare-package</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<property name="destdir" value="${basedir}/target/docs/"/>
|
||||
<mkdir dir="${destdir}/schema"/>
|
||||
<mkdir dir="${destdir}/elddoc"/>
|
||||
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask" classpathref="maven.plugin.classpath"/>
|
||||
<taskdef name="eldDocWriter" classname="org.x4o.plugin.ant.eld.doc.EldDocWriterTask" classpathref="maven.plugin.classpath"/>
|
||||
<eldXsdWriter destdir="${destdir}/schema" supportclass="net.forwardfire.vasc.impl.x4o.VascParserSupport"/>
|
||||
<eldDocWriter destdir="${destdir}/elddoc" supportclass="net.forwardfire.vasc.impl.x4o.VascParserSupport"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<artifactId>x4o-plugin-ant-schema</artifactId>
|
||||
<version>${x4o.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.x4o.plugin</groupId>
|
||||
<artifactId>x4o-plugin-ant-elddoc</artifactId>
|
||||
<version>${x4o.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-server-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>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-server-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>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2011, Willem Cazander
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
<baseDirectory>vasc-demo-tech-${project.version}</baseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/libs</outputDirectory>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.parent.parent.parent.basedir}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>authors.txt</include>
|
||||
<include>licence.txt</include>
|
||||
<!-- <include>versions.txt</include> -->
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/scripts/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/files/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>readme.txt</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src/main/directory/</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>conf/logback-server-console.xml</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/target/docs/</directory>
|
||||
<outputDirectory>/docs</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?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/server-tech" global="vasc/server-tech" type="net.forwardfire.vasc.core.VascController" />
|
||||
<ResourceLink name="vasc/server-admin" global="vasc/server-admin" 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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?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 if one DEBUG -->
|
||||
<logger level="WARN" name="org.apache.catalina"/>
|
||||
<logger level="WARN" name="org.apache.tomcat"/>
|
||||
<logger level="WARN" name="org.ajax4jsf"/>
|
||||
<logger level="WARN" name="net.jawr"/>
|
||||
<logger level="WARN" name="sun.awt"/>
|
||||
<logger level="WARN" name="java.awt"/>
|
||||
<logger level="WARN" name="org.eobjects"/>
|
||||
<logger level="WARN" name="org.x4o"/>
|
||||
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?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"/>
|
||||
<logger level="WARN" name="org.eobjects.metamodel.xml.XmlDomDataContext"/>
|
||||
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
PropertiesLogin {
|
||||
org.apache.openejb.core.security.jaas.PropertiesLoginModule required
|
||||
Debug=false
|
||||
UsersFile="users.properties"
|
||||
GroupsFile="groups.properties";
|
||||
};
|
||||
|
||||
vasc-auth-server {
|
||||
org.apache.openejb.core.security.jaas.SQLLoginModule required
|
||||
dataSourceName="jdbc/DemoManagerDataDS"
|
||||
userSelect="select username, password from vasc_user where username=?"
|
||||
groupSelect="select username, role from vasc_user_role where username=?";
|
||||
};
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vasc:root xmlns:vasc="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
</vasc:root>
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vasc:root
|
||||
xmlns:vasc="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
|
||||
<!--
|
||||
|
||||
<td:tomcatResource name="mmdc/pulsefire/device.log" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="csvFile" backendFile="/home/willemc/tmp/pulsefire-device.log"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="mmdc_pf" jndiName="java:mmdc/pulsefire/device.log"/>
|
||||
|
||||
<mm:metaModelBackend id="PulseFireDeviceLogBackend" dataContextProvider="${mmdc_pf}" table="pulsefire-device" tableId="epoch" />
|
||||
<v:entry id="PulseFireDeviceLog" backendId="PulseFireDeviceLogBackend" displayNameFieldId="time">
|
||||
<v:field id="epoch" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="time" />
|
||||
<v:field id="dev_volt" />
|
||||
<v:field id="dev_amp" />
|
||||
<v:field id="dev_temp" />
|
||||
<v:field id="dev_freq" />
|
||||
</v:entry>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc_pf}" entryPrefix="pf" />
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<td:tomcatResource name="mmdc/mongo/laura" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="mongodb" backendDatabase="laura"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="lauraDC" jndiName="java:mmdc/mongo/laura"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${lauraDC}" entryPrefix="laura"/>
|
||||
|
||||
<td:tomcatResource name="mmdc/mongo/lefiona" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="mongodb" backendDatabase="lefiona"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="lefionaDC" jndiName="java:mmdc/mongo/lefiona"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${lefionaDC}" entryPrefix="lefiona"/>
|
||||
|
||||
<td:tomcatResource name="mmdc/mongo/lisa" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="mongodb" backendDatabase="lisa"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="lisaDC" jndiName="java:mmdc/mongo/lisa"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${lisaDC}" entryPrefix="lisa"/>
|
||||
|
||||
|
||||
<td:tomcatResource name="mmdc/deploy/auto-pg.xml" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="xmlDomFile" backendFile="deploy/auto-pg.xml"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="autoPG" jndiName="java:mmdc/deploy/auto-pg.xml"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${autoPG}" entryPrefix="autopg"/>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<td:tomcatResource name="jdbc/DellStoreDS" auth="Container" type="javax.sql.DataSource"
|
||||
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
|
||||
testWhileIdle="true"
|
||||
testOnBorrow="true"
|
||||
testOnReturn="false"
|
||||
validationQuery="SELECT 1"
|
||||
validationInterval="30000"
|
||||
timeBetweenEvictionRunsMillis="30000"
|
||||
maxActive="10"
|
||||
minIdle="1"
|
||||
maxIdle="5"
|
||||
maxWait="10000"
|
||||
initialSize="1"
|
||||
removeAbandonedTimeout="60"
|
||||
removeAbandoned="true"
|
||||
logAbandoned="true"
|
||||
minEvictableIdleTimeMillis="30000"
|
||||
jmxEnabled="true"
|
||||
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
|
||||
username="postgres"
|
||||
password="postgresql"
|
||||
driverClassName="org.postgresql.Driver"
|
||||
url="jdbc:postgresql://localhost/dellstore2"
|
||||
/>
|
||||
<mm:jndiDataSourceDataContext el.id="dellStoreDC" jndiName="java:jdbc/DellStoreDS" />
|
||||
<mm:schemaAutoEntry
|
||||
dataContextProvider="${dellStoreDC}"
|
||||
entryPrefix="dstore2"
|
||||
tableInclude=".*"
|
||||
tableExclude="reorder|categories"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<mm:jndiDataSourceDataContext el.id="AdminManagerDataDC" jndiName="java:jdbc/vascDemoDS" />
|
||||
|
||||
<mm:jndiDataContext el.id="test1" jndiName="java:metamodel/demo/VascDemoDC"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test1}" entryPrefix="test1" />
|
||||
|
||||
<mm:jndiDataContext el.id="test2" jndiName="java:metamodel/demo/VascDemoDCReadOnly"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test2}" entryPrefix="test2" />
|
||||
|
||||
<mm:jndiDataContext el.id="test3" jndiName="java:metamodel/demo/VascDemoMongoDC"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test3}" entryPrefix="test3" />
|
||||
|
||||
<mm:jndiDataContext el.id="test4" jndiName="java:metamodel/server/conf/logback-server.xml"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test4}" entryPrefix="test4" />
|
||||
|
||||
<mm:jndiDataContext el.id="test5" jndiName="java:metamodel/server/conf/logback-access.xml"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test5}" entryPrefix="test5" />
|
||||
|
||||
<mm:jndiDataContext el.id="test6" jndiName="java:metamodel/server/conf/context.xml"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test6}" entryPrefix="test6" />
|
||||
|
||||
<mm:jndiDataContext el.id="test7" jndiName="java:metamodel/server/conf/web.xml"/>
|
||||
<mm:schemaAutoEntry dataContextProvider="${test7}" entryPrefix="test7" />
|
||||
-->
|
||||
|
||||
<!--
|
||||
<mm:xmlSaxDataContext el.id="ConfGlobalContextDC" file="conf/context.xml" >
|
||||
<mm:xmlSaxSchema rowXPath="/Context/ResourceLink">
|
||||
<mm:xmlSaxSchemaColumn dataXPath="/Context/ResourceLink@name"/>
|
||||
<mm:xmlSaxSchemaColumn dataXPath="/Context/ResourceLink@global"/>
|
||||
<mm:xmlSaxSchemaColumn dataXPath="/Context/ResourceLink@type"/>
|
||||
</mm:xmlSaxSchema>
|
||||
</mm:xmlSaxDataContext>
|
||||
<mm:metaModelBackend id="ConfGlobalContextBackend" dataContextProvider="${ConfGlobalContextDC}" table="/ResourceLink" tableId="row_id" />
|
||||
<v:entry id="ConfGlobalContext" backendId="ConfGlobalContextBackend" >
|
||||
<v:field id="id" backendName="row_id"/>
|
||||
<v:field id="name" backendName="@name"/>
|
||||
<v:field id="global" backendName="@global"/>
|
||||
<v:field id="type" backendName="@type"/>
|
||||
</v:entry>
|
||||
|
||||
<mm:xmlSaxDataContext el.id="ConfGlobalWebMimeDC" file="conf/web.xml" >
|
||||
<mm:xmlSaxSchema rowXPath="/web-app/mime-mapping">
|
||||
<mm:xmlSaxSchemaColumn dataXPath="/web-app/mime-mapping/extension"/>
|
||||
<mm:xmlSaxSchemaColumn dataXPath="/web-app/mime-mapping/mime-type"/>
|
||||
</mm:xmlSaxSchema>
|
||||
</mm:xmlSaxDataContext>
|
||||
<mm:metaModelBackend id="ConfGlobalWebMimeBackend" dataContextProvider="${ConfGlobalWebMimeDC}" table="/mime-mapping" tableId="row_id" />
|
||||
<v:entry id="ConfGlobalWebMime" backendId="ConfGlobalWebMimeBackend" >
|
||||
<v:field id="id" backendName="row_id"/>
|
||||
<v:field id="extension" backendName="/extension"/>
|
||||
<v:field id="mime-type" backendName="/mime-type"/>
|
||||
</v:entry>
|
||||
-->
|
||||
<!--
|
||||
<td:tomcatResource name="jdbc/pagilaDS" auth="Container" type="javax.sql.DataSource"
|
||||
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
|
||||
initialSize="1" minIdle="1"
|
||||
username="postgres" password="postgresql"
|
||||
driverClassName="org.postgresql.Driver"
|
||||
url="jdbc:postgresql://localhost/pagila"
|
||||
/>
|
||||
<mm:jndiDataSourceDataContext el.id="pagilaDC" jndiName="java:jdbc/pagilaDS" />
|
||||
<mm:schemaAutoEntry
|
||||
dataContextProvider="${pagilaDC}"
|
||||
entryPrefix="pagila"
|
||||
/>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<td:tomcatResource name="jdbc/bravoDS" auth="Container" type="javax.sql.DataSource"
|
||||
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
|
||||
initialSize="1" minIdle="1"
|
||||
username="postgres" password="postgresql"
|
||||
driverClassName="org.postgresql.Driver"
|
||||
url="jdbc:postgresql://localhost/openbravo"
|
||||
/>
|
||||
<td:tomcatResource name="mmdc/bravoDC" auth="Container" type="org.eobjects.metamodel.DataContext"
|
||||
factory="net.forwardfire.vasc.backend.metamodel.jndi.JndiDataContextObjectFactory"
|
||||
backendType="jdbcJndi" backendUrl="java:jdbc/bravoDS"
|
||||
/>
|
||||
<mm:jndiDataContext el.id="bravoDC" jndiName="java:mmdc/bravoDC"/>
|
||||
|
||||
<mm:schemaAutoEntry
|
||||
dataContextProvider="${bravoDC}"
|
||||
entryPrefix="bravo"
|
||||
/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<mm:jndiDataSourceDataContext el.id="bravoDC" jndiName="java:jdbc/bravoDS" />
|
||||
-->
|
||||
|
||||
</vasc:root>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vasc:root xmlns:vasc="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
>
|
||||
|
||||
<mm:csvDataContext
|
||||
el.id="metaPeopleDS"
|
||||
file="data/demo/meta-people.csv"
|
||||
/>
|
||||
<mm:metaModelBackend
|
||||
id="metaPeopleBackend"
|
||||
dataContextProvider="${metaPeopleDS}"
|
||||
table="meta_people"
|
||||
tableId="id"
|
||||
/>
|
||||
<v:entry id="metaPeople" backendId="metaPeopleBackend">
|
||||
<v:field id="id" list="false"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="age"/>
|
||||
<v:field id="gender" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="male,female,unknown"/>
|
||||
</v:field>
|
||||
<v:field id="function" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="manager,devver,sales"/>
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
<mm:csvDataContext
|
||||
el.id="metaProjectDS"
|
||||
file="data/demo/meta-project.csv"
|
||||
/>
|
||||
<mm:metaModelBackend
|
||||
id="metaProjectBackend"
|
||||
dataContextProvider="${metaProjectDS}"
|
||||
table="meta_project"
|
||||
tableId="id"
|
||||
/>
|
||||
<v:entry id="metaProject" backendId="metaProjectBackend">
|
||||
<v:field id="id" list="false"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" vascEntryFieldType="TextAreaField"/>
|
||||
</v:entry>
|
||||
|
||||
</vasc:root>
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vasc:root xmlns:vasc="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
<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="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" displayFieldId="slug"/>
|
||||
</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:vascSelectItemModelString data="HTML,WIKI"/>
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuWebBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_WEB" tableId="ID" />
|
||||
<v:entry id="AdminVascMenuWeb" backendId="AdminVascMenuWebBackend">
|
||||
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
|
||||
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType"/>
|
||||
</v:listOption>
|
||||
<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:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType"/>
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuGroupBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_GROUP" tableId="ID" />
|
||||
<v:entry id="AdminVascMenuGroup" backendId="AdminVascMenuGroupBackend">
|
||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||
</v:listOption>
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
<v:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="roles" backendName="ROLES"/>
|
||||
<v:field id="menu_order" backendName="MENU_ORDER" vascEntryFieldType="IntegerField"/>
|
||||
</v:entry>
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU" tableId="ID" />
|
||||
<v:entry id="AdminVascMenu" backendId="AdminVascMenuBackend">
|
||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||
</v:listOption>
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="vascEntryId" backendName="VASC_ENTRY_ID"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
<v:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="roles" backendName="ROLES"/>
|
||||
<v:field id="menu_order" backendName="MENU_ORDER" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="menu_group" backendName="MENU_GROUP">
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
</vasc:root>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
== 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.
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Server port="8805" shutdown="SHUTDOWN">
|
||||
<Listener className="org.apache.tomee.catalina.ServerListener" />
|
||||
<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" />
|
||||
<Listener className="net.forwardfire.vasc.demo.server.tomcat.JndiVascDeployerListener"
|
||||
vascControllerName="vasc/server-tech"
|
||||
scanPath="conf/server-tech"
|
||||
scanTime="3"
|
||||
/>
|
||||
<Listener className="net.forwardfire.vasc.demo.server.tomcat.JndiVascDeployerListener"
|
||||
vascControllerName="vasc/server-admin"
|
||||
scanPath="conf/server-admin"
|
||||
scanTime="9"
|
||||
/>
|
||||
<GlobalNamingResources>
|
||||
<!-- Config Vasc Tech Demo -->
|
||||
<Environment name="config/START_GUI" value="true" type="java.lang.Boolean"/>
|
||||
<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/server-tech" auth="Container" type="net.forwardfire.vasc.core.VascController" singleton="true" scope="Shareable"
|
||||
factory="net.forwardfire.vasc.impl.jndi.JndiVascControllerFactory"
|
||||
vascControllerProvider="net.forwardfire.vasc.demo.server.core.VascTechDemoControllerConfig"
|
||||
removeLocal="false"
|
||||
/>
|
||||
<Resource name="vasc/server-admin" auth="Container" type="net.forwardfire.vasc.core.VascController" singleton="true" scope="Shareable"
|
||||
factory="net.forwardfire.vasc.impl.jndi.JndiVascControllerFactory"
|
||||
vascControllerProvider="net.forwardfire.vasc.demo.server.core.VascTechDemoControllerConfig"
|
||||
removeLocal="false"
|
||||
/>
|
||||
</GlobalNamingResources>
|
||||
<Service name="Catalina">
|
||||
<Connector port="8899" protocol="HTTP/1.1" connectionTimeout="5000" redirectPort="9988" />
|
||||
<Engine name="Catalina" defaultHost="localhost">
|
||||
<Realm className="org.apache.catalina.realm.JAASRealm"
|
||||
appName="vasc-auth-server"
|
||||
userClassNames="org.apache.openejb.core.security.jaas.UserPrincipal"
|
||||
roleClassNames="org.apache.openejb.core.security.jaas.GroupPrincipal"
|
||||
/>
|
||||
<!--
|
||||
<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.server.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.server.tomcat.AuthSessionTimeoutValve"
|
||||
logInfo="true" minTimeout="30" maxTimeout="3600" authTimeout="1200"
|
||||
/>
|
||||
</Host>
|
||||
</Engine>
|
||||
</Service>
|
||||
</Server>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tomee>
|
||||
<!-- This is ugly non-xml -->
|
||||
|
||||
<Container id="ServerSingletonContainer" type="SINGLETON">
|
||||
AccessTimeout = 30 seconds
|
||||
</Container>
|
||||
|
||||
<Container id="ServerStatefulContainer" type="STATEFUL">
|
||||
AccessTimeout = 30 seconds
|
||||
Passivator org.apache.openejb.core.stateful.SimplePassivater
|
||||
TimeOut 20
|
||||
Frequency 60
|
||||
Capacity 1000
|
||||
BulkPassivate 100
|
||||
</Container>
|
||||
|
||||
<Container id="ServerStatelessContainer" type="STATELESS">
|
||||
AccessTimeout = 30 seconds
|
||||
MaxSize = 10
|
||||
MinSize = 0
|
||||
StrictPooling = true
|
||||
MaxAge = 0 hours
|
||||
IdleTimeout = 0 minutes
|
||||
</Container>
|
||||
|
||||
|
||||
<!--
|
||||
# For more examples of database configuration see:
|
||||
# http://openejb.apache.org/3.0/databases.html
|
||||
-->
|
||||
<!--
|
||||
<Resource id="My DataSource" type="DataSource">
|
||||
JdbcDriver org.hsqldb.jdbcDriver
|
||||
JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
|
||||
UserName sa
|
||||
Password
|
||||
JtaManaged true
|
||||
</Resource>
|
||||
|
||||
|
||||
<Resource id="My Unmanaged DataSource" type="DataSource">
|
||||
JdbcDriver org.hsqldb.jdbcDriver
|
||||
JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
|
||||
UserName sa
|
||||
Password
|
||||
JtaManaged false
|
||||
</Resource>
|
||||
-->
|
||||
|
||||
<!-- Search path for ee/web apps -->
|
||||
<Deployments dir="apps/" />
|
||||
|
||||
</tomee>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,10 @@
|
|||
id,name,gender,age,function
|
||||
1,"mike",male,18,manager
|
||||
2,"michael",male,19,manager-co
|
||||
3,"peter",male,18,devop
|
||||
4,"bob",male,17,devver
|
||||
5,"barbara, barb",female,18,devver
|
||||
6,"charlotte",female,18,devver
|
||||
7,"hillary",female,20,tester
|
||||
8,"vera",female,17,tester
|
||||
9,"carrie",female,17,sales
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
id,name,description
|
||||
1,"fix-website","Move all pages to plain text so it is printable when there is no power."
|
||||
2,"refactor-HJY","Make function HJY abstract and use generic logic to improve total cpu lag on system"
|
||||
3,"custum-graph","Big custumer foobar want really this killer graph woobly line point stuff."
|
||||
|
|
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<level>
|
||||
<levelValue name="OFF" description="No logging output"/>
|
||||
<levelValue name="INFO" description="Normal loggin should be almost none."/>
|
||||
<levelValue name="DEBUG" description="Log as debug mode."/>
|
||||
<levelValue name="TRACE" description="Logs every method call."/>
|
||||
<levelValue name="FINE"/>
|
||||
</level>
|
||||
<application name="foobar" type="test">
|
||||
<logLevel group="com.foo.bar.test" level="INFO"/>
|
||||
<logLevel group="com.foo.bar.models" level="FINE"/>
|
||||
<logLevel group="com.foo.bar.web.beans" level="TRACE"/>
|
||||
</application>
|
||||
<application name="example" type="test">
|
||||
<logLevel group="com.example.test" level="INFO"/>
|
||||
<logLevel group="com.example.models" level="INFO"/>
|
||||
<logLevel group="com.example.remote" level="OFF"/>
|
||||
</application>
|
||||
<application name="someapp" type="test">
|
||||
<logLevel group="net.some.app.android" level="INFO"/>
|
||||
<logLevel group="net.some.app.android.x4o" level="FINE"/>
|
||||
<logLevel group="net.some.app.android.server.impl.task" level="OFF"/>
|
||||
</application>
|
||||
</root>
|
||||
|
|
@ -0,0 +1 @@
|
|||
1234-56-78 90:12:34,123 INFO [install] Thank you for trying this vasc demo tech.
|
||||
|
|
@ -0,0 +1 @@
|
|||
All *.xml in this dir are automaticly started.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Readme for Vasc Tech Demo application.
|
||||
|
||||
To start:
|
||||
|
||||
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 © 2012
|
||||
Application.web.footer.right = Version 0.4.x<i>(beta)</i>
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
::
|
||||
:: Copyright (c) 2011, Willem Cazander
|
||||
:: All rights reserved.
|
||||
::
|
||||
:: Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
:: that the following conditions are met:
|
||||
::
|
||||
:: * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
:: following disclaimer.
|
||||
:: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
:: the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
::
|
||||
:: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
:: EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
:: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
:: THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
:: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
:: OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
:: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
:: TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
:: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
::
|
||||
@echo off
|
||||
setlocal enableextensions
|
||||
|
||||
:: Run in app dir
|
||||
cd /d %~dp0
|
||||
|
||||
:: Config variables
|
||||
set JAVA_OPTS=-Xms64m -Xmx256m
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.server.core.VascTechDemoStartup
|
||||
set CP=libs\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
||||
|
||||
endlocal
|
||||
:: EOF
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2011, Willem Cazander
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
# that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
# the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Run in app dir
|
||||
cd `dirname $0`;
|
||||
|
||||
# Config variables
|
||||
JAVA="java";
|
||||
JAVA_OPTS="-Xms64m -Xmx256m";
|
||||
MAIN_CLASS="net.forwardfire.vasc.demo.server.core.VascTechDemoStartup";
|
||||
CP=`echo libs/*.jar | sed 's/ /:/g'`;
|
||||
|
||||
# Launch application
|
||||
$JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS;
|
||||
|
||||
# EOF
|
||||
|
||||
23
vasc-demo/vasc-demo-server/vasc-demo-server-core/.project
Normal file
23
vasc-demo/vasc-demo-server/vasc-demo-server-core/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-server-core</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>
|
||||
258
vasc-demo/vasc-demo-server/vasc-demo-server-core/pom.xml
Normal file
258
vasc-demo/vasc-demo-server/vasc-demo-server-core/pom.xml
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
<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-server</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-server-core</artifactId>
|
||||
<name>vasc-demo-server-core</name>
|
||||
<description>vasc-server-tech-core</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${x4o.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>jasper-el</artifactId>
|
||||
</exclusion>
|
||||
<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>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-ejb3</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>
|
||||
<exclusion>
|
||||
<artifactId>javassist</artifactId>
|
||||
<groupId>javassist</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
<artifactId>tomee-mojarra</artifactId>
|
||||
<version>${tomee.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
<artifactId>tomee-embedded</artifactId>
|
||||
<version>${tomee.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>tomee-myfaces</artifactId>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>myfaces-api</artifactId>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>myfaces-impl</artifactId>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
</exclusion><!--
|
||||
<exclusion>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<groupId>org.apache.openejb</groupId>
|
||||
</exclusion> -->
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Web tech deps -->
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.7.2</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>
|
||||
|
|
@ -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.server.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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.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.server.core.service.DatabaseService;
|
||||
import net.forwardfire.vasc.demo.server.core.service.ServerConfigService;
|
||||
import net.forwardfire.vasc.demo.server.core.service.ServerGuiService;
|
||||
import net.forwardfire.vasc.demo.server.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.demo.server.core.service.ServerConfigService.ServerConfigKey;
|
||||
import net.forwardfire.vasc.demo.server.tomcat.TomcatService;
|
||||
|
||||
/**
|
||||
* VascTechDemo init and starts the VascTechDemo
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2012
|
||||
*/
|
||||
public class VascTechDemoStartup {
|
||||
|
||||
private Logger logger = null;
|
||||
private ServerConfigService serverConfigService = null;
|
||||
private DatabaseService databaseService = null;
|
||||
private TomcatService tomcatService = null;
|
||||
private VascControllerService vascControllerService = null;
|
||||
private ServerGuiService swingGuiService = null;
|
||||
static private VascTechDemoStartup instance = null;
|
||||
|
||||
/**
|
||||
* Starts this VascTechDemo instance
|
||||
* @param args
|
||||
*/
|
||||
static public void main(String[] args) {
|
||||
instance = new VascTechDemoStartup();
|
||||
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-server-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(VascTechDemoStartup.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");
|
||||
System.setProperty("java.security.auth.login.config", "file:conf/login.config");
|
||||
setupAutoDir();
|
||||
setupLogging();
|
||||
logger.info("VascTechDemo initializing ...");
|
||||
databaseService = new DatabaseService();
|
||||
tomcatService = new TomcatService();
|
||||
serverConfigService = new ServerConfigService();
|
||||
vascControllerService = new VascControllerService();
|
||||
swingGuiService = new ServerGuiService();
|
||||
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();
|
||||
//if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_GUI)) {
|
||||
swingGuiService.start();
|
||||
//}
|
||||
databaseService.start();
|
||||
tomcatService.start();
|
||||
serverConfigService.start();
|
||||
vascControllerService.start();
|
||||
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_EDITOR)) {
|
||||
vascControllerService.startEditor();
|
||||
}
|
||||
tomcatService.deploy(serverConfigService.getServerConfigValue(ServerConfigKey.DEPLOY_PATH));
|
||||
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.DEPLOY_DEBUG)) {
|
||||
tomcatService.deployDebug();
|
||||
}
|
||||
//if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_GUI)) {
|
||||
swingGuiService.startDone();
|
||||
//}
|
||||
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();
|
||||
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 VascTechDemoStartup getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean isMavenRun() {
|
||||
return System.getProperty("java.class.path").contains("classes");
|
||||
}
|
||||
|
||||
public VascControllerService getVascControllerService() {
|
||||
return vascControllerService;
|
||||
}
|
||||
|
||||
public TomcatService getTomcatService() {
|
||||
return tomcatService;
|
||||
}
|
||||
|
||||
public ServerGuiService getSwingGuiService() {
|
||||
return swingGuiService;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.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/server/core/service/resources/init-db.sql");
|
||||
String[] allSqlData = allSql.split(";");
|
||||
for(String sql:allSqlData) {
|
||||
sql = sql.trim();
|
||||
if (sql.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
//logger.info("exe init sql:"+sql);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.core.service;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* 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 = VascTechDemoStartup.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.core.service;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.ServerGuiApplication;
|
||||
import org.jdesktop.application.Application;
|
||||
|
||||
/**
|
||||
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class ServerGuiService {
|
||||
|
||||
public void start() {
|
||||
Application.launch(ServerGuiApplication.class, new String[] {});
|
||||
}
|
||||
public void startDone() {
|
||||
ServerGuiApplication instance = ServerGuiApplication.getInstance();
|
||||
instance.startupDone();
|
||||
}
|
||||
public void stop() {
|
||||
ServerGuiApplication instance = ServerGuiApplication.getInstance();
|
||||
instance.stop();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.core.service;
|
||||
|
||||
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.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEventChannelControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEventControllerListener;
|
||||
import net.forwardfire.vasc.core.VascEventControllerType;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
public VascControllerService() {
|
||||
logger = Logger.getLogger(VascControllerService.class.getName());
|
||||
}
|
||||
|
||||
public void start() {
|
||||
logger.finer("Starting vascmanager");
|
||||
if (vascController!=null) {
|
||||
throw new RuntimeException("VascManager is already started.");
|
||||
}
|
||||
try {
|
||||
// Fetch from jndi
|
||||
vascController = (VascController)VascTechDemoStartup.getInstance().getTomcatService().getServer().getGlobalNamingContext().lookup("vasc/server-tech");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
VascEventChannelControllerLocal ev = (VascEventChannelControllerLocal)vascController.getVascEventChannelController();
|
||||
ev.addVascEventControllerListener(new I18NVascEventControllerListener());
|
||||
|
||||
}
|
||||
|
||||
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 {
|
||||
vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_BEFORE, vascController);
|
||||
VascParser parser = new VascParser(vascController);
|
||||
parser.parseResource("net/forwardfire/vasc/lib/editor/vasc-edit.xml");
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_AFTER, vascController);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
//fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
class I18NVascEventControllerListener implements VascEventControllerListener {
|
||||
|
||||
@Override
|
||||
public VascEventControllerType[] getVascEventControllerTypes() {
|
||||
return new VascEventControllerType[] {VascEventControllerType.LOAD_ENTRIES_AFTER};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void controllerEvent(VascEventControllerType type,Object eventObject) {
|
||||
|
||||
logger.info("Regenerating resource bundle keys...");
|
||||
|
||||
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:vascController.getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry ve = vascController.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();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the logInfo
|
||||
*/
|
||||
public boolean isLogInfo() {
|
||||
return logInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param logInfo the logInfo to set
|
||||
*/
|
||||
public void setLogInfo(boolean logInfo) {
|
||||
this.logInfo = logInfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
public class JdniTreePrinter {
|
||||
|
||||
boolean printXml = true;
|
||||
|
||||
public JdniTreePrinter(boolean printXml) {
|
||||
this.printXml=printXml;
|
||||
}
|
||||
|
||||
public void printJNDITree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
if (printXml) {
|
||||
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
buf.append("<NamingRoot name=\""+ct+"\">\n");
|
||||
}
|
||||
printTree(context,ct,buf);
|
||||
if (printXml) {
|
||||
buf.append("</NamingRoot>\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void printTree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
try {
|
||||
printNE(context,context.list(ct), ct,buf);
|
||||
} catch (NamingException e) {
|
||||
//ignore leaf node exception
|
||||
}
|
||||
}
|
||||
|
||||
private void printNE(javax.naming.Context context,javax.naming.NamingEnumeration<?> ne, String parentctx,StringBuffer buf) throws NamingException {
|
||||
if (ne==null) {
|
||||
return;
|
||||
}
|
||||
while (ne.hasMoreElements()) {
|
||||
NameClassPair next = (NameClassPair) ne.nextElement();
|
||||
if (printXml) {
|
||||
printIndent(buf);
|
||||
buf.append("<NamingRoot name=\""+next.getName()+"\" className=\""+next.getClassName()+"\">\n");
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
|
||||
printIndent(buf);
|
||||
buf.append("</NamingRoot>\n");
|
||||
} else {
|
||||
printEntry(next,buf);
|
||||
increaseIndent();
|
||||
printTree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printEntry(javax.naming.NameClassPair next,StringBuffer buf) {
|
||||
printIndent(buf);
|
||||
buf.append("-->");
|
||||
buf.append(next);
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
|
||||
private int indentLevel = 0;
|
||||
|
||||
private void increaseIndent() {
|
||||
indentLevel += 4;
|
||||
}
|
||||
|
||||
private void decreaseIndent() {
|
||||
indentLevel -= 4;
|
||||
}
|
||||
|
||||
private void printIndent(StringBuffer buf) {
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
buf.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package net.forwardfire.vasc.demo.server.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 org.apache.openejb.loader.SystemInstance;
|
||||
import org.apache.openejb.spi.ContainerSystem;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
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 = null;
|
||||
if (req.getRequestURI().endsWith("global")) {
|
||||
context = VascTechDemoStartup.getInstance().getTomcatService().getServer().getGlobalNamingContext();
|
||||
} else if (req.getRequestURI().endsWith("openejb")) {
|
||||
ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
|
||||
context = containerSystem.getJNDIContext();
|
||||
} else if (req.getRequestURI().endsWith("java")) {
|
||||
context = new InitialContext();
|
||||
}
|
||||
StringBuffer buf = new StringBuffer();
|
||||
JdniTreePrinter printer = null;
|
||||
if ("text".equals(req.getParameter("type"))) {
|
||||
printer = new JdniTreePrinter(false);
|
||||
} else {
|
||||
printer = new JdniTreePrinter(true);
|
||||
}
|
||||
if (req.getRequestURI().endsWith("global")) {
|
||||
printer.printJNDITree(context,"",buf);
|
||||
} else if (req.getRequestURI().endsWith("openejb")) {
|
||||
printer.printJNDITree(context,"",buf);
|
||||
} else if (req.getRequestURI().endsWith("java")) {
|
||||
printer.printJNDITree(context,"java:",buf);
|
||||
} else {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
buf.append("Unknown uri postfix.");
|
||||
}
|
||||
PrintWriter out = response.getWriter();
|
||||
out.append(buf.toString());
|
||||
out.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
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 net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEventControllerType;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
import org.apache.catalina.Server;
|
||||
import org.apache.naming.ContextBindings;
|
||||
|
||||
/**
|
||||
* VascDeployService parses "deploy/*.xml" automaticly for hotdeployments.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 10, 2012
|
||||
*/
|
||||
public class JndiVascDeployer {
|
||||
|
||||
private Server server = null;
|
||||
private VascController vascController = null;
|
||||
private Logger logger = null;
|
||||
private File deployDir = null;
|
||||
private int scanPeriod = 3;
|
||||
private AutoDeployManager autoDeployManager = null;
|
||||
private Map<File,String> fileCheckSums = null;
|
||||
|
||||
public JndiVascDeployer() {
|
||||
logger = Logger.getLogger(JndiVascDeployer.class.getName());
|
||||
fileCheckSums = new HashMap<File,String>(20);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (vascController==null) {
|
||||
throw new NullPointerException("Can't deploy with null vascController.");
|
||||
}
|
||||
if (server==null) {
|
||||
throw new NullPointerException("Can't deploy with null server.");
|
||||
}
|
||||
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++;
|
||||
parseVascFile(file);
|
||||
}
|
||||
if (deployed > 0) {
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("Done deploying total files read: "+deployed+" in "+(stopTime-startTime)+" ms.");
|
||||
}
|
||||
}
|
||||
|
||||
public void parseVascFile(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));
|
||||
|
||||
vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_BEFORE, vascController);
|
||||
parser.parseFile(file);
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_AFTER, vascController);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
//fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
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 = VascTechDemoStartup.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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the server
|
||||
*/
|
||||
public Server getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param server the server to set
|
||||
*/
|
||||
public void setServer(Server server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
|
||||
import org.apache.catalina.Lifecycle;
|
||||
import org.apache.catalina.LifecycleEvent;
|
||||
import org.apache.catalina.LifecycleListener;
|
||||
import org.apache.catalina.core.StandardServer;
|
||||
|
||||
public class JndiVascDeployerListener implements LifecycleListener {
|
||||
|
||||
private Logger logger = Logger.getLogger(JndiVascDeployerListener.class.getName());
|
||||
private JndiVascDeployer deployer = null;
|
||||
private String vascControllerName = null;
|
||||
private String scanPath = null;
|
||||
private int scanTime = 3;
|
||||
|
||||
public void lifecycleEvent(LifecycleEvent event) {
|
||||
if ((event.getSource() instanceof StandardServer)==false) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if ( Lifecycle.AFTER_START_EVENT.equals(event.getType())) {
|
||||
startDeployer((StandardServer)event.getSource());
|
||||
}
|
||||
if ( Lifecycle.BEFORE_STOP_EVENT.equals(event.getType())) {
|
||||
stopDeployer();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, this.getClass().getSimpleName()+" can't control deployer: "+e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void startDeployer(StandardServer server) throws NamingException {
|
||||
if (deployer!=null) {
|
||||
throw new IllegalStateException("Can't start deployer when it is already started.");
|
||||
}
|
||||
if (getScanPath()==null) {
|
||||
throw new NullPointerException("Can't start deployer with null scanPath.");
|
||||
}
|
||||
File deployDir = new File(getScanPath());
|
||||
|
||||
|
||||
VascController vascController = (VascController)server.getGlobalNamingContext().lookup(getVascControllerName());
|
||||
if (vascController == null) {
|
||||
throw new NullPointerException("Cannot lookup vascController: "+getVascControllerName());
|
||||
}
|
||||
|
||||
deployer = new JndiVascDeployer();
|
||||
deployer.setDeployDir(deployDir);
|
||||
deployer.setScanPeriod(getScanTime());
|
||||
deployer.setServer(server);
|
||||
deployer.setVascController(vascController);
|
||||
deployer.start();
|
||||
}
|
||||
|
||||
private void stopDeployer() {
|
||||
if (deployer==null) {
|
||||
return;
|
||||
}
|
||||
deployer.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascControllerName
|
||||
*/
|
||||
public String getVascControllerName() {
|
||||
return vascControllerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascControllerName the vascControllerName to set
|
||||
*/
|
||||
public void setVascControllerName(String vascControllerName) {
|
||||
this.vascControllerName = vascControllerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanPath
|
||||
*/
|
||||
public String getScanPath() {
|
||||
return scanPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scanPath the scanPath to set
|
||||
*/
|
||||
public void setScanPath(String scanPath) {
|
||||
this.scanPath = scanPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanTime
|
||||
*/
|
||||
public int getScanTime() {
|
||||
return scanTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scanTime the scanTime to set
|
||||
*/
|
||||
public void setScanTime(int scanTime) {
|
||||
this.scanTime = scanTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,406 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.ejb.embeddable.EJBContainer;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.apache.catalina.Container;
|
||||
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.NamingContext;
|
||||
import org.apache.naming.resources.VirtualDirContext;
|
||||
import org.apache.openejb.assembler.Deployer;
|
||||
import org.apache.openejb.assembler.DeployerEjb;
|
||||
import org.apache.openejb.assembler.classic.AppInfo;
|
||||
import org.apache.openejb.config.AppModule;
|
||||
import org.apache.openejb.config.ConfigurationFactory;
|
||||
import org.apache.openejb.config.DeploymentsResolver;
|
||||
import org.apache.openejb.config.sys.AdditionalDeployments;
|
||||
import org.apache.openejb.config.sys.Deployments;
|
||||
import org.apache.openejb.config.sys.JaxbOpenejb;
|
||||
import org.apache.openejb.loader.FileUtils;
|
||||
import org.apache.openejb.loader.IO;
|
||||
import org.apache.openejb.loader.Options;
|
||||
import org.apache.openejb.loader.SystemInstance;
|
||||
import org.apache.openejb.server.ejbd.EjbServer;
|
||||
import org.apache.openejb.spi.ContainerSystem;
|
||||
import org.apache.openejb.util.URLs;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
/*
|
||||
// List all ejb-jar.xml resources.
|
||||
Enumeration<URL> ejbJars = this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
|
||||
while (ejbJars.hasMoreElements()) {
|
||||
URL url = ejbJars.nextElement();
|
||||
System.out.println("app = " + url);
|
||||
}
|
||||
*/
|
||||
|
||||
//org.apache.tomee.catalina.ServerListener
|
||||
System.setProperty("openejb.servicemanager.enabled", "true");
|
||||
System.setProperty("openejb.embedded.remotable", "true");
|
||||
System.setProperty("openejb.validation.output.level", "VERBOSE");
|
||||
|
||||
// System.setProperty("openejb.deployments.classpath", "true");
|
||||
// System.setProperty("openejb.deployments.classpath.ear", "true");
|
||||
//System.setProperty("openejb.deployments.classpath", "false");
|
||||
//System.setProperty("openejb.deployments.classpath.ear", "false");
|
||||
//System.setProperty("openejb.deployments.classpath.include", ".*");
|
||||
//System.setProperty("openejb.deployments.classpath.exclude", "");
|
||||
|
||||
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 static final String ADDITIONAL_DEPLOYMENTS = "conf/deployments.xml";
|
||||
private static final String CLASSPATH_AS_EAR = "openejb.deployments.classpath.ear";
|
||||
|
||||
private List<String> getDeclaredApps() {
|
||||
// make a copy of the list because we update it
|
||||
final List<Deployments> deployments = new ArrayList<Deployments>();
|
||||
//if (openejb != null) {
|
||||
// deployments.addAll(openejb.getDeployments());
|
||||
//}
|
||||
File additionalDeploymentFile;
|
||||
try {
|
||||
additionalDeploymentFile = SystemInstance.get().getBase().getFile(ADDITIONAL_DEPLOYMENTS, false);
|
||||
} catch (IOException e) {
|
||||
additionalDeploymentFile = null;
|
||||
}
|
||||
if (additionalDeploymentFile.exists()) {
|
||||
InputStream fis = null;
|
||||
try {
|
||||
fis = IO.read(additionalDeploymentFile);
|
||||
final AdditionalDeployments additionalDeployments = JaxbOpenejb.unmarshal(AdditionalDeployments.class, fis);
|
||||
deployments.addAll(additionalDeployments.getDeployments());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//logger.error("can't read " + ADDITIONAL_DEPLOYMENTS, e);
|
||||
} finally {
|
||||
IO.close(fis);
|
||||
}
|
||||
}
|
||||
|
||||
// resolve jar locations ////////////////////////////////////// BEGIN ///////
|
||||
|
||||
final FileUtils base = SystemInstance.get().getBase();
|
||||
|
||||
final List<URL> declaredAppsUrls = new ArrayList<URL>();
|
||||
try {
|
||||
for (final Deployments deployment : deployments) {
|
||||
DeploymentsResolver.loadFrom(deployment, base, declaredAppsUrls);
|
||||
}
|
||||
} catch (SecurityException ignored) {
|
||||
}
|
||||
return toString(declaredAppsUrls);
|
||||
}
|
||||
|
||||
public ArrayList<File> getModulesFromClassPath(List<String> declaredApps, final ClassLoader classLoader) {
|
||||
final FileUtils base = SystemInstance.get().getBase();
|
||||
if (declaredApps == null) {
|
||||
declaredApps = getDeclaredApps();
|
||||
}
|
||||
final List<URL> classpathAppsUrls = new ArrayList<URL>();
|
||||
DeploymentsResolver.loadFromClasspath(base, classpathAppsUrls, classLoader);
|
||||
|
||||
final ArrayList<File> jarFiles = new ArrayList<File>();
|
||||
for (final URL path : classpathAppsUrls) {
|
||||
if (declaredApps.contains(URLs.toFilePath(path))) continue;
|
||||
|
||||
jarFiles.add(new File(URLs.toFilePath(path)));
|
||||
}
|
||||
return jarFiles;
|
||||
}
|
||||
|
||||
private List<String> toString(final List<URL> urls) {
|
||||
final List<String> toReturn = new ArrayList<String>(urls.size());
|
||||
for (final URL url : urls) {
|
||||
try {
|
||||
toReturn.add(url.toString());
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void deploy(String deployContext) throws Exception {
|
||||
Service service = server.findService("Catalina");
|
||||
Host host = (Host)service.getContainer().findChild("localhost");
|
||||
|
||||
String deployPath = null;
|
||||
if (VascTechDemoStartup.getInstance().isMavenRun()) {
|
||||
String webappPathLocation = "../../vasc-demo-tech/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("libs").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+deployContext); //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/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;
|
||||
|
||||
/*
|
||||
ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
|
||||
Deployer dep = (Deployer)containerSystem.getJNDIContext().lookup("java:global/openejb/openejb/Deployer");
|
||||
for (AppInfo ai:dep.getDeployedApps()) {
|
||||
System.out.println("AppInfo: "+ai.appId);
|
||||
}
|
||||
|
||||
System.out.println("Deploy JarFile: "+deployPath);
|
||||
Properties p = new Properties();
|
||||
p.setProperty(Deployer.FILENAME, ""+deployPath);
|
||||
p.setProperty(DeployerEjb.OPENEJB_DEPLOYER_FORCED_APP_ID_PROP, deployContext);
|
||||
AppInfo app = dep.deploy(p);
|
||||
|
||||
for (Container c:host.findChildren()) {
|
||||
System.out.println("Containter: "+c.getName()+" info: "+c.getInfo());
|
||||
if ("/webapp".equals(c.getName()) | deployContext.equals(c.getName())) {
|
||||
applicationContext = (Context)c;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* deploy embedded ejbs .
|
||||
for (AppInfo ai:dep.getDeployedApps()) {
|
||||
System.out.println("AppInfo2: "+ai.appId);
|
||||
}
|
||||
|
||||
final List<String> declaredApps = getDeclaredApps();
|
||||
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
final ArrayList<File> jarFiles = getModulesFromClassPath(declaredApps, classLoader);
|
||||
try {
|
||||
for (final File jarFile : jarFiles) {
|
||||
System.out.println("Deploy JarFile: "+jarFile);
|
||||
|
||||
boolean skip = false;
|
||||
for (AppInfo ai:dep.getDeployedApps()) {
|
||||
if ((""+jarFile).contains(ai.appId)) {
|
||||
System.out.println("Skip deplyo: "+ai.appId);
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((""+jarFile).contains("vasc-core-ejb3-server")) {
|
||||
System.out.println("Skip vasc-core-ejb3-server");
|
||||
skip = true;
|
||||
}
|
||||
if ((""+jarFile).contains("vasc-xpql-ejb3-server")) {
|
||||
System.out.println("Skip vasc-xpql-ejb3-server");
|
||||
skip = true;
|
||||
}
|
||||
if ((""+jarFile).contains("vasc-demo-tech-ejb3")) {
|
||||
System.out.println("Skip vasc-demo-tech-ejb3");
|
||||
skip = true;
|
||||
}
|
||||
if (skip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p = new Properties();
|
||||
p.setProperty(Deployer.FILENAME, ""+jarFile);
|
||||
p.setProperty(DeployerEjb.OPENEJB_DEPLOYER_FORCED_APP_ID_PROP, "webapp");
|
||||
dep.deploy(p);
|
||||
}
|
||||
if (jarFiles.size() == 0) {
|
||||
logger.warning("config.noModulesFoundToDeploy");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void deployDebug() throws Exception {
|
||||
if (applicationContext==null) {
|
||||
throw new NullPointerException("Can only deploy debug after deploy.");
|
||||
//return;
|
||||
}
|
||||
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.server.tomcat.JndiDebugServlet");
|
||||
applicationContext.addServletMapping("/debug/jndi/view", "jndiView");
|
||||
applicationContext.addServletMapping("/debug/jndi/view/*", "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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
public class JStartupPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = -2880272130103870144L;
|
||||
private JProgressBar bar = null;
|
||||
|
||||
public JStartupPanel() {
|
||||
|
||||
JLabel label = new JLabel("Starting up....");
|
||||
add(label);
|
||||
|
||||
bar = new JProgressBar();
|
||||
add(bar);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.Serializable;
|
||||
|
||||
import 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.VascEntryLocal;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JStatusPanel extends JPanel {
|
||||
|
||||
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 JStatusPanel() {
|
||||
this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void changeEvent() {
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.CheckboxMenuItem;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.Menu;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.net.URL;
|
||||
import java.util.EventObject;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
import org.jdesktop.application.Application.ExitListener;
|
||||
|
||||
/**
|
||||
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class ServerGuiApplication extends SingleFrameApplication {
|
||||
|
||||
protected void startup() {
|
||||
addExitListener(new ShutdownManager());
|
||||
FrameView mainView = getMainView();
|
||||
|
||||
mainView.setComponent(new JStartupPanel());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(600,200));
|
||||
//mainView.getFrame().setResizable(false);
|
||||
show(mainView);
|
||||
|
||||
startSystemTray();
|
||||
}
|
||||
|
||||
public void startupDone() {
|
||||
getMainFrame().setVisible(false);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
exit();
|
||||
}
|
||||
|
||||
static public ServerGuiApplication getInstance() {
|
||||
return getInstance(ServerGuiApplication.class);
|
||||
}
|
||||
|
||||
class ShutdownManager implements ExitListener {
|
||||
public boolean canExit(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
public void willExit(EventObject event) {
|
||||
VascTechDemoStartup.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void startSystemTray() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
return;
|
||||
}
|
||||
final PopupMenu popup = new PopupMenu();
|
||||
final TrayIcon trayIcon = new TrayIcon(createImage("/net/forwardfire/vasc/demo/server/ui/resources/tray-icon.png", "tray icon"));
|
||||
final SystemTray tray = SystemTray.getSystemTray();
|
||||
|
||||
MenuItem aboutItem = new MenuItem("About");
|
||||
MenuItem statusItem = new MenuItem("View Status");
|
||||
MenuItem logItem = new MenuItem("View Log");
|
||||
|
||||
|
||||
Menu displayMenu = new Menu("Launch");
|
||||
MenuItem errorItem = new MenuItem("Web client");
|
||||
MenuItem warningItem = new MenuItem("Swing client");
|
||||
MenuItem infoItem = new MenuItem("Swt client");
|
||||
MenuItem noneItem = new MenuItem("None");
|
||||
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
exit();
|
||||
}
|
||||
});
|
||||
|
||||
popup.add(aboutItem);
|
||||
popup.addSeparator();
|
||||
popup.add(statusItem);
|
||||
popup.add(logItem);
|
||||
popup.addSeparator();
|
||||
popup.add(displayMenu);
|
||||
displayMenu.add(errorItem);
|
||||
displayMenu.add(warningItem);
|
||||
displayMenu.add(infoItem);
|
||||
displayMenu.add(noneItem);
|
||||
popup.add(exitItem);
|
||||
|
||||
trayIcon.setPopupMenu(popup);
|
||||
|
||||
try {
|
||||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
System.out.println("TrayIcon could not be added.");
|
||||
}
|
||||
}
|
||||
|
||||
protected static Image createImage(String path, String description) {
|
||||
URL imageURL = ServerGuiApplication.class.getResource(path);
|
||||
if (imageURL == null) {
|
||||
throw new NullPointerException("Could not find resource: "+path);
|
||||
}
|
||||
return (new ImageIcon(imageURL, description)).getImage();
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.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.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* 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(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.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.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.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(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.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
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.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.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.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(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.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
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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.server.x4o;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.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 = VascTechDemoStartup.getInstance().getTomcatService();
|
||||
Server server = tm.getServer();
|
||||
NamingResources jndiContext = server.getGlobalNamingResources();
|
||||
jndiContext.addResource(resource);
|
||||
logger.info("Added jndi global resource: "+resource.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
config.charset=UTF-8
|
||||
config.bundles=bundle1,bundle2
|
||||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.server.ui.resources.ServerGuiApplication
|
||||
|
||||
bundle2.uri=data/vasc-bundle.properties
|
||||
bundle2.type=FILE
|
||||
bundle2.optional=true
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<modules version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/modules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
|
||||
>
|
||||
<language version="1.0">
|
||||
<eld-resource>vasc-tech-demo.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root:module
|
||||
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
|
||||
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
|
||||
providerName="vasc.forwardfire.net"
|
||||
name="Vasc Tomcat Resource binding"
|
||||
id="vasc-tech-demo"
|
||||
>
|
||||
<namespace uri="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
schemaUri="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo-1.0.xsd"
|
||||
schemaResource="vasc-tech-demo-1.0.xsd"
|
||||
schemaPrefix="td"
|
||||
name="Vasc Tech Demo"
|
||||
id="ns-vasc-demo-server"
|
||||
>
|
||||
<element tag="tomcatResource" elementClass="net.forwardfire.vasc.demo.server.x4o.TomcatResourceElement"/>
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
--
|
||||
-- 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_group (
|
||||
id varchar not null primary key,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
);
|
||||
CREATE INDEX vasc_menu_group_active_idx ON vasc_menu_group(active);
|
||||
|
||||
CREATE TABLE vasc_menu (
|
||||
id IDENTITY not null primary key,
|
||||
vasc_entry_id varchar not null,
|
||||
title varchar not null,
|
||||
active BOOLEAN NOT NULL,
|
||||
roles varchar not null,
|
||||
menu_order integer not null,
|
||||
menu_group varchar not null
|
||||
);
|
||||
CREATE INDEX vasc_menu_active_idx ON vasc_menu(active);
|
||||
|
||||
CREATE TABLE vasc_menu_web (
|
||||
id IDENTITY not null primary key,
|
||||
href varchar not null,
|
||||
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_web_active_idx ON vasc_menu_web(active);
|
||||
CREATE INDEX vasc_menu_web_type_idx ON vasc_menu_web(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_group VALUES('demo', 'Demo',true,'',1);
|
||||
INSERT INTO vasc_menu_group VALUES('meta', 'Meta',true,'',2);
|
||||
|
||||
INSERT INTO vasc_menu VALUES(1,'metaPeople', 'People', true,'',1,'meta');
|
||||
INSERT INTO vasc_menu VALUES(2,'metaProjects', 'Projects',true,'',2,'meta');
|
||||
|
||||
INSERT INTO vasc_menu VALUES(3,'AdminVascUser', 'Users', true,'',1,'demo');
|
||||
INSERT INTO vasc_menu VALUES(4,'AdminVascUserRole', 'UserRole',true,'',2,'demo');
|
||||
INSERT INTO vasc_menu VALUES(5,'AdminVascUserChangeField','ChangeField', true,'',3,'demo');
|
||||
INSERT INTO vasc_menu VALUES(6,'AdminVascUserChangeLog', 'ChangeLog',true,'',4,'demo');
|
||||
INSERT INTO vasc_menu VALUES(7,'AdminVascPage', 'Pages', true,'',5,'demo');
|
||||
INSERT INTO vasc_menu VALUES(8,'AdminVascPagePart', 'PagesPart',true,'',6,'demo');
|
||||
INSERT INTO vasc_menu VALUES( 9,'AdminVascMenuWeb', 'MenuWeb', true,'',7,'demo');
|
||||
INSERT INTO vasc_menu VALUES(10,'AdminVascMenuGroup', 'MenuGroup',true,'',8,'demo');
|
||||
INSERT INTO vasc_menu VALUES(11,'AdminVascMenu', 'Menu', true,'',9,'demo');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(1, '/html/index.jsf','Home', '',true,'',1,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_web VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(4, '/html/index.jsf','Home', '',true,'',1,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu_web VALUES(5, '/html/index.jsf','Contact', '',true,'',2,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu_web VALUES(6, '/html/index.jsf','Help', '',true,'',3,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu_web VALUES(7, '/html/index.jsf','Techno', '',true,'',3,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu_web VALUES(8, '/html/index.jsf','Licences', '',true,'',3,'BAR_BOTTOM');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(10, '/vasc/AdminVascUser/list.jsf', 'Users', '',true,'admin',4,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu_web VALUES(11, '/vasc/AdminVascUserRole/list.jsf', 'UserRoles', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu_web VALUES(12, '/vasc/AdminVascUserChangeField/list.jsf', 'ChangeField', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu_web VALUES(13, '/vasc/AdminVascUserChangeLog/list.jsf', 'ChangeFieldLog', '',true,'admin',5,'PAGE_ADMIN');
|
||||
|
||||
INSERT INTO vasc_menu_web VALUES(14, '/vasc/AdminVascPage/list.jsf', 'Pages', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu_web VALUES(15, '/vasc/AdminVascPagePart/list.jsf', 'PageParts', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu_web VALUES(16, '/vasc/AdminVascMenu/list.jsf', 'Menu', '',true,'admin',4,'PAGE_ADMIN');
|
||||
|
||||
|
||||
|
|
@ -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 © 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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 644 B |
Loading…
Add table
Add a link
Reference in a new issue