diff --git a/li.strolch.persistence.xml/.gitignore b/li.strolch.persistence.xml/.gitignore deleted file mode 100644 index b284c6517..000000000 --- a/li.strolch.persistence.xml/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -target/ -.project -.settings -.classpath diff --git a/li.strolch.persistence.xml/LICENSE b/li.strolch.persistence.xml/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/li.strolch.persistence.xml/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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 deleted file mode 100644 index fbc7e1574..000000000 --- a/li.strolch.persistence.xml/README.md +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 85a045b3d..000000000 --- a/li.strolch.persistence.xml/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - 4.0.0 - - - li.strolch - li.strolch - 1.5.0-SNAPSHOT - ../pom.xml - - - li.strolch.persistence.xml - li.strolch.persistence.xml - Reference Persistence Implementation for Strolch - 2011 - - - - - li.strolch - li.strolch.model - - - li.strolch - li.strolch.agent - - - li.strolch - li.strolch.xmlpers - - - - - li.strolch - li.strolch.testbase - test - - - - - - - - src/main/resources - true - - **/*.properties - - - - - - org.codehaus.mojo - buildnumber-maven-plugin - - - org.apache.maven.plugins - maven-eclipse-plugin - - - - 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 deleted file mode 100644 index cd36f7372..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/AbstractDao.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.StrolchRootElement; -import li.strolch.persistence.api.StrolchDao; -import li.strolch.persistence.api.StrolchPersistenceException; -import li.strolch.persistence.api.StrolchTransaction; -import li.strolch.xmlpers.api.PersistenceTransaction; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.SubTypeRef; -import li.strolch.xmlpers.objref.TypeRef; - -public abstract class AbstractDao implements StrolchDao { - - private XmlStrolchTransaction strolchTx; - protected PersistenceTransaction tx; - - protected AbstractDao(StrolchTransaction tx) { - this.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 T queryBy(String type, String id, int version) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List queryVersionsFor(String type, String id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long queryVersionsSizeFor(String type, String id) { - // TODO Auto-generated method stub - return 0; - } - - @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); - } - - @Override - public void removeVersion(T element) throws StrolchPersistenceException { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("not yet implemented!"); - } - - @Override - public void flush() { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("not yet implemented!"); - } -} diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlActivityDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlActivityDao.java deleted file mode 100644 index 6b8fd86b2..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlActivityDao.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.Tags; -import li.strolch.model.activity.Activity; -import li.strolch.model.query.ActivityQuery; -import li.strolch.persistence.api.ActivityDao; -import li.strolch.persistence.api.StrolchTransaction; - -public class XmlActivityDao extends AbstractDao implements ActivityDao { - - protected XmlActivityDao(StrolchTransaction tx) { - super(tx); - } - - @Override - protected String getClassType() { - return Tags.ACTIVITY; - } - - @Override - public List doQuery(ActivityQuery query) { - // 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/XmlAuditDao.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlAuditDao.java deleted file mode 100644 index eace60248..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlAuditDao.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.persistence.api.AuditDao; -import li.strolch.persistence.api.StrolchTransaction; -import li.strolch.utils.collections.DateRange; -import li.strolch.xmlpers.api.PersistenceContext; -import li.strolch.xmlpers.api.PersistenceTransaction; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.ObjectRef; -import li.strolch.xmlpers.objref.SubTypeRef; -import li.strolch.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) { - // 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 deleted file mode 100644 index a4c97ce71..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlOrderDao.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.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) { - // 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 deleted file mode 100644 index 61714539e..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlPersistenceHandler.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.ActivityDao; -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.privilege.model.Certificate; -import li.strolch.runtime.configuration.ComponentConfiguration; -import li.strolch.runtime.configuration.StrolchConfigurationException; -import li.strolch.xmlpers.api.IoMode; -import li.strolch.xmlpers.api.PersistenceConstants; -import li.strolch.xmlpers.api.PersistenceManager; -import li.strolch.xmlpers.api.PersistenceManagerLoader; -import li.strolch.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) throws Exception { - - File basePathF = componentConfiguration.getRuntimeConfiguration().getDataPath(); - File dbStorePathF = new File(basePathF, DB_STORE_PATH); - if (!dbStorePathF.exists() && !dbStorePathF.mkdir()) { - throw new StrolchConfigurationException("Could not create store path at " + dbStorePathF.getAbsolutePath()); - } - - Properties properties = new Properties(); - properties.setProperty(PersistenceConstants.PROP_VERBOSE, componentConfiguration.getString("verbose", "false")); //$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 ActivityDao getActivityDao(StrolchTransaction tx) { - return new XmlActivityDao(tx); - } - - @Override - public AuditDao getAuditDao(StrolchTransaction tx) { - return new XmlAuditDao(tx); - } - - @Override - public void performDbInitialization() { - throw new UnsupportedOperationException("Not yet implemented!"); - } -} 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 deleted file mode 100644 index 12d72b0c1..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlResourceDao.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.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) { - // 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 deleted file mode 100644 index e4268aedc..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/XmlStrolchTransaction.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.privilege.model.Certificate; -import li.strolch.runtime.privilege.PrivilegeHandler; -import li.strolch.xmlpers.api.ModificationResult; -import li.strolch.xmlpers.api.PersistenceTransaction; -import li.strolch.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() 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); - getTxResult().incCreated(modificationResult.getCreated().size()); - getTxResult().incUpdated(modificationResult.getUpdated().size()); - getTxResult().incDeleted(modificationResult.getDeleted().size()); - } - } - - @Override - protected void rollback() 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/ActivityContextFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityContextFactory.java deleted file mode 100644 index ad89e27b1..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityContextFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.activity.Activity; -import li.strolch.xmlpers.api.PersistenceContext; -import li.strolch.xmlpers.api.PersistenceContextFactory; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.ObjectRef; -import li.strolch.xmlpers.objref.ObjectReferenceCache; - -public class ActivityContextFactory implements PersistenceContextFactory { - - @Override - public PersistenceContext createCtx(ObjectRef objectRef) { - PersistenceContext ctx = new PersistenceContext<>(objectRef); - ctx.setParserFactory(new ActivityParserFactory()); - return ctx; - } - - @Override - public PersistenceContext createCtx(ObjectReferenceCache objectRefCache, Activity t) { - IdOfSubTypeRef objectRef = objectRefCache.getIdOfSubTypeRef(Tags.ACTIVITY, 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/ActivityDomParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityDomParser.java deleted file mode 100644 index 177531365..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityDomParser.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.activity.Activity; -import li.strolch.model.xml.ActivityFromDomVisitor; -import li.strolch.model.xml.ActivityToDomVisitor; -import li.strolch.xmlpers.api.DomParser; - -import org.w3c.dom.Document; - -public class ActivityDomParser implements DomParser { - - private Activity activity; - - @Override - public Activity getObject() { - return this.activity; - } - - @Override - public void setObject(Activity activity) { - this.activity = activity; - } - - @Override - public Document toDom() { - ActivityToDomVisitor activityDomVisitor = new ActivityToDomVisitor(); - activityDomVisitor.visit(this.activity); - return activityDomVisitor.getDocument(); - } - - @Override - public void fromDom(Document document) { - Activity activity = new ActivityFromDomVisitor().visit(document); - this.activity = activity; - } -} diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityParserFactory.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityParserFactory.java deleted file mode 100644 index cb0598051..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivityParserFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.activity.Activity; -import li.strolch.xmlpers.api.DomParser; -import li.strolch.xmlpers.api.ParserFactory; -import li.strolch.xmlpers.api.SaxParser; - -public class ActivityParserFactory implements ParserFactory { - - @Override - public DomParser getDomParser() { - return new ActivityDomParser(); - } - - @Override - public SaxParser getSaxParser() { - return new ActivitySaxParser(); - } -} diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivitySaxParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivitySaxParser.java deleted file mode 100644 index 01f2dc811..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ActivitySaxParser.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2015 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 javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import li.strolch.model.Order; -import li.strolch.model.Resource; -import li.strolch.model.activity.Activity; -import li.strolch.model.xml.ActivityToSaxWriterVisitor; -import li.strolch.model.xml.StrolchElementListener; -import li.strolch.model.xml.XmlModelSaxReader; -import li.strolch.xmlpers.api.SaxParser; - -import org.xml.sax.helpers.DefaultHandler; - -/** - * @author Robert von Burg - */ -public class ActivitySaxParser implements SaxParser { - - protected Activity activity; - - @Override - public Activity getObject() { - return this.activity; - } - - @Override - public void setObject(Activity activity) { - this.activity = activity; - } - - @Override - public DefaultHandler getDefaultHandler() { - return new XmlModelSaxReader(new StrolchElementListener() { - - @Override - public void notifyResource(Resource resource) { - throw new IllegalArgumentException("Only expect Activities!"); - } - - @Override - public void notifyOrder(Order order) { - throw new IllegalArgumentException("Only expect Activities!"); - } - - @Override - public void notifyActivity(Activity activity) { - ActivitySaxParser.this.activity = activity; - } - }); - } - - @Override - public void write(XMLStreamWriter xmlWriter) throws XMLStreamException { - new ActivityToSaxWriterVisitor(xmlWriter); - } -} 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 deleted file mode 100644 index 5df91789b..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditContextFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 li.strolch.xmlpers.api.PersistenceContext; -import li.strolch.xmlpers.api.PersistenceContextFactory; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.ObjectRef; -import li.strolch.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 deleted file mode 100644 index 9d2a0d888..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditDomParser.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 li.strolch.xmlpers.api.DomParser; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -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 deleted file mode 100644 index 6e9d78503..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/AuditParserFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.xmlpers.api.DomParser; -import li.strolch.xmlpers.api.ParserFactory; -import li.strolch.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 deleted file mode 100644 index 8cc2017bc..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderContextFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 li.strolch.xmlpers.api.PersistenceContext; -import li.strolch.xmlpers.api.PersistenceContextFactory; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.ObjectRef; -import li.strolch.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 deleted file mode 100644 index dc3108ab1..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderDomParser.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.OrderFromDomVisitor; -import li.strolch.model.xml.OrderToDomVisitor; -import li.strolch.xmlpers.api.DomParser; - -import org.w3c.dom.Document; - -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) { - Order order = new OrderFromDomVisitor().visit(document); - 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 deleted file mode 100644 index e3b762103..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderParserFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.xmlpers.api.DomParser; -import li.strolch.xmlpers.api.ParserFactory; -import li.strolch.xmlpers.api.SaxParser; - -public class OrderParserFactory implements ParserFactory { - - @Override - public DomParser getDomParser() { - return new OrderDomParser(); - } - - @Override - public SaxParser getSaxParser() { - return new OrderSaxParser(); - } -} diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderSaxParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderSaxParser.java deleted file mode 100644 index 2a88f6765..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/OrderSaxParser.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2015 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 javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import li.strolch.model.Order; -import li.strolch.model.Resource; -import li.strolch.model.activity.Activity; -import li.strolch.model.xml.OrderToSaxWriterVisitor; -import li.strolch.model.xml.StrolchElementListener; -import li.strolch.model.xml.XmlModelSaxReader; -import li.strolch.xmlpers.api.SaxParser; - -import org.xml.sax.helpers.DefaultHandler; - -/** - * @author Robert von Burg - */ -public class OrderSaxParser implements SaxParser { - - protected Order order; - - @Override - public Order getObject() { - return this.order; - } - - @Override - public void setObject(Order order) { - this.order = order; - } - - @Override - public DefaultHandler getDefaultHandler() { - return new XmlModelSaxReader(new StrolchElementListener() { - - @Override - public void notifyResource(Resource resource) { - throw new IllegalArgumentException("Only expect Orders!"); - } - - @Override - public void notifyOrder(Order order) { - OrderSaxParser.this.order = order; - } - - @Override - public void notifyActivity(Activity activity) { - throw new IllegalArgumentException("Only expect Orders!"); - } - }); - } - - @Override - public void write(XMLStreamWriter xmlWriter) throws XMLStreamException { - new OrderToSaxWriterVisitor(xmlWriter); - } -} 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 deleted file mode 100644 index e0e50d1fc..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceContextFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 li.strolch.xmlpers.api.PersistenceContext; -import li.strolch.xmlpers.api.PersistenceContextFactory; -import li.strolch.xmlpers.objref.IdOfSubTypeRef; -import li.strolch.xmlpers.objref.ObjectRef; -import li.strolch.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 deleted file mode 100644 index fc208e4cd..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceDomParser.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ResourceFromDomVisitor; -import li.strolch.model.xml.ResourceToDomVisitor; -import li.strolch.xmlpers.api.DomParser; - -import org.w3c.dom.Document; - -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) { - Resource resource = new ResourceFromDomVisitor().visit(document); - 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 deleted file mode 100644 index 42d6762e9..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceParserFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.xmlpers.api.DomParser; -import li.strolch.xmlpers.api.ParserFactory; -import li.strolch.xmlpers.api.SaxParser; - -public class ResourceParserFactory implements ParserFactory { - - @Override - public DomParser getDomParser() { - return new ResourceDomParser(); - } - - @Override - public SaxParser getSaxParser() { - return new ResourceSaxParser(); - } -} \ No newline at end of file diff --git a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceSaxParser.java b/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceSaxParser.java deleted file mode 100644 index 31fce9c06..000000000 --- a/li.strolch.persistence.xml/src/main/java/li/strolch/persistence/xml/model/ResourceSaxParser.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2015 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 javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import li.strolch.model.Order; -import li.strolch.model.Resource; -import li.strolch.model.activity.Activity; -import li.strolch.model.xml.ResourceToSaxWriterVisitor; -import li.strolch.model.xml.StrolchElementListener; -import li.strolch.model.xml.XmlModelSaxReader; -import li.strolch.xmlpers.api.SaxParser; - -import org.xml.sax.helpers.DefaultHandler; - -/** - * @author Robert von Burg - */ -public class ResourceSaxParser implements SaxParser { - - protected Resource resource; - - @Override - public Resource getObject() { - return this.resource; - } - - @Override - public void setObject(Resource resource) { - this.resource = resource; - } - - @Override - public DefaultHandler getDefaultHandler() { - return new XmlModelSaxReader(new StrolchElementListener() { - - @Override - public void notifyResource(Resource resource) { - ResourceSaxParser.this.resource = resource; - } - - @Override - public void notifyOrder(Order order) { - throw new IllegalArgumentException("Only expect Resources!"); - } - - @Override - public void notifyActivity(Activity activity) { - throw new IllegalArgumentException("Only expect Resources!"); - } - }); - } - - @Override - public void write(XMLStreamWriter xmlWriter) throws XMLStreamException { - new ResourceToSaxWriterVisitor(xmlWriter); - } -} diff --git a/li.strolch.persistence.xml/src/main/resources/componentVersion.properties b/li.strolch.persistence.xml/src/main/resources/componentVersion.properties deleted file mode 100644 index a4594a250..000000000 --- a/li.strolch.persistence.xml/src/main/resources/componentVersion.properties +++ /dev/null @@ -1,6 +0,0 @@ -groupId=${project.groupId} -artifactId=${project.artifactId} -artifactVersion=${project.version} -scmRevision=${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 deleted file mode 100644 index 5afd57ecd..000000000 --- a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ExistingDbTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import li.strolch.model.Order; -import li.strolch.model.Resource; -import li.strolch.persistence.api.StrolchTransaction; -import li.strolch.persistence.xml.XmlPersistenceHandler; -import li.strolch.privilege.model.Certificate; -import li.strolch.runtime.StrolchConstants; -import li.strolch.runtime.privilege.PrivilegeHandler; -import li.strolch.testbase.runtime.RuntimeMock; -import li.strolch.utils.helper.FileHelper; - -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 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); - - File dbStoreSrcPath = new File(CONFIG_SRC, "data/" + XmlPersistenceHandler.DB_STORE_PATH); - File dbStoreDstPath = new File(RUNTIME_PATH, "data/" + XmlPersistenceHandler.DB_STORE_PATH); - if (!dbStoreDstPath.exists() && !dbStoreDstPath.mkdir()) { - throw new RuntimeException("Could not create db store " + dbStoreDstPath.getAbsolutePath()); - } - if (!FileHelper.copy(dbStoreSrcPath.listFiles(), dbStoreDstPath, false)) { - throw new RuntimeException("Failed to copy db store from " + dbStoreSrcPath + " to " + dbStoreDstPath); - } - - 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 deleted file mode 100644 index 2161966a1..000000000 --- a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/ObserverUpdateTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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 org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -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.privilege.model.Certificate; -import li.strolch.runtime.StrolchConstants; -import li.strolch.runtime.privilege.PrivilegeHandler; -import li.strolch.testbase.runtime.RuntimeMock; -import li.strolch.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 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); - 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); - tx.commitOnClose(); - } - - // 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); - tx.commitOnClose(); - } - - 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 deleted file mode 100644 index c7a39de67..000000000 --- a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlCachedDaoTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 org.junit.AfterClass; -import org.junit.BeforeClass; - -import li.strolch.testbase.runtime.AbstractModelTest; -import li.strolch.testbase.runtime.RuntimeMock; - -public class XmlCachedDaoTest extends AbstractModelTest { - - public static final String RUNTIME_PATH = "target/cachedStrolchRuntime/"; //$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); - 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 deleted file mode 100644 index ab3d99700..000000000 --- a/li.strolch.persistence.xml/src/test/java/li/strolch/persistence/impl/dao/test/XmlTransactionalDaoTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 org.junit.AfterClass; -import org.junit.BeforeClass; - -import li.strolch.testbase.runtime.AbstractModelTest; -import li.strolch.testbase.runtime.RuntimeMock; - -public class XmlTransactionalDaoTest extends AbstractModelTest { - - public static final String RUNTIME_PATH = "target/transactionalStrolchRuntime/"; //$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); - 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 deleted file mode 100644 index 4b73ec32b..000000000 --- a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeConfig.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeRoles.xml b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeRoles.xml deleted file mode 100644 index 78a1d851e..000000000 --- a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeRoles.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - li.strolch.runtime.privilege.StrolchSystemAction - li.strolch.runtime.privilege.StrolchSystemActionWithResult - - - - - true - - - true - - - diff --git a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeUsers.xml b/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeUsers.xml deleted file mode 100644 index 19a45be9f..000000000 --- a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/PrivilegeUsers.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - SYSTEM - - agent - - - - Application - Administrator - ENABLED - en_GB - - AppUser - - - 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 deleted file mode 100644 index d29ebd052..000000000 --- a/li.strolch.persistence.xml/src/test/resources/cachedruntime/config/StrolchConfiguration.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 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 deleted file mode 100644 index 4b73ec32b..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeConfig.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeRoles.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeRoles.xml deleted file mode 100644 index 78a1d851e..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeRoles.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - li.strolch.runtime.privilege.StrolchSystemAction - li.strolch.runtime.privilege.StrolchSystemActionWithResult - - - - - true - - - true - - - diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeUsers.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeUsers.xml deleted file mode 100644 index 19a45be9f..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/PrivilegeUsers.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - SYSTEM - - agent - - - - Application - Administrator - ENABLED - en_GB - - AppUser - - - 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 deleted file mode 100644 index eec57334a..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/config/StrolchConfiguration.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - 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/data/dbStore/defaultRealm/Order/MyType/@1.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/data/dbStore/defaultRealm/Order/MyType/@1.xml deleted file mode 100644 index 7c0a4269b..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/data/dbStore/defaultRealm/Order/MyType/@1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/data/dbStore/defaultRealm/Resource/MyType/@1.xml b/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/data/dbStore/defaultRealm/Resource/MyType/@1.xml deleted file mode 100644 index bc3a21ee7..000000000 --- a/li.strolch.persistence.xml/src/test/resources/existingDbRuntime/data/dbStore/defaultRealm/Resource/MyType/@1.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/li.strolch.persistence.xml/src/test/resources/logback.xml b/li.strolch.persistence.xml/src/test/resources/logback.xml deleted file mode 100644 index fcc71f058..000000000 --- a/li.strolch.persistence.xml/src/test/resources/logback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - %d [%thread] %-5level %class{36}:%line %method - %msg%n - - - - - - - - \ No newline at end of file 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 deleted file mode 100644 index 4b73ec32b..000000000 --- a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeConfig.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeRoles.xml b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeRoles.xml deleted file mode 100644 index 78a1d851e..000000000 --- a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeRoles.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - li.strolch.runtime.privilege.StrolchSystemAction - li.strolch.runtime.privilege.StrolchSystemActionWithResult - - - - - true - - - true - - - diff --git a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeUsers.xml b/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeUsers.xml deleted file mode 100644 index 19a45be9f..000000000 --- a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/PrivilegeUsers.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - SYSTEM - - agent - - - - Application - Administrator - ENABLED - en_GB - - AppUser - - - 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 deleted file mode 100644 index 017e5165b..000000000 --- a/li.strolch.persistence.xml/src/test/resources/transactionalruntime/config/StrolchConfiguration.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - 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