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 11:10:35 UTC
[32/51] [partial] ISIS-188: moving modules into core
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/objectstore-inmemory/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/internal/ObjectStorePersistedObjectsDefault_services.java
----------------------------------------------------------------------
diff --git a/framework/core/objectstore-inmemory/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/internal/ObjectStorePersistedObjectsDefault_services.java b/framework/core/objectstore-inmemory/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/internal/ObjectStorePersistedObjectsDefault_services.java
new file mode 100644
index 0000000..06e66c5
--- /dev/null
+++ b/framework/core/objectstore-inmemory/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/internal/ObjectStorePersistedObjectsDefault_services.java
@@ -0,0 +1,80 @@
+/*
+ * 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.dflt.internal;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Mockery;
+import org.jmock.auto.Mock;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class ObjectStorePersistedObjectsDefault_services {
+
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+ @Mock
+ private Oid mockOidForFooService;
+ @Mock
+ private Oid mockOidForBarService;
+
+ private ObjectStorePersistedObjectsDefault persistedObjects;
+
+ @Before
+ public void setUp() throws Exception {
+ persistedObjects = new ObjectStorePersistedObjectsDefault();
+ }
+
+ @Test
+ public void noServicesInitially() throws Exception {
+ final Oid service = persistedObjects.getService(ObjectSpecId.of("fooService"));
+ assertThat(service, is(nullValue()));
+ }
+
+ @Test
+ public void registerServicesMakesAvailable() throws Exception {
+ persistedObjects.registerService(ObjectSpecId.of("fooService"), mockOidForFooService);
+
+ final Oid service = persistedObjects.getService(ObjectSpecId.of("fooService"));
+ assertThat(service, is(mockOidForFooService));
+ }
+
+ @Test
+ public void registerServicesWhenMoreThanOnePullsOutTheCorrectOne() throws Exception {
+ persistedObjects.registerService(ObjectSpecId.of("fooService"), mockOidForFooService);
+ persistedObjects.registerService(ObjectSpecId.of("barService"), mockOidForBarService);
+
+ final Oid service = persistedObjects.getService(ObjectSpecId.of("fooService"));
+ assertThat(service, is(mockOidForFooService));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/objectstore-inmemory/test.data
----------------------------------------------------------------------
diff --git a/framework/core/objectstore-inmemory/test.data b/framework/core/objectstore-inmemory/test.data
new file mode 100644
index 0000000..859c9b3
--- /dev/null
+++ b/framework/core/objectstore-inmemory/test.data
@@ -0,0 +1,4 @@
+org.apache.isis.core.testsupport.testdomain.Person#1
+ name: Fred Smith
+ # ignores: data
+ date: 08-Mar-2010 13:32
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/pom.xml b/framework/core/pom.xml
index 9ed904f..90e2ebd 100644
--- a/framework/core/pom.xml
+++ b/framework/core/pom.xml
@@ -47,19 +47,19 @@
<modules>
- <module>testsupport</module>
- <module>../applib</module>
+ <module>unittestsupport</module>
+ <module>applib</module>
<module>metamodel</module>
- <module>../runtimes/dflt/runtime</module>
- <module>../runtimes/dflt/webserver</module>
+ <module>runtime</module>
+ <module>webserver</module>
- <module>../runtimes/dflt/testsupport</module>
- <module>../runtimes/dflt/bytecode/dflt</module>
- <module>../runtimes/dflt/bytecode/javassist</module>
+ <module>integtestsupport</module>
+ <module>bytecode-cglib</module>
+ <module>bytecode-javassist</module>
- <module>../runtimes/dflt/objectstores/dflt</module>
- <module>../runtimes/dflt/profilestores/dflt</module>
- <module>../security/dflt</module>
+ <module>objectstore-inmemory</module>
+ <module>profilestore-inmemory</module>
+ <module>security-noop</module>
</modules>
<build>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/profilestore-inmemory/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/NOTICE b/framework/core/profilestore-inmemory/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/core/profilestore-inmemory/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/dbb64345/framework/core/profilestore-inmemory/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/pom.xml b/framework/core/profilestore-inmemory/pom.xml
new file mode 100644
index 0000000..737d73c
--- /dev/null
+++ b/framework/core/profilestore-inmemory/pom.xml
@@ -0,0 +1,93 @@
+<?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>core</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.runtimes.dflt.profilestores</groupId>
+ <artifactId>dflt</artifactId>
+ <name>Default ProfileStore (In-Memory)</name>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>profilestore-inmemory/</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.apache.isis.core</groupId>
+ <artifactId>isis-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-metamodel</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStore.java
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStore.java b/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStore.java
new file mode 100644
index 0000000..ac625ee
--- /dev/null
+++ b/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStore.java
@@ -0,0 +1,61 @@
+/*
+ * 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.dflt;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
+import org.apache.isis.core.runtime.userprofile.UserProfile;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+
+public class InMemoryUserProfileStore implements UserProfileStore, DebuggableWithTitle {
+
+ private static final Map<String, UserProfile> profiles = new HashMap<String, UserProfile>();
+
+ @Override
+ public boolean isFixturesInstalled() {
+ return false;
+ }
+
+ @Override
+ public UserProfile getUserProfile(final String name) {
+ return profiles.get(name);
+ }
+
+ @Override
+ public void save(final String name, final UserProfile userProfile) {
+ profiles.put(name, userProfile);
+ }
+
+ @Override
+ public void debugData(final DebugBuilder debug) {
+ for (final String name : profiles.keySet()) {
+ debug.appendln(name, profiles.get(name));
+ }
+ }
+
+ @Override
+ public String debugTitle() {
+ return "InMemoryUserProfileStore";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStoreInstaller.java
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStoreInstaller.java b/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStoreInstaller.java
new file mode 100644
index 0000000..12b4d15
--- /dev/null
+++ b/framework/core/profilestore-inmemory/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/InMemoryUserProfileStoreInstaller.java
@@ -0,0 +1,44 @@
+/*
+ * 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.dflt;
+
+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 InMemoryUserProfileStoreInstaller extends InstallerAbstract implements UserProfileStoreInstaller {
+
+ public InMemoryUserProfileStoreInstaller() {
+ super(UserProfileStoreInstaller.TYPE, "in-memory");
+ }
+
+ @Override
+ public UserProfileStore createUserProfileStore(final IsisConfiguration objectConfiguration) {
+ return new InMemoryUserProfileStore();
+ }
+
+ @Override
+ public List<Class<?>> getTypes() {
+ return listOf(UserProfileStore.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/profilestore-inmemory/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/src/site/apt/index.apt b/framework/core/profilestore-inmemory/src/site/apt/index.apt
new file mode 100644
index 0000000..816fe8c
--- /dev/null
+++ b/framework/core/profilestore-inmemory/src/site/apt/index.apt
@@ -0,0 +1,38 @@
+~~ 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.
+
+
+
+Default Profile Store (In-Memory)
+
+ The <dflt> (default) profile store module provides an in-memory
+ (non-persistent) store for user profiles.
+
+ For persistent user profiles, you will typically need to configure
+ one of the alternative implementations.
+
+
+Alternatives
+
+ Alternatives include:
+
+ * the {{{../xml/index.html}XML}} profile store
+
+ * the {{{../sql/index.html}SQL}} (jdbc) profile store (incomplete)
+
+ []
+
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/profilestore-inmemory/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/src/site/apt/jottings.apt b/framework/core/profilestore-inmemory/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/core/profilestore-inmemory/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/dbb64345/framework/core/profilestore-inmemory/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/core/profilestore-inmemory/src/site/site.xml b/framework/core/profilestore-inmemory/src/site/site.xml
new file mode 100644
index 0000000..05017e1
--- /dev/null
+++ b/framework/core/profilestore-inmemory/src/site/site.xml
@@ -0,0 +1,40 @@
+<?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="Default" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="Default 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="Maven Reports" ref="reports"/>
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/runtime/NOTICE b/framework/core/runtime/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/core/runtime/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/dbb64345/framework/core/runtime/example/org/apache/isis/nof/core/util/ShowDebugFrame.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/example/org/apache/isis/nof/core/util/ShowDebugFrame.java b/framework/core/runtime/example/org/apache/isis/nof/core/util/ShowDebugFrame.java
new file mode 100644
index 0000000..79ae8bf
--- /dev/null
+++ b/framework/core/runtime/example/org/apache/isis/nof/core/util/ShowDebugFrame.java
@@ -0,0 +1,67 @@
+/*
+ * 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.nof.core.util;
+
+import org.apache.isis.noa.util.DebugInfo;
+import org.apache.isis.noa.util.DebugString;
+
+
+public class ShowDebugFrame {
+ public static void main(final String[] args) {
+ DebugFrame frame = new DebugFrame() {
+ DebugInfo info1 = new DebugInfo() {
+ public void debugData(final DebugString debug) {
+ debug.appendln("Debug data");
+ }
+
+ public String debugTitle() {
+ return "Debug title";
+ }
+ };
+
+ DebugInfo info2 = new DebugInfo() {
+ public void debugData(final DebugString debug) {
+ debug.appendln("Debug data 2");
+ }
+
+ public String debugTitle() {
+ return "Debug title 2";
+ }
+ };
+
+ DebugInfo info3 = new DebugInfo() {
+ public void debugData(final DebugString debug) {
+ debug.appendln("Debug data 3");
+ }
+
+ public String debugTitle() {
+ return "Debug 3";
+ }
+ };
+
+ protected DebugInfo[] getInfo() {
+ return new DebugInfo[] { info1, info2, info3 };
+ }
+ };
+
+ frame.show(10, 10);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/example/org/apache/isis/nof/core/util/ThrowExceptions.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/example/org/apache/isis/nof/core/util/ThrowExceptions.java b/framework/core/runtime/example/org/apache/isis/nof/core/util/ThrowExceptions.java
new file mode 100644
index 0000000..8ff0ad4
--- /dev/null
+++ b/framework/core/runtime/example/org/apache/isis/nof/core/util/ThrowExceptions.java
@@ -0,0 +1,75 @@
+/*
+ * 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.nof.core.util;
+
+import org.apache.isis.noa.ObjectAdapterRuntimeException;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+
+public class ThrowExceptions {
+ private static final Logger LOG = Logger.getLogger(ThrowExceptions.class);
+
+ public static void main(final String[] args) {
+ method1();
+ }
+
+ private static void method1() {
+ method2();
+ }
+
+ private static void method2() {
+ method3();
+ }
+
+ private static void method3() {
+ BasicConfigurator.configure();
+
+ ObjectAdapterRuntimeException exception = new ObjectAdapterRuntimeException("exception message");
+
+ LOG.info("Testing logging", exception);
+ LOG.info("");
+ LOG.info("");
+ System.out.println();
+
+ try {
+ method4();
+ } catch (Exception e) {
+ ObjectAdapterRuntimeException exception2 = new ObjectAdapterRuntimeException("cascading exception message", e);
+
+ LOG.info("Testing logging 2", exception2);
+ LOG.info("");
+ LOG.info("");
+ System.out.println();
+
+ throw exception2;
+ }
+ }
+
+ private static void method4() {
+ method5();
+ }
+
+ private static void method5() {
+ throw new NullPointerException("system exception message");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/runtime/pom.xml b/framework/core/runtime/pom.xml
new file mode 100644
index 0000000..c5550ee
--- /dev/null
+++ b/framework/core/runtime/pom.xml
@@ -0,0 +1,127 @@
+<?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>core</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <name>Default Runtime Runtime</name>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>runtime/</relativeUrl>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>isis-version.properties</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </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</groupId>
+ <artifactId>applib</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-metamodel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-metamodel</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jmock</groupId>
+ <artifactId>jmock-legacy</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/Isis.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/Isis.java b/framework/core/runtime/src/main/java/org/apache/isis/Isis.java
new file mode 100644
index 0000000..830863d
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/Isis.java
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+public class Isis {
+
+ public static void main(final String[] args) {
+ org.apache.isis.runtimes.dflt.runtime.Isis.main(args);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/classsubstitutor/ClassSubstitutorIdentity.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/classsubstitutor/ClassSubstitutorIdentity.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/classsubstitutor/ClassSubstitutorIdentity.java
new file mode 100644
index 0000000..f19b0b8
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/classsubstitutor/ClassSubstitutorIdentity.java
@@ -0,0 +1,29 @@
+/*
+ * 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.bytecode.identity.classsubstitutor;
+
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutorAbstract;
+
+public class ClassSubstitutorIdentity extends ClassSubstitutorAbstract {
+
+ public ClassSubstitutorIdentity() {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/objectfactory/ObjectFactoryBasic.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/objectfactory/ObjectFactoryBasic.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/objectfactory/ObjectFactoryBasic.java
new file mode 100644
index 0000000..8bfe64f
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/bytecode/identity/objectfactory/ObjectFactoryBasic.java
@@ -0,0 +1,54 @@
+/*
+ * 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.bytecode.identity.objectfactory;
+
+import java.lang.reflect.Modifier;
+
+import org.apache.isis.core.metamodel.spec.ObjectInstantiationException;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectFactoryAbstract;
+
+public class ObjectFactoryBasic extends ObjectFactoryAbstract {
+
+ public ObjectFactoryBasic() {
+ }
+
+ public ObjectFactoryBasic(final Mode mode) {
+ super(mode);
+ }
+
+ /**
+ * Simply instantiates reflectively, does not enhance bytecode etc in any
+ * way.
+ */
+ @Override
+ protected <T> T doInstantiate(final Class<T> cls) throws ObjectInstantiationException {
+ if (Modifier.isAbstract(cls.getModifiers())) {
+ throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+ }
+ try {
+ return cls.newInstance();
+ } catch (final IllegalAccessException e) {
+ throw new ObjectInstantiationException(e);
+ } catch (final InstantiationException e) {
+ throw new ObjectInstantiationException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/Isis.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/Isis.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/Isis.java
new file mode 100644
index 0000000..5cbb3eb
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/Isis.java
@@ -0,0 +1,58 @@
+/*
+ * 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.runtime;
+
+import org.apache.isis.runtimes.dflt.runtime.runner.IsisRunner;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerDeploymentTypeIsis;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerPassword;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerUser;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionValidatorUserAndPasswordCombo;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class Isis {
+
+ static final String DEFAULT_EMBEDDED_WEBSERVER = SystemConstants.WEBSERVER_DEFAULT;
+
+ public static void main(final String[] args) {
+ new Isis().run(args);
+ }
+
+ private void run(final String[] args) {
+ final IsisRunner runner = new IsisRunner(args, new OptionHandlerDeploymentTypeIsis());
+
+ addOptionHandlersAndValidators(runner);
+
+ if (!runner.parseAndValidate()) {
+ return;
+ }
+ runner.bootstrap(new RuntimeBootstrapper());
+ }
+
+ private void addOptionHandlersAndValidators(final IsisRunner runner) {
+ final OptionHandlerUser optionHandlerUser = new OptionHandlerUser();
+ final OptionHandlerPassword optionHandlerPassword = new OptionHandlerPassword();
+
+ runner.addOptionHandler(optionHandlerUser);
+ runner.addOptionHandler(optionHandlerPassword);
+
+ runner.addValidator(new OptionValidatorUserAndPasswordCombo(optionHandlerUser, optionHandlerPassword));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/IsisInstallerRegistry.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/IsisInstallerRegistry.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/IsisInstallerRegistry.java
new file mode 100644
index 0000000..e3fa3a5
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/IsisInstallerRegistry.java
@@ -0,0 +1,33 @@
+package org.apache.isis.runtimes.dflt.runtime;
+
+import java.io.InputStream;
+
+/**
+ * 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.
+ */
+
+public final class IsisInstallerRegistry {
+
+ public final static String INSTALLER_REGISTRY_FILE = "installer-registry.properties";
+
+ private IsisInstallerRegistry() {
+ }
+
+ public static InputStream getPropertiesAsStream() {
+ return IsisInstallerRegistry.class.getResourceAsStream(IsisInstallerRegistry.INSTALLER_REGISTRY_FILE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/RuntimeBootstrapper.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/RuntimeBootstrapper.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/RuntimeBootstrapper.java
new file mode 100644
index 0000000..6c90bcb
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/RuntimeBootstrapper.java
@@ -0,0 +1,133 @@
+/*
+ * 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.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.inject.Injector;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+
+import org.apache.isis.core.commons.lang.Threads;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
+import org.apache.isis.runtimes.dflt.runtime.runner.IsisBootstrapper;
+import org.apache.isis.runtimes.dflt.runtime.runner.IsisModule.ViewerList;
+import org.apache.isis.runtimes.dflt.runtime.system.IsisSystem;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.viewer.IsisViewer;
+import org.apache.isis.runtimes.dflt.runtime.viewer.web.WebAppSpecification;
+import org.apache.isis.runtimes.dflt.runtime.web.EmbeddedWebServer;
+
+final class RuntimeBootstrapper implements IsisBootstrapper {
+
+ @Override
+ public void bootstrap(final Injector injector) {
+
+ bootstrapSystem(injector);
+ bootstrapViewers(injector);
+ }
+
+ private void bootstrapSystem(final Injector injector) {
+
+ // sufficient just to look it up
+ @SuppressWarnings("unused")
+ final IsisSystem system = injector.getInstance(IsisSystem.class);
+ }
+
+ private void bootstrapViewers(final Injector injector) {
+ final List<IsisViewer> viewers = lookupViewers(injector);
+
+ // split viewers into web viewers and non-web viewers
+ final List<IsisViewer> webViewers = findWebViewers(viewers);
+ final List<IsisViewer> nonWebViewers = findNonWebViewers(viewers, webViewers);
+
+ startNonWebViewers(nonWebViewers);
+ startWebViewers(injector, webViewers);
+ }
+
+ private List<IsisViewer> lookupViewers(final Injector injector) {
+ final List<IsisViewer> viewers = injector.getInstance(ViewerList.class).getViewers();
+
+ // looking up viewers may have merged in some further config files,
+ // so update the NOContext global
+ // REVIEW: would rather inject this
+ final InstallerLookup installerLookup = injector.getInstance(InstallerLookup.class);
+ IsisContext.setConfiguration(installerLookup.getConfiguration());
+
+ return viewers;
+ }
+
+ private List<IsisViewer> findWebViewers(final List<IsisViewer> viewers) {
+ final List<IsisViewer> webViewers = new ArrayList<IsisViewer>(viewers);
+ CollectionUtils.filter(webViewers, new Predicate() {
+ @Override
+ public boolean evaluate(final Object object) {
+ final IsisViewer viewer = (IsisViewer) object;
+ return viewer.getWebAppSpecification() != null;
+ }
+ });
+ return webViewers;
+ }
+
+ private List<IsisViewer> findNonWebViewers(final List<IsisViewer> viewers, final List<IsisViewer> webViewers) {
+ final List<IsisViewer> nonWebViewers = new ArrayList<IsisViewer>(viewers);
+ nonWebViewers.removeAll(webViewers);
+ return nonWebViewers;
+ }
+
+ /**
+ * Starts each (non web) {@link IsisViewer viewer} in its own thread.
+ */
+ private void startNonWebViewers(final List<IsisViewer> viewers) {
+ for (final IsisViewer viewer : viewers) {
+ final Runnable target = new Runnable() {
+ @Override
+ public void run() {
+ viewer.init();
+ }
+ };
+ Threads.startThread(target, "Viewer");
+ }
+ }
+
+ /**
+ * Starts all the web {@link IsisViewer viewer}s in an instance of an
+ * {@link EmbeddedWebServer}.
+ */
+ private void startWebViewers(final Injector injector, final List<IsisViewer> webViewers) {
+ if (webViewers.size() == 0) {
+ return;
+ }
+
+ final InstallerLookup installerLookup = injector.getInstance(InstallerLookup.class);
+
+ // TODO: we could potentially offer pluggability here
+ final EmbeddedWebServerInstaller webServerInstaller = installerLookup.embeddedWebServerInstaller(Isis.DEFAULT_EMBEDDED_WEBSERVER);
+ final EmbeddedWebServer embeddedWebServer = webServerInstaller.createEmbeddedWebServer();
+ for (final IsisViewer viewer : webViewers) {
+ final WebAppSpecification webContainerRequirements = viewer.getWebAppSpecification();
+ embeddedWebServer.addWebAppSpecification(webContainerRequirements);
+ }
+ embeddedWebServer.init();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardForDfltRuntime.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardForDfltRuntime.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardForDfltRuntime.java
new file mode 100644
index 0000000..3ed1f54
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardForDfltRuntime.java
@@ -0,0 +1,78 @@
+/*
+ * 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.runtime.authentication;
+
+import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.runtimes.dflt.runtime.authentication.exploration.ExplorationAuthenticator;
+import org.apache.isis.runtimes.dflt.runtime.authentication.exploration.ExplorationSession;
+import org.apache.isis.runtimes.dflt.runtime.authentication.fixture.LogonFixtureAuthenticator;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+
+/**
+ * A refinement of the {@link AuthenticationManagerStandard}, which adds support
+ * to make it easier without the palava of logging in when running in either
+ * {@link DeploymentType#EXPLORATION exploration} mode or in
+ * {@link DeploymentType#PROTOTYPE prototype} mode.
+ *
+ * <p>
+ * Specifically:
+ * <ul>
+ * <li>the {@link ExplorationAuthenticator} will always provide a special
+ * {@link ExplorationSession} if running in the {@link DeploymentType} of
+ * {@link DeploymentType#EXPLORATION exploration}.
+ * <li>the {@link LogonFixtureAuthenticator} will set up a session using the
+ * login provided by a {@link LogonFixture}, provided that the
+ * {@link DeploymentType} is {@link DeploymentType#EXPLORATION exploration} or
+ * {@link DeploymentType#PROTOTYPE prototyping}
+ * </ul>
+ */
+public class AuthenticationManagerStandardForDfltRuntime extends AuthenticationManagerStandard {
+
+ public AuthenticationManagerStandardForDfltRuntime(final IsisConfiguration configuration) {
+ super(configuration);
+ }
+
+ // //////////////////////////////////////////////////////////
+ // init
+ // //////////////////////////////////////////////////////////
+
+ @Override
+ protected void addDefaultAuthenticators() {
+ // we add to start to ensure that these special case authenticators
+ // are always consulted first
+ addAuthenticatorToStart(new ExplorationAuthenticator(getConfiguration()));
+ addAuthenticatorToStart(new LogonFixtureAuthenticator(getConfiguration()));
+ }
+
+ // //////////////////////////////////////////////////////////
+ // Session Management (including authenticate)
+ // //////////////////////////////////////////////////////////
+
+ @Override
+ public void closeSession(final AuthenticationSession session) {
+ super.closeSession(session);
+ IsisContext.closeSession();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardInstallerAbstractForDfltRuntime.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardInstallerAbstractForDfltRuntime.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardInstallerAbstractForDfltRuntime.java
new file mode 100644
index 0000000..a49c9f1
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticationManagerStandardInstallerAbstractForDfltRuntime.java
@@ -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.
+ */
+
+package org.apache.isis.runtimes.dflt.runtime.authentication;
+
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandardInstallerAbstract;
+
+public abstract class AuthenticationManagerStandardInstallerAbstractForDfltRuntime extends AuthenticationManagerStandardInstallerAbstract {
+
+ public AuthenticationManagerStandardInstallerAbstractForDfltRuntime(final String name) {
+ super(name);
+ }
+
+ @Override
+ protected AuthenticationManagerStandard createAuthenticationManagerStandard() {
+ return new AuthenticationManagerStandardForDfltRuntime(getConfiguration());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticatorAbstractForDfltRuntime.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticatorAbstractForDfltRuntime.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticatorAbstractForDfltRuntime.java
new file mode 100644
index 0000000..2696b51
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/AuthenticatorAbstractForDfltRuntime.java
@@ -0,0 +1,49 @@
+/*
+ * 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.runtime.authentication;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticatorAbstract;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public abstract class AuthenticatorAbstractForDfltRuntime extends AuthenticatorAbstract {
+
+ public AuthenticatorAbstractForDfltRuntime(final IsisConfiguration configuration) {
+ super(configuration);
+ }
+
+ // //////////////////////////////////////////////////////
+ // Helpers
+ // //////////////////////////////////////////////////////
+
+ /**
+ * Helper method for convenience of implementations that depend on the
+ * {@link DeploymentType}.
+ */
+ public DeploymentType getDeploymentType() {
+ final String deploymentTypeStr = getConfiguration().getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+ if (deploymentTypeStr == null) {
+ throw new IllegalStateException("Expect value for '" + SystemConstants.DEPLOYMENT_TYPE_KEY + "' to be bound into IsisConfiguration");
+ }
+ return DeploymentType.lookup(deploymentTypeStr);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/AuthenticationRequestExploration.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/AuthenticationRequestExploration.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/AuthenticationRequestExploration.java
new file mode 100644
index 0000000..7578b95
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/AuthenticationRequestExploration.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.runtime.authentication.exploration;
+
+import java.util.List;
+
+import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestAbstract;
+
+/**
+ * For testing purposes, requests corresponding to an {@link ExplorationSession}
+ * .
+ */
+public class AuthenticationRequestExploration extends AuthenticationRequestAbstract {
+
+ private static final String EXPLORATION_USER = "exploration";
+
+ private final LogonFixture logonFixture;
+
+ public AuthenticationRequestExploration() {
+ this(null);
+ }
+
+ public AuthenticationRequestExploration(final LogonFixture logonFixture) {
+ super(logonFixture != null ? logonFixture.getUsername() : EXPLORATION_USER);
+ this.logonFixture = logonFixture;
+ }
+
+ @Override
+ public List<String> getRoles() {
+ return logonFixture != null ? logonFixture.getRoles() : super.getRoles();
+ }
+
+ public boolean isDefaultUser() {
+ return EXPLORATION_USER.equals(getName());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticator.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticator.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticator.java
new file mode 100644
index 0000000..95c48d5
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticator.java
@@ -0,0 +1,138 @@
+/*
+ * 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.runtime.authentication.exploration;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.runtimes.dflt.runtime.authentication.AuthenticatorAbstractForDfltRuntime;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+/**
+ * Creates a session suitable for {@link DeploymentType#EXPLORATION exploration}
+ * mode.
+ *
+ * <p>
+ * If the {@link IsisConfiguration} contains the key
+ * {@value ExplorationAuthenticatorConstants#USERS} then returns a
+ * {@link MultiUserExplorationSession} which encapsulates the details of several
+ * users (and their roles). Viewers that are aware of this capability can offer
+ * the convenient ability to switch between these users. For viewers that are
+ * not aware, the {@link MultiUserExplorationSession} appears as a regular
+ * {@link SimpleSession session}, with the Id of the first user listed.
+ *
+ * <p>
+ * The format of the {@value ExplorationAuthenticatorConstants#USERS} key should
+ * be:
+ *
+ * <pre>
+ * &lt:userName> [:<role>[|<role>]...], <userName>...
+ * </pre>
+ */
+public class ExplorationAuthenticator extends AuthenticatorAbstractForDfltRuntime {
+
+ private final Set<SimpleSession> registeredSessions = new LinkedHashSet<SimpleSession>();;
+ private final String users;
+
+ // //////////////////////////////////////////////////////////////////
+ // Constructor
+ // //////////////////////////////////////////////////////////////////
+
+ public ExplorationAuthenticator(final IsisConfiguration configuration) {
+ super(configuration);
+ users = getConfiguration().getString(ExplorationAuthenticatorConstants.USERS);
+ if (users != null) {
+ registeredSessions.addAll(parseUsers(users));
+ }
+ }
+
+ private List<SimpleSession> parseUsers(final String users) {
+ final List<SimpleSession> registeredUsers = new ArrayList<SimpleSession>();
+
+ final StringTokenizer st = new StringTokenizer(users, ",");
+ while (st.hasMoreTokens()) {
+ final String token = st.nextToken();
+ final int end = token.indexOf(':');
+ final List<String> roles = new ArrayList<String>();
+ final String userName;
+ if (end == -1) {
+ userName = token.trim();
+ } else {
+ userName = token.substring(0, end).trim();
+ final String roleList = token.substring(end + 1);
+ final StringTokenizer st2 = new StringTokenizer(roleList, "|");
+ while (st2.hasMoreTokens()) {
+ final String role = st2.nextToken().trim();
+ roles.add(role);
+ }
+ }
+ registeredUsers.add(createSimpleSession(userName, roles));
+ }
+ return registeredUsers;
+ }
+
+ private SimpleSession createSimpleSession(final String userName, final List<String> roles) {
+ return new SimpleSession(userName, roles.toArray(new String[roles.size()]));
+ }
+
+ // //////////////////////////////////////////////////////////////////
+ // API
+ // //////////////////////////////////////////////////////////////////
+
+ /**
+ * Can authenticate if a {@link AuthenticationRequestExploration}.
+ */
+ @Override
+ public final boolean canAuthenticate(final Class<? extends AuthenticationRequest> authenticationRequestClass) {
+ return AuthenticationRequestExploration.class.isAssignableFrom(authenticationRequestClass);
+ }
+
+ /**
+ * Valid providing running in {@link DeploymentType#isExploring()
+ * exploration} mode.
+ */
+ @Override
+ public final boolean isValid(final AuthenticationRequest request) {
+ return getDeploymentType().isExploring();
+ }
+
+ @Override
+ public AuthenticationSession authenticate(final AuthenticationRequest request, final String code) {
+ final AuthenticationRequestExploration authenticationRequestExploration = (AuthenticationRequestExploration) request;
+ if (!authenticationRequestExploration.isDefaultUser()) {
+ registeredSessions.add(createSimpleSession(authenticationRequestExploration.getName(), authenticationRequestExploration.getRoles()));
+ }
+ if (registeredSessions.size() > 1) {
+ return new MultiUserExplorationSession(registeredSessions, code);
+ } else if (registeredSessions.size() == 1) {
+ return registeredSessions.iterator().next();
+ } else {
+ return new ExplorationSession(code);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticatorConstants.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticatorConstants.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticatorConstants.java
new file mode 100644
index 0000000..59e8dd7
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationAuthenticatorConstants.java
@@ -0,0 +1,31 @@
+/*
+ * 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.runtime.authentication.exploration;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+
+public final class ExplorationAuthenticatorConstants {
+
+ public static final String USERS = ConfigurationConstants.ROOT + "exploration.users";
+
+ private ExplorationAuthenticatorConstants() {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationSession.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationSession.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationSession.java
new file mode 100644
index 0000000..f6a4734
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/ExplorationSession.java
@@ -0,0 +1,61 @@
+/*
+ * 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.runtime.authentication.exploration;
+
+import java.io.IOException;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSessionAbstract;
+import org.apache.isis.core.commons.encoding.DataInputExtended;
+import org.apache.isis.core.commons.encoding.DataOutputExtended;
+import org.apache.isis.core.commons.encoding.Encodable;
+
+public final class ExplorationSession extends AuthenticationSessionAbstract implements Encodable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String DEFAULT_USER_NAME = "exploration";
+
+ /**
+ * Defaults validation code to <tt>""</tt>.
+ */
+ public ExplorationSession() {
+ this("");
+ }
+
+ public ExplorationSession(final String code) {
+ super(DEFAULT_USER_NAME, code);
+ initialized();
+ }
+
+ public ExplorationSession(final DataInputExtended input) throws IOException {
+ super(input);
+ initialized();
+ }
+
+ @Override
+ public void encode(final DataOutputExtended output) throws IOException {
+ super.encode(output);
+ }
+
+ private void initialized() {
+ // nothing to do
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/MultiUserExplorationSession.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/MultiUserExplorationSession.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/MultiUserExplorationSession.java
new file mode 100644
index 0000000..9f5336d
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/exploration/MultiUserExplorationSession.java
@@ -0,0 +1,126 @@
+/*
+ * 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.runtime.authentication.exploration;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSessionAbstract;
+import org.apache.isis.core.commons.encoding.DataInputExtended;
+import org.apache.isis.core.commons.encoding.DataOutputExtended;
+import org.apache.isis.core.commons.encoding.Encodable;
+import org.apache.isis.core.commons.lang.ToString;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+
+public final class MultiUserExplorationSession extends AuthenticationSessionAbstract implements Encodable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final Set<SimpleSession> sessions = new LinkedHashSet<SimpleSession>();;
+ private SimpleSession selectedSession;
+
+ // ////////////////////////////////////////////////////
+ // Constructors
+ // ////////////////////////////////////////////////////
+
+ public MultiUserExplorationSession(final Set<SimpleSession> sessions, final String code) {
+ super("unused", code);
+ this.sessions.addAll(sessions);
+ initialized();
+ }
+
+ public MultiUserExplorationSession(final DataInputExtended input) throws IOException {
+ super(input);
+ sessions.addAll(Arrays.asList(input.readEncodables(SimpleSession.class)));
+ selectedSession = input.readEncodable(SimpleSession.class);
+ initialized();
+ }
+
+ @Override
+ public void encode(final DataOutputExtended output) throws IOException {
+ super.encode(output);
+ output.writeEncodables(sessions.toArray());
+ output.writeEncodable(selectedSession);
+ }
+
+ private void initialized() {
+ if (selectedSession == null && sessions.size() > 0) {
+ selectedSession = sessions.iterator().next();
+ }
+ }
+
+ // ////////////////////////////////////////////////////
+ // Overriding API
+ // ////////////////////////////////////////////////////
+
+ @Override
+ public String getUserName() {
+ return selectedSession.getUserName();
+ }
+
+ @Override
+ public boolean hasUserNameOf(final String userName) {
+ for (final SimpleSession session : sessions) {
+ if (session.hasUserNameOf(userName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public List<String> getRoles() {
+ return selectedSession.getRoles();
+ }
+
+ // ////////////////////////////////////////////////////
+ // not API
+ // ////////////////////////////////////////////////////
+
+ public void setCurrentSession(final String name) {
+ for (final SimpleSession user : this.sessions) {
+ if (user.getUserName().equals(name)) {
+ selectedSession = user;
+ break;
+ }
+ }
+ }
+
+ public Set<String> getUserNames() {
+ final Set<String> users = new LinkedHashSet<String>();
+ for (final SimpleSession user : sessions) {
+ users.add(user.getUserName());
+ }
+ return users;
+ }
+
+ // ////////////////////////////////////////////////////
+ // toString
+ // ////////////////////////////////////////////////////
+
+ @Override
+ public String toString() {
+ return new ToString(this).append("name", getUserNames()).append("userCount", sessions.size()).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/fixture/LogonFixtureAuthenticator.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/fixture/LogonFixtureAuthenticator.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/fixture/LogonFixtureAuthenticator.java
new file mode 100644
index 0000000..662260a
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/fixture/LogonFixtureAuthenticator.java
@@ -0,0 +1,52 @@
+/*
+ * 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.runtime.authentication.fixture;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.runtimes.dflt.runtime.authentication.AuthenticatorAbstractForDfltRuntime;
+import org.apache.isis.runtimes.dflt.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+public class LogonFixtureAuthenticator extends AuthenticatorAbstractForDfltRuntime {
+
+ public LogonFixtureAuthenticator(final IsisConfiguration configuration) {
+ super(configuration);
+ }
+
+ /**
+ * Can authenticate if a {@link AuthenticationRequestLogonFixture}.
+ */
+ @Override
+ public final boolean canAuthenticate(final Class<? extends AuthenticationRequest> authenticationRequestClass) {
+ return AuthenticationRequestLogonFixture.class.isAssignableFrom(authenticationRequestClass);
+ }
+
+ /**
+ * Valid providing running in {@link DeploymentType#isExploring()
+ * exploration} or {@link DeploymentType#isPrototyping() prototyping} mode.
+ */
+ @Override
+ public final boolean isValid(final AuthenticationRequest request) {
+ final DeploymentType deploymentType = getDeploymentType();
+ return deploymentType.isExploring() || deploymentType.isPrototyping();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/AuthenticationRequestSingleUser.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/AuthenticationRequestSingleUser.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/AuthenticationRequestSingleUser.java
new file mode 100644
index 0000000..a00b97b
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/AuthenticationRequestSingleUser.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.runtime.authentication.singleuser;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestAbstract;
+
+/**
+ * Requests corresponding to an {@link SingleUserSession}.
+ */
+public class AuthenticationRequestSingleUser extends AuthenticationRequestAbstract {
+
+ private static final String SINGLE_USER_NAME = "self";
+ private static final String SINGLE_USER_ROlE_NAME = "default_role";
+ private final List<String> roles;
+
+ public AuthenticationRequestSingleUser() {
+ super(SINGLE_USER_NAME);
+ roles = Collections.unmodifiableList(Arrays.asList(SINGLE_USER_ROlE_NAME));
+ }
+
+ @Override
+ public List<String> getRoles() {
+ return roles;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/SingleUserSession.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/SingleUserSession.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/SingleUserSession.java
new file mode 100644
index 0000000..aea98ed
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/authentication/singleuser/SingleUserSession.java
@@ -0,0 +1,61 @@
+/*
+ * 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.runtime.authentication.singleuser;
+
+import java.io.IOException;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSessionAbstract;
+import org.apache.isis.core.commons.encoding.DataInputExtended;
+import org.apache.isis.core.commons.encoding.DataOutputExtended;
+import org.apache.isis.core.commons.encoding.Encodable;
+
+public final class SingleUserSession extends AuthenticationSessionAbstract implements Encodable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String DEFAULT_USER_NAME = "exploration";
+
+ /**
+ * Defaults validation code to <tt>""</tt>.
+ */
+ public SingleUserSession() {
+ this("");
+ }
+
+ public SingleUserSession(final String code) {
+ super(DEFAULT_USER_NAME, code);
+ initialized();
+ }
+
+ public SingleUserSession(final DataInputExtended input) throws IOException {
+ super(input);
+ initialized();
+ }
+
+ @Override
+ public void encode(final DataOutputExtended output) throws IOException {
+ super.encode(output);
+ }
+
+ private void initialized() {
+ // nothing to do
+ }
+
+}