[Project] Initial commit

This commit is contained in:
Robert von Burg 2022-08-16 22:04:41 +02:00
commit 3fc67af657
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
99 changed files with 6582 additions and 0 deletions

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# Strolch Maven Archetypes
This repository contains archetypes to be used when creating new Strolch applications.
Install this maven module locally:
git clone https://github.com/strolch-li/strolch-maven-archetypes.git
cd strolch-maven-archetypes
mvn clean install
Now you can use the archetypes to create your project. The following archetypes are available:
* li.strolch.mvn.archetype.main
* li.strolch.mvn.archetype.webapp
To create a Strolch project see https://strolch.li/development/

View File

@ -0,0 +1,5 @@
target/
.project
.settings
.classpath
*.iml

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>li.strolch</groupId>
<artifactId>li.strolch-maven-archetypes</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>li.strolch.mvn.archetype.main</artifactId>
<packaging>maven-archetype</packaging>
<distributionManagement>
<site>
<id>localhost</id>
<url>file://${project.basedir}/../target/${project.artifactId}</url>
</site>
</distributionManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${archetype-packaging.version}</version>
</extension>
</extensions>
</build>
</project>

View File

@ -0,0 +1,37 @@
<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0
http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="li.strolch.mvn.archetype.main">
<requiredProperties>
<requiredProperty key="appName">
<defaultValue>Strolch App</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/test/resources</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>runtime</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>README.md</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>

View File

@ -0,0 +1,37 @@
Strolch Project: ${appName} / ${artifactId}
======================================
This is a Strolch project which is started by a main()-method. It has an example
test class to show how to start an agent for tests.
The project's runtime directory is in the root folder and contains the
configuration and data files needed to start via the main()-method.
The test has it's own runtime directory, with its own configuration, but the
model file in the data directory points to the main runtime directory and uses
that model file, so that one does not need to duplicate resource files.
Preparation
------------------
Please change the SCM connection in the pom.xml:
<scm>
<!-- TODO: Change this to your SCM URL -->
<connection>scm:git:https://github.com/4treesCH/strolch.git</connection>
<developerConnection>scm:git:https://github.com/4treesCH/strolch.git</developerConnection>
<url>https://github.com/4treesCH/strolch</url>
</scm>
Running tests
-------------------------
mvn clean test
Running App
--------------------------
mvn clean compile
mvn exec:java

View File

@ -0,0 +1,247 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<name>${appName}</name>
<version>${version}</version>
<packaging>jar</packaging>
<scm>
<!-- TODO: Change this to your SCM URL -->
<connection>scm:git:https://github.com/4treesCH/strolch.git</connection>
<developerConnection>scm:git:https://github.com/4treesCH/strolch.git</developerConnection>
<url>https://github.com/4treesCH/strolch</url>
</scm>
<properties>
<appFinalName>${artifactId}</appFinalName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
<buildTimestamp>${maven.build.timestamp}</buildTimestamp>
<jdk.version>17</jdk.version>
<!-- compile time dependencies -->
<slf4j.version>1.7.30</slf4j.version>
<logback.version>1.2.9</logback.version>
<gson.version>2.8.9</gson.version>
<strolch.version>1.7.0-SNAPSHOT</strolch.version>
<!-- test time dependencies -->
<junit.version>4.13.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
<!-- maven plug-in dependencies -->
<maven-scm-plugin.version>1.12.2</maven-scm-plugin.version>
<buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
<versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-site-plugin.version>3.10.0</maven-site-plugin.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
<maven-deploy-plugin.version>3.0.0-M2</maven-deploy-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-dependency-plugin.version>3.2.0</maven-dependency-plugin.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-project-info-reports-plugin.version>3.1.2</maven-project-info-reports-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<nexus-staging-maven-plugin.version>1.6.12</nexus-staging-maven-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
<archetype-packaging.version>3.2.0</archetype-packaging.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.bom</artifactId>
<type>pom</type>
<version>${strolch.version}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- base -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- strolch -->
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.model</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.agent</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.service</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.testbase</artifactId>
<scope>test</scope>
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${appFinalName}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-Xlint:all</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<configuration>
<mainClass>${package}.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- for dev: always enable strolch environment "dev" -->
<profile>
<id>dev.local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<strolch.env>dev</strolch.env>
</properties>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<Privilege>
<Container>
<Parameters>
<!-- parameters for the container itself -->
<Parameter name="secretKey" value="CHANGE-ME-1"/>
<Parameter name="secretSalt" value="CHANGE-ME-2"/>
<Parameter name="persistSessions" value="true"/>
<Parameter name="autoPersistOnUserChangesData" value="true"/>
<Parameter name="privilegeConflictResolution" value="MERGE"/>
<Parameter name="allowSessionRefresh" value="true"/>
</Parameters>
<EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler">
<Parameters>
<!-- WARNING: If you change iterations or keyLength, then all passwords are invalid -->
<!-- default algorithm is: PBKDF2WithHmacSHA512 -->
<Parameter name="hashAlgorithm" value="PBKDF2WithHmacSHA512"/>
<!-- default iterations: 200000 -->
<Parameter name="hashIterations" value="10000"/>
<!-- default key length: 256 -->
<Parameter name="hashKeyLength" value="256"/>
</Parameters>
</EncryptionHandler>
<PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler">
<Parameters>
<Parameter name="usersXmlFile" value="PrivilegeUsers.xml"/>
<Parameter name="rolesXmlFile" value="PrivilegeRoles.xml"/>
</Parameters>
</PersistenceHandler>
<UserChallengeHandler class="li.strolch.privilege.handler.ConsoleUserChallengeHandler">
</UserChallengeHandler>
</Container>
<Policies>
<Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege"/>
<Policy name="ModelPrivilege" class="li.strolch.runtime.privilege.ModelPrivilege"/>
<Policy name="RoleAccessPrivilege" class="li.strolch.privilege.policy.RoleAccessPrivilege"/>
<Policy name="UserAccessPrivilege" class="li.strolch.privilege.policy.UserAccessPrivilege"/>
<Policy name="UserSessionAccessPrivilege" class="li.strolch.privilege.policy.UsernameFromCertificatePrivilege"/>
</Policies>
</Privilege>

View File

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<Roles>
<Role name="AppUser">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.report.ReportSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<!--
Internal
-->
<Role name="ModelAccessor">
<Privilege name="GetOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="StrolchAdmin">
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RequirePasswordChange" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.handler.operationslog.OperationsLog" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.report.ReportSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.job.StrolchJob" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.job.StrolchJobsHandler" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="UserPrivileges">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserPasswordService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserLocaleService</Allow>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege"/>
<Privilege name="PrivilegeSetUserLocale" policy="UserAccessPrivilege"/>
</Role>
<Role name="PrivilegeAdmin">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<Allow>li.strolch.service.privilege.users.PrivilegeUpdateUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeUpdateUserRolesService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserPasswordService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserLocaleService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeRemoveUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeRemoveRoleFromUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeAddUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeAddRoleToUserService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeUpdateRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeRemoveRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeRemovePrivilegeFromRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeAddRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeAddOrReplacePrivilegeOnRoleService</Allow>
</Privilege>
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="InvalidateSession" policy="UserSessionAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RequirePasswordChange" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserLocale" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeAction" policy="DefaultPrivilege">
<Allow>Reload</Allow>
<Allow>GetPolicies</Allow>
<Allow>Persist</Allow>
<Allow>GetCertificates</Allow>
<Allow>PersistSessions</Allow>
</Privilege>
<Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserState" policy="UserAccessPrivilege">
<Deny>SYSTEM</Deny>
<Allow>DISABLED</Allow>
<Allow>ENABLED</Allow>
</Privilege>
<Privilege name="PrivilegeAddRoleToUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeGetRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetSession" policy="UserSessionAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveRoleFromUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeAddRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="agent">
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege">
<Allow>li.strolch.runtime.privilege.StrolchSystemAction</Allow>
<Allow>li.strolch.runtime.privilege.StrolchSystemActionWithResult</Allow>
<Allow>li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer</Allow>
</Privilege>
<Privilege name="PrivilegeAction" policy="DefaultPrivilege">
<Allow>Persist</Allow>
<Allow>GetCertificates</Allow>
<Allow>PersistSessions</Allow>
</Privilege>
<Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
</Roles>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<!-- Password: admin -->
<User userId="1" username="bob" password="cb69962946617da006a2f95776d78b49e5ec7941d2bdb2d25cdb05f957f64344" salt="61646d696e">
<Firstname>User</Firstname>
<Lastname>Bob</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>AppUser</Role>
<Role>ModelAccessor</Role>
<Role>UserPrivileges</Role>
</Roles>
<Properties>
<Property name="organization" value="strolch.li"/>
<Property name="organizationalUnit" value="Development"/>
</Properties>
</User>
<!-- Password: admin -->
<User userId="1" username="admin" password="cb69962946617da006a2f95776d78b49e5ec7941d2bdb2d25cdb05f957f64344" salt="61646d696e">
<Firstname>Application</Firstname>
<Lastname>Administrator</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>StrolchAdmin</Role>
<Role>ModelAccessor</Role>
<Role>PrivilegeAdmin</Role>
</Roles>
<Properties>
<Property name="organization" value="strolch.li"/>
<Property name="organizationalUnit" value="Development"/>
</Properties>
</User>
<User userId="0" username="agent">
<State>SYSTEM</State>
<Roles>
<Role>ModelAccessor</Role>
<Role>PrivilegeAdmin</Role>
<Role>agent</Role>
</Roles>
</User>
</Users>

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchConfiguration>
<env id="dev">
<Runtime>
<applicationName>${appName}</applicationName>
<Properties>
<locale>en</locale>
<verbose>true</verbose>
<timezone>Europe/Zurich</timezone>
</Properties>
</Runtime>
<Component>
<name>PrivilegeHandler</name>
<api>li.strolch.runtime.privilege.PrivilegeHandler</api>
<impl>li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</impl>
<Properties>
<privilegeConfigFile>PrivilegeConfig.xml</privilegeConfigFile>
</Properties>
</Component>
<Component>
<name>RealmHandler</name>
<api>li.strolch.agent.api.RealmHandler</api>
<impl>li.strolch.agent.impl.DefaultRealmHandler</impl>
<depends>PrivilegeHandler</depends>
<Properties>
<realms>defaultRealm</realms>
<dataStoreMode>TRANSIENT</dataStoreMode>
<dataStoreFile>Model.xml</dataStoreFile>
<enableObserverUpdates>true</enableObserverUpdates>
</Properties>
</Component>
<Component>
<name>EnumHandler</name>
<api>li.strolch.runtime.query.enums.EnumHandler</api>
<impl>li.strolch.runtime.query.enums.DefaultEnumHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>ServiceHandler</name>
<api>li.strolch.service.api.ServiceHandler</api>
<impl>li.strolch.service.api.DefaultServiceHandler</impl>
<depends>RealmHandler</depends>
<depends>PrivilegeHandler</depends>
<Properties>
<verbose>true</verbose>
</Properties>
</Component>
<Component>
<name>PolicyHandler</name>
<api>li.strolch.policy.PolicyHandler</api>
<impl>li.strolch.policy.DefaultPolicyHandler</impl>
<Properties>
<readPolicyFile>true</readPolicyFile>
</Properties>
</Component>
<Component>
<name>MigrationsHandler</name>
<api>li.strolch.migrations.MigrationsHandler</api>
<impl>li.strolch.migrations.MigrationsHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>OperationsLog</name>
<api>li.strolch.handler.operationslog.OperationsLog</api>
<impl>li.strolch.handler.operationslog.OperationsLog</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>StrolchJobsHandler</name>
<api>li.strolch.job.StrolchJobsHandler</api>
<impl>li.strolch.job.StrolchJobsHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>PostInitializer</name>
<api>li.strolch.agent.api.PostInitializer</api>
<impl>${package}.PostInitializer</impl>
<depends>ServiceHandler</depends>
<Properties>
</Properties>
</Component>
<Component>
<name>ExecutionHandler</name>
<api>li.strolch.execution.ExecutionHandler</api>
<impl>li.strolch.execution.EventBasedExecutionHandler</impl>
<depends>PostInitializer</depends>
<Properties>
<restartExecution>true</restartExecution>
</Properties>
</Component>
</env>
</StrolchConfiguration>

View File

@ -0,0 +1,3 @@
<StrolchPolicies>
</StrolchPolicies>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel.xsd">
<Resource Id="yellowBall" Name="Yellow Ball" Type="Ball">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="color" Name="Color" Type="String" Value="yellow"/>
</ParameterBag>
</Resource>
</StrolchModel>

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>This is Version 1.6.x of the StrolchModel XSD.</xs:documentation>
</xs:annotation>
<xs:element name="StrolchModel" type="StrolchModelType"/>
<xs:complexType name="StrolchModelType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="IncludeFileType" name="IncludeFile" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="OrderType" name="Order" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ResourceType" name="Resource" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IncludeFileType">
<xs:attribute type="xs:string" name="file"/>
</xs:complexType>
<xs:complexType name="VersionType">
<xs:attribute type="xs:int" name="Version" use="required"/>
<xs:attribute type="xs:string" name="CreatedBy" use="required"/>
<xs:attribute type="xs:string" name="UpdatedBy" use="required"/>
<xs:attribute type="xs:dateTime" name="Created" use="required"/>
<xs:attribute type="xs:dateTime" name="Updated" use="required"/>
<xs:attribute type="xs:string" name="Deleted" use="required"/>
</xs:complexType>
<xs:complexType name="OrderType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:dateTime" name="Date" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
</xs:complexType>
<xs:complexType name="ResourceType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="TimedStateType" name="TimedState" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ActivityType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="ActionType" name="Action" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="TimeOrderingType" name="TimeOrdering" use="required"/>
</xs:complexType>
<xs:complexType name="ActionType">
<xs:sequence>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
<xs:element type="ValueChangeType" name="ValueChange" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="ResourceId" use="optional"/>
<xs:attribute type="xs:string" name="ResourceType" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterBagType">
<xs:sequence>
<xs:element type="ParameterType" name="Parameter" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="ParameterValueType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="optional"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PoliciesType">
<xs:sequence>
<xs:element type="PolicyType" name="Policy" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PolicyType">
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="TimedStateType">
<xs:sequence>
<xs:element type="ValueType" name="Value" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:complexType>
<xs:complexType name="ValueType">
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="ValueChangeType">
<xs:attribute type="xs:string" name="StateId" use="optional"/>
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:enumeration value="Created"/>
<xs:enumeration value="Planning"/>
<xs:enumeration value="Planned"/>
<xs:enumeration value="Execution"/>
<xs:enumeration value="Stopped"/>
<xs:enumeration value="Warning"/>
<xs:enumeration value="Error"/>
<xs:enumeration value="Executed"/>
<xs:enumeration value="Closed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimeOrderingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Series"/>
<xs:enumeration value="Parallel"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="String"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Date"/>
<xs:enumeration value="Duration"/>
<xs:enumeration value="StringList"/>
<xs:enumeration value="IntegerList"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="LongList"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimedStateTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="StringSet"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -0,0 +1,50 @@
package ${package};
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.api.StrolchBootstrapper;
import li.strolch.runtime.configuration.StrolchEnvironment;
import li.strolch.utils.helper.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class);
private static final String APP_NAME = "${appName}";
private static StrolchAgent agent;
public static void main(String[] args) throws Throwable {
logger.info("Starting " + APP_NAME + "...");
long start = System.currentTimeMillis();
try {
// find environment from ENV.properties
String env = StrolchEnvironment.getEnvironmentFromResourceEnv(Main.class);
// and now start by system properties user.dir
StrolchBootstrapper bootstrapper = new StrolchBootstrapper(Main.class);
Main.agent = bootstrapper.setupByUserDir(env, "runtime");
Main.agent.initialize();
Main.agent.start();
} catch (Throwable e) {
logger.error("Failed to start " + APP_NAME + " due to: " + e.getMessage(), e);
throw e;
}
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
Thread.sleep(200);
System.out.println("Shutting down ...");
Main.agent.stop();
Main.agent.destroy();
} catch (InterruptedException e) {
logger.error("Failed to stop " + APP_NAME + " due to " + e.getMessage(), e);
}
}));
long took = System.currentTimeMillis() - start;
logger.info("Started " + APP_NAME + " in " + (StringHelper.formatMillisecondsDuration(took)));
}
}

View File

