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
|
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<artifactId>vasc</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo</artifactId>
|
||||
|
|
@ -14,5 +14,6 @@
|
|||
<modules>
|
||||
<module>vasc-demo-petstore-j2ee5</module>
|
||||
<module>vasc-demo-tech</module>
|
||||
<module>vasc-demo-server</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-demo</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-petstore-j2ee5</artifactId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-demo-petstore-j2ee5</name>
|
||||
<description>vasc-demo-petstore-j2ee5</description>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-demo-petstore-j2ee5</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-petstore-j2ee5-ear</artifactId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<name>vasc-demo-petstore-j2ee5-ear</name>
|
||||
<description>vasc-demo-petstore-j2ee5-ear</description>
|
||||
</project>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<artifactId>vasc-demo-petstore-j2ee5</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-petstore-j2ee5-ejb</artifactId>
|
||||
<packaging>ejb</packaging>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>${x4o-core.version}</version>
|
||||
<version>${x4o.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -70,12 +70,12 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-xpql-ejb3</artifactId>
|
||||
<artifactId>vasc-xpql-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3</artifactId>
|
||||
<artifactId>vasc-core-ejb3-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<parent>
|
||||
<artifactId>vasc-demo-petstore-j2ee5</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>net.forwardfire.vasc.demos</groupId>
|
||||
<artifactId>vasc-demo-petstore-j2ee5-war</artifactId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<name>vasc-demo-petstore-j2ee5-war</name>
|
||||
<description>vasc-demo-petstore-j2ee5-war</description>
|
||||
</project>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-tech-build</name>
|
||||
<name>vasc-demo-server</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
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>
|
||||
|
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<baseDirectory>vasc-demo-tech-${project.version}</baseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/lib</outputDirectory>
|
||||
<outputDirectory>/libs</outputDirectory>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
|
|
@ -67,5 +67,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<exclude>conf/logback-server-console.xml</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/target/docs/</directory>
|
||||
<outputDirectory>/docs</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
|
@ -7,13 +7,15 @@
|
|||
<ResourceLink name="config/START_EDITOR" global="config/START_EDITOR" type="java.lang.Boolean"/>
|
||||
<ResourceLink name="config/DEPLOY_DEBUG" global="config/DEPLOY_DEBUG" type="java.lang.Boolean"/>
|
||||
<ResourceLink name="config/DEPLOY_PATH" global="config/DEPLOY_PATH" type="java.lang.String"/>
|
||||
|
||||
<ResourceLink name="jdbc/DemoManagerDataDS" global="jdbc/DemoManagerDataDS" type="javax.sql.DataSource"/>
|
||||
<ResourceLink name="vasc/DemoVascController" global="vasc/DemoVascController" type="net.forwardfire.vasc.core.VascController" />
|
||||
<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>
|
||||
<!-- Default set of monitored resources -->
|
||||
<WatchedResource>WEB-INF/web.xml</WatchedResource>
|
||||
|
||||
<!-- Disable session persistence across restarts -->
|
||||
<Manager pathname="" />
|
||||
|
||||
<!-- Disable session persistence across restarts -->
|
||||
<Manager pathname="" />
|
||||
|
||||
</Context>
|
||||
|
|
@ -20,13 +20,14 @@
|
|||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
<!-- Limit some startup messages. -->
|
||||
<logger level="WARN" name="org.apache.catalina.startup.Catalina"/>
|
||||
<logger level="WARN" name="org.apache.catalina.startup.ContextConfig"/>
|
||||
<logger level="ERROR" name="org.apache.catalina.startup.ClassLoaderFactory"/>
|
||||
<logger level="WARN" name="org.apache.catalina.core.AprLifecycleListener"/>
|
||||
<logger level="WARN" name="org.ajax4jsf.cache.LRUMapCacheFactory"/>
|
||||
<logger level="WARN" name="javax.enterprise.resource.webcontainer.jsf.application"/>
|
||||
<logger level="WARN" name="net.jawr.web.resource.bundle.factory.BundlesHandlerFactory"/>
|
||||
<!-- 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>
|
||||
|
|
@ -25,5 +25,6 @@
|
|||
<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=?";
|
||||
};
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
|
||||
xmlns:td="http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld"
|
||||
<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. -->
|
||||
|
|
@ -40,4 +41,4 @@
|
|||
<mm:schemaAutoEntry dataContextProvider="${mmdc4}" entryPrefix="AdminConfConfig" />
|
||||
<mm:schemaAutoEntry dataContextProvider="${mmdc5}" entryPrefix="AdminConfWeb" />
|
||||
|
||||
</v:root>
|
||||
</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>
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
|
||||
<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="meta-people.csv"
|
||||
file="data/demo/meta-people.csv"
|
||||
/>
|
||||
<mm:metaModelBackend
|
||||
id="metaPeopleBackend"
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<mm:csvDataContext
|
||||
el.id="metaProjectDS"
|
||||
file="meta-project.csv"
|
||||
file="data/demo/meta-project.csv"
|
||||
/>
|
||||
<mm:metaModelBackend
|
||||
id="metaProjectBackend"
|
||||
|
|
@ -42,4 +42,4 @@
|
|||
<v:field id="description" vascEntryFieldType="TextAreaField"/>
|
||||
</v:entry>
|
||||
|
||||
</v:root>
|
||||
</vasc:root>
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
|
||||
xmlns:td="http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld"
|
||||
<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" />
|
||||
|
||||
|
|
@ -21,7 +22,7 @@
|
|||
<v:field id="username" backendName="USERNAME" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModel entryId="AdminVascUser" keyFieldId="username"/>
|
||||
</v:field>
|
||||
<v:field id="role" backendNAME="ROLE"/>
|
||||
<v:field id="role" backendName="ROLE"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
|
|
@ -30,7 +31,7 @@
|
|||
<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:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
|
|
@ -43,58 +44,84 @@
|
|||
<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:field id="value_old" backendName="VALUE_OLD"/>
|
||||
<v:field id="value_new" backendName="VALUE_NEW"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascMenuBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU" tableId="ID" />
|
||||
<v:entry id="AdminVascMenu" backendId="AdminVascMenuBackend">
|
||||
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="BAR_LEFT,BAR_RIGHT,BAR_BOTTOM,PAGE_INDEX,PAGE_USER_LEFT,PAGE_USER_RIGHT,PAGE_ADMIN"/>
|
||||
</v:listOption>
|
||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||
</v:listOption>
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="href" backendNAME="HREF"/>
|
||||
<v:field id="title" backendNAME="TITLE"/>
|
||||
<v:field id="target" backendNAME="TARGET"/>
|
||||
<v:field id="active" backendNAME="ACTIVE" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="roles" backendNAME="ROLES"/>
|
||||
<v:field id="menu_order" backendNAME="MENU_ORDER" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="menu_type" backendNAME="MENU_TYPE" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelString data="BAR_LEFT,BAR_RIGHT,BAR_BOTTOM,MENU0,MENU1,MENU2,PAGE_INDEX,PAGE_USER_LEFT,PAGE_USER_RIGHT,PAGE_ADMIN"/>
|
||||
</v:field>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascPageBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE" tableId="ID" />
|
||||
<v:entry id="AdminVascPage" backendId="AdminVascPageBackend">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="slug" backendNAME="SLUG"/>
|
||||
<v:field id="title" backendNAME="TITLE"/>
|
||||
<v:field id="i18n_key" backendNAME="I18N_KEY" vascEntryFieldType="BooleanField"/>
|
||||
<!-- <v:field id="active" backendNAME="ACTIVE" vascEntryFieldType="BooleanField"/> -->
|
||||
<v:field id="sitemap" backendNAME="SITEMAP" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="slug" backendName="SLUG"/>
|
||||
<v:field id="title" backendName="TITLE"/>
|
||||
<v:field id="i18n_key" backendName="I18N_KEY" vascEntryFieldType="BooleanField"/>
|
||||
<!-- <v:field id="active" backendName="ACTIVE" vascEntryFieldType="BooleanField"/> -->
|
||||
<v:field id="sitemap" backendName="SITEMAP" vascEntryFieldType="BooleanField"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<mm:metaModelBackend id="AdminVascPagePartBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_PAGE_PART" tableId="ID" />
|
||||
<v:entry id="AdminVascPagePart" backendId="AdminVascPagePartBackend">
|
||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||
<v:field id="page_id" backendNAME="PAGE_ID" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModel entryId="AdminVascPage" keyFieldId="id"/>
|
||||
<v:field 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:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.web.menu.model.VascMenuType"/>
|
||||
<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>
|
||||
|
||||
</v:root>
|
||||
|
||||
<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>
|
||||
|
|
@ -1,10 +1,21 @@
|
|||
<?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"/>
|
||||
|
|
@ -20,15 +31,26 @@
|
|||
url="jdbc:h2:tcp://localhost:9092/vasc-demo"
|
||||
/>
|
||||
<!-- Config The Vasc Demo Controller -->
|
||||
<Resource name="vasc/DemoVascController" auth="Container" type="net.forwardfire.vasc.core.VascController" singleton="true" scope="Shareable"
|
||||
<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.tech.core.VascTechDemoControllerConfig"
|
||||
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"
|
||||
|
|
@ -39,8 +61,7 @@
|
|||
roleNameCol="role"
|
||||
digestEncoding="UTF-8"
|
||||
/>
|
||||
<!--
|
||||
<Realm className="net.forwardfire.vasc.demo.tech.core.service.tomcat.MongoRealm"
|
||||
<Realm className="net.forwardfire.vasc.demo.server.tomcat.MongoRealm"
|
||||
hostname="localhost" port="27017" database="testdb" authUser="" authPass=""
|
||||
userCollection="site_user"
|
||||
userField="username"
|
||||
|
|
@ -53,15 +74,15 @@
|
|||
/>
|
||||
<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})"
|
||||
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"
|
||||
>
|
||||
|
|
@ -72,7 +93,7 @@
|
|||
crawlerUserAgents=".*[bB]ot.*|.*ahoo.*|.*oogle.*"
|
||||
sessionInactiveInterval="60"
|
||||
/>
|
||||
<Valve className="net.forwardfire.vasc.demo.tech.core.service.tomcat.AuthSessionTimeoutValve"
|
||||
<Valve className="net.forwardfire.vasc.demo.server.tomcat.AuthSessionTimeoutValve"
|
||||
logInfo="true" minTimeout="30" maxTimeout="3600" authTimeout="1200"
|
||||
/>
|
||||
</Host>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -28,8 +28,8 @@ cd /d %~dp0
|
|||
|
||||
:: Config variables
|
||||
set JAVA_OPTS=-Xms64m -Xmx256m
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.tech.core.VascTechDemo
|
||||
set CP=lib\*
|
||||
set MAIN_CLASS=net.forwardfire.vasc.demo.server.core.VascTechDemoStartup
|
||||
set CP=libs\*
|
||||
|
||||
:: Launch application
|
||||
java %JAVA_OPTS% -cp "%CP%" %MAIN_CLASS%
|
||||
|
|
@ -28,8 +28,8 @@ cd `dirname $0`;
|
|||
# Config variables
|
||||
JAVA="java";
|
||||
JAVA_OPTS="-Xms64m -Xmx256m";
|
||||
MAIN_CLASS="net.forwardfire.vasc.demo.tech.core.VascTechDemo";
|
||||
CP=`echo lib/*.jar | sed 's/ /:/g'`;
|
||||
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;
|
||||
|
|
@ -1,25 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-tech-core</name>
|
||||
<name>vasc-demo-server-core</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
|
|
@ -27,10 +17,7 @@
|
|||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -1,20 +1,24 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
<artifactId>vasc-demo-server</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech-core</artifactId>
|
||||
<name>vasc-demo-tech-core</name>
|
||||
<description>vasc-demo-tech-core</description>
|
||||
<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-core.version}</version>
|
||||
<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>
|
||||
|
|
@ -87,6 +91,21 @@
|
|||
<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>
|
||||
|
|
@ -117,39 +136,49 @@
|
|||
<artifactId>log4j</artifactId>
|
||||
<groupId>log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>javassist</artifactId>
|
||||
<groupId>javassist</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Tomcat deps -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>7.0.27</version>
|
||||
<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.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-jasper</artifactId>
|
||||
<version>7.0.27</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jasper</artifactId>
|
||||
<version>7.0.27</version>
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>7.0.27</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web tech deps
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- Web tech deps -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
|
|
@ -197,6 +226,11 @@
|
|||
<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>
|
||||
|
|
@ -219,5 +253,6 @@
|
|||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>${log4j-over-slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core;
|
||||
package net.forwardfire.vasc.demo.server.core;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core;
|
||||
package net.forwardfire.vasc.demo.server.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -31,13 +31,12 @@ import java.util.logging.Logger;
|
|||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.service.DatabaseService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.ServerConfigService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.ServerConfigService.ServerConfigKey;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.tomcat.TomcatService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.SwingGuiService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.VascDeployService;
|
||||
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
|
||||
|
|
@ -45,39 +44,38 @@ import net.forwardfire.vasc.demo.tech.core.service.VascDeployService;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2012
|
||||
*/
|
||||
public class VascTechDemo {
|
||||
public class VascTechDemoStartup {
|
||||
|
||||
private Logger logger = null;
|
||||
private ServerConfigService serverConfigService = null;
|
||||
private DatabaseService databaseService = null;
|
||||
private TomcatService tomcatService = null;
|
||||
private VascControllerService vascControllerService = null;
|
||||
private VascDeployService vascDeployService = null;
|
||||
private SwingGuiService swingGuiService = null;
|
||||
static private VascTechDemo instance = null;
|
||||
|
||||
private ServerGuiService swingGuiService = null;
|
||||
static private VascTechDemoStartup instance = null;
|
||||
|
||||
/**
|
||||
* Starts this VascTechDemo instance
|
||||
* @param args
|
||||
*/
|
||||
static public void main(String[] args) {
|
||||
instance = new VascTechDemo();
|
||||
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 deployDir = new File("deploy");
|
||||
File workDir = new File("workdir");
|
||||
File workDirTmp = new File("workdir/tmp");
|
||||
if (deployDir.exists()==false) {
|
||||
deployDir.mkdir();
|
||||
}
|
||||
//if (deployDir.exists()==false) {
|
||||
// deployDir.mkdir();
|
||||
//}
|
||||
if (workDir.exists()==false) {
|
||||
workDir.mkdir();
|
||||
}
|
||||
|
|
@ -98,14 +96,14 @@ public class VascTechDemo {
|
|||
if (isMavenRun()==false) {
|
||||
throw new RuntimeException("Can't start without conf dir.");
|
||||
}
|
||||
FileUtils.copyDirectory(new File("../vasc-demo-tech-build/src/main/directory/"), new File("."));
|
||||
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;
|
||||
|
|
@ -131,10 +129,10 @@ public class VascTechDemo {
|
|||
|
||||
// Logback offical init method.
|
||||
//LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
//StatusPrinter.print(lc);
|
||||
//StatusPrinter.print(lc);
|
||||
|
||||
// Create an JUL logger for our application.
|
||||
logger = Logger.getLogger(VascTechDemo.class.getName());
|
||||
logger = Logger.getLogger(VascTechDemoStartup.class.getName());
|
||||
logger.info("Logging is ready for application log;");
|
||||
}
|
||||
|
||||
|
|
@ -146,53 +144,53 @@ public class VascTechDemo {
|
|||
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();
|
||||
tomcatService = new TomcatService();
|
||||
serverConfigService = new ServerConfigService();
|
||||
vascControllerService = new VascControllerService();
|
||||
vascDeployService = new VascDeployService();
|
||||
vascDeployService.setDeployDir(new File("deploy"));
|
||||
swingGuiService = new SwingGuiService();
|
||||
long stopTime = System.currentTimeMillis();
|
||||
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_GUI)) {
|
||||
swingGuiService.start();
|
||||
}
|
||||
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.START_EDITOR)) {
|
||||
vascControllerService.startEditor();
|
||||
}
|
||||
vascDeployService.start();
|
||||
tomcatService.deploy(serverConfigService.getServerConfigValue(ServerConfigKey.DEPLOY_PATH));
|
||||
if (serverConfigService.isServerConfigValueTrue(ServerConfigKey.DEPLOY_DEBUG)) {
|
||||
tomcatService.deployDebug();
|
||||
}
|
||||
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) {
|
||||
|
|
@ -203,7 +201,6 @@ public class VascTechDemo {
|
|||
public void run() {
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
vascDeployService.stop();
|
||||
vascControllerService.stop();
|
||||
serverConfigService.stop();
|
||||
tomcatService.stop();
|
||||
|
|
@ -222,7 +219,7 @@ public class VascTechDemo {
|
|||
t.start();
|
||||
}
|
||||
|
||||
static public VascTechDemo getInstance() {
|
||||
static public VascTechDemoStartup getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
@ -234,15 +231,11 @@ public class VascTechDemo {
|
|||
return vascControllerService;
|
||||
}
|
||||
|
||||
public VascDeployService getVascDeployService() {
|
||||
return vascDeployService;
|
||||
}
|
||||
|
||||
public TomcatService getTomcatService() {
|
||||
return tomcatService;
|
||||
}
|
||||
|
||||
public SwingGuiService getSwingGuiService() {
|
||||
public ServerGuiService getSwingGuiService() {
|
||||
return swingGuiService;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service;
|
||||
package net.forwardfire.vasc.demo.server.core.service;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
|
@ -100,13 +100,14 @@ public class DatabaseService {
|
|||
}
|
||||
rs.close();
|
||||
|
||||
String allSql = readResourceAsString("net/forwardfire/vasc/demo/tech/core/service/resources/init-db.sql");
|
||||
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);
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service;
|
||||
package net.forwardfire.vasc.demo.server.core.service;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* ServerConfigService reads demo server config parameters from jndi.
|
||||
|
|
@ -46,7 +46,7 @@ public class ServerConfigService {
|
|||
|
||||
private Object readConfigKey(ServerConfigKey key) {
|
||||
try {
|
||||
Context context = VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext();
|
||||
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);
|
||||
|
|
@ -20,16 +20,10 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service;
|
||||
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.JApplication;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.JMainPanel;
|
||||
package net.forwardfire.vasc.demo.server.core.service;
|
||||
|
||||
import net.forwardfire.vasc.demo.server.ui.ServerGuiApplication;
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
/**
|
||||
* SwingGuiService Shows the demo swing gui and vasc swing frontend.
|
||||
|
|
@ -37,22 +31,17 @@ import org.jdesktop.application.SingleFrameApplication;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class SwingGuiService {
|
||||
|
||||
public class ServerGuiService {
|
||||
|
||||
public void start() {
|
||||
Application.launch(JApplication.class, new String[] {});
|
||||
Application.launch(ServerGuiApplication.class, new String[] {});
|
||||
}
|
||||
|
||||
public void startDone() {
|
||||
ServerGuiApplication instance = ServerGuiApplication.getInstance();
|
||||
instance.startupDone();
|
||||
}
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
// move
|
||||
public JTabbedPane getTabPane() {
|
||||
SingleFrameApplication a = (SingleFrameApplication)JApplication.getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
JMainPanel mainPanel = (JMainPanel)mainView.getComponent();
|
||||
return mainPanel.getTabPane();
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
|
||||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -123,4 +123,18 @@ public class AuthSessionTimeoutValve extends ValveBase {
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service;
|
||||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
|
@ -35,31 +35,43 @@ 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;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
|
||||
/**
|
||||
* VascDeployService parses "deploy/*.xml" automaticly for hotdeployments.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 10, 2012
|
||||
*/
|
||||
public class VascDeployService {
|
||||
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 VascDeployService() {
|
||||
logger = Logger.getLogger(VascDeployService.class.getName());
|
||||
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.");
|
||||
}
|
||||
|
|
@ -122,22 +134,31 @@ public class VascDeployService {
|
|||
}
|
||||
fileCheckSums.put(file, md5File);
|
||||
deployed++;
|
||||
VascTechDemo.getInstance().getVascControllerService().openFile(file);
|
||||
parseVascFile(file);
|
||||
}
|
||||
if (deployed > 0) {
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("Done deploying total files read: "+deployed+" in "+(stopTime-startTime)+" ms.");
|
||||
/*
|
||||
try {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
InitialContext context = new InitialContext();
|
||||
JdniTreePrinter jndi = new JdniTreePrinter();
|
||||
jndi.printJNDITree(context, "java:", buf);
|
||||
logger.info("JDNI Tree:\n"+buf.toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,16 +169,15 @@ public class VascDeployService {
|
|||
Thread.sleep(2000); // let gui+tomcat start
|
||||
logger.info("AutoDeployManager started");
|
||||
|
||||
Server server = VascTechDemo.getInstance().getTomcatService().getServer();
|
||||
//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();
|
||||
}
|
||||
|
||||
ContextBindings.bindThread(bindName,token);
|
||||
} catch (NamingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
while(run) {
|
||||
try {
|
||||
|
|
@ -220,4 +240,32 @@ public class VascDeployService {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
|
||||
package net.forwardfire.vasc.demo.server.tomcat;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.Principal;
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui;
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,25 +20,14 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui;
|
||||
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.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
|
|
@ -53,15 +42,11 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
|||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.VascControllerService.VascServiceListener;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
import net.forwardfire.vasc.demo.server.core.service.VascControllerService;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
|
|
@ -69,7 +54,7 @@ import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JMainPanel extends JPanel implements VascServiceListener {
|
||||
public class JStatusPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
private VascControllerService vascManager = null;
|
||||
|
|
@ -78,14 +63,11 @@ public class JMainPanel extends JPanel implements VascServiceListener {
|
|||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
|
||||
|
||||
public JMainPanel() {
|
||||
this.vascManager=VascTechDemo.getInstance().getVascControllerService();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
|
||||
vascManager.addVascServiceListener(this);
|
||||
public JStatusPanel() {
|
||||
this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
|
|
@ -284,91 +266,15 @@ public class JMainPanel extends JPanel implements VascServiceListener {
|
|||
root.add(entries);
|
||||
|
||||
SwingUtilities.updateComponentTreeUI(vascTree);
|
||||
|
||||
|
||||
// todo move
|
||||
Map<String,String> keys = new HashMap<String,String>(300);
|
||||
VascBundleCheckEntryKeys checker = new VascBundleCheckEntryKeys(ResourceBundle.getBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"));
|
||||
for (String veId:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("data");
|
||||
|
||||
if (dataDir.exists()==false) {
|
||||
dataDir.mkdirs();
|
||||
}
|
||||
File resourceFile = new File("data/vasc-bundle.properties");
|
||||
if (resourceFile.exists()) {
|
||||
readPropertiesFile(p,resourceFile);
|
||||
}
|
||||
for (String key:keys.keySet()) {
|
||||
if (key==null) {
|
||||
continue;
|
||||
}
|
||||
if (keys.get(key)==null) {
|
||||
continue;
|
||||
}
|
||||
p.put(key, keys.get(key));
|
||||
}
|
||||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
ResourceBundle.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
protected void writePropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
writePropertiesStream(p,new FileOutputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void readPropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
readPropertiesStream(p,new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void writePropertiesStream(Properties p,OutputStream out) {
|
||||
try {
|
||||
p.store(out, "Saved by vasc auto i18n.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void readPropertiesStream(Properties p,InputStream in) {
|
||||
try {
|
||||
p.load(in);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void changeEvent() {
|
||||
rebuildTree();
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui;
|
||||
package net.forwardfire.vasc.demo.server.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
|
@ -40,7 +40,7 @@ import javax.swing.JPanel;
|
|||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||
|
||||
/**
|
||||
* JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code.
|
||||
|
|
@ -95,8 +95,8 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
|
|||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(file.getName());
|
||||
schema.autoCreateEntries(VascTechDemo.getInstance().getVascControllerService().getVascController());
|
||||
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
|
@ -41,8 +41,8 @@ import javax.swing.SpringLayout;
|
|||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.SpringLayoutGrid;
|
||||
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.
|
||||
|
|
@ -118,8 +118,8 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
|
|||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(dbName);
|
||||
schema.autoCreateEntries(VascTechDemo.getInstance().getVascControllerService().getVascController());
|
||||
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui.actions;
|
||||
package net.forwardfire.vasc.demo.server.ui.actions;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
|
@ -40,8 +40,8 @@ import javax.swing.SpringLayout;
|
|||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.SpringLayoutGrid;
|
||||
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.
|
||||
|
|
@ -108,8 +108,8 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
|
|||
MetaModelSchemaAutoEntry schema = new MetaModelSchemaAutoEntry();
|
||||
schema.setDataContextProvider(ds);
|
||||
schema.setEntryPrefix(ds.getDatabase());
|
||||
schema.autoCreateEntries(VascTechDemo.getInstance().getVascControllerService().getVascController());
|
||||
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
|
||||
schema.autoCreateEntries(VascTechDemoStartup.getInstance().getVascControllerService().getVascController());
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
result.add(fileButton);
|
||||
|
|
@ -20,13 +20,13 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.x4o.vasc;
|
||||
package net.forwardfire.vasc.demo.server.x4o;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.tech.core.service.tomcat.TomcatService;
|
||||
import 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;
|
||||
|
|
@ -94,7 +94,7 @@ public class TomcatResourceElement extends AbstractElement {
|
|||
}
|
||||
|
||||
// add to tomcat
|
||||
TomcatService tm = VascTechDemo.getInstance().getTomcatService();
|
||||
TomcatService tm = VascTechDemoStartup.getInstance().getTomcatService();
|
||||
Server server = tm.getServer();
|
||||
NamingResources jndiContext = server.getGlobalNamingResources();
|
||||
jndiContext.addResource(resource);
|
||||
|
|
@ -3,7 +3,7 @@ config.charset=UTF-8
|
|||
config.bundles=bundle1,bundle2
|
||||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.tech.core.ui.resources.JApplication
|
||||
bundle1.uri=net.forwardfire.vasc.demo.server.ui.resources.ServerGuiApplication
|
||||
|
||||
bundle2.uri=data/vasc-bundle.properties
|
||||
bundle2.type=FILE
|
||||
|
|
@ -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>
|
||||
|
|
@ -63,7 +63,28 @@ 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,
|
||||
|
|
@ -73,8 +94,8 @@ CREATE TABLE vasc_menu (
|
|||
menu_order integer not null,
|
||||
menu_type varchar not null
|
||||
);
|
||||
CREATE INDEX vasc_menu_active_idx ON vasc_menu(active);
|
||||
CREATE INDEX vasc_menu_type_idx ON vasc_menu(menu_type);
|
||||
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.
|
||||
|
|
@ -93,44 +114,60 @@ 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 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(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(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_part VALUES(8, 6, 'server', '', TRUE,TRUE,TRUE,1,'WIKI', '');
|
||||
INSERT INTO vasc_page_part VALUES(9, 6, 'vasc', '', TRUE,TRUE,TRUE,2,'WIKI', '');
|
||||
INSERT INTO vasc_page_part VALUES(10,6, 'metamodel','', TRUE,TRUE,TRUE,3,'WIKI', '');
|
||||
|
||||
|
||||
|
||||
-- INSERT INTO vasc_page VALUES(1, 'home','home','Welcome to the vasc demo, please login as admin to view all stuff.');
|
||||
|
||||
INSERT INTO vasc_menu VALUES(1, '/html/index.jsf','Home','',true,'',1,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
|
||||
INSERT INTO vasc_menu_group VALUES('demo', 'Demo',true,'',1);
|
||||
INSERT INTO vasc_menu_group VALUES('meta', 'Meta',true,'',2);
|
||||
|
||||
INSERT INTO vasc_menu VALUES(4, '/html/index.jsf','Home', '',true,'',1,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu VALUES(5, '/html/index.jsf','Contact', '',true,'',2,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu VALUES(6, '/html/index.jsf','Help', '',true,'',3,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu VALUES(7, '/html/index.jsf','Techno', '',true,'',3,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu VALUES(8, '/html/index.jsf','Licences', '',true,'',3,'BAR_BOTTOM');
|
||||
INSERT INTO vasc_menu VALUES(1,'metaPeople', 'People', true,'',1,'meta');
|
||||
INSERT INTO vasc_menu VALUES(2,'metaProjects', 'Projects',true,'',2,'meta');
|
||||
|
||||
INSERT INTO vasc_menu VALUES(10, '/vasc/AdminVascUser/list.jsf', 'Users', '',true,'admin',4,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(11, '/vasc/AdminVascUserRole/list.jsf', 'UserRoles', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(12, '/vasc/AdminVascUserChangeField/list.jsf', 'ChangeField', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(13, '/vasc/AdminVascUserChangeLog/list.jsf', 'ChangeFieldLog', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(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 VALUES(14, '/vasc/AdminVascPage/list.jsf', 'Pages', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(15, '/vasc/AdminVascPagePart/list.jsf', 'PageParts', '',true,'admin',5,'PAGE_ADMIN');
|
||||
INSERT INTO vasc_menu VALUES(16, '/vasc/AdminVascMenu/list.jsf', 'Menu', '',true,'admin',4,'PAGE_ADMIN');
|
||||
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');
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 644 B |
|
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<artifactId>vasc-demo</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
|
|
@ -11,9 +11,8 @@
|
|||
<name>vasc-demo-tech</name>
|
||||
<description>vasc-demo-tech</description>
|
||||
<modules>
|
||||
<module>vasc-demo-tech-build</module>
|
||||
<module>vasc-demo-tech-editor</module>
|
||||
<module>vasc-demo-tech-web</module>
|
||||
<module>vasc-demo-tech-core</module>
|
||||
<module>vasc-demo-tech-client-swing</module>
|
||||
<module>vasc-demo-tech-ejb3</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech-build</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-demo-tech-build</name>
|
||||
<description>vasc-demo-tech-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>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
|
||||
|
||||
dn: cn=Mirjan Broek,os=Amsterdam,ou=user,o=forwardfire,c=net
|
||||
objectClass: inetOrgPerson
|
||||
cn: Mirjan Broek
|
||||
description: Prime Contractors
|
||||
mail: mirjan.broek@demo.vasc.forwardfire.net
|
||||
postalAddress: 233 Mobbs Circuit$Vermont VIC
|
||||
postalCode: 3133
|
||||
sn: Broek
|
||||
telephoneNumber: 622 7619
|
||||
title: Secretary
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:l="http://vasc.forwardfire.net/eld/vasc-backend-ldap.eld"
|
||||
>
|
||||
|
||||
<l:ldapConnectionProvider
|
||||
el.id="ldapSudoers"
|
||||
ldapHost="localhost"
|
||||
bindUser="uid=admin-sudo,ou=services,dc=example,dc=nl"
|
||||
bindPass="test"
|
||||
/>
|
||||
<l:ldapBackend
|
||||
id="ldapBackendSudoers"
|
||||
ldapConnectionProvider="${ldapSudoers}"
|
||||
baseDN="ou=sudoers,dc=example,dc=nl"
|
||||
keyAttribute="cn"
|
||||
ldapFilter="(&(objectClass=sudoRole))"
|
||||
/>
|
||||
<v:entry id="sudoers" backendId="ldapBackendSudoers">
|
||||
<v:field id="user" backendName="cn" readOnly="true"/>
|
||||
<v:field id="description" rolesEdit="admin" rolesList="all"/>
|
||||
<v:field id="sudoCommand" vascEntryFieldType="MultiTextField"/>
|
||||
<v:field id="sudoHost" vascEntryFieldType="MultiTextField"/>
|
||||
<v:field id="sudoUser" vascEntryFieldType="MultiTextField"/>
|
||||
<!--
|
||||
<v:ldapNextIdFunction name="nextUidNumber" ldapFilter="(&(objectClass=posixGroup))" ldapAttribute="gidnumber"/>
|
||||
|
||||
<v:listeners hook="post_create">
|
||||
<etc:loginToFtpServer/>
|
||||
</v:listeners>
|
||||
|
||||
<v:link fieldName="user" viewController="ldapUsers" parameterName="user_cn"/>
|
||||
<v:link fieldName="gidNumber" viewController="ldapGroups" parameterName="group_key,${baseDn}"/>
|
||||
|
||||
<v:detail fieldName="gidNumber" detailController="${ldapGroups}"/>
|
||||
-->
|
||||
</v:entry>
|
||||
|
||||
<l:ldapConnectionProvider
|
||||
el.id="ldapUsers"
|
||||
ldapHost="10.11.12.96"
|
||||
bindUser="uid=libnss,ou=services,dc=example,dc=nl"
|
||||
bindPass="test"
|
||||
/>
|
||||
<l:ldapBackend
|
||||
id="ldapBackendUsers"
|
||||
ldapConnectionProvider="${ldapUsers}"
|
||||
baseDN="ou=users,dc=example,dc=nl"
|
||||
keyAttribute="uid"
|
||||
ldapFilter="(&(objectClass=posixAccount))"
|
||||
/>
|
||||
<v:entry id="users" backendId="ldapBackendUsers">
|
||||
<v:field id="uid" />
|
||||
<v:field id="uidNumber" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="gidNumber" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="loginShell" list="false"/>
|
||||
<v:field id="homeDirectory" list="false"/>
|
||||
<v:field id="cn" list="false"/>
|
||||
<v:field id="givenName" />
|
||||
<v:field id="sn" />
|
||||
<v:field id="mailbox" list="false"/>
|
||||
<v:field id="mail" vascEntryFieldType="EmailField"/>
|
||||
<v:field id="mailActive" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="alias" vascEntryFieldType="MultiTextField" list="false"/>
|
||||
|
||||
<v:field id="autoResponseActive" vascEntryFieldType="BooleanField" />
|
||||
<v:field id="autoresponseMessage" vascEntryFieldType="TextAreaField" list="false"/>
|
||||
<v:field id="sambaAcctFlags" list="false"/>
|
||||
<v:field id="sambaPrimaryGroupSID" list="false"/>
|
||||
<v:field id="sambaSID" list="false"/>
|
||||
|
||||
</v:entry>
|
||||
|
||||
|
||||
<l:ldapConnectionProvider
|
||||
el.id="ldapMachines"
|
||||
ldapHost="localhost"
|
||||
bindUser="uid=samba,ou=services,dc=example,dc=nl"
|
||||
bindPass="test"
|
||||
/>
|
||||
<l:ldapBackend
|
||||
id="ldapBackendMachines"
|
||||
ldapConnectionProvider="${ldapMachines}"
|
||||
baseDN="ou=machines,dc=example,dc=nl"
|
||||
keyAttribute="uid"
|
||||
ldapFilter="(&(objectClass=sambaSamAccount))"
|
||||
/>
|
||||
<v:entry id="machines" backendId="ldapBackendMachines">
|
||||
<v:field id="uid" />
|
||||
<v:field id="sambaAcctFlags"/>
|
||||
<v:field id="sambaSID" />
|
||||
<v:field id="uidNumber" />
|
||||
</v:entry>
|
||||
|
||||
</v:root>
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<v:root xmlns:v="http://vasc.forwardfire.net/eld/vasc-lang.eld"
|
||||
xmlns:mm="http://vasc.forwardfire.net/eld/vasc-backend-metamodel.eld"
|
||||
xmlns:j="http://vasc.forwardfire.net/eld/vasc-backend-jdbc.eld"
|
||||
>
|
||||
|
||||
|
||||
<j:jdbcConnectionProvider
|
||||
el.id="dbRssFeeds"
|
||||
driverClassName="org.postgresql.Driver"
|
||||
dbUrl="jdbc:postgresql://localhost/vasc_testpg"
|
||||
dbUser="test"
|
||||
dbPassword="test"
|
||||
/>
|
||||
<j:jdbcBackend
|
||||
id="rssChannelDB"
|
||||
jdbcConnectionProvider="${dbRssFeeds}"
|
||||
idColumnName="id"
|
||||
sqlList="SELECT * FROM channel LIMIT 100"
|
||||
sqlDelete="DELETE FROM channel WHERE id = ?0"
|
||||
sqlPersist="INSERT INTO channel (name,url,importing,etc) VALUES (?0,?1,?2,?3,?4)"
|
||||
sqlMerge="UPDATE channel (name,url) VALUE (?0,?1)"
|
||||
/>
|
||||
|
||||
<v:entry id="rssChannel" backendId="rssChannelDB">
|
||||
<v:field id="id" readOnly="true"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="url"/>
|
||||
<v:field id="importing" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="last_parsed" vascEntryFieldType="DateField" />
|
||||
<v:field id="last_checked" vascEntryFieldType="DateField"/>
|
||||
|
||||
<v:field id="parser_locale" list="false"/>
|
||||
<v:field id="column_mapping" list="false"/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
|
||||
</v:root>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-tech-client-swing</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>
|
||||
58
vasc-demo/vasc-demo-tech/vasc-demo-tech-client-swing/pom.xml
Normal file
58
vasc-demo/vasc-demo-tech/vasc-demo-tech-client-swing/pom.xml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech-client-swing</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</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-frontend-swing</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</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.apache.openejb</groupId>
|
||||
<artifactId>openejb-client</artifactId>
|
||||
<version>4.5.1-SNAPSHOT</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>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,556 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
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.annotations.VascModelReference;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendController;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascController;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.SetParameterBackendListener;
|
||||
|
||||
/**
|
||||
* JMainPanel is the main panel/window of this demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JMainPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 5834715323973411147L;
|
||||
//private VascControllerService vascManager = null;
|
||||
private VascController vc = null;
|
||||
private VascMenuController vmc = null;
|
||||
private VascServiceManager vsm = null;
|
||||
private SwingPanelIntegration spi = null;
|
||||
private JTabbedPane tabPane = null;
|
||||
private JTree vascTree = null;
|
||||
private JSplitPane bottomSplitPane = null;
|
||||
private JSplitPane treeSplitPane = null;
|
||||
|
||||
|
||||
public JMainPanel(VascServiceManager vsm,VascMenuController vmc) {
|
||||
//this.vascManager=VascTechDemoStartup.getInstance().getVascControllerService();
|
||||
this.vsm = vsm;
|
||||
this.vmc = vmc;
|
||||
setLayout(new BorderLayout());
|
||||
add(createBottomSplit(), BorderLayout.CENTER);
|
||||
|
||||
vc = createVascController(vsm);
|
||||
|
||||
//vascManager.addVascServiceListener(this);
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
|
||||
public RemoteVascBackend(String backendId,VascServiceManager vascManager) {
|
||||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
|
||||
|
||||
|
||||
try {
|
||||
field = ((VascEntryFieldLocal)field).clone(); // RM...
|
||||
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController createVascController(VascServiceManager vsm) {
|
||||
try {
|
||||
// VascUserInfo vui = getVascUserInfo();
|
||||
|
||||
|
||||
// get local jvm plugging controller
|
||||
VascController c = DefaultVascFactory.getDefaultVascController();
|
||||
|
||||
/*
|
||||
DefaultVascEntryController con = new DefaultVascEntryController() {
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
VascEntry ve = super.getVascEntryById(id);
|
||||
// add global listener to make sure we have all LAZY properties of a bean before we goto edit mode.
|
||||
ve.addVascEntryEventListener(VascEventType.DATA_SELECT, new RefreshObjectForLazyPropertiesListener());
|
||||
return ve;
|
||||
}
|
||||
};
|
||||
((DefaultVascController)c).setVascEntryController(con);
|
||||
*/
|
||||
|
||||
|
||||
VascServiceManager vascManager = vsm;
|
||||
List<String> entryIds = vascManager.getVascEntryIds();
|
||||
|
||||
VascEntryControllerLocal localEntryController = (VascEntryControllerLocal)c.getVascEntryController();
|
||||
VascBackendControllerLocal localBackendController = (VascBackendControllerLocal)c.getVascBackendController();
|
||||
for (String id:entryIds) {
|
||||
VascEntryLocal ve = (VascEntryLocal)vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
|
||||
/*
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
Object value = ve.getEntryParameter(key);
|
||||
if (value instanceof String==false) {
|
||||
continue;
|
||||
}
|
||||
String paraValue = (String)value;
|
||||
if (paraValue.startsWith("userPara")==false) {
|
||||
continue;
|
||||
}
|
||||
String[] ps = paraValue.split(":");
|
||||
String type = ps[1];
|
||||
String paraTypeValue = ps[2];
|
||||
|
||||
SetParameterBackendListener listener = new SetParameterBackendListener(vui.userId,vui.username);
|
||||
listener.setName(key);
|
||||
listener.setType(type);
|
||||
listener.setValue(paraTypeValue);
|
||||
|
||||
VascBackendProxyEventExecutor localUserProxy = new VascBackendProxyEventExecutor();
|
||||
localUserProxy.addVascEntryBackendEventListener(listener);
|
||||
vb = localUserProxy;
|
||||
}
|
||||
*/
|
||||
localBackendController.addVascBackend(vb);
|
||||
localEntryController.addVascEntry(ve);
|
||||
|
||||
c.getVascEntryConfigController().configVascEntry(c, ve);
|
||||
}
|
||||
return c;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not create remote based vasc controller; "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
private JSplitPane createBottomSplit() {
|
||||
JSplitPane sp0 = createTreeSplit();
|
||||
JPanel sp1 = new JPanel();//JConsolePanel();
|
||||
bottomSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sp0,sp1);
|
||||
bottomSplitPane.setOneTouchExpandable(true);
|
||||
bottomSplitPane.setResizeWeight(0.2);
|
||||
bottomSplitPane.setDividerLocation(700);
|
||||
sp0.setMinimumSize(new Dimension(400, 400));
|
||||
sp1.setMinimumSize(new Dimension(400, 150));
|
||||
return bottomSplitPane;
|
||||
}
|
||||
|
||||
private JSplitPane createTreeSplit() {
|
||||
JScrollPane sp0 = createTreePane();
|
||||
JScrollPane sp1 = createContentPane();
|
||||
treeSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sp0,sp1);
|
||||
treeSplitPane.setOneTouchExpandable(true);
|
||||
treeSplitPane.setResizeWeight(0.7);
|
||||
treeSplitPane.setDividerLocation(200);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void openVascEntry(String vascId) throws VascException {
|
||||
VascEntryLocal ee = (VascEntryLocal)vsm.getVascEntry(vascId);
|
||||
vc.getVascEntryConfigController().configVascFrontendController(vc, ee);
|
||||
spi.createNewVascView(ee);
|
||||
}
|
||||
|
||||
private JScrollPane createTreePane() {
|
||||
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ROOT,"Menu"));
|
||||
|
||||
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 && vsm!=null) {
|
||||
if (vascNode.type == VascTreeNodeType.ENTRY) {
|
||||
openVascEntry(vascNode.id);
|
||||
}
|
||||
}
|
||||
} 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 {
|
||||
ROOT,
|
||||
GROUP,
|
||||
ENTRY
|
||||
}
|
||||
|
||||
public void rebuildTree() {
|
||||
|
||||
|
||||
if (vsm==null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode root = (DefaultMutableTreeNode)vascTree.getModel().getRoot();
|
||||
root.removeAllChildren();
|
||||
|
||||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
|
||||
DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.GROUP,group.getTitle()));
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(new VascTreeNode(VascTreeNodeType.ENTRY,vm.getVascEntryId()));
|
||||
groupNode.add(entryNode);
|
||||
}
|
||||
root.add(groupNode);
|
||||
}
|
||||
|
||||
SwingUtilities.updateComponentTreeUI(vascTree);
|
||||
|
||||
/*
|
||||
// todo move
|
||||
Map<String,String> keys = new HashMap<String,String>(300);
|
||||
VascBundleCheckEntryKeys checker = new VascBundleCheckEntryKeys(ResourceBundle.getBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"));
|
||||
for (String veId:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("data");
|
||||
|
||||
if (dataDir.exists()==false) {
|
||||
dataDir.mkdirs();
|
||||
}
|
||||
File resourceFile = new File("data/vasc-bundle.properties");
|
||||
if (resourceFile.exists()) {
|
||||
readPropertiesFile(p,resourceFile);
|
||||
}
|
||||
for (String key:keys.keySet()) {
|
||||
if (key==null) {
|
||||
continue;
|
||||
}
|
||||
if (keys.get(key)==null) {
|
||||
continue;
|
||||
}
|
||||
p.put(key, keys.get(key));
|
||||
}
|
||||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
ResourceBundle.clearCache();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
public void changeEvent() {
|
||||
rebuildTree();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,11 +20,12 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.ui;
|
||||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JMenu;
|
||||
|
|
@ -34,10 +35,11 @@ import javax.swing.JTabbedPane;
|
|||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaCsv;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaJdbc;
|
||||
import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaMongodb;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
|
||||
|
||||
/**
|
||||
* JMainPanelMenuBar Adds all menu bar items.
|
||||
|
|
@ -45,21 +47,109 @@ import net.forwardfire.vasc.demo.tech.core.ui.actions.JDialogMetaMongodb;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class JMainPanelMenuBar extends JMenuBar {
|
||||
public class JMainPanelMenuBar extends JMenuBar implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -2828428804621352725L;
|
||||
JMenu fileMenu = new JMenu("File");
|
||||
JMenu vascMenu = new JMenu("Vasc");
|
||||
JMenu tabMenu = new JMenu("Tabs");
|
||||
private VascMenuController vmc = null;
|
||||
private JMainPanel mainPanel = null;
|
||||
private List<JMenu> vascMenus = null;
|
||||
private JMenu clientFileMenu = null;
|
||||
private JMenu clientTabMenu = null;
|
||||
|
||||
public JMainPanelMenuBar() {
|
||||
createMenuItems();
|
||||
add(fileMenu);
|
||||
add(vascMenu);
|
||||
add(tabMenu);
|
||||
public JMainPanelMenuBar(VascMenuController vmc,JMainPanel mainPanel) {
|
||||
this.vmc=vmc;
|
||||
this.mainPanel=mainPanel;
|
||||
|
||||
clientFileMenu = new JMenu("File");
|
||||
add(clientFileMenu);
|
||||
|
||||
JMenuItem logoutItem = new JMenuItem("Logout");
|
||||
logoutItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
/*
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
//fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
*/
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientFileMenu.add(logoutItem);
|
||||
clientFileMenu.addSeparator();
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascDemoSwingClient.getInstance().exit();
|
||||
}
|
||||
});
|
||||
clientFileMenu.add(exitItem);
|
||||
|
||||
|
||||
List<VascMenuGroup> groups = vmc.getFilteredMenuGroup();
|
||||
for (VascMenuGroup group:groups) {
|
||||
JMenu menu = new JMenu(group.getTitle());
|
||||
for (VascMenu vm:group.getMenus()) {
|
||||
JMenuItem item = new JMenuItem(vm.getTitle());
|
||||
item.putClientProperty("vascEntryId", vm.getVascEntryId());
|
||||
item.addActionListener(this);
|
||||
menu.add(item);
|
||||
}
|
||||
add(menu);
|
||||
}
|
||||
|
||||
clientTabMenu = new JMenu("Tabs");
|
||||
add(clientTabMenu);
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
if (tabPane.getSelectedIndex()>=0) {
|
||||
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
clientTabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JTabbedPane tabPane = getTabPane();
|
||||
for (int i=tabPane.getTabCount();i>0;i--) {
|
||||
tabPane.removeTabAt(i-1); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
});
|
||||
clientTabMenu.add(itemAll);
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return mainPanel.getTabPane();
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() instanceof JMenuItem) {
|
||||
JMenuItem item = (JMenuItem)e.getSource();
|
||||
String vascId = (String)item.getClientProperty("vascEntryId");
|
||||
try {
|
||||
mainPanel.openVascEntry(vascId);
|
||||
} catch (VascException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private void createMenuItems() {
|
||||
JMenuItem openXmlItem = new JMenuItem("Import Xml");
|
||||
openXmlItem.addActionListener(new ActionListener() {
|
||||
|
|
@ -70,7 +160,7 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
int returnVal = fc.showOpenDialog((JMenuItem)e.getSource());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
VascTechDemo.getInstance().getVascControllerService().openFile(file);
|
||||
//VascTechDemoStartup.getInstance().getVascControllerService().openFile(file);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
|
|
@ -85,7 +175,7 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JApplication.getInstance().exit();
|
||||
//JApplication.getInstance().exit();
|
||||
}
|
||||
});
|
||||
fileMenu.add(exitItem);
|
||||
|
|
@ -103,33 +193,7 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
connectLdapItem.setEnabled(false);
|
||||
vascMenu.add(connectLdapItem);
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem connectMetaCsvItem = new JMenuItem("Add meta csv");
|
||||
connectMetaCsvItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaCsv d = new JDialogMetaCsv(JApplication.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaCsvItem);
|
||||
JMenuItem connectMetaXmlItem = new JMenuItem("Add meta xml");
|
||||
connectMetaXmlItem.setEnabled(false);
|
||||
vascMenu.add(connectMetaXmlItem);
|
||||
JMenuItem connectMetaMongoItem = new JMenuItem("Add meta mongo");
|
||||
connectMetaMongoItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaMongodb d = new JDialogMetaMongodb(JApplication.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaMongoItem);
|
||||
JMenuItem connectMetaJdbcItem = new JMenuItem("Add meta jdbc");
|
||||
connectMetaJdbcItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialogMetaJdbc d = new JDialogMetaJdbc(JApplication.getInstance().getMainFrame());
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
vascMenu.add(connectMetaJdbcItem);
|
||||
|
||||
|
||||
vascMenu.addSeparator();
|
||||
JMenuItem removeEntryItem = new JMenuItem("Remove entry");
|
||||
|
|
@ -140,49 +204,10 @@ public class JMainPanelMenuBar extends JMenuBar {
|
|||
});
|
||||
vascMenu.add(removeEntryItem);
|
||||
|
||||
JMenuItem removeAllItem = new JMenuItem("Remove all");
|
||||
removeAllItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)VascTechDemo.getInstance().getVascControllerService().getVascController().getVascBackendController();
|
||||
VascEntryControllerLocal entries = (VascEntryControllerLocal)VascTechDemo.getInstance().getVascControllerService().getVascController().getVascEntryController();
|
||||
for (String entryId:entries.getVascEntryIds()) {
|
||||
if (entryId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
entries.removeVascEntry(entryId);
|
||||
}
|
||||
for (String backendId:backends.getVascBackendIds()) {
|
||||
if (backendId.startsWith("Vasc")) {
|
||||
continue;
|
||||
}
|
||||
backends.removeVascBackendById(backendId);
|
||||
}
|
||||
VascTechDemo.getInstance().getVascControllerService().fireChangeEvent();
|
||||
}
|
||||
});
|
||||
vascMenu.add(removeAllItem);
|
||||
|
||||
|
||||
JMenuItem item = new JMenuItem("Close tab");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = VascTechDemo.getInstance().getSwingGuiService().getTabPane();
|
||||
if (tabPane.getSelectedIndex()>=0) {
|
||||
tabPane.removeTabAt(tabPane.getSelectedIndex()); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
tabMenu.add(item);
|
||||
JMenuItem itemAll = new JMenuItem("Close All tabs");
|
||||
itemAll.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JTabbedPane tabPane = VascTechDemo.getInstance().getSwingGuiService().getTabPane();
|
||||
for (int i=tabPane.getTabCount();i>0;i--) {
|
||||
tabPane.removeTabAt(i-1); // todo release vasc frontend
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tabMenu.add(itemAll);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,361 @@
|
|||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.naming.CommunicationException;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingException;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.login.LoginContext;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.user.LoginUserController;
|
||||
import net.forwardfire.vasc.ejb3.VascServiceManager;
|
||||
|
||||
import org.jdesktop.application.Application;
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
public class VascDemoSwingClient extends SingleFrameApplication {
|
||||
|
||||
private static VascDemoSwingClient instance = null;
|
||||
static protected Context context = null;
|
||||
static protected LoginContext loginContext = null;
|
||||
private Logger logger = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
/*
|
||||
instance = new VascDemoSwingClient();
|
||||
instance.initialize(args);
|
||||
instance.startup();
|
||||
*/
|
||||
Application.launch(VascDemoSwingClient.class, new String[] {});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startup() {
|
||||
|
||||
logger = Logger.getLogger(VascDemoSwingClient.class.getName());
|
||||
createContext();
|
||||
try {
|
||||
setJaasConfig();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
doLogin();
|
||||
|
||||
|
||||
JdniTreePrinter printer = new JdniTreePrinter(false);
|
||||
StringBuffer buf = new StringBuffer();
|
||||
printer.printJNDITree(context, "", buf);
|
||||
System.out.println(buf);
|
||||
|
||||
VascServiceManager vc = null;
|
||||
LoginUserController luc = null;
|
||||
VascMenuController vmc = null;
|
||||
try {
|
||||
vc = (VascServiceManager)context.lookup("vascServiceManagerRemote");
|
||||
System.out.println("ob: "+vc);
|
||||
|
||||
luc = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
System.out.println("fll: "+luc.doClientLogin());
|
||||
|
||||
vmc = (VascMenuController)context.lookup("vascMenuControllerRemote");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
JMainPanel mainPanel = new JMainPanel(vc,vmc);
|
||||
SingleFrameApplication a = (VascDemoSwingClient)getInstance(); // BIG NOTE because of 'launch' for auto conf swing.
|
||||
FrameView mainView = a.getMainView();
|
||||
|
||||
mainView.setComponent(mainPanel);
|
||||
mainView.setMenuBar(new JMainPanelMenuBar(vmc,mainPanel));
|
||||
mainView.getFrame().setSize(600, 800);
|
||||
mainView.getFrame().setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created an context to the showplanner server.
|
||||
*/
|
||||
private void createContext() {
|
||||
Properties props = new Properties();
|
||||
String connectUrl = "http://localhost:8899/demo/ejb"; //System.getProperty("javaws.connecturl");
|
||||
logger.info("Connecting to: "+connectUrl);
|
||||
props.put(Context.PROVIDER_URL, connectUrl );
|
||||
props.put("openejb.authentication.realmName", "vasc-auth-server");
|
||||
props.put(Context.SECURITY_PRINCIPAL,"admin");
|
||||
props.put(Context.SECURITY_CREDENTIALS,"admin123");
|
||||
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
|
||||
|
||||
try {
|
||||
context = new InitialContext(props);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//logger.log(Level.WARNING,e.getMessage(),e);
|
||||
//ExceptionDialog err = new ExceptionDialog(e,true);
|
||||
//err.showOpenDialog(null,i18n(VascDemoSwingClient.class,"dialogTitle"),i18n(VascDemoSwingClient.class,"dialogContext"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets our jaas config path
|
||||
*/
|
||||
private void setJaasConfig() throws IOException {
|
||||
|
||||
// tomee
|
||||
String path = System.getProperty("java.security.auth.login.config");
|
||||
if (path == null) {
|
||||
URL url = VascDemoSwingClient.class.getClassLoader().getResource("META-INF/client.login.conf");
|
||||
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
String urlString = "file:"+tempFile.getAbsolutePath();
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
logger.info("Setting jaas config property to url: "+urlString);
|
||||
/*
|
||||
if (resource != null) {
|
||||
path = URLDecoder.decode(resource.getFile());
|
||||
System.setProperty("java.security.auth.login.config", path);
|
||||
|
||||
} else {
|
||||
logger.warning("Could not find client.login.conf");
|
||||
}*/
|
||||
}
|
||||
|
||||
/* jboss
|
||||
URL url = Thread.currentThread().getContextClassLoader().getResource("META-INF/jaas.config");
|
||||
String urlString = url.toExternalForm();
|
||||
|
||||
// jdk1.6 update10 has different classloader, so just copy for the moment..... ..
|
||||
if (urlString.startsWith("jar:")) {
|
||||
File tempFile = File.createTempFile("cached-", ".jar");
|
||||
tempFile.deleteOnExit();
|
||||
copyFile(url.openConnection().getInputStream(),tempFile);
|
||||
urlString = "file:"+tempFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
//logger.info("Setting jaas config property to url: "+urlString);
|
||||
System.setProperty("java.security.auth.login.config", urlString);
|
||||
*/
|
||||
}
|
||||
|
||||
private void copyFile(InputStream in, File out) throws IOException {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(1024*4);
|
||||
byte[] bufferArray = buffer.array();
|
||||
FileChannel outputChannel = new FileOutputStream(out).getChannel();
|
||||
while (true) {
|
||||
buffer.clear();
|
||||
int lim = in.read(bufferArray);
|
||||
if (lim < 0) {
|
||||
break; // could not read anymore
|
||||
}
|
||||
buffer.flip();
|
||||
buffer.limit(lim);
|
||||
while (buffer.hasRemaining()) {
|
||||
outputChannel.write(buffer);
|
||||
}
|
||||
}
|
||||
outputChannel.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do an login on the server
|
||||
*/
|
||||
private void doLogin() {
|
||||
VascDemoUserLoginDialog loginHandler = new VascDemoUserLoginDialog();
|
||||
try {
|
||||
loginContext = new LoginContext("vasc-auth-client", loginHandler);
|
||||
loginContext.login();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, i18n(this,"dialogNoLoginContext"),i18n(this,"dialogTitle"), JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// Subject subject = loginContext.getSubject();
|
||||
|
||||
if(doLoginTest()) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
return;
|
||||
}
|
||||
loginContext.login();
|
||||
if(doLoginTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JOptionPane.showMessageDialog(null, i18n(this,"dialogUserLoginFailure"),i18n(this,"dialogTitle"), JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
} catch (CommunicationException e) {
|
||||
List<String> messages = new ArrayList<String>(3);
|
||||
messages.add("Could not connect to Vasc Tech Client Swing server, please try again.");
|
||||
messages.add("If the problem persists please contact your systems administrator.");
|
||||
String connectionError = "Could not obtain connection to any of these urls: ";
|
||||
Integer connectionErrorLen = connectionError.length();
|
||||
String emsg = e.getMessage();
|
||||
if (emsg!=null && emsg.startsWith(connectionError)) {
|
||||
Integer urlEndIdx = emsg.substring(connectionErrorLen).indexOf(':');
|
||||
if (urlEndIdx>=0) {
|
||||
messages.add("Server unreachable at: "+emsg.substring(connectionErrorLen, connectionErrorLen+urlEndIdx));
|
||||
}
|
||||
}
|
||||
JOptionPane.showMessageDialog(null, messages.toArray(), "Vasc Tech Client Swing", JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
} catch (Exception e) {
|
||||
//logger.log(Level.WARNING,e.getMessage(),e);
|
||||
JOptionPane.showMessageDialog(null, "Failure on login test.", "Vasc Tech Client Swing", JOptionPane.WARNING_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we have 'login' role on server.
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private boolean doLoginTest() throws Exception {
|
||||
try {
|
||||
LoginUserController loginManager = (LoginUserController)context.lookup("loginUserControllerRemote");
|
||||
loginManager.doClientLogin();
|
||||
return true;
|
||||
} catch (javax.naming.NameNotFoundException e) {
|
||||
JOptionPane.showMessageDialog(null, "Server is not deployed.\nPlease wait a couple of minuts and try again.");
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null, "Server error: "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some simple hardcoded i18n function here
|
||||
*
|
||||
* @param key
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
static protected String i18n(Object obj,String key,Object...params) {
|
||||
if(obj==null) { throw new NullPointerException("Can't get key of null obj"); }
|
||||
if (key==null) { throw new NullPointerException("key may not be null"); }
|
||||
if(obj instanceof Class) {
|
||||
key=((Class<?>)obj).getName()+"."+key;
|
||||
} else {
|
||||
key=obj.getClass().getName()+"."+key;
|
||||
}
|
||||
return key;
|
||||
/*
|
||||
try {
|
||||
String text = ResourceBundle.getBundle("resources.i18n.root").getString(key);
|
||||
if (params != null) {
|
||||
MessageFormat mf = new MessageFormat(text);
|
||||
text = mf.format(params, new StringBuffer(), null).toString();
|
||||
}
|
||||
return text;
|
||||
} catch(MissingResourceException e){
|
||||
return "MISSING: '"+key+"'";
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
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,408 @@
|
|||
/*
|
||||
* @(#)DialogCallbackHandler.java 1.9 03/12/19
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.client.swing;
|
||||
|
||||
import javax.security.auth.callback.Callback;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.callback.ConfirmationCallback;
|
||||
import javax.security.auth.callback.NameCallback;
|
||||
import javax.security.auth.callback.PasswordCallback;
|
||||
import javax.security.auth.callback.TextOutputCallback;
|
||||
import javax.security.auth.callback.UnsupportedCallbackException;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowFocusListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
* Zwaar gehacke jaas login dialog
|
||||
* added features:
|
||||
* - name remebering
|
||||
* - focus on name field
|
||||
* - alway on top
|
||||
* - logo stuff
|
||||
* - message field
|
||||
*
|
||||
* <p>
|
||||
* Uses a Swing dialog window to query the user for answers to authentication
|
||||
* questions. This can be used by a JAAS application to instantiate a
|
||||
* CallbackHandler
|
||||
*
|
||||
* @see javax.security.auth.callback
|
||||
*/
|
||||
public class VascDemoUserLoginDialog implements CallbackHandler {
|
||||
|
||||
/* The parent window, or null if using the default parent */
|
||||
private Component parentComponent;
|
||||
private static final int JPasswordFieldLen = 8;
|
||||
private int loginTry = 0;
|
||||
private String userName = null;
|
||||
|
||||
/**
|
||||
* Creates a callback dialog with the default parent window.
|
||||
*/
|
||||
public VascDemoUserLoginDialog() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a callback dialog and specify the parent window.
|
||||
*
|
||||
* @param parentComponent
|
||||
* the parent window -- specify <code>null</code> for the
|
||||
* default parent
|
||||
*/
|
||||
public VascDemoUserLoginDialog(Component parentComponent) {
|
||||
this.parentComponent = parentComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface for recording actions to carry out if the user clicks OK for
|
||||
* the dialog.
|
||||
*/
|
||||
private static interface Action {
|
||||
void perform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the specified set of callbacks.
|
||||
*
|
||||
* @param callbacks
|
||||
* the callbacks to handle
|
||||
* @throws UnsupportedCallbackException
|
||||
* if the callback is not an instance of NameCallback or
|
||||
* PasswordCallback
|
||||
*/
|
||||
public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
|
||||
this.loginTry++;
|
||||
/* Collect messages to display in the dialog */
|
||||
final JPanel loginDesign = new JPanel();
|
||||
loginDesign.setLayout(new BoxLayout(loginDesign, BoxLayout.PAGE_AXIS));
|
||||
//final Image logoImage = Toolkit.getDefaultToolkit().createImage(getClass().getResource("/resources/images/logos/logo.png"));
|
||||
final JPanel logoPanel = new JPanel() {
|
||||
private static final long serialVersionUID = 10l;
|
||||
protected void paintComponent(Graphics g) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
// for antialiasing geometric shapes
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
// for antialiasing text
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
// to go for quality over speed
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
|
||||
|
||||
// Paint the default look of the panel.
|
||||
super.paintComponent(g2d);
|
||||
|
||||
int offsetX = 0; // for windows systems
|
||||
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1;
|
||||
if (isWindows) {
|
||||
offsetX += 25;
|
||||
}
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.fillRect(0,0,getWidth(),getHeight());
|
||||
g2d.setColor(new Color(238,212,1));
|
||||
|
||||
//int w = (getWidth()/2)-(logoImage.getWidth(null)/2);
|
||||
//int h = (getHeight()/2)-(logoImage.getHeight(null)/2);
|
||||
//g2d.drawImage(logoImage, w, h, this);
|
||||
}
|
||||
};
|
||||
logoPanel.setPreferredSize(new Dimension(200, 170));
|
||||
logoPanel.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
||||
loginDesign.add(logoPanel);
|
||||
loginDesign.add(Box.createVerticalStrut(5));
|
||||
JPanel namePanel = new JPanel();
|
||||
JLabel nameLabel = new JLabel("Vasc Demo Client");
|
||||
nameLabel.setFont(new Font("Lucida Sans", Font.BOLD, 24));
|
||||
namePanel.add(nameLabel);
|
||||
loginDesign.add(namePanel);
|
||||
loginDesign.add(Box.createVerticalStrut(5));
|
||||
|
||||
final GridLayout messagesLayout = new GridLayout(2,2);
|
||||
final JPanel messages = new JPanel();
|
||||
messages.setLayout(messagesLayout);
|
||||
|
||||
/* Collection actions to perform if the user clicks OK */
|
||||
final List<Action> okActions = new ArrayList<Action>(2);
|
||||
ConfirmationInfo confirmation = new ConfirmationInfo();
|
||||
|
||||
// hackje for focus
|
||||
final JTextField name = new JTextField();
|
||||
confirmation.initialValue=name;
|
||||
|
||||
for (int i = 0; i < callbacks.length; i++) {
|
||||
if (callbacks[i] instanceof TextOutputCallback) {
|
||||
TextOutputCallback tc = (TextOutputCallback) callbacks[i];
|
||||
|
||||
switch (tc.getMessageType()) {
|
||||
case TextOutputCallback.INFORMATION:
|
||||
confirmation.messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.WARNING:
|
||||
confirmation.messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case TextOutputCallback.ERROR:
|
||||
confirmation.messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized message type");
|
||||
}
|
||||
messages.add(new JLabel(tc.getMessage()));
|
||||
|
||||
} else if (callbacks[i] instanceof NameCallback) {
|
||||
final NameCallback nc = (NameCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(nc.getPrompt());
|
||||
String defaultName = nc.getDefaultName();
|
||||
|
||||
// if (check some property)
|
||||
defaultName = "";
|
||||
if (defaultName != null) {
|
||||
name.setText(defaultName);
|
||||
}
|
||||
// default to last user name
|
||||
if (userName !=null ) {
|
||||
name.setText(userName);
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(name);
|
||||
|
||||
/* Store the name back into the callback if OK */
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
nc.setName(name.getText());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof PasswordCallback) {
|
||||
final PasswordCallback pc = (PasswordCallback) callbacks[i];
|
||||
|
||||
JLabel prompt = new JLabel(pc.getPrompt());
|
||||
|
||||
final JPasswordField password = new JPasswordField(JPasswordFieldLen);
|
||||
if (!pc.isEchoOn()) {
|
||||
password.setEchoChar('*');
|
||||
}
|
||||
messages.add(prompt);
|
||||
messages.add(password);
|
||||
|
||||
okActions.add(new Action() {
|
||||
public void perform() {
|
||||
pc.setPassword(password.getPassword());
|
||||
}
|
||||
});
|
||||
|
||||
} else if (callbacks[i] instanceof ConfirmationCallback) {
|
||||
ConfirmationCallback cc = (ConfirmationCallback) callbacks[i];
|
||||
|
||||
confirmation.setCallback(cc);
|
||||
if (cc.getPrompt() != null) {
|
||||
messages.add(new JLabel(cc.getPrompt()));
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loginTry>1) {
|
||||
JPanel messagesPanel = new JPanel();
|
||||
messagesPanel.setBorder(BorderFactory.createEtchedBorder());
|
||||
JLabel iup = new JLabel("Invalid Username and Password:");
|
||||
iup.setForeground(Color.RED);
|
||||
messagesPanel.add(iup);
|
||||
loginDesign.add(messagesPanel);
|
||||
loginDesign.add(Box.createVerticalStrut(5));
|
||||
}
|
||||
|
||||
JPanel messagesPanel = new JPanel();
|
||||
messagesPanel.setBorder(BorderFactory.createEtchedBorder());
|
||||
messagesPanel.add(messages);
|
||||
loginDesign.add(messagesPanel);
|
||||
/* Display the dialog */
|
||||
|
||||
/// JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
|
||||
JOptionPane jop = new JOptionPane(loginDesign, JOptionPane.PLAIN_MESSAGE,confirmation.optionType,null,
|
||||
confirmation.options,confirmation.initialValue);
|
||||
|
||||
JDialog dialog = jop.createDialog(parentComponent,"Vasc Demo Login");
|
||||
|
||||
// We alway request focus after the windows gets focus
|
||||
dialog.addWindowFocusListener(new WindowFocusListener() {
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowGainedFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowGainedFocus(WindowEvent arg0) {
|
||||
//System.out.println("request focus window focus");
|
||||
name.requestFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.awt.event.WindowFocusListener#windowLostFocus(java.awt.event.WindowEvent)
|
||||
*/
|
||||
public void windowLostFocus(WindowEvent arg0) {
|
||||
}
|
||||
});
|
||||
|
||||
// HACK, EVEN the listener above doesn't work 100% so just request focus request
|
||||
// until we have focus, then cancel task, see println output
|
||||
final Timer lTimer = new Timer();
|
||||
lTimer.schedule(new TimerTask() {
|
||||
public void run() {
|
||||
if(name.hasFocus()==false) {
|
||||
//System.out.println("request focus timer task");
|
||||
name.requestFocus();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 10, 5);
|
||||
// wait 10ms
|
||||
// execute every 5ms
|
||||
|
||||
dialog.setAlwaysOnTop(true);
|
||||
dialog.setVisible(true);
|
||||
Integer result = (Integer)jop.getValue();
|
||||
dialog.dispose();
|
||||
|
||||
if (result==null) {
|
||||
// is null when escaping by window closing
|
||||
result = JOptionPane.CANCEL_OPTION;
|
||||
}
|
||||
|
||||
// copy user name for next try
|
||||
userName = name.getText();
|
||||
|
||||
/* Perform the OK actions */
|
||||
if (result == JOptionPane.OK_OPTION || result == JOptionPane.YES_OPTION) {
|
||||
Iterator<Action> iterator = okActions.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().perform();
|
||||
}
|
||||
} else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.NO_OPTION) {
|
||||
System.exit(1);
|
||||
}
|
||||
confirmation.handleResult(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides assistance with translating between JAAS and Swing confirmation
|
||||
* dialogs.
|
||||
*/
|
||||
private static class ConfirmationInfo {
|
||||
|
||||
private int[] translations;
|
||||
|
||||
int optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
Object[] options = null;
|
||||
Object initialValue = null;
|
||||
|
||||
int messageType = JOptionPane.QUESTION_MESSAGE;
|
||||
|
||||
private ConfirmationCallback callback;
|
||||
|
||||
/* Set the confirmation callback handler */
|
||||
void setCallback(ConfirmationCallback callback) throws UnsupportedCallbackException {
|
||||
this.callback = callback;
|
||||
|
||||
int confirmationOptionType = callback.getOptionType();
|
||||
switch (confirmationOptionType) {
|
||||
case ConfirmationCallback.YES_NO_OPTION:
|
||||
optionType = JOptionPane.YES_NO_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CLOSED_OPTION, ConfirmationCallback.NO
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.YES_NO_CANCEL_OPTION:
|
||||
optionType = JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.YES_OPTION, ConfirmationCallback.YES, JOptionPane.NO_OPTION, ConfirmationCallback.NO, JOptionPane.CANCEL_OPTION,
|
||||
ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION, ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.OK_CANCEL_OPTION:
|
||||
optionType = JOptionPane.OK_CANCEL_OPTION;
|
||||
translations = new int[] {
|
||||
JOptionPane.OK_OPTION, ConfirmationCallback.OK, JOptionPane.CANCEL_OPTION, ConfirmationCallback.CANCEL, JOptionPane.CLOSED_OPTION,
|
||||
ConfirmationCallback.CANCEL
|
||||
};
|
||||
break;
|
||||
case ConfirmationCallback.UNSPECIFIED_OPTION:
|
||||
options = callback.getOptions();
|
||||
/*
|
||||
* There's no way to know if the default option means to
|
||||
* cancel the login, but there isn't a better way to guess
|
||||
* this.
|
||||
*/
|
||||
translations = new int[] {
|
||||
JOptionPane.CLOSED_OPTION, callback.getDefaultOption()
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized option type: " + confirmationOptionType);
|
||||
}
|
||||
|
||||
int confirmationMessageType = callback.getMessageType();
|
||||
switch (confirmationMessageType) {
|
||||
case ConfirmationCallback.WARNING:
|
||||
messageType = JOptionPane.WARNING_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.ERROR:
|
||||
messageType = JOptionPane.ERROR_MESSAGE;
|
||||
break;
|
||||
case ConfirmationCallback.INFORMATION:
|
||||
messageType = JOptionPane.INFORMATION_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedCallbackException(callback, "Unrecognized message type: " + confirmationMessageType);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process the result returned by the Swing dialog */
|
||||
void handleResult(int result) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < translations.length; i += 2) {
|
||||
if (translations[i] == result) {
|
||||
result = translations[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
callback.setSelectedIndex(result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
vasc-auth-client {
|
||||
org.apache.openejb.client.ClientLoginModule required
|
||||
debug=true
|
||||
openejb.server.uri="http://localhost:8899/demo/ejb";
|
||||
};
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
/**
|
||||
* VascControllerService manages the demo vasc controller which gets init by jndi factory.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 18, 2012
|
||||
*/
|
||||
public class VascControllerService {
|
||||
|
||||
private Logger logger = null;
|
||||
private VascController vascController = null;
|
||||
private List<VascServiceListener> vascServiceListeners = null;
|
||||
|
||||
public VascControllerService() {
|
||||
logger = Logger.getLogger(VascControllerService.class.getName());
|
||||
vascServiceListeners = new ArrayList<VascServiceListener>(10);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
logger.finer("Starting vascmanager");
|
||||
if (vascController!=null) {
|
||||
throw new RuntimeException("VascManager is already started.");
|
||||
}
|
||||
try {
|
||||
// Fetch from jndi
|
||||
vascController = (VascController)VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext().lookup("vasc/DemoVascController");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (vascController==null) {
|
||||
return;
|
||||
}
|
||||
VascBackendControllerLocal backends = (VascBackendControllerLocal)vascController.getVascBackendController();
|
||||
backends.clearAndStopBackends();
|
||||
|
||||
vascController = null;
|
||||
logger.info("Stop manager, cleared all.");
|
||||
}
|
||||
|
||||
public void startEditor() {
|
||||
try {
|
||||
VascParser parser = new VascParser(vascController);
|
||||
parser.addGlobalELBean("vascController", vascController);
|
||||
parser.parseResource("net/forwardfire/vasc/lib/editor/vasc-edit.xml");
|
||||
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void openFile(File file) {
|
||||
logger.info("Vasc open file: "+file.getAbsoluteFile());
|
||||
try {
|
||||
VascParser parser = new VascParser(vascController);
|
||||
//File f = File.createTempFile("test-vasc", ".xml");
|
||||
//parser.setDebugOutputStream(new FileOutputStream(f));
|
||||
parser.parseFile(file);
|
||||
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
fireChangeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
|
||||
public void fireChangeEvent() {
|
||||
for (VascServiceListener listener:vascServiceListeners) {
|
||||
listener.changeEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public void addVascServiceListener(VascServiceListener listener) {
|
||||
vascServiceListeners.add(listener);
|
||||
}
|
||||
|
||||
public interface VascServiceListener {
|
||||
public void changeEvent();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
|
||||
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
public class JdniTreePrinter {
|
||||
public JdniTreePrinter() {
|
||||
|
||||
}
|
||||
|
||||
public void printJNDITree(javax.naming.Context context,String ct,StringBuffer buf) {
|
||||
try {
|
||||
printNE(context,context.list(ct), ct,buf);
|
||||
} catch (NamingException e) {
|
||||
//ignore leaf node exception
|
||||
}
|
||||
}
|
||||
|
||||
private void printNE(javax.naming.Context context,javax.naming.NamingEnumeration<?> ne, String parentctx,StringBuffer buf) throws NamingException {
|
||||
while (ne.hasMoreElements()) {
|
||||
NameClassPair next = (NameClassPair) ne.nextElement();
|
||||
printEntry(next,buf);
|
||||
increaseIndent();
|
||||
printJNDITree(context,(parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName(),buf);
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
|
||||
private void printEntry(javax.naming.NameClassPair next,StringBuffer buf) {
|
||||
printIndent(buf);
|
||||
buf.append("-->");
|
||||
buf.append(next);
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
|
||||
private int indentLevel = 0;
|
||||
|
||||
private void increaseIndent() {
|
||||
indentLevel += 4;
|
||||
}
|
||||
|
||||
private void decreaseIndent() {
|
||||
indentLevel -= 4;
|
||||
}
|
||||
|
||||
private void printIndent(StringBuffer buf) {
|
||||
for (int i = 0; i < indentLevel; i++) {
|
||||
buf.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
|
||||
public class JndiDebugServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = -7624183395089913214L;
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
|
||||
try {
|
||||
Context context = new InitialContext();
|
||||
if (req.getRequestURI().endsWith("global")) {
|
||||
context = VascTechDemo.getInstance().getTomcatService().getServer().getGlobalNamingContext();
|
||||
}
|
||||
StringBuffer buf = new StringBuffer();
|
||||
JdniTreePrinter jndi = new JdniTreePrinter();
|
||||
if (req.getRequestURI().endsWith("global")) {
|
||||
jndi.printJNDITree(context,"",buf);
|
||||
} else {
|
||||
jndi.printJNDITree(context,"java:",buf);
|
||||
}
|
||||
PrintWriter out = response.getWriter();
|
||||
out.append(buf.toString());
|
||||
out.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.core.service.tomcat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.Host;
|
||||
import org.apache.catalina.Server;
|
||||
import org.apache.catalina.Service;
|
||||
import org.apache.catalina.Wrapper;
|
||||
import org.apache.catalina.core.StandardContext;
|
||||
import org.apache.catalina.startup.Bootstrap;
|
||||
import org.apache.catalina.startup.ContextConfig;
|
||||
import org.apache.naming.resources.VirtualDirContext;
|
||||
|
||||
/**
|
||||
* TomcatService config and starts Tomcat in semi embedded mode.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 10, 2012
|
||||
*/
|
||||
public class TomcatService {
|
||||
|
||||
private Logger logger = null;
|
||||
private Server server = null;
|
||||
private ClassLoader commonLoader = null;
|
||||
private Context applicationContext = null;
|
||||
|
||||
public TomcatService() {
|
||||
logger = Logger.getLogger(TomcatService.class.getName());
|
||||
}
|
||||
|
||||
public void start() throws Exception {
|
||||
|
||||
|
||||
Bootstrap boot = new Bootstrap();
|
||||
boot.setCatalinaHome(System.getProperty("user.dir"));
|
||||
boot.init();
|
||||
boot.start();
|
||||
|
||||
/// After startup get the server object from private method.
|
||||
for (Method m:boot.getClass().getDeclaredMethods()) {
|
||||
if (m.getName().equals("getServer")) {
|
||||
m.setAccessible(true);
|
||||
server = (Server)m.invoke(boot);
|
||||
}
|
||||
}
|
||||
if (server==null) {
|
||||
throw new RuntimeException("Could not get server by reflection from BootStrap.");
|
||||
}
|
||||
for (Field f:boot.getClass().getDeclaredFields()) {
|
||||
if (f.getName().equals("commonLoader")) {
|
||||
f.setAccessible(true);
|
||||
commonLoader = (ClassLoader)f.get(boot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deploy(String deployContext) throws Exception {
|
||||
Service service = server.findService("Catalina");
|
||||
Host host = (Host)service.getContainer().findChild("localhost");
|
||||
|
||||
String deployPath = null;
|
||||
if (VascTechDemo.getInstance().isMavenRun()) {
|
||||
String webappPathLocation = "../vasc-demo-tech-web/src/main/webapp/";
|
||||
deployPath = new File(webappPathLocation).getAbsolutePath();
|
||||
logger.info("Deploy demo app from workspace path: "+deployPath);
|
||||
} else {
|
||||
|
||||
File techWarFile = null;
|
||||
for (File file:new File("lib").listFiles()) {
|
||||
if (file.getName().contains("vasc-demo-tech-web")) {
|
||||
techWarFile = file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (techWarFile==null) {
|
||||
throw new NullPointerException("Could not locate war file in lib directory.");
|
||||
}
|
||||
File destDir = new File("workdir","tomcat.wars"+File.separator+techWarFile.getName());
|
||||
|
||||
if (destDir.exists()==false) {
|
||||
destDir.mkdirs();
|
||||
JarFile jar = new JarFile(techWarFile);
|
||||
Enumeration<JarEntry> jars = jar.entries();
|
||||
while (jars.hasMoreElements()) {
|
||||
JarEntry file = jars.nextElement();
|
||||
File f = new File(destDir+File.separator+file.getName());
|
||||
if (file.isDirectory()) {
|
||||
f.mkdir();
|
||||
continue;
|
||||
}
|
||||
InputStream is = jar.getInputStream(file);
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
while (is.available() > 0) {
|
||||
fos.write(is.read()); // slow copy
|
||||
}
|
||||
fos.close();
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
deployPath = destDir.getAbsolutePath();
|
||||
logger.info("Deploy war path: "+deployPath);
|
||||
}
|
||||
|
||||
|
||||
Context ctx = new StandardContext();
|
||||
ctx.setName(deployContext);
|
||||
ctx.setPath(deployContext);
|
||||
ctx.setDocBase(deployPath);
|
||||
//ctx.setParentClassLoader(commonLoader);
|
||||
ctx.setConfigured(true);
|
||||
|
||||
ContextConfig ctxCfg = new ContextConfig();
|
||||
ctx.addLifecycleListener(ctxCfg);
|
||||
|
||||
VirtualDirContext vDir = new VirtualDirContext();
|
||||
vDir.setExtraResourcePaths("../vasc-demo-tech-web/target/classes");
|
||||
|
||||
ctx.setResources(vDir);
|
||||
|
||||
//VirtualWebappLoader loader = new VirtualWebappLoader();
|
||||
//String cl = System.getProperty("java.class.path").replace(":", ";");
|
||||
//logger.info("Virtal class path: "+cl);
|
||||
//loader.setVirtualClasspath(cl);
|
||||
//loader.setSearchVirtualFirst(true);
|
||||
//ctx.setLoader(loader);
|
||||
|
||||
//ctx.getJarScanner().scan
|
||||
host.addChild(ctx);
|
||||
|
||||
applicationContext = ctx;
|
||||
}
|
||||
|
||||
public void deployDebug() throws Exception {
|
||||
if (applicationContext==null) {
|
||||
throw new NullPointerException("Can only deploy debug after deploy.");
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
addServlet(applicationContext,"jdbcConsole","org.h2.server.web.WebServlet");
|
||||
applicationContext.addServletMapping("/debug/jdbc/console/*", "jdbcConsole");
|
||||
|
||||
addServlet(applicationContext,"jndiView","net.forwardfire.vasc.demo.tech.core.service.tomcat.JndiDebugServlet");
|
||||
applicationContext.addServletMapping("/debug/jndi/view", "jndiView");
|
||||
applicationContext.addServletMapping("/debug/jndi/view/global", "jndiView");
|
||||
|
||||
addServlet(applicationContext,"logbackClassicStatus","ch.qos.logback.classic.ViewStatusMessagesServlet");
|
||||
applicationContext.addServletMapping("/debug/logback/status/classic", "logbackClassicStatus");
|
||||
|
||||
addServlet(applicationContext,"logbackAccessStatus","ch.qos.logback.access.ViewStatusMessagesServlet");
|
||||
applicationContext.addServletMapping("/debug/logback/status/access", "logbackAccessStatus");
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
logger.info("Deployed all debug resources in: "+(stopTime-startTime)+" ms.");
|
||||
}
|
||||
|
||||
public Wrapper addServlet(Context ctx,String servletName,String servletClass) {
|
||||
Wrapper sw = ctx.createWrapper();
|
||||
sw.setServletClass(servletClass);
|
||||
sw.setName(servletName);
|
||||
ctx.addChild(sw);
|
||||
return sw;
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
if (server==null) {
|
||||
return;
|
||||
}
|
||||
server.stop();
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoaderCommon() {
|
||||
return commonLoader;
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the applicationContext
|
||||
*/
|
||||
public Context getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package net.forwardfire.vasc.demo.tech.core.ui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.EventObject;
|
||||
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.core.VascTechDemo;
|
||||
|
||||
import org.jdesktop.application.FrameView;
|
||||
import org.jdesktop.application.SingleFrameApplication;
|
||||
|
||||
public class JApplication extends SingleFrameApplication {
|
||||
|
||||
protected void startup() {
|
||||
addExitListener(new ShutdownManager());
|
||||
FrameView mainView = getMainView();
|
||||
mainView.setComponent(new JMainPanel());
|
||||
mainView.setMenuBar(new JMainPanelMenuBar());
|
||||
mainView.getFrame().setMinimumSize(new Dimension(1024-64,768-128));
|
||||
show(mainView);
|
||||
}
|
||||
|
||||
static public JApplication getInstance() {
|
||||
return getInstance(JApplication.class);
|
||||
}
|
||||
|
||||
class ShutdownManager implements ExitListener {
|
||||
public boolean canExit(EventObject e) {
|
||||
return true;
|
||||
}
|
||||
public void willExit(EventObject event) {
|
||||
VascTechDemo.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
Vasc namespace for the vasc tech demo
|
||||
</comment>
|
||||
<entry key="eld.http://demo.vasc.forwardfire.net/eld/vasc-tech-demo.eld">vasc-tech-demo.eld</entry>
|
||||
</properties>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementClass tag="tomcatResource" elementClassName="net.forwardfire.vasc.demo.tech.core.x4o.vasc.TomcatResourceElement"/>
|
||||
</eld:root>
|
||||
23
vasc-demo/vasc-demo-tech/vasc-demo-tech-ejb3/.project
Normal file
23
vasc-demo/vasc-demo-tech/vasc-demo-tech-ejb3/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-demo-tech-ejb3</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>
|
||||
19
vasc-demo/vasc-demo-tech/vasc-demo-tech-ejb3/pom.xml
Normal file
19
vasc-demo/vasc-demo-tech/vasc-demo-tech-ejb3/pom.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech</artifactId>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-demo-tech-ejb3</artifactId>
|
||||
<name>vasc-demo-tech-ejb3</name>
|
||||
<description>vasc-demo-tech-ejb3</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.menu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
||||
|
||||
public interface VascMenuController {
|
||||
|
||||
List<VascMenuWeb> getFilteredMenuWeb(VascMenuWebType type);
|
||||
|
||||
List<VascMenuGroup> getFilteredMenuGroup();
|
||||
|
||||
List<VascMenu> getFilteredMenu(String groupId);
|
||||
}
|
||||
|
|
@ -0,0 +1,280 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.ejb.SessionContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenu;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroupComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebComparator;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
||||
|
||||
/**
|
||||
* MenuController Shows the menu for the user.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuControllerRemote {
|
||||
|
||||
private VascMenuWebComparator vascMenuWebComparator = null;
|
||||
private VascMenuGroupComparator vascMenuGroupComparator = null;
|
||||
private VascMenuComparator vascMenuComparator = null;
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
||||
|
||||
public VascMenuControllerImpl() {
|
||||
vascMenuWebComparator = new VascMenuWebComparator();
|
||||
vascMenuGroupComparator = new VascMenuGroupComparator();
|
||||
vascMenuComparator = new VascMenuComparator();
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> fetchVascMenuWeb() {
|
||||
List<VascMenuWeb> result = new ArrayList<VascMenuWeb>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU_WEB");
|
||||
ResultSet rs = s.getResultSet();
|
||||
//int cols = rs.getMetaData().getColumnCount();
|
||||
while (rs.next()) {
|
||||
VascMenuWeb menu = new VascMenuWeb();
|
||||
menu.setId(rs.getInt(1));
|
||||
menu.setHref(rs.getString(2));
|
||||
menu.setTitle(rs.getString(3));
|
||||
menu.setTarget(rs.getString(4));
|
||||
menu.setActive(rs.getBoolean(5));
|
||||
menu.setRoles(rs.getString(6));
|
||||
menu.setMenuOrder(rs.getInt(7));
|
||||
menu.setMenuType(VascMenuWebType.valueOf(rs.getString(8)));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenuGroup> fetchVascMenuGroup() {
|
||||
List<VascMenuGroup> result = new ArrayList<VascMenuGroup>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU_GROUP");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenuGroup menu = new VascMenuGroup();
|
||||
menu.setId(rs.getString(1));
|
||||
menu.setTitle(rs.getString(2));
|
||||
menu.setActive(rs.getBoolean(3));
|
||||
menu.setRoles(rs.getString(4));
|
||||
menu.setMenuOrder(rs.getInt(5));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenu> fetchVascMenu() {
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(50);
|
||||
Connection connection = null;
|
||||
try {
|
||||
DataSource ds = getDataSource("openejb:Resource/jdbc/DemoManagerDataDS");
|
||||
connection = ds.getConnection();
|
||||
Statement s = connection.createStatement();
|
||||
s.execute("SELECT * FROM VASC_MENU");
|
||||
ResultSet rs = s.getResultSet();
|
||||
while (rs.next()) {
|
||||
VascMenu menu = new VascMenu();
|
||||
menu.setId(rs.getInt(1));
|
||||
menu.setVascEntryId(rs.getString(2));
|
||||
menu.setTitle(rs.getString(3));
|
||||
menu.setActive(rs.getBoolean(4));
|
||||
menu.setRoles(rs.getString(5));
|
||||
menu.setMenuOrder(rs.getInt(6));
|
||||
menu.setMenuGroup(rs.getString(7));
|
||||
if (filterVascMenuRoles(menu.getActive(),menu.getRoles())==false) {
|
||||
continue;
|
||||
}
|
||||
result.add(menu);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private DataSource getDataSource(String name) throws SQLException {
|
||||
try {
|
||||
Context initialContext = new InitialContext();
|
||||
DataSource datasource = (DataSource)initialContext.lookup(name);
|
||||
if ( datasource == null ) {
|
||||
throw new SQLException("Cannot lookup datasource: "+name);
|
||||
}
|
||||
return datasource;
|
||||
} catch ( NamingException e ) {
|
||||
throw new SQLException("Cannot get connection " + e,e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean filterVascMenuRoles(Boolean active,String roles) {
|
||||
if (active!=null && active==false) {
|
||||
return false;
|
||||
}
|
||||
if (roles!=null && roles.isEmpty()==false) {
|
||||
String[] rolesArray = roles.split(",");
|
||||
for (String role:rolesArray) {
|
||||
if (role.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (session.isCallerInRole(role)==false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<VascMenuGroup> getFilteredMenuGroup() {
|
||||
List<VascMenuGroup> result = fetchVascMenuGroup();
|
||||
for (VascMenuGroup group:result) {
|
||||
group.setMenus(getFilteredMenu(group.getId()));
|
||||
}
|
||||
Collections.sort(result,vascMenuGroupComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenu> getFilteredMenu(String groupId) {
|
||||
if (groupId==null) {
|
||||
throw new NullPointerException("Can't filter on null groupId.");
|
||||
}
|
||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
||||
for (VascMenu menu:fetchVascMenu()) {
|
||||
if (groupId.equals(menu.getMenuGroup())) {
|
||||
result.add(menu);
|
||||
}
|
||||
}
|
||||
Collections.sort(result,vascMenuComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getFilteredMenuWeb(VascMenuWebType type) {
|
||||
if (type==null) {
|
||||
throw new NullPointerException("Can't filter on null type.");
|
||||
}
|
||||
List<VascMenuWeb> result = new ArrayList<VascMenuWeb>(15);
|
||||
for (VascMenuWeb menu:fetchVascMenuWeb()) {
|
||||
if (type.equals(menu.getMenuType())) {
|
||||
result.add(menu);
|
||||
}
|
||||
}
|
||||
Collections.sort(result,vascMenuWebComparator);
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<VascMenuWeb> getMenuFiltered(VascMenuWebType type) {
|
||||
return getFilteredMenuWeb(type);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuBarLeft() {
|
||||
return getMenuFiltered(VascMenuWebType.BAR_LEFT);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuBarRight() {
|
||||
return getMenuFiltered(VascMenuWebType.BAR_RIGHT);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuBarBottom() {
|
||||
return getMenuFiltered(VascMenuWebType.BAR_BOTTOM);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuPageIndex() {
|
||||
return getMenuFiltered(VascMenuWebType.PAGE_INDEX);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuPageUserLeft() {
|
||||
return getMenuFiltered(VascMenuWebType.PAGE_USER_LEFT);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuPageUserRight() {
|
||||
return getMenuFiltered(VascMenuWebType.PAGE_USER_RIGHT);
|
||||
}
|
||||
|
||||
public List<VascMenuWeb> getMenuPageAdmin() {
|
||||
return getMenuFiltered(VascMenuWebType.PAGE_ADMIN);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.menu;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
@Local
|
||||
public interface VascMenuControllerLocal extends VascMenuController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.menu;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface VascMenuControllerRemote extends VascMenuController {
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,9 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.web.menu.model;
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* VascMenu stores menu item information.
|
||||
|
|
@ -28,16 +30,16 @@ package net.forwardfire.vasc.demo.tech.web.menu.model;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class VascMenu {
|
||||
public class VascMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5087600835051760512L;
|
||||
private Integer id = null;
|
||||
private String href = null;
|
||||
private String vascEntryId = null;
|
||||
private String title = null;
|
||||
private String target = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private VascMenuType menuType = null;
|
||||
private String menuGroup = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
|
|
@ -54,19 +56,19 @@ public class VascMenu {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the href
|
||||
* @return the vascEntryId
|
||||
*/
|
||||
public String getHref() {
|
||||
return href;
|
||||
public String getVascEntryId() {
|
||||
return vascEntryId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param href the href to set
|
||||
* @param vascEntryId the vascEntryId to set
|
||||
*/
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
public void setVascEntryId(String vascEntryId) {
|
||||
this.vascEntryId = vascEntryId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
|
|
@ -81,20 +83,6 @@ public class VascMenu {
|
|||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the target
|
||||
*/
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param target the target to set
|
||||
*/
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
|
|
@ -136,18 +124,18 @@ public class VascMenu {
|
|||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the menuType
|
||||
* @return the menuGroup
|
||||
*/
|
||||
public VascMenuType getMenuType() {
|
||||
return menuType;
|
||||
public String getMenuGroup() {
|
||||
return menuGroup;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param menuType the menuType to set
|
||||
* @param menuGroup the menuGroup to set
|
||||
*/
|
||||
public void setMenuType(VascMenuType menuType) {
|
||||
this.menuType = menuType;
|
||||
public void setMenuGroup(String menuGroup) {
|
||||
this.menuGroup = menuGroup;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,19 +20,18 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.web.menu;
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import net.forwardfire.vasc.demo.tech.web.menu.model.VascMenu;
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuComparator orders the menu items.
|
||||
* VascMenuComparator orders the menu group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
* @version 1.0 nov 17, 2012
|
||||
*/
|
||||
public class VascMenuComparator implements Serializable,Comparator<VascMenu> {
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VascMenuGroup stores menu header item information.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 21, 2012
|
||||
*/
|
||||
public class VascMenuGroup implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -9154803561816570868L;
|
||||
private String id = null;
|
||||
private String title = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private List<VascMenu> menus = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menus
|
||||
*/
|
||||
public List<VascMenu> getMenus() {
|
||||
return menus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menus the menus to set
|
||||
*/
|
||||
public void setMenus(List<VascMenu> menus) {
|
||||
this.menus = menus;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuGroupComparator orders the menu group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 nov 17, 2012
|
||||
*/
|
||||
public class VascMenuGroupComparator implements Serializable,Comparator<VascMenuGroup> {
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
|
||||
public int compare(VascMenuGroup m1, VascMenuGroup m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* VascMenu stores menu item information.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class VascMenuWeb implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4650021226959950898L;
|
||||
private Integer id = null;
|
||||
private String href = null;
|
||||
private String title = null;
|
||||
private String target = null;
|
||||
private Boolean active = null;
|
||||
private String roles = null;
|
||||
private Integer menuOrder = null;
|
||||
private VascMenuWebType menuType = null;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the href
|
||||
*/
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param href the href to set
|
||||
*/
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the target
|
||||
*/
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param target the target to set
|
||||
*/
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public Boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param active the active to set
|
||||
*/
|
||||
public void setActive(Boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the roles
|
||||
*/
|
||||
public String getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param roles the roles to set
|
||||
*/
|
||||
public void setRoles(String roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuOrder
|
||||
*/
|
||||
public Integer getMenuOrder() {
|
||||
return menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuOrder the menuOrder to set
|
||||
*/
|
||||
public void setMenuOrder(Integer menuOrder) {
|
||||
this.menuOrder = menuOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the menuType
|
||||
*/
|
||||
public VascMenuWebType getMenuType() {
|
||||
return menuType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuType the menuType to set
|
||||
*/
|
||||
public void setMenuType(VascMenuWebType menuType) {
|
||||
this.menuType = menuType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* VascMenuComparator orders the menu items.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2012
|
||||
*/
|
||||
public class VascMenuWebComparator implements Serializable,Comparator<VascMenuWeb> {
|
||||
|
||||
private static final long serialVersionUID = 386631856823832371L;
|
||||
|
||||
public int compare(VascMenuWeb m1, VascMenuWeb m2) {
|
||||
if (m1.getMenuOrder()==null) {
|
||||
return 1;
|
||||
}
|
||||
if (m2.getMenuOrder()==null) {
|
||||
return -1;
|
||||
}
|
||||
return m1.getMenuOrder().compareTo(m2.getMenuOrder());
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.demo.tech.web.menu.model;
|
||||
package net.forwardfire.vasc.demo.tech.ejb3.menu.model;
|
||||
|
||||
/**
|
||||
* VascMenuType defines all menu lists on page.
|
||||
|
|
@ -28,16 +28,12 @@ package net.forwardfire.vasc.demo.tech.web.menu.model;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 26, 2012
|
||||
*/
|
||||
public enum VascMenuType {
|
||||
public enum VascMenuWebType {
|
||||
|
||||
BAR_LEFT,
|
||||
BAR_RIGHT,
|
||||
BAR_BOTTOM,
|
||||
|
||||
MENU0,
|
||||
MENU1,
|
||||
MENU2,
|
||||
|
||||
PAGE_INDEX,
|
||||
PAGE_USER_LEFT,
|
||||
PAGE_USER_RIGHT,
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
|
||||
public interface LoginUserController {
|
||||
|
||||
public String doClientLogin();
|
||||
|
||||
/*
|
||||
public void doClientLogout();
|
||||
|
||||
public User getUser() throws Exception;
|
||||
|
||||
public List<RightRole> getClientRoles() throws Exception;
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.ejb.SessionContext;
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless(name="loginUserController")
|
||||
public class LoginUserControllerImpl implements LoginUserControllerLocal,LoginUserControllerRemote {
|
||||
|
||||
@Resource
|
||||
private SessionContext session;
|
||||
|
||||
/**
|
||||
* Tests for the login role
|
||||
*/
|
||||
@RolesAllowed("login")
|
||||
public String doClientLogin() {
|
||||
|
||||
String name = session.getCallerPrincipal().getName();
|
||||
return name;
|
||||
|
||||
/*
|
||||
User u = null;
|
||||
try {
|
||||
u = getUser();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Could not lookup showplanner user from username: "+session.getCallerPrincipal().getName());
|
||||
}
|
||||
UserSession us = new UserSession();
|
||||
us.setLoginDate(new Date());
|
||||
us.setLogoutDate(null); // set when doing doClientLogout();
|
||||
|
||||
try {
|
||||
Query q2 = xtesManager.getQuery("users.xml", "getUserSessionStatusByStatusKey");
|
||||
q2.setQueryParameter("status_key", "success");
|
||||
q2.setProperty("limit", 1);
|
||||
UserSessionStatus userSessionStatus = (UserSessionStatus)xtesManager.executeObject(q2);
|
||||
us.setUserSessionStatus(userSessionStatus);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Could not lookup session status of success.");
|
||||
}
|
||||
|
||||
// current_time_in_secs + str_to_int(username)*10E20
|
||||
long timeSS = us.getLoginDate().getTime();
|
||||
int userSS = hashUserName(u.getUsername());
|
||||
int modSS = 10230;
|
||||
long sessionId = timeSS+userSS*modSS;
|
||||
us.setSessionId(sessionId);
|
||||
//System.out.println("Created sessionId: timeSS: "+timeSS+" userSS: "+userSS+" modSS: "+modSS);
|
||||
|
||||
us.setUser(u);
|
||||
entityManager.persist(us);
|
||||
return u.getUsername();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
@Local
|
||||
public interface LoginUserControllerLocal extends LoginUserController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package net.forwardfire.vasc.demo.tech.ejb3.user;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface LoginUserControllerRemote extends LoginUserController {
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue