initial
This commit is contained in:
3
src/dist/bin/start-client
vendored
Executable file
3
src/dist/bin/start-client
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
$(dirname $0)/starter client
|
3
src/dist/bin/start-client.bat
vendored
Executable file
3
src/dist/bin/start-client.bat
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
|
||||
"%~dp0\..\starter.bat" client
|
5
src/dist/bin/starter
vendored
Executable file
5
src/dist/bin/starter
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)/..
|
||||
bin/sample $1 -config config/ncore-properties.xml -logconfig config/log4j.properties $2 $3 $4 $5
|
||||
cd $OLDPWD
|
5
src/dist/bin/starter.bat
vendored
Executable file
5
src/dist/bin/starter.bat
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
|
||||
pushd "%~dp0\.."
|
||||
bin\sample.bat %1 -config config\ncore-properties.xml -logconfig config\log4j.properties %2 %3 %4 %5
|
||||
popd
|
24
src/dist/config/log4j.properties
vendored
Normal file
24
src/dist/config/log4j.properties
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
log4j.rootLogger=ERROR, file, stdout
|
||||
log4j.logger.biz.redsoft.ncore.docflow.Log4jDocFlowLogger=ERROR, biz.redsoft.ncore.docflow.Log4jDocFlowLogger
|
||||
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger=org.apache.log4j.FileAppender
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.encoding=UTF-8
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.File=${server.home}/logs/sample-docflow.log
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.stdout.encoding=UTF-8
|
||||
|
||||
log4j.appender.stdout.Threshold=ERROR
|
||||
|
||||
log4j.appender.file=org.apache.log4j.FileAppender
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.file.encoding=UTF-8
|
||||
log4j.appender.file.Threshold=ERROR
|
||||
|
||||
log4j.appender.file.File=${server.home}/logs/ncore-sample.log
|
||||
log4j.appender.file.Append=true
|
16
src/dist/config/ncore-properties.xml
vendored
Normal file
16
src/dist/config/ncore-properties.xml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>Configuration settings for ncore platform</comment>
|
||||
|
||||
<!-- Product settings -->
|
||||
<entry key="product.name">sample</entry>
|
||||
<entry key="product.title">Sample ncore project</entry>
|
||||
|
||||
<!-- Database settings -->
|
||||
<entry key="jdbc.drivers">org.firebirdsql.jdbc.FBDriver</entry>
|
||||
<entry key="ncore.db.url">jdbc:firebirdsql:localhost:ncore-sample?lc_ctype=WIN1251</entry>
|
||||
<entry key="ncore.db.user">SYSDBA</entry>
|
||||
<entry key="ncore.db.password">masterkey</entry>
|
||||
|
||||
</properties>
|
26
src/main/java/biz/redsoft/sample/Product.java
Normal file
26
src/main/java/biz/redsoft/sample/Product.java
Normal file
@ -0,0 +1,26 @@
|
||||
package biz.redsoft.sample;
|
||||
|
||||
import biz.redsoft.ncore.system.application.Application;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Victor Bellavin
|
||||
*/
|
||||
public class Product implements biz.redsoft.ncore.product.Product {
|
||||
@Override
|
||||
public void init(Map<Object, Object> properties) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Application application) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(Application application) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
}
|
68
src/main/java/biz/redsoft/sample/Version.java
Normal file
68
src/main/java/biz/redsoft/sample/Version.java
Normal file
@ -0,0 +1,68 @@
|
||||
package biz.redsoft.sample;
|
||||
|
||||
import biz.redsoft.util.IncorrectVersionFormat;
|
||||
import biz.redsoft.util.VersionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Victor Bellavin
|
||||
*/
|
||||
public class Version {
|
||||
public static final Logger LOGGER = Logger.getLogger(Version.class);
|
||||
|
||||
public static final String VERSION_FILE = "version.properties";
|
||||
public static final String VERSION_PROP_NAME = "version";
|
||||
|
||||
private static final VersionUtils.Version version = readVersion();
|
||||
|
||||
public static VersionUtils.Version getInstance() {
|
||||
return getVersion();
|
||||
}
|
||||
|
||||
public static VersionUtils.Version getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
private static VersionUtils.Version readVersion() {
|
||||
final VersionUtils.Version version = new VersionUtils.Version();
|
||||
final String packageName = Version.class.getPackage().getName();
|
||||
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
final String versionPath = "META-INF/ncore-product/" + packageName + "/" + VERSION_FILE;
|
||||
final InputStream is = classLoader.getResourceAsStream(versionPath);
|
||||
if (is != null) {
|
||||
loadVersion(version, is);
|
||||
} else {
|
||||
LOGGER.warn("No version resource at " + versionPath + " Trying to load it from the main package...");
|
||||
final InputStream oldStream = Version.class.getResourceAsStream(VERSION_FILE);
|
||||
if (oldStream != null)
|
||||
loadVersion(version, oldStream);
|
||||
else
|
||||
LOGGER.error("No version resource in classpath");
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
private static void loadVersion(VersionUtils.Version version, InputStream is) {
|
||||
try {
|
||||
try {
|
||||
final Properties props = new Properties();
|
||||
props.load(is);
|
||||
final String moduleVersion = props.getProperty(VERSION_PROP_NAME);
|
||||
if (moduleVersion != null)
|
||||
version.setVersion(moduleVersion);
|
||||
else
|
||||
LOGGER.error("No module.version key in version properties");
|
||||
} catch (IncorrectVersionFormat e) {
|
||||
LOGGER.error("Error reading version", e);
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
}catch (IOException e) {
|
||||
LOGGER.error("Error reading version", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dependencies": [],
|
||||
"register": {}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
version=1.1.1.1-SNAPSHOT
|
||||
# release | build | patchset
|
||||
type=release
|
4
src/main/webapp/META-INF/context.xml
Normal file
4
src/main/webapp/META-INF/context.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context>
|
||||
<Manager pathname="" />
|
||||
</Context>
|
24
src/main/webapp/WEB-INF/log4j.properties
Normal file
24
src/main/webapp/WEB-INF/log4j.properties
Normal file
@ -0,0 +1,24 @@
|
||||
log4j.rootLogger=ERROR, file, stdout
|
||||
log4j.logger.biz.redsoft.ncore.docflow.Log4jDocFlowLogger=ERROR, biz.redsoft.ncore.docflow.Log4jDocFlowLogger
|
||||
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger=org.apache.log4j.FileAppender
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.encoding=UTF-8
|
||||
log4j.appender.biz.redsoft.ncore.docflow.Log4jDocFlowLogger.File=${server.home}/logs/sample-docflow.log
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.stdout.encoding=UTF-8
|
||||
|
||||
log4j.appender.stdout.Threshold=ERROR
|
||||
|
||||
log4j.appender.file=org.apache.log4j.FileAppender
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yy HH:mm:ss.SSS},%t,%p,%c{1},%m%n
|
||||
log4j.appender.file.encoding=UTF-8
|
||||
log4j.appender.file.Threshold=ERROR
|
||||
|
||||
log4j.appender.file.File=${server.home}/logs/ncore-sample.log
|
||||
log4j.appender.file.Append=true
|
16
src/main/webapp/WEB-INF/ncore-properties.xml
Normal file
16
src/main/webapp/WEB-INF/ncore-properties.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>Configuration settings for ncore platform</comment>
|
||||
|
||||
<!-- Product settings -->
|
||||
<entry key="product.name">sample</entry>
|
||||
<entry key="product.title">Sample ncore project</entry>
|
||||
|
||||
<!-- Database settings -->
|
||||
<entry key="jdbc.drivers">org.firebirdsql.jdbc.FBDriver</entry>
|
||||
<entry key="ncore.db.url">jdbc:firebirdsql:localhost:ncore-sample?lc_ctype=WIN1251</entry>
|
||||
<entry key="ncore.db.user">SYSDBA</entry>
|
||||
<entry key="ncore.db.password">masterkey</entry>
|
||||
|
||||
</properties>
|
51
src/main/webapp/WEB-INF/web.xml
Normal file
51
src/main/webapp/WEB-INF/web.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
<display-name>Sample server</display-name>
|
||||
<context-param>
|
||||
<param-name>productionMode</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<description>A list of ncore config files</description>
|
||||
<param-name>ncoreConfigFiles</param-name>
|
||||
<param-value>
|
||||
ncore-properties.xml
|
||||
ncore-properties-local.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<servlet>
|
||||
<servlet-name>ncore</servlet-name>
|
||||
<servlet-class>biz.redsoft.ncore.server.NcoreApplicationServlet</servlet-class>
|
||||
<init-param>
|
||||
<description>Vaadin application class to start</description>
|
||||
<param-name>application</param-name>
|
||||
<param-value>biz.redsoft.ncore.client.vaadin.WebApplication</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<description>Application widgetset</description>
|
||||
<param-name>widgetset</param-name>
|
||||
<param-value>biz.redsoft.ncore.client.vaadin.NcoreWidgetset</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ncore</servlet-name>
|
||||
<url-pattern>/client/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ncore</servlet-name>
|
||||
<url-pattern>/VAADIN/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>biz.redsoft.ncore.dx.init.DxInitializationListener</listener-class>
|
||||
</listener>
|
||||
<welcome-file-list>
|
||||
<welcome-file>client</welcome-file>
|
||||
</welcome-file-list>
|
||||
</web-app>
|
22
src/test/java/biz/redsoft/sample/SampleTests.java
Normal file
22
src/test/java/biz/redsoft/sample/SampleTests.java
Normal file
@ -0,0 +1,22 @@
|
||||
package biz.redsoft.sample;
|
||||
|
||||
import biz.redsoft.ncore.util.Misc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Victor Bellavin
|
||||
*/
|
||||
public class SampleTests {
|
||||
@Test
|
||||
public void testProductName() throws IOException {
|
||||
final Properties props = new Properties(System.getProperties());
|
||||
Misc.loadProperties(props, Arrays.asList("ncore-properties.xml", "ncore-properties-local.xml"));
|
||||
Assert.assertEquals(props.getProperty("product.name"), "sample");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user