@ -0,0 +1,87 @@
package ${package};
import java.util.concurrent.TimeUnit;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.impl.SimplePostInitializer;
import li.strolch.execution.ArchiveExecutedActivitiesJob;
import li.strolch.execution.ExecutionHandler;
import li.strolch.handler.mail.MailHandler;
import li.strolch.job.JobMode;
import li.strolch.job.StrolchJobsHandler;
import li.strolch.policy.ReloadPoliciesJob;
import li.strolch.policy.ReloadPrivilegeHandlerJob;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import li.strolch.utils.helper.ExceptionHelper;
public class PostInitializer extends SimplePostInitializer {
public PostInitializer(ComponentContainer container, String componentName) {
super(container, componentName);
}
@Override
public void start() throws Exception {
registerJobs();
notifyStart();
super.start();
}
private void registerJobs() throws Exception {
if (!getContainer().hasComponent(StrolchJobsHandler.class))
return;
StrolchJobsHandler jobsHandler = getComponent(StrolchJobsHandler.class);
// Manually triggered jobs to run once on startup
// jobsHandler.register(XXX.class).runNow();
// special jobs which are triggered by an admin, and not run at startup
jobsHandler.register(ReloadPoliciesJob.class);
jobsHandler.register(ReloadPrivilegeHandlerJob.class);
// recurring jobs
// jobsHandler.registerAndScheduleJob(XXX.class);
if (getContainer().hasComponent(ExecutionHandler.class)) {
StrolchAgent agent = getContainer().getAgent();
ArchiveExecutedActivitiesJob archiveExecutedActivitiesJob = new ArchiveExecutedActivitiesJob(agent,
JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS);
jobsHandler.register(archiveExecutedActivitiesJob).runNow();
}
}
private void notifyStart() {
if (!(getConfiguration().getBoolean("notifyStart", Boolean.FALSE) && getContainer()
.hasComponent(MailHandler.class)))
return;
String recipients = getConfiguration().getString("notifyStartRecipients", "");
if (recipients.isEmpty()) {
logger.error("config param notifyStartRecipients is empty, can not notify of boot!");
return;
}
StrolchAgent agent = getContainer().getAgent();
RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration();
String subject = runtimeConfiguration.getApplicationName() + ":" + runtimeConfiguration.getEnvironment()
+ " Startup Complete!";
String body = "Dear User\n\n" //
+ "The " + getConfiguration().getRuntimeConfiguration().getApplicationName()
+ " Server has just completed startup with version " //
+ agent.getVersion().getAppVersion().getArtifactVersion() //
+ "\n\n" //
+ "\tYour Server.";
try {
getContainer().getComponent(MailHandler.class).sendMail(subject, body, recipients);
} catch (Exception e) {
logger.error("Notifying of server startup failed: " + ExceptionHelper.getRootCause(e), e);
}
}
}

View File

