Author: rhauch
Date: 2009-01-16 15:03:39 -0500 (Fri, 16 Jan 2009)
New Revision: 712
Removed:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContextFactory.java
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNamespaceRegistryTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TestUtil.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_for_sequencing.xml
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_repositories.xml
trunk/docs/reference/src/main/docbook/en-US/content/environment.xml
trunk/docs/reference/src/main/docbook/en-US/content/repositories.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
Log:
DNA-276 ExecutionContext story should be simplified by eliminating
ExecutionContextFactory
Remove the ExecutionContextFactory interface, and renamed the ExecutionContext.create(...)
methods to 'with' (to mirror the other methods of creating a new context by
changing an aspect).
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -27,6 +27,7 @@
import java.security.AccessController;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
@@ -52,16 +53,16 @@
* it is given a different one).
* <p>
* ExecutionContext instances are {@link Immutable immutable}, so components may hold
onto references to them without concern of
- * those contexts changing. However, contexts may be used to create other context with
variations in the environment and/or
- * security context. For example, an ExecutionContext could be used to create another
context that references the same
- * {@link #getNamespaceRegistry() namespace registry} but which has a different {@link
#getSubject() JAAS subject}.
+ * those contexts changing. Contexts may be used to create other contexts that vary the
environment and/or security context. For
+ * example, an ExecutionContext could be used to create another context that references
the same {@link #getNamespaceRegistry()
+ * namespace registry} but which has a different {@link #getSubject() JAAS subject}.
* </p>
*
* @author Randall Hauch
* @author John Verhaeg
*/
@Immutable
-public class ExecutionContext implements ClassLoaderFactory, Cloneable,
ExecutionContextFactory {
+public class ExecutionContext implements ClassLoaderFactory, Cloneable {
private final ClassLoaderFactory classLoaderFactory;
private final LoginContext loginContext;
@@ -73,9 +74,9 @@
private final MimeTypeDetector mimeTypeDetector;
/**
- * Create an instance of an execution context that inherits the {@link
AccessControlContext security context} from the
- * {@link AccessController#getContext() current calling context}, with default
implementations for all other components
- * (including default namespaces in the {@link #getNamespaceRegistry() namespace
registry}.
+ * Create an instance of an execution context that uses the {@link
AccessController#getContext() current JAAS calling context}
+ * , with default implementations for all other components (including default
namespaces in the
+ * {@link #getNamespaceRegistry() namespace registry}.
*/
public ExecutionContext() {
this(null, null, null, null, null, null, null);
@@ -295,7 +296,8 @@
* the new namespace registry.
*
* @param namespaceRegistry the new namespace registry implementation, or null if the
default implementation should be used
- * @return the new execution context
+ * @return the execution context that is identical with this execution context, but
which uses the supplied registry; never
+ * null
*/
public ExecutionContext with( NamespaceRegistry namespaceRegistry ) {
// Don't supply the value factories or property factories, since they'll
have to be recreated
@@ -305,11 +307,12 @@
}
/**
- * Create a new execution context that mirrors this context but that uses the
supplied {@link MimeTypeDetector MIME type
- * detector}.
+ * Create a new execution context that is the same as this context, but which uses
the supplied {@link MimeTypeDetector MIME
+ * type detector}.
*
* @param mimeTypeDetector the new MIME type detector implementation, or null if the
default implementation should be used
- * @return the new execution context
+ * @return the execution context that is identical with this execution context, but
which uses the supplied detector
+ * implementation; never null
*/
public ExecutionContext with( MimeTypeDetector mimeTypeDetector ) {
// Don't supply the value factories or property factories, since they'll
have to be recreated
@@ -323,7 +326,8 @@
* factory}.
*
* @param classLoaderFactory the new class loader factory implementation, or null if
the default implementation should be used
- * @return the new execution context
+ * @return the execution context that is identical with this execution context, but
which uses the supplied class loader
+ * factory implementation; never null
*/
public ExecutionContext with( ClassLoaderFactory classLoaderFactory ) {
// Don't supply the value factories or property factories, since they'll
have to be recreated
@@ -333,10 +337,12 @@
}
/**
- * Creates an {@link ExecutionContext} using the supplied {@link AccessControlContext
access control context}.
+ * Creates an {@link ExecutionContext} that is the same as this context, but which
uses the supplied
+ * {@link AccessControlContext access control context}.
*
- * @param accessControlContext An access control context.
- * @return the execution context; never <code>null</code>.
+ * @param accessControlContext the JAAS access control context that should be used
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws IllegalArgumentException if <code>accessControlContext</code>
is <code>null</code>.
*/
public ExecutionContext create( AccessControlContext accessControlContext ) {
@@ -344,10 +350,14 @@
}
/**
- * Create an {@link ExecutionContext} for the supplied {@link LoginContext}.
+ * Create an {@link ExecutionContext} that is the same as this context, but which
uses the supplied {@link LoginContext}. A
+ * LoginContext has a variety of constructors, including contructors that take
combinations of
+ * {@link Configuration#getAppConfigurationEntry(String) application configuration
name}, {@link Subject subject},
+ * {@link CallbackHandler callback handlers}, and a {@link Configuration JAAS
configuration}.
*
* @param loginContext the JAAS login context
- * @return the execution context
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws IllegalArgumentException if the <code>loginContext</code> is
null
*/
public ExecutionContext create( LoginContext loginContext ) {
@@ -355,68 +365,79 @@
}
/**
- * @param name the name of the JAAS login context
- * @return the execution context
+ * Create an {@link ExecutionContext} that is the same as this context, but which
uses the supplied
+ * {@link Configuration#getAppConfigurationEntry(String) application configuration
name}.
+ *
+ * @param name the name of the {@link Configuration#getAppConfigurationEntry(String)
JAAS application configuration name}
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws IllegalArgumentException if the <code>name</code> is null
* @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), or if the
* default callback handler JAAS property was not set or could not be loaded
*/
- public ExecutionContext create( String name ) throws LoginException {
+ public ExecutionContext with( String name ) throws LoginException {
return new ExecutionContext(this, new LoginContext(name));
}
/**
- * @param name the name of the JAAS login context
+ * Create an {@link ExecutionContext} that is the same as this context, but which
uses the supplied
+ * {@link Configuration#getAppConfigurationEntry(String) application configuration
name} and a {@link Subject JAAS subject}.
+ *
+ * @param name the name of the {@link Configuration#getAppConfigurationEntry(String)
JAAS application configuration name}
* @param subject the subject to authenticate
- * @return the execution context
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), if the default
* callback handler JAAS property was not set or could not be loaded, or if
the <code>subject</code> is null or
* unknown
*/
- public ExecutionContext create( String name,
- Subject subject ) throws LoginException {
+ public ExecutionContext with( String name,
+ Subject subject ) throws LoginException {
return new ExecutionContext(this, new LoginContext(name, subject));
}
/**
- * @param name the name of the JAAS login context
- * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user.
- * @return the execution context
+ * Create an {@link ExecutionContext} that is the same as this context, but which
uses the supplied
+ * {@link Configuration#getAppConfigurationEntry(String) application configuration
name} and a {@link CallbackHandler JAAS
+ * callback handler} (used to handle authentication callbacks).
+ *
+ * @param name the name of the {@link Configuration#getAppConfigurationEntry(String)
JAAS application configuration name}
+ * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user to
+ * authenticate
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), or if the
* <code>callbackHandler</code> is null
*/
- public ExecutionContext create( String name,
- CallbackHandler callbackHandler ) throws
LoginException {
+ public ExecutionContext with( String name,
+ CallbackHandler callbackHandler ) throws LoginException
{
return new ExecutionContext(this, new LoginContext(name, callbackHandler));
}
/**
- * @param name the name of the JAAS login context
+ * Create an {@link ExecutionContext} that is the same as this context, but which
uses the supplied
+ * {@link Configuration#getAppConfigurationEntry(String) application configuration
name}, a {@link Subject JAAS subject}, and
+ * a {@link CallbackHandler JAAS callback handler} (used to handle authentication
callbacks).
+ *
+ * @param name the name of the {@link Configuration#getAppConfigurationEntry(String)
JAAS application configuration name}
* @param subject the subject to authenticate
- * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user.
- * @return the execution context
+ * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user to
+ * authenticate
+ * @return the execution context that is identical with this execution context, but
with a different security context; never
+ * null
* @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), if the default
* callback handler JAAS property was not set or could not be loaded, if the
<code>subject</code> is null or unknown,
* or if the <code>callbackHandler</code> is null
*/
- public ExecutionContext create( String name,
- Subject subject,
- CallbackHandler callbackHandler ) throws
LoginException {
+ public ExecutionContext with( String name,
+ Subject subject,
+ CallbackHandler callbackHandler ) throws LoginException
{
return new ExecutionContext(this, new LoginContext(name, subject,
callbackHandler));
}
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.graph.ExecutionContextFactory#create()
- */
- public ExecutionContext create() {
- return new ExecutionContext(this);
- }
-
- /**
- * {@inheritDoc}
- *
* @see java.lang.Object#clone()
*/
@Override
Deleted: trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContextFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContextFactory.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContextFactory.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -1,113 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.graph;
-
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-/**
- * A factory for creating {@link ExecutionContext} instances. Each execution context is
affiliated with a JAAS {@link Subject},
- * and thus the factory methods take the same parameters that the JAAS {@link
LoginContext} take.
- *
- * @author Randall Hauch
- * @author John Verhaeg
- */
-public interface ExecutionContextFactory {
-
- /**
- * Creates an {@link ExecutionContext} using a snapshot of the {@link
AccessControlContext access control context} obtained
- * from the current calling context.
- *
- * @return the execution context; never <code>null</code>.
- * @see AccessController#getContext()
- */
- ExecutionContext create();
-
- /**
- * Creates an {@link ExecutionContext} using the supplied {@link AccessControlContext
access control context}.
- *
- * @param accessControlContext An access control context.
- * @return the execution context; never <code>null</code>.
- * @throws IllegalArgumentException if <code>accessControlContext</code>
is <code>null</code>.
- */
- ExecutionContext create( AccessControlContext accessControlContext );
-
- /**
- * Create an {@link ExecutionContext} for the supplied {@link LoginContext}.
- *
- * @param loginContext the JAAS login context
- * @return the execution context
- * @throws IllegalArgumentException if the <code>loginContext</code> is
null
- */
- ExecutionContext create( LoginContext loginContext );
-
- /**
- * @param name the name of the JAAS login context
- * @return the execution context
- * @throws IllegalArgumentException if the <code>name</code> is null
- * @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), or if the
- * default callback handler JAAS property was not set or could not be loaded
- */
- ExecutionContext create( String name ) throws LoginException;
-
- /**
- * @param name the name of the JAAS login context
- * @param subject the subject to authenticate
- * @return the execution context
- * @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), if the default
- * callback handler JAAS property was not set or could not be loaded, or if
the <code>subject</code> is null or
- * unknown
- */
- ExecutionContext create( String name,
- Subject subject ) throws LoginException;
-
- /**
- * @param name the name of the JAAS login context
- * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user.
- * @return the execution context
- * @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), or if the
- * <code>callbackHandler</code> is null
- */
- ExecutionContext create( String name,
- CallbackHandler callbackHandler ) throws LoginException;
-
- /**
- * @param name the name of the JAAS login context
- * @param subject the subject to authenticate
- * @param callbackHandler the callback handler that will be used by {@link
LoginModule}s to communicate with the user.
- * @return the execution context
- * @throws LoginException if there <code>name</code> is invalid (or there
is no login context named "other"), if the default
- * callback handler JAAS property was not set or could not be loaded, if the
<code>subject</code> is null or unknown,
- * or if the <code>callbackHandler</code> is null
- */
- ExecutionContext create( String name,
- Subject subject,
- CallbackHandler callbackHandler ) throws LoginException;
-
-}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryContext.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -23,7 +23,7 @@
*/
package org.jboss.dna.graph.connector;
-import org.jboss.dna.graph.ExecutionContextFactory;
+import org.jboss.dna.graph.ExecutionContext;
/**
* The context for a repository. This interface need not be implemented by a {@link
RepositorySource}, as it is normally provided
@@ -34,11 +34,11 @@
public interface RepositoryContext {
/**
- * Get the factory that can be used to create execution contexts.
+ * Get the execution context, which can be used to create other contexts with
specific JAAS security contexts.
*
- * @return the execution context factory
+ * @return the execution context; never null
*/
- ExecutionContextFactory getExecutionContextFactory();
+ ExecutionContext getExecutionContext();
/**
* Get the factory for {@link RepositoryConnection connections} to other sources.
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySource.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -128,7 +128,7 @@
/**
* Initialize this source to use the supplied {@link RepositoryContext}, from which
this source can obtain
* {@link RepositoryContext#getRepositoryConnectionFactory() connections} to other
{@link RepositorySource sources} as well as
- * {@link RepositoryContext#getExecutionContextFactory() execution contexts}.
+ * {@link RepositoryContext#getExecutionContext() execution contexts}.
*
* @param context
* @throws RepositorySourceException
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -37,7 +37,6 @@
import java.util.concurrent.TimeUnit;
import org.jboss.dna.common.statistic.Stopwatch;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.Node;
@@ -71,7 +70,6 @@
*/
public abstract class AbstractConnectorTest {
- protected static ExecutionContextFactory contextFactory;
protected static ExecutionContext context;
protected static RepositorySource source;
protected static Graph graph;
@@ -85,8 +83,7 @@
// Set up the connection factory to other sources ...
// Set up the execution context ...
- contextFactory = new ExecutionContext();
- context = setUpExecutionContext(contextFactory);
+ context = setUpExecutionContext(new ExecutionContext());
// Set up the source ...
source = setUpSource();
@@ -108,8 +105,8 @@
// Initialize the source with the rest of the environment ...
source.initialize(new RepositoryContext() {
- public ExecutionContextFactory getExecutionContextFactory() {
- return contextFactory;
+ public ExecutionContext getExecutionContext() {
+ return context;
}
@SuppressWarnings( "synthetic-access" )
@@ -179,11 +176,11 @@
/**
* Set up the {@link ExecutionContext} for each unit test.
*
- * @param contextFactory the context factory that may be used; never null
+ * @param context the context that may be used directly, or used to create another
context; never null
* @return the execution context; may not be null
*/
- protected ExecutionContext setUpExecutionContext( ExecutionContextFactory
contextFactory ) {
- return contextFactory.create();
+ protected ExecutionContext setUpExecutionContext( ExecutionContext context ) {
+ return context;
}
/**
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-01-16 03:26:56
UTC (rev 711)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-01-16 20:03:39
UTC (rev 712)
@@ -40,7 +40,6 @@
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
import com.google.common.base.ReferenceType;
@@ -50,9 +49,9 @@
* Creates JCR {@link Session sessions} to an underlying repository (which may be a
federated repository).
* <p>
* This JCR repository must be configured with the ability to connect to a repository via
a supplied
- * {@link RepositoryConnectionFactory repository connection factory} and repository
source name. An
- * {@link ExecutionContextFactory execution context factory} must also be supplied to
enable working with the underlying DNA graph
- * implementation to which this JCR implementation delegates.
+ * {@link RepositoryConnectionFactory repository connection factory} and repository
source name. An {@link ExecutionContext
+ * execution context} must also be supplied to enable working with the underlying DNA
graph implementation to which this JCR
+ * implementation delegates.
* </p>
* <p>
* If {@link Credentials credentials} are used to login, implementations
<em>must</em> also implement one of the following
@@ -74,21 +73,21 @@
public class JcrRepository implements Repository {
private final Map<String, String> descriptors;
- private final ExecutionContextFactory executionContextFactory;
+ private final ExecutionContext executionContext;
private final RepositoryConnectionFactory connectionFactory;
/**
* Creates a JCR repository that uses the supplied {@link RepositoryConnectionFactory
repository connection factory} to
* establish {@link Session sessions} to the underlying repository source upon {@link
#login() login}.
*
- * @param executionContextFactory An execution context factory.
+ * @param executionContext An execution context.
* @param connectionFactory A repository connection factory.
* @throws IllegalArgumentException If
<code>executionContextFactory</code> or
<code>connectionFactory</code> is
* <code>null</code>.
*/
- public JcrRepository( ExecutionContextFactory executionContextFactory,
+ public JcrRepository( ExecutionContext executionContext,
RepositoryConnectionFactory connectionFactory ) {
- this(null, executionContextFactory, connectionFactory);
+ this(null, executionContext, connectionFactory);
}
/**
@@ -96,17 +95,17 @@
* establish {@link Session sessions} to the underlying repository source upon {@link
#login() login}.
*
* @param descriptors The {@link #getDescriptorKeys() descriptors} for this
repository; may be <code>null</code>.
- * @param executionContextFactory An execution context factory.
+ * @param executionContext An execution context.
* @param connectionFactory A repository connection factory.
* @throws IllegalArgumentException If
<code>executionContextFactory</code> or
<code>connectionFactory</code> is
* <code>null</code>.
*/
public JcrRepository( Map<String, String> descriptors,
- ExecutionContextFactory executionContextFactory,
+ ExecutionContext executionContext,
RepositoryConnectionFactory connectionFactory ) {
- CheckArg.isNotNull(executionContextFactory,
"executionContextFactory");
+ CheckArg.isNotNull(executionContext, "executionContext");
CheckArg.isNotNull(connectionFactory, "connectionFactory");
- this.executionContextFactory = executionContextFactory;
+ this.executionContext = executionContext;
this.connectionFactory = connectionFactory;
Map<String, String> modifiableDescriptors;
if (descriptors == null) {
@@ -209,7 +208,7 @@
// Ensure credentials are either null or provide a JAAS method
ExecutionContext execContext;
if (credentials == null) {
- execContext = executionContextFactory.create();
+ execContext = executionContext;
} else {
try {
// Check if credentials provide a login context
@@ -222,7 +221,7 @@
if (loginContext == null) {
throw new
IllegalArgumentException(JcrI18n.credentialsMustReturnLoginContext.text(credentials.getClass()));
}
- execContext = executionContextFactory.create(loginContext);
+ execContext = executionContext.create(loginContext);
} catch (NoSuchMethodException error) {
// Check if credentials provide an access control context
try {
@@ -236,7 +235,7 @@
throw new IllegalArgumentException(
JcrI18n.credentialsMustReturnAccessControlContext.text(credentials.getClass()));
}
- execContext =
executionContextFactory.create(accessControlContext);
+ execContext = executionContext.create(accessControlContext);
} catch (NoSuchMethodException error2) {
throw new
IllegalArgumentException(JcrI18n.credentialsMustProvideJaasMethod.text(credentials.getClass()),
error2);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNamespaceRegistryTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNamespaceRegistryTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrNamespaceRegistryTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -30,7 +30,6 @@
import javax.jcr.NamespaceException;
import javax.jcr.UnsupportedRepositoryOperationException;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -45,8 +44,7 @@
@BeforeClass
public static void beforeClass() throws Exception {
- ExecutionContextFactory factory = TestUtil.getExecutionContextFactory();
- executionContext = factory.create();
+ executionContext = TestUtil.getExecutionContext();
}
@Before
@@ -105,7 +103,7 @@
assertThat(registry.getPrefix("http://www.jcp.org/jcr/1.0"),
is("jcr"));
assertThat(registry.getPrefix("http://www.jcp.org/jcr/mix/1.0"),
is("mix"));
assertThat(registry.getPrefix("http://www.jcp.org/jcr/nt/1.0"),
is("nt"));
-//
assertThat(registry.getPrefix("http://www.w3.org/XML/1998/namespace&...,
is("xml"));
+ //
assertThat(registry.getPrefix("http://www.w3.org/XML/1998/namespace&...,
is("xml"));
}
@Test
@@ -115,7 +113,7 @@
assertThat(registry.getURI("jcr"),
is("http://www.jcp.org/jcr/1.0"));
assertThat(registry.getURI("mix"),
is("http://www.jcp.org/jcr/mix/1.0"));
assertThat(registry.getURI("nt"),
is("http://www.jcp.org/jcr/nt/1.0"));
-// assertThat(registry.getURI("xml"),
is("http://www.w3.org/XML/1998/namespace"));
+ // assertThat(registry.getURI("xml"),
is("http://www.w3.org/XML/1998/namespace"));
}
@Test( expected = NamespaceException.class )
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -38,7 +38,6 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
import org.junit.Before;
@@ -56,8 +55,6 @@
@Mock
private Map<String, String> descriptors;
@Mock
- private ExecutionContextFactory executionContextFactory;
- @Mock
private RepositoryConnectionFactory connectionFactory;
@Mock
private ExecutionContext executionContext;
@@ -79,15 +76,14 @@
@Before
public void before() throws Exception {
MockitoAnnotations.initMocks(this);
- stub(executionContextFactory.create()).toReturn(executionContext);
-
stub(executionContextFactory.create(accessControlContext)).toReturn(executionContext);
+ stub(executionContext.create(accessControlContext)).toReturn(executionContext);
stub(connectionFactory.createConnection(JcrI18n.defaultWorkspaceName.text())).toReturn(connection);
- repository = new JcrRepository(descriptors, executionContextFactory,
connectionFactory);
+ repository = new JcrRepository(descriptors, executionContext,
connectionFactory);
}
@Test
public void shouldAllowNoDescriptors() {
- new JcrRepository(descriptors, executionContextFactory, connectionFactory);
+ new JcrRepository(descriptors, executionContext, connectionFactory);
}
@Test( expected = IllegalArgumentException.class )
@@ -97,7 +93,7 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowNoConnectionFactories() throws Exception {
- new JcrRepository(executionContextFactory, null);
+ new JcrRepository(executionContext, null);
}
@Test( expected = IllegalArgumentException.class )
@@ -122,7 +118,7 @@
@Test
public void shouldProvideBuiltInDescriptorsWhenNotSuppliedDescriptors() {
- Repository repository = new JcrRepository(descriptors, executionContextFactory,
connectionFactory);
+ Repository repository = new JcrRepository(descriptors, executionContext,
connectionFactory);
testDescriptorKeys(repository);
testDescriptorValues(repository);
}
@@ -131,7 +127,7 @@
public void shouldProvideUserSuppliedDescriptors() {
Map<String, String> descriptors = new HashMap<String, String>();
descriptors.put("property", "value");
- Repository repository = new JcrRepository(descriptors, executionContextFactory,
connectionFactory);
+ Repository repository = new JcrRepository(descriptors, executionContext,
connectionFactory);
testDescriptorKeys(repository);
testDescriptorValues(repository);
assertThat(repository.getDescriptor("property"),
is("value"));
@@ -152,7 +148,7 @@
@Test
public void shouldAllowLoginWithProperCredentials() throws Exception {
repository.login(credentials);
- stub(executionContextFactory.create(loginContext)).toReturn(executionContext);
+ stub(executionContext.create(loginContext)).toReturn(executionContext);
repository.login(new Credentials() {
private static final long serialVersionUID = 1L;
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java 2009-01-16 03:26:56
UTC (rev 711)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java 2009-01-16 20:03:39
UTC (rev 712)
@@ -47,7 +47,6 @@
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
@@ -77,13 +76,12 @@
@BeforeClass
public static void beforeClass() throws Exception {
- ExecutionContextFactory factory = TestUtil.getExecutionContextFactory();
- executionContext = factory.create();
+ executionContext = TestUtil.getExecutionContext();
simpleRepository = SimpleRepository.get(WORKSPACE_NAME);
simpleRepository.setProperty(executionContext, "/a/b",
"booleanProperty", true);
simpleRepository.setProperty(executionContext, "/a/b/c",
"stringProperty", "value");
connectionFactory = TestUtil.createJackRabbitConnectionFactory(simpleRepository,
executionContext);
- repository = new JcrRepository(factory, connectionFactory);
+ repository = new JcrRepository(executionContext, connectionFactory);
}
@AfterClass
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -28,7 +28,6 @@
import static org.junit.Assert.assertThat;
import javax.jcr.Session;
import javax.jcr.Workspace;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connector.SimpleRepository;
import org.junit.After;
import org.junit.AfterClass;
@@ -44,12 +43,11 @@
@BeforeClass
public static void beforeClass() throws Exception {
- ExecutionContextFactory factory = TestUtil.getExecutionContextFactory();
- JcrSessionTest.executionContext = factory.create();
+ JcrSessionTest.executionContext = TestUtil.getExecutionContext();
JcrSessionTest.simpleRepository =
SimpleRepository.get(JcrSessionTest.WORKSPACE_NAME);
JcrSessionTest.connectionFactory =
TestUtil.createJackRabbitConnectionFactory(JcrSessionTest.simpleRepository,
JcrSessionTest.executionContext);
- JcrSessionTest.repository = new JcrRepository(factory,
JcrSessionTest.connectionFactory);
+ JcrSessionTest.repository = new JcrRepository(JcrSessionTest.executionContext,
JcrSessionTest.connectionFactory);
}
@AfterClass
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TestUtil.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TestUtil.java 2009-01-16 03:26:56 UTC
(rev 711)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TestUtil.java 2009-01-16 20:03:39 UTC
(rev 712)
@@ -23,13 +23,9 @@
*/
package org.jboss.dna.jcr;
-import java.security.AccessControlContext;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext;
import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
import org.jboss.dna.graph.connector.SimpleRepository;
@@ -503,7 +499,7 @@
};
}
- public static ExecutionContextFactory getExecutionContextFactory() {
+ public static ExecutionContext getExecutionContext() {
final ExecutionContext context = new
ExecutionContext().create(Mockito.mock(LoginContext.class));
NamespaceRegistry registry = context.getNamespaceRegistry();
registry.register("dna", "http://www.jboss.org/dna/1.0");
@@ -515,40 +511,7 @@
registry.register("rep", "internal");
registry.register("sv", "http://www.jcp.org/jcr/sv/1.0");
registry.register("xs", "http://www.w3.org/2001/XMLSchema");
- return new ExecutionContextFactory() {
-
- public ExecutionContext create() {
- return context;
- }
-
- public ExecutionContext create( AccessControlContext accessControlContext )
{
- return context;
- }
-
- public ExecutionContext create( LoginContext loginContext ) {
- return context;
- }
-
- public ExecutionContext create( String name ) {
- return context;
- }
-
- public ExecutionContext create( String name,
- CallbackHandler callbackHandler ) {
- return context;
- }
-
- public ExecutionContext create( String name,
- Subject subject ) {
- return context;
- }
-
- public ExecutionContext create( String name,
- Subject subject,
- CallbackHandler callbackHandler ) {
- return context;
- }
- };
+ return context;
}
private static void createChildDefinition( SimpleRepository repository,
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -36,7 +36,6 @@
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
import org.jboss.dna.graph.connector.RepositoryConnectionPool;
@@ -107,7 +106,7 @@
private final ReadWriteLock sourcesLock = new ReentrantReadWriteLock();
private final CopyOnWriteArrayList<RepositoryConnectionPool> pools = new
CopyOnWriteArrayList<RepositoryConnectionPool>();
private RepositoryConnectionFactory delegate;
- private final ExecutionContextFactory executionContextFactory;
+ protected final ExecutionContext executionContext;
private final RepositoryContext repositoryContext;
/**
@@ -130,34 +129,36 @@
/**
* Create a new manager instance.
*
- * @param executionContextFactory the execution context factory, used by sources to
create {@link ExecutionContext} instances
+ * @param executionContext the execution context, which can be used used by sources
to create other {@link ExecutionContext}
+ * instances with different JAAS security contexts
* @throws IllegalArgumentException if the
<code>executionContextFactory</code> reference is null
*/
- public RepositoryLibrary( ExecutionContextFactory executionContextFactory ) {
- this(executionContextFactory, null);
+ public RepositoryLibrary( ExecutionContext executionContext ) {
+ this(executionContext, null);
}
/**
* Create a new manager instance.
*
- * @param executionContextFactory the execution context factory, used by sources to
create {@link ExecutionContext} instances
+ * @param executionContext the execution context, which can be used used by sources
to create other {@link ExecutionContext}
+ * instances with different JAAS security contexts
* @param delegate the connection factory to which this instance should delegate in
the event that a source is not found in
* this manager; may be null if there is no delegate
* @throws IllegalArgumentException if the
<code>executionContextFactory</code> reference is null
*/
- public RepositoryLibrary( ExecutionContextFactory executionContextFactory,
+ public RepositoryLibrary( ExecutionContext executionContext,
RepositoryConnectionFactory delegate ) {
- CheckArg.isNotNull(executionContextFactory,
"executionContextFactory");
+ CheckArg.isNotNull(executionContext, "executionContext");
this.delegate = delegate;
- this.executionContextFactory = executionContextFactory;
+ this.executionContext = executionContext;
this.repositoryContext = new RepositoryContext() {
/**
* {@inheritDoc}
*
- * @see
org.jboss.dna.graph.connector.RepositoryContext#getExecutionContextFactory()
+ * @see
org.jboss.dna.graph.connector.RepositoryContext#getExecutionContext()
*/
- public ExecutionContextFactory getExecutionContextFactory() {
- return RepositoryLibrary.this.getExecutionContextFactory();
+ public ExecutionContext getExecutionContext() {
+ return RepositoryLibrary.this.executionContext;
}
/**
@@ -175,8 +176,8 @@
/**
* @return executionContextFactory
*/
- public ExecutionContextFactory getExecutionContextFactory() {
- return executionContextFactory;
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
}
/**
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -44,7 +44,6 @@
import org.jboss.dna.common.text.NoOpEncoder;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
@@ -86,7 +85,6 @@
}
private RepositoryLibrary sources;
- private ExecutionContextFactory contextFactory;
private RepositoryService repositoryService;
private Api api = Api.JCR;
private String jaasContextName;
@@ -130,15 +128,12 @@
public void startRepositories() throws IOException, SAXException, NamingException {
if (repositoryService != null) return; // already started
- // Create the factory for execution contexts.
- contextFactory = new ExecutionContext();
-
// Create the execution context that we'll use for the services. If we'd
want to use JAAS, we'd create the context
// by supplying LoginContext, AccessControlContext, or even Subject with
CallbackHandlers. But no JAAS in this example.
- context = contextFactory.create();
+ context = new ExecutionContext();
// Create the library for the RepositorySource instances ...
- sources = new RepositoryLibrary(contextFactory);
+ sources = new RepositoryLibrary(context);
// Load into the source manager the repository source for the configuration
repository ...
InMemoryRepositorySource configSource = new InMemoryRepositorySource();
@@ -243,7 +238,7 @@
LoginContext loginContext = getLoginContext(); // will ask user to authenticate
if needed
switch (api) {
case JCR: {
- JcrRepository jcrRepository = new JcrRepository(contextFactory,
sources);
+ JcrRepository jcrRepository = new JcrRepository(context, sources);
Session session = null;
if (loginContext != null) {
Credentials credentials = new JaasCredentials(loginContext);
@@ -304,7 +299,7 @@
case DNA: {
try {
// Use the DNA Graph API to read the properties and children of the
node ...
- ExecutionContext context = loginContext != null ?
contextFactory.create(loginContext) : contextFactory.create();
+ ExecutionContext context = loginContext != null ?
this.context.create(loginContext) : this.context;
Graph graph = Graph.create(sourceName, sources, context);
org.jboss.dna.graph.Node node = graph.getNodeAt(pathToNode);
Modified:
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_for_sequencing.xml
===================================================================
---
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_for_sequencing.xml 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_for_sequencing.xml 2009-01-16
20:03:39 UTC (rev 712)
@@ -63,7 +63,7 @@
</listitem>
</itemizedlist>
</para>
- <para>As mentioned above, the <code>ExecutionContext</code> provides
access to a <code>SessionFactory</code> that is used
+ <para>As mentioned above, the <code>JcrExecutionContext</code>
provides access to a <code>SessionFactory</code> that is used
by JBoss DNA to establish sessions to your JCR repositories. Two implementations
are available:
<itemizedlist>
<listitem>
@@ -440,7 +440,7 @@
Credentials credentials = new SimpleCredentials(this.username,
this.password);
sessionFactory.registerCredentials(this.repositoryName + "/" +
this.workspaceName, credentials);
}
- this.executionContext = new SimpleExecutionContext(sessionFactory);
+ this.executionContext = new JcrExecutionContext(sessionFactory,
repositoryWorkspaceName);
// Create the sequencing service, passing in the execution context ...
this.sequencingService = new SequencingService();
Modified:
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_repositories.xml
===================================================================
---
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_repositories.xml 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/docs/gettingstarted/src/main/docbook/en-US/content/using_dna_repositories.xml 2009-01-16
20:03:39 UTC (rev 712)
@@ -81,13 +81,13 @@
<para>To set up the repository service, we need to first set up a few other
objects:
<itemizedlist>
<listitem>
- <para>A <emphasis>factory for execution contexts</emphasis>.
Execution contexts define the context (or environment)
+ <para>An <emphasis>execution contexts</emphasis>. Execution
contexts define the context (or environment)
in which the service runs and in which operations against repositories are
performed. <code>ExecutionContext</code>
instances can be created using JAAS application contexts, meaning that they
contain the information about the subject
that the software represents. Execution contexts also provide access to the all
of the factories and utilities
used throughout the services and components, and it is through this mechanism
that you can inject your own behavior.
- For example, if your application already had a notion of namespaces, you could
override the execution context's
- <code>NamespaceRegistry</code> to use the namespaces defined in your
application.</para>
+ For example, if your application already had a notion of namespaces, you could
create an execution context that
+ uses your own <code>NamespaceRegistry</code> implementation (which
would use the namespaces defined in your application).</para>
</listitem>
<listitem>
<para>A <emphasis>repository library</emphasis> that manages the
list of <code>RepositorySource</code> instances.
@@ -112,7 +112,7 @@
// Create the execution context that we'll use for the services. If we'd want
to use JAAS, we'd
// create the context by supplying LoginContext, AccessControlContext, or even Subject
with
// CallbackHandlers. But this example doesn't use JAAS in this example.
- ExecutionContext context = contextFactory.create();
+ ExecutionContext context = new ExecutionContext();
// Create the library for the RepositorySource instances ...
RepositoryLibrary sources = new RepositoryLibrary(context);
Modified: trunk/docs/reference/src/main/docbook/en-US/content/environment.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/environment.xml 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/docs/reference/src/main/docbook/en-US/content/environment.xml 2009-01-16
20:03:39 UTC (rev 712)
@@ -217,19 +217,18 @@
</para>
<programlisting>
&ExecutionContext; context1 = new &ExecutionContext;();
-&ExecutionContext; context2 = factory.create(); // same as 'context1'
// Create a context for a user, authenticating using JAAS ...
&LoginContext; loginContext = new
LoginContext("username",callbackHandler);
-&ExecutionContext; context3 = context1.create(new
LoginContext("username"));
+&ExecutionContext; context2 = context1.with(new LoginContext("username"));
// Create a context for the same user, authenticating using JAAS, and using a different
callback handler ...
&CallbackHandler; callbackHandler = ...
&LoginContext; loginContext = new
LoginContext("username",callbackHandler);
-&ExecutionContext; context4 = context1.create(loginContext);
+&ExecutionContext; context3 = context1.with(loginContext);
</programlisting>
<para>
- These contexts (or the context factory) can then be passed to the various components
as needed.
+ These contexts can then be passed to the various components as needed.
</para>
</sect1>
<sect1>
Modified: trunk/docs/reference/src/main/docbook/en-US/content/repositories.xml
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/content/repositories.xml 2009-01-16
03:26:56 UTC (rev 711)
+++ trunk/docs/reference/src/main/docbook/en-US/content/repositories.xml 2009-01-16
20:03:39 UTC (rev 712)
@@ -191,7 +191,7 @@
<itemizedlist>
<listitem>
<para>
- A &ExecutionContextFactory; instance, as discussed <link
linkend="execution-context">earlier</link>.
+ A &ExecutionContext; instance, as discussed <link
linkend="execution-context">earlier</link>.
</para>
</listitem>
<listitem>
@@ -221,8 +221,8 @@
<code>org.jboss.example.dna.repository.RepositoryClient</code> class.
</para>
<programlisting>
- // Create the top-level execution context (which is also a factory) ...
- &ExecutionContext; context = contextFactory.create();
+ // Create the top-level execution context with all standard components ...
+ &ExecutionContext; context = new ExecutionContext();
// Create the library for the RepositorySource instances ...
&RepositoryLibrary; sources = new &RepositoryLibrary;(context);
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-01-16 03:26:56 UTC (rev
711)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-01-16 20:03:39 UTC (rev
712)
@@ -61,7 +61,6 @@
<!ENTITY Results "<ulink
url='&API;graph/Results.html'><interface>Results</interface></ulink>">
<!ENTITY Location "<ulink
url='&API;graph/Location.html'><classname>Location</classname></ulink>">
<!ENTITY ExecutionContext "<ulink
url='&API;graph/ExecutionContext.html'><classname>ExecutionContext</classname></ulink>">
-<!ENTITY ExecutionContextFactory "<ulink
url='&API;graph/ExecutionContextFactory.html'><interface>ExecutionContextFactory</interface></ulink>">
<!ENTITY Name "<ulink
url='&API;graph/property/Name.html'><interface>Name</interface></ulink>">
<!ENTITY Path "<ulink
url='&API;graph/property/Path.html'><interface>Path</interface></ulink>">
<!ENTITY PathSegment "<ulink
url='&API;graph/property/Path.Segment.html'><interface>Path.Segment</interface></ulink>">
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -47,7 +47,6 @@
import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.Node;
@@ -474,14 +473,14 @@
}
protected ExecutionContext getExecutionContext() {
- ExecutionContextFactory factory =
getRepositoryContext().getExecutionContextFactory();
+ ExecutionContext factory = getRepositoryContext().getExecutionContext();
CallbackHandler handler = createCallbackHandler();
try {
String securityDomain = getSecurityDomain();
if (securityDomain != null || getUsername() != null) {
- return factory.create(securityDomain, handler);
+ return factory.with(securityDomain, handler);
}
- return factory.create();
+ return factory;
} catch (LoginException e) {
I18n msg = FederationI18n.unableToCreateExecutionContext;
throw new RepositorySourceException(getName(), msg.text(this.sourceName,
securityDomain), e);
Modified:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -40,7 +40,6 @@
import javax.security.auth.callback.CallbackHandler;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
@@ -93,7 +92,7 @@
@Mock
private RepositoryConnectionFactory connectionFactory;
@Mock
- private ExecutionContextFactory executionContextFactory;
+ private ExecutionContext executionContextFactory;
@Mock
private RepositoryContext repositoryContext;
@@ -110,8 +109,8 @@
securityDomain = "security domain";
stub(jndiContext.lookup(executionContextFactoryJndiName)).toReturn(executionContextFactory);
stub(jndiContext.lookup(repositoryConnectionFactoryJndiName)).toReturn(connectionFactory);
- stub(executionContextFactory.create(eq(securityDomain),
anyCallbackHandler())).toReturn(context);
-
stub(repositoryContext.getExecutionContextFactory()).toReturn(executionContextFactory);
+ stub(executionContextFactory.with(eq(securityDomain),
anyCallbackHandler())).toReturn(context);
+ stub(repositoryContext.getExecutionContext()).toReturn(executionContextFactory);
stub(repositoryContext.getRepositoryConnectionFactory()).toReturn(connectionFactory);
// Set up the federated repository source ...
Modified:
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/extensions/dna-connector-federation/src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceTest.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -44,7 +44,6 @@
import javax.security.auth.login.LoginException;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
import org.jboss.dna.graph.connector.RepositoryContext;
@@ -79,7 +78,7 @@
@Mock
private RepositoryConnectionFactory connectionFactory;
@Mock
- private ExecutionContextFactory executionContextFactory;
+ private ExecutionContext executionContextFactory;
@Mock
private RepositoryContext repositoryContext;
@@ -124,10 +123,10 @@
configRepositorySource.setRepositoryName(configRepository.getRepositoryName());
configRepositorySource.setName(configurationSourceName);
configRepositoryConnection = configRepositorySource.getConnection();
-
stub(repositoryContext.getExecutionContextFactory()).toReturn(executionContextFactory);
+ stub(repositoryContext.getExecutionContext()).toReturn(executionContextFactory);
stub(repositoryContext.getRepositoryConnectionFactory()).toReturn(connectionFactory);
stub(connectionFactory.createConnection(configurationSourceName)).toReturn(configRepositoryConnection);
- stub(executionContextFactory.create(eq(securityDomain),
anyCallbackHandler())).toReturn(context);
+ stub(executionContextFactory.with(eq(securityDomain),
anyCallbackHandler())).toReturn(context);
}
protected static CallbackHandler anyCallbackHandler() {
@@ -168,14 +167,14 @@
@Test( expected = RepositorySourceException.class )
public void shouldNotCreateConnectionWhenAuthenticationFails() throws Exception {
// Stub the execution context factory to throw a LoginException to simulate
failed authentication
- stub(executionContextFactory.create(eq(securityDomain),
anyCallbackHandler())).toThrow(new LoginException());
+ stub(executionContextFactory.with(eq(securityDomain),
anyCallbackHandler())).toThrow(new LoginException());
source.getConnection();
}
@Test( expected = NullPointerException.class )
public void
shouldPropogateAllExceptionsExceptLoginExceptionThrownFromExecutionContextFactory() throws
Exception {
// Stub the execution context factory to throw a LoginException to simulate
failed authentication
- stub(executionContextFactory.create(eq(securityDomain),
anyCallbackHandler())).toThrow(new NullPointerException());
+ stub(executionContextFactory.with(eq(securityDomain),
anyCallbackHandler())).toThrow(new NullPointerException());
source.getConnection();
}
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-01-16
03:26:56 UTC (rev 711)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-01-16
20:03:39 UTC (rev 712)
@@ -771,7 +771,7 @@
// Set the context class loader, so that the driver could be found ...
if (this.repositoryContext != null && this.driverClassloaderName
!= null) {
try {
- ExecutionContext context =
this.repositoryContext.getExecutionContextFactory().create();
+ ExecutionContext context =
this.repositoryContext.getExecutionContext();
ClassLoader loader =
context.getClassLoader(this.driverClassloaderName);
if (loader != null) {
Thread.currentThread().setContextClassLoader(loader);