DNA SVN: r1379 - in trunk: dna-jcr/src/test/java/org/jboss/dna/jcr and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 22:24:38 -0500 (Tue, 01 Dec 2009)
New Revision: 1379
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java
Log:
DNA-566 I created a package-level static final boolean WORKSPACES_SHARE_SYSTEM_BRANCH flag that may be changed to false when debugging so that the federated connector is not used. As stated above, this has implications for some connectors, and definitely cannot be changed in production without having some potentially serious deviations from JCR spec behavior with respect to the '/jcr:system' branch. However, it is very useful while debugging certain situations.
I added a new unit test to check that the flag is 'true', and this should always pass (except when debugging). This helps ensure that the value is not accidentally committed to SVN with a value of 'false'.
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-12-02 03:10:41 UTC (rev 1378)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-02 03:24:38 UTC (rev 1379)
@@ -104,6 +104,16 @@
public class JcrRepository implements Repository {
/**
+ * A flag that controls whether the repository uses a shared repository (or workspace) for the "/jcr:system" content in all of
+ * the workspaces. In production, this needs to be "true" for proper JCR functionality, but in some debugging cases it can be
+ * set to false to simplify the architecture by removing the federated connector layer.
+ * <p>
+ * This should be changed to 'false' only in advanced situations, and never for production.
+ * </p>
+ */
+ static final boolean WORKSPACES_SHARE_SYSTEM_BRANCH = true;
+
+ /**
* The available options for the {@code JcrRepository}.
*/
public enum Option {
@@ -405,23 +415,28 @@
ioe.printStackTrace();
throw new IllegalStateException("Could not access node type definition files", ioe);
}
- if (Boolean.valueOf(this.options.get(Option.PROJECT_NODE_TYPES))) {
- // Note that the node types are written directly to the system workspace.
- Path parentOfTypeNodes = pathFactory.create(systemPath, JcrLexicon.NODE_TYPES);
- this.repositoryTypeManager.projectOnto(systemGraph, parentOfTypeNodes);
- }
+ if (WORKSPACES_SHARE_SYSTEM_BRANCH) {
+ if (Boolean.valueOf(this.options.get(Option.PROJECT_NODE_TYPES))) {
+ // Note that the node types are written directly to the system workspace.
+ Path parentOfTypeNodes = pathFactory.create(systemPath, JcrLexicon.NODE_TYPES);
+ this.repositoryTypeManager.projectOnto(systemGraph, parentOfTypeNodes);
+ }
- // Create the projection for the system repository ...
- ProjectionParser projectionParser = ProjectionParser.getInstance();
- String rule = "/jcr:system => /jcr:system";
- Projection.Rule[] systemProjectionRules = projectionParser.rulesFromString(this.executionContext, rule);
- this.systemSourceProjection = new Projection(systemSourceName, systemWorkspaceName, true, systemProjectionRules);
+ // Create the projection for the system repository ...
+ ProjectionParser projectionParser = ProjectionParser.getInstance();
+ String rule = "/jcr:system => /jcr:system";
+ Projection.Rule[] systemProjectionRules = projectionParser.rulesFromString(this.executionContext, rule);
+ this.systemSourceProjection = new Projection(systemSourceName, systemWorkspaceName, true, systemProjectionRules);
- // Define the federated repository source. Use the same name as the repository, since this federated source
- // will not be in the connection factory ...
- this.federatedSource = new FederatedRepositorySource();
- this.federatedSource.setName("JCR " + repositorySourceName);
- this.federatedSource.initialize(new FederatedRepositoryContext(this.connectionFactory));
+ // Define the federated repository source. Use the same name as the repository, since this federated source
+ // will not be in the connection factory ...
+ this.federatedSource = new FederatedRepositorySource();
+ this.federatedSource.setName("JCR " + repositorySourceName);
+ this.federatedSource.initialize(new FederatedRepositoryContext(this.connectionFactory));
+ } else {
+ this.federatedSource = null;
+ this.systemSourceProjection = null;
+ }
this.lockManagers = new ConcurrentHashMap<String, WorkspaceLockManager>();
this.locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, DnaLexicon.LOCKS);
@@ -468,7 +483,15 @@
Graph createWorkspaceGraph( String workspaceName,
ExecutionContext workspaceContext ) {
- Graph graph = Graph.create(this.federatedSource, workspaceContext);
+ Graph graph = null;
+ if (WORKSPACES_SHARE_SYSTEM_BRANCH) {
+ // Connect via the federated source ...
+ assert this.federatedSource != null;
+ graph = Graph.create(this.federatedSource, workspaceContext);
+ } else {
+ // Otherwise, just create a graph directly to the connection factory ...
+ graph = Graph.create(this.sourceName, this.connectionFactory, workspaceContext);
+ }
graph.useWorkspace(workspaceName);
return graph;
}
@@ -671,8 +694,10 @@
// Verify that the workspace exists (or can be created) ...
Set<String> workspaces = graph.getWorkspaces();
if (!workspaces.contains(workspaceName)) {
- // Make sure there isn't a federated workspace ...
- this.federatedSource.removeWorkspace(workspaceName);
+ if (this.federatedSource != null) {
+ // Make sure there isn't a federated workspace ...
+ this.federatedSource.removeWorkspace(workspaceName);
+ }
// Per JCR 1.0 6.1.1, if the workspaceName is not recognized, a NoSuchWorkspaceException is thrown
throw new NoSuchWorkspaceException(JcrI18n.workspaceNameIsInvalid.text(sourceName, workspaceName));
}
@@ -686,16 +711,25 @@
}
}
- synchronized (this.federatedSource) {
- if (!this.federatedSource.hasWorkspace(workspaceName)) {
- // Add the workspace to the federated source ...
- ProjectionParser projectionParser = ProjectionParser.getInstance();
- Projection.Rule[] mirrorRules = projectionParser.rulesFromString(this.executionContext, "/ => /");
- List<Projection> projections = new ArrayList<Projection>(2);
- projections.add(new Projection(sourceName, workspaceName, false, mirrorRules));
- projections.add(this.systemSourceProjection);
- this.federatedSource.addWorkspace(workspaceName, projections, isDefault);
+ if (WORKSPACES_SHARE_SYSTEM_BRANCH) {
+ assert this.federatedSource != null;
+ assert this.systemSourceProjection != null;
+ synchronized (this.federatedSource) {
+ if (!this.federatedSource.hasWorkspace(workspaceName)) {
+ // Add the workspace to the federated source ...
+ ProjectionParser projectionParser = ProjectionParser.getInstance();
+ Projection.Rule[] mirrorRules = projectionParser.rulesFromString(this.executionContext, "/ => /");
+ List<Projection> projections = new ArrayList<Projection>(2);
+ projections.add(new Projection(sourceName, workspaceName, false, mirrorRules));
+ projections.add(this.systemSourceProjection);
+ this.federatedSource.addWorkspace(workspaceName, projections, isDefault);
+ }
}
+ } else {
+ // We're not sharing a '/jcr:system' branch, so we need to make sure there is one in the source.
+ // Note that this doesn't always work with some connectors (e.g., the FileSystem or SVN connectors)
+ // that don't allow arbitrary nodes.
+ initializeSystemContent(graph);
}
// Create the workspace, which will create its own session ...
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-12-02 03:10:41 UTC (rev 1378)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java 2009-12-02 03:24:38 UTC (rev 1379)
@@ -135,6 +135,12 @@
}
@Test
+ public void shouldFailIfWorkspacesSharingSystemBranchConstantIsFalse() {
+ // Check that the debugging flag is ALWAYS set to true...
+ assertThat(JcrRepository.WORKSPACES_SHARE_SYSTEM_BRANCH, is(true));
+ }
+
+ @Test
public void shouldAllowNullDescriptors() {
new JcrRepository(context, connectionFactory, sourceName, null, null);
}
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java 2009-12-02 03:10:41 UTC (rev 1378)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicModel.java 2009-12-02 03:24:38 UTC (rev 1379)
@@ -128,11 +128,11 @@
public RepositoryConnection createConnection( JpaSource source ) {
RepositoryContext repositoryContext = source.getRepositoryContext();
Observer observer = repositoryContext != null ? repositoryContext.getObserver() : null;
- return new BasicJpaConnection(getName(), observer, source.getCachePolicy(), source.getEntityManagers(),
- source.getRootUuid(),
- source.getDefaultWorkspaceName(), source.getPredefinedWorkspaceNames(),
- source.getLargeValueSizeInBytes(), source.isCreatingWorkspacesAllowed(),
- source.isCompressData(), source.isReferentialIntegrityEnforced());
+ return new BasicJpaConnection(source.getName(), observer, source.getCachePolicy(), source.getEntityManagers(),
+ source.getRootUuid(), source.getDefaultWorkspaceName(),
+ source.getPredefinedWorkspaceNames(), source.getLargeValueSizeInBytes(),
+ source.isCreatingWorkspacesAllowed(), source.isCompressData(),
+ source.isReferentialIntegrityEnforced());
}
}
14 years, 5 months
DNA SVN: r1378 - in trunk: dna-jcr/src/main/java/org/jboss/dna/jcr and 4 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-01 22:10:41 -0500 (Tue, 01 Dec 2009)
New Revision: 1378
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java
trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
Log:
DNA-565 JCR Implementation Should Support Anonymous Access More Easily
Committed patch that adds a JcrRepository.Option for ANONYMOUS_USER_ROLES. This defaults to null (indicating that an anonymous user will not be granted any roles and will not be able to log in). It can be set to a comma-delimited list of role names that will be provided to an anonymous user. A test case has been added at the JCR layer.
The patch also changes the REST server around a bit to accommodate this new access. If the requesting user is not authenticated, the REST code will now attempt to log in anonymously. I've tested this locally and it did work for me, but I couldn't figure out a good way to write test cases for it and still test the behavior when it's not enabled (short of creating a whole new subproject which doesn't seem worth it).
I added this line to the configRepository.xml in the dna-web-jcr-rest project to test the anonymous access:
<anonymousUserRoles jcr:primaryType="dna:option" value="connect,readonly"/>
This gave all unauthenticated users the ability to connect to the REST server and read-only privileges for all workspaces in all repositories.
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-12-01 16:01:17 UTC (rev 1377)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContext.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -26,7 +26,6 @@
import java.security.AccessControlContext;
import java.security.AccessController;
import java.util.UUID;
-import javax.security.auth.login.LoginException;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.component.ClassLoaderFactory;
import org.jboss.dna.common.component.StandardClassLoaderFactory;
@@ -300,10 +299,8 @@
* @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 with( SecurityContext securityContext ) throws LoginException {
+ public ExecutionContext with( SecurityContext securityContext ) {
return new ExecutionContext(this, securityContext);
}
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-12-01 16:01:17 UTC (rev 1377)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -29,6 +29,7 @@
import java.security.AccessControlException;
import java.security.AccessController;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
@@ -46,7 +47,6 @@
import javax.security.auth.Subject;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;
@@ -57,6 +57,7 @@
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.JaasSecurityContext;
+import org.jboss.dna.graph.SecurityContext;
import org.jboss.dna.graph.Subgraph;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
@@ -137,9 +138,15 @@
/**
* The depth of the subgraphs that should be loaded the connectors. The default value is 1.
*/
- READ_DEPTH;
+ READ_DEPTH,
/**
+ * A comma-delimited list of default roles provided for anonymous access. A null or empty value for this option means that
+ * anonymous access is disabled.
+ */
+ ANONYMOUS_USER_ROLES;
+
+ /**
* Determine the option given the option name. This does more than {@link Option#valueOf(String)}, since this method first
* tries to match the supplied string to the option's {@link Option#name() name}, then the uppercase version of the
* supplied string to the option's name, and finally if the supplied string is a camel-case version of the name (e.g.,
@@ -186,6 +193,11 @@
* The default value for the {@link Option#READ_DEPTH} option is {@value} .
*/
public static final String READ_DEPTH = "1";
+
+ /**
+ * The default value for the {@link Option#READ_DEPTH} option is {@value} .
+ */
+ public static final String ANONYMOUS_USER_ROLES = null;
}
/**
@@ -199,6 +211,7 @@
defaults.put(Option.PROJECT_NODE_TYPES, DefaultOption.PROJECT_NODE_TYPES);
defaults.put(Option.JAAS_LOGIN_CONFIG_NAME, DefaultOption.JAAS_LOGIN_CONFIG_NAME);
defaults.put(Option.READ_DEPTH, DefaultOption.READ_DEPTH);
+ defaults.put(Option.ANONYMOUS_USER_ROLES, DefaultOption.ANONYMOUS_USER_ROLES);
DEFAULT_OPTIONS = Collections.<Option, String>unmodifiableMap(defaults);
}
@@ -217,6 +230,7 @@
private final FederatedRepositorySource federatedSource;
private final Observer observer;
private final NamespaceRegistry persistentRegistry;
+ private final SecurityContext anonymousUserContext;
/**
* Creates a JCR repository that uses the supplied {@link RepositoryConnectionFactory repository connection factory} to
@@ -411,6 +425,34 @@
this.lockManagers = new ConcurrentHashMap<String, WorkspaceLockManager>();
this.locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, DnaLexicon.LOCKS);
+
+ /*
+ * Set up the anonymous role, if appropriate
+ */
+ SecurityContext anonymousUserContext = null;
+ String rawAnonRoles = options != null ? options.get(Option.ANONYMOUS_USER_ROLES) : null;
+ if (rawAnonRoles != null) {
+ String[] anonRoles = rawAnonRoles.split("\\s*,\\s*");
+ final List<String> roles = Arrays.asList(anonRoles);
+ if (anonRoles.length > 0) {
+ anonymousUserContext = new SecurityContext() {
+
+ public String getUserName() {
+ return null;
+ }
+
+ public boolean hasRole( String roleName ) {
+ return roles.contains(roleName);
+ }
+
+ public void logout() {
+ }
+
+ };
+ }
+ }
+
+ this.anonymousUserContext = anonymousUserContext;
}
protected void initializeSystemContent( Graph systemGraph ) {
@@ -563,16 +605,16 @@
Map<String, Object> sessionAttributes = new HashMap<String, Object>();
ExecutionContext execContext = null;
if (credentials == null) {
- try {
- Subject subject = Subject.getSubject(AccessController.getContext());
- if (subject == null) {
- throw new javax.jcr.LoginException(JcrI18n.mustBeInPrivilegedAction.text());
- }
+ Subject subject = Subject.getSubject(AccessController.getContext());
+ if (subject != null) {
execContext = executionContext.with(new JaasSecurityContext(subject));
- } catch (LoginException le) {
- // This really can't happen if you're creating the JAAS security context with an existing subject
- throw new IllegalStateException(le);
}
+ // Well. There's no JAAS subject. Try using an anonymous user (if that's enabled).
+ else if (anonymousUserContext != null) {
+ execContext = executionContext.with(this.anonymousUserContext);
+ } else {
+ throw new javax.jcr.LoginException(JcrI18n.mustBeInPrivilegedAction.text());
+ }
} else {
try {
if (credentials instanceof SimpleCredentials) {
Modified: trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties
===================================================================
--- trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties 2009-12-01 16:01:17 UTC (rev 1377)
+++ trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties 2009-12-02 03:10:41 UTC (rev 1378)
@@ -23,7 +23,7 @@
#
cannotConvertValue = Cannot convert {0} value to {1}
credentialsMustProvideJaasMethod = The Credentials class "{0}" must implement "public LoginContext getLoginContext();", be an instance of "javax.jcr.SimpleCredentials", or be an instance of "org.jboss.dna.jcr.SecurityContextCredentials"
-mustBeInPrivilegedAction=login() can only be called successfully from within a java.security.PrivilegedAction
+mustBeInPrivilegedAction=login() can only be called successfully from within a java.security.PrivilegedAction or when the ANONYMOUS_USER_ROLES repository option is set
credentialsMustReturnLoginContext = The "getLoginContext()" method in Credentials class "{0}" must not return a null
defaultWorkspaceName=
inputStreamConsumed = This value was already consumed as an input stream
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java 2009-12-01 16:01:17 UTC (rev 1377)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrConfigurationTest.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -249,6 +249,7 @@
options.put(Option.JAAS_LOGIN_CONFIG_NAME, "test");
options.put(Option.PROJECT_NODE_TYPES, DefaultOption.PROJECT_NODE_TYPES);
options.put(Option.READ_DEPTH, DefaultOption.READ_DEPTH);
+ options.put(Option.ANONYMOUS_USER_ROLES, DefaultOption.ANONYMOUS_USER_ROLES);
assertThat(repository.getOptions(), is(options));
}
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-12-01 16:01:17 UTC (rev 1377)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -26,6 +26,7 @@
import static org.hamcrest.collection.IsArrayContaining.hasItemInArray;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
+import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;
import java.security.AccessControlContext;
import java.security.AccessController;
@@ -226,6 +227,19 @@
}
@Test
+ public void shouldAllowLoginWithNoCredentialsIfAnonAccessEnabled() throws Exception {
+ Map<JcrRepository.Option, String> options = new HashMap<JcrRepository.Option, String>();
+ options.put(JcrRepository.Option.ANONYMOUS_USER_ROLES, JcrSession.DNA_READ_PERMISSION);
+ JcrRepository repository = new JcrRepository(context, connectionFactory, sourceName, descriptors, options);
+
+ session = (JcrSession)repository.login();
+
+ assertThat(session, is(notNullValue()));
+ assertThat(session.getUserID(), is(nullValue()));
+
+ }
+
+ @Test
public void shouldAllowLoginWithProperCredentials() throws Exception {
repository.login(credentials);
repository.login(new SecurityContextCredentials(
Modified: trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java
===================================================================
--- trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java 2009-12-01 16:01:17 UTC (rev 1377)
+++ trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/JcrResources.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -185,13 +185,7 @@
String rawRepositoryName,
String rawWorkspaceName ) throws RepositoryException {
assert request != null;
- assert request.getUserPrincipal() != null : "Request must be authorized";
- // Sanity check
- if (request.getUserPrincipal() == null) {
- throw new UnauthorizedException("Client is not authorized");
- }
-
return RepositoryFactory.getSession(request, repositoryNameFor(rawRepositoryName), workspaceNameFor(rawWorkspaceName));
}
Modified: trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java
===================================================================
--- trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java 2009-12-01 16:01:17 UTC (rev 1377)
+++ trunk/web/dna-web-jcr-rest/src/main/java/org/jboss/dna/web/jcr/rest/spi/DnaJcrRepositoryProvider.java 2009-12-02 03:10:41 UTC (rev 1378)
@@ -38,7 +38,6 @@
import org.jboss.dna.jcr.SecurityContextCredentials;
import org.jboss.dna.web.jcr.rest.ServletSecurityContext;
import org.jboss.resteasy.spi.NotFoundException;
-import org.jboss.resteasy.spi.UnauthorizedException;
import org.xml.sax.SAXException;
/**
@@ -102,13 +101,7 @@
String repositoryName,
String workspaceName ) throws RepositoryException {
assert request != null;
- assert request.getUserPrincipal() != null : "Request must be authorized";
- // Sanity check in case assertions are disabled
- if (request.getUserPrincipal() == null) {
- throw new UnauthorizedException("Client is not authorized");
- }
-
Repository repository;
try {
@@ -118,6 +111,11 @@
throw new NotFoundException(re.getMessage(), re);
}
+ // If there's no authenticated user, try an anonymous login
+ if (request.getUserPrincipal() == null) {
+ return repository.login(workspaceName);
+ }
+
return repository.login(new SecurityContextCredentials(new ServletSecurityContext(request)), workspaceName);
}
14 years, 5 months
DNA SVN: r1377 - in trunk: extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 11:01:17 -0500 (Tue, 01 Dec 2009)
New Revision: 1377
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphSequencerOutput.java
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlSequencer.java
Log:
Added assertion check for the GraphSequencerOutput implementation to prevent sequencers from setting property values that are Iterator<?> (which is a common mistake if using Property objects in the sequencer and using output.setProperty(path,name,property.getValues()).)
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphSequencerOutput.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphSequencerOutput.java 2009-12-01 15:46:19 UTC (rev 1376)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphSequencerOutput.java 2009-12-01 16:01:17 UTC (rev 1377)
@@ -24,6 +24,7 @@
package org.jboss.dna.graph.io;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
@@ -77,6 +78,7 @@
public void setProperty( String nodePath,
String propertyName,
Object... values ) {
+ assert valuesAreNotIterators(values);
Path path = pathFactory.create(nodePath);
if (paths.add(path)) {
batch.create(path).and();
@@ -93,6 +95,7 @@
public void setProperty( Path nodePath,
Name propertyName,
Object... values ) {
+ assert valuesAreNotIterators(values);
if (paths.add(nodePath)) {
batch.create(nodePath).and();
}
@@ -118,4 +121,19 @@
batch.execute();
}
+ /**
+ * Utility method to ensure that the value objects are not {@link Iterator} instances. This may be a common mistake if the
+ * sequencer calls the {@link #setProperty(Path, Name, Object...)} or {@link #setProperty(String, String, Object...)} methods
+ * with <code>output.setProperty(path, property.getName(), property.getValues());</code>
+ *
+ * @param values the values
+ * @return true if the values are not iterators, or false if they are
+ */
+ private final boolean valuesAreNotIterators( Object... values ) {
+ for (Object value : values) {
+ if (value instanceof Iterator<?>) return false;
+ }
+ return true;
+ }
+
}
Modified: trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlSequencer.java
===================================================================
--- trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlSequencer.java 2009-12-01 15:46:19 UTC (rev 1376)
+++ trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlSequencer.java 2009-12-01 16:01:17 UTC (rev 1377)
@@ -120,7 +120,7 @@
public void create( Path path,
List<Property> properties ) {
for (Property property : properties) {
- output.setProperty(path, property.getName(), property.getValues());
+ output.setProperty(path, property.getName(), property.getValuesAsArray());
}
}
@@ -133,9 +133,9 @@
public void create( Path path,
Property firstProperty,
Property... additionalProperties ) {
- output.setProperty(path, firstProperty.getName(), firstProperty.getValues());
+ output.setProperty(path, firstProperty.getName(), firstProperty.getValuesAsArray());
for (Property property : additionalProperties) {
- output.setProperty(path, property.getName(), property.getValues());
+ output.setProperty(path, property.getName(), property.getValuesAsArray());
}
}
@@ -148,7 +148,7 @@
public void setProperties( Path path,
Property... properties ) {
for (Property property : properties) {
- output.setProperty(path, property.getName(), property.getValues());
+ output.setProperty(path, property.getName(), property.getValuesAsArray());
}
}
14 years, 5 months
DNA SVN: r1376 - in trunk/dna-search: src/test/java/org/jboss/dna/search/query and 1 other directory.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 10:46:19 -0500 (Tue, 01 Dec 2009)
New Revision: 1376
Modified:
trunk/dna-search/pom.xml
trunk/dna-search/src/test/java/org/jboss/dna/search/query/NotQueryTest.java
Log:
DNA-562 Upgraded Lucene to the latest release (3.0.0), which was made just last week and contains only removal of deprecated APIs.
Modified: trunk/dna-search/pom.xml
===================================================================
--- trunk/dna-search/pom.xml 2009-12-01 15:20:21 UTC (rev 1375)
+++ trunk/dna-search/pom.xml 2009-12-01 15:46:19 UTC (rev 1376)
@@ -45,22 +45,22 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
- <version>2.9.1</version>
+ <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
- <version>2.9.1</version>
+ <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-snowball</artifactId>
- <version>2.9.1</version>
+ <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-regex</artifactId>
- <version>2.9.1</version>
+ <version>3.0.0</version>
</dependency>
<!--
Testing (note the scope)
Modified: trunk/dna-search/src/test/java/org/jboss/dna/search/query/NotQueryTest.java
===================================================================
--- trunk/dna-search/src/test/java/org/jboss/dna/search/query/NotQueryTest.java 2009-12-01 15:20:21 UTC (rev 1375)
+++ trunk/dna-search/src/test/java/org/jboss/dna/search/query/NotQueryTest.java 2009-12-01 15:46:19 UTC (rev 1376)
@@ -35,7 +35,6 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Similarity;
-import org.jboss.dna.search.query.NotQuery;
import org.junit.Test;
public class NotQueryTest {
@@ -104,6 +103,29 @@
/**
* {@inheritDoc}
*
+ * @see org.apache.lucene.search.DocIdSetIterator#advance(int)
+ */
+ @Override
+ public int advance( int target ) {
+ int doc;
+ while ((doc = nextDoc()) < target) {
+ }
+ return doc;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.lucene.search.DocIdSetIterator#docID()
+ */
+ @Override
+ public int docID() {
+ return nextDoc();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.apache.lucene.search.DocIdSetIterator#nextDoc()
*/
@Override
14 years, 5 months
DNA SVN: r1375 - in trunk/dna-graph/src: main/java/org/jboss/dna/graph/request and 4 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 10:20:21 -0500 (Tue, 01 Dec 2009)
New Revision: 1375
Added:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/FullTextSearchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/QueryRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SearchRequest.java
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySourceTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/io/GraphSequencerOutputTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/search/SearchEngineTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/session/GraphSessionTest.java
Log:
DNA-467 Fixed the previous commmit, which had several missing changes.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -31,7 +31,9 @@
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.cache.CachePolicy;
import org.jboss.dna.graph.connector.RepositoryConnection;
+import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySourceException;
+import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.request.Request;
import org.jboss.dna.graph.request.processor.RequestProcessor;
@@ -101,8 +103,9 @@
sw.start();
}
// Do any commands update/write?
- RequestProcessor processor = new MapRequestProcessor(context, this.repository, this.source.getRepositoryContext()
- .getObserver());
+ RepositoryContext repositoryContext = this.source.getRepositoryContext();
+ Observer observer = repositoryContext != null ? repositoryContext.getObserver() : null;
+ RequestProcessor processor = new MapRequestProcessor(context, this.repository, observer);
Lock lock = request.isReadOnly() ? repository.getLock().readLock() : repository.getLock().writeLock();
lock.lock();
Added: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/FullTextSearchRequest.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/FullTextSearchRequest.java (rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/FullTextSearchRequest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -0,0 +1,117 @@
+/*
+ * 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.request;
+
+import org.jboss.dna.common.util.CheckArg;
+
+/**
+ * A {@link Request} to perform a full-text search on a graph.
+ */
+public class FullTextSearchRequest extends SearchRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String expression;
+ private final String workspaceName;
+
+ /**
+ * Create a new request to execute the supplied query against the name workspace.
+ *
+ * @param fullTextSearch the full-text search to be performed; may not be null
+ * @param workspace the name of the workspace to be queried
+ * @throws IllegalArgumentException if the query or workspace name is null
+ */
+ public FullTextSearchRequest( String fullTextSearch,
+ String workspace ) {
+ CheckArg.isNotEmpty(fullTextSearch, "fullTextSearch");
+ CheckArg.isNotNull(workspace, "workspace");
+ this.expression = fullTextSearch;
+ this.workspaceName = workspace;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.Request#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ /**
+ * Get the full-text search expression that is to be executed.
+ *
+ * @return the full-text search expression; never null and never empty
+ */
+ public String expression() {
+ return expression;
+ }
+
+ /**
+ * Get the name of the workspace in which the node exists.
+ *
+ * @return the name of the workspace; never null
+ */
+ public String workspace() {
+ return workspaceName;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return expression.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (obj == this) return true;
+ if (this.getClass().isInstance(obj)) {
+ FullTextSearchRequest that = (FullTextSearchRequest)obj;
+ if (!this.expression().equals(that.expression())) return false;
+ if (!this.workspace().equals(that.workspace())) return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "search the \"" + workspaceName + "\" workspace with \"" + expression + "\"";
+ }
+}
Property changes on: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/FullTextSearchRequest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/QueryRequest.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/QueryRequest.java (rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/QueryRequest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -0,0 +1,184 @@
+/*
+ * 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.request;
+
+import java.util.Collections;
+import java.util.Map;
+import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.graph.query.model.QueryCommand;
+import org.jboss.dna.graph.query.model.Visitors;
+import org.jboss.dna.graph.query.plan.PlanHints;
+import org.jboss.dna.graph.query.validate.Schemata;
+
+/**
+ * A {@link Request} to query a graph.
+ */
+public class QueryRequest extends SearchRequest {
+
+ private static final Map<String, Object> EMPTY_VARIABLES = Collections.emptyMap();
+
+ private static final long serialVersionUID = 1L;
+
+ private final QueryCommand query;
+ private final String workspaceName;
+ private final Map<String, Object> variables;
+ private final PlanHints hints;
+ private final transient Schemata schemata;
+
+ /**
+ * Create a new request to execute the supplied query against the name workspace.
+ *
+ * @param query the query to be executed
+ * @param workspace the name of the workspace to be queried
+ * @throws IllegalArgumentException if the query or workspace name is null
+ */
+ public QueryRequest( QueryCommand query,
+ String workspace ) {
+ CheckArg.isNotNull(query, "query");
+ CheckArg.isNotNull(workspace, "workspace");
+ this.query = query;
+ this.workspaceName = workspace;
+ this.variables = EMPTY_VARIABLES;
+ this.hints = null;
+ this.schemata = null;
+ }
+
+ /**
+ * Create a new request to execute the supplied query against the name workspace.
+ *
+ * @param query the query to be executed
+ * @param workspace the name of the workspace to be queried
+ * @param variables the variables that are available to be substituted upon execution; may be null if there are no variables
+ * @param hints the hints; may be null if there are no hints
+ * @param schemata the schemata defining the structure of the tables that may be queried, or null if the default schemata
+ * should be used
+ * @throws IllegalArgumentException if the query or workspace name is null
+ */
+ public QueryRequest( QueryCommand query,
+ String workspace,
+ Map<String, Object> variables,
+ PlanHints hints,
+ Schemata schemata ) {
+ CheckArg.isNotNull(query, "query");
+ CheckArg.isNotNull(workspace, "workspace");
+ this.query = query;
+ this.workspaceName = workspace;
+ this.variables = variables != null ? variables : EMPTY_VARIABLES;
+ this.hints = hints;
+ this.schemata = schemata;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.Request#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ /**
+ * Get the query that is to be executed.
+ *
+ * @return the query; never null
+ */
+ public QueryCommand query() {
+ return query;
+ }
+
+ /**
+ * Get the name of the workspace in which the node exists.
+ *
+ * @return the name of the workspace; never null
+ */
+ public String workspace() {
+ return workspaceName;
+ }
+
+ /**
+ * The variables that are available to be substituted upon execution.
+ *
+ * @return the variables; never null but possibly empty
+ */
+ public Map<String, Object> variables() {
+ return variables;
+ }
+
+ /**
+ * Get the hints for the query.
+ *
+ * @return the hints, or null if there are no hints
+ */
+ public PlanHints hints() {
+ return hints;
+ }
+
+ /**
+ * Get the schemata that defines the structure of the tables that may be queried.
+ *
+ * @return the schemata, or null if the default schemata should be used
+ */
+ public Schemata schemata() {
+ return schemata;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return query.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ if (obj == this) return true;
+ if (this.getClass().isInstance(obj)) {
+ QueryRequest that = (QueryRequest)obj;
+ if (!this.query().equals(that.query())) return false;
+ if (!this.workspace().equals(that.workspace())) return false;
+ if (!this.variables().equals(that.variables())) return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "query the \"" + workspaceName + "\" workspace with \"" + Visitors.readable(query) + "\"";
+ }
+}
Property changes on: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/QueryRequest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SearchRequest.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SearchRequest.java (rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SearchRequest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ * 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.request;
+
+import org.jboss.dna.graph.query.QueryResults;
+
+/**
+ * A {@link Request} to search or query a graph.
+ */
+public abstract class SearchRequest extends Request {
+
+ private static final long serialVersionUID = 1L;
+
+ private QueryResults results;
+
+ /**
+ * Set the results for this request.
+ *
+ * @param results the results
+ */
+ public void setResults( QueryResults results ) {
+ this.results = results;
+ }
+
+ /**
+ * Get the results of this query.
+ *
+ * @return the results of the query, or null if this request has not been processed
+ */
+ public QueryResults getResults() {
+ return results;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.Request#cancel()
+ */
+ @Override
+ public void cancel() {
+ super.cancel();
+ this.results = null;
+ }
+
+}
Property changes on: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SearchRequest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -96,12 +96,8 @@
configRepositorySource = new InMemoryRepositorySource();
configRepositorySource.setName("Configuration Repository");
configRepositorySource.setDefaultWorkspaceName(configurationWorkspaceName);
- Graph config = Graph.create(configRepositorySource, context);
- config.create("/a").and();
- config.create("/a/b").and();
- config.create("/a/b/Test Repository").and();
- config.create("/a/b/Test Repository/dna:workspaces").and();
+ // Set up the repository context ...
repositoryContext = new RepositoryContext() {
public ExecutionContext getExecutionContext() {
return context;
@@ -123,7 +119,15 @@
return result.getSubgraphOfDepth(depth).at("/a/b/Test Repository");
}
};
+ configRepositorySource.initialize(repositoryContext);
+ // Populate the configuration repository ...
+ Graph config = Graph.create(configRepositorySource, context);
+ config.create("/a").and();
+ config.create("/a/b").and();
+ config.create("/a/b/Test Repository").and();
+ config.create("/a/b/Test Repository/dna:workspaces").and();
+
// Set up the source ...
source = new FederatedRepositorySource();
source.setName(repositoryName);
@@ -217,6 +221,7 @@
return newSource.getConnection();
}
});
+ source.initialize(repositoryContext);
}
// Make sure there's a workspace for it ...
Graph sourceGraph = Graph.create(sourceName, connectionFactory, context);
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySourceTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySourceTest.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/FederatedRepositorySourceTest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -107,6 +107,7 @@
return result.getSubgraphOfDepth(depth).at("/a/b/Test Repository");
}
};
+ configRepositorySource.initialize(repositoryContext);
source = new FederatedRepositorySource();
source.setName(repositoryName);
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/io/GraphSequencerOutputTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/io/GraphSequencerOutputTest.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/io/GraphSequencerOutputTest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -29,7 +29,10 @@
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Subgraph;
+import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
+import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.junit.Before;
@@ -47,8 +50,31 @@
public void beforeEach() {
context = new ExecutionContext();
- InMemoryRepositorySource source = new InMemoryRepositorySource();
+ final InMemoryRepositorySource source = new InMemoryRepositorySource();
source.setName("actual");
+ RepositoryContext repositoryContext = new RepositoryContext() {
+ @SuppressWarnings( "synthetic-access" )
+ public ExecutionContext getExecutionContext() {
+ return context;
+ }
+
+ public Observer getObserver() {
+ return null;
+ }
+
+ public RepositoryConnectionFactory getRepositoryConnectionFactory() {
+ return null;
+ }
+
+ @SuppressWarnings( "synthetic-access" )
+ public Subgraph getConfiguration( int depth ) {
+ Graph result = Graph.create(source, context);
+ result.useWorkspace("configSpace");
+ return result.getSubgraphOfDepth(depth).at("/");
+ }
+ };
+ source.initialize(repositoryContext);
+
graph = Graph.create(source, context);
output = new GraphSequencerOutput(graph);
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/search/SearchEngineTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/search/SearchEngineTest.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/search/SearchEngineTest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -39,10 +39,13 @@
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.Node;
+import org.jboss.dna.graph.Subgraph;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
+import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySourceException;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.query.QueryContext;
import org.jboss.dna.graph.query.model.Query;
@@ -77,6 +80,28 @@
// Set up the source and graph instance ...
source = new InMemoryRepositorySource();
source.setName(sourceName);
+ RepositoryContext repositoryContext = new RepositoryContext() {
+ @SuppressWarnings( "synthetic-access" )
+ public ExecutionContext getExecutionContext() {
+ return context;
+ }
+
+ public Observer getObserver() {
+ return null;
+ }
+
+ public RepositoryConnectionFactory getRepositoryConnectionFactory() {
+ return null;
+ }
+
+ @SuppressWarnings( "synthetic-access" )
+ public Subgraph getConfiguration( int depth ) {
+ Graph result = Graph.create(source, context);
+ result.useWorkspace("configSpace");
+ return result.getSubgraphOfDepth(depth).at("/");
+ }
+ };
+ source.initialize(repositoryContext);
content = Graph.create(source, context);
// Create the workspaces ...
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/session/GraphSessionTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/session/GraphSessionTest.java 2009-12-01 15:19:45 UTC (rev 1374)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/session/GraphSessionTest.java 2009-12-01 15:20:21 UTC (rev 1375)
@@ -35,10 +35,13 @@
import org.jboss.dna.common.statistic.Stopwatch;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.Subgraph;
import org.jboss.dna.graph.connector.RepositoryConnection;
import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
+import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySourceException;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
@@ -79,6 +82,28 @@
return null;
}
};
+
+ RepositoryContext repositoryContext = new RepositoryContext() {
+ public ExecutionContext getExecutionContext() {
+ return context;
+ }
+
+ public Observer getObserver() {
+ return null;
+ }
+
+ public RepositoryConnectionFactory getRepositoryConnectionFactory() {
+ return null;
+ }
+
+ public Subgraph getConfiguration( int depth ) {
+ Graph result = Graph.create(source, context);
+ result.useWorkspace("configSpace");
+ return result.getSubgraphOfDepth(depth).at("/");
+ }
+ };
+ source.initialize(repositoryContext);
+
store = Graph.create(source.getName(), connectionFactory, context);
// Load the store with content ...
14 years, 5 months
DNA SVN: r1374 - trunk.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 10:19:45 -0500 (Tue, 01 Dec 2009)
New Revision: 1374
Modified:
trunk/.gitignore
trunk/pom.xml
Log:
DNA-467 Corrected the POM file and the .gitignore file, which referenced a project that has not been committed.
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2009-12-01 15:19:31 UTC (rev 1373)
+++ trunk/.gitignore 2009-12-01 15:19:45 UTC (rev 1374)
@@ -52,7 +52,6 @@
/extensions/dna-connector-infinispan/target
/extensions/dna-connector-jdbc-metadata/target
/extensions/dna-connector-store-jpa/target
-/extensions/dna-connector-store-lucene/target
/extensions/dna-connector-svn/target
/extensions/dna-mimetype-detector-aperture/.settings
/extensions/dna-mimetype-detector-aperture/target
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-01 15:19:31 UTC (rev 1373)
+++ trunk/pom.xml 2009-12-01 15:19:45 UTC (rev 1374)
@@ -139,7 +139,6 @@
<module>extensions/dna-connector-jbosscache</module>
<module>extensions/dna-connector-svn</module>
<module>extensions/dna-connector-store-jpa</module>
- <module>extensions/dna-connector-store-lucene</module>
<module>extensions/dna-mimetype-detector-aperture</module>
<!--module>extensions/dna-common-jdbc</module-->
<!--module>extensions/dna-connector-jdbc-metadata</module-->
14 years, 5 months
DNA SVN: r1373 - in trunk: dna-common/src/main/java/org/jboss/dna/common/collection and 10 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-01 10:19:31 -0500 (Tue, 01 Dec 2009)
New Revision: 1373
Modified:
trunk/.gitignore
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepository.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapWorkspace.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/QueryResults.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/AllNodes.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/And.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Between.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/BindVariableName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNodeJoinCondition.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Column.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Command.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Comparison.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Constraint.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNodeJoinCondition.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DynamicOperand.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/EquiJoinCondition.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearch.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearchScore.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Join.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/JoinCondition.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LanguageObject.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Length.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Limit.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Literal.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LowerCase.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NamedSelector.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeDepth.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeLocalName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodePath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Not.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Or.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Ordering.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyExistence.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyValue.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Query.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/QueryCommand.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNodeJoinCondition.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Selector.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SelectorName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetCriteria.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetQuery.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Source.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/StaticOperand.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/TypeSystem.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/UpperCase.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/optimize/RewriteAsRangeCriteria.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/PlanHints.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResultColumns.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResults.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
trunk/pom.xml
Log:
DNA-467 Made the abstract query model classes implement Serializable so they can be used in Request objects. Also did the same for the Location and Problems class families.
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/.gitignore 2009-12-01 15:19:31 UTC (rev 1373)
@@ -52,6 +52,7 @@
/extensions/dna-connector-infinispan/target
/extensions/dna-connector-jdbc-metadata/target
/extensions/dna-connector-store-jpa/target
+/extensions/dna-connector-store-lucene/target
/extensions/dna-connector-svn/target
/extensions/dna-mimetype-detector-aperture/.settings
/extensions/dna-mimetype-detector-aperture/target
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/AbstractProblems.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,6 +33,7 @@
* were encountered (although this cannot be guaranteed in contexts involving multiple threads or processes).
*/
public abstract class AbstractProblems implements Problems {
+ private static final long serialVersionUID = 1L;
protected static final List<Problem> EMPTY_PROBLEMS = Collections.emptyList();
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableProblems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableProblems.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ImmutableProblems.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -34,6 +34,7 @@
@Immutable
public class ImmutableProblems implements Problems {
+ private static final long serialVersionUID = 1L;
private final Problems delegate;
public ImmutableProblems( Problems delegate ) {
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problems.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.common.collection;
+import java.io.Serializable;
import java.util.Iterator;
import org.jboss.dna.common.i18n.I18n;
@@ -30,7 +31,7 @@
* An interface for a collection of {@link Problem} objects, with multiple overloaded methods for adding errors, warnings, and
* informational messages.
*/
-public interface Problems extends Iterable<Problem> {
+public interface Problems extends Iterable<Problem>, Serializable {
/**
* Add an error message with the parameters that should be used when localizing the message.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/SimpleProblems.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -34,6 +34,7 @@
*/
@NotThreadSafe
public class SimpleProblems extends AbstractProblems {
+ private static final long serialVersionUID = 1L;
private List<Problem> problems;
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/ThreadSafeProblems.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -37,6 +37,7 @@
*/
@ThreadSafe
public class ThreadSafeProblems extends AbstractProblems {
+ private static final long serialVersionUID = 1L;
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final List<Problem> problems = new LinkedList<Problem>();
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -40,9 +40,9 @@
/**
* Maintains the list of component instances for the system. This class does not actively update the component configurations, but
- * is designed to properly maintain the sequencer instances when those configurations are changed by other callers. If the
- * components are subclasses of {@link Component}, then they will be {@link Component#setConfiguration(ComponentConfig)
- * configured} with the appropriate configuration.
+ * is designed to properly maintain the instances when those configurations are changed by other callers. If the components are
+ * subclasses of {@link Component}, then they will be {@link Component#setConfiguration(ComponentConfig) configured} with the
+ * appropriate configuration.
* <p>
* Therefore, this library does guarantee that the {@link #getInstances() instances} at the time they are {@link #getInstances()
* obtained} are always reflected by the configurations.
@@ -106,7 +106,7 @@
}
/**
- * Set the Maven Repository that should be used to load the sequencer classes. Unless changed, the library uses the
+ * Set the Maven Repository that should be used to load the component classes. Unless changed, the library uses the
* {@link #DEFAULT default} class loader factory, which uses the {@link Thread#getContextClassLoader() current thread's
* context class loader} if not null or the class loader that loaded the library class.
*
@@ -120,7 +120,7 @@
}
/**
- * Add the configuration for a sequencer, or update any existing one that represents the {@link ConfigType#equals(Object) same
+ * Add the configuration for a component, or update any existing one that represents the {@link ConfigType#equals(Object) same
* configuration}
*
* @param config the new configuration
@@ -161,7 +161,25 @@
}
/**
- * Update the configuration for a sequencer, or add it if there is no {@link ConfigType#equals(Object) matching configuration}
+ * Get the instance given by the configuration with the supplied name.
+ *
+ * @param name the configuration name
+ * @return the instance, or null if the configuration doesn't exist
+ */
+ public ComponentType getInstance( String name ) {
+ CheckArg.isNotNull(name, "name");
+ try {
+ this.lock.lock();
+ // Find an existing configuration that matches ...
+ int index = findIndexOfMatchingConfiguration(name);
+ return index >= 0 ? this.instances.get(index) : null;
+ } finally {
+ this.lock.unlock();
+ }
+ }
+
+ /**
+ * Update the configuration for a component, or add it if there is no {@link ConfigType#equals(Object) matching configuration}
* .
*
* @param config the updated (or new) configuration
@@ -176,7 +194,7 @@
}
/**
- * Remove the configuration for a sequencer.
+ * Remove the configuration for a component.
*
* @param config the configuration to be removed
* @return true if the component was remove, or false if there was no existing configuration
@@ -191,7 +209,7 @@
// Find an existing configuration that matches ...
int index = findIndexOfMatchingConfiguration(config);
if (index >= 0) {
- // Remove the configuration and the sequencer instance ...
+ // Remove the configuration and the component instance ...
this.configs.remove(index);
this.instances.remove(index);
return true;
@@ -226,21 +244,21 @@
}
/**
- * Return the list of sequencers.
+ * Return the list of components.
*
- * @return the unmodifiable list of sequencers; never null
+ * @return the unmodifiable list of components; never null
*/
public List<ComponentType> getInstances() {
return this.unmodifiableInstances;
}
/**
- * Instantiate, configure and return a new sequencer described by the supplied configuration. This method does not manage the
+ * Instantiate, configure and return a new component described by the supplied configuration. This method does not manage the
* returned instance.
*
- * @param config the configuration describing the sequencer
- * @return the new sequencer, or null if the sequencer could not be successfully configured
- * @throws IllegalArgumentException if the sequencer could not be configured properly
+ * @param config the configuration describing the component
+ * @return the new component, or null if the component could not be successfully configured
+ * @throws IllegalArgumentException if the component could not be configured properly
*/
@SuppressWarnings( "unchecked" )
protected ComponentType newInstance( ConfigType config ) {
@@ -288,7 +306,7 @@
}
/**
- * Find the index for the matching {@link #configs configuration} and {@link #instances sequencer}.
+ * Find the index for the matching {@link #configs configuration} and {@link #instances component}.
*
* @param config the configuration; may not be null
* @return the index, or -1 if not found
@@ -306,4 +324,22 @@
return -1;
}
+ /**
+ * Find the index for the matching {@link #configs configuration} and {@link #instances component}.
+ *
+ * @param name the configuration name; may not be null
+ * @return the index, or -1 if not found
+ */
+ @GuardedBy( value = "lock" )
+ protected int findIndexOfMatchingConfiguration( String name ) {
+ // Iterate through the configurations and look for an existing one that matches
+ for (int i = 0, length = this.configs.size(); i != length; i++) {
+ ConfigType existingConfig = this.configs.get(i);
+ assert existingConfig != null;
+ if (existingConfig.getName().equals(name)) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.graph;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
@@ -45,8 +46,10 @@
* in this base class to allow immutable subclasses to calculate and cache the hash code during object construction.
*/
@Immutable
-public abstract class Location implements Iterable<Property>, Comparable<Location> {
+public abstract class Location implements Iterable<Property>, Comparable<Location>, Serializable {
+ private static final long serialVersionUID = 1L;
+
private static final Comparator<Location> COMPARATOR = new Comparator<Location>() {
/**
* {@inheritDoc}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -41,6 +41,8 @@
@Immutable
class LocationWithPath extends Location {
+ private static final long serialVersionUID = 1L;
+
private final Path path;
private final int hashCode;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -27,9 +27,7 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-
import net.jcip.annotations.Immutable;
-
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
@@ -43,6 +41,8 @@
@Immutable
class LocationWithPathAndProperties extends LocationWithPath {
+ private static final long serialVersionUID = 1L;
+
private final List<Property> idProperties;
/**
@@ -53,7 +53,7 @@
*/
LocationWithPathAndProperties( Path path,
List<Property> idProperties ) {
- super(path);
+ super(path);
assert idProperties != null;
assert !idProperties.isEmpty();
this.idProperties = Collections.unmodifiableList(idProperties);
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -41,6 +41,8 @@
@Immutable
class LocationWithPathAndProperty extends LocationWithPathAndProperties {
+ private static final long serialVersionUID = 1L;
+
/**
* Create a new location with a given path and identification property.
*
@@ -84,14 +86,14 @@
/**
* {@inheritDoc}
- *
+ *
* @see org.jboss.dna.graph.LocationWithPathAndProperties#hasIdProperties()
*/
@Override
public final boolean hasIdProperties() {
return true;
}
-
+
/**
* {@inheritDoc}
*
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -38,6 +38,8 @@
@Immutable
final class LocationWithPathAndUuid extends LocationWithPathAndProperty {
+ private static final long serialVersionUID = 1L;
+
private final UUID uuid;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -42,6 +42,8 @@
@Immutable
class LocationWithProperties extends Location {
+ private static final long serialVersionUID = 1L;
+
private final List<Property> idProperties;
private final int hashCode;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -43,6 +43,8 @@
@Immutable
final class LocationWithProperty extends LocationWithProperties {
+ private static final long serialVersionUID = 1L;
+
/**
* Create a new location with a given path and identification property.
*
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -41,6 +41,8 @@
@Immutable
final class LocationWithUuid extends Location {
+ private static final long serialVersionUID = 1L;
+
private final UUID uuid;
private final int hashCode;
private final List<Property> properties;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositorySourceCapabilities.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -55,11 +55,21 @@
public static final boolean DEFAULT_SUPPORT_CREATING_WORKSPACES = false;
/**
- * The default support for creating workspaces is {@value} .
+ * The default support for references is {@value} .
*/
public static final boolean DEFAULT_SUPPORT_REFERENCES = true;
/**
+ * The default support for querying workspaces is {@value} .
+ */
+ public static final boolean DEFAULT_SUPPORT_QUERIES = false;
+
+ /**
+ * The default support for searching workspaces is {@value} .
+ */
+ public static final boolean DEFAULT_SUPPORT_SEARCHES = false;
+
+ /**
* The default support for creating locks is {@value} .
*/
public static final boolean DEFAULT_SUPPORT_LOCKS = false;
@@ -69,19 +79,23 @@
private final boolean events;
private final boolean creatingWorkspaces;
private final boolean references;
+ private final boolean locks;
+ private final boolean queries;
+ private final boolean searches;
/**
* Create a capabilities object using the defaults, .
*/
public RepositorySourceCapabilities() {
this(DEFAULT_SUPPORT_SAME_NAME_SIBLINGS, DEFAULT_SUPPORT_UPDATES, DEFAULT_SUPPORT_EVENTS,
- DEFAULT_SUPPORT_CREATING_WORKSPACES, DEFAULT_SUPPORT_REFERENCES);
+ DEFAULT_SUPPORT_CREATING_WORKSPACES, DEFAULT_SUPPORT_REFERENCES, DEFAULT_SUPPORT_LOCKS, DEFAULT_SUPPORT_QUERIES,
+ DEFAULT_SUPPORT_SEARCHES);
}
public RepositorySourceCapabilities( boolean supportsSameNameSiblings,
boolean supportsUpdates ) {
this(supportsSameNameSiblings, supportsUpdates, DEFAULT_SUPPORT_EVENTS, DEFAULT_SUPPORT_CREATING_WORKSPACES,
- DEFAULT_SUPPORT_REFERENCES);
+ DEFAULT_SUPPORT_REFERENCES, DEFAULT_SUPPORT_LOCKS, DEFAULT_SUPPORT_QUERIES, DEFAULT_SUPPORT_SEARCHES);
}
public RepositorySourceCapabilities( boolean supportsSameNameSiblings,
@@ -89,12 +103,27 @@
boolean supportsEvents,
boolean supportsCreatingWorkspaces,
boolean supportsReferences ) {
+ this(supportsSameNameSiblings, supportsUpdates, supportsEvents, supportsCreatingWorkspaces, supportsReferences,
+ DEFAULT_SUPPORT_LOCKS, DEFAULT_SUPPORT_QUERIES, DEFAULT_SUPPORT_SEARCHES);
+ }
+ public RepositorySourceCapabilities( boolean supportsSameNameSiblings,
+ boolean supportsUpdates,
+ boolean supportsEvents,
+ boolean supportsCreatingWorkspaces,
+ boolean supportsReferences,
+ boolean supportsLocks,
+ boolean supportsQueries,
+ boolean supportsSearches ) {
+
this.sameNameSiblings = supportsSameNameSiblings;
this.updates = supportsUpdates;
this.events = supportsEvents;
this.creatingWorkspaces = supportsCreatingWorkspaces;
this.references = supportsReferences;
+ this.locks = supportsLocks;
+ this.queries = supportsQueries;
+ this.searches = supportsSearches;
}
/**
@@ -143,4 +172,31 @@
public boolean supportsCreatingWorkspaces() {
return creatingWorkspaces;
}
+
+ /**
+ * Return whether the source supports creating locks.
+ *
+ * @return true if locks are supported, or false if the source is not capable of creating locks
+ */
+ public boolean supportsLocks() {
+ return locks;
+ }
+
+ /**
+ * Return whether the source supports queries.
+ *
+ * @return true if queries are supported, or false if the source is not capable of querying content
+ */
+ public boolean supportsQueries() {
+ return queries;
+ }
+
+ /**
+ * Return whether the source supports full-text searches.
+ *
+ * @return true if searches are supported, or false if the source is not capable of searching content
+ */
+ public boolean supportsSearches() {
+ return searches;
+ }
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -48,6 +48,8 @@
import org.jboss.dna.graph.property.ValueFactory;
import org.jboss.dna.graph.property.Path.Segment;
import org.jboss.dna.graph.property.basic.RootPath;
+import org.jboss.dna.graph.query.QueryResults;
+import org.jboss.dna.graph.query.model.QueryCommand;
/**
* A default implementation of {@link MapWorkspace} that only requires the user to implement some simple, map-like operations.
@@ -620,6 +622,27 @@
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.map.MapWorkspace#query(org.jboss.dna.graph.ExecutionContext,
+ * org.jboss.dna.graph.query.model.QueryCommand)
+ */
+ public QueryResults query( ExecutionContext context,
+ QueryCommand command ) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.map.MapWorkspace#search(org.jboss.dna.graph.ExecutionContext, java.lang.String)
+ */
+ public QueryResults search( ExecutionContext context,
+ String fullTextSearchExpression ) {
+ return null;
+ }
+
+ /**
* Returns all of the UUIDs in the branch rooted at {@code node}. The UUID of {@code node} <i>will</i> be included in the set
* of returned UUIDs.
*
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepository.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepository.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepository.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -57,8 +57,8 @@
* @param rootNodeUuid the UUID that will be used as the root node UUID for each workspace in the repository; may not be null
* or empty
*/
- public MapRepository( String sourceName,
- UUID rootNodeUuid ) {
+ protected MapRepository( String sourceName,
+ UUID rootNodeUuid ) {
this(sourceName, rootNodeUuid, null);
}
@@ -71,9 +71,9 @@
* or empty
* @param defaultWorkspaceName the name of the default, auto-created workspace
*/
- public MapRepository( String sourceName,
- UUID rootNodeUuid,
- String defaultWorkspaceName ) {
+ protected MapRepository( String sourceName,
+ UUID rootNodeUuid,
+ String defaultWorkspaceName ) {
CheckArg.isNotEmpty(sourceName, "sourceName");
CheckArg.isNotNull(rootNodeUuid, "rootNodeUUID");
this.rootNodeUuid = rootNodeUuid;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRepositoryConnection.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -101,7 +101,8 @@
sw.start();
}
// Do any commands update/write?
- RequestProcessor processor = new MapRequestProcessor(context, this.repository, this.source.getRepositoryContext());
+ RequestProcessor processor = new MapRequestProcessor(context, this.repository, this.source.getRepositoryContext()
+ .getObserver());
Lock lock = request.isReadOnly() ? repository.getLock().readLock() : repository.getLock().writeLock();
lock.lock();
@@ -131,5 +132,4 @@
public String toString() {
return "Connection to the \"" + getSourceName() + "\" " + repository.getClass().getSimpleName();
}
-
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -38,7 +38,7 @@
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.JcrLexicon;
import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.connector.RepositoryContext;
+import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
@@ -46,6 +46,7 @@
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.PropertyFactory;
import org.jboss.dna.graph.property.Path.Segment;
+import org.jboss.dna.graph.query.QueryResults;
import org.jboss.dna.graph.request.CloneBranchRequest;
import org.jboss.dna.graph.request.CloneWorkspaceRequest;
import org.jboss.dna.graph.request.CopyBranchRequest;
@@ -53,10 +54,12 @@
import org.jboss.dna.graph.request.CreateWorkspaceRequest;
import org.jboss.dna.graph.request.DeleteBranchRequest;
import org.jboss.dna.graph.request.DestroyWorkspaceRequest;
+import org.jboss.dna.graph.request.FullTextSearchRequest;
import org.jboss.dna.graph.request.GetWorkspacesRequest;
import org.jboss.dna.graph.request.InvalidWorkspaceException;
import org.jboss.dna.graph.request.LockBranchRequest;
import org.jboss.dna.graph.request.MoveBranchRequest;
+import org.jboss.dna.graph.request.QueryRequest;
import org.jboss.dna.graph.request.ReadAllChildrenRequest;
import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
import org.jboss.dna.graph.request.Request;
@@ -75,8 +78,8 @@
public MapRequestProcessor( ExecutionContext context,
MapRepository repository,
- RepositoryContext repositoryContext ) {
- super(repository.getSourceName(), context, repositoryContext != null ? repositoryContext.getObserver() : null);
+ Observer observer ) {
+ super(repository.getSourceName(), context, observer);
this.repository = repository;
pathFactory = context.getValueFactories().getPathFactory();
propertyFactory = context.getPropertyFactory();
@@ -491,6 +494,42 @@
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.QueryRequest)
+ */
+ @Override
+ public void process( QueryRequest request ) {
+ MapWorkspace workspace = getWorkspace(request, request.workspace());
+ if (workspace == null) return;
+ final ExecutionContext context = getExecutionContext();
+ QueryResults results = workspace.query(context, request.query());
+ if (results != null) {
+ request.setResults(results);
+ } else {
+ super.processUnknownRequest(request);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.FullTextSearchRequest)
+ */
+ @Override
+ public void process( FullTextSearchRequest request ) {
+ MapWorkspace workspace = getWorkspace(request, request.workspace());
+ if (workspace == null) return;
+ final ExecutionContext context = getExecutionContext();
+ QueryResults results = workspace.search(context, request.expression());
+ if (results != null) {
+ request.setResults(results);
+ } else {
+ super.processUnknownRequest(request);
+ }
+ }
+
protected Location getActualLocation( Location location,
MapNode node ) {
Path path = location.getPath();
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapWorkspace.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapWorkspace.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapWorkspace.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,6 +33,8 @@
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
import org.jboss.dna.graph.property.Property;
+import org.jboss.dna.graph.query.QueryResults;
+import org.jboss.dna.graph.query.model.QueryCommand;
import org.jboss.dna.graph.request.LockBranchRequest.LockScope;
/**
@@ -89,7 +91,7 @@
* @return whether a node was removed as a result of this operation
*/
boolean removeNode( ExecutionContext context,
- MapNode node );
+ MapNode node );
/**
* Create a node at the supplied path. The parent of the new node must already exist.
@@ -226,4 +228,24 @@
*/
Path pathFor( PathFactory pathFactory,
MapNode node );
+
+ /**
+ * Perform a query of this workspace.
+ *
+ * @param context the context in which the query is to be executed; may not be null
+ * @param command the query command; may not be null
+ * @return the query results, or null if the query is not supported
+ */
+ QueryResults query( ExecutionContext context,
+ QueryCommand command );
+
+ /**
+ * Perform a full-text search of this workspace.
+ *
+ * @param context the context in which the query is to be executed; may not be null
+ * @param fullTextSearchExpression the full-text search expression; may not be null
+ * @return the query results, or null if the query is not supported
+ */
+ QueryResults search( ExecutionContext context,
+ String fullTextSearchExpression );
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/QueryResults.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/QueryResults.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/QueryResults.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.graph.query;
+import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.List;
import java.util.NoSuchElementException;
@@ -33,22 +34,14 @@
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.query.model.Column;
import org.jboss.dna.graph.query.model.QueryCommand;
-import org.jboss.dna.graph.query.model.TypeSystem;
/**
* The resulting output of a query.
*/
@Immutable
-public interface QueryResults {
+public interface QueryResults extends Serializable {
/**
- * Get the type system used to evaluate the query.
- *
- * @return the type system; never null
- */
- public TypeSystem getTypeSystem();
-
- /**
* Get the original query command.
*
* @return the query; never null
@@ -186,7 +179,7 @@
* the tuples.
*/
@Immutable
- public interface Columns {
+ public interface Columns extends Serializable {
/**
* Get the columns.
*
@@ -365,7 +358,10 @@
public Columns subSelect( Column... columns );
}
- public static class Statistics implements Comparable<Statistics> {
+ @Immutable
+ public static class Statistics implements Comparable<Statistics>, Serializable {
+ private static final long serialVersionUID = 1L;
+
protected static final Statistics EMPTY_STATISTICS = new Statistics();
private final long planningNanos;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/AllNodes.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/AllNodes.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/AllNodes.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
@Immutable
public class AllNodes extends Selector {
+ private static final long serialVersionUID = 1L;
+
public static final SelectorName ALL_NODES_NAME = new SelectorName("__ALLNODES__");
public AllNodes() {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/And.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/And.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/And.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,6 +33,8 @@
@Immutable
public class And extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final Constraint left;
private final Constraint right;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Between.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Between.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Between.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,6 +33,8 @@
@Immutable
public class Between extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final DynamicOperand operand;
private final StaticOperand lowerBound;
private final StaticOperand upperBound;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/BindVariableName.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/BindVariableName.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/BindVariableName.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
@Immutable
public class BindVariableName extends StaticOperand {
+ private static final long serialVersionUID = 1L;
+
private final String variableName;
public BindVariableName( String variableName ) {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNode.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNode.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNode.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class ChildNode extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String parentPath;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNodeJoinCondition.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNodeJoinCondition.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/ChildNodeJoinCondition.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class ChildNodeJoinCondition extends JoinCondition {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName childSelectorName;
private final SelectorName parentSelectorName;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Column.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Column.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Column.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,7 @@
*/
@Immutable
public class Column implements LanguageObject {
+ private static final long serialVersionUID = 1L;
private final SelectorName selectorName;
private final String propertyName;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Command.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Command.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Command.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -27,5 +27,5 @@
* Represents the abstract base class for all top-level language objects that are the root of a language object tree.
*/
public abstract class Command implements LanguageObject {
-
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Comparison.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Comparison.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Comparison.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,6 +33,8 @@
@Immutable
public class Comparison extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final DynamicOperand operand1;
private final StaticOperand operand2;
private final Operator operator;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Constraint.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Constraint.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Constraint.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,5 +30,5 @@
*/
@Immutable
public abstract class Constraint implements LanguageObject {
-
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNode.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNode.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNode.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class DescendantNode extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String ancestorPath;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNodeJoinCondition.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNodeJoinCondition.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DescendantNodeJoinCondition.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class DescendantNodeJoinCondition extends JoinCondition {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName descendantSelectorName;
private final SelectorName ancestorSelectorName;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DynamicOperand.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DynamicOperand.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/DynamicOperand.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,6 +30,7 @@
*/
@Immutable
public abstract class DynamicOperand implements LanguageObject {
+ private static final long serialVersionUID = 1L;
/**
* Get the selector symbol to which this operand applies.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/EquiJoinCondition.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/EquiJoinCondition.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/EquiJoinCondition.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -38,6 +38,8 @@
*/
@Immutable
public class EquiJoinCondition extends JoinCondition {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selector1Name;
private final String property1Name;
private final SelectorName selector2Name;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearch.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearch.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearch.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -38,6 +38,8 @@
*/
@Immutable
public class FullTextSearch extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String propertyName;
private final String fullTextSearchExpression;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearchScore.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearchScore.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/FullTextSearchScore.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class FullTextSearchScore extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Join.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Join.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Join.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,7 @@
*/
@Immutable
public class Join extends Source {
+ private static final long serialVersionUID = 1L;
private final Source left;
private final Source right;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/JoinCondition.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/JoinCondition.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/JoinCondition.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,5 +30,5 @@
*/
@Immutable
public abstract class JoinCondition implements LanguageObject {
-
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LanguageObject.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LanguageObject.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LanguageObject.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,8 +23,10 @@
*/
package org.jboss.dna.graph.query.model;
+import java.io.Serializable;
+
/**
* A common interface for all query language objects.
*/
-public interface LanguageObject extends Visitable {
+public interface LanguageObject extends Visitable, Serializable {
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Length.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Length.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Length.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class Length extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final PropertyValue propertyValue;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Limit.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Limit.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Limit.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public class Limit implements LanguageObject {
+ private static final long serialVersionUID = 1L;
public static final Limit NONE = new Limit(Integer.MAX_VALUE, 0);
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Literal.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Literal.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Literal.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public class Literal extends StaticOperand {
+ private static final long serialVersionUID = 1L;
private final Object value;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LowerCase.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LowerCase.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/LowerCase.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class LowerCase extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final DynamicOperand operand;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NamedSelector.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NamedSelector.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NamedSelector.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public class NamedSelector extends Selector {
+ private static final long serialVersionUID = 1L;
/**
* Create a selector with a name.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeDepth.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeDepth.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeDepth.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class NodeDepth extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeLocalName.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeLocalName.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeLocalName.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class NodeLocalName extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeName.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeName.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodeName.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class NodeName extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodePath.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodePath.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/NodePath.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,8 @@
*/
@Immutable
public class NodePath extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Not.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Not.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Not.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public class Not extends Constraint {
+ private static final long serialVersionUID = 1L;
private final Constraint constraint;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Or.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Or.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Or.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,7 @@
*/
@Immutable
public class Or extends Constraint {
+ private static final long serialVersionUID = 1L;
private final Constraint left;
private final Constraint right;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Ordering.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Ordering.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Ordering.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public class Ordering implements LanguageObject {
+ private static final long serialVersionUID = 1L;
private final DynamicOperand operand;
private final Order order;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyExistence.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyExistence.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyExistence.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class PropertyExistence extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String propertyName;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyValue.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyValue.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/PropertyValue.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class PropertyValue extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String propertyName;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Query.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Query.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Query.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -37,6 +37,7 @@
*/
@Immutable
public class Query extends QueryCommand {
+ private static final long serialVersionUID = 1L;
public static final boolean IS_DISTINCT_DEFAULT = false;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/QueryCommand.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/QueryCommand.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/QueryCommand.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,6 +30,7 @@
* Represents the abstract base class for all query commands. Subclasses include {@link Query} and {@link SetQuery}.
*/
public abstract class QueryCommand extends Command {
+ private static final long serialVersionUID = 1L;
private final List<Ordering> orderings;
private final Limit limits;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNode.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNode.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNode.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class SameNode extends Constraint {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selectorName;
private final String path;
private final int hc;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNodeJoinCondition.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNodeJoinCondition.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SameNodeJoinCondition.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -34,6 +34,8 @@
*/
@Immutable
public class SameNodeJoinCondition extends JoinCondition {
+ private static final long serialVersionUID = 1L;
+
private final SelectorName selector1Name;
private final SelectorName selector2Name;
private final String selector2Path;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Selector.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Selector.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Selector.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -31,6 +31,7 @@
*/
@Immutable
public abstract class Selector extends Source {
+ private static final long serialVersionUID = 1L;
private final SelectorName name;
private final SelectorName alias;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SelectorName.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SelectorName.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SelectorName.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,6 +23,7 @@
*/
package org.jboss.dna.graph.query.model;
+import java.io.Serializable;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
@@ -30,7 +31,8 @@
* A representation of a qualified or expanded name.
*/
@Immutable
-public class SelectorName implements Readable {
+public class SelectorName implements Readable, Serializable {
+ private static final long serialVersionUID = 1L;
private final String name;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetCriteria.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetCriteria.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetCriteria.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -34,6 +34,7 @@
*/
@Immutable
public class SetCriteria extends Constraint {
+ private static final long serialVersionUID = 1L;
private final DynamicOperand left;
private final Collection<StaticOperand> setOperands;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetQuery.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetQuery.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/SetQuery.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -44,6 +44,7 @@
*/
@Immutable
public class SetQuery extends QueryCommand {
+ private static final long serialVersionUID = 1L;
public enum Operation implements Readable {
UNION("UNION"),
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Source.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Source.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/Source.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,5 +30,5 @@
*/
@Immutable
public abstract class Source implements LanguageObject {
-
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/StaticOperand.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/StaticOperand.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/StaticOperand.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -30,5 +30,5 @@
*/
@Immutable
public abstract class StaticOperand implements LanguageObject {
-
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/TypeSystem.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/TypeSystem.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/TypeSystem.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -29,29 +29,81 @@
import org.jboss.dna.graph.property.ValueFormatException;
/**
- *
+ * An interface that defines the value types used in tuples.
*/
@Immutable
public interface TypeSystem {
+ /**
+ * Get the type factory given the name of the type.
+ *
+ * @param typeName the name of the type
+ * @return the type factory, or null if there is no such type in this system
+ */
TypeFactory<?> getTypeFactory( String typeName );
+ /**
+ * Get the type factory for the type denoted by the supplied prototype value.
+ *
+ * @param prototype the value whose type is to be identified
+ * @return the type factory, or null if there is no such type in this system
+ */
TypeFactory<?> getTypeFactory( Object prototype );
+ /**
+ * Get the type factory for boolean types.
+ *
+ * @return the boolean factory; never null
+ */
TypeFactory<Boolean> getBooleanFactory();
+ /**
+ * Get the type factory for long types.
+ *
+ * @return the long factory; never null
+ */
TypeFactory<Long> getLongFactory();
+ /**
+ * Get the type factory for string types.
+ *
+ * @return the string factory; never null
+ */
TypeFactory<String> getStringFactory();
+ /**
+ * Get the type factory for double types.
+ *
+ * @return the double factory; never null
+ */
TypeFactory<Double> getDoubleFactory();
+ /**
+ * Get the type factory for date-time objects.
+ *
+ * @return the date-time factory, or null if this type system doesn't support date-time objects
+ */
TypeFactory<?> getDateTimeFactory();
+ /**
+ * Get the type factory for path objects.
+ *
+ * @return the path factory, or null if this type system doesn't support path objects
+ */
TypeFactory<?> getPathFactory();
+ /**
+ * Get the name of the type that is used by default.
+ *
+ * @return the default type name; never null
+ */
String getDefaultType();
+ /**
+ * Get the comparator that should be used by default.
+ *
+ * @return the default comparator; never null
+ */
Comparator<Object> getDefaultComparator();
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/UpperCase.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/UpperCase.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/model/UpperCase.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -32,6 +32,8 @@
*/
@Immutable
public class UpperCase extends DynamicOperand {
+ private static final long serialVersionUID = 1L;
+
private final DynamicOperand operand;
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/optimize/RewriteAsRangeCriteria.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/optimize/RewriteAsRangeCriteria.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/optimize/RewriteAsRangeCriteria.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -58,6 +58,8 @@
public class RewriteAsRangeCriteria implements OptimizerRule {
protected static final Constraint CONFLICTING_CONSTRAINT = new Constraint() {
+ private static final long serialVersionUID = 1L;
+
public void accept( Visitor visitor ) {
throw new UnsupportedOperationException();
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/PlanHints.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/PlanHints.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/PlanHints.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -23,11 +23,14 @@
*/
package org.jboss.dna.graph.query.plan;
+import java.io.Serializable;
import net.jcip.annotations.NotThreadSafe;
@NotThreadSafe
-public final class PlanHints {
+public final class PlanHints implements Serializable {
+ private static final long serialVersionUID = 1L;
+
/** This flag indicates that the plan has a criteria somewhere */
public boolean hasCriteria = false;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResultColumns.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResultColumns.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResultColumns.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -43,6 +43,7 @@
*/
@Immutable
public final class QueryResultColumns implements Columns {
+ private static final long serialVersionUID = 1L;
private static final QueryResultColumns EMPTY = new QueryResultColumns(Collections.<Column>emptyList(), false);
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResults.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResults.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/QueryResults.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -33,7 +33,6 @@
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.query.QueryContext;
import org.jboss.dna.graph.query.model.QueryCommand;
-import org.jboss.dna.graph.query.model.TypeSystem;
import org.jboss.dna.graph.query.model.TypeSystem.TypeFactory;
/**
@@ -41,6 +40,7 @@
*/
@Immutable
public class QueryResults implements org.jboss.dna.graph.query.QueryResults {
+ private static final long serialVersionUID = 1L;
private final QueryContext context;
private final QueryCommand command;
@@ -91,15 +91,6 @@
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.graph.query.QueryResults#getTypeSystem()
- */
- public TypeSystem getTypeSystem() {
- return context.getTypeSystem();
- }
-
- /**
- * {@inheritDoc}
- *
* @see org.jboss.dna.graph.query.QueryResults#getCommand()
*/
public QueryCommand getCommand() {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-12-01 15:19:31 UTC (rev 1373)
@@ -56,10 +56,12 @@
import org.jboss.dna.graph.request.DeleteBranchRequest;
import org.jboss.dna.graph.request.DeleteChildrenRequest;
import org.jboss.dna.graph.request.DestroyWorkspaceRequest;
+import org.jboss.dna.graph.request.FullTextSearchRequest;
import org.jboss.dna.graph.request.GetWorkspacesRequest;
import org.jboss.dna.graph.request.InvalidRequestException;
import org.jboss.dna.graph.request.LockBranchRequest;
import org.jboss.dna.graph.request.MoveBranchRequest;
+import org.jboss.dna.graph.request.QueryRequest;
import org.jboss.dna.graph.request.ReadAllChildrenRequest;
import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
import org.jboss.dna.graph.request.ReadBlockOfChildrenRequest;
@@ -272,6 +274,10 @@
process((DestroyWorkspaceRequest)request);
} else if (request instanceof UpdateValuesRequest) {
process((UpdateValuesRequest)request);
+ } else if (request instanceof QueryRequest) {
+ process((QueryRequest)request);
+ } else if (request instanceof FullTextSearchRequest) {
+ process((FullTextSearchRequest)request);
} else {
processUnknownRequest(request);
}
@@ -913,6 +919,32 @@
}
/**
+ * Process a request to query a workspace.
+ * <p>
+ * The default implementation of this method behaves as though the implementation does not support queries by setting an error
+ * on the request
+ * </p>
+ *
+ * @param request the request
+ */
+ public void process( QueryRequest request ) {
+ processUnknownRequest(request);
+ }
+
+ /**
+ * Process a request to search a workspace.
+ * <p>
+ * The default implementation of this method behaves as though the implementation does not support full-text searches by
+ * setting an error on the request
+ * </p>
+ *
+ * @param request the request
+ */
+ public void process( FullTextSearchRequest request ) {
+ processUnknownRequest(request);
+ }
+
+ /**
* A class that represents a location at a known depth
*
* @author Randall Hauch
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-11-30 21:53:47 UTC (rev 1372)
+++ trunk/pom.xml 2009-12-01 15:19:31 UTC (rev 1373)
@@ -139,6 +139,7 @@
<module>extensions/dna-connector-jbosscache</module>
<module>extensions/dna-connector-svn</module>
<module>extensions/dna-connector-store-jpa</module>
+ <module>extensions/dna-connector-store-lucene</module>
<module>extensions/dna-mimetype-detector-aperture</module>
<!--module>extensions/dna-common-jdbc</module-->
<!--module>extensions/dna-connector-jdbc-metadata</module-->
14 years, 5 months