@ -0,0 +1,6 @@
groupId=${project.groupId}
artifactId=${project.artifactId}
artifactVersion=${project.version}
scmRevision=${buildNumber}
scmBranch=${scmBranch}
buildTimestamp=${buildTimestamp}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d [%thread] %-5level %class{36}:%line %method - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,49 @@
package ${package};
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import li.strolch.model.Resource;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
import li.strolch.testbase.runtime.RuntimeMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class SimpleTest {
private static final String SRC_PATH = "src/test/resources/runtime-SimpleTest";
private static final String TARGET_PATH = "target/" + SimpleTest.class;
private static RuntimeMock runtimeMock;
private static Certificate certificate;
@BeforeClass
public static void beforeClass() {
runtimeMock = new RuntimeMock().mockRuntime(TARGET_PATH, SRC_PATH);
runtimeMock.startContainer();
certificate = runtimeMock.loginTest();
}
@AfterClass
public static void afterClass() {
if (certificate != null)
runtimeMock.logout(certificate);
if (runtimeMock != null)
runtimeMock.destroyRuntime();
}
@Test
public void shouldLoadIntoRealm() {
try (StrolchTransaction tx = runtimeMock.openUserTx(certificate, true)) {
Resource ball = tx.getResourceBy("Ball", "yellowBall", true);
assertTrue(ball.hasParameter("parameters", "color"));
assertEquals("yellow", ball.getParameter("parameters", "color", true).getValue());
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d [%thread] %-5level %class{36}:%line %method - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<Privilege>
<Container>
<Parameters>
<!-- parameters for the container itself -->
<Parameter name="secretKey" value="CHANGE-ME-1"/>
<Parameter name="secretSalt" value="CHANGE-ME-2"/>
<Parameter name="persistSessions" value="true"/>
<Parameter name="autoPersistOnUserChangesData" value="true"/>
<Parameter name="privilegeConflictResolution" value="MERGE"/>
</Parameters>
<EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler">
<Parameters>
<!-- WARNING: If you change iterations or keyLength, then all passwords are invalid -->
<!-- default algorithm is: PBKDF2WithHmacSHA512 -->
<Parameter name="hashAlgorithm" value="PBKDF2WithHmacSHA512"/>
<!-- default iterations: 200000 -->
<Parameter name="hashIterations" value="10000"/>
<!-- default key length: 256 -->
<Parameter name="hashKeyLength" value="256"/>
</Parameters>
</EncryptionHandler>
<PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler">
<Parameters>
<Parameter name="usersXmlFile" value="PrivilegeUsers.xml"/>
<Parameter name="rolesXmlFile" value="PrivilegeRoles.xml"/>
</Parameters>
</PersistenceHandler>
<UserChallengeHandler class="li.strolch.privilege.handler.ConsoleUserChallengeHandler">
</UserChallengeHandler>
</Container>
<Policies>
<Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege"/>
<Policy name="ModelPrivilege" class="li.strolch.runtime.privilege.ModelPrivilege"/>
<Policy name="RoleAccessPrivilege" class="li.strolch.privilege.policy.RoleAccessPrivilege"/>
<Policy name="UserAccessPrivilege" class="li.strolch.privilege.policy.UserAccessPrivilege"/>
<Policy name="UserSessionAccessPrivilege" class="li.strolch.privilege.policy.UsernameFromCertificatePrivilege"/>
</Policies>
</Privilege>

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<Roles>
<Role name="agent">
<Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege">
<Allow>li.strolch.runtime.privilege.StrolchSystemAction</Allow>
<Allow>li.strolch.runtime.privilege.StrolchSystemActionWithResult</Allow>
<Allow>li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer</Allow>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="AppUser">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
</Roles>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<User userId="1" username="agent">
<State>SYSTEM</State>
<Roles>
<Role>agent</Role>
</Roles>
</User>
<!-- Password: admin -->
<User userId="3" username="test" password="fdd9d2def3475e1d5cc87107b87e14fd6adbca664c2874fc379a1e53931c0428" salt="74657374">
<Firstname>Application</Firstname>
<Lastname>Administrator</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>AppUser</Role>
</Roles>
<Properties>
<Property name="realm" value="defaultRealm" />
</Properties>
</User>
</Users>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchConfiguration>
<env id="dev">
<Runtime>
<applicationName>${appName}</applicationName>
<Properties>
<locale>en</locale>
<verbose>true</verbose>
</Properties>
</Runtime>
<Component>
<name>PrivilegeHandler</name>
<api>li.strolch.runtime.privilege.PrivilegeHandler</api>
<impl>li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</impl>
<Properties>
<privilegeConfigFile>PrivilegeConfig.xml</privilegeConfigFile>
</Properties>
</Component>
<Component>
<name>RealmHandler</name>
<api>li.strolch.agent.api.RealmHandler</api>
<impl>li.strolch.agent.impl.DefaultRealmHandler</impl>
<depends>PrivilegeHandler</depends>
<Properties>
<realms>defaultRealm</realms>
<dataStoreMode>TRANSIENT</dataStoreMode>
<dataStoreFile>Model.xml</dataStoreFile>
<enableObserverUpdates>true</enableObserverUpdates>
</Properties>
</Component>
<Component>
<name>ServiceHandler</name>
<api>li.strolch.service.api.ServiceHandler</api>
<impl>li.strolch.service.api.DefaultServiceHandler</impl>
<depends>RealmHandler</depends>
<depends>PrivilegeHandler</depends>
<Properties>
<verbose>true</verbose>
</Properties>
</Component>
<Component>
<name>PostInitializer</name>
<api>li.strolch.agent.api.PostInitializer</api>
<impl>${package}.PostInitializer</impl>
<depends>ServiceHandler</depends>
<Properties>
</Properties>
</Component>
</env>
</StrolchConfiguration>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel.xsd">
<!-- include root model here -->
<IncludeFile file="../../../runtime/data/Model.xml"/>
<!-- add test specific model data here -->
</StrolchModel>

View File

@ -0,0 +1,5 @@
target/
.project
.settings
.classpath
*.iml

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>li.strolch</groupId>
<artifactId>li.strolch-maven-archetypes</artifactId>
<version>0.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>li.strolch.mvn.archetype.webapp</artifactId>
<packaging>maven-archetype</packaging>
<distributionManagement>
<site>
<id>localhost</id>
<url>file://${project.basedir}/../target/${project.artifactId}</url>
</site>
</distributionManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${archetype-packaging.version}</version>
</extension>
</extensions>
</build>
</project>

View File

@ -0,0 +1,63 @@
<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0
http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="li.strolch.mvn.archetype.webapp">
<requiredProperties>
<requiredProperty key="appName">
<defaultValue>Strolch App</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/test/resources</directory>
</fileSet>
<fileSet filtered="false" encoding="UTF-8">
<directory>src/main/webapp/</directory>
<excludes>
<exclude>bower.json</exclude>
<exclude>package.json</exclude>
<exclude>locales.json</exclude>
<exclude>app/index.html</exclude>
<exclude>app/src/behaviors/c-app-behavior.html</exclude>
<exclude>app/src/main/c-drawer.html</exclude>
</excludes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/webapp/</directory>
<includes>
<include>bower.json</include>
<include>package.json</include>
<include>locales.json</include>
<include>app/index.html</include>
<include>app/src/behaviors/c-app-behavior.html</include>
<include>app/src/main/c-drawer.html</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>runtime</directory>
</fileSet>
<!-- <fileSet filtered="true" encoding="UTF-8">-->
<!-- <directory></directory>-->
<!-- <includes>-->
<!-- <include>README.md</include>-->
<!-- </includes>-->
<!-- <excludes>-->
<!-- <exclude>runtime/*</exclude>-->
<!-- <exclude>src/*</exclude>-->
<!-- </excludes>-->
<!-- </fileSet>-->
</fileSets>
</archetype-descriptor>

View File

@ -0,0 +1,61 @@
Strolch Project: ${appName} / ${artifactId}
======================================
This is a Strolch project which is started by a servlet container as this
project builds WARs.
The project's runtime directory is in the root folder and contains the
configuration and data files needed to start via the `StartupListener`.
The test has it's own runtime directory, with its own configuration, but the
model file in the data directory points to the main runtime directory and uses
that model file, so that one does not need to duplicate resource files.
Preparation
------------------
Please change the SCM connection in the pom.xml:
<scm>
<!-- TODO: Change this to your SCM URL -->
<connection>scm:git:https://github.com/strolch-li/strolch.git</connection>
<developerConnection>scm:git:https://github.com/strolch-li/strolch.git</developerConnection>
<url>https://github.com/strolch-li/strolch</url>
</scm>
Before you are able to start the app, you need to update the path in the
`StrolchBootstrap.xml` file in web `src/main/webapp/WEB-INF`. There add a new
environment with the following format:
<env id="dev.${username}" default="true">
<root>${path.to.runtime.directory}</root>
<environment>dev</environment>
</env>
Now install web dependencies:
cd src/main/webapp
npm install
gulp
Running tests
-------------------------
mvn clean test
Building WAR
--------------------------
Without compressing the web files:
mvn clean package
With compressing the web files for local runtime:
mvn clean package -Prelease -Pdev.local
And if you want to prepare for deployment, which uses a different environment:
mvn clean package -Prelease -Dstrolch.env=<env from StrolchBootstrap.xml>

View File

@ -0,0 +1,432 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<name>${appName}</name>
<version>${version}</version>
<packaging>war</packaging>
<scm>
<!-- TODO: Change this to your SCM URL -->
<connection>scm:git:https://github.com/strolch-li/strolch.git</connection>
<developerConnection>scm:git:https://github.com/strolch-li/strolch.git</developerConnection>
<url>https://github.com/strolch-li/strolch</url>
</scm>
<properties>
<appFinalName>${artifactId}</appFinalName>
<warFinalName>${artifactId}</warFinalName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
<buildTimestamp>${maven.build.timestamp}</buildTimestamp>
<jdk.version>17</jdk.version>
<!-- compile time dependencies -->
<slf4j.version>1.7.30</slf4j.version>
<logback.version>1.2.9</logback.version>
<jersey.version>2.34</jersey.version>
<gson.version>2.8.9</gson.version>
<hikaricp.version>5.0.0</hikaricp.version>
<postgresql.version>42.4.1</postgresql.version>
<antlr.version>4.9.3</antlr.version>
<annotation.version>1.3.2</annotation.version>
<activation.version>1.1.1</activation.version>
<javaxmail.version>1.6.2</javaxmail.version>
<serverlet.version>4.0.1</serverlet.version>
<jaxrs.api.version>2.1.1</jaxrs.api.version>
<jaxrs.ri.version>2.35</jaxrs.ri.version>
<jaxb.api.version>2.3.1</jaxb.api.version>
<jaxws.version>2.3.3</jaxws.version>
<jakarta.jws-api.version>2.1.0</jakarta.jws-api.version>
<jaxp.version>1.4.2</jaxp.version>
<tyrus.version>1.17</tyrus.version>
<grizzly.version>2.4.4</grizzly.version>
<websocket.version>1.1</websocket.version>
<sax.version>2.0.1</sax.version>
<csv.version>1.9.0</csv.version>
<cron.version>1.6.2</cron.version>
<!-- test time dependencies -->
<junit.version>4.13.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
<!-- strolch -->
<strolch.version>1.8.0-SNAPSHOT</strolch.version>
<!-- maven plug-in dependencies -->
<maven-scm-plugin.version>1.12.2</maven-scm-plugin.version>
<buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
<versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-site-plugin.version>3.10.0</maven-site-plugin.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
<maven-deploy-plugin.version>3.0.0-M2</maven-deploy-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-dependency-plugin.version>3.2.0</maven-dependency-plugin.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-project-info-reports-plugin.version>3.1.2</maven-project-info-reports-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<nexus-staging-maven-plugin.version>1.6.12</nexus-staging-maven-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
<archetype-packaging.version>3.2.0</archetype-packaging.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.bom</artifactId>
<type>pom</type>
<version>${strolch.version}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<!-- Restful API -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${serverlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${jaxrs.api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.bundles</groupId>
<artifactId>jaxrs-ri</artifactId>
<version>${jaxrs.ri.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
<version>${tyrus.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-client</artifactId>
<version>${tyrus.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-server</artifactId>
<version>${tyrus.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-framework</artifactId>
<version>${grizzly.version}</version>
</dependency>
<!-- websocket -->
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>${websocket.version}</version>
<scope>provided</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- base -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- strolch -->
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.model</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.agent</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.rest</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.service</artifactId>
</dependency>
<dependency>
<groupId>li.strolch</groupId>
<artifactId>li.strolch.testbase</artifactId>
<scope>test</scope>
</dependency>
<!-- web -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.bundles</groupId>
<artifactId>jaxrs-ri</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-client</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-framework</artifactId>
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${appFinalName}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>StrolchBootstrap.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>StrolchBootstrap.xml</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-Xlint:all</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${warFinalName}</warName>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- for dev: always enable strolch environment "dev" -->
<profile>
<id>dev.local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<strolch.env>dev.local</strolch.env>
</properties>
</profile>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/app/bower_components</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-gulp</id>
<phase>generate-sources</phase>
<configuration>
<executable>gulp</executable>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${warFinalName}</warName>
<packagingExcludes>app/**/*,node_modules/**/*</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<Privilege>
<Container>
<Parameters>
<!-- parameters for the container itself -->
<Parameter name="secretKey" value="CHANGE-ME-1"/>
<Parameter name="secretSalt" value="CHANGE-ME-2"/>
<Parameter name="persistSessions" value="true"/>
<Parameter name="autoPersistOnUserChangesData" value="false"/>
<Parameter name="privilegeConflictResolution" value="MERGE"/>
<Parameter name="allowSessionRefresh" value="true"/>
</Parameters>
<EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler">
<Parameters>
<!-- WARNING: If you change iterations or keyLength, then all passwords are invalid -->
<!-- default algorithm is: PBKDF2WithHmacSHA512 -->
<Parameter name="hashAlgorithm" value="PBKDF2WithHmacSHA512"/>
<!-- default iterations: 200000 -->
<Parameter name="hashIterations" value="10000"/>
<!-- default key length: 256 -->
<Parameter name="hashKeyLength" value="256"/>
</Parameters>
</EncryptionHandler>
<PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler">
<Parameters>
<Parameter name="usersXmlFile" value="PrivilegeUsers.xml"/>
<Parameter name="rolesXmlFile" value="PrivilegeRoles.xml"/>
</Parameters>
</PersistenceHandler>
<UserChallengeHandler class="li.strolch.privilege.handler.ConsoleUserChallengeHandler">
</UserChallengeHandler>
</Container>
<Policies>
<Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege"/>
<Policy name="ModelPrivilege" class="li.strolch.runtime.privilege.ModelPrivilege"/>
<Policy name="RoleAccessPrivilege" class="li.strolch.privilege.policy.RoleAccessPrivilege"/>
<Policy name="UserAccessPrivilege" class="li.strolch.privilege.policy.UserAccessPrivilege"/>
<Policy name="UserSessionAccessPrivilege" class="li.strolch.privilege.policy.UsernameFromCertificatePrivilege"/>
</Policies>
</Privilege>

View File

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<Roles>
<Role name="AppUser">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<Allow>${package}.service.CreateBookService</Allow>
<Allow>${package}.service.UpdateBookService</Allow>
<Allow>${package}.service.RemoveBookService</Allow>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<Allow>internal</Allow>
<Allow>${package}.search.BookSearch</Allow>
</Privilege>
<Privilege name="li.strolch.report.ReportSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<!--
Internal
-->
<Role name="I18nAdmin">
<Privilege name="I18n" policy="DefaultPrivilege">
<Allow>Get</Allow>
<Allow>Update</Allow>
</Privilege>
</Role>
<Role name="ModelAccessor">
<Privilege name="GetOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="StrolchAdmin">
<Privilege name="I18n" policy="DefaultPrivilege">
<Allow>Get</Allow>
<Allow>Update</Allow>
</Privilege>
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RequirePasswordChange" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.handler.operationslog.OperationsLog" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.report.ReportSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.job.StrolchJob" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.job.StrolchJobsHandler" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="UserPrivileges">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserPasswordService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserLocaleService</Allow>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege"/>
<Privilege name="PrivilegeSetUserLocale" policy="UserAccessPrivilege"/>
</Role>
<Role name="PrivilegeAdmin">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<Allow>li.strolch.service.privilege.users.PrivilegeUpdateUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeUpdateUserRolesService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserPasswordService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeSetUserLocaleService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeRemoveUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeRemoveRoleFromUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeAddUserService</Allow>
<Allow>li.strolch.service.privilege.users.PrivilegeAddRoleToUserService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeUpdateRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeRemoveRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeRemovePrivilegeFromRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeAddRoleService</Allow>
<Allow>li.strolch.service.privilege.roles.PrivilegeAddOrReplacePrivilegeOnRoleService</Allow>
</Privilege>
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="InvalidateSession" policy="UserSessionAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RequirePasswordChange" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserLocale" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeAction" policy="DefaultPrivilege">
<Allow>Reload</Allow>
<Allow>GetPolicies</Allow>
<Allow>Persist</Allow>
<Allow>GetCertificates</Allow>
<Allow>PersistSessions</Allow>
</Privilege>
<Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeSetUserState" policy="UserAccessPrivilege">
<Deny>SYSTEM</Deny>
<Allow>DISABLED</Allow>
<Allow>ENABLED</Allow>
</Privilege>
<Privilege name="PrivilegeAddRoleToUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeGetRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetSession" policy="UserSessionAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveRoleFromUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeAddRole" policy="RoleAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="agent">
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege">
<Allow>li.strolch.runtime.privilege.StrolchSystemAction</Allow>
<Allow>li.strolch.runtime.privilege.StrolchSystemActionWithResult</Allow>
<Allow>li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer</Allow>
</Privilege>
<Privilege name="PrivilegeAction" policy="DefaultPrivilege">
<Allow>Persist</Allow>
<Allow>GetCertificates</Allow>
<Allow>PersistSessions</Allow>
</Privilege>
<Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
</Roles>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<!-- Password: admin -->
<User userId="1" username="bob" password="cb69962946617da006a2f95776d78b49e5ec7941d2bdb2d25cdb05f957f64344" salt="61646d696e">
<Firstname>User</Firstname>
<Lastname>Bob</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>AppUser</Role>
<Role>ModelAccessor</Role>
<Role>UserPrivileges</Role>
</Roles>
<Properties>
<Property name="organization" value="strolch.li"/>
<Property name="organizationalUnit" value="Development"/>
</Properties>
</User>
<!-- Password: admin -->
<User userId="1" username="admin" password="cb69962946617da006a2f95776d78b49e5ec7941d2bdb2d25cdb05f957f64344" salt="61646d696e">
<Firstname>Application</Firstname>
<Lastname>Administrator</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>StrolchAdmin</Role>
<Role>ModelAccessor</Role>
<Role>PrivilegeAdmin</Role>
</Roles>
<Properties>
<Property name="organization" value="strolch.li"/>
<Property name="organizationalUnit" value="Development"/>
</Properties>
</User>
<User userId="0" username="agent">
<State>SYSTEM</State>
<Roles>
<Role>ModelAccessor</Role>
<Role>PrivilegeAdmin</Role>
<Role>agent</Role>
</Roles>
</User>
</Users>

View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchConfiguration>
<env id="global">
<Runtime>
<applicationName>${appName}</applicationName>
<Properties>
<locale>en</locale>
<verbose>true</verbose>
<timezone>Europe/Zurich</timezone>
</Properties>
</Runtime>
<Component>
<name>PrivilegeHandler</name>
<api>li.strolch.runtime.privilege.PrivilegeHandler</api>
<impl>li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</impl>
<Properties>
<privilegeConfigFile>PrivilegeConfig.xml</privilegeConfigFile>
</Properties>
</Component>
<Component>
<name>RealmHandler</name>
<api>li.strolch.agent.api.RealmHandler</api>
<impl>li.strolch.agent.impl.DefaultRealmHandler</impl>
<depends>PrivilegeHandler</depends>
<Properties>
<realms>defaultRealm</realms>
<dataStoreMode>TRANSIENT</dataStoreMode>
<dataStoreFile>Model.xml</dataStoreFile>
<enableObserverUpdates>true</enableObserverUpdates>
</Properties>
</Component>
<Component>
<name>EnumHandler</name>
<api>li.strolch.runtime.query.enums.EnumHandler</api>
<impl>li.strolch.runtime.query.enums.DefaultEnumHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>ServiceHandler</name>
<api>li.strolch.service.api.ServiceHandler</api>
<impl>li.strolch.service.api.DefaultServiceHandler</impl>
<depends>RealmHandler</depends>
<depends>PrivilegeHandler</depends>
<Properties>
<verbose>true</verbose>
</Properties>
</Component>
<Component>
<name>PolicyHandler</name>
<api>li.strolch.policy.PolicyHandler</api>
<impl>li.strolch.policy.DefaultPolicyHandler</impl>
<Properties>
<readPolicyFile>true</readPolicyFile>
</Properties>
</Component>
<Component>
<name>MigrationsHandler</name>
<api>li.strolch.migrations.MigrationsHandler</api>
<impl>li.strolch.migrations.MigrationsHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>OperationsLog</name>
<api>li.strolch.handler.operationslog.OperationsLog</api>
<impl>li.strolch.handler.operationslog.OperationsLog</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>StrolchJobsHandler</name>
<api>li.strolch.job.StrolchJobsHandler</api>
<impl>li.strolch.job.StrolchJobsHandler</impl>
<depends>RealmHandler</depends>
</Component>
<Component>
<name>SessionHandler</name>
<api>li.strolch.rest.StrolchSessionHandler</api>
<impl>li.strolch.rest.DefaultStrolchSessionHandler</impl>
<depends>PrivilegeHandler</depends>
<Properties>
<session.ttl.minutes>30</session.ttl.minutes>
<session.maxKeepAlive.minutes>10080</session.maxKeepAlive.minutes>
<session.reload>true</session.reload>
</Properties>
</Component>
<Component>
<name>RestfulHandler</name>
<api>li.strolch.rest.RestfulStrolchComponent</api>
<impl>li.strolch.rest.RestfulStrolchComponent</impl>
<depends>SessionHandler</depends>
<Properties>
<cookieMaxAge>30</cookieMaxAge>
<secureCookie>false</secureCookie>
</Properties>
</Component>
<Component>
<name>PostInitializer</name>
<api>li.strolch.agent.api.PostInitializer</api>
<impl>${package}.components.PostInitializer</impl>
<depends>RestfulHandler</depends>
<Properties>
</Properties>
</Component>
<Component>
<name>ExecutionHandler</name>
<api>li.strolch.execution.ExecutionHandler</api>
<impl>li.strolch.execution.EventBasedExecutionHandler</impl>
<depends>PostInitializer</depends>
<Properties>
<restartExecution>true</restartExecution>
</Properties>
</Component>
</env>
<env id="dev">
<!-- taken from global env -->
</env>
<env id="test">
<!-- taken from global env -->
</env>
</StrolchConfiguration>

View File

@ -0,0 +1,3 @@
<StrolchPolicies>
</StrolchPolicies>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel.xsd">
<Resource Id="location1" Name="Bücher Lüthy Solothurn" Type="Location">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="city" Name="City" Type="String" Value="Solothurn"/>
</ParameterBag>
<ParameterBag Id="stockBook1" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book1"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="8"/>
</ParameterBag>
<ParameterBag Id="stockBook2" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book2"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="7"/>
</ParameterBag>
</Resource>
<Resource Id="location2" Name="Buchhaus Stocker Luzern" Type="Location">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="city" Name="City" Type="String" Value="Luzern"/>
</ParameterBag>
<ParameterBag Id="stockBook3" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book3"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="5"/>
</ParameterBag>
<ParameterBag Id="stockBook4" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book4"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="8"/>
</ParameterBag>
</Resource>
<Resource Id="location3" Name="Bücher Lüthy Sihlcity Zürich" Type="Location">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="city" Name="City" Type="String" Value="Zürich"/>
</ParameterBag>
<ParameterBag Id="stockBook1" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book1"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="4"/>
</ParameterBag>
<ParameterBag Id="stockBook2" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book2"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="1"/>
</ParameterBag>
<ParameterBag Id="stockBook3" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book3"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="54"/>
</ParameterBag>
<ParameterBag Id="stockBook4" Name="Stock" Type="Stock">
<Parameter Id="book" Name="Book" Type="String" Interpretation="Resource-Ref" Uom="Book" Value="book4"/>
<Parameter Id="stock" Name="Stock" Type="Integer" Value="0"/>
</ParameterBag>
</Resource>
<Resource Id="book1" Name="The Road to Reality - Roger Penrose" Type="Book">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="author" Name="Author" Type="String" Value="Roger Penrose"/>
<Parameter Id="title" Name="Title" Type="String" Value="The Road to Reality"/>
</ParameterBag>
</Resource>
<Resource Id="book2" Name="The God Delusion - Richard Hawkins" Type="Book">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="author" Name="Author" Type="String" Value="Richard Hawkins"/>
<Parameter Id="title" Name="Title" Type="String" Value="The God Delusion"/>
</ParameterBag>
</Resource>
<Resource Id="book3" Name="It's Not Rocket Science - Ben Miller" Type="Book">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="author" Name="Author" Type="String" Value="Ben Miller"/>
<Parameter Id="title" Name="Title" Type="String" Value="It's Not Rocket Science"/>
</ParameterBag>
</Resource>
<Resource Id="book4" Name="Catching Fire - Richard Wrangham" Type="Book">
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
<Parameter Id="author" Name="Author" Type="String" Value="Richard Wrangham"/>
<Parameter Id="title" Name="Title" Type="String" Value="Catching Fire"/>
</ParameterBag>
</Resource>
</StrolchModel>

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>This is Version 1.6.x of the StrolchModel XSD.</xs:documentation>
</xs:annotation>
<xs:element name="StrolchModel" type="StrolchModelType"/>
<xs:complexType name="StrolchModelType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="IncludeFileType" name="IncludeFile" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="OrderType" name="Order" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ResourceType" name="Resource" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IncludeFileType">
<xs:attribute type="xs:string" name="file"/>
</xs:complexType>
<xs:complexType name="VersionType">
<xs:attribute type="xs:int" name="Version" use="required"/>
<xs:attribute type="xs:string" name="CreatedBy" use="required"/>
<xs:attribute type="xs:string" name="UpdatedBy" use="required"/>
<xs:attribute type="xs:dateTime" name="Created" use="required"/>
<xs:attribute type="xs:dateTime" name="Updated" use="required"/>
<xs:attribute type="xs:string" name="Deleted" use="required"/>
</xs:complexType>
<xs:complexType name="OrderType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:dateTime" name="Date" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
</xs:complexType>
<xs:complexType name="ResourceType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="TimedStateType" name="TimedState" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ActivityType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="ActionType" name="Action" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="TimeOrderingType" name="TimeOrdering" use="required"/>
</xs:complexType>
<xs:complexType name="ActionType">
<xs:sequence>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
<xs:element type="ValueChangeType" name="ValueChange" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="ResourceId" use="optional"/>
<xs:attribute type="xs:string" name="ResourceType" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterBagType">
<xs:sequence>
<xs:element type="ParameterType" name="Parameter" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="ParameterValueType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="optional"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PoliciesType">
<xs:sequence>
<xs:element type="PolicyType" name="Policy" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PolicyType">
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="TimedStateType">
<xs:sequence>
<xs:element type="ValueType" name="Value" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:complexType>
<xs:complexType name="ValueType">
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="ValueChangeType">
<xs:attribute type="xs:string" name="StateId" use="optional"/>
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:enumeration value="Created"/>
<xs:enumeration value="Planning"/>
<xs:enumeration value="Planned"/>
<xs:enumeration value="Execution"/>
<xs:enumeration value="Stopped"/>
<xs:enumeration value="Warning"/>
<xs:enumeration value="Error"/>
<xs:enumeration value="Executed"/>
<xs:enumeration value="Closed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimeOrderingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Series"/>
<xs:enumeration value="Parallel"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="String"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Date"/>
<xs:enumeration value="Duration"/>
<xs:enumeration value="StringList"/>
<xs:enumeration value="IntegerList"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="LongList"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimedStateTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="StringSet"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -0,0 +1,87 @@
package ${package}.components;
import java.util.concurrent.TimeUnit;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.impl.SimplePostInitializer;
import li.strolch.execution.ArchiveExecutedActivitiesJob;
import li.strolch.execution.ExecutionHandler;
import li.strolch.handler.mail.MailHandler;
import li.strolch.job.JobMode;
import li.strolch.job.StrolchJobsHandler;
import li.strolch.policy.ReloadPoliciesJob;
import li.strolch.policy.ReloadPrivilegeHandlerJob;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import li.strolch.utils.helper.ExceptionHelper;
public class PostInitializer extends SimplePostInitializer {
public PostInitializer(ComponentContainer container, String componentName) {
super(container, componentName);
}
@Override
public void start() throws Exception {
registerJobs();
notifyStart();
super.start();
}
private void registerJobs() throws Exception {
if (!getContainer().hasComponent(StrolchJobsHandler.class))
return;
StrolchJobsHandler jobsHandler = getComponent(StrolchJobsHandler.class);
// Manually triggered jobs to run once on startup
// jobsHandler.register(XXX.class).runNow();
// special jobs which are triggered by an admin, and not run at startup
jobsHandler.register(ReloadPoliciesJob.class);
jobsHandler.register(ReloadPrivilegeHandlerJob.class);
// recurring jobs
// jobsHandler.registerAndScheduleJob(XXX.class);
if (getContainer().hasComponent(ExecutionHandler.class)) {
StrolchAgent agent = getContainer().getAgent();
ArchiveExecutedActivitiesJob archiveExecutedActivitiesJob = new ArchiveExecutedActivitiesJob(agent,
JobMode.Recurring, 5, TimeUnit.MINUTES, 6, TimeUnit.HOURS);
jobsHandler.register(archiveExecutedActivitiesJob).runNow();
}
}
private void notifyStart() {
if (!(getConfiguration().getBoolean("notifyStart", Boolean.FALSE) && getContainer()
.hasComponent(MailHandler.class)))
return;
String recipients = getConfiguration().getString("notifyStartRecipients", "");
if (recipients.isEmpty()) {
logger.error("config param notifyStartRecipients is empty, can not notify of boot!");
return;
}
StrolchAgent agent = getContainer().getAgent();
RuntimeConfiguration runtimeConfiguration = agent.getStrolchConfiguration().getRuntimeConfiguration();
String subject = runtimeConfiguration.getApplicationName() + ":" + runtimeConfiguration.getEnvironment()
+ " Startup Complete!";
String body = "Dear User\n\n" //
+ "The " + getConfiguration().getRuntimeConfiguration().getApplicationName()
+ " Server has just completed startup with version " //
+ agent.getVersion().getAppVersion().getArtifactVersion() //
+ "\n\n" //
+ "\tYour Server.";
try {
getContainer().getComponent(MailHandler.class).sendMail(subject, body, recipients);
} catch (Exception e) {
logger.error("Notifying of server startup failed: " + ExceptionHelper.getRootCause(e), e);
}
}
}

View File

@ -0,0 +1,20 @@
package ${package}.model;
public class Constants {
public static final String TYPE_BOOK = "Book";
public static final String TYPE_LOCATION = "Location";
public static final String TYPE_STOCK = "Stock";
public static final String BAG_PARAMETERS = "parameters";
public static final String PARAM_STOCK = "stock";
public static final String PARAM_STOCKS = "stocks";
public static final String PARAM_BOOK = "book";
public static final String PARAM_BOOK_NAME = "bookName";
public static final String PARAM_AUTHOR = "author";
public static final String PARAM_TITLE = "title";
public static final String PARAM_CITY = "city";
}

View File

@ -0,0 +1,39 @@
package ${package}.model;
import static ${package}.model.Constants.*;
import java.util.Optional;
import com.google.gson.JsonArray;
import li.strolch.model.StrolchElement;
import li.strolch.model.json.StrolchRootElementToJsonVisitor;
import li.strolch.persistence.api.StrolchTransaction;
public class JsonVisitors {
public static StrolchRootElementToJsonVisitor toJson() {
return new StrolchRootElementToJsonVisitor().withoutPolicies();
}
public static StrolchRootElementToJsonVisitor flatToJson() {
return toJson().withoutVersion().flat();
}
public static StrolchRootElementToJsonVisitor bookToJson() {
return flatToJson();
}
public static StrolchRootElementToJsonVisitor stockBagToJson(StrolchTransaction tx) {
return flatToJson().bagHook((stockBag, stockJ) -> stockJ.addProperty(PARAM_BOOK_NAME,
Optional.ofNullable(tx.getResourceBy(stockBag.getParameter(PARAM_BOOK), false))
.map(StrolchElement::getName).orElse("???")));
}
public static StrolchRootElementToJsonVisitor locationToJson(StrolchTransaction tx) {
StrolchRootElementToJsonVisitor stockVisitor = stockBagToJson(tx);
return flatToJson().ignoreBagByType(TYPE_STOCK).resourceHook(
(location, locationJ) -> locationJ.add(PARAM_STOCKS,
location.streamOfParameterBagsByType(TYPE_STOCK).map(b -> b.accept(stockVisitor))
.collect(JsonArray::new, JsonArray::add, JsonArray::addAll)));
}
}

View File

@ -0,0 +1,157 @@
package ${package}.rest;
import static ${package}.model.Constants.*;
import static ${package}.model.JsonVisitors.bookToJson;
import static li.strolch.rest.StrolchRestfulConstants.*;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import ${package}.model.Constants;
import ${package}.model.JsonVisitors;
import ${package}.search.BookSearch;
import ${package}.service.CreateBookService;
import ${package}.service.RemoveBookService;
import ${package}.service.UpdateBookService;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import li.strolch.model.Resource;
import li.strolch.model.json.StrolchRootElementToJsonVisitor;
import li.strolch.model.visitor.ResourceVisitor;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
import li.strolch.rest.RestfulStrolchComponent;
import li.strolch.rest.StrolchRestfulConstants;
import li.strolch.rest.helper.ResponseUtil;
import li.strolch.service.JsonServiceArgument;
import li.strolch.service.JsonServiceResult;
import li.strolch.service.StringServiceArgument;
import li.strolch.service.api.ServiceHandler;
import li.strolch.service.api.ServiceResult;
import li.strolch.utils.collections.Paging;
@Path("books")
public class BooksResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response query(@Context HttpServletRequest request, @QueryParam("query") String query,
@DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("20") @QueryParam("limit") int limit) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// open the TX with the certificate, using this class as context
Paging<Resource> paging;
try (StrolchTransaction tx = RestfulStrolchComponent.getInstance().openTx(cert, getClass())) {
// perform a book search
paging = new BookSearch() //
.stringQuery(query) //
.search(tx) //
.orderByName(false) //
.toPaging(offset, limit);
}
return ResponseUtil.toResponse(paging, e -> e.accept(bookToJson()));
}
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response get(@Context HttpServletRequest request, @PathParam("id") String id) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// open the TX with the certificate, using this class as context
try (StrolchTransaction tx = RestfulStrolchComponent.getInstance().openTx(cert, getClass())) {
// get the book
Resource book = tx.getResourceBy(TYPE_BOOK, id, true);
// transform to JSON
JsonObject bookJ = book.accept(bookToJson());
// return
return ResponseUtil.toResponse(DATA, bookJ);
}
}
@POST
@Produces(MediaType.APPLICATION_JSON)
public Response create(@Context HttpServletRequest request, String data) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// parse data to JSON
JsonObject jsonData = JsonParser.parseString(data).getAsJsonObject();
// instantiate the service with the argument
CreateBookService svc = new CreateBookService();
JsonServiceArgument arg = svc.getArgumentInstance();
arg.jsonElement = jsonData;
// perform the service
ServiceHandler serviceHandler = RestfulStrolchComponent.getInstance().getServiceHandler();
JsonServiceResult result = serviceHandler.doService(cert, svc, arg);
// return depending on the result state
if (result.isOk())
return ResponseUtil.toResponse(DATA, result.getResult());
return ResponseUtil.toResponse(result);
}
@PUT
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response update(@Context HttpServletRequest request, @PathParam("id") String id, String data) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// parse data to JSON
JsonObject jsonData = JsonParser.parseString(data).getAsJsonObject();
// instantiate the service with the argument
UpdateBookService svc = new UpdateBookService();
JsonServiceArgument arg = svc.getArgumentInstance();
arg.objectId = id;
arg.jsonElement = jsonData;
// perform the service
ServiceHandler serviceHandler = RestfulStrolchComponent.getInstance().getServiceHandler();
JsonServiceResult result = serviceHandler.doService(cert, svc, arg);
// return depending on the result state
if (result.isOk())
return ResponseUtil.toResponse(DATA, result.getResult());
return ResponseUtil.toResponse(result);
}
@DELETE
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response remove(@Context HttpServletRequest request, @PathParam("id") String id) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// instantiate the service with the argument
RemoveBookService svc = new RemoveBookService();
StringServiceArgument arg = svc.getArgumentInstance();
arg.value = id;
// perform the service
ServiceHandler serviceHandler = RestfulStrolchComponent.getInstance().getServiceHandler();
ServiceResult result = serviceHandler.doService(cert, svc, arg);
// return depending on the result state
return ResponseUtil.toResponse(result);
}
}

