incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098935 [12/20] - in /incubator/isis/trunk/runtimes/dflt: bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/ bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/ byte...
Date Tue, 03 May 2011 06:22:23 GMT
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryAbstract.java Tue May  3 06:22:09 2011
@@ -17,16 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.session;
 
-package org.apache.isis.runtimes.dflt.runtime.system.session;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-
-import java.util.List;
-
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import java.util.List;
+
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -41,144 +40,149 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
-
-
-/**
- * Creates an implementation of {@link IsisSessionFactory#openSession(AuthenticationSession)} to create
- * an {@link IsisSession}, but delegates to subclasses to actually obtain the components that make up
- * that {@link IsisSession}.
- * 
- * <p>
- * The idea is that one subclass can use the {@link InstallerLookup} design to lookup installers for
- * components (and hence create the components themselves), whereas another subclass might simply use Spring
- * (or another DI container) to inject in the components according to some Spring-configured application
- * context.
- */
-public abstract class IsisSessionFactoryAbstract implements IsisSessionFactory {
-
-    private final DeploymentType deploymentType;
-    private final IsisConfiguration configuration;
-    private final TemplateImageLoader templateImageLoader;
-    private final SpecificationLoader specificationLoader;
-    private final AuthenticationManager authenticationManager;
-    private final AuthorizationManager authorizationManager;
-    private final PersistenceSessionFactory persistenceSessionFactory;
-    private final UserProfileLoader userProfileLoader;
-	private final List<Object> serviceList;
-
-    public IsisSessionFactoryAbstract(
-            final DeploymentType deploymentType,
-            final IsisConfiguration configuration,
-            final SpecificationLoader specificationLoader,
-            final TemplateImageLoader templateImageLoader,
-            final AuthenticationManager authenticationManager,
-            final AuthorizationManager authorizationManager, 
-            final UserProfileLoader userProfileLoader, 
-            final PersistenceSessionFactory persistenceSessionFactory, 
-            final List<Object> serviceList) {
-
-        ensureThatArg(deploymentType, is(not(nullValue())));
-        ensureThatArg(configuration, is(not(nullValue())));
-        ensureThatArg(specificationLoader, is(not(nullValue())));
-        ensureThatArg(templateImageLoader, is(not(nullValue())));
-        ensureThatArg(authenticationManager, is(not(nullValue())));
-        ensureThatArg(authorizationManager, is(not(nullValue())));
-        ensureThatArg(userProfileLoader, is(not(nullValue())));
-        ensureThatArg(persistenceSessionFactory, is(not(nullValue())));
-        ensureThatArg(serviceList, is(not(nullValue())));
-
-        this.deploymentType = deploymentType;
-        this.configuration = configuration;
-        this.templateImageLoader = templateImageLoader;
-        this.specificationLoader = specificationLoader;
-        this.authenticationManager = authenticationManager;
-        this.authorizationManager = authorizationManager;
-        this.userProfileLoader = userProfileLoader;
-        this.persistenceSessionFactory = persistenceSessionFactory;
-        this.serviceList = serviceList;
-    }
-
-    // ///////////////////////////////////////////
-    // init, shutdown
-    // ///////////////////////////////////////////
-
-    /**
-     * Wires components as necessary, and then {@link ApplicationScopedComponent#init() init}ializes all.
-     */
-    public void init() {
-        templateImageLoader.init();
-        
-        specificationLoader.setServiceClasses(JavaClassUtils.toClasses(serviceList));
-        
-        specificationLoader.init();
-
-        // must come after init of spec loader.
-        specificationLoader.injectInto(persistenceSessionFactory);
-        persistenceSessionFactory.setServices(serviceList);
-        userProfileLoader.setServices(serviceList);
-
-        authenticationManager.init();
-        authorizationManager.init();
-        persistenceSessionFactory.init();
-    }
-
-    public void shutdown() {
-        persistenceSessionFactory.shutdown();
-        authenticationManager.shutdown();
-        specificationLoader.shutdown();
-        templateImageLoader.shutdown();
-        userProfileLoader.shutdown();
-    }
-
-    public IsisSession openSession(final AuthenticationSession authenticationSession) {
-        PersistenceSession persistenceSession = persistenceSessionFactory.createPersistenceSession();
-        ensureThatArg(persistenceSession, is(not(nullValue())));
-        
-        UserProfile userProfile = userProfileLoader.getProfile(authenticationSession);
-        ensureThatArg(userProfile, is(not(nullValue())));
-        
-        // inject into persistenceSession any/all application-scoped components that it requires
-        getSpecificationLoader().injectInto(persistenceSession);
-
-        IsisSessionDefault isisSessionDefault = new IsisSessionDefault(this, authenticationSession, persistenceSession, userProfile);
-        
-        return isisSessionDefault;
-    }
-
-    public IsisConfiguration getConfiguration() {
-        return configuration;
-    }
-
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-
-    public SpecificationLoader getSpecificationLoader() {
-        return specificationLoader;
-    }
-
-    public TemplateImageLoader getTemplateImageLoader() {
-        return templateImageLoader;
-    }
-
-    public AuthenticationManager getAuthenticationManager() {
-        return authenticationManager;
-    }
-
-    public AuthorizationManager getAuthorizationManager() {
-        return authorizationManager;
-    }
-
-    public PersistenceSessionFactory getPersistenceSessionFactory() {
-        return persistenceSessionFactory;
-    }
-
-    public UserProfileLoader getUserProfileLoader() {
-        return userProfileLoader;
-    }
-    
-    public List<Object> getServices() {
-    	return serviceList;
-    }
-}
-
+
+/**
+ * Creates an implementation of {@link IsisSessionFactory#openSession(AuthenticationSession)} to create an
+ * {@link IsisSession}, but delegates to subclasses to actually obtain the components that make up that
+ * {@link IsisSession}.
+ * 
+ * <p>
+ * The idea is that one subclass can use the {@link InstallerLookup} design to lookup installers for components (and
+ * hence create the components themselves), whereas another subclass might simply use Spring (or another DI container)
+ * to inject in the components according to some Spring-configured application context.
+ */
+public abstract class IsisSessionFactoryAbstract implements IsisSessionFactory {
+
+    private final DeploymentType deploymentType;
+    private final IsisConfiguration configuration;
+    private final TemplateImageLoader templateImageLoader;
+    private final SpecificationLoader specificationLoader;
+    private final AuthenticationManager authenticationManager;
+    private final AuthorizationManager authorizationManager;
+    private final PersistenceSessionFactory persistenceSessionFactory;
+    private final UserProfileLoader userProfileLoader;
+    private final List<Object> serviceList;
+
+    public IsisSessionFactoryAbstract(final DeploymentType deploymentType, final IsisConfiguration configuration,
+        final SpecificationLoader specificationLoader, final TemplateImageLoader templateImageLoader,
+        final AuthenticationManager authenticationManager, final AuthorizationManager authorizationManager,
+        final UserProfileLoader userProfileLoader, final PersistenceSessionFactory persistenceSessionFactory,
+        final List<Object> serviceList) {
+
+        ensureThatArg(deploymentType, is(not(nullValue())));
+        ensureThatArg(configuration, is(not(nullValue())));
+        ensureThatArg(specificationLoader, is(not(nullValue())));
+        ensureThatArg(templateImageLoader, is(not(nullValue())));
+        ensureThatArg(authenticationManager, is(not(nullValue())));
+        ensureThatArg(authorizationManager, is(not(nullValue())));
+        ensureThatArg(userProfileLoader, is(not(nullValue())));
+        ensureThatArg(persistenceSessionFactory, is(not(nullValue())));
+        ensureThatArg(serviceList, is(not(nullValue())));
+
+        this.deploymentType = deploymentType;
+        this.configuration = configuration;
+        this.templateImageLoader = templateImageLoader;
+        this.specificationLoader = specificationLoader;
+        this.authenticationManager = authenticationManager;
+        this.authorizationManager = authorizationManager;
+        this.userProfileLoader = userProfileLoader;
+        this.persistenceSessionFactory = persistenceSessionFactory;
+        this.serviceList = serviceList;
+    }
+
+    // ///////////////////////////////////////////
+    // init, shutdown
+    // ///////////////////////////////////////////
+
+    /**
+     * Wires components as necessary, and then {@link ApplicationScopedComponent#init() init}ializes all.
+     */
+    @Override
+    public void init() {
+        templateImageLoader.init();
+
+        specificationLoader.setServiceClasses(JavaClassUtils.toClasses(serviceList));
+
+        specificationLoader.init();
+
+        // must come after init of spec loader.
+        specificationLoader.injectInto(persistenceSessionFactory);
+        persistenceSessionFactory.setServices(serviceList);
+        userProfileLoader.setServices(serviceList);
+
+        authenticationManager.init();
+        authorizationManager.init();
+        persistenceSessionFactory.init();
+    }
+
+    @Override
+    public void shutdown() {
+        persistenceSessionFactory.shutdown();
+        authenticationManager.shutdown();
+        specificationLoader.shutdown();
+        templateImageLoader.shutdown();
+        userProfileLoader.shutdown();
+    }
+
+    @Override
+    public IsisSession openSession(final AuthenticationSession authenticationSession) {
+        final PersistenceSession persistenceSession = persistenceSessionFactory.createPersistenceSession();
+        ensureThatArg(persistenceSession, is(not(nullValue())));
+
+        final UserProfile userProfile = userProfileLoader.getProfile(authenticationSession);
+        ensureThatArg(userProfile, is(not(nullValue())));
+
+        // inject into persistenceSession any/all application-scoped components that it requires
+        getSpecificationLoader().injectInto(persistenceSession);
+
+        final IsisSessionDefault isisSessionDefault =
+            new IsisSessionDefault(this, authenticationSession, persistenceSession, userProfile);
+
+        return isisSessionDefault;
+    }
+
+    @Override
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+
+    @Override
+    public SpecificationLoader getSpecificationLoader() {
+        return specificationLoader;
+    }
+
+    @Override
+    public TemplateImageLoader getTemplateImageLoader() {
+        return templateImageLoader;
+    }
+
+    @Override
+    public AuthenticationManager getAuthenticationManager() {
+        return authenticationManager;
+    }
+
+    @Override
+    public AuthorizationManager getAuthorizationManager() {
+        return authorizationManager;
+    }
+
+    @Override
+    public PersistenceSessionFactory getPersistenceSessionFactory() {
+        return persistenceSessionFactory;
+    }
+
+    @Override
+    public UserProfileLoader getUserProfileLoader() {
+        return userProfileLoader;
+    }
+
+    @Override
+    public List<Object> getServices() {
+        return serviceList;
+    }
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryDefault.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryDefault.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/IsisSessionFactoryDefault.java Tue May  3 06:22:09 2011
@@ -17,11 +17,10 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.session;
+
+import java.util.List;
 
-package org.apache.isis.runtimes.dflt.runtime.system.session;
-
-import java.util.List;
-
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
@@ -30,26 +29,20 @@ import org.apache.isis.core.runtime.imag
 import org.apache.isis.core.runtime.userprofile.UserProfileLoader;
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
-
-/**
- * As its superclass, but provides a default for some of more basic components (that
- * is, where the core framework offers only a single implementation). 
- */
-public class IsisSessionFactoryDefault extends IsisSessionFactoryAbstract {
-
-    public IsisSessionFactoryDefault(
-            final DeploymentType deploymentType, 
-            final IsisConfiguration configuration, 
-            final TemplateImageLoader templateImageLoader, 
-            final SpecificationLoader specificationLoader, 
-            final AuthenticationManager authenticationManager, 
-            AuthorizationManager authorizationManager,
-            final UserProfileLoader userProfileLoader,
-            final PersistenceSessionFactory persistenceSessionFactory, final List<Object> servicesList) {
-        super(deploymentType, configuration, specificationLoader, templateImageLoader, authenticationManager, authorizationManager, userProfileLoader, persistenceSessionFactory, servicesList);
-    }
-
-
-}
-
-
+
+/**
+ * As its superclass, but provides a default for some of more basic components (that is, where the core framework offers
+ * only a single implementation).
+ */
+public class IsisSessionFactoryDefault extends IsisSessionFactoryAbstract {
+
+    public IsisSessionFactoryDefault(final DeploymentType deploymentType, final IsisConfiguration configuration,
+        final TemplateImageLoader templateImageLoader, final SpecificationLoader specificationLoader,
+        final AuthenticationManager authenticationManager, final AuthorizationManager authorizationManager,
+        final UserProfileLoader userProfileLoader, final PersistenceSessionFactory persistenceSessionFactory,
+        final List<Object> servicesList) {
+        super(deploymentType, configuration, specificationLoader, templateImageLoader, authenticationManager,
+            authorizationManager, userProfileLoader, persistenceSessionFactory, servicesList);
+    }
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/SessionFactoryException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/SessionFactoryException.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/SessionFactoryException.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/session/SessionFactoryException.java Tue May  3 06:22:09 2011
@@ -17,27 +17,25 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.session;
 
-package org.apache.isis.runtimes.dflt.runtime.system.session;
-
-public class SessionFactoryException extends Exception {
-
-    private static final long serialVersionUID = 1L;
-
-    public SessionFactoryException() {}
-
-    public SessionFactoryException(String message) {
-        super(message);
-    }
-
-    public SessionFactoryException(Throwable cause) {
-        super(cause);
-    }
-
-    public SessionFactoryException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}
-
-
+public class SessionFactoryException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    public SessionFactoryException() {
+    }
+
+    public SessionFactoryException(final String message) {
+        super(message);
+    }
+
+    public SessionFactoryException(final Throwable cause) {
+        super(cause);
+    }
+
+    public SessionFactoryException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransaction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransaction.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransaction.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransaction.java Tue May  3 06:22:09 2011
@@ -17,142 +17,133 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
-
 import org.apache.isis.core.commons.components.TransactionScopedComponent;
-
-
-/**
- * Used by the {@link IsisTransactionManager} to captures a set of changes to be applied.
- * 
- * <p>
- * The protocol by which the {@link IsisTransactionManager} interacts and uses the
- * {@link IsisTransaction} is not API, because different approaches are used. For the server-side
- * <tt>ObjectStoreTransactionManager</tt>, each object is wrapped in a command generated by the underlying
- * <tt>ObjectStore</tt>. for the client-side <tt>ClientSideTransactionManager</tt>, the transaction simply
- * holds a set of events.
- * 
- * <p>
- * Note that methods such as <tt>flush()</tt>, <tt>commit()</tt> and <tt>abort()</tt> are
- * not part of the API.  The place to control transactions is through the {@link IsisTransactionManager transaction manager},
- * because some implementations may support nesting and such like.  It is also the job of the
- * {@link IsisTransactionManager} to ensure that the underlying persistence
- * mechanism (for example, the <tt>ObjectAdapterStore</tt>) is also committed.
- */
-public interface IsisTransaction extends TransactionScopedComponent {
-
-    public static enum State {
-        /**
-         * Started, still in progress.
-         * 
-         * <p>
-         * May {@link IsisTransaction#flush() flush}, {@link IsisTransaction#commit() commit} 
-         * or {@link IsisTransaction#abort() abort}.
-         */
-        IN_PROGRESS(true, true, true, false),
-        /**
-         * Started, but has hit an exception.
-         * 
-         * <p>
-         * May not {@link IsisTransaction#flush()} or {@link IsisTransaction#commit() commit}
-         * (will throw an {@link IllegalStateException}), but can only {@link IsisTransaction#abort()
-         * abort}.
-         * 
-         * <p>
-         * Similar to <tt>setRollbackOnly</tt> in EJBs.
-         */
-        MUST_ABORT(false, false, true, false),
-        /**
-         * Completed, having successfully committed.
-         * 
-         * <p>
-         * May not {@link IsisTransaction#flush()} or {@link IsisTransaction#abort() abort} or
-         * {@link IsisTransaction#commit() commit} (will throw {@link IllegalStateException}).
-         */
-        COMMITTED(false, false, false, true),
-        /**
-         * Completed, having aborted.
-         * 
-         * <p>
-         * May not {@link IsisTransaction#flush()}, {@link IsisTransaction#commit() commit}
-         * or {@link IsisTransaction#abort() abort} (will throw {@link IllegalStateException}).
-         */
-        ABORTED(false, false, false, true);
-
-        private final boolean canFlush;
-        private final boolean canCommit;
-        private final boolean canAbort;
-        private final boolean isComplete;
-
-        private State(final boolean canFlush, final boolean canCommit, final boolean canAbort, final boolean isComplete) {
-            this.canFlush = canFlush;
-            this.canCommit = canCommit;
-            this.canAbort = canAbort;
-            this.isComplete = isComplete;
-        }
-
-        /**
-         * Whether it is valid to {@link IsisTransaction#flush() flush} this {@link IsisTransaction transaction}.
-         */
-        public boolean canFlush() {
-            return canFlush;
-        }
-
-        /**
-         * Whether it is valid to {@link IsisTransaction#commit() commit} this {@link IsisTransaction transaction}.
-         */
-        public boolean canCommit() {
-            return canCommit;
-        }
-
-        /**
-         * Whether it is valid to {@link IsisTransaction#abort() abort} this
-         * {@link IsisTransaction transaction}.
-         */
-        public boolean canAbort() {
-            return canAbort;
-        }
-
-        /**
-         * Whether the {@link IsisTransaction transaction} is complete (and
-         * so a new one can be started).
-         */
-        public boolean isComplete() {
-            return isComplete;
-        }
-
-    }
-
-    /**
-     * The state of this transaction.
-     */
-    State getState();
-
-    /**
-     * The underlying reason (if known) why the transaction was aborted.
-     * 
-     * <p>
-     * Will be set if an exception is thrown while {@link #flush() flush}ing, 
-     * {@link #commit() commit}ting or {@link #abort() abort}ing.
-     */
-    public RuntimeException getAbortCause();
-
-
-    /**
-     * The owning {@link IsisTransactionManager transaction manager}.
-     */
-    IsisTransactionManager getTransactionManager();
-
-    /**
-     * The {@link UpdateNotifier} for this transaction.
-     */
-    UpdateNotifier getUpdateNotifier();
-
-    /**
-     * The {@link MessageBroker} for this transaction.
-     */
-    MessageBroker getMessageBroker();
-
-
-}
+
+/**
+ * Used by the {@link IsisTransactionManager} to captures a set of changes to be applied.
+ * 
+ * <p>
+ * The protocol by which the {@link IsisTransactionManager} interacts and uses the {@link IsisTransaction} is not API,
+ * because different approaches are used. For the server-side <tt>ObjectStoreTransactionManager</tt>, each object is
+ * wrapped in a command generated by the underlying <tt>ObjectStore</tt>. for the client-side
+ * <tt>ClientSideTransactionManager</tt>, the transaction simply holds a set of events.
+ * 
+ * <p>
+ * Note that methods such as <tt>flush()</tt>, <tt>commit()</tt> and <tt>abort()</tt> are not part of the API. The place
+ * to control transactions is through the {@link IsisTransactionManager transaction manager}, because some
+ * implementations may support nesting and such like. It is also the job of the {@link IsisTransactionManager} to ensure
+ * that the underlying persistence mechanism (for example, the <tt>ObjectAdapterStore</tt>) is also committed.
+ */
+public interface IsisTransaction extends TransactionScopedComponent {
+
+    public static enum State {
+        /**
+         * Started, still in progress.
+         * 
+         * <p>
+         * May {@link IsisTransaction#flush() flush}, {@link IsisTransaction#commit() commit} or
+         * {@link IsisTransaction#abort() abort}.
+         */
+        IN_PROGRESS(true, true, true, false),
+        /**
+         * Started, but has hit an exception.
+         * 
+         * <p>
+         * May not {@link IsisTransaction#flush()} or {@link IsisTransaction#commit() commit} (will throw an
+         * {@link IllegalStateException}), but can only {@link IsisTransaction#abort() abort}.
+         * 
+         * <p>
+         * Similar to <tt>setRollbackOnly</tt> in EJBs.
+         */
+        MUST_ABORT(false, false, true, false),
+        /**
+         * Completed, having successfully committed.
+         * 
+         * <p>
+         * May not {@link IsisTransaction#flush()} or {@link IsisTransaction#abort() abort} or
+         * {@link IsisTransaction#commit() commit} (will throw {@link IllegalStateException}).
+         */
+        COMMITTED(false, false, false, true),
+        /**
+         * Completed, having aborted.
+         * 
+         * <p>
+         * May not {@link IsisTransaction#flush()}, {@link IsisTransaction#commit() commit} or
+         * {@link IsisTransaction#abort() abort} (will throw {@link IllegalStateException}).
+         */
+        ABORTED(false, false, false, true);
+
+        private final boolean canFlush;
+        private final boolean canCommit;
+        private final boolean canAbort;
+        private final boolean isComplete;
+
+        private State(final boolean canFlush, final boolean canCommit, final boolean canAbort, final boolean isComplete) {
+            this.canFlush = canFlush;
+            this.canCommit = canCommit;
+            this.canAbort = canAbort;
+            this.isComplete = isComplete;
+        }
+
+        /**
+         * Whether it is valid to {@link IsisTransaction#flush() flush} this {@link IsisTransaction transaction}.
+         */
+        public boolean canFlush() {
+            return canFlush;
+        }
+
+        /**
+         * Whether it is valid to {@link IsisTransaction#commit() commit} this {@link IsisTransaction transaction}.
+         */
+        public boolean canCommit() {
+            return canCommit;
+        }
+
+        /**
+         * Whether it is valid to {@link IsisTransaction#abort() abort} this {@link IsisTransaction transaction}.
+         */
+        public boolean canAbort() {
+            return canAbort;
+        }
+
+        /**
+         * Whether the {@link IsisTransaction transaction} is complete (and so a new one can be started).
+         */
+        public boolean isComplete() {
+            return isComplete;
+        }
+
+    }
+
+    /**
+     * The state of this transaction.
+     */
+    State getState();
+
+    /**
+     * The underlying reason (if known) why the transaction was aborted.
+     * 
+     * <p>
+     * Will be set if an exception is thrown while {@link #flush() flush}ing, {@link #commit() commit}ting or
+     * {@link #abort() abort}ing.
+     */
+    public RuntimeException getAbortCause();
+
+    /**
+     * The owning {@link IsisTransactionManager transaction manager}.
+     */
+    IsisTransactionManager getTransactionManager();
+
+    /**
+     * The {@link UpdateNotifier} for this transaction.
+     */
+    UpdateNotifier getUpdateNotifier();
+
+    /**
+     * The {@link MessageBroker} for this transaction.
+     */
+    MessageBroker getMessageBroker();
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManager.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManager.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManager.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManager.java Tue May  3 06:22:09 2011
@@ -17,90 +17,76 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
-
 import org.apache.isis.core.commons.components.Injectable;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSession;
-
-
-public interface IsisTransactionManager extends SessionScopedComponent, Injectable {
-
-
-    //////////////////////////////////////////////////////////////////////
-    // Session
-    //////////////////////////////////////////////////////////////////////
-
-    /**
-     * The owning {@link IsisSession}.
-     *
-     * <p>
-     * Will be non-<tt>null</tt> when {@link #open() open}ed, but <tt>null</tt> if {@link #close() close}d .
-     */
-    IsisSession getSession();
-
-
-    //////////////////////////////////////////////////////////////////////
-    // Transaction Management
-    //////////////////////////////////////////////////////////////////////
-
-    
-    void startTransaction();
-    
-    boolean flushTransaction();
-
-    void abortTransaction();
-
-    /**
-     * Ends the transaction if nesting level is 0. 
-     */
-    void endTransaction();
-
-
-    /**
-     * The current transaction, if any.
-     */
-    IsisTransaction getTransaction();
-
-
-
-    //////////////////////////////////////////////////////////////////////
-    // Transactional Execution
-    //////////////////////////////////////////////////////////////////////
-
-    /**
-     * Run the supplied {@link Runnable block of code (closure)} in a {@link IsisTransaction transaction}.
-     * 
-     * <p>
-     * If a transaction is {@link IsisContext#inTransaction() in progress}, then
-     * uses that.  Otherwise will {@link #startTransaction() start} a transaction before
-     * running the block and {@link #endTransaction() commit} it at the end.  If the
-     * closure throws an exception, then will {@link #abortTransaction() abort} the transaction. 
-     */
-    public void executeWithinTransaction(TransactionalClosure closure);
-
-
-    /**
-     * Run the supplied {@link Runnable block of code (closure)} in a {@link IsisTransaction transaction}.
-     * 
-     * <p>
-     * If a transaction is {@link IsisContext#inTransaction() in progress}, then
-     * uses that.  Otherwise will {@link #startTransaction() start} a transaction before
-     * running the block and {@link #endTransaction() commit} it at the end.  If the
-     * closure throws an exception, then will {@link #abortTransaction() abort} the transaction. 
-     */
-    public <T> T executeWithinTransaction(TransactionalClosureWithReturn<T> closure);
-
-    //////////////////////////////////////////////////////////////////////
-    // Debugging
-    //////////////////////////////////////////////////////////////////////
-
-    void debugData(DebugBuilder debug);
-
-
-
-}
-
+
+public interface IsisTransactionManager extends SessionScopedComponent, Injectable {
+
+    // ////////////////////////////////////////////////////////////////////
+    // Session
+    // ////////////////////////////////////////////////////////////////////
+
+    /**
+     * The owning {@link IsisSession}.
+     * 
+     * <p>
+     * Will be non-<tt>null</tt> when {@link #open() open}ed, but <tt>null</tt> if {@link #close() close}d .
+     */
+    IsisSession getSession();
+
+    // ////////////////////////////////////////////////////////////////////
+    // Transaction Management
+    // ////////////////////////////////////////////////////////////////////
+
+    void startTransaction();
+
+    boolean flushTransaction();
+
+    void abortTransaction();
+
+    /**
+     * Ends the transaction if nesting level is 0.
+     */
+    void endTransaction();
+
+    /**
+     * The current transaction, if any.
+     */
+    IsisTransaction getTransaction();
+
+    // ////////////////////////////////////////////////////////////////////
+    // Transactional Execution
+    // ////////////////////////////////////////////////////////////////////
+
+    /**
+     * Run the supplied {@link Runnable block of code (closure)} in a {@link IsisTransaction transaction}.
+     * 
+     * <p>
+     * If a transaction is {@link IsisContext#inTransaction() in progress}, then uses that. Otherwise will
+     * {@link #startTransaction() start} a transaction before running the block and {@link #endTransaction() commit} it
+     * at the end. If the closure throws an exception, then will {@link #abortTransaction() abort} the transaction.
+     */
+    public void executeWithinTransaction(TransactionalClosure closure);
+
+    /**
+     * Run the supplied {@link Runnable block of code (closure)} in a {@link IsisTransaction transaction}.
+     * 
+     * <p>
+     * If a transaction is {@link IsisContext#inTransaction() in progress}, then uses that. Otherwise will
+     * {@link #startTransaction() start} a transaction before running the block and {@link #endTransaction() commit} it
+     * at the end. If the closure throws an exception, then will {@link #abortTransaction() abort} the transaction.
+     */
+    public <T> T executeWithinTransaction(TransactionalClosureWithReturn<T> closure);
+
+    // ////////////////////////////////////////////////////////////////////
+    // Debugging
+    // ////////////////////////////////////////////////////////////////////
+
+    void debugData(DebugBuilder debug);
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManagerAware.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManagerAware.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManagerAware.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/IsisTransactionManagerAware.java Tue May  3 06:22:09 2011
@@ -17,13 +17,9 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
+public interface IsisTransactionManagerAware {
 
-
-public interface IsisTransactionManagerAware {
-
-    public void setTransactionManager(IsisTransactionManager transactionManager);
-}
-
-
+    public void setTransactionManager(IsisTransactionManager transactionManager);
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/MessageBroker.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/MessageBroker.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/MessageBroker.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/MessageBroker.java Tue May  3 06:22:09 2011
@@ -17,25 +17,24 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
-
-import java.util.List;
-
-public interface MessageBroker {
-
-    List<String> getMessages();
-    
-    String getMessagesCombined();
-
-    List<String> getWarnings();
-
-    String getWarningsCombined();
-
-    void addWarning(String message);
-
-    void addMessage(String message);
-
-    void ensureEmpty();
-
-}
+import java.util.List;
+
+public interface MessageBroker {
+
+    List<String> getMessages();
+
+    String getMessagesCombined();
+
+    List<String> getWarnings();
+
+    String getWarningsCombined();
+
+    void addWarning(String message);
+
+    void addMessage(String message);
+
+    void ensureEmpty();
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosure.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosure.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosure.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosure.java Tue May  3 06:22:09 2011
@@ -17,16 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
-
-public interface TransactionalClosure {
-
-	public void preExecute();
-	
-	public void execute();
-	
-	public void onSuccess();
-	
-	public void onFailure();
-}
+public interface TransactionalClosure {
+
+    public void preExecute();
+
+    public void execute();
+
+    public void onSuccess();
+
+    public void onFailure();
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosureWithReturn.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosureWithReturn.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosureWithReturn.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/TransactionalClosureWithReturn.java Tue May  3 06:22:09 2011
@@ -17,16 +17,15 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.system.transaction;
-
-public interface TransactionalClosureWithReturn<T> {
-
-	public void preExecute();
-	
-	public T execute();
-	
-	public void onSuccess();
-	
-	public void onFailure();
-}
+public interface TransactionalClosureWithReturn<T> {
+
+    public void preExecute();
+
+    public T execute();
+
+    public void onSuccess();
+
+    public void onFailure();
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/UpdateNotifier.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/UpdateNotifier.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/UpdateNotifier.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/transaction/UpdateNotifier.java Tue May  3 06:22:09 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.runtimes.dflt.runtime.system.transaction;
 
 import java.util.List;
@@ -27,56 +26,52 @@ import org.apache.isis.core.commons.comp
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 
 /**
- * UpdateNotifier provides updates to client making available lists of the
- * latest changed and disposed objects.
+ * UpdateNotifier provides updates to client making available lists of the latest changed and disposed objects.
  */
 public interface UpdateNotifier extends TransactionScopedComponent, Injectable {
 
-	// //////////////////////////////////////////////////
-	// Changed Objects
-	// //////////////////////////////////////////////////
-
-	/**
-	 * Used by the framework to add objects that have just changed.
-	 */
-	void addChangedObject(ObjectAdapter object);
-
-	/**
-	 * Returns an immutable {@link List} of changed objects.
-	 * 
-	 * <p>
-	 * Each changed object that was added is only ever provided during one call
-	 * to this method so the list must be processed fully to avoid missing
-	 * updates.
-	 */
-	List<ObjectAdapter> getChangedObjects();
-
-	// //////////////////////////////////////////////////
-	// Disposed Objects
-	// //////////////////////////////////////////////////
-
-	/**
-	 * Used by the framework to add objects that have just been disposed of.
-	 */
-	void addDisposedObject(ObjectAdapter adapter);
-
-	/**
-	 * Returns an immutable {@link List} of disposed objects.
-	 * 
-	 * <p>
-	 * Each object that was disposed of is only ever provided during one call to
-	 * this method so the list must be processed fully to avoid missing
-	 * deletions.
-	 */
-	public List<ObjectAdapter> getDisposedObjects();
-
-	// //////////////////////////////////////////////////
-	// Empty, Clear
-	// //////////////////////////////////////////////////
+    // //////////////////////////////////////////////////
+    // Changed Objects
+    // //////////////////////////////////////////////////
+
+    /**
+     * Used by the framework to add objects that have just changed.
+     */
+    void addChangedObject(ObjectAdapter object);
+
+    /**
+     * Returns an immutable {@link List} of changed objects.
+     * 
+     * <p>
+     * Each changed object that was added is only ever provided during one call to this method so the list must be
+     * processed fully to avoid missing updates.
+     */
+    List<ObjectAdapter> getChangedObjects();
+
+    // //////////////////////////////////////////////////
+    // Disposed Objects
+    // //////////////////////////////////////////////////
+
+    /**
+     * Used by the framework to add objects that have just been disposed of.
+     */
+    void addDisposedObject(ObjectAdapter adapter);
+
+    /**
+     * Returns an immutable {@link List} of disposed objects.
+     * 
+     * <p>
+     * Each object that was disposed of is only ever provided during one call to this method so the list must be
+     * processed fully to avoid missing deletions.
+     */
+    public List<ObjectAdapter> getDisposedObjects();
+
+    // //////////////////////////////////////////////////
+    // Empty, Clear
+    // //////////////////////////////////////////////////
 
-	void ensureEmpty();
+    void ensureEmpty();
 
-	void clear();
+    void clear();
 
 }
-

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjector.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjector.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjector.java Tue May  3 06:22:09 2011
@@ -18,7 +18,7 @@ package org.apache.isis.runtimes.dflt.ru
 
 /**
  * 
- *
+ * 
  * @version $Rev$ $Date$
  */
 public interface SystemDependencyInjector {

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjectorAware.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjectorAware.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjectorAware.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemdependencyinjector/SystemDependencyInjectorAware.java Tue May  3 06:22:09 2011
@@ -17,14 +17,9 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.systemdependencyinjector;
 
-package org.apache.isis.runtimes.dflt.runtime.systemdependencyinjector;
+public interface SystemDependencyInjectorAware {
 
-
-
-
-public interface SystemDependencyInjectorAware  {
-
-    void setSystemDependencyInjector(final SystemDependencyInjector dependencyInjector);
-}
-
+    void setSystemDependencyInjector(final SystemDependencyInjector dependencyInjector);
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemAbstract.java Tue May  3 06:22:09 2011
@@ -59,7 +59,6 @@ public abstract class IsisSystemAbstract
         super(deploymentType, localeInitializer, timeZoneInitializer);
     }
 
-
     @Override
     protected void installFixturesIfRequired() throws IsisSystemException {
         // some deployment types (eg CLIENT) do not support installing fixtures
@@ -86,11 +85,10 @@ public abstract class IsisSystemAbstract
         }
     }
 
-    private boolean isNoop(FixturesInstaller candidate) {
+    private boolean isNoop(final FixturesInstaller candidate) {
         return candidate == null || (fixtureInstaller instanceof Noop);
     }
 
-
     // ///////////////////////////////////////////
     // Fixtures
     // ///////////////////////////////////////////
@@ -128,9 +126,8 @@ public abstract class IsisSystemAbstract
     }
 
     @Override
-    protected void appendFixturesInstallerDebug(DebugBuilder debug) {
-        debug.appendln("Fixture Installer", fixtureInstaller == null ? "none" : fixtureInstaller.getClass()
-            .getName());
+    protected void appendFixturesInstallerDebug(final DebugBuilder debug) {
+        debug.appendln("Fixture Installer", fixtureInstaller == null ? "none" : fixtureInstaller.getClass().getName());
     }
 
 }

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java Tue May  3 06:22:09 2011
@@ -17,67 +17,68 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.systemusinginstallers;
 
-package org.apache.isis.runtimes.dflt.runtime.systemusinginstallers;
-
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.IsisSystem;
 import org.apache.isis.runtimes.dflt.runtime.system.IsisSystemFactory;
 import org.apache.isis.runtimes.dflt.runtime.systemdependencyinjector.SystemDependencyInjector;
-
-import com.google.inject.Inject;
-
-
-/**
- * Implementation of {@link IsisSystemFactory} that uses {@link InstallerLookup} to convert the names
- * of components into actual component instances.
- */
-public class IsisSystemThatUsesInstallersFactory implements IsisSystemFactory {
-
-    private final InstallerLookup installerLookup;
-
-    // //////////////////////////////////////////////////////////
-    // constructor
-    // //////////////////////////////////////////////////////////
-
-    @Inject
-    public IsisSystemThatUsesInstallersFactory(final InstallerLookup installerLookup) {
-        this.installerLookup = installerLookup;
-    }
-
-    // //////////////////////////////////////////////////////////
-    // init, shutdown
-    // //////////////////////////////////////////////////////////
-
-    public void init() {
-    // nothing to do
-    }
-
-    public void shutdown() {
-    // nothing to do
-    }
-
-    // //////////////////////////////////////////////////////////
-    // main API
-    // //////////////////////////////////////////////////////////
-
-    public IsisSystem createSystem(final DeploymentType deploymentType) {
-
-        final IsisSystemUsingInstallers system = new IsisSystemUsingInstallers(deploymentType, installerLookup);
-
-        system.lookupAndSetAuthenticatorAndAuthorization(deploymentType);
-        system.lookupAndSetUserProfileFactoryInstaller();
-        system.lookupAndSetFixturesInstaller();
-        return system;
-    }
-
-    // //////////////////////////////////////////////////////////
-    // Dependencies (injected or defaulted in constructor)
-    // //////////////////////////////////////////////////////////
-
-    public SystemDependencyInjector getInstallerLookup() {
-        return installerLookup;
-    }
-
-}
+
+import com.google.inject.Inject;
+
+/**
+ * Implementation of {@link IsisSystemFactory} that uses {@link InstallerLookup} to convert the names of components into
+ * actual component instances.
+ */
+public class IsisSystemThatUsesInstallersFactory implements IsisSystemFactory {
+
+    private final InstallerLookup installerLookup;
+
+    // //////////////////////////////////////////////////////////
+    // constructor
+    // //////////////////////////////////////////////////////////
+
+    @Inject
+    public IsisSystemThatUsesInstallersFactory(final InstallerLookup installerLookup) {
+        this.installerLookup = installerLookup;
+    }
+
+    // //////////////////////////////////////////////////////////
+    // init, shutdown
+    // //////////////////////////////////////////////////////////
+
+    @Override
+    public void init() {
+        // nothing to do
+    }
+
+    @Override
+    public void shutdown() {
+        // nothing to do
+    }
+
+    // //////////////////////////////////////////////////////////
+    // main API
+    // //////////////////////////////////////////////////////////
+
+    @Override
+    public IsisSystem createSystem(final DeploymentType deploymentType) {
+
+        final IsisSystemUsingInstallers system = new IsisSystemUsingInstallers(deploymentType, installerLookup);
+
+        system.lookupAndSetAuthenticatorAndAuthorization(deploymentType);
+        system.lookupAndSetUserProfileFactoryInstaller();
+        system.lookupAndSetFixturesInstaller();
+        return system;
+    }
+
+    // //////////////////////////////////////////////////////////
+    // Dependencies (injected or defaulted in constructor)
+    // //////////////////////////////////////////////////////////
+
+    public SystemDependencyInjector getInstallerLookup() {
+        return installerLookup;
+    }
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemUsingInstallers.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemUsingInstallers.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemUsingInstallers.java Tue May  3 06:22:09 2011
@@ -151,10 +151,10 @@ public class IsisSystemUsingInstallers e
     // Authentication & Authorization
     // ///////////////////////////////////////////
 
-    public void lookupAndSetAuthenticatorAndAuthorization(DeploymentType deploymentType) {
+    public void lookupAndSetAuthenticatorAndAuthorization(final DeploymentType deploymentType) {
 
-        IsisConfiguration configuration = installerLookup.getConfiguration();
-        String connection = configuration.getString(SystemConstants.CLIENT_CONNECTION_KEY);
+        final IsisConfiguration configuration = installerLookup.getConfiguration();
+        final String connection = configuration.getString(SystemConstants.CLIENT_CONNECTION_KEY);
 
         if (connection != null) {
             lookupAndSetAuthenticatorAndAuthorizationUsingClientConnectionInstaller(connection);
@@ -163,8 +163,9 @@ public class IsisSystemUsingInstallers e
         }
     }
 
-    private void lookupAndSetAuthenticatorAndAuthorizationUsingClientConnectionInstaller(String connection) {
-        ClientConnectionInstaller clientConnectionInstaller = installerLookup.clientConnectionInstaller(connection);
+    private void lookupAndSetAuthenticatorAndAuthorizationUsingClientConnectionInstaller(final String connection) {
+        final ClientConnectionInstaller clientConnectionInstaller =
+            installerLookup.clientConnectionInstaller(connection);
         if (clientConnectionInstaller == null) {
             return;
         }
@@ -172,9 +173,10 @@ public class IsisSystemUsingInstallers e
         setAuthorizationInstaller(clientConnectionInstaller);
     }
 
-    private void lookupAndSetAuthenticatorAndAuthorizationInstallers(DeploymentType deploymentType) {
+    private void lookupAndSetAuthenticatorAndAuthorizationInstallers(final DeploymentType deploymentType) {
         // use the one specified in configuration
-        String authenticationManagerKey = getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY);
+        final String authenticationManagerKey =
+            getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY);
         final AuthenticationManagerInstaller authenticationInstaller =
             installerLookup.authenticationManagerInstaller(authenticationManagerKey, deploymentType);
         if (authenticationInstaller != null) {
@@ -182,7 +184,8 @@ public class IsisSystemUsingInstallers e
         }
 
         // use the one specified in configuration
-        String authorizationManagerKey = getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY);
+        final String authorizationManagerKey =
+            getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY);
         final AuthorizationManagerInstaller authorizationInstaller =
             installerLookup.authorizationManagerInstaller(authorizationManagerKey, deploymentType);
         if (authorizationInstaller != null) {
@@ -215,11 +218,11 @@ public class IsisSystemUsingInstallers e
     }
 
     @Override
-    protected AuthenticationManager obtainAuthenticationManager(DeploymentType deploymentType) {
+    protected AuthenticationManager obtainAuthenticationManager(final DeploymentType deploymentType) {
         return authenticationInstaller.createAuthenticationManager();
     }
 
-    protected AuthorizationManager obtainAuthorizationManager(DeploymentType deploymentType) {
+    protected AuthorizationManager obtainAuthorizationManager(final DeploymentType deploymentType) {
         return authorizationInstaller.createAuthorizationManager();
     }
 
@@ -228,8 +231,8 @@ public class IsisSystemUsingInstallers e
     // ///////////////////////////////////////////
 
     public void lookupAndSetFixturesInstaller() {
-        IsisConfiguration configuration = installerLookup.getConfiguration();
-        String fixture = configuration.getString(SystemConstants.FIXTURES_INSTALLER_KEY);
+        final IsisConfiguration configuration = installerLookup.getConfiguration();
+        final String fixture = configuration.getString(SystemConstants.FIXTURES_INSTALLER_KEY);
 
         final FixturesInstaller fixturesInstaller = installerLookup.fixturesInstaller(fixture);
         if (fixturesInstaller != null) {
@@ -237,7 +240,7 @@ public class IsisSystemUsingInstallers e
         }
     }
 
-    public void setFixtureInstaller(FixturesInstaller fixtureInstaller) {
+    public void setFixtureInstaller(final FixturesInstaller fixtureInstaller) {
         this.fixtureInstaller = fixtureInstaller;
     }
 
@@ -256,7 +259,8 @@ public class IsisSystemUsingInstallers e
      */
     @Override
     protected TemplateImageLoader obtainTemplateImageLoader() {
-        TemplateImageLoaderInstaller templateImageLoaderInstaller = installerLookup.templateImageLoaderInstaller(null);
+        final TemplateImageLoaderInstaller templateImageLoaderInstaller =
+            installerLookup.templateImageLoaderInstaller(null);
         if (templateImageLoaderInstaller != null) {
             return templateImageLoaderInstaller.createLoader();
         } else {
@@ -273,9 +277,9 @@ public class IsisSystemUsingInstallers e
     }
 
     @Override
-    protected ObjectReflector obtainReflector(DeploymentType deploymentType) throws IsisSystemException {
+    protected ObjectReflector obtainReflector(final DeploymentType deploymentType) throws IsisSystemException {
         if (reflectorInstaller == null) {
-            String fromCmdLine = getConfiguration().getString(SystemConstants.REFLECTOR_KEY);
+            final String fromCmdLine = getConfiguration().getString(SystemConstants.REFLECTOR_KEY);
             reflectorInstaller = installerLookup.reflectorInstaller(fromCmdLine);
         }
         ensureThatState(reflectorInstaller, is(not(nullValue())),
@@ -286,9 +290,10 @@ public class IsisSystemUsingInstallers e
             .getInstaller(TransactionFacetDecoratorInstaller.class));
 
         // if there is a client connection installer, then add facet decorator installer also
-        String connection = getConfiguration().getString(SystemConstants.CLIENT_CONNECTION_KEY);
+        final String connection = getConfiguration().getString(SystemConstants.CLIENT_CONNECTION_KEY);
         if (connection != null) {
-            FacetDecoratorInstaller clientConnectionInstaller = installerLookup.clientConnectionInstaller(connection);
+            final FacetDecoratorInstaller clientConnectionInstaller =
+                installerLookup.clientConnectionInstaller(connection);
             reflectorInstaller.addFacetDecoratorInstaller(clientConnectionInstaller);
         }
 
@@ -299,7 +304,7 @@ public class IsisSystemUsingInstallers e
     // Services
     // ///////////////////////////////////////////
 
-    public void setServicesInstaller(ServicesInstaller servicesInstaller) {
+    public void setServicesInstaller(final ServicesInstaller servicesInstaller) {
         this.servicesInstaller = servicesInstaller;
     }
 
@@ -319,17 +324,17 @@ public class IsisSystemUsingInstallers e
     // ///////////////////////////////////////////
 
     public void lookupAndSetUserProfileFactoryInstaller() {
-        IsisConfiguration configuration = installerLookup.getConfiguration();
-        String persistor = configuration.getString(SystemConstants.PROFILE_PERSISTOR_INSTALLER_KEY);
+        final IsisConfiguration configuration = installerLookup.getConfiguration();
+        final String persistor = configuration.getString(SystemConstants.PROFILE_PERSISTOR_INSTALLER_KEY);
 
-        UserProfileStoreInstaller userProfilePersistenceMechanismInstaller =
+        final UserProfileStoreInstaller userProfilePersistenceMechanismInstaller =
             installerLookup.userProfilePersistenceMechanismInstaller(persistor, getDeploymentType());
         if (userProfilePersistenceMechanismInstaller != null) {
             setUserProfileStoreInstaller(userProfilePersistenceMechanismInstaller);
         }
     }
 
-    public void setUserProfileStoreInstaller(UserProfileStoreInstaller userProfilestoreInstaller) {
+    public void setUserProfileStoreInstaller(final UserProfileStoreInstaller userProfilestoreInstaller) {
         this.userProfileStoreInstaller = userProfilestoreInstaller;
     }
 
@@ -347,18 +352,19 @@ public class IsisSystemUsingInstallers e
     }
 
     @Override
-    protected PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType)
+    protected PersistenceSessionFactory obtainPersistenceSessionFactory(final DeploymentType deploymentType)
         throws IsisSystemException {
 
         // attempt to look up connection (that is, a ProxyPersistor)
-        String connection = getConfiguration().getString(SystemConstants.CLIENT_CONNECTION_KEY);
+        final String connection = getConfiguration().getString(SystemConstants.CLIENT_CONNECTION_KEY);
         if (connection != null) {
             persistenceMechanismInstaller = installerLookup.clientConnectionInstaller(connection);
         }
 
         // if nothing, look for a object store persistor
         if (persistenceMechanismInstaller == null) {
-            String persistenceMechanism = getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY);
+            final String persistenceMechanism =
+                getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY);
             persistenceMechanismInstaller =
                 installerLookup.persistenceMechanismInstaller(persistenceMechanism, deploymentType);
         }

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionAbstract.java Tue May  3 06:22:09 2011
@@ -17,214 +17,210 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.transaction;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
-
-import org.apache.log4j.Logger;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
 import org.apache.isis.core.commons.lang.ToString;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.MessageBroker;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.UpdateNotifier;
-
-public abstract class IsisTransactionAbstract implements IsisTransaction {
-
-    private static final Logger LOG = Logger.getLogger(IsisTransactionAbstract.class);
-
-    private final IsisTransactionManager transactionManager;
-    private final MessageBroker messageBroker;
-    private final UpdateNotifier updateNotifier;
-    
-    private State state;
-
-    private RuntimeException cause;
-    
-    public IsisTransactionAbstract(
-            final IsisTransactionManager transactionManager, 
-            final MessageBroker messageBroker, 
-            final UpdateNotifier updateNotifier) {
-        
-        ensureThatArg(transactionManager, is(not(nullValue())), "transaction manager is required");
-        ensureThatArg(messageBroker, is(not(nullValue())), "message broker is required");
-        ensureThatArg(updateNotifier, is(not(nullValue())), "update notifier is required");
-        
-        this.transactionManager = transactionManager;
-        this.messageBroker = messageBroker;
-        this.updateNotifier = updateNotifier;
-        
-        this.state = State.IN_PROGRESS;
-    }
-
-
-
-    //////////////////////////////////////////////////////////////////
-    // State 
-    //////////////////////////////////////////////////////////////////
-
-    public State getState() {
-        return state;
-    }
-    
-    private void setState(State state) {
-        this.state = state;
-    }
-
-    
-    //////////////////////////////////////////////////////////////////
-    // commit, abort 
-    //////////////////////////////////////////////////////////////////
-
-    public final void flush() {
-        ensureThatState(getState().canFlush(), is(true), "state is: " + getState());
-        if (LOG.isInfoEnabled()) {
-            LOG.info("flush transaction " + this);
-        }
-        
-        try {
-            doFlush();
-        } catch(RuntimeException ex) {
-            setState(State.MUST_ABORT);
-            setAbortCause(ex);
-            throw ex;
-        }
-    }
-
-
-    public final void commit() {
-        ensureThatState(getState().canCommit(), is(true), "state is: " + getState());
-
-        if (LOG.isInfoEnabled()) {
-            LOG.info("commit transaction " + this);
-        }
-
-        if (getState() == State.COMMITTED) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("already committed; ignoring");
-            }
-            return;
-        }
-        try {
-            doFlush();
-            setState(State.COMMITTED);
-        } catch(RuntimeException ex) {
-            setAbortCause(ex);
-            throw ex;
-        }
-    }
-
-    public final void abort() {
-        ensureThatState(getState().canAbort(), is(true), "state is: " + getState());
-        if (LOG.isInfoEnabled()) {
-            LOG.info("abort transaction " + this);
-        }
-
-        try {
-            doAbort();
-        } catch(RuntimeException ex) {
-            setAbortCause(ex);
-            throw ex;
-        } finally {
-            setState(State.ABORTED);
-        }
-    }
-
-    /**
-     * Mandatory hook method for subclasses to persist all pending changes.
-     * 
-     * <p>
-     * Called by both {@link #commit()} and by {@link #flush()}:
-     * <table>
-     * <tr>
-     * <th>called from</th><th>next {@link #getState() state} if ok</th><th>next {@link #getState() state} if exception</th>
-     * </tr>
-     * <tr>
-     * <td>{@link #commit()}</td><td>{@link State#COMMITTED}</td><td>{@link State#ABORTED}</td>
-     * </tr>
-     * <tr>
-     * <td>{@link #flush()}</td><td>{@link State#IN_PROGRESS}</td><td>{@link State#MUST_ABORT}</td>
-     * </tr>
-     * </table>
-     */
-    protected abstract void doFlush();
-
-    /**
-     * Mandatory hook method for subclasses to perform additional processing on abort.
-     * 
-     * <p>
-     * After this call the {@link #getState() state} will always be set to 
-     * {@link State#ABORTED}, irrespective of whether an exception is thrown or not.
-     */
-    protected abstract void doAbort();
-
-
-
-    //////////////////////////////////////////////////////////////////
-    // Abort Cause 
-    //////////////////////////////////////////////////////////////////
-
-    protected void setAbortCause(RuntimeException cause) {
-        this.cause = cause;
-    }
-    /**
-     * The cause (if any) for the transaction being aborted.
-     * 
-     * <p>
-     * There will be a cause if an exception is thrown either by {@link #doFlush()} or
-     * {@link #doAbort()}.
-     */
-    public RuntimeException getAbortCause() {
-        return cause;
-    }
-
-
-
-    //////////////////////////////////////////////////////////////////
-    // toString 
-    //////////////////////////////////////////////////////////////////
-    
-    @Override
-    public String toString() {
-        return appendTo(new ToString(this)).toString();
-    }
-
-    protected ToString appendTo(ToString str) {
-        str.append("state", state);
-        return str;
-    }
-
-    //////////////////////////////////////////////////////////////////
-    // Depenendencies  (from constructor) 
-    //////////////////////////////////////////////////////////////////
-
-    /**
-     * Injected in constructor
-     */
-    public IsisTransactionManager getTransactionManager() {
-        return transactionManager;
-    }
-
-    /**
-     * Injected in constructor
-     */
-    public MessageBroker getMessageBroker() {
-        return messageBroker;
-    }
-    
-    /**
-     * Injected in constructor
-     */
-    public UpdateNotifier getUpdateNotifier() {
-        return updateNotifier;
-    }
-    
-
-    
-}
-
-
+import org.apache.log4j.Logger;
+
+public abstract class IsisTransactionAbstract implements IsisTransaction {
+
+    private static final Logger LOG = Logger.getLogger(IsisTransactionAbstract.class);
+
+    private final IsisTransactionManager transactionManager;
+    private final MessageBroker messageBroker;
+    private final UpdateNotifier updateNotifier;
+
+    private State state;
+
+    private RuntimeException cause;
+
+    public IsisTransactionAbstract(final IsisTransactionManager transactionManager, final MessageBroker messageBroker,
+        final UpdateNotifier updateNotifier) {
+
+        ensureThatArg(transactionManager, is(not(nullValue())), "transaction manager is required");
+        ensureThatArg(messageBroker, is(not(nullValue())), "message broker is required");
+        ensureThatArg(updateNotifier, is(not(nullValue())), "update notifier is required");
+
+        this.transactionManager = transactionManager;
+        this.messageBroker = messageBroker;
+        this.updateNotifier = updateNotifier;
+
+        this.state = State.IN_PROGRESS;
+    }
+
+    // ////////////////////////////////////////////////////////////////
+    // State
+    // ////////////////////////////////////////////////////////////////
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    private void setState(final State state) {
+        this.state = state;
+    }
+
+    // ////////////////////////////////////////////////////////////////
+    // commit, abort
+    // ////////////////////////////////////////////////////////////////
+
+    public final void flush() {
+        ensureThatState(getState().canFlush(), is(true), "state is: " + getState());
+        if (LOG.isInfoEnabled()) {
+            LOG.info("flush transaction " + this);
+        }
+
+        try {
+            doFlush();
+        } catch (final RuntimeException ex) {
+            setState(State.MUST_ABORT);
+            setAbortCause(ex);
+            throw ex;
+        }
+    }
+
+    public final void commit() {
+        ensureThatState(getState().canCommit(), is(true), "state is: " + getState());
+
+        if (LOG.isInfoEnabled()) {
+            LOG.info("commit transaction " + this);
+        }
+
+        if (getState() == State.COMMITTED) {
+            if (LOG.isInfoEnabled()) {
+                LOG.info("already committed; ignoring");
+            }
+            return;
+        }
+        try {
+            doFlush();
+            setState(State.COMMITTED);
+        } catch (final RuntimeException ex) {
+            setAbortCause(ex);
+            throw ex;
+        }
+    }
+
+    public final void abort() {
+        ensureThatState(getState().canAbort(), is(true), "state is: " + getState());
+        if (LOG.isInfoEnabled()) {
+            LOG.info("abort transaction " + this);
+        }
+
+        try {
+            doAbort();
+        } catch (final RuntimeException ex) {
+            setAbortCause(ex);
+            throw ex;
+        } finally {
+            setState(State.ABORTED);
+        }
+    }
+
+    /**
+     * Mandatory hook method for subclasses to persist all pending changes.
+     * 
+     * <p>
+     * Called by both {@link #commit()} and by {@link #flush()}:
+     * <table>
+     * <tr>
+     * <th>called from</th>
+     * <th>next {@link #getState() state} if ok</th>
+     * <th>next {@link #getState() state} if exception</th>
+     * </tr>
+     * <tr>
+     * <td>{@link #commit()}</td>
+     * <td>{@link State#COMMITTED}</td>
+     * <td>{@link State#ABORTED}</td>
+     * </tr>
+     * <tr>
+     * <td>{@link #flush()}</td>
+     * <td>{@link State#IN_PROGRESS}</td>
+     * <td>{@link State#MUST_ABORT}</td>
+     * </tr>
+     * </table>
+     */
+    protected abstract void doFlush();
+
+    /**
+     * Mandatory hook method for subclasses to perform additional processing on abort.
+     * 
+     * <p>
+     * After this call the {@link #getState() state} will always be set to {@link State#ABORTED}, irrespective of
+     * whether an exception is thrown or not.
+     */
+    protected abstract void doAbort();
+
+    // ////////////////////////////////////////////////////////////////
+    // Abort Cause
+    // ////////////////////////////////////////////////////////////////
+
+    protected void setAbortCause(final RuntimeException cause) {
+        this.cause = cause;
+    }
+
+    /**
+     * The cause (if any) for the transaction being aborted.
+     * 
+     * <p>
+     * There will be a cause if an exception is thrown either by {@link #doFlush()} or {@link #doAbort()}.
+     */
+    @Override
+    public RuntimeException getAbortCause() {
+        return cause;
+    }
+
+    // ////////////////////////////////////////////////////////////////
+    // toString
+    // ////////////////////////////////////////////////////////////////
+
+    @Override
+    public String toString() {
+        return appendTo(new ToString(this)).toString();
+    }
+
+    protected ToString appendTo(final ToString str) {
+        str.append("state", state);
+        return str;
+    }
+
+    // ////////////////////////////////////////////////////////////////
+    // Depenendencies (from constructor)
+    // ////////////////////////////////////////////////////////////////
+
+    /**
+     * Injected in constructor
+     */
+    @Override
+    public IsisTransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+    /**
+     * Injected in constructor
+     */
+    @Override
+    public MessageBroker getMessageBroker() {
+        return messageBroker;
+    }
+
+    /**
+     * Injected in constructor
+     */
+    @Override
+    public UpdateNotifier getUpdateNotifier() {
+        return updateNotifier;
+    }
+
+}

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionDefault.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionDefault.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/transaction/IsisTransactionDefault.java Tue May  3 06:22:09 2011
@@ -17,38 +17,31 @@
  *  under the License.
  */
 
+package org.apache.isis.runtimes.dflt.runtime.transaction;
 
-package org.apache.isis.runtimes.dflt.runtime.transaction;
-
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.MessageBroker;
 import org.apache.isis.runtimes.dflt.runtime.system.transaction.UpdateNotifier;
 import org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker.MessageBrokerDefault;
 import org.apache.isis.runtimes.dflt.runtime.transaction.updatenotifier.UpdateNotifierDefault;
-
-public class IsisTransactionDefault extends IsisTransactionAbstract {
-
-    public IsisTransactionDefault(
-            final IsisTransactionManager transactionManager) {
-        this(transactionManager, new MessageBrokerDefault(), new UpdateNotifierDefault());
-    }
-
-
-    public IsisTransactionDefault(
-            IsisTransactionManager transactionManager,
-            MessageBroker messageBroker,
-            UpdateNotifier updateNotifier) {
-        super(transactionManager, messageBroker, updateNotifier);
-    }
-
-
-    @Override
-    protected void doAbort() {}
-
-    @Override
-    protected void doFlush() {}
-
-
-}
-
-
+
+public class IsisTransactionDefault extends IsisTransactionAbstract {
+
+    public IsisTransactionDefault(final IsisTransactionManager transactionManager) {
+        this(transactionManager, new MessageBrokerDefault(), new UpdateNotifierDefault());
+    }
+
+    public IsisTransactionDefault(final IsisTransactionManager transactionManager, final MessageBroker messageBroker,
+        final UpdateNotifier updateNotifier) {
+        super(transactionManager, messageBroker, updateNotifier);
+    }
+
+    @Override
+    protected void doAbort() {
+    }
+
+    @Override
+    protected void doFlush() {
+    }
+
+}



Mime
View raw message