commit e2af6a41aad4400266f594757cf0a7e5251c6764 Author: Robert von Burg Date: Sun May 21 14:04:57 2017 +0200 [Project] Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8bd3a05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target/ +/.settings/ +/.classpath +/.project diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..acecc5c --- /dev/null +++ b/pom.xml @@ -0,0 +1,215 @@ + + + 4.0.0 + + li.strolch + strolch-bookshop + 0.1.0-SNAPSHOT + war + + strolch-bookshop + Bookshop built on Strolch + 2017 + + + UTF-8 + yyyy-MM-dd HH:mm:ss + ${maven.build.timestamp} + + 1.8 + + 1.5.0-SNAPSHOT + 2.11 + 2.0 + + bookshop + ${warFinalName} + + + + + + org.slf4j + slf4j-api + 1.7.2 + + + ch.qos.logback + logback-classic + 1.0.13 + + + + + li.strolch + li.strolch.utils + ${strolch.version} + + + li.strolch + li.strolch.privilege + ${strolch.version} + + + li.strolch + li.strolch.model + ${strolch.version} + + + li.strolch + li.strolch.agent + ${strolch.version} + + + li.strolch + li.strolch.rest + ${strolch.version} + + + li.strolch + li.strolch.service + ${strolch.version} + + + li.strolch + li.strolch.testbase + ${strolch.version} + test + + + + + com.github.petitparser.java-petitparser + petitparser-core + 2.0.3 + + + com.google.code.gson + gson + 2.3.1 + + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + javax.ws.rs + javax.ws.rs-api + ${jaxrs.api.version} + + + + + junit + junit + 4.11 + test + + + org.hamcrest + hamcrest-core + 1.3 + test + + + org.hamcrest + hamcrest-library + 1.3 + test + + + + + + + + src/main/resources + true + + **/*.properties + + + + src/main/resources + false + + **/*.properties + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + ${java-version} + ${java-version} + + + + org.apache.maven.plugins + maven-war-plugin + 2.4 + + false + ${warFinalName} + + + + + + + + + jitpack.io + snapshots + https://jitpack.io + + true + + + true + + + + + + + + m2e.eitchpc + + + user.name + eitch + + + unix + + + + dev.eitchpc + + + + m2e.eitchmac + + + user.name + eitch + + + mac + + + + dev.eitchmac + + + + diff --git a/runtime/config/PrivilegeConfig.xml b/runtime/config/PrivilegeConfig.xml new file mode 100644 index 0000000..a188f31 --- /dev/null +++ b/runtime/config/PrivilegeConfig.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/config/PrivilegeRoles.xml b/runtime/config/PrivilegeRoles.xml new file mode 100644 index 0000000..fc26159 --- /dev/null +++ b/runtime/config/PrivilegeRoles.xml @@ -0,0 +1,63 @@ + + + + + + + + internal + + + + + + + + + + + + true + + + true + + + true + + + true + + + + + + li.strolch.runtime.privilege.StrolchSystemAction + li.strolch.runtime.privilege.StrolchSystemActionWithResult + li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer + + + true + + + true + + + Persist + PersistSessions + GetCertificates + + + true + + + true + + + true + + + + diff --git a/runtime/config/PrivilegeUsers.xml b/runtime/config/PrivilegeUsers.xml new file mode 100644 index 0000000..728996c --- /dev/null +++ b/runtime/config/PrivilegeUsers.xml @@ -0,0 +1,42 @@ + + + + + Jill + Someone + ENABLED + en_GB + + User + UserPrivileges + + + + + + + + Jill + Someone + ENABLED + en_GB + + StrolchAdmin + UserPrivileges + + + + + + + + + SYSTEM + + agent + + + + diff --git a/runtime/config/StrolchConfiguration.xml b/runtime/config/StrolchConfiguration.xml new file mode 100644 index 0000000..31b9168 --- /dev/null +++ b/runtime/config/StrolchConfiguration.xml @@ -0,0 +1,110 @@ + + + + + Bookshop + + en + true + + + + + PrivilegeHandler + li.strolch.runtime.privilege.PrivilegeHandler + li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler + + PrivilegeConfig.xml + + + + + RealmHandler + li.strolch.agent.api.RealmHandler + li.strolch.agent.impl.DefaultRealmHandler + PrivilegeHandler + + defaultRealm + + TRANSIENT + defaultModel.xml + true + + + + + ServiceHandler + li.strolch.service.api.ServiceHandler + li.strolch.service.api.DefaultServiceHandler + RealmHandler + PrivilegeHandler + + true + + + + + PolicyHandler + li.strolch.policy.PolicyHandler + li.strolch.policy.DefaultPolicyHandler + + true + + + + + ExecutionHandler + li.strolch.execution.ExecutionHandler + li.strolch.execution.EventBasedExecutionHandler + RealmHandler + PrivilegeHandler + + + + RestfulHandler + li.strolch.rest.RestfulStrolchComponent + li.strolch.rest.RestfulStrolchComponent + SessionHandler + + false + false + false + ALL + + + + SessionHandler + li.strolch.rest.StrolchSessionHandler + li.strolch.rest.DefaultStrolchSessionHandler + PrivilegeHandler + + 30 + true + + + + + MailHandler + li.strolch.handler.mail.MailHandler + li.strolch.handler.mail.SmtpMailHandler + + relayer@eitchnet.ch + Susi + IPSC Test <eitch@eitchnet.ch> + eitch@eitchnet.ch + test + test + true + true + smtp.gmail.com + 587 + + + + + + + + + + diff --git a/runtime/config/StrolchPolicies.xml b/runtime/config/StrolchPolicies.xml new file mode 100644 index 0000000..0365d76 --- /dev/null +++ b/runtime/config/StrolchPolicies.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/data/StrolchModel.xsd b/runtime/data/StrolchModel.xsd new file mode 100644 index 0000000..c398f63 --- /dev/null +++ b/runtime/data/StrolchModel.xsd @@ -0,0 +1,190 @@ + + + + + This is Version 1.4.x of the StrolchModel XSD. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/data/defaultModel.xml b/runtime/data/defaultModel.xml new file mode 100644 index 0000000..98edf19 --- /dev/null +++ b/runtime/data/defaultModel.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/data/templates.xml b/runtime/data/templates.xml new file mode 100644 index 0000000..980e286 --- /dev/null +++ b/runtime/data/templates.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/temp/.gitignore b/runtime/temp/.gitignore new file mode 100644 index 0000000..7385672 --- /dev/null +++ b/runtime/temp/.gitignore @@ -0,0 +1 @@ +/sessions.dat diff --git a/src/main/java/li/strolch/bookshop/web/StartupListener.java b/src/main/java/li/strolch/bookshop/web/StartupListener.java new file mode 100644 index 0000000..257d1f3 --- /dev/null +++ b/src/main/java/li/strolch/bookshop/web/StartupListener.java @@ -0,0 +1,53 @@ +package li.strolch.bookshop.web; + +import java.io.InputStream; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.annotation.WebListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import li.strolch.agent.api.StrolchAgent; +import li.strolch.agent.api.StrolchBootstrapper; + +@WebListener +public class StartupListener implements ServletContextListener { + + private static final Logger logger = LoggerFactory.getLogger(StartupListener.class); + + private StrolchAgent agent; + + @Override + public void contextInitialized(ServletContextEvent sce) { + + logger.info("Starting Bookshop..."); + try { + // we load the configuration by reading the boot strap file: + String boostrapFileName = "/WEB-INF/" + StrolchBootstrapper.FILE_BOOTSTRAP; + InputStream bootstrapFile = sce.getServletContext().getResourceAsStream(boostrapFileName); + StrolchBootstrapper bootstrapper = new StrolchBootstrapper(StartupListener.class); + + // now setup, initialize and start Strolch: + this.agent = bootstrapper.setupByBoostrapFile(StartupListener.class, bootstrapFile); + this.agent.initialize(); + this.agent.start(); + + } catch (Exception e) { + logger.error("Failed to start Bookshop due to: " + e.getMessage(), e); + throw e; + } + + logger.info("Started Bookshop."); + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + if (this.agent != null) { + this.agent.stop(); + this.agent.destroy(); + } + logger.info("Destroyed Bookshop."); + } +} diff --git a/src/main/resources/ENV.properties b/src/main/resources/ENV.properties new file mode 100644 index 0000000..8212444 --- /dev/null +++ b/src/main/resources/ENV.properties @@ -0,0 +1 @@ +ENV_STROLCH=${strolch.env} \ No newline at end of file diff --git a/src/main/resources/appVersion.properties b/src/main/resources/appVersion.properties new file mode 100644 index 0000000..a4594a2 --- /dev/null +++ b/src/main/resources/appVersion.properties @@ -0,0 +1,6 @@ +groupId=${project.groupId} +artifactId=${project.artifactId} +artifactVersion=${project.version} +scmRevision=${buildNumber} +scmBranch=${scmBranch} +buildTimestamp=${buildTimestamp} \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..fcc71f0 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,16 @@ + + + + + + + %d [%thread] %-5level %class{36}:%line %method - %msg%n + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/StrolchBootstrap.xml b/src/main/webapp/WEB-INF/StrolchBootstrap.xml new file mode 100644 index 0000000..1364aa0 --- /dev/null +++ b/src/main/webapp/WEB-INF/StrolchBootstrap.xml @@ -0,0 +1,13 @@ + + + + + /home/eitch/src/git/strolch-bookshop/runtime + dev + + + /Users/eitch/src/git/strolch-bookshop/runtime + dev + + + \ No newline at end of file