View File

@ -0,0 +1,95 @@
package ${package}.rest;
import static ${package}.model.Constants.TYPE_LOCATION;
import static ${package}.model.JsonVisitors.locationToJson;
import static li.strolch.rest.StrolchRestfulConstants.DATA;
import static li.strolch.rest.StrolchRestfulConstants.STROLCH_CERTIFICATE;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import ${package}.search.LocationSearch;
import ${package}.service.RemoveLocationService;
import com.google.gson.JsonObject;
import li.strolch.model.Resource;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
import li.strolch.rest.RestfulStrolchComponent;
import li.strolch.rest.helper.ResponseUtil;
import li.strolch.service.StringServiceArgument;
import li.strolch.service.api.ServiceHandler;
import li.strolch.service.api.ServiceResult;
import li.strolch.utils.collections.Paging;
@Path("locations")
public class LocationsResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response query(@Context HttpServletRequest request, @QueryParam("query") String query,
@DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("20") @QueryParam("limit") int limit) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// open the TX with the certificate, using this class as context
Paging<JsonObject> paging;
try (StrolchTransaction tx = RestfulStrolchComponent.getInstance().openTx(cert, getClass())) {
// perform a book search
paging = new LocationSearch() //
.stringQuery(query) //
.search(tx) //
.orderByName(false) //
.map(l -> l.accept(locationToJson(tx))) //
.toPaging(offset, limit);
}
return ResponseUtil.toResponse(paging);
}
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response get(@Context HttpServletRequest request, @PathParam("id") String id) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// open the TX with the certificate, using this class as context
try (StrolchTransaction tx = RestfulStrolchComponent.getInstance().openTx(cert, getClass())) {
// get the book
Resource location = tx.getResourceBy(TYPE_LOCATION, id, true);
// transform to JSON
JsonObject locationJ = location.accept(locationToJson(tx));
// return
return ResponseUtil.toResponse(DATA, locationJ);
}
}
@DELETE
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response remove(@Context HttpServletRequest request, @PathParam("id") String id) {
// this is an authenticated method call, thus we can get the certificate from the request:
Certificate cert = (Certificate) request.getAttribute(STROLCH_CERTIFICATE);
// instantiate the service with the argument
RemoveLocationService svc = new RemoveLocationService();
StringServiceArgument arg = svc.getArgumentInstance();
arg.value = id;
// perform the service
ServiceHandler serviceHandler = RestfulStrolchComponent.getInstance().getServiceHandler();
ServiceResult result = serviceHandler.doService(cert, svc, arg);
// return depending on the result state
return ResponseUtil.toResponse(result);
}
}

View File

@ -0,0 +1,29 @@
package ${package}.search;
import static ${package}.model.Constants.*;
import static li.strolch.utils.helper.StringHelper.isEmpty;
import li.strolch.search.ResourceSearch;
public class BookSearch extends ResourceSearch {
public BookSearch() {
types(TYPE_BOOK);
}
public BookSearch stringQuery(String value) {
if (isEmpty(value))
return this;
// split by spaces
value = value.trim();
String[] values = value.split(" ");
// add where clauses for id, name and description
where(id().containsIgnoreCase(values) //
.or(name().containsIgnoreCase(values)) //
.or(param(BAG_PARAMETERS, PARAM_TITLE).containsIgnoreCase(values)));
return this;
}
}

View File

@ -0,0 +1,29 @@
package ${package}.search;
import static ${package}.model.Constants.*;
import static li.strolch.utils.helper.StringHelper.isEmpty;
import li.strolch.search.ResourceSearch;
public class LocationSearch extends ResourceSearch {
public LocationSearch() {
types(TYPE_LOCATION);
}
public LocationSearch stringQuery(String value) {
if (isEmpty(value))
return this;
// split by spaces
value = value.trim();
String[] values = value.split(" ");
// add where clauses for id, name and description
where(id().containsIgnoreCase(values) //
.or(name().containsIgnoreCase(values)) //
.or(param(PARAM_CITY).containsIgnoreCase(values)));
return this;
}
}

View File

@ -0,0 +1,53 @@
package ${package}.service;
import static ${package}.model.JsonVisitors.bookToJson;
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
import ${package}.model.Constants;
import com.google.gson.JsonObject;
import li.strolch.model.Resource;
import li.strolch.model.json.FromFlatJsonVisitor;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.service.JsonServiceArgument;
import li.strolch.service.JsonServiceResult;
import li.strolch.service.api.AbstractService;
public class CreateBookService extends AbstractService<JsonServiceArgument, JsonServiceResult> {
@Override
protected JsonServiceResult getResultInstance() {
return new JsonServiceResult();
}
@Override
public JsonServiceArgument getArgumentInstance() {
return new JsonServiceArgument();
}
@Override
protected JsonServiceResult internalDoService(JsonServiceArgument arg) throws Exception {
// open a new transaction, using the realm from the argument, or the certificate
Resource book;
try (StrolchTransaction tx = openArgOrUserTx(arg)) {
// get a new book "instance" from the template
book = tx.getResourceTemplate(Constants.TYPE_BOOK);
// map all values from the JSON object into the new book element
book.accept(new FromFlatJsonVisitor(arg.jsonElement.getAsJsonObject()).ignoreBag(BAG_RELATIONS));
// save changes
tx.add(book);
// notify the TX that it should commit on close
tx.commitOnClose();
}
// map the return value to JSON
JsonObject result = book.accept(bookToJson());
// and return the result
return new JsonServiceResult(result);
}
}

View File

@ -0,0 +1,41 @@
package ${package}.service;
import ${package}.model.Constants;
import li.strolch.model.Resource;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.service.StringServiceArgument;
import li.strolch.service.api.AbstractService;
import li.strolch.service.api.ServiceResult;
public class RemoveBookService extends AbstractService<StringServiceArgument, ServiceResult> {
@Override
protected ServiceResult getResultInstance() {
return new ServiceResult();
}
@Override
public StringServiceArgument getArgumentInstance() {
return new StringServiceArgument();
}
@Override
protected ServiceResult internalDoService(StringServiceArgument arg) throws Exception {
// open a new transaction, using the realm from the argument, or the certificate
try (StrolchTransaction tx = openArgOrUserTx(arg)) {
// get the existing book
Resource book = tx.getResourceBy(Constants.TYPE_BOOK, arg.value, true);
// save changes
tx.remove(book);
// notify the TX that it should commit on close
tx.commitOnClose();
}
// and return the result
return ServiceResult.success();
}
}

View File

@ -0,0 +1,42 @@
package ${package}.service;
import static ${package}.model.Constants.TYPE_LOCATION;
import li.strolch.model.Resource;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.service.StringServiceArgument;
import li.strolch.service.api.AbstractService;
import li.strolch.service.api.ServiceResult;
public class RemoveLocationService extends AbstractService<StringServiceArgument, ServiceResult> {
@Override
protected ServiceResult getResultInstance() {
return new ServiceResult();
}
@Override
public StringServiceArgument getArgumentInstance() {
return new StringServiceArgument();
}
@Override
protected ServiceResult internalDoService(StringServiceArgument arg) throws Exception {
// open a new transaction, using the realm from the argument, or the certificate
try (StrolchTransaction tx = openArgOrUserTx(arg)) {
// get the existing book
Resource location = tx.getResourceBy(TYPE_LOCATION, arg.value, true);
// save changes
tx.remove(location);
// notify the TX that it should commit on close
tx.commitOnClose();
}
// and return the result
return ServiceResult.success();
}
}

View File

@ -0,0 +1,59 @@
package ${package}.service;
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
import ${package}.model.Constants;
import com.google.gson.JsonObject;
import li.strolch.model.Resource;
import li.strolch.model.Tags.Json;
import li.strolch.model.json.FromFlatJsonVisitor;
import li.strolch.model.json.StrolchRootElementToJsonVisitor;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.service.JsonServiceArgument;
import li.strolch.service.JsonServiceResult;
import li.strolch.service.api.AbstractService;
import li.strolch.utils.dbc.DBC;
public class UpdateBookService extends AbstractService<JsonServiceArgument, JsonServiceResult> {
@Override
protected JsonServiceResult getResultInstance() {
return new JsonServiceResult();
}
@Override
public JsonServiceArgument getArgumentInstance() {
return new JsonServiceArgument();
}
@Override
protected JsonServiceResult internalDoService(JsonServiceArgument arg) throws Exception {
// verify same book
DBC.PRE.assertEquals("ObjectId and given Id must be same!", arg.objectId,
arg.jsonElement.getAsJsonObject().get(Json.ID).getAsString());
// open a new transaction, using the realm from the argument, or the certificate
Resource book;
try (StrolchTransaction tx = openArgOrUserTx(arg)) {
// get the existing book
book = tx.getResourceBy(Constants.TYPE_BOOK, arg.objectId, true);
// map all values from the JSON object into the new book element
book.accept(new FromFlatJsonVisitor(arg.jsonElement.getAsJsonObject()).ignoreBag(BAG_RELATIONS));
// save changes
tx.update(book);
// notify the TX that it should commit on close
tx.commitOnClose();
}
// map the return value to JSON
JsonObject result = book.accept(new StrolchRootElementToJsonVisitor().flat());
// and return the result
return new JsonServiceResult(result);
}
}

View File

@ -0,0 +1,71 @@
package ${package}.web;
import static ${package}.web.StartupListener.APP_NAME;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Priorities;
import java.util.logging.Level;
import ${package}.rest.BooksResource;
import li.strolch.rest.RestfulStrolchComponent;
import li.strolch.rest.StrolchRestfulExceptionMapper;
import li.strolch.rest.endpoint.*;
import li.strolch.rest.filters.*;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ApplicationPath("rest")
public class RestfulApplication extends ResourceConfig {
private static final Logger logger = LoggerFactory.getLogger(RestfulApplication.class);
public RestfulApplication() {
setApplicationName(APP_NAME);
// add project resources by package name
packages(BooksResource.class.getPackage().getName());
// strolch services
register(AuthenticationService.class);
register(StrolchJobsResource.class);
register(ReportResource.class);
register(ControlResource.class);
register(EnumQuery.class);
register(Inspector.class);
register(UserSessionsService.class);
register(PrivilegeUsersService.class);
register(PrivilegeRolesService.class);
register(PrivilegePoliciesService.class);
register(OperationsLogResource.class);
register(VersionQuery.class);
// filters
register(AuthenticationRequestFilter.class, Priorities.AUTHENTICATION);
register(AccessControlResponseFilter.class);
register(AuthenticationResponseFilter.class);
register(HttpCacheResponseFilter.class);
// log exceptions and return them as plain text to the caller
register(StrolchRestfulExceptionMapper.class);
// the JSON generated is in UTF-8
register(CharsetResponseFilter.class);
RestfulStrolchComponent restfulComponent = RestfulStrolchComponent.getInstance();
if (restfulComponent.isRestLogging()) {
register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME),
Level.SEVERE, LoggingFeature.Verbosity.PAYLOAD_ANY, Integer.MAX_VALUE));
property(ServerProperties.TRACING, "ALL");
property(ServerProperties.TRACING_THRESHOLD, "TRACE");
}
logger.info(
"Initialized REST application " + getApplicationName() + " with " + getClasses().size() + " classes, "
+ getInstances().size() + " instances, " + getResources().size() + " resources and "
+ getProperties().size() + " properties");
}
}

View File

