You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/06 12:09:57 UTC
[33/51] [partial] ISIS-188: moving components into correct
directories.
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java b/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java
new file mode 100644
index 0000000..793ba66
--- /dev/null
+++ b/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest.java
@@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.xml;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.xml.XmlFile;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.runtimes.dflt.objectstores.xml.XmlPersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.ListOfRootOid;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.ObjectData;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion;
+import org.apache.isis.runtimes.dflt.runtime.persistence.ObjectPersistenceException;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.xmlos.Role;
+import org.apache.isis.tck.dom.xmlos.Team;
+import org.apache.isis.tck.dom.xmlos.TeamDomainRepository;
+
+public class XmlDataManagerTest {
+
+ @Rule
+ public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
+ .with(new XmlPersistenceMechanismInstaller())
+ .withServices(new TeamDomainRepository())
+ .build();
+
+ protected XmlDataManager manager;
+
+ @Before
+ public void setUp() throws Exception {
+ FileVersion.setClock(new DefaultClock());
+
+ clearTestDirectory();
+ final String charset = Utils.lookupCharset(iswf.getIsisSystem().getConfiguration());
+ manager = new XmlDataManager(new XmlFile(charset, "tmp/tests"));
+ }
+
+ protected static void clearTestDirectory() {
+ final File directory = new File("tmp" + File.separator + "tests");
+ final String[] files = directory.list(new FilenameFilter() {
+ @Override
+ public boolean accept(final File arg0, final String name) {
+ return name.endsWith(".xml");
+ }
+ });
+
+ if (files != null) {
+ for (final String file : files) {
+ new File(directory, file).delete();
+ }
+ }
+ }
+
+ @Test
+ public void testWriteReadTypeOidAndVersion() {
+ final ObjectData data = createData(Role.class, 99, FileVersion.create("user", 19));
+ manager.insertObject(data);
+
+ final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
+
+ assertEquals(data.getRootOid(), read.getRootOid());
+ assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
+ assertEquals(data.getVersion(), read.getVersion());
+ }
+
+ @Test
+ public void testNextId() throws Exception {
+ final long first = manager.nextId();
+ assertEquals(first + 1, manager.nextId());
+ assertEquals(first + 2, manager.nextId());
+ assertEquals(first + 3, manager.nextId());
+ }
+
+ @Test
+ public void testInsertObjectWithFields() throws ObjectPersistenceException {
+ final ObjectData data = createData(Role.class, 99, FileVersion.create("user", 13));
+ data.set("Person", RootOidDefault.create(ObjectSpecId.of("RLE"), ""+101));
+ assertNotNull(data.get("Person"));
+ data.set("Name", "Harry");
+ assertNotNull(data.get("Name"));
+
+ manager.insertObject(data);
+
+ final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
+ assertEquals(data.getRootOid(), read.getRootOid());
+ assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
+
+ assertEquals(data.get("Person"), read.get("Person"));
+ assertEquals(data.get("Name"), read.get("Name"));
+ }
+
+ @Test
+ public void testInsertObjectWithEmptyOneToManyAssociations() throws ObjectPersistenceException {
+ final ObjectData data = createData(Team.class, 99, FileVersion.create("user", 13));
+
+ data.initCollection("Members");
+
+ manager.insertObject(data);
+
+ final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
+ assertEquals(data.getRootOid(), read.getRootOid());
+ assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
+
+ final ListOfRootOid c = read.elements("Members");
+ assertNull(c);
+ }
+
+ @Test
+ public void testInsertObjectWithOneToManyAssociations() throws ObjectPersistenceException {
+ final ObjectData data = createData(Team.class, 99, FileVersion.create("user", 13));
+
+ data.initCollection("Members");
+ final RootOidDefault oid[] = new RootOidDefault[3];
+ for (int i = 0; i < oid.length; i++) {
+ oid[i] = RootOidDefault.create(ObjectSpecId.of("TEA"), ""+ (104 + i));
+ data.addElement("Members", oid[i]);
+ }
+ manager.insertObject(data);
+
+ final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
+ assertEquals(data.getRootOid(), read.getRootOid());
+ assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
+
+ final ListOfRootOid c = read.elements("Members");
+ for (int i = 0; i < oid.length; i++) {
+ assertEquals(oid[i], c.elementAt(i));
+ }
+ }
+
+
+ private ObjectData createData(final Class<?> type, final long id, final Version version) {
+
+ final ObjectSpecification objSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
+ final ObjectSpecId objectSpecId = objSpec.getSpecId();
+ final RootOidDefault oid = RootOidDefault.create(objectSpecId, ""+id);
+ return new ObjectData(oid, version);
+ }
+ /*
+ * public void xxxtestInsertValues() throws ObjectStoreException {
+ * ObjectSpecification type =
+ * Isis.getSpecificationLoader().loadSpecification
+ * (ValueObjectExample.class.getName()); SerialOid oid = new SerialOid(99);
+ * ObjectData data = new ObjectData(type, oid);
+ *
+ *
+ * Date date1 = new Date(); date1.add(1,2,3); data.saveValue("Date", date1);
+ *
+ * FloatingPointNumber floatingPoint1 = new FloatingPointNumber();
+ * floatingPoint1.setValue(3.145); data.saveValue("Floating Point",
+ * floatingPoint1);
+ *
+ * Label label1 = new Label(); label1.setValue("Labelled");
+ * data.saveValue("Label", label1);
+ *
+ * Logical logical1 = new Logical(); logical1.setValue(true);
+ * data.saveValue("Logical", logical1);
+ *
+ * Money money1 = new Money(); money1.setValue(1233.45);
+ * data.saveValue("Money", money1);
+ *
+ * Option option1 = new Option(new String[] {"Fred", "Sam", "joe"}, 1);
+ * data.saveValue("Option", option1);
+ *
+ * Percentage percentage1 = new Percentage(); percentage1.setValue(95);
+ * data.saveValue("Percentage", percentage1);
+ *
+ * TextString textString1 = new TextString("Fred");
+ * data.saveValue("Text String", textString1);
+ *
+ * DateTime timestamp1 = new DateTime(); timestamp1.add(1,2,3);
+ * data.saveValue("Time Stamp", timestamp1);
+ *
+ * Time time1 = new Time(); time1.add(1,30); data.saveValue("Time", time1);
+ *
+ * URLString urlString1 = new URLString("http://isis.apache.org/");
+ * data.saveValue("Url String", urlString1);
+ *
+ * WholeNumber number1 = new WholeNumber(); number1.setValue(435422);
+ * data.saveValue("Whole Number", number1);
+ *
+ *
+ * manager.insert(data);
+ *
+ *
+ *
+ * ObjectData object = manager.loadObjectData(oid);
+ *
+ * Date date2 = new Date(); object.restoreValue("Date", date2);
+ * assertEquals(date1, date2);
+ *
+ * FloatingPointNumber floatingPoint2 = new FloatingPointNumber();
+ * object.restoreValue("Floating Point", floatingPoint2);
+ * assertEquals(floatingPoint1, floatingPoint2);
+ *
+ * Label label2 = new Label(); object.restoreValue("Label", label2);
+ * assertEquals(label1, label2);
+ *
+ * Logical logical2 = new Logical(); object.restoreValue("Logical",
+ * logical2); assertEquals(logical1, logical2);
+ *
+ * Money money2 = new Money(); object.restoreValue("Money", money2);
+ * assertEquals(money1, money2);
+ *
+ * Option option2 = new Option(new String [] {"Fred", "Sam", "joe"});
+ * object.restoreValue("Option", option2); assertEquals(option1, option2);
+ *
+ * Percentage percentage2 = new Percentage();
+ * object.restoreValue("Percentage", percentage2); assertEquals(percentage1,
+ * percentage2);
+ *
+ * Time time2 = new Time(); object.restoreValue("Time", time2);
+ * assertEquals(time1, time2);
+ *
+ * DateTime timestamp2 = new DateTime(); object.restoreValue("Time Stamp",
+ * timestamp2); assertEquals(timestamp1, timestamp2);
+ *
+ * TextString textString2 = new TextString();
+ * object.restoreValue("Text String", textString2);
+ * assertEquals(textString1, textString2);
+ *
+ * URLString urlString2 = new URLString(); object.restoreValue("Url String",
+ * urlString2); assertEquals(urlString1, urlString2);
+ *
+ * WholeNumber number2 = new WholeNumber();
+ * object.restoreValue("Whole Number", number2); assertEquals(number1,
+ * number2); }
+ *
+ * public void xxxtestSaveValues() throws ObjectStoreException {
+ * ObjectSpecification type =
+ * Isis.getSpecificationLoader().loadSpecification
+ * (ValueObjectExample.class.getName()); SerialOid oid = new SerialOid(99);
+ * ObjectData data = new ObjectData(type, oid);
+ *
+ * manager.insert(data);
+ *
+ *
+ * Date date1 = new Date(); date1.add(1,2,3); data.saveValue("Date", date1);
+ *
+ * FloatingPointNumber floatingPoint1 = new FloatingPointNumber();
+ * floatingPoint1.setValue(3.145); data.saveValue("Floating Point",
+ * floatingPoint1);
+ *
+ * Label label1 = new Label(); label1.setValue("Labelled");
+ * data.saveValue("Label", label1);
+ *
+ * Logical logical1 = new Logical(); logical1.setValue(true);
+ * data.saveValue("Logical", logical1);
+ *
+ * Money money1 = new Money(); money1.setValue(1233.45);
+ * data.saveValue("Money", money1);
+ *
+ * Option option1 = new Option(new String[] {"Fred", "Sam", "joe"}, 1);
+ * data.saveValue("Option", option1);
+ *
+ * Percentage percentage1 = new Percentage(); percentage1.setValue(95);
+ * data.saveValue("Percentage", percentage1);
+ *
+ * TextString textString1 = new TextString("Fred");
+ * data.saveValue("Text String", textString1);
+ *
+ * DateTime timestamp1 = new DateTime(); timestamp1.add(1,2,3);
+ * data.saveValue("Time Stamp", timestamp1);
+ *
+ * Time time1 = new Time(); time1.add(1,30); data.saveValue("Time", time1);
+ *
+ * URLString urlString1 = new URLString("http://isis.apache.org/");
+ * data.saveValue("Url String", urlString1);
+ *
+ * WholeNumber number1 = new WholeNumber(); number1.setValue(435422);
+ * data.saveValue("Whole Number", number1);
+ *
+ *
+ * manager.save(data);
+ *
+ *
+ *
+ * ObjectData object = manager.loadObjectData(oid);
+ *
+ * Date date2 = new Date(); object.restoreValue("Date", date2);
+ * assertEquals(date1, date2);
+ *
+ * FloatingPointNumber floatingPoint2 = new FloatingPointNumber();
+ * object.restoreValue("Floating Point", floatingPoint2);
+ * assertEquals(floatingPoint1, floatingPoint2);
+ *
+ * Label label2 = new Label(); object.restoreValue("Label", label2);
+ * assertEquals(label1, label2);
+ *
+ * Logical logical2 = new Logical(); object.restoreValue("Logical",
+ * logical2); assertEquals(logical1, logical2);
+ *
+ * Money money2 = new Money(); object.restoreValue("Money", money2);
+ * assertEquals(money1, money2);
+ *
+ * Option option2 = new Option(new String [] {"Fred", "Sam", "joe"});
+ * object.restoreValue("Option", option2); assertEquals(option1, option2);
+ *
+ * Percentage percentage2 = new Percentage();
+ * object.restoreValue("Percentage", percentage2); assertEquals(percentage1,
+ * percentage2);
+ *
+ * Time time2 = new Time(); object.restoreValue("Time", time2);
+ * assertEquals(time1, time2);
+ *
+ * DateTime timestamp2 = new DateTime(); object.restoreValue("Time Stamp",
+ * timestamp2); assertEquals(timestamp1, timestamp2);
+ *
+ * TextString textString2 = new TextString();
+ * object.restoreValue("Text String", textString2);
+ * assertEquals(textString1, textString2);
+ *
+ * URLString urlString2 = new URLString(); object.restoreValue("Url String",
+ * urlString2); assertEquals(urlString1, urlString2);
+ *
+ * WholeNumber number2 = new WholeNumber();
+ * object.restoreValue("Whole Number", number2); assertEquals(number1,
+ * number2);
+ *
+ * }
+ */
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java b/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java
new file mode 100644
index 0000000..df056ae
--- /dev/null
+++ b/framework/objectstore/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/internal/data/xml/XmlDataManagerTest_instances.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.xml;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.xml.XmlFile;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.runtimes.dflt.objectstores.xml.XmlPersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.clock.DefaultClock;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.ObjectData;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.data.ObjectDataVector;
+import org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.xmlos.TeamDomainRepository;
+
+public class XmlDataManagerTest_instances {
+
+ @Rule
+ public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
+ .with(new XmlPersistenceMechanismInstaller())
+ .withServices(new TeamDomainRepository())
+ .build();
+
+ protected XmlDataManager manager;
+ protected final int SIZE = 5;
+
+ private RootOid oids[];
+ private ObjectData data[];
+ private ObjectData pattern;
+
+ @Before
+ public void setUp() throws Exception {
+
+ clearTestDirectory();
+ final String charset = Utils.lookupCharset(iswf.getIsisSystem().getConfiguration());
+ manager = new XmlDataManager(new XmlFile(charset, "tmp/tests"));
+
+ FileVersion.setClock(new DefaultClock());
+
+ oids = new RootOid[SIZE];
+ data = new ObjectData[SIZE];
+
+ pattern = new ObjectData(RootOidDefault.deString("RLE:1", new OidMarshaller()), FileVersion.create("user", 13));
+ for (int i = 0; i < SIZE; i++) {
+ oids[i] = RootOidDefault.create(ObjectSpecId.of("RLE"), ""+i);
+ data[i] = new ObjectData(oids[i], FileVersion.create("user", 13));
+ manager.insertObject(data[i]);
+ }
+ }
+
+ protected static void clearTestDirectory() {
+ final File directory = new File("tmp" + File.separator + "tests");
+ final String[] files = directory.list(new FilenameFilter() {
+ @Override
+ public boolean accept(final File arg0, final String name) {
+ return name.endsWith(".xml");
+ }
+ });
+
+ if (files != null) {
+ for (final String file : files) {
+ new File(directory, file).delete();
+ }
+ }
+ }
+
+
+ @Test
+ public void testNumberOfInstances() {
+ assertEquals(SIZE, manager.numberOfInstances(pattern));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ final RootOid oid = oids[2];
+ manager.remove(oid);
+
+ assertEquals(SIZE - 1, manager.numberOfInstances(pattern));
+
+ final ObjectDataVector instances = manager.getInstances(pattern);
+ for (int i = 0; i < instances.size(); i++) {
+ assertFalse(instances.element(i) == data[2]);
+ }
+
+ assertNull((manager.loadData(oid)));
+ }
+
+ @Test
+ public void testSaveObject() throws Exception {
+ data[2].set("Person", RootOidDefault.create(ObjectSpecId.of("PER"), ""+231));
+ data[2].set("Name", "Fred");
+ manager.save(data[2]);
+
+ assertTrue(manager.getInstances(pattern).contains(data[2]));
+ final ObjectData read = (ObjectData) manager.loadData(oids[2]);
+ assertEquals(data[2], read);
+ assertEquals(data[2].get("Name"), read.get("Name"));
+ assertEquals(data[2].get("Person"), read.get("Person"));
+ }
+
+ /*
+ * public void xxxtestInsertValues() throws ObjectStoreException {
+ * ObjectSpecification type =
+ * Isis.getSpecificationLoader().loadSpecification
+ * (ValueObjectExample.class.getName()); SerialOid oid = new SerialOid(99);
+ * ObjectData data = new ObjectData(type, oid);
+ *
+ *
+ * Date date1 = new Date(); date1.add(1,2,3); data.saveValue("Date", date1);
+ *
+ * FloatingPointNumber floatingPoint1 = new FloatingPointNumber();
+ * floatingPoint1.setValue(3.145); data.saveValue("Floating Point",
+ * floatingPoint1);
+ *
+ * Label label1 = new Label(); label1.setValue("Labelled");
+ * data.saveValue("Label", label1);
+ *
+ * Logical logical1 = new Logical(); logical1.setValue(true);
+ * data.saveValue("Logical", logical1);
+ *
+ * Money money1 = new Money(); money1.setValue(1233.45);
+ * data.saveValue("Money", money1);
+ *
+ * Option option1 = new Option(new String[] {"Fred", "Sam", "joe"}, 1);
+ * data.saveValue("Option", option1);
+ *
+ * Percentage percentage1 = new Percentage(); percentage1.setValue(95);
+ * data.saveValue("Percentage", percentage1);
+ *
+ * TextString textString1 = new TextString("Fred");
+ * data.saveValue("Text String", textString1);
+ *
+ * DateTime timestamp1 = new DateTime(); timestamp1.add(1,2,3);
+ * data.saveValue("Time Stamp", timestamp1);
+ *
+ * Time time1 = new Time(); time1.add(1,30); data.saveValue("Time", time1);
+ *
+ * URLString urlString1 = new URLString("http://isis.apache.org/");
+ * data.saveValue("Url String", urlString1);
+ *
+ * WholeNumber number1 = new WholeNumber(); number1.setValue(435422);
+ * data.saveValue("Whole Number", number1);
+ *
+ *
+ * manager.insert(data);
+ *
+ *
+ *
+ * ObjectData object = manager.loadObjectData(oid);
+ *
+ * Date date2 = new Date(); object.restoreValue("Date", date2);
+ * assertEquals(date1, date2);
+ *
+ * FloatingPointNumber floatingPoint2 = new FloatingPointNumber();
+ * object.restoreValue("Floating Point", floatingPoint2);
+ * assertEquals(floatingPoint1, floatingPoint2);
+ *
+ * Label label2 = new Label(); object.restoreValue("Label", label2);
+ * assertEquals(label1, label2);
+ *
+ * Logical logical2 = new Logical(); object.restoreValue("Logical",
+ * logical2); assertEquals(logical1, logical2);
+ *
+ * Money money2 = new Money(); object.restoreValue("Money", money2);
+ * assertEquals(money1, money2);
+ *
+ * Option option2 = new Option(new String [] {"Fred", "Sam", "joe"});
+ * object.restoreValue("Option", option2); assertEquals(option1, option2);
+ *
+ * Percentage percentage2 = new Percentage();
+ * object.restoreValue("Percentage", percentage2); assertEquals(percentage1,
+ * percentage2);
+ *
+ * Time time2 = new Time(); object.restoreValue("Time", time2);
+ * assertEquals(time1, time2);
+ *
+ * DateTime timestamp2 = new DateTime(); object.restoreValue("Time Stamp",
+ * timestamp2); assertEquals(timestamp1, timestamp2);
+ *
+ * TextString textString2 = new TextString();
+ * object.restoreValue("Text String", textString2);
+ * assertEquals(textString1, textString2);
+ *
+ * URLString urlString2 = new URLString(); object.restoreValue("Url String",
+ * urlString2); assertEquals(urlString1, urlString2);
+ *
+ * WholeNumber number2 = new WholeNumber();
+ * object.restoreValue("Whole Number", number2); assertEquals(number1,
+ * number2); }
+ *
+ * public void xxxtestSaveValues() throws ObjectStoreException {
+ * ObjectSpecification type =
+ * Isis.getSpecificationLoader().loadSpecification
+ * (ValueObjectExample.class.getName()); SerialOid oid = new SerialOid(99);
+ * ObjectData data = new ObjectData(type, oid);
+ *
+ * manager.insert(data);
+ *
+ *
+ * Date date1 = new Date(); date1.add(1,2,3); data.saveValue("Date", date1);
+ *
+ * FloatingPointNumber floatingPoint1 = new FloatingPointNumber();
+ * floatingPoint1.setValue(3.145); data.saveValue("Floating Point",
+ * floatingPoint1);
+ *
+ * Label label1 = new Label(); label1.setValue("Labelled");
+ * data.saveValue("Label", label1);
+ *
+ * Logical logical1 = new Logical(); logical1.setValue(true);
+ * data.saveValue("Logical", logical1);
+ *
+ * Money money1 = new Money(); money1.setValue(1233.45);
+ * data.saveValue("Money", money1);
+ *
+ * Option option1 = new Option(new String[] {"Fred", "Sam", "joe"}, 1);
+ * data.saveValue("Option", option1);
+ *
+ * Percentage percentage1 = new Percentage(); percentage1.setValue(95);
+ * data.saveValue("Percentage", percentage1);
+ *
+ * TextString textString1 = new TextString("Fred");
+ * data.saveValue("Text String", textString1);
+ *
+ * DateTime timestamp1 = new DateTime(); timestamp1.add(1,2,3);
+ * data.saveValue("Time Stamp", timestamp1);
+ *
+ * Time time1 = new Time(); time1.add(1,30); data.saveValue("Time", time1);
+ *
+ * URLString urlString1 = new URLString("http://isis.apache.org/");
+ * data.saveValue("Url String", urlString1);
+ *
+ * WholeNumber number1 = new WholeNumber(); number1.setValue(435422);
+ * data.saveValue("Whole Number", number1);
+ *
+ *
+ * manager.save(data);
+ *
+ *
+ *
+ * ObjectData object = manager.loadObjectData(oid);
+ *
+ * Date date2 = new Date(); object.restoreValue("Date", date2);
+ * assertEquals(date1, date2);
+ *
+ * FloatingPointNumber floatingPoint2 = new FloatingPointNumber();
+ * object.restoreValue("Floating Point", floatingPoint2);
+ * assertEquals(floatingPoint1, floatingPoint2);
+ *
+ * Label label2 = new Label(); object.restoreValue("Label", label2);
+ * assertEquals(label1, label2);
+ *
+ * Logical logical2 = new Logical(); object.restoreValue("Logical",
+ * logical2); assertEquals(logical1, logical2);
+ *
+ * Money money2 = new Money(); object.restoreValue("Money", money2);
+ * assertEquals(money1, money2);
+ *
+ * Option option2 = new Option(new String [] {"Fred", "Sam", "joe"});
+ * object.restoreValue("Option", option2); assertEquals(option1, option2);
+ *
+ * Percentage percentage2 = new Percentage();
+ * object.restoreValue("Percentage", percentage2); assertEquals(percentage1,
+ * percentage2);
+ *
+ * Time time2 = new Time(); object.restoreValue("Time", time2);
+ * assertEquals(time1, time2);
+ *
+ * DateTime timestamp2 = new DateTime(); object.restoreValue("Time Stamp",
+ * timestamp2); assertEquals(timestamp1, timestamp2);
+ *
+ * TextString textString2 = new TextString();
+ * object.restoreValue("Text String", textString2);
+ * assertEquals(textString1, textString2);
+ *
+ * URLString urlString2 = new URLString(); object.restoreValue("Url String",
+ * urlString2); assertEquals(urlString1, urlString2);
+ *
+ * WholeNumber number2 = new WholeNumber();
+ * object.restoreValue("Whole Number", number2); assertEquals(number1,
+ * number2);
+ *
+ * }
+ */
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/pom.xml
----------------------------------------------------------------------
diff --git a/framework/pom.xml b/framework/pom.xml
index c7361a4..bb33303 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -248,13 +248,13 @@
<module>core</module>
- <module>runtimes/dflt/objectstores/xml</module>
- <module>runtimes/dflt/objectstores/sql</module>
- <module>runtimes/dflt/objectstores/nosql</module>
- <module>runtimes/dflt/objectstores/jdo</module>
+ <module>objectstore/xml</module>
+ <module>objectstore/sql</module>
+ <module>objectstore/nosql</module>
+ <module>objectstore/jdo</module>
- <module>runtimes/dflt/profilestores/xml</module>
- <module>runtimes/dflt/profilestores/sql</module>
+ <module>profilestore/xml</module>
+ <module>profilestore/sql</module>
<module>tck</module>
@@ -262,8 +262,8 @@
<module>security/ldap</module>
<module>security/sql</module>
- <module>progmodels/wrapper</module>
- <module>progmodels/groovy</module>
+ <module>progmodel/wrapper</module>
+ <module>progmodel/groovy</module>
<module>viewer/dnd</module>
<module>viewer/dnd-tck</module>
@@ -276,7 +276,7 @@
<module>viewer/junit</module>
<module>viewer/junit-tck</module>
- <module>quickstart-archetype</module>
+ <module>archetype/quickstart</module>
<module>runtimes/dflt/monitoring</module>
</modules>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/NOTICE
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/NOTICE b/framework/profilestore/sql/NOTICE
new file mode 100755
index 0000000..d391f54
--- /dev/null
+++ b/framework/profilestore/sql/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/pom.xml
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/pom.xml b/framework/profilestore/sql/pom.xml
new file mode 100755
index 0000000..2d589a5
--- /dev/null
+++ b/framework/profilestore/sql/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis</groupId>
+ <artifactId>isis</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.isis.runtimes.dflt.profilestores</groupId>
+ <artifactId>sql</artifactId>
+ <name>Default Runtime SQL ProfileStore (jdbc)</name>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>profilestore/sql/</relativeUrl>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${maven-project-info-reports-plugin}</version>
+ <inherited>false</inherited>
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <inherited>false</inherited>
+ <reports>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>plugins</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-unittestsupport</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-metamodel</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStore.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStore.java b/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStore.java
new file mode 100755
index 0000000..559c922
--- /dev/null
+++ b/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStore.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.isis.runtimes.dflt.profilestores.sql;
+
+import com.google.inject.Inject;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class SqlUserProfileStore implements UserProfileStore {
+
+ @Inject
+ public SqlUserProfileStore(final IsisConfiguration configuration) {
+
+ }
+
+ @Override
+ public boolean isFixturesInstalled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void save(final String userName, final UserProfile userProfile) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public UserProfile getUserProfile(final String userName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStoreInstaller.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStoreInstaller.java b/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStoreInstaller.java
new file mode 100755
index 0000000..ce78557
--- /dev/null
+++ b/framework/profilestore/sql/src/main/java/org/apache/isis/runtimes/dflt/profilestores/sql/SqlUserProfileStoreInstaller.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.isis.runtimes.dflt.profilestores.sql;
+
+import java.util.List;
+
+import org.apache.isis.core.commons.config.InstallerAbstract;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+import org.apache.isis.runtimes.dflt.runtime.userprofile.UserProfileStoreInstaller;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class SqlUserProfileStoreInstaller extends InstallerAbstract implements UserProfileStoreInstaller {
+
+ public SqlUserProfileStoreInstaller() {
+ super(UserProfileStoreInstaller.TYPE, "sql");
+ }
+
+ @Override
+ public UserProfileStore createUserProfileStore(final IsisConfiguration configuration) {
+ return new SqlUserProfileStore(configuration);
+ }
+
+ @Override
+ public List<Class<?>> getTypes() {
+ return listOf(UserProfileStore.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/src/site/apt/index.apt b/framework/profilestore/sql/src/site/apt/index.apt
new file mode 100755
index 0000000..a3591d0
--- /dev/null
+++ b/framework/profilestore/sql/src/site/apt/index.apt
@@ -0,0 +1,43 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you 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.
+
+
+
+SQL Profile Store (jdbc)
+
+ The <sql> (jdbc) profile store module provides a skeleton to accept
+ a persistent store for user profiles that is backed onto any jdbc
+ compatible database.
+
+ It is currently a no-op skeleton, yet to be implemented.
+
+
+Alternatives
+
+ Alternatives include:
+
+ * the {{{../dflt/index.html}dflt}} (in-memory) profile store
+
+ * the {{{../xml/index.html}XML}} profile store
+
+Further Info
+
+ See this module's {{{./apidocs/index.html}Javadoc}} for more information.
+
+
+ []
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/src/site/apt/jottings.apt b/framework/profilestore/sql/src/site/apt/jottings.apt
new file mode 100755
index 0000000..c5d1200
--- /dev/null
+++ b/framework/profilestore/sql/src/site/apt/jottings.apt
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you 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.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/sql/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/profilestore/sql/src/site/site.xml b/framework/profilestore/sql/src/site/site.xml
new file mode 100755
index 0000000..55d03a7
--- /dev/null
+++ b/framework/profilestore/sql/src/site/site.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project>
+
+ <body>
+ <breadcrumbs>
+ <item name="Sql" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="SQL (jdbc) Profile Store">
+ <item name="About" href="index.html" />
+ <item name="Jottings" href="jottings.html" />
+ </menu>
+
+ <menu name="Profile Stores">
+ <item name="Default (In-mem)" href="../dflt/index.html" />
+ <item name="XML" href="../xml/index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports"/>
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/NOTICE
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/NOTICE b/framework/profilestore/xml/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/profilestore/xml/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/pom.xml
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/pom.xml b/framework/profilestore/xml/pom.xml
new file mode 100644
index 0000000..8cc5e3c
--- /dev/null
+++ b/framework/profilestore/xml/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis</groupId>
+ <artifactId>isis</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.isis.runtimes.dflt.profilestores</groupId>
+ <artifactId>xml</artifactId>
+
+ <name>Default Runtime XML ProfileStore</name>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>profilestore/xml/</relativeUrl>
+
+ <docbkxGuideTitle>Default Runtime XML ProfileStore</docbkxGuideTitle>
+ <docbkxGuideSubTitle>Configuration and Deployment Guide</docbkxGuideSubTitle>
+ <docbkxGuideName>isis-xml-profilestore</docbkxGuideName>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.agilejava.docbkx</groupId>
+ <artifactId>docbkx-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${maven-project-info-reports-plugin}</version>
+ <inherited>false</inherited>
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <inherited>false</inherited>
+ <reports>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>plugins</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-metamodel</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-unittestsupport</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/docbkx/guide/isis-xml-profilestore.xml
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/docbkx/guide/isis-xml-profilestore.xml b/framework/profilestore/xml/src/docbkx/guide/isis-xml-profilestore.xml
new file mode 100644
index 0000000..f336723
--- /dev/null
+++ b/framework/profilestore/xml/src/docbkx/guide/isis-xml-profilestore.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"file:./src/docbkx/dtd-4.5/docbookx.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<book>
+ <bookinfo>
+ <title><?eval ${docbkxGuideTitle}?></title>
+ <subtitle><?eval ${docbkxGuideSubTitle}?></subtitle>
+ <releaseinfo><?eval ${project.version}?></releaseinfo>
+
+ <authorgroup>
+ <author>
+ <firstname>Robert</firstname>
+ <surname>Matthews</surname>
+ </author>
+ </authorgroup>
+
+ <legalnotice>
+ <para>Permission is granted to make and distribute verbatim copies of
+ this manual provided that the copyright notice and this permission
+ notice are preserved on all copies.</para>
+ </legalnotice>
+ </bookinfo>
+
+ <!-- front matter -->
+
+ <toc></toc>
+
+ <preface id="preface">
+ <title>Preface</title>
+
+ <para><emphasis>Apache Isis</emphasis> is designed to allow programmers
+ rapidly develop domain-driven applications following the <ulink
+ url="http://en.wikipedia.org/wiki/Naked_Objects">Naked Objects</ulink>
+ pattern. It is made up of a core framework plus a number of alternate
+ implementations, and supports various viewers and object stores. Apache
+ Isis is hosted at the
+ <ulink url="http://incubator.apache.org/isis">Apache Foundation</ulink>,
+ and is licensed under <ulink
+ url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software
+ License v2</ulink>.</para>
+
+ <para>This guide is written for programmers who want to use the
+ <emphasis>XML Profile Store</emphasis> to persist user-specific profile
+ information for users working with an
+ <emphasis>Apache Isis</emphasis> application.</para>
+ </preface>
+
+ <!-- main content -->
+
+ <chapter id="chp.Intro">
+ <title>Introduction</title>
+
+ <abstract>
+ <para>*** yada yada</para>
+ </abstract>
+
+ <sect1>
+ <title>***</title>
+
+ <para><emphasis>*** yada yada</emphasis></para>
+ </sect1>
+ </chapter>
+
+ <chapter>
+ <title>***</title>
+
+ <abstract>
+ <para>*** yada yada</para>
+ </abstract>
+
+ <sect1>
+ <title>***</title>
+
+ <para><emphasis>*** yada yada</emphasis></para>
+ </sect1>
+ </chapter>
+
+ <appendix>
+ <title>***</title>
+
+ <abstract>
+ <para>*** yada yada</para>
+ </abstract>
+
+ <sect1>
+ <title>***</title>
+
+ <para>*** yada yada</para>
+ </sect1>
+ </appendix>
+</book>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStore.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStore.java b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStore.java
new file mode 100644
index 0000000..4e2b01a
--- /dev/null
+++ b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStore.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml;
+
+import com.google.inject.Inject;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.xml.XmlFile;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+import org.apache.isis.runtimes.dflt.profilestores.xml.internal.UserProfileContentWriter;
+import org.apache.isis.runtimes.dflt.profilestores.xml.internal.UserProfileDataHandler;
+import org.apache.isis.runtimes.dflt.profilestores.xml.internal.XmlFileUtil;
+
+public class XmlUserProfileStore implements UserProfileStore {
+
+ private static final String XML_DIR = ConfigurationConstants.ROOT + "xmluserprofile.dir";
+ private final XmlFile xmlFile;
+
+ @Inject
+ public XmlUserProfileStore(final IsisConfiguration configuration) {
+ final String directory = configuration.getString(XML_DIR, "xml/profiles");
+ xmlFile = new XmlFile(XmlFileUtil.lookupCharset(configuration), directory);
+ }
+
+ @Override
+ public UserProfile getUserProfile(final String userName) {
+ final UserProfileDataHandler handler = new UserProfileDataHandler();
+ if (xmlFile.parse(handler, userName)) {
+ return handler.getUserProfile();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isFixturesInstalled() {
+ return xmlFile.isFixturesInstalled();
+ }
+
+ @Override
+ public void save(final String userName, final UserProfile userProfile) {
+ xmlFile.writeXml(userName, new UserProfileContentWriter(userProfile));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStoreInstaller.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStoreInstaller.java b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStoreInstaller.java
new file mode 100644
index 0000000..7154ee6
--- /dev/null
+++ b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/XmlUserProfileStoreInstaller.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml;
+
+import java.util.List;
+
+import org.apache.isis.core.commons.config.InstallerAbstract;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+import org.apache.isis.runtimes.dflt.runtime.userprofile.UserProfileStoreInstaller;
+
+public class XmlUserProfileStoreInstaller extends InstallerAbstract implements UserProfileStoreInstaller {
+
+ public XmlUserProfileStoreInstaller() {
+ super(UserProfileStoreInstaller.TYPE, "xml");
+ }
+
+ @Override
+ public UserProfileStore createUserProfileStore(final IsisConfiguration configuration) {
+ return new XmlUserProfileStore(configuration);
+ }
+
+ @Override
+ public List<Class<?>> getTypes() {
+ return listOf(UserProfileStore.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriter.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriter.java b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriter.java
new file mode 100644
index 0000000..6dcd103
--- /dev/null
+++ b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriter.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.Iterator;
+
+import org.apache.commons.lang.StringUtils;
+
+import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
+import org.apache.isis.core.commons.xml.ContentWriter;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.services.ServiceUtil;
+import org.apache.isis.core.runtime.userprofile.Options;
+import org.apache.isis.core.runtime.userprofile.PerspectiveEntry;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+
+public class UserProfileContentWriter implements ContentWriter {
+ private final UserProfile userProfile;
+
+ public UserProfileContentWriter(final UserProfile userProfile) {
+ this.userProfile = userProfile;
+ }
+
+ @Override
+ public void write(final Writer writer) throws IOException {
+ final StringBuffer xml = new StringBuffer();
+ xml.append("<profile>\n");
+
+ final Options options = userProfile.getOptions();
+ writeOptions(xml, options, null, 0);
+
+ xml.append(" <perspectives>\n");
+ for (final String perspectiveName : userProfile.list()) {
+ final PerspectiveEntry perspective = userProfile.getPerspective(perspectiveName);
+
+ xml.append(" <perspective" + attribute("name", perspectiveName) + ">\n");
+ xml.append(" <services>\n");
+ for (final Object service : perspective.getServices()) {
+ xml.append(" <service " + attribute("id", ServiceUtil.id(service)) + "/>\n");
+ }
+ xml.append(" </services>\n");
+ xml.append(" <objects>\n");
+ for (final Object object : perspective.getObjects()) {
+ final ObjectAdapter adapter = getPersistenceSession().getAdapterManager().adapterFor(object);
+ xml.append(" <object>" + adapter.getOid().enString(getOidMarshaller()) + "</object>\n");
+ }
+ xml.append(" </objects>\n");
+ xml.append(" </perspective>\n");
+ }
+ xml.append(" </perspectives>\n");
+
+ xml.append("</profile>\n");
+
+ writer.write(xml.toString());
+ }
+
+ private void writeOptions(final StringBuffer xml, final Options options, final String name1, final int level) {
+ final String spaces = StringUtils.repeat(" ", level);
+
+ final Iterator<String> names = options.names();
+ if (level == 0 || names.hasNext()) {
+ xml.append(spaces + " <options");
+ if (name1 != null) {
+ xml.append(" id=\"" + name1 + "\"");
+ }
+ xml.append(">\n");
+ while (names.hasNext()) {
+ final String name = names.next();
+ if (options.isOptions(name)) {
+ writeOptions(xml, options.getOptions(name), name, level + 1);
+ } else {
+ xml.append(spaces + " <option" + attribute("id", name) + ">" + options.getString(name) + "</option>\n");
+ }
+ }
+ xml.append(spaces + " </options>\n");
+ }
+ }
+
+ private String attribute(final String name, final String value) {
+ return " " + name + "=\"" + value + "\"";
+ }
+
+ // ///////////////////////////////////////////////////
+ // Dependencies (from context)
+ // ///////////////////////////////////////////////////
+
+ protected OidMarshaller getOidMarshaller() {
+ return IsisContext.getOidMarshaller();
+ }
+
+ protected static PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileDataHandler.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileDataHandler.java b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileDataHandler.java
new file mode 100644
index 0000000..b02dfdd
--- /dev/null
+++ b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileDataHandler.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml.internal;
+
+import java.util.List;
+import java.util.Stack;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.apache.isis.core.metamodel.services.ServiceUtil;
+import org.apache.isis.core.runtime.userprofile.Options;
+import org.apache.isis.core.runtime.userprofile.PerspectiveEntry;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+
+public class UserProfileDataHandler extends DefaultHandler {
+ private final StringBuffer data = new StringBuffer();
+ private final UserProfile userProfile = new UserProfile();
+ private final Stack<Options> options = new Stack<Options>();
+ private String optionName;
+ private boolean isProfile;
+ private boolean isOptions;
+ private boolean isPerspectives;
+ private PerspectiveEntry perspective;
+ private boolean isServices;
+ private boolean isObjects;
+
+ public UserProfile getUserProfile() {
+ return userProfile;
+ }
+
+ @Override
+ public void characters(final char[] ch, final int start, final int end) throws SAXException {
+ data.append(new String(ch, start, end));
+ }
+
+ @Override
+ public void endElement(final String ns, final String name, final String tagName) throws SAXException {
+ if (tagName.equals("options")) {
+ options.pop();
+ isOptions = options.size() > 0;
+ } else if (tagName.equals("perspectives")) {
+ isPerspectives = false;
+ } else if (tagName.equals("perspective")) {
+ // TODO add perspective to profile
+
+ perspective = null;
+ } else if (tagName.equals("services")) {
+ isServices = false;
+ } else if (tagName.equals("objects")) {
+ isObjects = false;
+ } else if (tagName.equals("option")) {
+ final String value = data.toString();
+ options.peek().addOption(optionName, value);
+ } else if (tagName.equals("name")) {
+ final String value = data.toString();
+ System.out.println(value);
+ }
+ }
+
+ @Override
+ public void startElement(final String ns, final String name, final String tagName, final Attributes attributes) throws SAXException {
+
+ if (isProfile) {
+ if (isOptions) {
+ if (tagName.equals("option")) {
+ optionName = attributes.getValue("id");
+ data.setLength(0);
+ } else if (tagName.equals("options")) {
+ final String optionsName = attributes.getValue("id");
+ final Options newOptions = new Options();
+ options.peek().addOptions(optionsName, newOptions);
+ options.push(newOptions);
+ } else {
+ throw new SAXException("Invalid element in options: " + tagName);
+ }
+ } else if (isPerspectives) {
+ if (perspective != null) {
+ if (isServices) {
+ if (tagName.equals("service")) {
+ final String serviceId = attributes.getValue("id");
+ final List<Object> serviceObjects = IsisContext.getServices();
+ for (final Object service : serviceObjects) {
+ if (ServiceUtil.id(service).equals(serviceId)) {
+ perspective.addToServices(service);
+ break;
+ }
+ }
+ } else {
+ throw new SAXException("Invalid element in services: " + tagName);
+ }
+ } else if (isObjects) {
+ // TODO reload objects
+ } else if (tagName.equals("services")) {
+ isServices = true;
+ } else if (tagName.equals("objects")) {
+ isObjects = true;
+ } else {
+ throw new SAXException("Invalid element in perspective: " + tagName);
+ }
+ } else if (tagName.equals("perspective")) {
+ perspective = userProfile.newPerspective(attributes.getValue("name"));
+ } else {
+ throw new SAXException("Invalid element in perspectives: " + tagName);
+ }
+ } else if (tagName.equals("options")) {
+ isOptions = true;
+ options.push(userProfile.getOptions());
+ } else if (tagName.equals("perspectives") && !isOptions) {
+ isPerspectives = true;
+ } else {
+ throw new SAXException("Invalid element in profile: " + tagName);
+ }
+
+ }
+ /*
+ * else { throw new SAXException("Invalid data"); } }
+ */
+
+ if (tagName.equals("profile")) {
+ isProfile = true;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/XmlFileUtil.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/XmlFileUtil.java b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/XmlFileUtil.java
new file mode 100644
index 0000000..2edce0e
--- /dev/null
+++ b/framework/profilestore/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/XmlFileUtil.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml.internal;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+
+public class XmlFileUtil {
+
+ public static final String ENCODING_PROPERTY = ConfigurationConstants.ROOT + "xmlos.encoding";
+ public static final String DEFAULT_ENCODING = "ISO-8859-1";
+
+ public static String lookupCharset(final IsisConfiguration configuration) {
+ return configuration.getString(ENCODING_PROPERTY, DEFAULT_ENCODING);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/site/apt/index.apt b/framework/profilestore/xml/src/site/apt/index.apt
new file mode 100644
index 0000000..61e9f4b
--- /dev/null
+++ b/framework/profilestore/xml/src/site/apt/index.apt
@@ -0,0 +1,36 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you 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.
+
+
+
+XML ProfileStore
+
+ The <xml> profile store provides a simple way to persist user profile
+ information to file storage. The format of this file is a
+ proprietary XML schema.
+
+
+Alternatives
+
+ Alternatives include:
+
+ * the {{{../dflt/index.html}dflt}} (in-memory) profile store
+
+ * the {{{../sql/index.html}SQL}} (jdbc) profile store (incomplete)
+
+ []
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/site/apt/jottings.apt b/framework/profilestore/xml/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/profilestore/xml/src/site/apt/jottings.apt
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you 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.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/site/site.xml b/framework/profilestore/xml/src/site/site.xml
new file mode 100644
index 0000000..8ba380f
--- /dev/null
+++ b/framework/profilestore/xml/src/site/site.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project>
+
+ <body>
+ <breadcrumbs>
+ <item name="XML" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="XML Profile Store">
+ <item name="About" href="index.html" />
+ <item name="Jottings" href="jottings.html" />
+ </menu>
+
+ <menu name="Profile Stores">
+ <item name="Default (In-mem)" href="../dflt/index.html" />
+ <item name="XML" href="../xml/index.html" />
+ <item name="SQL (jdbc)" href="../sql/index.html" />
+ </menu>
+
+ <menu name="Documentation">
+ <item name="${docbkxGuideTitle} (PDF)" href="docbkx/pdf/${docbkxGuideName}.pdf" />
+ <item name="${docbkxGuideTitle} (HTML)" href="docbkx/html/guide/${docbkxGuideName}.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/TestServiceObject1.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/TestServiceObject1.java b/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/TestServiceObject1.java
new file mode 100644
index 0000000..d4fe76d
--- /dev/null
+++ b/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/TestServiceObject1.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml.internal;
+
+public class TestServiceObject1 {
+ public static final String ID = "test service";
+
+ public String getId() {
+ return ID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriterTest.java
----------------------------------------------------------------------
diff --git a/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriterTest.java b/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriterTest.java
new file mode 100644
index 0000000..3d10a7f
--- /dev/null
+++ b/framework/profilestore/xml/src/test/java/org/apache/isis/runtimes/dflt/profilestores/xml/internal/UserProfileContentWriterTest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.isis.runtimes.dflt.profilestores.xml.internal;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.core.runtime.userprofile.Options;
+import org.apache.isis.core.runtime.userprofile.PerspectiveEntry;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+
+public class UserProfileContentWriterTest {
+
+ private UserProfileContentWriter writer1;
+ private UserProfile profile;
+ private StringWriter writer;
+
+ @Before
+ public void setup() throws Exception {
+ profile = new UserProfile();
+ writer1 = new UserProfileContentWriter(profile);
+ writer = new StringWriter();
+
+ }
+
+ @Test
+ public void emptyStructure() throws Exception {
+ writeContent();
+ assertEquals("<profile>\n <options>\n </options>\n <perspectives>\n </perspectives>\n</profile>\n", writer.toString());
+ }
+
+ @Test
+ public void singleOption() throws Exception {
+ profile.addToOptions("option1", "value1");
+ profile.addToOptions("option2", "value2");
+ assertLine(" <option id=\"option2\">value2</option>", 2);
+ assertLine(" <option id=\"option1\">value1</option>", 3);
+ }
+
+ @Test
+ public void recursiveOptions() throws Exception {
+ final Options options = new Options();
+ options.addOption("option2", "value2");
+ profile.getOptions().addOptions("option1", options);
+ assertLine(" <options id=\"option1\">", 2);
+ assertLine(" <option id=\"option2\">value2</option>", 3);
+ assertLine(" </options>", 4);
+ }
+
+ @Test
+ public void emptyOptionsAreIgnored() throws Exception {
+ final Options options = new Options();
+ profile.getOptions().addOptions("option1", options);
+ debug();
+ assertLine(" </options>", 2);
+ }
+
+ @Test
+ public void perspective() throws Exception {
+ final PerspectiveEntry perspective = new PerspectiveEntry();
+ perspective.setName("test");
+ profile.addToPerspectives(perspective);
+ // debug();
+ writeContent();
+ assertEquals("<profile>\n <options>\n </options>\n <perspectives>\n" + " <perspective name=\"test\">\n <services>\n </services>\n <objects>\n </objects>\n </perspective>\n" + " </perspectives>\n</profile>\n", writer.toString());
+ }
+
+ // // Helpers
+
+ private void assertLine(final String expected, final int line) throws IOException {
+ writeContent();
+ assertEquals(expected, writer.toString().split("\n")[line]);
+ }
+
+ private void debug() throws IOException {
+ writeContent();
+ System.out.println(writer.toString());
+ }
+
+ private void writeContent() throws IOException {
+ writer1.write(writer);
+ }
+}