diff --git a/li.strolch.persistence.xml/.gitignore b/li.strolch.persistence.xml/.gitignore
new file mode 100644
index 000000000..b284c6517
--- /dev/null
+++ b/li.strolch.persistence.xml/.gitignore
@@ -0,0 +1,4 @@
+target/
+.project
+.settings
+.classpath
diff --git a/li.strolch.persistence.xml/LICENSE b/li.strolch.persistence.xml/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/li.strolch.persistence.xml/LICENSE
@@ -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.
diff --git a/li.strolch.persistence.xml/README.md b/li.strolch.persistence.xml/README.md
new file mode 100644
index 000000000..35f61b964
--- /dev/null
+++ b/li.strolch.persistence.xml/README.md
@@ -0,0 +1,6 @@
+li.strolch.persistence.xml
+==========================
+
+[![Build Status](http://jenkins.eitchnet.ch/buildStatus/icon?job=li.strolch.persistence.xml)](http://jenkins.eitchnet.ch/view/strolch/job/li.strolch.persistence.xml/)
+
+XML Persistence Implementation for Strolch
diff --git a/li.strolch.persistence.xml/pom.xml b/li.strolch.persistence.xml/pom.xml
new file mode 100644
index 000000000..02df6bc80
--- /dev/null
+++ b/li.strolch.persistence.xml/pom.xml
@@ -0,0 +1,94 @@
+
+
+
+ li.strolch
+ li.strolch.parent
+ 1.0.0-SNAPSHOT
+ ../li.strolch.parent/pom.xml
+
+
+ 4.0.0
+
+ li.strolch.persistence.xml
+
+ li.strolch.persistence.xml
+ Reference Persistence Implementation for Strolch
+
+ https://github.com/eitchnet/li.strolch.persistence.xml
+
+ 2011
+
+
+ Github Issues
+ https://github.com/eitchnet/li.strolch.persistence.xml/issues
+
+
+
+ scm:git:https://github.com/eitchnet/li.strolch.persistence.xml.git
+ scm:git:git@github.com:eitch/li.strolch.persistence.xml.git
+ https://github.com/eitchnet/li.strolch.persistence.xml
+
+
+
+
+
+ li.strolch
+ li.strolch.model
+
+
+ li.strolch
+ li.strolch.agent
+
+
+ ch.eitchnet
+ ch.eitchnet.xmlpers
+
+
+
+
+ li.strolch
+ li.strolch.testbase
+ test
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+ **/componentVersion.properties
+
+
+
+
+
+ org.codehaus.mojo
+ buildnumber-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-eclipse-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/AbstractDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/AbstractDao.java
new file mode 100644
index 000000000..932fa2e1a
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/AbstractDao.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import li.strolch.model.StrolchElement;
+import li.strolch.persistence.api.StrolchDao;
+import li.strolch.persistence.api.StrolchTransaction;
+import ch.eitchnet.xmlpers.api.PersistenceTransaction;
+import ch.eitchnet.xmlpers.objref.IdOfSubTypeRef;
+import ch.eitchnet.xmlpers.objref.SubTypeRef;
+import ch.eitchnet.xmlpers.objref.TypeRef;
+
+public abstract class AbstractDao implements StrolchDao {
+
+ protected PersistenceTransaction tx;
+
+ protected AbstractDao(StrolchTransaction tx) {
+ XmlStrolchTransaction strolchTx = (XmlStrolchTransaction) tx;
+ this.tx = strolchTx.getTx();
+ }
+
+ protected abstract String getClassType();
+
+ protected IdOfSubTypeRef getIdRef(String type, String id) {
+ IdOfSubTypeRef idRef = this.tx.getObjectRefCache().getIdOfSubTypeRef(getClassType(), type, id);
+ return idRef;
+ }
+
+ protected SubTypeRef getTypeRef(String type) {
+ SubTypeRef typeRef = this.tx.getObjectRefCache().getSubTypeRef(getClassType(), type);
+ return typeRef;
+ }
+
+ @Override
+ public boolean hasElement(String type, String id) {
+ IdOfSubTypeRef ref = getIdRef(type, id);
+ return this.tx.getObjectDao().hasElement(ref);
+ }
+
+ @Override
+ public long querySize() {
+ long size = 0;
+ Set types = queryTypes();
+ for (String type : types) {
+
+ SubTypeRef subTypeRef = getTypeRef(type);
+ size += this.tx.getMetadataDao().querySize(subTypeRef);
+ }
+ return size;
+ }
+
+ @Override
+ public long querySize(String type) {
+ SubTypeRef subTypeRef = getTypeRef(type);
+ return this.tx.getMetadataDao().querySize(subTypeRef);
+ }
+
+ @Override
+ public Set queryKeySet() {
+ Set keys = new HashSet<>();
+ Set types = queryTypes();
+ for (String type : types) {
+ keys.addAll(queryKeySet(type));
+ }
+ return keys;
+ }
+
+ @Override
+ public Set queryKeySet(String type) {
+ SubTypeRef typeRef = getTypeRef(type);
+ Set keys = this.tx.getMetadataDao().queryKeySet(typeRef);
+ return keys;
+ }
+
+ @Override
+ public Set queryTypes() {
+ TypeRef typeRef = this.tx.getObjectRefCache().getTypeRef(getClassType());
+ Set types = this.tx.getMetadataDao().queryTypeSet(typeRef);
+ return types;
+ }
+
+ @Override
+ public T queryBy(String type, String id) {
+ T t = this.tx.getObjectDao().queryById(getIdRef(type, id));
+ return t;
+ }
+
+ @Override
+ public List queryAll() {
+ List objects = new ArrayList<>();
+ Set types = queryTypes();
+ for (String type : types) {
+ List objectsByType = this.tx.getObjectDao().queryAll(getTypeRef(type));
+ objects.addAll(objectsByType);
+ }
+
+ return objects;
+ }
+
+ @Override
+ public List queryAll(String type) {
+ List objectsByType = this.tx.getObjectDao().queryAll(getTypeRef(type));
+ return objectsByType;
+ }
+
+ @Override
+ public void save(T object) {
+ this.tx.getObjectDao().add(object);
+ }
+
+ @Override
+ public void saveAll(List objects) {
+ this.tx.getObjectDao().addAll(objects);
+ }
+
+ @Override
+ public void update(T object) {
+ this.tx.getObjectDao().update(object);
+ }
+
+ @Override
+ public void updateAll(List objects) {
+ this.tx.getObjectDao().updateAll(objects);
+ }
+
+ @Override
+ public void remove(T object) {
+ this.tx.getObjectDao().remove(object);
+ }
+
+ @Override
+ public void removeAll(List objects) {
+ this.tx.getObjectDao().removeAll(objects);
+ }
+
+ @Override
+ public long removeAll() {
+ TypeRef typeRef = this.tx.getObjectRefCache().getTypeRef(getClassType());
+ return this.tx.getObjectDao().removeAllBy(typeRef);
+ }
+
+ @Override
+ public long removeAllBy(String type) {
+ SubTypeRef typeRef = getTypeRef(type);
+ return this.tx.getObjectDao().removeAllBy(typeRef);
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlAuditDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlAuditDao.java
new file mode 100644
index 000000000..47695ece7
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlAuditDao.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import li.strolch.model.Tags;
+import li.strolch.model.audit.Audit;
+import li.strolch.model.audit.AuditQuery;
+import li.strolch.model.audit.AuditVisitor;
+import li.strolch.persistence.api.AuditDao;
+import li.strolch.persistence.api.StrolchTransaction;
+import ch.eitchnet.utils.collections.DateRange;
+import ch.eitchnet.xmlpers.api.PersistenceContext;
+import ch.eitchnet.xmlpers.api.PersistenceTransaction;
+import ch.eitchnet.xmlpers.objref.IdOfSubTypeRef;
+import ch.eitchnet.xmlpers.objref.ObjectRef;
+import ch.eitchnet.xmlpers.objref.SubTypeRef;
+import ch.eitchnet.xmlpers.objref.TypeRef;
+
+/**
+ * @author Robert von Burg
+ */
+public class XmlAuditDao implements AuditDao {
+
+ private PersistenceTransaction tx;
+
+ public XmlAuditDao(StrolchTransaction tx) {
+ XmlStrolchTransaction strolchTx = (XmlStrolchTransaction) tx;
+ this.tx = strolchTx.getTx();
+ }
+
+ protected String getClassType() {
+ return Tags.AUDIT;
+ }
+
+ protected IdOfSubTypeRef getIdRef(String type, Long id) {
+ IdOfSubTypeRef idRef = this.tx.getObjectRefCache().getIdOfSubTypeRef(getClassType(), type, id.toString());
+ return idRef;
+ }
+
+ protected SubTypeRef getTypeRef(String type) {
+ SubTypeRef typeRef = this.tx.getObjectRefCache().getSubTypeRef(getClassType(), type);
+ return typeRef;
+ }
+
+ @Override
+ public boolean hasElement(String type, Long id) {
+ IdOfSubTypeRef ref = getIdRef(type, id);
+ return this.tx.getObjectDao().hasElement(ref);
+ }
+
+ @Override
+ public long querySize(DateRange dateRange) {
+ long size = 0;
+ Set types = queryTypes();
+ for (String type : types) {
+ // SubTypeRef subTypeRef = getTypeRef(type);
+ // size += this.tx.getMetadataDao().querySize(subTypeRef);
+
+ size += querySize(type, dateRange);
+ }
+ return size;
+ }
+
+ @Override
+ public long querySize(String type, DateRange dateRange) {
+ long size = 0;
+
+ // TODO re-think this nonsense... this might have a huge performance penalty
+ SubTypeRef subTypeRef = getTypeRef(type);
+ Set keySet = this.tx.getMetadataDao().queryKeySet(subTypeRef);
+ for (String key : keySet) {
+ ObjectRef objectRef = subTypeRef.getChildIdRef(this.tx, key);
+ Audit audit = this.tx.getObjectDao().queryById(objectRef);
+ if (dateRange.contains(audit.getDate()))
+ size++;
+ }
+
+ // return this.tx.getMetadataDao().querySize(subTypeRef);
+ return size;
+ }
+
+ @Override
+ public Set queryTypes() {
+ TypeRef typeRef = this.tx.getObjectRefCache().getTypeRef(getClassType());
+ Set types = this.tx.getMetadataDao().queryTypeSet(typeRef);
+ return types;
+ }
+
+ @Override
+ public Audit queryBy(String type, Long id) {
+ Audit t = this.tx.getObjectDao().queryById(getIdRef(type, id));
+ return t;
+ }
+
+ @Override
+ public List queryAll(String type, DateRange dateRange) {
+
+ List audits = new ArrayList<>();
+
+ SubTypeRef subTypeRef = getTypeRef(type);
+ Set keySet = this.tx.getMetadataDao().queryKeySet(subTypeRef);
+ for (String key : keySet) {
+ ObjectRef objectRef = subTypeRef.getChildIdRef(this.tx, key);
+ Audit audit = this.tx.getObjectDao().queryById(objectRef);
+ if (dateRange.contains(audit.getDate()))
+ audits.add(audit);
+ }
+
+ // this.tx.getObjectDao().queryAll(getTypeRef(type));
+ return audits;
+ }
+
+ @Override
+ public void save(Audit audit) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performCreate(ctx);
+ }
+
+ @Override
+ public void saveAll(List audits) {
+ for (Audit audit : audits) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performCreate(ctx);
+ }
+ }
+
+ @Override
+ public void update(Audit audit) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performUpdate(ctx);
+ }
+
+ @Override
+ public void updateAll(List audits) {
+ for (Audit audit : audits) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performUpdate(ctx);
+ }
+ }
+
+ @Override
+ public void remove(Audit audit) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performDelete(ctx);
+ }
+
+ @Override
+ public void removeAll(List audits) {
+ for (Audit audit : audits) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(audit);
+ this.tx.getFileDao().performDelete(ctx);
+ }
+ }
+
+ @Override
+ public long removeAll(String type, DateRange dateRange) {
+
+ long removed = 0L;
+
+ SubTypeRef subTypeRef = getTypeRef(type);
+ Set keySet = this.tx.getMetadataDao().queryKeySet(subTypeRef);
+ for (String key : keySet) {
+ ObjectRef objectRef = subTypeRef.getChildIdRef(this.tx, key);
+ Audit audit = this.tx.getObjectDao().queryById(objectRef);
+ if (dateRange.contains(audit.getDate())) {
+ PersistenceContext ctx = this.tx.getObjectDao().createCtx(objectRef);
+ this.tx.getFileDao().performDelete(ctx);
+ removed++;
+ }
+ }
+
+ return removed;
+ }
+
+ @Override
+ public List doQuery(AuditQuery query, AuditVisitor auditVisitor) {
+ // TODO implement XML file based querying...
+ throw new UnsupportedOperationException("not yet implemented!");
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlOrderDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlOrderDao.java
new file mode 100644
index 000000000..a5b109d50
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlOrderDao.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.util.List;
+
+import li.strolch.model.Order;
+import li.strolch.model.OrderVisitor;
+import li.strolch.model.Tags;
+import li.strolch.model.query.OrderQuery;
+import li.strolch.persistence.api.OrderDao;
+import li.strolch.persistence.api.StrolchTransaction;
+
+public class XmlOrderDao extends AbstractDao implements OrderDao {
+
+ protected XmlOrderDao(StrolchTransaction tx) {
+ super(tx);
+ }
+
+ @Override
+ protected String getClassType() {
+ return Tags.ORDER;
+ }
+
+ @Override
+ public List doQuery(OrderQuery query, OrderVisitor orderVisitor) {
+ // TODO implement XML file based querying...
+ throw new UnsupportedOperationException("not yet implemented!");
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java
new file mode 100644
index 000000000..a281bb768
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.io.File;
+import java.util.Properties;
+
+import li.strolch.agent.api.ComponentContainer;
+import li.strolch.agent.api.StrolchComponent;
+import li.strolch.agent.api.StrolchRealm;
+import li.strolch.model.Order;
+import li.strolch.model.Resource;
+import li.strolch.model.Tags;
+import li.strolch.model.audit.Audit;
+import li.strolch.persistence.api.AuditDao;
+import li.strolch.persistence.api.OrderDao;
+import li.strolch.persistence.api.PersistenceHandler;
+import li.strolch.persistence.api.ResourceDao;
+import li.strolch.persistence.api.StrolchTransaction;
+import li.strolch.persistence.xml.model.AuditContextFactory;
+import li.strolch.persistence.xml.model.OrderContextFactory;
+import li.strolch.persistence.xml.model.ResourceContextFactory;
+import li.strolch.runtime.configuration.ComponentConfiguration;
+import ch.eitchnet.privilege.model.Certificate;
+import ch.eitchnet.xmlpers.api.IoMode;
+import ch.eitchnet.xmlpers.api.PersistenceConstants;
+import ch.eitchnet.xmlpers.api.PersistenceManager;
+import ch.eitchnet.xmlpers.api.PersistenceManagerLoader;
+import ch.eitchnet.xmlpers.api.PersistenceTransaction;
+
+/**
+ * @author Robert von Burg
+ */
+public class XmlPersistenceHandler extends StrolchComponent implements PersistenceHandler {
+
+ public static final String DB_STORE_PATH = "dbStore/"; //$NON-NLS-1$
+ private PersistenceManager persistenceManager;
+
+ public XmlPersistenceHandler(ComponentContainer container, String componentName) {
+ super(container, componentName);
+ }
+
+ @Override
+ public void initialize(ComponentConfiguration componentConfiguration) {
+
+ File basePathF = componentConfiguration.getRuntimeConfiguration().getRootPath();
+ File dbStorePathF = new File(basePathF, DB_STORE_PATH);
+
+ Properties properties = new Properties();
+ properties.setProperty(PersistenceConstants.PROP_VERBOSE, "true"); //$NON-NLS-1$
+ properties.setProperty(PersistenceConstants.PROP_XML_IO_MOD, IoMode.DOM.name());
+ properties.setProperty(PersistenceConstants.PROP_BASEPATH, dbStorePathF.getAbsolutePath());
+
+ this.persistenceManager = PersistenceManagerLoader.load(properties);
+
+ this.persistenceManager.getCtxFactory().registerPersistenceContextFactory(Resource.class, Tags.RESOURCE,
+ new ResourceContextFactory());
+ this.persistenceManager.getCtxFactory().registerPersistenceContextFactory(Order.class, Tags.ORDER,
+ new OrderContextFactory());
+ this.persistenceManager.getCtxFactory().registerPersistenceContextFactory(Audit.class, Tags.AUDIT,
+ new AuditContextFactory());
+
+ super.initialize(componentConfiguration);
+ }
+
+ @SuppressWarnings("resource")
+ @Override
+ public StrolchTransaction openTx(StrolchRealm realm, Certificate certificate, String action) {
+ PersistenceTransaction tx = this.persistenceManager.openTx(realm.getRealm());
+ return new XmlStrolchTransaction(getContainer().getPrivilegeHandler(), realm, certificate, action, tx, this);
+ }
+
+ @Override
+ public OrderDao getOrderDao(StrolchTransaction tx) {
+ return new XmlOrderDao(tx);
+ }
+
+ @Override
+ public ResourceDao getResourceDao(StrolchTransaction tx) {
+ return new XmlResourceDao(tx);
+ }
+
+ @Override
+ public AuditDao getAuditDao(StrolchTransaction tx) {
+ return new XmlAuditDao(tx);
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlResourceDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlResourceDao.java
new file mode 100644
index 000000000..1e8c1f114
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlResourceDao.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.util.List;
+
+import li.strolch.model.Resource;
+import li.strolch.model.ResourceVisitor;
+import li.strolch.model.Tags;
+import li.strolch.model.query.ResourceQuery;
+import li.strolch.persistence.api.ResourceDao;
+import li.strolch.persistence.api.StrolchTransaction;
+
+public class XmlResourceDao extends AbstractDao implements ResourceDao {
+
+ protected XmlResourceDao(StrolchTransaction tx) {
+ super(tx);
+ }
+
+ @Override
+ protected String getClassType() {
+ return Tags.RESOURCE;
+ }
+
+ @Override
+ public List doQuery(ResourceQuery query, ResourceVisitor resourceVisitor) {
+ // TODO implement XML file based querying...
+ throw new UnsupportedOperationException("not yet implemented!");
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlStrolchTransaction.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlStrolchTransaction.java
new file mode 100644
index 000000000..92098bd6f
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlStrolchTransaction.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml;
+
+import java.util.Set;
+
+import li.strolch.agent.api.StrolchRealm;
+import li.strolch.persistence.api.AbstractTransaction;
+import li.strolch.persistence.api.PersistenceHandler;
+import li.strolch.runtime.privilege.PrivilegeHandler;
+import ch.eitchnet.privilege.model.Certificate;
+import ch.eitchnet.xmlpers.api.ModificationResult;
+import ch.eitchnet.xmlpers.api.PersistenceTransaction;
+import ch.eitchnet.xmlpers.api.TransactionResult;
+
+public class XmlStrolchTransaction extends AbstractTransaction {
+
+ private XmlPersistenceHandler persistenceHandler;
+ private PersistenceTransaction tx;
+
+ public XmlStrolchTransaction(PrivilegeHandler privilegeHandler, StrolchRealm realm, Certificate certificate,
+ String action, PersistenceTransaction tx, XmlPersistenceHandler persistenceHandler) {
+ super(privilegeHandler, realm, certificate, action);
+ this.persistenceHandler = persistenceHandler;
+ this.tx = tx;
+ }
+
+ PersistenceTransaction getTx() {
+ return this.tx;
+ }
+
+ @Override
+ protected void writeChanges(li.strolch.persistence.api.TransactionResult txResult) throws Exception {
+ TransactionResult result = new TransactionResult();
+ this.tx.setTransactionResult(result);
+ this.tx.autoCloseableCommit();
+ Set keys = result.getKeys();
+ for (String key : keys) {
+ ModificationResult modificationResult = result.getModificationResult(key);
+ txResult.incCreated(modificationResult.getCreated().size());
+ txResult.incUpdated(modificationResult.getUpdated().size());
+ txResult.incDeleted(modificationResult.getDeleted().size());
+ }
+ }
+
+ @Override
+ protected void rollback(li.strolch.persistence.api.TransactionResult txResult) throws Exception {
+ this.tx.autoCloseableRollback();
+ }
+
+ @Override
+ protected void commit() throws Exception {
+ // no-op
+ }
+
+ @Override
+ public PersistenceHandler getPersistenceHandler() {
+ return this.persistenceHandler;
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditContextFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditContextFactory.java
new file mode 100644
index 000000000..0cad02fb2
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditContextFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Tags;
+import li.strolch.model.audit.Audit;
+import ch.eitchnet.xmlpers.api.PersistenceContext;
+import ch.eitchnet.xmlpers.api.PersistenceContextFactory;
+import ch.eitchnet.xmlpers.objref.IdOfSubTypeRef;
+import ch.eitchnet.xmlpers.objref.ObjectRef;
+import ch.eitchnet.xmlpers.objref.ObjectReferenceCache;
+
+public class AuditContextFactory implements PersistenceContextFactory {
+
+ @Override
+ public PersistenceContext createCtx(ObjectRef objectRef) {
+ PersistenceContext ctx = new PersistenceContext<>(objectRef);
+ ctx.setParserFactory(new AuditParserFactory());
+ return ctx;
+ }
+
+ @Override
+ public PersistenceContext createCtx(ObjectReferenceCache objectRefCache, Audit audit) {
+ IdOfSubTypeRef objectRef = objectRefCache.getIdOfSubTypeRef(Tags.AUDIT, audit.getElementType(), audit.getId()
+ .toString());
+ PersistenceContext ctx = createCtx(objectRef);
+ ctx.setObject(audit);
+ return ctx;
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditDomParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditDomParser.java
new file mode 100644
index 000000000..a72e9459d
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditDomParser.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.audit.Audit;
+import li.strolch.model.audit.AuditFromDomReader;
+import li.strolch.model.audit.AuditToDomVisitor;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import ch.eitchnet.xmlpers.api.DomParser;
+
+public class AuditDomParser implements DomParser {
+
+ private Audit audit;
+
+ @Override
+ public Audit getObject() {
+ return this.audit;
+ }
+
+ @Override
+ public void setObject(Audit audit) {
+ this.audit = audit;
+ }
+
+ @Override
+ public Document toDom() {
+ AuditToDomVisitor auditDomVisitor = new AuditToDomVisitor();
+ return auditDomVisitor.visitAudit(this.audit);
+ }
+
+ @Override
+ public void fromDom(Document document) {
+ Element rootElement = document.getDocumentElement();
+ Audit audit = new AuditFromDomReader().from(rootElement);
+ this.audit = audit;
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditParserFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditParserFactory.java
new file mode 100644
index 000000000..67b4f8b66
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditParserFactory.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.audit.Audit;
+import ch.eitchnet.xmlpers.api.DomParser;
+import ch.eitchnet.xmlpers.api.ParserFactory;
+import ch.eitchnet.xmlpers.api.SaxParser;
+
+public class AuditParserFactory implements ParserFactory {
+
+ @Override
+ public DomParser getDomParser() {
+ return new AuditDomParser();
+ }
+
+ @Override
+ public SaxParser getSaxParser() {
+ throw new UnsupportedOperationException("Not yet implemented!"); //$NON-NLS-1$
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderContextFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderContextFactory.java
new file mode 100644
index 000000000..5a88e0fec
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderContextFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Order;
+import li.strolch.model.Tags;
+import ch.eitchnet.xmlpers.api.PersistenceContext;
+import ch.eitchnet.xmlpers.api.PersistenceContextFactory;
+import ch.eitchnet.xmlpers.objref.IdOfSubTypeRef;
+import ch.eitchnet.xmlpers.objref.ObjectRef;
+import ch.eitchnet.xmlpers.objref.ObjectReferenceCache;
+
+public class OrderContextFactory implements PersistenceContextFactory {
+
+ @Override
+ public PersistenceContext createCtx(ObjectRef objectRef) {
+ PersistenceContext ctx = new PersistenceContext<>(objectRef);
+ ctx.setParserFactory(new OrderParserFactory());
+ return ctx;
+ }
+
+ @Override
+ public PersistenceContext createCtx(ObjectReferenceCache objectRefCache, Order t) {
+ IdOfSubTypeRef objectRef = objectRefCache.getIdOfSubTypeRef(Tags.ORDER, t.getType(), t.getId());
+ PersistenceContext ctx = createCtx(objectRef);
+ ctx.setObject(t);
+ return ctx;
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderDomParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderDomParser.java
new file mode 100644
index 000000000..5abfece4a
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderDomParser.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Order;
+import li.strolch.model.xml.OrderToDomVisitor;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import ch.eitchnet.xmlpers.api.DomParser;
+
+public class OrderDomParser implements DomParser {
+
+ private Order order;
+
+ @Override
+ public Order getObject() {
+ return this.order;
+ }
+
+ @Override
+ public void setObject(Order object) {
+ this.order = object;
+ }
+
+ @Override
+ public Document toDom() {
+ OrderToDomVisitor orderDomVisitor = new OrderToDomVisitor();
+ orderDomVisitor.visit(this.order);
+ return orderDomVisitor.getDocument();
+ }
+
+ @Override
+ public void fromDom(Document document) {
+ Element rootElement = document.getDocumentElement();
+ Order order = new Order(rootElement);
+ this.order = order;
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderParserFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderParserFactory.java
new file mode 100644
index 000000000..e7e38543c
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderParserFactory.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Order;
+import ch.eitchnet.xmlpers.api.DomParser;
+import ch.eitchnet.xmlpers.api.ParserFactory;
+import ch.eitchnet.xmlpers.api.SaxParser;
+
+public class OrderParserFactory implements ParserFactory {
+
+ @Override
+ public DomParser getDomParser() {
+ return new OrderDomParser();
+ }
+
+ @Override
+ public SaxParser getSaxParser() {
+ throw new UnsupportedOperationException("Not yet implemented!"); //$NON-NLS-1$
+ }
+}
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceContextFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceContextFactory.java
new file mode 100644
index 000000000..408d68db2
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceContextFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Resource;
+import li.strolch.model.Tags;
+import ch.eitchnet.xmlpers.api.PersistenceContext;
+import ch.eitchnet.xmlpers.api.PersistenceContextFactory;
+import ch.eitchnet.xmlpers.objref.IdOfSubTypeRef;
+import ch.eitchnet.xmlpers.objref.ObjectRef;
+import ch.eitchnet.xmlpers.objref.ObjectReferenceCache;
+
+public class ResourceContextFactory implements PersistenceContextFactory {
+
+ @Override
+ public PersistenceContext createCtx(ObjectRef objectRef) {
+ PersistenceContext ctx = new PersistenceContext<>(objectRef);
+ ctx.setParserFactory(new ResourceParserFactory());
+ return ctx;
+ }
+
+ @Override
+ public PersistenceContext createCtx(ObjectReferenceCache objectRefCache, Resource t) {
+ IdOfSubTypeRef objectRef = objectRefCache.getIdOfSubTypeRef(Tags.RESOURCE, t.getType(), t.getId());
+ PersistenceContext ctx = createCtx(objectRef);
+ ctx.setObject(t);
+ return ctx;
+ }
+}
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceDomParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceDomParser.java
new file mode 100644
index 000000000..4853df885
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceDomParser.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Resource;
+import li.strolch.model.xml.ResourceToDomVisitor;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import ch.eitchnet.xmlpers.api.DomParser;
+
+public class ResourceDomParser implements DomParser {
+
+ private Resource resource;
+
+ @Override
+ public Resource getObject() {
+ return this.resource;
+ }
+
+ @Override
+ public void setObject(Resource resource) {
+ this.resource = resource;
+ }
+
+ @Override
+ public Document toDom() {
+ ResourceToDomVisitor domVisitor = new ResourceToDomVisitor();
+ domVisitor.visit(this.resource);
+ return domVisitor.getDocument();
+ }
+
+ @Override
+ public void fromDom(Document document) {
+ Element rootElement = document.getDocumentElement();
+ Resource resource = new Resource(rootElement);
+ this.resource = resource;
+ }
+}
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceParserFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceParserFactory.java
new file mode 100644
index 000000000..197c6903e
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceParserFactory.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.xml.model;
+
+import li.strolch.model.Resource;
+import ch.eitchnet.xmlpers.api.DomParser;
+import ch.eitchnet.xmlpers.api.ParserFactory;
+import ch.eitchnet.xmlpers.api.SaxParser;
+
+public class ResourceParserFactory implements ParserFactory {
+
+ @Override
+ public DomParser getDomParser() {
+ return new ResourceDomParser();
+ }
+
+ @Override
+ public SaxParser getSaxParser() {
+ throw new UnsupportedOperationException("Not yet implemented!"); //$NON-NLS-1$
+ }
+}
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/main/resources/componentVersion.properties b/li.strolch.persistence.xml/src/main/resources/componentVersion.properties
new file mode 100644
index 000000000..1f050160f
--- /dev/null
+++ b/li.strolch.persistence.xml/src/main/resources/componentVersion.properties
@@ -0,0 +1,6 @@
+groupId=${project.groupId}
+artifactId=${project.artifactId}
+artifactVersion=${project.version}
+scmRevision=r${buildNumber}
+scmBranch=${scmBranch}
+buildTimestamp=${buildTimestamp}
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ExistingDbTest.java b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ExistingDbTest.java
new file mode 100644
index 000000000..a749056fc
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ExistingDbTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.impl.dao.test;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+
+import li.strolch.model.Order;
+import li.strolch.model.Resource;
+import li.strolch.persistence.api.StrolchTransaction;
+import li.strolch.runtime.StrolchConstants;
+import li.strolch.runtime.privilege.PrivilegeHandler;
+import li.strolch.testbase.runtime.RuntimeMock;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import ch.eitchnet.privilege.model.Certificate;
+
+public class ExistingDbTest {
+
+ private static final String TEST = "test"; //$NON-NLS-1$
+ public static final String RUNTIME_PATH = "target/existingDbRuntime/"; //$NON-NLS-1$
+ public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
+ public static final String CONFIG_SRC = "src/test/resources/existingDbRuntime"; //$NON-NLS-1$
+
+ protected static RuntimeMock runtimeMock;
+
+ @BeforeClass
+ public static void beforeClass() {
+
+ File rootPath = new File(RUNTIME_PATH);
+ File configSrc = new File(CONFIG_SRC);
+ runtimeMock = new RuntimeMock();
+ runtimeMock.mockRuntime(rootPath, configSrc);
+ runtimeMock.startContainer();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ runtimeMock.destroyRuntime();
+ }
+
+ @Test
+ public void shouldQueryExistingData() {
+
+ PrivilegeHandler privilegeHandler = runtimeMock.getAgent().getContainer().getPrivilegeHandler();
+ Certificate certificate = privilegeHandler.authenticate(TEST, TEST.getBytes());
+
+ try (StrolchTransaction tx = runtimeMock.getRealm(StrolchConstants.DEFAULT_REALM).openTx(certificate, TEST)) {
+ Resource resource = tx.getResourceMap().getBy(tx, "MyType", "@1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertNotNull("Should be able to read existing element from db", resource); //$NON-NLS-1$
+
+ Order order = tx.getOrderMap().getBy(tx, "MyType", "@1"); //$NON-NLS-1$//$NON-NLS-2$
+ assertNotNull("Should be able to read existing element from db", order); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ObserverUpdateTest.java b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ObserverUpdateTest.java
new file mode 100644
index 000000000..22ff19569
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ObserverUpdateTest.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.impl.dao.test;
+
+import static li.strolch.model.ModelGenerator.createOrder;
+import static li.strolch.model.ModelGenerator.createResource;
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import li.strolch.agent.api.Observer;
+import li.strolch.agent.api.StrolchRealm;
+import li.strolch.model.Order;
+import li.strolch.model.Resource;
+import li.strolch.model.State;
+import li.strolch.model.StrolchRootElement;
+import li.strolch.model.Tags;
+import li.strolch.persistence.api.StrolchTransaction;
+import li.strolch.runtime.StrolchConstants;
+import li.strolch.runtime.privilege.PrivilegeHandler;
+import li.strolch.testbase.runtime.RuntimeMock;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import ch.eitchnet.privilege.model.Certificate;
+import ch.eitchnet.xmlpers.api.ModificationResult;
+
+/**
+ * @author Robert von Burg
+ */
+public class ObserverUpdateTest {
+
+ private static final String TEST = "test"; //$NON-NLS-1$
+ public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/"; //$NON-NLS-1$
+ public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
+ public static final String CONFIG_SRC = "src/test/resources/cachedruntime"; //$NON-NLS-1$
+
+ protected static RuntimeMock runtimeMock;
+
+ protected RuntimeMock getRuntimeMock() {
+ return runtimeMock;
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+
+ File rootPath = new File(RUNTIME_PATH);
+ File configSrc = new File(CONFIG_SRC);
+ runtimeMock = new RuntimeMock();
+ runtimeMock.mockRuntime(rootPath, configSrc);
+ new File(rootPath, DB_STORE_PATH_DIR).mkdir();
+ runtimeMock.startContainer();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ runtimeMock.destroyRuntime();
+ }
+
+ public final class ElementAddedObserver implements Observer {
+
+ Map results = new HashMap<>();
+
+ private ModificationResult getModificationResult(String key) {
+ ModificationResult result = this.results.get(key);
+ if (result == null) {
+ result = new ModificationResult(key);
+ this.results.put(key, result);
+ }
+ return result;
+ }
+
+ @Override
+ public void update(String key, List elements) {
+ getModificationResult(key).getUpdated().addAll(elements);
+ }
+
+ @Override
+ public void remove(String key, List elements) {
+ getModificationResult(key).getDeleted().addAll(elements);
+ }
+
+ @Override
+ public void add(String key, List elements) {
+ getModificationResult(key).getCreated().addAll(elements);
+ }
+ }
+
+ @Test
+ public void shouldReceiveUpdates() {
+
+ // register an observer for orders and resources
+ ElementAddedObserver observer = new ElementAddedObserver();
+ StrolchRealm realm = runtimeMock.getRealm(StrolchConstants.DEFAULT_REALM);
+ realm.getObserverHandler().registerObserver(Tags.ORDER, observer);
+ realm.getObserverHandler().registerObserver(Tags.RESOURCE, observer);
+
+ PrivilegeHandler privilegeHandler = runtimeMock.getAgent().getContainer().getPrivilegeHandler();
+ Certificate certificate = privilegeHandler.authenticate(TEST, TEST.getBytes());
+
+ // create order
+ Order newOrder = createOrder("MyTestOrder", "Test Name", "TestType", new Date(), State.CREATED); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ try (StrolchTransaction tx = realm.openTx(certificate, TEST)) {
+ tx.getOrderMap().add(tx, newOrder);
+ }
+
+ // create resource
+ Resource newResource = createResource("MyTestResource", "Test Name", "TestType"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ try (StrolchTransaction tx = realm.openTx(certificate, TEST)) {
+ tx.getResourceMap().add(tx, newResource);
+ }
+
+ assertEquals(2, observer.results.size());
+ assertEquals(1, observer.results.get(Tags.ORDER).getCreated().size());
+ assertEquals(1, observer.results.get(Tags.RESOURCE).getCreated().size());
+ }
+}
diff --git a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlCachedDaoTest.java b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlCachedDaoTest.java
new file mode 100644
index 000000000..045a71abd
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlCachedDaoTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.impl.dao.test;
+
+import java.io.File;
+
+import li.strolch.testbase.runtime.AbstractModelTest;
+import li.strolch.testbase.runtime.RuntimeMock;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class XmlCachedDaoTest extends AbstractModelTest {
+
+ public static final String RUNTIME_PATH = "target/cachedStrolchRuntime/"; //$NON-NLS-1$
+ public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
+ public static final String CONFIG_SRC = "src/test/resources/cachedruntime"; //$NON-NLS-1$
+
+ protected static RuntimeMock runtimeMock;
+
+ @Override
+ protected RuntimeMock getRuntimeMock() {
+ return runtimeMock;
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+
+ File rootPath = new File(RUNTIME_PATH);
+ File configSrc = new File(CONFIG_SRC);
+ runtimeMock = new RuntimeMock();
+ runtimeMock.mockRuntime(rootPath, configSrc);
+ new File(rootPath, DB_STORE_PATH_DIR).mkdir();
+ runtimeMock.startContainer();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ runtimeMock.destroyRuntime();
+ }
+}
diff --git a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlTransactionalDaoTest.java b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlTransactionalDaoTest.java
new file mode 100644
index 000000000..ab785c203
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlTransactionalDaoTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Robert von Burg
+ *
+ * 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.
+ */
+package li.strolch.persistence.impl.dao.test;
+
+import java.io.File;
+
+import li.strolch.testbase.runtime.AbstractModelTest;
+import li.strolch.testbase.runtime.RuntimeMock;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class XmlTransactionalDaoTest extends AbstractModelTest {
+
+ public static final String RUNTIME_PATH = "target/transactionalStrolchRuntime/"; //$NON-NLS-1$
+ public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
+ public static final String CONFIG_SRC = "src/test/resources/transactionalruntime"; //$NON-NLS-1$
+
+ protected static RuntimeMock runtimeMock;
+
+ @Override
+ protected RuntimeMock getRuntimeMock() {
+ return runtimeMock;
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+
+ File rootPath = new File(RUNTIME_PATH);
+ File configSrc = new File(CONFIG_SRC);
+ runtimeMock = new RuntimeMock();
+ runtimeMock.mockRuntime(rootPath, configSrc);
+ new File(rootPath, DB_STORE_PATH_DIR).mkdir();
+ runtimeMock.startContainer();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ runtimeMock.destroyRuntime();
+ }
+}
diff --git a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeConfig.xml b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeConfig.xml
new file mode 100644
index 000000000..9d7a227e3
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeConfig.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeModel.xml b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeModel.xml
new file mode 100644
index 000000000..0ed6ce7b2
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeModel.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ SYSTEM
+
+ agent
+
+
+
+ Application
+ Administrator
+ ENABLED
+ en_GB
+
+ PrivilegeAdmin
+ AppUser
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/StrolchConfiguration.xml b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/StrolchConfiguration.xml
new file mode 100644
index 000000000..d29ebd052
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/StrolchConfiguration.xml
@@ -0,0 +1,39 @@
+
+
+
+
+ StrolchPersistenceTest
+
+ true
+
+
+
+ PrivilegeHandler
+ li.strolch.runtime.privilege.PrivilegeHandler
+ li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler
+
+ PrivilegeConfig.xml
+
+
+
+ RealmHandler
+ li.strolch.agent.api.RealmHandler
+ li.strolch.agent.impl.DefaultRealmHandler
+ PrivilegeHandler
+ PersistenceHandler
+
+ CACHED
+ true
+ true
+
+
+
+ PersistenceHandler
+ li.strolch.persistence.api.PersistenceHandler
+ li.strolch.persistence.xml.XmlPersistenceHandler
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeConfig.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeConfig.xml
new file mode 100644
index 000000000..9d7a227e3
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeConfig.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeModel.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeModel.xml
new file mode 100644
index 000000000..0ed6ce7b2
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeModel.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ SYSTEM
+
+ agent
+
+
+
+ Application
+ Administrator
+ ENABLED
+ en_GB
+
+ PrivilegeAdmin
+ AppUser
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/StrolchConfiguration.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/StrolchConfiguration.xml
new file mode 100644
index 000000000..eec57334a
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/StrolchConfiguration.xml
@@ -0,0 +1,37 @@
+
+
+
+
+ StrolchPersistenceTest
+
+ true
+
+
+
+ PrivilegeHandler
+ li.strolch.runtime.privilege.PrivilegeHandler
+ li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler
+
+ PrivilegeConfig.xml
+
+
+
+ RealmHandler
+ li.strolch.agent.api.RealmHandler
+ li.strolch.agent.impl.DefaultRealmHandler
+ PrivilegeHandler
+ PersistenceHandler
+
+ CACHED
+
+
+
+ PersistenceHandler
+ li.strolch.persistence.api.PersistenceHandler
+ li.strolch.persistence.xml.XmlPersistenceHandler
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Order/MyType/@1.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Order/MyType/@1.xml
new file mode 100644
index 000000000..7c0a4269b
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Order/MyType/@1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Resource/MyType/@1.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Resource/MyType/@1.xml
new file mode 100644
index 000000000..bc3a21ee7
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/dbStore/defaultRealm/Resource/MyType/@1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/li.strolch.persistence.xml/src/test/resources/log4j.xml b/li.strolch.persistence.xml/src/test/resources/log4j.xml
new file mode 100644
index 000000000..0a2a73d06
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/log4j.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeConfig.xml b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeConfig.xml
new file mode 100644
index 000000000..9d7a227e3
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeConfig.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeModel.xml b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeModel.xml
new file mode 100644
index 000000000..0ed6ce7b2
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeModel.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ SYSTEM
+
+ agent
+
+
+
+ Application
+ Administrator
+ ENABLED
+ en_GB
+
+ PrivilegeAdmin
+ AppUser
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/StrolchConfiguration.xml b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/StrolchConfiguration.xml
new file mode 100644
index 000000000..017e5165b
--- /dev/null
+++ b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/StrolchConfiguration.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ StrolchPersistenceTest
+
+ true
+
+
+
+ PrivilegeHandler
+ li.strolch.runtime.privilege.PrivilegeHandler
+ li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler
+
+ PrivilegeConfig.xml
+
+
+
+ RealmHandler
+ li.strolch.agent.api.RealmHandler
+ li.strolch.agent.impl.DefaultRealmHandler
+ PrivilegeHandler
+ PersistenceHandler
+
+ TRANSACTIONAL
+ true
+
+
+
+ PersistenceHandler
+ li.strolch.persistence.api.PersistenceHandler
+ li.strolch.persistence.xml.XmlPersistenceHandler
+
+ true
+
+
+
+
\ No newline at end of file