@ -0,0 +1,67 @@
package ${package}.web;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.io.InputStream;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.util.ContextInitializer;
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.api.StrolchBootstrapper;
import li.strolch.utils.helper.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;
@WebListener
public class StartupListener implements ServletContextListener {
private static final Logger logger = LoggerFactory.getLogger(StartupListener.class);
public static final String APP_NAME = "eSyTest";
private StrolchAgent agent;
@Override
public void contextInitialized(ServletContextEvent sce) {
logger.info("Starting " + APP_NAME + "...");
long start = System.currentTimeMillis();
try {
String bootstrapFileName = "/" + StrolchBootstrapper.FILE_BOOTSTRAP;
InputStream bootstrapFile = getClass().getResourceAsStream(bootstrapFileName);
StrolchBootstrapper bootstrapper = new StrolchBootstrapper(StartupListener.class);
this.agent = bootstrapper.setupByBootstrapFile(StartupListener.class, bootstrapFile);
this.agent.initialize();
this.agent.start();
} catch (Throwable e) {
logger.error("Failed to start " + APP_NAME + " due to: " + e.getMessage(), e);
throw e;
}
long took = System.currentTimeMillis() - start;
logger.info("Started " + APP_NAME + " in " + (StringHelper.formatMillisecondsDuration(took)));
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
try {
new ContextInitializer((LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory()).autoConfig();
} catch (Exception e) {
System.err.println("Failed to reconfigure logging...");
e.printStackTrace(System.err);
}
if (this.agent != null) {
logger.info("Destroying " + APP_NAME + "...");
try {
this.agent.stop();
this.agent.destroy();
} catch (Throwable e) {
logger.error("Failed to stop " + APP_NAME + " due to: " + e.getMessage(), e);
throw e;
}
}
logger.info("Destroyed " + APP_NAME);
}
}

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchBootstrap>
<!-- use attribute default="true" to allow optional values -->
<env id="dev" default="true">
<!-- optional, to load different environment -->
<environment>dev</environment>
<!-- always optional root tag, default: system property user.dir -->
<root>runtime</root>
<!-- optional config tag, if default="true": config/ -->
<!-- <config>config</config> -->
<!-- optional data tag, if default="true": data/ -->
<!-- <data>data</data> -->
<!-- optional temp tag, if default="true": temp/ -->
<!-- <temp>temp</temp> -->
</env>
<env id="dev.local" default="true">
<root>${project.basedir}/runtime</root>
<environment>dev</environment>
</env>
<env id="test" default="true">
<root>/absolute/path/to/runtime</root>
<environment>test</environment>
</env>
</StrolchBootstrap>

View File

@ -0,0 +1,6 @@
groupId=${project.groupId}
artifactId=${project.artifactId}
artifactVersion=${project.version}
scmRevision=${buildNumber}
scmBranch=${scmBranch}
buildTimestamp=${buildTimestamp}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d [%thread] %-5level %class{36}:%line %method - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,3 @@
{
"directory": "app/bower_components"
}

View File

@ -0,0 +1,4 @@
package-lock.json
node_modules/
app/bower_components/
www/

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<!-- For WebSockets with large frames -->
<context-param>
<param-name>org.apache.tomcat.websocket.textBufferSize</param-name>
<param-value>1048576</param-value>
</context-param>
<context-param>
<param-name>org.apache.tomcat.websocket.binaryBufferSize</param-name>
<param-value>1048576</param-value>
</context-param>
</web-app>

View File

@ -0,0 +1,12 @@
CustomWeb = {
//
};
(function () {
var basePath = window.location.pathname.substr(0, window.location.pathname.indexOf('/index.html'));
basePath = basePath.substr(0, basePath.lastIndexOf('/'));
CustomWeb.baseRestPath = basePath + '/rest';
console.log('Base REST Path is ' + CustomWeb.baseRestPath);
CustomWeb.baseWsPath = basePath + '/websocket';
console.log('Base WebSocket Path is ' + CustomWeb.baseWsPath);
})();

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>${appName}</title>
<meta name="description" content="${appName}">
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<link rel="shortcut icon" type="image/png" href="../favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<script src="./bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="./bower_components/strolchjs/Strolch.js"></script>
<script src="./CustomWeb.js"></script>
<link rel="import" href="src/main/c-main.html">
<style>
@font-face {
font-family: 'Ubuntu-local';
src: url(font/Ubuntu-Regular.ttf);
}
body {
margin: 0;
padding: 0;
font-family: 'Ubuntu-local', sans-serif;
font-size: 14px;
background-color: #fafafa;
}
</style>
</head>
<body unresolved>
<c-main></c-main>
</body>
</html>

View File

@ -0,0 +1,199 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="./c-component-behavior.html">
<script>
CustomAppBehaviorImpl = {
properties: {
notifications: {
type: Array,
value: []
},
},
onClearSearchTerm: function () {
this.$$("#debouncedInput").onClearTapped();
},
_updatePageTitle: function (pageName) {
if (pageName === "${appName}" || pageName === "${appName}")
document.title = pageName;
else
document.title = "${appName}: " + (this.localize == null ? pageName : this.localize(pageName));
},
onLogOut: function () {
this.$$("#pages").logout();
sessionStorage.clear();
Strolch.clearStorageData();
this.deleteCookie("strolch.authorization");
window.location.reload();
},
reloadPage: function (pageName) {
this._updatePageTitle(pageName);
this.debounce('page-reload-' + pageName, function () {
var page = this.$$('#' + pageName);
if (page && page.reload) {
console.log('Reloading ' + pageName);
page.reload();
}
switch (pageName) {
case 'login' :
case 'inspector' :
case 'control' :
case 'operations-log' :
case 'jobs' :
case 'sessions' :
case 'users' :
case 'roles' :
case 'i18n-editor' :
case 'reports' :
this.set('toolbarConfig', {
pageTitle: pageName,
backButton: true,
hasSearchTerm: false
});
break;
default:
if (page != null && page.toolbarConfig != null) {
this.set('toolbarConfig', page.toolbarConfig);
}
}
}, 100);
},
onShowToast: function (e) {
if (this.$.toast.opened) {
this.$.toast.close();
this.async(function () {
this.toastText = e.detail.text;
this.$.toast.open();
}, 100);
} else {
this.toastText = e.detail.text;
this.$.toast.open();
}
},
onShowDialog: function (e) {
var dlgTitle;
if (e.detail.title != null)
dlgTitle = e.detail.title;
else
dlgTitle = e.detail.isError ? 'errorOccurred' : 'info';
var dlgText;
if (e.detail.text)
dlgText = e.detail.text;
else if (e.detail.message)
dlgText = e.detail.message;
else
dlgText = JSON.stringify(e.detail);
this._showDialog(dlgTitle, dlgText);
},
onShowNotification: function (e) {
console.log("Showing notification " + e.detail.id);
this.push("notifications", e.detail);
},
onClearNotification: function (e) {
console.log("Clearing notification " + e.detail.id);
for (var i = 0; i < this.notifications.length; i++) {
if (this.notifications[i].id === e.detail.id) {
this.splice("notifications", i, 1);
break;
}
}
},
onServerNotAvailable: function (event) {
clearInterval(this.checkForNewVersionInterval);
this.showInfo({
translate: true,
okLbl: 'reconnect',
title: 'serverNotAvailable',
line1: 'serverNotAvailableMsg',
cancelable: false,
callback: function (confirmed) {
if (confirmed)
this.reconnect();
}.bind(this)
});
},
onSessionInvalid: function (e) {
console.log(this.routeTail);
if (this.routeTail.prefix !== '/login') {
this.showInfo({
translate: true,
title: 'sessionInvalid',
line1: 'sessionInvalidConfirmNavToLogin',
cancelable: false,
callback: function (confirmed) {
if (!confirmed) return;
this.deleteCookie('strolch.authorization');
this.set("authTokenValid", false);
}.bind(this)
});
}
},
onPrivilegeDenied: function (e) {
if (this.authTokenValid) {
if (e.detail && e.detail.detail && e.detail.detail.request //
&& e.detail.detail.request.response //
&& e.detail.detail.request.response.i18n) {
this.showInfo({
title: 'privilegeDenied',
i18n: e.detail.detail.request.response.i18n,
translate: true
});
} else if (e.detail && e.detail.detail && e.detail.detail.request //
&& e.detail.detail.request.response //
&& e.detail.detail.request.response.exceptionMsg) {
this.showInfo({
title: 'privilegeDenied',
line1: e.detail.detail.request.response.exceptionMsg,
line2: this.requestEventToUrl(e),
translate: true
});
} else {
this.showInfo({
title: 'privilegeDenied',
line1: 'privilegeDeniedText',
line2: this.requestEventToUrl(e),
translate: true
});
}
} else {
console.warn("Privilege denied to URL " + this.requestEventToUrl(e));
this.requestErrorToMsg(e);
}
},
_showDialog: function (dlgTitle, dlgText, dlgReason) {
if (this.localize) {
var data = {
title: this.localize(dlgTitle),
line1: this.localize(dlgText)
};
if (dlgReason)
data.line1 += ": " + dlgReason;
this.$.infoDlg.open(data);
} else {
this.debounce('show-dlg', function () {
var data = {
title: this.localize(dlgTitle),
line1: this.localize(dlgText)
};
if (dlgReason)
data.line1 += ": " + dlgReason;
this.$.infoDlg.open(data);
}.bind(this), 250);
}
},
};
CustomAppBehavior = [CustomComponentBehavior, CustomAppBehaviorImpl];
</script>

View File

@ -0,0 +1,30 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/strolch-wc-util-behavior/strolch-wc-component-behavior.html">
<link rel="import" href="../../bower_components/strolch-wc-localize-behavior/strolch-wc-localize-behavior.html">
<script>
CustomComponentBehaviorImpl = {
properties: {
baseRestPath: {
type: String,
value: function () {
return CustomWeb.baseRestPath;
}
},
baseWsPath: {
type: String,
value: function () {
return CustomWeb.baseWsPath;
}
},
localesPath: {
type: String,
value: '../../../locales.json'
}
}
};
CustomComponentBehavior = [StrolchComponentBehavior, StrolchLocalizeBehavior, CustomComponentBehaviorImpl];
</script>

View File

@ -0,0 +1,203 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-inspector-menu.html">
<link rel="import" href="../behaviors/c-component-behavior.html">
<link rel="import" href="../styles/c-app-style.html">
<dom-module id="c-drawer">
<template>
<style is="custom-style" include="c-app-style">
:root {
}
app-drawer {
z-index: 10;
}
app-toolbar {
background-color: var(--app-primary-color);
color: var(--app-regular-highlight-fg-color);
}
paper-menu {
--paper-menu-selected-item: {
background-color: var(--app-light-highlight-bg-color);
};
--paper-menu-focused-item: {
background-color: var(--app-regular-highlight-bg-color);
};
}
paper-menu paper-item {
cursor: pointer;
}
paper-menu paper-item:hover {
background-color: var(--app-regular-highlight-bg-color);
}
.info-div {
display: block !important;
font-size: small;
color: darkgray;
}
.strolch {
color: #7f7f7f;
font-family: monospace;
font-weight: 600;
font-size: 30px;
text-shadow: 2px 2px 3px #7f7f7f;
margin: auto;
}
</style>
<app-drawer id="appDrawer">
<app-toolbar>
<paper-icon-button icon="menu" on-tap="closeDrawer"></paper-icon-button>
<div main-title>[[localize('appTitle')]]</div>
</app-toolbar>
<paper-menu id="menu" selected="{{page}}" attr-for-selected="id" on-tap="onMenuTap">
<paper-item id="demo-locations" class="menu-item">[[localize('demo-locations')]]</paper-item>
<paper-item id="demo-books" class="menu-item">[[localize('demo-books')]]</paper-item>
<template is="dom-if" if="[[hasPrivilege('li.strolch.report.ReportSearch')]]">
<paper-item id="reports" class="menu-item">[[localize('reports')]]</paper-item>
</template>
</paper-menu>
<template is="dom-if" if="[[hasRole('StrolchAdmin')]]">
<strolch-wc-inspector-menu selected-page="[[page]]"
on-menu-tap="onInspectorMenuTap"></strolch-wc-inspector-menu>
</template>
<paper-menu on-tap="onLogoutTapped">
<paper-item id="logout" class="menu-item">[[localize('logout')]]</paper-item>
</paper-menu>
<paper-material id="container" class="container info-div" elevation="0">
<p>[[userConfig.firstname]] [[userConfig.lastname]] / [[userConfig.username]]</p>
<p title="[[version.appVersion.scmRevision]]">[[version.appVersion.artifactVersion]]</p>
</paper-material>
<paper-material id="container" class="container" elevation="0">
<paper-dropdown-menu label="[[localize('language')]]">
<paper-listbox class="dropdown-content" selected="{{userLocale}}" attr-for-selected="data">
<paper-item data="de">Deutsch</paper-item>
<paper-item data="en">English</paper-item>
<paper-item data="fr">Français</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</paper-material>
<paper-material id="container" class="container" elevation="0">
<p class="strolch">${appName}</p>
</paper-material>
</app-drawer>
<!-- Ajax requests -->
<iron-ajax id="ajaxPutLocale" content-type="application/json" handle-as="json" method="PUT"></iron-ajax>
</template>
<script>
Polymer({
is: 'c-drawer',
behaviors: [
CustomComponentBehavior
],
properties: {
authTokenValid: {
type: Boolean
},
userConfig: {
type: Object,
observer: "userConfigChanged"
},
userLocale: {
type: String,
observer: "userLocaleChanged"
},
version: {
type: Object
}
},
observers: [],
listeners: {},
toggleDrawer: function () {
this.$$("#appDrawer").toggle();
},
closeDrawer: function () {
this.$$("#appDrawer").close();
},
onInspectorMenuTap: function (e) {
this.changePage(e.detail.target.id, false);
},
onMenuTap: function (e) {
this.changePage(e.detail.sourceEvent.target.id, false);
},
onLogoutTapped: function (e) {
this.fire('cx-logout');
},
userConfigChanged: function (newValue, oldValue) {
if (newValue != null) {
var userLocale = Strolch.getUserLocale();
if (userLocale !== newValue.locale) {
console.log("Updating server side locale for user " + newValue.username + " to " + userLocale);
newValue.locale = userLocale;
Strolch.setUserConfig(newValue);
this.$.ajaxPutLocale.url = this.baseRestPath + "/strolch/sessions/" + newValue.sessionId + "/locale/" + userLocale;
this.$.ajaxPutLocale.generateRequest();
}
this.userLocale = newValue.locale;
}
},
userLocaleChanged: function (newValue, oldValue) {
if (newValue && oldValue) {
console.log('User locale changed to ' + newValue);
this.$.ajaxPutLocale.generateRequest();
Strolch.setUserLocale(newValue);
window.location.reload();
} else if (this.userConfig == null && Strolch.getUserConfig() != null && Strolch.getUserConfig().locale !== newValue) {
this.userConfig = Strolch.getUserConfig();
this.userConfig.locale = newValue;
Strolch.setUserConfig(this.userConfig);
this.$.ajaxPutLocale.generateRequest();
}
},
/* Lifecycle */
});
</script>
</dom-module>

View File

@ -0,0 +1,268 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
<link rel="import" href="../../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-toast/paper-toast.html">
<link rel="import" href="../../bower_components/strolch-wc-debounced-input/strolch-wc-debounced-input.html">
<link rel="import" href="../../bower_components/strolch-wc-notification/strolch-wc-notification.html">
<link rel="import" href="../../bower_components/strolch-wc-information-dialog/strolch-wc-information-dialog.html">
<link rel="import" href="../behaviors/c-app-behavior.html">
<link rel="import" href="../styles/c-app-style.html">
<link rel="import" href="../utils/c-app-routing.html">
<link rel="import" href="./c-drawer.html">
<link rel="import" href="./c-pages.html">
<dom-module id="c-main">
<template>
<style is="custom-style" include="c-app-style">
:root {
display: block;
}
app-toolbar {
background-color: var(--app-primary-color);
color: var(--app-regular-highlight-fg-color);
}
strolch-wc-debounced-input {
--focus-color: white;
--input-color: white;
--regular-color: white;
}
</style>
<!-- Routing -->
<c-app-routing id="appRouting"
login-page="login"
auth-valid="[[authTokenValid]]"
page="{{page}}"
route-tail="{{routeTail}}"
use-hash-as-path></c-app-routing>
<app-drawer-layout fullbleed force-narrow>
<template is="dom-if" if="[[authTokenValid]]">
<c-drawer id="drawer" page="[[page]]" auth-token-valid="[[authTokenValid]]" user-config="[[userConfig]]" version="[[version]]"
on-strolch-app-version-outdated="onAppVersionOutdated"></c-drawer>
<app-toolbar>
<paper-icon-button icon="menu" on-tap="toggleDrawer"></paper-icon-button>
<div main-title>[[localize(page)]]</div>
<template is="dom-if" if="[[toolbarConfig.hasSearchTerm]]">
<strolch-wc-debounced-input id="debouncedInput"
debounced-input="{{searchTerm}}"></strolch-wc-debounced-input>
</template>
</app-toolbar>
</template>
<template is="dom-repeat" items="[[notifications]]" as="notification">
<strolch-wc-notification message="[[notification.message]]"
action1="[[notification.action1]]"
action2="[[notification.action2]]"
action3="[[notification.action3]]"
callback1="[[notification.callback1]]"
callback2="[[notification.callback2]]"
callback3="[[notification.callback3]]"
bind="[[notification.bind]]"
fa-icon="[[notification.faIcon]]"></strolch-wc-notification>
</template>
<c-pages id="pages" page="[[page]]" toolbar-config="{{toolbarConfig}}" route="{{routeTail}}" search-term="[[searchTerm]]"
user-location="{{userLocation}}"></c-pages>
<paper-toast id="toast" text="[[toastText]]"></paper-toast>
<paper-toast id="newVersionAvailableToast" duration="0">
<paper-button class="refresh" on-tap="refreshBrowser">[[localize('refresh')]]</paper-button>
</paper-toast>
</app-drawer-layout>
<strolch-wc-information-dialog id="infoDlg"
locales-path="../../../locales.json"></strolch-wc-information-dialog>
<!-- Ajax requests -->
<iron-ajax id="ajaxGetAppVersion"
url="[[baseRestPath]]/strolch/version"
content-type="application/json"
handle-as="json"
method="GET"
on-response="onGetAppVersionResponse"
on-error="onGetAppVersionError"></iron-ajax>
</template>
<script>
Polymer({
is: 'c-main',
behaviors: [
CustomAppBehavior
],
properties: {
toolbarConfig: {
type: Object
},
searchTerm: {
type: String
},
page: {
type: String
},
authToken: {
type: String
},
authTokenValid: {
type: Boolean,
value: false
},
userConfig: {
type: Object
},
route: {
type: Object
},
toastText: {
type: String,
value: 'not-yet-set'
},
version: {
type: Object
}
},
observers: [],
listeners: {
"strolch-session-valid": "onSessionValidated",
"strolch-reload": "reload",
"strolch-show-toast": "onShowToast",
"strolch-server-not-available": "onServerNotAvailable",
"strolch-session-invalid": "onSessionInvalid",
"strolch-privilege-denied": "onPrivilegeDenied",
"strolch-change-page": "onPageChange",
"strolch-show-dialog": "onShowDialog",
"strolch-show-info": "onShowInfo",
"strolch-ajax-request-error": "onRequestError",
"strolch-show-notification": "onShowNotification",
"strolch-clear-notification": "onClearNotification",
"strolch-clear-search-term": "onClearSearchTerm",
"cx-logout": "onLogOut",
},
reload: function () {
this.reloadPage(this.page);
},
toggleDrawer: function () {
this.$$("#drawer").toggleDrawer();
},
closeDrawer: function () {
this.$$("#drawer").closeDrawer();
},
onPageChange: function (e) {
this.closeDrawer();
if (e && e.detail && e.detail.page) {
var pageName = e.detail.page;
// set the next page
document.title = this.localize == null ? pageName : this.localize(pageName);
this.$.appRouting.pushNextPage(pageName, e.detail.keepQueryParams);
} else {
console.log("received page change without new value");
}
},
onShowInfo: function (e) {
this.$.infoDlg.open(e.detail);
},
onSessionValidated: function () {
console.log("Session validated.");
this.set("authToken", Strolch.getAuthToken());
this.set("authTokenValid", true);
this.set("userConfig", Strolch.getUserConfig());
this.$.ajaxGetAppVersion.generateRequest();
},
onGetAppVersionResponse: function (event) {
this.version = event.detail.response;
Strolch.setAppVersion(this.version);
var artifactVersion = this.version.appVersion.artifactVersion;
var scmRevision = this.version.appVersion.scmRevision;
console.log("App Version is " + artifactVersion);
var currentVersion = sessionStorage.appScmRevision;
if (currentVersion == null //
|| currentVersion === 'undefined' //
|| scmRevision == null
|| scmRevision === 'undefined') {
sessionStorage.appScmRevision = scmRevision;
console.log("App SCM Revision is now known as " + scmRevision);
} else if (scmRevision !== currentVersion) {
console.log("App SCM Revision has changed from " + currentVersion + " to " + scmRevision + ". Need to refresh browser...");
this.fire("strolch-app-version-outdated", {newVersion: scmRevision});
this.$.newVersionAvailableToast.text = this.localize('newVersionAvailableRefreshRequired') + ": " + artifactVersion;
this.$.newVersionAvailableToast.open();
}
},
onGetAppVersionError: function (event) {
console.log(event);
var readyState = event.detail.request.xhr.readyState;
var status = event.detail.request.xhr.status;
if (readyState === 4 && status === 404) {
console.log("Ignoring 404 for get version, as server is probably still starting...");
} else {
this.onRequestError(event);
}
},
refreshBrowser: function () {
sessionStorage.appScmRevision = this.version.appVersion.scmRevision;
document.location.reload();
},
checkForNewVersion: function () {
this.$.ajaxGetAppVersion.generateRequest();
},
reconnect: function () {
this.onGetAppVersionResponse = function (event) {
var version = event.detail.response;
this.scmRevision = version.appVersion.scmRevision;
sessionStorage.appScmRevision = this.scmRevision;
document.location.reload();
};
this.$.ajaxGetAppVersion.generateRequest();
},
/* Lifecycle */
attached: function () {
setTimeout(function () {
this.checkForNewVersion();
}.bind(this), 5000);
this.checkForNewVersionInterval = setInterval(function () {
this.checkForNewVersion();
}.bind(this), 300000);
window.addEventListener("beforeunload", function (e) {
console.log("App SCM Revision " + sessionStorage.appScmRevision + " is cleared due to unload of UI");
delete sessionStorage.appScmRevision;
return null;
});
},
});
</script>
</dom-module>

View File

@ -0,0 +1,184 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-pages/iron-pages.html">
<link rel="import" href="../../bower_components/strolch-wc-auth/strolch-wc-auth.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-inspector.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-users.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-roles.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-sessions.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-operations-log.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-jobs.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-operations-log.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-inspector-menu.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-control.html">
<link rel="import" href="../../bower_components/strolch-wc-inspector/strolch-wc-i18n-editor.html">
<link rel="import" href="../../bower_components/strolch-wc-reports/strolch-wc-reports.html">
<link rel="import" href="../behaviors/c-app-behavior.html">
<link rel="import" href="../styles/c-app-style.html">
<link rel="import" href="../views/c-view404.html">
<link rel="import" href="../views/c-demo-locations.html">
<link rel="import" href="../views/c-demo-books.html">
<dom-module id="c-pages">
<template>
<style is="custom-style" include="c-app-style">
:root {
display: block;
}
</style>
<iron-pages selected="[[selectedPage]]" attr-for-selected="id" fallback-selection="view404">
<strolch-wc-auth id="login"
app-title="[[localize('appTitle')]]"
toolbar-config="{{toolbarConfig}}"
base-path="../"
show-version
show-keep-alive></strolch-wc-auth>
<c-demo-locations id="demo-locations"
toolbar-config="{{toolbarConfig}}"
search-term="[[searchTerm]]"
base-path="../"></c-demo-locations>
<c-demo-books id="demo-books"
toolbar-config="{{toolbarConfig}}"
search-term="[[searchTerm]]"
base-path="../"></c-demo-books>
<template is="dom-if" if="[[equal(page, 'inspector')]]" restamp>
<strolch-wc-inspector id="inspector"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-inspector>
</template>
<template is="dom-if" if="[[equal(page, 'operations-log')]]" restamp>
<strolch-wc-operations-log id="operations-log"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-operations-log>
</template>
<template is="dom-if" if="[[equal(page, 'jobs')]]" restamp>
<strolch-wc-jobs id="jobs"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-jobs>
</template>
<template is="dom-if" if="[[equal(page, 'reports')]]" restamp>
<strolch-wc-reports id="reports"
toolbar-config="{{toolbarConfig}}"
base-path="../"
base-rest-path="[[baseRestPath]]"
locales-path="../../../locales.json"
route="{{route}}"
facet-limit="[[reportFacetLimit]]"
propagate-show-dialog></strolch-wc-reports>
</template>
<template is="dom-if" if="[[equal(page, 'users')]]" restamp>
<strolch-wc-users id="users"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-users>
</template>
<template is="dom-if" if="[[equal(page, 'roles')]]" restamp>
<strolch-wc-roles id="roles"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-roles>
</template>
<template is="dom-if" if="[[equal(page, 'sessions')]]" restamp>
<strolch-wc-sessions id="sessions"
toolbar-config="{{toolbarConfig}}"
base-path="../"
route="{{route}}"></strolch-wc-sessions>
</template>
<template is="dom-if" if="[[equal(page, 'control')]]" restamp>
<strolch-wc-control id="control"
class="padded-view"
base-path="../"
base-ws-path="[[baseWsPath]]"
toolbar-config="{{toolbarConfig}}"
search-term="{{searchTerm}}"
user-location="{{userLocation}}"
route="{{routeTail}}"
propagate-show-dialog></strolch-wc-control>
</template>
<c-view404 id="view404"></c-view404>
</iron-pages>
</template>
<script>
Polymer({
is: 'c-pages',
behaviors: [
CustomAppBehavior
],
properties: {
toolbarConfig: {
type: Object,
notify: true
},
searchTerm: {
type: String
},
page: {
type: String,
observer: 'observePage'
},
selectedPage: {
type: String,
observer: 'observeSelectedPage'
},
route: {
type: Object
},
reportFacetLimit: {
type: Number,
value: function () {
return 25;
}
}
},
observers: [],
listeners: {},
observePage: function (newValue, oldValue) {
if (newValue) {
this.async(function () {
this.selectedPage = newValue;
}, 10);
}
},
observeSelectedPage: function (newValue, oldValue) {
if (newValue) {
console.log("Page changed to " + newValue + ", reloading...");
this.reloadPage(newValue);
}
},
logout: function () {
this.$$('#login').logout();
}
});
</script>
</dom-module>

View File

@ -0,0 +1,14 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/strolch-wc-styles/strolch-wc-app-style.html">
<dom-module id="c-app-style">
<template>
<style is="c-app-style" include="strolch-wc-app-style">
:root {
}
</style>
</template>
</dom-module>

View File

@ -0,0 +1,148 @@
<!-- Components -->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/app-route/app-location.html">
<link rel="import" href="../../bower_components/app-route/app-route.html">
<dom-module id="c-app-routing">
<template>
<!-- Routing -->
<app-location use-hash-as-path="[[useHashAsPath]]" route="{{route}}"></app-location>
<app-route route="{{route}}" data="{{routeData}}" tail="{{routeTail}}" pattern="/:page"></app-route>
</template>
<script>
Polymer({
<!-- Settings -->
is: "c-app-routing",
<!-- Properties -->
properties: {
useHashAsPath: {
type: Boolean
},
authValid: {
type: Boolean
},
loginPage: {
type: String,
value: "login"
},
exposedPages: {
type: Array,
value: []
},
returnPath: {
type: String
},
page: {
type: String,
notify: true
},
path: {
type: String
},
routeData: {
type: Object,
notify: true
},
routeTail: {
type: Object,
notify: true
}
},
<!-- Observers -->
observers: [
"observeRouteData(routeData)",
"observeRoutePath(route.path)",
"redirectApp(path, authValid)"
],
computeDefaultPage: function (userConfig) {
if (userConfig == null)
return "inspector";
Strolch.setUserConfig(userConfig);
if (Strolch.hasRole("StrolchAdmin")) {
return "demo-locations";
} else {
return "demo-books";
}
},
observeRouteData: function (routeData) {
// redirect to login or default if there is no page
if (!routeData.page) {
var firstPage = this.authValid ? this.computeDefaultPage(Strolch.getUserConfig()) : this.loginPage;
this.replaceCurrentPage(firstPage);
} else {
// this debounces multiple page changes by the app route component
this.set("page", routeData.page);
}
},
observeRoutePath: function (routePath) {
// this debounces multiple path changes by the app route component
this.set("path", routePath);
},
redirectApp: function (path, authValid) {
// find the base of the path
var pathBase = path.split("/")[1];
// prevent navigation to login if the auth is still valid
if (pathBase === this.loginPage && authValid) {
// instead return to a path that was tried to access before login or the default page
if (this.returnPath) {
this.replaceCurrentPath(this.returnPath);
} else {
this.replaceCurrentPage(this.computeDefaultPage(Strolch.getUserConfig()));
}
}
// prevent navigation to any page but exposed pages if the auth is invalid
var accessesExposedPage = (pathBase === this.loginPage || this.exposedPages.indexOf(pathBase) !== -1);
if (!accessesExposedPage && authValid === false) {
console.log("Not authenticated, navigating from page " + pathBase + " to " + this.loginPage);
// instead save this path to return after login and go to login
this.set("returnPath", path);
this.replaceCurrentPage(this.loginPage);
}
},
<!-- Functions -->
replaceCurrentPage: function (currentPage) {
this.replaceCurrentPath("/" + currentPage);
},
replaceCurrentPath: function (currentPath) {
var _currentPath = (this.useHashAsPath ? "#" : "") + currentPath;
history.replaceState({}, _currentPath, _currentPath);
this.updateRoutePath(currentPath);
},
pushNextPage: function (nextPage, keepQueryParams) {
this.pushNextPath("/" + nextPage, keepQueryParams);
},
pushNextPath: function (nextPath, keepQueryParams) {
if (keepQueryParams) {
var queryParams = Strolch.getQueryParamsAsString();
if (Strolch.isNotEmptyString(queryParams)) {
if (nextPath.endsWith('/'))
nextPath = nextPath + '?' + queryParams;
else
nextPath = nextPath + '/?' + queryParams;
}
}
var _nextPath = (this.useHashAsPath ? "#" : "") + nextPath;
history.pushState({}, _nextPath, _nextPath);
this.updateRoutePath(nextPath);
},
updateRoutePath: function (path) {
if (this.route.path !== path) {
this.set("route.path", path);
this.notifyPath("route.path");
}
}
});
</script>
</dom-module>

View File

@ -0,0 +1,157 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-badge/paper-badge.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../../bower_components/strolch-wc-badge/strolch-wc-badge.html">
<link rel="import" href="../../bower_components/strolch-wc-styles/strolch-wc-styles.html">
<link rel="import" href="../styles/c-app-style.html">
<link rel="import" href="../widgets/c-demo-books-table.html">
<dom-module id="c-demo-books">
<template>
<style is="custom-style" include="c-app-style">
:host {
display: block;
padding: 10px 10px;
}
paper-card {
margin: 0;
}
</style>
<h1>Demo Books Table</h1>
<div class="actions">
<paper-button on-tap="onShowLocations" raised>Show Locations</paper-button>
<paper-icon-button icon="refresh" on-tap="reload"></paper-icon-button>
</div>
<template is="dom-if" if="[[arrayFilled(rows)]]">
<c-demo-books-table rows="[[rows]]" on-data-selected="onRowSelected" on-remove-book="onRemoveBook"></c-demo-books-table>
</template>
<template is="dom-if" if="[[!arrayFilled(rows)]]">
<p class="g-center"><i>[[localize('noElementsAvailable')]]</i></p>
</template>
<strolch-wc-paging id="paging" data-obj="[[dataObj]]" hidden$="[[!arrayFilled(rows)]]"></strolch-wc-paging>
<iron-ajax id="ajaxGetBooks"
url="[[baseRestPath]]/books?query=[[searchTerm]]"
content-type="application/json"
params=""
handle-as="json"
method="GET"
on-response="onGetBooksResponse"
on-error="onRequestError"></iron-ajax>
<iron-ajax id="ajaxRemoveBook"
content-type="application/json"
handle-as="json"
method="DELETE"
on-response="onRemoveBookResponse"
on-error="onRequestError"></iron-ajax>
</template>
<script>
Polymer({
is: 'c-demo-books',
behaviors: [
CustomComponentBehavior
],
properties: {
toolbarConfig: {
type: Object,
readOnly: true,
value: {
hasSearchTerm: true
}
},
searchTerm: {
type: String,
observer: "searchTermChanged"
},
selectedRows: {
type: Array,
value: []
},
dataObj: {
type: Object,
value: null
},
rows: {
type: Array,
value: []
}
},
searchTermChanged: function (newValue, oldValue) {
if (newValue != null && oldValue !== undefined)
this.reload();
},
/* Private */
onShowLocations : function () {
this.changePage("demo-locations");
},
onRowSelected: function (e) {
if (e.detail.data.checked) {
this.push('selectedRows', e.detail.data);
} else {
this.arrayDelete('selectedRows', e.detail.data);
}
},
onRemoveBook: function (e) {
var book = e.detail.book;
this.showInfo({
title: "Remove Book",
line1: "Do you really want to remove book " + book.name,
callback: function (confirmed) {
this.async(function () {
if (!confirmed) return;
this.$.ajaxRemoveBook.url = this.baseRestPath + "/books/" + book.id;
this.$.ajaxRemoveBook.generateRequest();
});
}.bind(this)
});
},
/* Public */
reload: function () {
this.$.ajaxGetBooks.generateRequest();
},
onGetBooksResponse: function (e) {
this.selectedRows = [];
var response = e.detail.response;
response.data.forEach(function (book) {
book.selectable = true;
});
this.rows = response.data;
this.dataObj = response;
},
onRemoveBookResponse: function (e) {
this.reload();
},
/* Lifecycle */
attached: function () {
this.$.ajaxGetBooks.params.limit = 20;
this.$.paging.ajax = this.$.ajaxGetBooks;
},
ready: function () {
},
});
</script>
</dom-module>

View File

@ -0,0 +1,225 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-badge/paper-badge.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../../bower_components/strolch-wc-badge/strolch-wc-badge.html">
<link rel="import" href="../../bower_components/strolch-wc-styles/strolch-wc-styles.html">
<link rel="import" href="../styles/c-app-style.html">
<link rel="import" href="../widgets/c-demo-location-detail.html">
<dom-module id="c-demo-locations">
<template>
<style is="custom-style" include="c-app-style">
:host {
display: block;
padding: 10px 10px;
}
paper-card {
margin: 0;
}
c-demo-location-detail {
margin-bottom: 10px;
}
</style>
<h1>Demo actions to test UI</h1>
<div class="actions">
<div>
<paper-button on-tap="onShowBooks" raised>Show Books</paper-button>
<paper-button raised on-tap="_showNotification">Show Notification</paper-button>
<paper-button raised on-tap="_showInfo">Show Info</paper-button>
</div>
<div>
<paper-button raised on-tap="_showConfirmation">Show Confirmation</paper-button>
</div>
<div>
<paper-button id="showToast" raised on-tap="_showToast">Show Toast</paper-button>
<strolch-wc-badge hide="[[arrayEmpty(selectedRows)]]" label="[[selectedRows.length]]" for="showToast"></strolch-wc-badge>
<paper-toggle-button>[[localize('Toggle')]]</paper-toggle-button>
<paper-icon-button icon="refresh" on-tap="reload"></paper-icon-button>
</div>
</div>
<p>Current search criteria:
<template is="dom-if" if="[[isEmptyString(searchTerm)]]"><i>empty</i></template>
<template is="dom-if" if="[[isNotEmptyString(searchTerm)]]">[[searchTerm]]
<paper-icon-button icon="clear" on-tap="clearSearchTerm"></paper-icon-button>
</template>
</p>
<template is="dom-if" if="[[arrayFilled(rows)]]">
<template is="dom-repeat" items="[[rows]]" as="row">
<c-demo-location-detail data="[[row]]" on-data-selected="onRowSelected" on-remove-location="onRemoveLocation"></c-demo-location-detail>
</template>
</template>
<template is="dom-if" if="[[!arrayFilled(rows)]]">
<p class="g-center"><i>[[localize('noElementsAvailable')]]</i></p>
</template>
<strolch-wc-paging id="paging" data-obj="[[dataObj]]" hidden$="[[!arrayFilled(rows)]]"></strolch-wc-paging>
<iron-ajax id="ajaxGetLocations"
url="[[baseRestPath]]/locations?query=[[searchTerm]]"
content-type="application/json"
params=""
handle-as="json"
method="GET"
on-response="onGetLocationsResponse"
on-error="onRequestError"></iron-ajax>
<iron-ajax id="ajaxRemoveLocation"
content-type="application/json"
handle-as="json"
method="DELETE"
on-response="onRemoveLocationResponse"
on-error="onRequestError"></iron-ajax>
</template>
<script>
Polymer({
is: 'c-demo-locations',
behaviors: [
CustomComponentBehavior
],
properties: {
toolbarConfig: {
type: Object,
readOnly: true,
value: {
hasSearchTerm: true
}
},
searchTerm: {
type: String,
observer: "searchTermChanged"
},
selectedRows: {
type: Array,
value: []
},
dataObj: {
type: Object,
value: null
},
rows: {
type: Array,
value: []
}
},
searchTermChanged: function (newValue, oldValue) {
if (newValue != null && oldValue !== undefined)
this.reload();
},
onShowBooks : function () {
this.changePage("demo-books");
},
_showNotification: function (e) {
this.showNotification("notification-one", //
"This is a notification!", //
"fa-exclamation-triangle", //
"Close", function () {
this.clearNotification("notification-one");
});
},
_showInfo: function (e) {
this.showDialog("This is an info dialog!", false);
},
_showConfirmation: function (e) {
this.showInfo({
title: "Confirmation",
line1: "This is a confirmation dialog. Do you want to confirm?",
callback: function (confirmed) {
this.async(function () {
if (confirmed) {
this.showDialog("You confirmed the dialog", false);
return;
}
this.showNotification("notification-two", //
"You did not confirm the dialog", "fa-exclamation-triangle", //
"Cancel", function () {
this.clearNotification("notification-two");
}.bind(this), //
"Close", function () {
this.clearNotification("notification-two");
}.bind(this), //
"Info", function () {
this._showInfo();
}.bind(this));
});
}.bind(this)
});
},
_showToast: function (e) {
this.showToast("This is a toast!");
},
/* Private */
onRowSelected: function (e) {
if (e.detail.data.checked) {
this.push('selectedRows', e.detail.data);
} else {
this.arrayDelete('selectedRows', e.detail.data);
}
},
onRemoveLocation: function (e) {
var location = e.detail.location;
this.showInfo({
title: "Remove location",
line1: "Do you really want to remove location " + location.name,
callback: function (confirmed) {
this.async(function () {
if (!confirmed) return;
this.$.ajaxRemoveLocation.url = this.baseRestPath + "/locations/" + location.id;
this.$.ajaxRemoveLocation.generateRequest();
});
}.bind(this)
});
},
/* Public */
reload: function () {
this.$.ajaxGetLocations.generateRequest();
},
onGetLocationsResponse: function (e) {
this.selectedRows = [];
var response = e.detail.response;
response.data.forEach(function (location) {
location.selectable = true;
});
this.rows = response.data;
this.dataObj = response;
},
onRemoveLocationResponse: function (e) {
this.reload();
},
/* Lifecycle */
attached: function () {
this.$.ajaxGetLocations.params.limit = 20;
this.$.paging.ajax = this.$.ajaxGetLocations;
},
ready: function () {
},
});
</script>
</dom-module>

View File

@ -0,0 +1,46 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../styles/c-app-style.html">
<dom-module id="c-view404">
<template>
<style is="custom-style" include="c-app-style">
:host {
display: block;
min-height: 100%;
padding: 10px 20px;
}
</style>
Oops you hit a 404.
</template>
<script>
Polymer({
is: 'c-view404',
behaviors: [
CustomComponentBehavior, StrolchLocalizeBehavior
],
properties: {
toolbarConfig: {
type: Object,
notify: true,
readOnly: true,
value: {
hasSearchTerm: false
}
},
dataObj: {
type: Object
},
messages: {
type: Array
}
}
});
</script>
</dom-module>

View File

@ -0,0 +1,138 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../../bower_components/strolch-wc-dialog-button/strolch-wc-dialog-button.html">
<link rel="import" href="../styles/c-app-style.html">
<dom-module id="c-demo-books-table">
<template>
<!-- Style -->
<style is="custom-style" include="c-app-style">
:host {
display: block;
min-width: 100%;
padding-bottom: 10px;
}
.select {
flex-basis: 150px;
flex-grow: 0;
}
</style>
<!-- Content -->
<div class="table">
<div class="table-row">
<div class="table-heading">[[localize('id')]]</div>
<div class="table-heading">[[localize('title')]]</div>
<div class="table-heading">[[localize('author')]]</div>
<div class="table-heading select">
<paper-checkbox checked="{{allRowsSelected}}"
on-tap="onToggleAllRowsSelected"
disabled$="[[allNotSelectable]]"></paper-checkbox>
</div>
</div>
<template is="dom-repeat" items="[[rows]]" as="row">
<div class="table-row data">
<div class="table-cell">
<strolch-wc-dialog-button button-icon="info-outline"
dialog-headline="[[row.name]]"
dialog-content="[[row.name]]"
link-url="https://strolch.li"
link-name="Strolch"></strolch-wc-dialog-button>
[[row.id]]
</div>
<div class="table-cell">
[[row.title]]
</div>
<div class="table-cell">
[[row.author]]
</div>
<div class="table-cell select">
<paper-checkbox checked="{{row.selected}}"
disabled$="[[!row.selectable]]"
on-tap="onRowSelected"></paper-checkbox>
<paper-button on-tap="onRemoveBook" raised>[[localize('remove')]]</paper-button>
</div>
</div>
</template>
</div>
</template>
<script>
Polymer({
is: 'c-demo-books-table',
behaviors: [
CustomComponentBehavior
],
properties: {
rows: {
type: Array,
value: [],
observer: "_rowsChanged"
},
allRowsSelected: {
type: Boolean,
value: false
},
allNotSelectable: {
type: Boolean,
value: true
}
},
/* Observers */
observers: [],
_rowsChanged: function (newValue) {
var allNotSelectable = true;
var allSelected = true;
for (var i = 0; i < newValue.length; i++) {
if (newValue[i].selectable) {
allNotSelectable = false;
if (!newValue[i].selected) {
allSelected = false;
break;
}
}
}
this.allNotSelectable = allNotSelectable;
this.allRowsSelected = newValue.length > 0 && allSelected && !allNotSelectable;
this.fire("selected-rows-changed", {value: newValue.slice()});
},
/* Listeners*/
listeners: {},
onToggleAllRowsSelected: function (e) {
var selected = this.allRowsSelected;
for (var i = 0; i < this.rows.length; i++) {
if (this.rows[i].selectable && this.rows[i].selected !== selected) {
this.set("rows." + i + ".selected", !selected);
this.set("rows." + i + ".selected", selected);
}
}
this.fire("selected-rows-changed", {value: this.rows.slice()});
},
onRowSelected: function (e) {
this._rowsChanged(this.rows);
},
onRemoveBook: function (e) {
this.fire("remove-book", {book: e.model.row});
},
/* Private */
/* Public */
/* Lifecycle */
});
</script>
</dom-module>

View File

@ -0,0 +1,205 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="../../bower_components/paper-card/paper-card.html">
<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../../bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="../../bower_components/strolch-wc-dialog-button/strolch-wc-dialog-button.html">
<link rel="import" href="../styles/c-app-style.html">
<link rel="import" href="../widgets/c-demo-location-table.html">
<dom-module id="c-demo-location-detail">
<template>
<!-- Style -->
<style is="custom-style" include="c-app-style">
:host {
display: block;
}
.info {
display: flex;
flex-direction: row;
margin-bottom: 10px;
}
.symbol {
flex-basis: 50px;
flex-shrink: 0;
flex-grow: 0;
display: flex;
align-content: center;
justify-content: center;
align-items: center;
}
.name {
flex-basis: 150px;
flex-shrink: 0;
flex-grow: 1;
flex-direction: column;
display: flex;
padding-top: 10px;
}
.text-name {
font-size: larger;
}
.info-text {
color: var(--google-grey-500);
}
.details {
flex-basis: 100px;
flex-shrink: 0;
flex-grow: 1;
display: flex;
min-width: inherit;
padding-top: 10px;
}
.table-cell {
min-height: inherit;
padding: 0 10px 0 0;
}
.label {
justify-content: flex-end;
}
.select {
flex-basis: 100px;
flex-shrink: 0;
flex-grow: 0;
display: flex;
padding-top: 10px;
}
</style>
<!-- Content -->
<paper-card>
<div class="info" on-tap="toggleCollapse">
<div class="symbol">
<iron-icon icon="icons:android"></iron-icon>
</div>
<div class="name">
<div class="text-name">
[[data.name]]
</div>
<div class="info-text">
[[data.city]]
</div>
</div>
<div class="details table">
<div class="table-row">
<div class="table-cell label">[[localize('nrOfBooks')]]:</div>
<div class="table-cell">
<b>[[data.stocks.length]]</b>
</div>
</div>
</div>
<div class="select">
<paper-checkbox class="person-checkbox"
checked="{{data.checked}}"
disabled="[[!data.selectable]]"
on-tap="dataSelected"></paper-checkbox>
</div>
<paper-ripple></paper-ripple>
</div>
<template is="dom-if" if="[[expanded]]" restamp>
<hr>
<template is="dom-if" if="[[arrayFilled(rows)]]">
<c-demo-location-table rows="[[rows]]" on-refresh="refresh" on-row-selected="onRowSelected"></c-demo-location-table>
</template>
<template is="dom-if" if="[[!arrayFilled(rows)]]">
<p class="g-center"><i>[[localize('noElementsAvailable')]]</i></p>
</template>
<div class="actions padding actions-right">
<paper-button raised on-tap="_removeLocation">Remove</paper-button>
</div>
</template>
</paper-card>
</template>
<script>
Polymer({
is: 'c-demo-location-detail',
behaviors: [
CustomComponentBehavior
],
properties: {
data: {
type: Object,
observer: 'dataChanged'
},
rows: {
type: Array,
value: []
},
selectedRows: {
type: Array,
value: []
},
expanded: {
type: Boolean
},
},
/* Observers */
observers: [],
dataChanged: function (newValue, oldValue) {
this.selectedRows = [];
this.rows = [];
if (newValue && newValue.stocks) {
newValue.stocks.forEach(function (stock) {
stock.selectable = true;
});
}
if (this.expanded && (newValue == null || (oldValue != null && newValue.id !== oldValue.id))) {
this.expanded = false;
} else if (this.expanded) {
this.rows = this.data.stocks;
}
},
/* Listeners*/
listeners: {},
toggleCollapse: function (e) {
this.expanded = !this.expanded;
if (this.expanded) {
this.selectedRows = [];
this.rows = this.data.stocks;
}
},
dataSelected: function (e) {
e.cancelBubble = true;
this.fire('data-selected', {data: this.data});
},
/* Private */
_removeLocation: function (e) {
this.fire("remove-location", {location: this.data});
},
/* Public */
/* Lifecycle */
});
</script>
</dom-module>

View File

@ -0,0 +1,133 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../../bower_components/strolch-wc-dialog-button/strolch-wc-dialog-button.html">
<link rel="import" href="../styles/c-app-style.html">
<dom-module id="c-demo-location-table">
<template>
<!-- Style -->
<style is="custom-style" include="c-app-style">
:host {
display: block;
min-width: 100%;
padding-bottom: 10px;
}
.select {
flex-basis: 80px;
flex-grow: 0;
}
</style>
<!-- Content -->
<div class="table">
<div class="table-row">
<div class="table-heading">[[localize('id')]]</div>
<div class="table-heading">[[localize('name')]]</div>
<div class="table-heading">[[localize('stock')]]</div>
<div class="table-heading select">
<paper-checkbox checked="{{allRowsSelected}}"
on-tap="onToggleAllRowsSelected"
disabled$="[[allNotSelectable]]"></paper-checkbox>
</div>
</div>
<template is="dom-repeat" items="[[rows]]" as="row">
<div class="table-row data">
<div class="table-cell">
<strolch-wc-dialog-button button-icon="info-outline"
dialog-headline="[[row.bookName]]"
dialog-content="[[row.bookName]]"
link-url="https://strolch.li"
link-name="Strolch"></strolch-wc-dialog-button>
[[row.book]]
</div>
<div class="table-cell">
[[row.bookName]]
</div>
<div class="table-cell">
[[row.stock]]
</div>
<div class="table-cell select">
<paper-checkbox checked="{{row.selected}}"
disabled$="[[!row.selectable]]"
on-tap="onRowSelected"></paper-checkbox>
</div>
</div>
</template>
</div>
</template>
<script>
Polymer({
is: 'c-demo-location-table',
behaviors: [
CustomComponentBehavior
],
properties: {
rows: {
type: Array,
value: [],
observer: "_rowsChanged"
},
allRowsSelected: {
type: Boolean,
value: false
},
allNotSelectable: {
type: Boolean,
value: true
}
},
/* Observers */
observers: [],
_rowsChanged: function (newValue) {
var allNotSelectable = true;
var allSelected = true;
for (var i = 0; i < newValue.length; i++) {
if (newValue[i].selectable) {
allNotSelectable = false;
if (!newValue[i].selected) {
allSelected = false;
break;
}
}
}
this.allNotSelectable = allNotSelectable;
this.allRowsSelected = newValue.length > 0 && allSelected && !allNotSelectable;
this.fire("selected-rows-changed", {value: newValue.slice()});
},
/* Listeners*/
listeners: {},
onToggleAllRowsSelected: function (e) {
var selected = this.allRowsSelected;
for (var i = 0; i < this.rows.length; i++) {
if (this.rows[i].selectable && this.rows[i].selected !== selected) {
this.set("rows." + i + ".selected", !selected);
this.set("rows." + i + ".selected", selected);
}
}
this.fire("selected-rows-changed", {value: this.rows.slice()});
},
onRowSelected: function (e) {
this._rowsChanged(this.rows);
},
/* Private */
/* Public */
/* Lifecycle */
});
</script>
</dom-module>

View File

@ -0,0 +1,41 @@
{
"name": "${artifactId}",
"authors": [
"Robert von Burg <eitch@eitchnet.ch>"
],
"private": true,
"dependencies": {
"strolchjs": "strolch-li/strolchjs#^0.5.3",
"strolch-wc-styles": "strolch-li/strolch-wc-styles#^0.4.8",
"strolch-wc-auth": "strolch-li/strolch-wc-auth#^0.9.9",
"strolch-wc-badge": "strolch-li/strolch-wc-badge#^0.1.4",
"strolch-wc-notification": "strolch-li/strolch-wc-notification#^0.1.1",
"strolch-wc-inspector": "strolch-li/strolch-wc-inspector#^0.23.6",
"strolch-wc-util-behavior": "strolch-li/strolch-wc-util-behavior#^0.3.7",
"strolch-wc-localize-behavior": "strolch-li/strolch-wc-localize-behavior#^1.1.15",
"strolch-wc-debounced-input": "strolch-li/strolch-wc-debounced-input#^0.1.6",
"strolch-wc-dialog-button": "strolch-li/strolch-wc-dialog-button#^0.1.7",
"strolch-wc-information-dialog": "strolch-li/strolch-wc-information-dialog#^0.1.14",
"strolch-wc-parameter-input": "strolch-li/strolch-wc-parameter-input#^0.1.5",
"strolch-wc-reports": "strolch-li/strolch-wc-reports#^0.5.3",
"strolch-wc-paging": "strolch-li/strolch-wc-paging#^0.1.7",
"strolch-wc-ws-observer": "strolch-li/strolch-wc-ws-observer#^0.2.11",
"strolch-wc-tree": "strolch-li/strolch-wc-tree#^0.2.6",
"polymer": "Polymer/polymer#^1.12.0",
"iron-pages": "PolymerElements/iron-pages#^1.0.9",
"font-awesome": "FortAwesome/Font-Awesome#^4.7.0",
"app-route": "PolymerElements/app-route#^1.0.1",
"app-layout": "PolymerElements/app-layout#^1.0.1",
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.5.1",
"paper-menu": "PolymerElements/paper-menu#^1.3.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.1.6",
"paper-header-panel": "PolymerElements/paper-header-panel#^1.1.7",
"paper-input": "PolymerElements/paper-input#^1.1.24",
"paper-radio-group": "PolymerElements/paper-radio-group#^1.2.2",
"paper-toggle-button": "PolymerElements/paper-toggle-button#^1.3.0",
"paper-toast": "PolymerElements/paper-toast#^1.3.1"
},
"devDependencies": {
}
}

View File

@ -0,0 +1,93 @@
const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
const merge = require('merge-stream');
const del = require('del');
// temporary until gulp 4.0 is released
const runSequence = require('run-sequence');
const vulcanize = require('gulp-vulcanize');
const minify = require('gulp-minify');
const crisper = require('gulp-crisper');
const shell = require('gulp-shell');
const rename = require("gulp-rename");
const replace = require('gulp-replace');
// Copy All Files At The Root Level
gulp.task('copy', function () {
var svg = gulp.src([
'app/**/*.svg', '!app/bower_components/**/hero.svg', '!app/bower_components/mocha/**/*', '!app/bower_components/**/{demo,test,site}/**/*'
])
.pipe(gulp.dest('www/'));
var font = gulp.src([
'app/font/*'
])
.pipe(gulp.dest('www/font/'));
var imgs = gulp.src([
'app/img/*.svg', 'app/img/*.ico', 'app/img/*.png', 'app/img/*.gif'
])
.pipe(gulp.dest('www/img/'));
var locales = gulp.src([
'app/bower_components/**/locales.json'
])
.pipe(gulp.dest('www/bower_components/'));
var app_files = gulp.src([
'app/bower.json', 'app/manifest.json', 'app/locales.json', '**/moment.min.js'
])
.pipe(gulp.dest('www/'));
var js = gulp.src([
'src/**/*'
])
.pipe(gulp.dest('js'));
return merge(svg, font, imgs, locales, app_files, js)
.pipe($.size({title: 'Copy app files to dist dir:'}));
});
gulp.task('vulcanize', function () {
return gulp.src('app/index.html')
.pipe(vulcanize({
stripComments: true,
inlineScripts: true,
inlineCss: true
}))
.pipe(replace('<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic" crossorigin="anonymous">', ''))
.pipe(replace("font-family: 'Roboto', 'Noto', sans-serif;", "font-family: 'Ubuntu-local', sans-serif;"))
.pipe(crisper())
.pipe(gulp.dest('www/'));
});
gulp.task('compress', function () {
return gulp.src('www/index.js')
.pipe(minify({}))
.pipe(gulp.dest('www/'))
});
// Clean Output Directory
gulp.task('clean-www', del.bind(null, ['www/']));
// Remove unneeded files
gulp.task('del-files', del.bind(null, ['www/index-min.js']));
gulp.task('move-indexjs-js', function () {
return gulp.src('./www/index-min.js') //
.pipe(rename('index.js'))
.pipe(gulp.dest('./www/'));
});
// bower install
gulp.task('bower', shell.task('bower install'));
// Build Production Files, the Default Task
gulp.task('prepare', ['bower'], function (cb) {
runSequence('clean-www', cb);
});
gulp.task('default', ['prepare'], function (cb) {
runSequence('copy', 'vulcanize', 'compress', 'del-files', cb);
});

View File

@ -0,0 +1,7 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0;url=./www/index.html" />
</head>
</html>

View File

@ -0,0 +1,161 @@
{
"de": {
"appTitle": "${appName}",
"demo-locations": "Demo Locations",
"demo-books": "Demo Books",
"title": "Title",
"author": "Author",
"logout": "Ausloggen",
"language": "Sprache",
"reports": "Berichte",
"operations-log": "Betriebsnachrichten",
"jobs": "Jobs",
"sessions": "Sitzungen",
"users": "Benutzer",
"roles": "Rollen",
"control": "Control",
"inspector": "Inspector",
"newVersionAvailableRefreshRequired": "Eine neue Version steht zur Verfügung",
"refresh": "Aktualisieren",
"close": "Schliessen",
"cancel": "Abbrechen",
"ok": "Ok",
"reconnect": "Wiederhestellen",
"serverNotAvailable": "Server nicht erreichbar",
"serverNotAvailableMsg": "Die Verbindung zum Server ist zur Zeit unterbrochen",
"privilegeDenied": "Aktion verweigert",
"privilegeDeniedText": "Die Aktion wurde verweigert.",
"sessionInvalid": "Sitzung ungültig",
"sessionInvalidConfirmNavToLogin": "Die Sitzung ist abgelaufen oder ungültig. Bitte neu anmelden.",
"sessionInvalidLoggingBackIn": "Die Sitzung ist ungültig oder abgelaufen, automatische Anmeldung wird ausgeführt...",
"errorOccurred": "Ein Fehler ist aufgetreten",
"login": "Login",
"i18n-editor": "Internationalisierungs Editor",
"user": "Benutzer",
"mode": "Modus",
"enable": "Aktivieren",
"disable": "Deaktivieren",
"status": "Status",
"id": "ID",
"deleted": "Gelöscht",
"date": "Datum",
"Created": "Erstellt",
"Planning": "In Planung",
"Planned": "Geplant",
"Execution": "In Ausführung",
"Warning": "Warnung",
"Error": "Fehler",
"Executed": "Ausgeführt",
"Closed": "Geschlossen",
"keepAlive": "Eingeloggt bleiben",
"systemAction.failed": "Systembefehl {action} fehlgeschlagen: {reason}",
"enabled": "Aktiv",
"severity": "Schweregrad",
"true": "Ja",
"false": "Nein",
"Info": "Information",
"Exception": "Ausnahme",
"clearInactiveMessages": "Inaktive Meldungen entfernen",
"clearInactiveMessagesConfirm": "Sollen alle inaktive Meldungen entfernt werden?",
"executionDate": "Ausführungsdatum",
"orderDate": "Auftragsdatum",
"info": "Information",
"agent.service.failed.access.denied": "Benutzer {user} darf Service {service} nicht ausführen",
"agent.query.failed.access.denied": "Benutzer {user} darf Abfrage {query} nicht ausführen",
"agent.search.failed.access.denied": "Benutzer {user} darf Suche {search} nicht ausführen"
},
"en": {
"agent.service.failed.access.denied": "User {user} may not perform service {service}",
"agent.query.failed.access.denied": "User {user} may not perform query {query}",
"agent.search.failed.access.denied": "User {user} may not perform search {search}",
"demo-locations": "Demo Locations",
"demo-books": "Demo Books",
"title": "Titel",
"author": "Author",
"logout": "Logout",
"info": "Information",
"keepAlive": "Stay logged in",
"appTitle": "${appName}",
"language": "Language",
"reports": "Reports",
"operations-log": "Operation Logs",
"jobs": "Jobs",
"sessions": "Sessions",
"users": "Users",
"roles": "Roles",
"control": "Control",
"inspector": "Inspector",
"newVersionAvailableRefreshRequired": "A new version is available",
"refresh": "Refresh",
"close": "Close",
"cancel": "Cancel",
"ok": "Ok",
"reconnect": "Reconnect",
"serverNotAvailable": "Server not available",
"serverNotAvailableMsg": "The connection to the server is currently not available",
"privilegeDenied": "Action denied",
"privilegeDeniedText": "The action has been denied",
"sessionInvalid": "Session Invalid",
"sessionInvalidConfirmNavToLogin": "The session has expired or is invalid. Please logon again.",
"sessionInvalidLoggingBackIn": "The session is invalid or has expired, automatic logon has commenced...",
"enabled": "Active",
"severity": "Severity",
"true": "Yes",
"false": "No",
"Info": "Information",
"Exception": "Exception",
"clearInactiveMessages": "Remove inactive messages",
"clearInactiveMessagesConfirm": "Should all inactive messages be removed?",
"errorOccurred": "An error occurred",
"systemAction.failed": "SystemAction {action} failed: {reason}",
"Created": "Created",
"Planning": "Planning",
"Planned": "Planned",
"Execution": "Execution",
"Warning": "Warning",
"Error": "Error",
"Executed": "Executed",
"Closed": "Closed",
"date": "Date",
"deleted": "Deleted",
"id": "ID",
"status": "Status",
"enable": "Enable",
"disable": "Disable",
"mode": "Mode",
"user": "User",
"i18n-editor": "Internationalization editor",
"login": "Login"
},
"fr": {
"appTitle": "${appName}",
"demo-locations": "Demo Locations",
"demo-books": "Demo Books",
"language": "Langue",
"reports": "Rapports",
"operations-log": "Logs",
"jobs": "Jobs",
"sessions": "Sessions",
"users": "Utilisateurs",
"roles": "Rôles",
"control": "Controle",
"inspector": "Inspecteur",
"newVersionAvailableRefreshRequired": "Une nouvelle version est disponible!",
"refresh": "Actualiser",
"close": "Fermer",
"cancel": "Annuler",
"ok": "Ok",
"reconnect": "Reconnecter",
"serverNotAvailable": "Server indisponible",
"serverNotAvailableMsg": "La connexion au serveur est indisponible",
"privilegeDenied": "Action refusée",
"privilegeDeniedText": "L'action a été refusée.",
"sessionInvalid": "Session invalide",
"sessionInvalidConfirmNavToLogin": "La session a expirée, veuillez vous reconnecter.",
"sessionInvalidLoggingBackIn": "La session a expirée, reconnexion automatiqque...",
"errorOccurred": "Une erreur s'est produite",
"agent.service.failed.access.denied": "Utilisateur {user} ne peut exécuter le service {service}",
"agent.query.failed.access.denied": "Utilisateur {user} ne peut exécuter la demande {query}",
"agent.search.failed.access.denied": "Utilisateur {user} ne peut exécuter la recherche {search}"
}
}

View File

@ -0,0 +1,37 @@
{
"name": "${artifactId}",
"description": "${appName}",
"version": "0.1.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/strolch-li/strolch.git"
},
"author": "Robert von Burg <eitch@eitchnet.ch>",
"license": "Proprietary",
"keywords": [],
"bugs": {
"url": "https://github.com/strolch-li/strolch/issues"
},
"homepage": "https://www.strolch.li",
"devDependencies": {
"bower": "^1.8.8",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-crisper": "^1.1.0",
"gulp-imagemin": "^7.1.0",
"gulp-load-plugins": "^1.4.0",
"gulp-minify": "0.0.15",
"gulp-rename": "^1.2.2",
"gulp-shell": "^0.8.0",
"gulp-size": "^2.1.0",
"gulp-vulcanize": "^6.1.0",
"gulp-replace": "^1.1.3",
"merge-stream": "^1.0.0",
"run-sequence": "^1.2.2",
"vulcanize": "^1.15.3"
},
"scripts": {
"postinstall": "bower install"
}
}

View File

@ -0,0 +1,50 @@
package ${package}.test;
import static ${package}.model.Constants.TYPE_BOOK;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import li.strolch.model.Resource;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.privilege.model.Certificate;
import li.strolch.testbase.runtime.RuntimeMock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class SimpleTest {
private static final String SRC_PATH = "src/test/resources/runtime-SimpleTest";
private static final String TARGET_PATH = "target/" + SimpleTest.class;
private static RuntimeMock runtimeMock;
private static Certificate certificate;
@BeforeClass
public static void beforeClass() {
runtimeMock = new RuntimeMock().mockRuntime(TARGET_PATH, SRC_PATH);
runtimeMock.startContainer();
certificate = runtimeMock.loginTest();
}
@AfterClass
public static void afterClass() {
if (certificate != null)
runtimeMock.logout(certificate);
if (runtimeMock != null)
runtimeMock.destroyRuntime();
}
@Test
public void shouldLoadIntoRealm() {
try (StrolchTransaction tx = runtimeMock.openUserTx(certificate, true)) {
Resource book = tx.getResourceBy(TYPE_BOOK, "book1", true);
assertTrue(book.hasParameter("author"));
assertEquals("Roger Penrose", book.getParameter("author", true).getValue());
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d [%thread] %-5level %class{36}:%line %method - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<Privilege>
<Container>
<Parameters>
<!-- parameters for the container itself -->
<Parameter name="secretKey" value="CHANGE-ME-1"/>
<Parameter name="secretSalt" value="CHANGE-ME-2"/>
<Parameter name="persistSessions" value="true"/>
<Parameter name="autoPersistOnUserChangesData" value="true"/>
<Parameter name="privilegeConflictResolution" value="MERGE"/>
<Parameter name="allowSessionRefresh" value="true"/>
</Parameters>
<EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler">
<Parameters>
<!-- WARNING: If you change iterations or keyLength, then all passwords are invalid -->
<!-- default algorithm is: PBKDF2WithHmacSHA512 -->
<Parameter name="hashAlgorithm" value="PBKDF2WithHmacSHA512"/>
<!-- default iterations: 200000 -->
<Parameter name="hashIterations" value="10000"/>
<!-- default key length: 256 -->
<Parameter name="hashKeyLength" value="256"/>
</Parameters>
</EncryptionHandler>
<PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler">
<Parameters>
<Parameter name="usersXmlFile" value="PrivilegeUsers.xml"/>
<Parameter name="rolesXmlFile" value="PrivilegeRoles.xml"/>
</Parameters>
</PersistenceHandler>
<UserChallengeHandler class="li.strolch.privilege.handler.ConsoleUserChallengeHandler">
</UserChallengeHandler>
</Container>
<Policies>
<Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege"/>
<Policy name="ModelPrivilege" class="li.strolch.runtime.privilege.ModelPrivilege"/>
<Policy name="RoleAccessPrivilege" class="li.strolch.privilege.policy.RoleAccessPrivilege"/>
<Policy name="UserAccessPrivilege" class="li.strolch.privilege.policy.UserAccessPrivilege"/>
<Policy name="UserSessionAccessPrivilege" class="li.strolch.privilege.policy.UsernameFromCertificatePrivilege"/>
</Policies>
</Privilege>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<Roles>
<Role name="AppUser">
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.report.ReportSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<!--
Internal
-->
<Role name="ModelAccessor">
<Privilege name="GetOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveActivity" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="GetResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="AddResource" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="UpdateOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="RemoveOrder" policy="ModelPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
<Role name="agent">
<Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeRemoveUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.search.StrolchSearch" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege">
<Allow>li.strolch.runtime.privilege.StrolchSystemAction</Allow>
<Allow>li.strolch.runtime.privilege.StrolchSystemActionWithResult</Allow>
<Allow>li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer</Allow>
</Privilege>
<Privilege name="PrivilegeAction" policy="DefaultPrivilege">
<Allow>Persist</Allow>
<Allow>GetCertificates</Allow>
<Allow>PersistSessions</Allow>
</Privilege>
<Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
<Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role>
</Roles>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<User userId="1" username="agent">
<State>SYSTEM</State>
<Roles>
<Role>agent</Role>
</Roles>
</User>
<!-- Password: admin -->
<User userId="3" username="test" password="fdd9d2def3475e1d5cc87107b87e14fd6adbca664c2874fc379a1e53931c0428" salt="74657374">
<Firstname>Application</Firstname>
<Lastname>Administrator</Lastname>
<State>ENABLED</State>
<Locale>en-GB</Locale>
<Roles>
<Role>AppUser</Role>
</Roles>
<Properties>
<Property name="realm" value="defaultRealm" />
</Properties>
</User>
</Users>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchConfiguration>
<env id="dev">
<Runtime>
<applicationName>${appName}</applicationName>
<Properties>
<locale>en</locale>
<verbose>true</verbose>
</Properties>
</Runtime>
<Component>
<name>PrivilegeHandler</name>
<api>li.strolch.runtime.privilege.PrivilegeHandler</api>
<impl>li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</impl>
<Properties>
<privilegeConfigFile>PrivilegeConfig.xml</privilegeConfigFile>
</Properties>
</Component>
<Component>
<name>RealmHandler</name>
<api>li.strolch.agent.api.RealmHandler</api>
<impl>li.strolch.agent.impl.DefaultRealmHandler</impl>
<depends>PrivilegeHandler</depends>
<Properties>
<realms>defaultRealm</realms>
<dataStoreMode>TRANSIENT</dataStoreMode>
<dataStoreFile>Model.xml</dataStoreFile>
<enableObserverUpdates>true</enableObserverUpdates>
</Properties>
</Component>
<Component>
<name>ServiceHandler</name>
<api>li.strolch.service.api.ServiceHandler</api>
<impl>li.strolch.service.api.DefaultServiceHandler</impl>
<depends>RealmHandler</depends>
<depends>PrivilegeHandler</depends>
<Properties>
<verbose>true</verbose>
</Properties>
</Component>
<Component>
<name>PostInitializer</name>
<api>li.strolch.agent.api.PostInitializer</api>
<impl>${package}.components.PostInitializer</impl>
<depends>ServiceHandler</depends>
<Properties>
</Properties>
</Component>
</env>
</StrolchConfiguration>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel.xsd">
<!-- include root model here -->
<IncludeFile file="../../../runtime/data/Model.xml"/>
<!-- add test specific model data here -->
</StrolchModel>

83
pom.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.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>
<groupId>li.strolch</groupId>
<artifactId>li.strolch-maven-archetypes</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>li.strolch-maven-archetypes</name>
<description>Module build for strolch maven archetypes</description>
<packaging>pom</packaging>
<url>http://www.strolch.li</url>
<inceptionYear>2022</inceptionYear>
<issueManagement>
<system>Github Issues</system>
<url>https://github.com/strolch-li/strolch/issues</url>
</issueManagement>
<scm>
<connection>scm:git:https://github.com/strolch-li/strolch-maven-archetypes.git</connection>
<developerConnection>scm:git:https://github.com/strolch-li/strolch-maven-archetypes.git</developerConnection>
<url>https://github.com/strolch-li/strolch-maven-archetypes</url>
</scm>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<organization>
<name>Strolch</name>
<url>http://www.strolch.li</url>
</organization>
<developers>
<developer>
<id>eitch</id>
<name>Robert von Burg</name>
<email>eitch@eitchnet.ch</email>
<url>http://www.eitchnet.ch</url>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+1</timezone>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
<buildTimestamp>${maven.build.timestamp}</buildTimestamp>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<archetype-packaging.version>3.2.0</archetype-packaging.version>
</properties>
<modules>
<module>li.strolch.mvn.archetype.main</module>
<module>li.strolch.mvn.archetype.webapp</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>