DNA SVN: r1552 - in trunk: dna-jcr/src/main/java/org/jboss/dna/jcr and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-07 13:24:39 -0500 (Thu, 07 Jan 2010)
New Revision: 1552
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/CanonicalPlanner.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryQueryManager.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractSessionTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/CndNodeTypeRegistrationTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrQueryManagerTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/WorkspaceLockManagerTest.java
Log:
DNA-460 NodeTypeManager.unregisterType
Applied patch that changes the query language from XPath to SQL to allow the use of the LIMIT keyword. The patch also corrects a minor problem with limit/offset parsing.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/CanonicalPlanner.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/CanonicalPlanner.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/plan/CanonicalPlanner.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -361,11 +361,11 @@
boolean attach = false;
if (limit.getOffset() != 0) {
- limitNode.setProperty(Property.LIMIT_COUNT, limit.getOffset());
+ limitNode.setProperty(Property.LIMIT_OFFSET, limit.getOffset());
attach = true;
}
if (!limit.isUnlimited()) {
- limitNode.setProperty(Property.LIMIT_OFFSET, limit.getRowLimit());
+ limitNode.setProperty(Property.LIMIT_COUNT, limit.getRowLimit());
attach = true;
}
if (attach) {
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -331,7 +331,7 @@
public QueryResult execute() throws RepositoryException {
// Submit immediately to the workspace graph ...
Schemata schemata = session.workspace().nodeTypeManager().schemata();
- QueryResults result = session.repository().queryManager().query(session.workspace(),
+ QueryResults result = session.repository().queryManager().query(session.workspace().getName(),
query,
schemata,
hints,
@@ -383,7 +383,7 @@
*/
public QueryResult execute() throws RepositoryException {
// Submit immediately to the workspace graph ...
- QueryResults result = session.repository().queryManager().search(session.workspace(),
+ QueryResults result = session.repository().queryManager().search(session.workspace().getName(),
statement,
MAXIMUM_RESULTS_FOR_FULL_TEXT_SEARCH_QUERIES,
0);
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 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -95,6 +95,7 @@
import org.jboss.dna.graph.query.parse.QueryParsers;
import org.jboss.dna.graph.query.parse.SqlQueryParser;
import org.jboss.dna.graph.request.InvalidWorkspaceException;
+import org.jboss.dna.jcr.RepositoryQueryManager.PushDown;
import org.jboss.dna.jcr.xpath.XPathQueryParser;
/**
@@ -536,7 +537,8 @@
// Set up the repository type manager ...
try {
boolean includeInheritedProperties = Boolean.valueOf(this.options.get(Option.TABLES_INCLUDE_COLUMNS_FOR_INHERITED_PROPERTIES));
- this.repositoryTypeManager = new RepositoryNodeTypeManager(this.executionContext, includeInheritedProperties);
+ // this.repositoryTypeManager = new RepositoryNodeTypeManager(this, includeInheritedProperties);
+ this.repositoryTypeManager = new RepositoryNodeTypeManager(this, includeInheritedProperties);
this.repositoryTypeManager.registerNodeTypes(new CndNodeTypeSource(new String[] {
"/org/jboss/dna/jcr/jsr_170_builtins.cnd", "/org/jboss/dna/jcr/dna_builtins.cnd"}));
} catch (RepositoryException re) {
@@ -585,7 +587,7 @@
// We can query the federated source if it supports queries and searches
// AND the original source supports queries and searches ...
if (canQuerySource && canQueryFederated) {
- this.queryManager = new RepositoryQueryManager();
+ this.queryManager = new PushDown(this.sourceName, executionContext, connectionFactory);
} else {
// Otherwise create a repository query manager that maintains its own search engine ...
String indexDirectory = this.options.get(Option.QUERY_INDEX_DIRECTORY);
@@ -595,7 +597,7 @@
indexDirectory, updateIndexesSynchronously);
}
} else {
- this.queryManager = new RepositoryQueryManager.Disabled();
+ this.queryManager = new RepositoryQueryManager.Disabled(this.sourceName);
}
/*
@@ -953,6 +955,13 @@
}
/**
+ * @return a list of all workspace names, without regard to the access permissions of any particular user
+ */
+ Set<String> workspaceNames() {
+ return Graph.create(sourceName, connectionFactory, executionContext).getWorkspaces();
+ }
+
+ /**
* Returns the lock manager for the named workspace (if one already exists) or creates a new lock manager and returns it. This
* method is thread-safe.
*
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -31,6 +31,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.jcr.PropertyType;
@@ -42,6 +43,7 @@
import javax.jcr.nodetype.NodeDefinition;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.query.InvalidQueryException;
import javax.jcr.version.OnParentVersionAction;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
@@ -64,6 +66,12 @@
import org.jboss.dna.graph.property.PropertyFactory;
import org.jboss.dna.graph.property.ValueFactories;
import org.jboss.dna.graph.property.ValueFactory;
+import org.jboss.dna.graph.query.QueryResults;
+import org.jboss.dna.graph.query.model.QueryCommand;
+import org.jboss.dna.graph.query.model.TypeSystem;
+import org.jboss.dna.graph.query.parse.QueryParser;
+import org.jboss.dna.graph.query.parse.SqlQueryParser;
+import org.jboss.dna.graph.query.validate.Schemata;
import org.jboss.dna.jcr.nodetype.InvalidNodeTypeDefinitionException;
import org.jboss.dna.jcr.nodetype.NodeTypeDefinition;
import org.jboss.dna.jcr.nodetype.NodeTypeExistsException;
@@ -105,6 +113,8 @@
private static final TextEncoder NAME_ENCODER = new XmlNameEncoder();
+ private final JcrRepository repository;
+ private final QueryParser queryParser;
private final ExecutionContext context;
@GuardedBy( "nodeTypeManagerLock" )
@@ -142,9 +152,10 @@
ANY
}
- RepositoryNodeTypeManager( ExecutionContext context,
+ RepositoryNodeTypeManager( JcrRepository repository,
boolean includeColumnsForInheritedProperties ) {
- this.context = context;
+ this.repository = repository;
+ this.context = repository.getExecutionContext();
this.includeColumnsForInheritedProperties = includeColumnsForInheritedProperties;
this.propertyFactory = context.getPropertyFactory();
this.pathFactory = context.getValueFactories().getPathFactory();
@@ -152,6 +163,8 @@
propertyDefinitions = new HashMap<PropertyDefinitionId, JcrPropertyDefinition>();
childNodeDefinitions = new HashMap<NodeDefinitionId, JcrNodeDefinition>();
nodeTypes = new HashMap<Name, JcrNodeType>(50);
+ queryParser = new SqlQueryParser();
+
}
/**
@@ -1199,13 +1212,18 @@
childNode.getName()));
}
}
+
+ /*
+ * Search the content graph to make sure that this type isn't being used
+ */
+ if (isNodeTypeInUse(nodeTypeName)) {
+ throw new InvalidNodeTypeDefinitionException(JcrI18n.cannotUnregisterInUseType.text(name));
+
+ }
+
}
}
- /*
- * Do a full recursive search over the content graph to make sure that this type isn't being used
- */
- // TODO: replace this with a query after queries work
this.nodeTypes.keySet().removeAll(nodeTypeNames);
this.schemata = null;
@@ -1215,6 +1233,36 @@
}
/**
+ * Check if the named node type is in use in any workspace in the repository
+ *
+ * @param nodeTypeName the name of the node type to check
+ * @return true if at least one node is using that type; false otherwise
+ * @throws InvalidQueryException if there is an error searching for uses of the named node type
+ */
+ boolean isNodeTypeInUse( Name nodeTypeName ) throws InvalidQueryException {
+ String nodeTypeString = nodeTypeName.getString(context.getNamespaceRegistry());
+ String expression = "SELECT * from [" + nodeTypeString + "] LIMIT 1";
+
+ TypeSystem typeSystem = context.getValueFactories().getTypeSystem();
+ // Parsing must be done now ...
+ QueryCommand command = queryParser.parseQuery(expression, typeSystem);
+ assert command != null : "Could not parse " + expression;
+
+ Schemata schemata = getRepositorySchemata();
+
+ Set<String> workspaceNames = repository.workspaceNames();
+ for (String workspaceName : workspaceNames) {
+ QueryResults result = repository.queryManager().query(workspaceName, command, schemata, null, null);
+
+ if (result.getRowCount() > 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Registers a new node type or updates an existing node type using the specified definition and returns the resulting {@code
* NodeType} object.
* <p>
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryQueryManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryQueryManager.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryQueryManager.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -77,31 +77,25 @@
/**
*
*/
-class RepositoryQueryManager {
+abstract class RepositoryQueryManager {
- RepositoryQueryManager() {
- }
+ protected final String sourceName;
- @SuppressWarnings( "unused" )
- public QueryResults query( JcrWorkspace workspace,
- QueryCommand query,
- Schemata schemata,
- PlanHints hints,
- Map<String, Object> variables ) throws InvalidQueryException {
- Graph.BuildQuery builder = workspace.graph().query(query, schemata);
- if (variables != null) builder.using(variables);
- if (hints != null) builder.using(hints);
- return builder.execute();
+ RepositoryQueryManager( String sourceName ) {
+ this.sourceName = sourceName;
}
- @SuppressWarnings( "unused" )
- public QueryResults search( JcrWorkspace workspace,
- String searchExpression,
- int maxRowCount,
- int offset ) throws InvalidQueryException {
- return workspace.graph().search(searchExpression, maxRowCount, offset);
- }
+ public abstract QueryResults query( String workspaceName,
+ QueryCommand query,
+ Schemata schemata,
+ PlanHints hints,
+ Map<String, Object> variables ) throws InvalidQueryException;
+ public abstract QueryResults search( String workspaceName,
+ String searchExpression,
+ int maxRowCount,
+ int offset ) throws InvalidQueryException;
+
/**
* Crawl and index the content in the named workspace.
*
@@ -138,35 +132,82 @@
// do nothing by default
}
+ static class PushDown extends RepositoryQueryManager {
+ private final ExecutionContext context;
+ private final RepositoryConnectionFactory connectionFactory;
+
+ PushDown( String sourceName,
+ ExecutionContext context,
+ RepositoryConnectionFactory connectionFactory ) {
+ super(sourceName);
+ this.context = context;
+ this.connectionFactory = connectionFactory;
+ }
+
+ private Graph workspaceGraph( String workspaceName ) {
+ Graph graph = Graph.create(this.sourceName, connectionFactory, context);
+
+ if (workspaceName != null) {
+ graph.useWorkspace(workspaceName);
+ }
+
+ return graph;
+ }
+
+ @Override
+ public QueryResults query( String workspaceName,
+ QueryCommand query,
+ Schemata schemata,
+ PlanHints hints,
+ Map<String, Object> variables ) throws InvalidQueryException {
+ Graph.BuildQuery builder = workspaceGraph(workspaceName).query(query, schemata);
+ if (variables != null) builder.using(variables);
+ if (hints != null) builder.using(hints);
+ return builder.execute();
+ }
+
+ @Override
+ public QueryResults search( String workspaceName,
+ String searchExpression,
+ int maxRowCount,
+ int offset ) throws InvalidQueryException {
+ return workspaceGraph(workspaceName).search(searchExpression, maxRowCount, offset);
+ }
+
+ }
+
static class Disabled extends RepositoryQueryManager {
+ Disabled( String sourceName ) {
+ super(sourceName);
+ }
+
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.jcr.RepositoryQueryManager#query(org.jboss.dna.jcr.JcrWorkspace,
- * org.jboss.dna.graph.query.model.QueryCommand, org.jboss.dna.graph.query.validate.Schemata,
- * org.jboss.dna.graph.query.plan.PlanHints, java.util.Map)
+ * @see org.jboss.dna.jcr.RepositoryQueryManager#query(java.lang.String, org.jboss.dna.graph.query.model.QueryCommand,
+ * org.jboss.dna.graph.query.validate.Schemata, org.jboss.dna.graph.query.plan.PlanHints, java.util.Map)
*/
@Override
- public QueryResults query( JcrWorkspace workspace,
+ public QueryResults query( String workspaceName,
QueryCommand query,
Schemata schemata,
PlanHints hints,
Map<String, Object> variables ) throws InvalidQueryException {
- throw new InvalidQueryException(JcrI18n.queryIsDisabledInRepository.text(workspace.getSourceName()));
+ throw new InvalidQueryException(JcrI18n.queryIsDisabledInRepository.text(this.sourceName));
}
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.jcr.RepositoryQueryManager#search(org.jboss.dna.jcr.JcrWorkspace, java.lang.String, int, int)
+ * @see org.jboss.dna.jcr.RepositoryQueryManager#search(java.lang.String, java.lang.String, int, int)
*/
@Override
- public QueryResults search( JcrWorkspace workspace,
+ public QueryResults search( String workspaceName,
String searchExpression,
int maxRowCount,
int offset ) throws InvalidQueryException {
- throw new InvalidQueryException(JcrI18n.queryIsDisabledInRepository.text(workspace.getSourceName()));
+ throw new InvalidQueryException(JcrI18n.queryIsDisabledInRepository.text(this.sourceName));
}
}
@@ -186,6 +227,8 @@
Observable observable,
String indexDirectory,
boolean updateIndexesSynchronously ) throws RepositoryException {
+ super(nameOfSourceToBeSearchable);
+
this.context = context;
this.sourceName = nameOfSourceToBeSearchable;
this.connectionFactory = connectionFactory;
@@ -301,22 +344,36 @@
}
@Override
- public QueryResults query( JcrWorkspace workspace,
+ public QueryResults query( String workspaceName,
QueryCommand query,
Schemata schemata,
PlanHints hints,
Map<String, Object> variables ) {
- TypeSystem typeSystem = workspace.context().getValueFactories().getTypeSystem();
+ TypeSystem typeSystem = context.getValueFactories().getTypeSystem();
SearchEngineProcessor processor = searchEngine.createProcessor(context, null, true);
try {
QueryContext context = new GraphQueryContext(schemata, typeSystem, hints, new SimpleProblems(), variables,
- processor, workspace.getName());
+ processor, workspaceName);
return queryEngine.execute(context, query);
} finally {
processor.close();
}
}
+ @Override
+ public QueryResults search( String workspaceName,
+ String searchExpression,
+ int maxRowCount,
+ int offset ) throws InvalidQueryException {
+ Graph graph = Graph.create(sourceName, connectionFactory, context);
+
+ if (workspaceName != null) {
+ graph.useWorkspace(workspaceName);
+ }
+
+ return graph.search(searchExpression, maxRowCount, offset);
+ }
+
/**
* {@inheritDoc}
*
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrTest.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrTest.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -26,7 +26,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.stub;
import java.io.IOException;
-import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Workspace;
import org.jboss.dna.graph.ExecutionContext;
@@ -49,6 +48,7 @@
public abstract class AbstractJcrTest {
protected static ExecutionContext context;
+ protected static JcrRepository repository;
protected static RepositoryNodeTypeManager rntm;
protected InMemoryRepositorySource source;
protected Graph store;
@@ -57,7 +57,6 @@
protected JcrSession jcrSession;
protected JcrNodeTypeManager nodeTypes;
protected Workspace workspace;
- protected Repository repository;
/**
* Initialize the expensive activities, and in particular the RepositoryNodeTypeManager instance.
@@ -70,7 +69,10 @@
// Create the node type manager ...
context.getNamespaceRegistry().register(Vehicles.Lexicon.Namespace.PREFIX, Vehicles.Lexicon.Namespace.URI);
- rntm = new RepositoryNodeTypeManager(context, true);
+ repository = mock(JcrRepository.class);
+ stub(repository.getExecutionContext()).toReturn(context);
+
+ rntm = new RepositoryNodeTypeManager(repository, true);
try {
rntm.registerNodeTypes(new CndNodeTypeSource(new String[] {"/org/jboss/dna/jcr/jsr_170_builtins.cnd",
"/org/jboss/dna/jcr/dna_builtins.cnd"}));
@@ -115,7 +117,6 @@
// Stub the session, workspace, and repository; then stub some critical methods ...
jcrSession = mock(JcrSession.class);
workspace = mock(Workspace.class);
- repository = mock(Repository.class);
stub(jcrSession.getExecutionContext()).toReturn(context);
stub(jcrSession.getWorkspace()).toReturn(workspace);
stub(jcrSession.getRepository()).toReturn(repository);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractSessionTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractSessionTest.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractSessionTest.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -122,8 +122,24 @@
}
};
+ stub(repository.getExecutionContext()).toReturn(context);
+ stub(repository.getRepositorySourceName()).toReturn(repositorySourceName);
+ stub(repository.getPersistentRegistry()).toReturn(context.getNamespaceRegistry());
+ stub(repository.createWorkspaceGraph(anyString(), (ExecutionContext)anyObject())).toAnswer(new Answer<Graph>() {
+ public Graph answer( InvocationOnMock invocation ) throws Throwable {
+ return graph;
+ }
+ });
+ stub(repository.createSystemGraph(context)).toAnswer(new Answer<Graph>() {
+ public Graph answer( InvocationOnMock invocation ) throws Throwable {
+ return graph;
+ }
+ });
+ stub(this.repository.getRepositoryObservable()).toReturn(new MockObservable());
+
// Stub out the repository, since we only need a few methods ...
- repoTypeManager = new RepositoryNodeTypeManager(context, true);
+ repoTypeManager = new RepositoryNodeTypeManager(repository, true);
+ stub(repository.getRepositoryTypeManager()).toReturn(repoTypeManager);
try {
this.repoTypeManager.registerNodeTypes(new CndNodeTypeSource(new String[] {"/org/jboss/dna/jcr/jsr_170_builtins.cnd",
@@ -139,21 +155,6 @@
}
this.repoTypeManager.projectOnto(graph, pathFactory.create("/jcr:system/jcr:nodeTypes"));
- stub(repository.getRepositoryTypeManager()).toReturn(repoTypeManager);
- stub(repository.getRepositorySourceName()).toReturn(repositorySourceName);
- stub(repository.getPersistentRegistry()).toReturn(context.getNamespaceRegistry());
- stub(repository.createWorkspaceGraph(anyString(), (ExecutionContext)anyObject())).toAnswer(new Answer<Graph>() {
- public Graph answer( InvocationOnMock invocation ) throws Throwable {
- return graph;
- }
- });
- stub(repository.createSystemGraph(context)).toAnswer(new Answer<Graph>() {
- public Graph answer( InvocationOnMock invocation ) throws Throwable {
- return graph;
- }
- });
- stub(this.repository.getRepositoryObservable()).toReturn(new MockObservable());
-
Path locksPath = pathFactory.createAbsolutePath(JcrLexicon.SYSTEM, DnaLexicon.LOCKS);
workspaceLockManager = new WorkspaceLockManager(context, repository, workspaceName, locksPath);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/CndNodeTypeRegistrationTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/CndNodeTypeRegistrationTest.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/CndNodeTypeRegistrationTest.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -26,6 +26,7 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.stub;
import java.io.IOException;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -35,6 +36,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoAnnotations.Mock;
/**
* Test of CND-based type definitions. These test cases focus on ensuring that an import of a type from a CND file registers the
@@ -49,6 +51,8 @@
private ExecutionContext context;
private RepositoryNodeTypeManager repoTypeManager;
private JcrNodeTypeSource nodeTypes;
+ @Mock
+ protected JcrRepository repository;
@Before
public void beforeEach() throws Exception {
@@ -56,7 +60,9 @@
context = new ExecutionContext();
context.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);
- repoTypeManager = new RepositoryNodeTypeManager(context, true);
+ stub(repository.getExecutionContext()).toReturn(context);
+
+ repoTypeManager = new RepositoryNodeTypeManager(repository, true);
try {
this.repoTypeManager.registerNodeTypes(new CndNodeTypeSource(new String[] {"/org/jboss/dna/jcr/jsr_170_builtins.cnd",
"/org/jboss/dna/jcr/dna_builtins.cnd"}));
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrQueryManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrQueryManagerTest.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrQueryManagerTest.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -31,6 +31,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -39,6 +40,7 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
@@ -47,6 +49,8 @@
import org.jboss.dna.jcr.JcrQueryManager.JcrQueryResult;
import org.jboss.dna.jcr.JcrRepository.Option;
import org.jboss.dna.jcr.JcrRepository.QueryLanguage;
+import org.jboss.dna.jcr.nodetype.InvalidNodeTypeDefinitionException;
+import org.jboss.security.config.IDTrustConfiguration;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -93,10 +97,22 @@
.registerNamespace("car", "http://www.jboss.org/dna/examples/cars/1.0")
.addNodeTypes(resourceUrl("cars.cnd"))
.setOption(Option.ANONYMOUS_USER_ROLES,
- JcrSession.DNA_READ_PERMISSION + "," + JcrSession.DNA_WRITE_PERMISSION);
+ JcrSession.DNA_READ_PERMISSION + "," + JcrSession.DNA_WRITE_PERMISSION)
+ .setOption(Option.JAAS_LOGIN_CONFIG_NAME, "dna-jcr");
engine = configuration.build();
engine.start();
+ // Initialize the JAAS configuration to allow for an admin login later
+ // Initialize IDTrust
+ String configFile = "security/jaas.conf.xml";
+ IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
+
+ try {
+ idtrustConfig.config(configFile);
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+
// Start the repository ...
repository = engine.getRepository("cars");
@@ -363,4 +379,23 @@
assertResults(query, result, 1);
assertResultsHaveColumns(result, "jcr:primaryType", "jcr:path", "jcr:score");
}
+
+ /*
+ * Adding this test case since its primarily a test of integration between the RNTM and the query engine
+ */
+ @Test( expected = InvalidNodeTypeDefinitionException.class )
+ public void shouldNotAllowUnregisteringUsedPrimaryType() throws Exception {
+ Session adminSession = null;
+
+ try {
+ adminSession = repository.login(new SimpleCredentials("superuser", "superuser".toCharArray()));
+ adminSession.setNamespacePrefix("cars", "http://www.jboss.org/dna/examples/cars/1.0");
+
+ JcrNodeTypeManager nodeTypeManager = (JcrNodeTypeManager)adminSession.getWorkspace().getNodeTypeManager();
+ nodeTypeManager.unregisterNodeType(Collections.singletonList("cars:Car"));
+ } finally {
+ if (adminSession != null) adminSession.logout();
+ }
+ }
+
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/WorkspaceLockManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/WorkspaceLockManagerTest.java 2010-01-07 14:47:53 UTC (rev 1551)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/WorkspaceLockManagerTest.java 2010-01-07 18:24:39 UTC (rev 1552)
@@ -65,11 +65,9 @@
validUuid = UUID.randomUUID();
validLocation = Location.create(validUuid);
- // Stub out the repository, since we only need a few methods ...
- repoTypeManager = new RepositoryNodeTypeManager(context, true);
PathFactory pathFactory = context.getValueFactories().getPathFactory();
- stub(repository.getRepositoryTypeManager()).toReturn(repoTypeManager);
+ stub(repository.getExecutionContext()).toReturn(context);
stub(repository.getRepositorySourceName()).toReturn(sourceName);
stub(repository.getPersistentRegistry()).toReturn(context.getNamespaceRegistry());
stub(repository.createWorkspaceGraph(anyString(), (ExecutionContext)anyObject())).toAnswer(new Answer<Graph>() {
@@ -92,6 +90,11 @@
}
});
+ // Stub out the repository, since we only need a few methods ...
+ repoTypeManager = new RepositoryNodeTypeManager(repository, true);
+
+ stub(repository.getRepositoryTypeManager()).toReturn(repoTypeManager);
+
executedRequests.clear();
}
15 years, 11 months
DNA SVN: r1551 - in trunk/dna-graph/src: main/java/org/jboss/dna/graph/connector/path/cache and 1 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-07 09:47:53 -0500 (Thu, 07 Jan 2010)
New Revision: 1551
Added:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultCacheStatistics.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/NoCachePolicy.java
Removed:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultPathCachePolicy.java
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySource.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/InMemoryWorkspaceCache.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/PathRepositoryCache.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/WorkspaceCache.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/package-info.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySourceTest.java
Log:
DNA-626 Change Default Path Repository Cache Behavior to Not Cache
Applied patch that reverts the default caching behavior for the path repository implementations to not cache. It is still possible to override the cache policy for any path repository by calling setCachePolicy(PathCachePolicy) on the repository source.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySource.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySource.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySource.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -37,7 +37,7 @@
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.connector.path.cache.DefaultPathCachePolicy;
+import org.jboss.dna.graph.connector.path.cache.NoCachePolicy;
import org.jboss.dna.graph.connector.path.cache.PathCachePolicy;
import org.jboss.dna.graph.connector.path.cache.PathRepositoryCache;
@@ -59,12 +59,10 @@
*/
public static final int DEFAULT_RETRY_LIMIT = 0;
- private static final int DEFAULT_CACHE_TIME_TO_LIVE_IN_SECONDS = 30;
-
/**
- * The default cache policy for this repository source (cache all nodes which remain valid for 30 seconds)
+ * The default cache policy for this repository source (no caching)
*/
- public static final PathCachePolicy DEFAULT_CACHE_POLICY = new DefaultPathCachePolicy(DEFAULT_CACHE_TIME_TO_LIVE_IN_SECONDS);
+ public static final PathCachePolicy DEFAULT_CACHE_POLICY = new NoCachePolicy();
protected int retryLimit = DEFAULT_RETRY_LIMIT;
protected String name;
Added: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultCacheStatistics.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultCacheStatistics.java (rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultCacheStatistics.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -0,0 +1,48 @@
+package org.jboss.dna.graph.connector.path.cache;
+
+import java.util.concurrent.atomic.AtomicLong;
+import net.jcip.annotations.ThreadSafe;
+
+/**
+ * Default, thread-safe implementation of {@link CacheStatistics} that uses {@link AtomicLong AtomicLongs} as counters for the
+ * statistics.
+ */
+@ThreadSafe
+public final class DefaultCacheStatistics implements CacheStatistics {
+ private final AtomicLong writes = new AtomicLong(0);
+ private final AtomicLong hits = new AtomicLong(0);
+ private final AtomicLong misses = new AtomicLong(0);
+ private final AtomicLong expirations = new AtomicLong(0);
+
+ public long getWrites() {
+ return writes.get();
+ }
+
+ public long getHits() {
+ return hits.get();
+ }
+
+ public long getMisses() {
+ return misses.get();
+ }
+
+ public long getExpirations() {
+ return expirations.get();
+ }
+
+ public long incrementWrites() {
+ return writes.getAndIncrement();
+ }
+
+ public long incrementHits() {
+ return hits.getAndIncrement();
+ }
+
+ public long incrementMisses() {
+ return misses.getAndIncrement();
+ }
+
+ public long incrementExpirations() {
+ return expirations.getAndIncrement();
+ }
+}
Property changes on: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultCacheStatistics.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultPathCachePolicy.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultPathCachePolicy.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultPathCachePolicy.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -1,63 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.graph.connector.path.cache;
-
-import net.jcip.annotations.Immutable;
-import org.jboss.dna.graph.connector.path.PathNode;
-
-/**
- * Trivial path cache policy implementation that caches all nodes in an in-memory cache.
- * <p>
- * As a result, this cache policy may not be safe for use with some large repositories as it does not attempt to limit cache
- * attempts based on the size of the node or the current size of the cache.
- * </p>
- */
-@Immutable
-public class DefaultPathCachePolicy implements PathCachePolicy {
-
- private static final long serialVersionUID = 1L;
-
- private final long cacheTimeToLiveInSeconds;
-
- public DefaultPathCachePolicy( long cacheTimeToLiveInSeconds ) {
- super();
- this.cacheTimeToLiveInSeconds = cacheTimeToLiveInSeconds;
- }
-
- /**
- * @return true for all nodes
- * @see PathCachePolicy#shouldCache(PathNode)
- */
- public boolean shouldCache( PathNode node ) {
- return true;
- }
-
- public long getTimeToLive() {
- return this.cacheTimeToLiveInSeconds;
- }
-
- public Class<? extends WorkspaceCache> getCacheClass() {
- return InMemoryWorkspaceCache.class;
- }
-}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/InMemoryWorkspaceCache.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/InMemoryWorkspaceCache.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/InMemoryWorkspaceCache.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -27,7 +27,6 @@
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.graph.connector.path.PathNode;
import org.jboss.dna.graph.property.Path;
@@ -39,9 +38,10 @@
public class InMemoryWorkspaceCache implements WorkspaceCache {
private final ConcurrentMap<Path, CacheEntry> nodesByPath = new ConcurrentHashMap<Path, CacheEntry>();
private PathCachePolicy policy = null;
- private InMemoryStatistics statistics = new InMemoryStatistics();
+ private DefaultCacheStatistics statistics = new DefaultCacheStatistics();
- public void initialize( PathCachePolicy policy ) {
+ public void initialize( PathCachePolicy policy,
+ String workspaceName ) {
if (this.policy != null) {
throw new IllegalStateException();
}
@@ -49,8 +49,12 @@
this.policy = policy;
}
+ protected PathCachePolicy policy() {
+ return policy;
+ }
+
public void clearStatistics() {
- statistics = new InMemoryStatistics();
+ statistics = new DefaultCacheStatistics();
}
public CacheStatistics getStatistics() {
@@ -81,7 +85,7 @@
assert node != null;
if (!policy.shouldCache(node)) return;
-
+
statistics.incrementWrites();
nodesByPath.put(node.getPath(), new CacheEntry(node));
}
@@ -104,10 +108,6 @@
this.statistics = null;
}
- protected PathCachePolicy policy() {
- return this.policy;
- }
-
class CacheEntry {
private final SoftReference<PathNode> ref;
private final long expiryTime;
@@ -126,42 +126,38 @@
}
}
- class InMemoryStatistics implements CacheStatistics {
- private final AtomicLong writes = new AtomicLong(0);
- private final AtomicLong hits = new AtomicLong(0);
- private final AtomicLong misses = new AtomicLong(0);
- private final AtomicLong expirations = new AtomicLong(0);
+ /**
+ * Trivial path cache policy implementation that caches all nodes in an in-memory cache.
+ * <p>
+ * As a result, this cache policy may not be safe for use with some large repositories as it does not attempt to limit cache
+ * attempts based on the size of the node or the current size of the cache.
+ * </p>
+ */
+ public static class InMemoryCachePolicy implements PathCachePolicy {
- public long getWrites() {
- return writes.get();
- }
+ private static final long serialVersionUID = 1L;
- public long getHits() {
- return hits.get();
- }
+ private final long cacheTimeToLiveInSeconds;
- public long getMisses() {
- return misses.get();
+ public InMemoryCachePolicy( long cacheTimeToLiveInSeconds ) {
+ super();
+ this.cacheTimeToLiveInSeconds = cacheTimeToLiveInSeconds;
}
- public long getExpirations() {
- return expirations.get();
+ /**
+ * @return true for all nodes
+ * @see PathCachePolicy#shouldCache(PathNode)
+ */
+ public boolean shouldCache( PathNode node ) {
+ return true;
}
- public long incrementWrites() {
- return writes.getAndIncrement();
+ public long getTimeToLive() {
+ return this.cacheTimeToLiveInSeconds;
}
- public long incrementHits() {
- return hits.getAndIncrement();
+ public Class<? extends WorkspaceCache> getCacheClass() {
+ return InMemoryWorkspaceCache.class;
}
-
- public long incrementMisses() {
- return misses.getAndIncrement();
- }
-
- public long incrementExpirations() {
- return expirations.getAndIncrement();
- }
}
}
Copied: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/NoCachePolicy.java (from rev 1529, trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/DefaultPathCachePolicy.java)
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/NoCachePolicy.java (rev 0)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/NoCachePolicy.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -0,0 +1,52 @@
+/*
+ * 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.connector.path.cache;
+
+import net.jcip.annotations.Immutable;
+import org.jboss.dna.graph.connector.path.PathNode;
+
+/**
+ * Trivial path cache policy implementation that performs no caching at all
+ */
+@Immutable
+public class NoCachePolicy implements PathCachePolicy {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @return false for all nodes
+ * @see PathCachePolicy#shouldCache(PathNode)
+ */
+ public boolean shouldCache( PathNode node ) {
+ return false;
+ }
+
+ public long getTimeToLive() {
+ return 0;
+ }
+
+ public Class<? extends WorkspaceCache> getCacheClass() {
+ return InMemoryWorkspaceCache.class;
+ }
+}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/PathRepositoryCache.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/PathRepositoryCache.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/PathRepositoryCache.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -63,18 +63,18 @@
WorkspaceCache cache = cachesByName.get(workspaceName);
if (cache != null) return cache;
- cache = newCache();
+ cache = newCache(workspaceName);
cachesByName.putIfAbsent(workspaceName, cache);
return cachesByName.get(workspaceName);
}
- private final WorkspaceCache newCache() {
+ private final WorkspaceCache newCache( String workspaceName ) {
WorkspaceCache cache = null;
try {
cache = policy.getCacheClass().newInstance();
- cache.initialize(policy);
+ cache.initialize(policy, workspaceName);
} catch (IllegalAccessException iae) {
throw new IllegalStateException(iae);
} catch (InstantiationException ie) {
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/WorkspaceCache.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/WorkspaceCache.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/WorkspaceCache.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -31,7 +31,7 @@
* The basic contract for a workspace-level cache of paths to the nodes stored at that path.
* <p>
* Implementations must provide a no-argument constructor in order to be instantiated by {@link PathRepositoryCache}. After
- * instantiation, the {@link #initialize(PathCachePolicy)} method will be called to inject the cache policy into the
+ * instantiation, the {@link #initialize(PathCachePolicy, String)} method will be called to inject the cache policy into the
* implementation.
* </p>
* <p>
@@ -45,9 +45,11 @@
* Injects the cache policy into the cache
*
* @param policy the active cache policy for the repository source with which this cache is associated
+ * @param workspaceName the name of the workspace that this cache is managing
* @throws IllegalStateException if this method is called on a cache that has already been initialized.
*/
- public void initialize( PathCachePolicy policy );
+ public void initialize( PathCachePolicy policy,
+ String workspaceName );
/**
* Clears all statistics for this cache
@@ -71,7 +73,7 @@
/**
* Attempts to cache the given node. Implementations must call {@link PathCachePolicy#shouldCache(PathNode)} on the policy
- * from the {@link #initialize(PathCachePolicy)} method to determine if the node should be cached.
+ * from the {@link #initialize(PathCachePolicy, String)} method to determine if the node should be cached.
*
* @param node the node that is to be cached; may not be null
*/
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/package-info.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/package-info.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/cache/package-info.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -29,7 +29,7 @@
* <p>
* Each {@code AbstractPathRepositorySource} has a local instance of {@link PathRepositoryCache} that reads the {@code PathCachePolicy} for the source and uses it to create instances of
* {@link WorkspaceCache} for each workspace in the repository. When a workspace cache instance is requested for the first time from the {@link PathRepositoryCache#getCache(String)} method,
- * an instance of the class is created using the no-argument constructor for the class and {@link WorkspaceCache#initialize(PathCachePolicy)} is called with the current cache policy.
+ * an instance of the class is created using the no-argument constructor for the class and {@link WorkspaceCache#initialize(PathCachePolicy, String)} is called with the current cache policy.
* </p>
* <p>
* When {@link org.jboss.dna.graph.connector.path.AbstractPathRepositorySource#setCachePolicy(PathCachePolicy) the cache policy is changed} on the source, the existing {@code PathRepositoryCache}
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySourceTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySourceTest.java 2010-01-07 14:43:33 UTC (rev 1550)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/path/AbstractPathRepositorySourceTest.java 2010-01-07 14:47:53 UTC (rev 1551)
@@ -134,7 +134,8 @@
boolean closed = false;
PathCachePolicy policy;
- public void initialize( PathCachePolicy policy ) {
+ public void initialize( PathCachePolicy policy,
+ String workspaceName ) {
this.policy = policy;
}
15 years, 11 months
DNA SVN: r1550 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-07 09:43:33 -0500 (Thu, 07 Jan 2010)
New Revision: 1550
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/MapRequestProcessor.java
Log:
Fixed one eclipse warning and added some asserts to clarify intent.
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 2010-01-07 14:39:17 UTC (rev 1549)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/AbstractMapWorkspace.java 2010-01-07 14:43:33 UTC (rev 1550)
@@ -33,6 +33,7 @@
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.connector.UuidAlreadyExistsException;
@@ -721,6 +722,11 @@
return false;
}
+ @Override
+ public int hashCode() {
+ return HashCode.compute(getName());
+ }
+
/**
* {@inheritDoc}
*
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 2010-01-07 14:39:17 UTC (rev 1549)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java 2010-01-07 14:43:33 UTC (rev 1550)
@@ -98,8 +98,13 @@
public void process( ReadAllChildrenRequest request ) {
MapWorkspace workspace = getWorkspace(request, request.inWorkspace());
MapNode node = getTargetNode(workspace, request, request.of());
- if (node == null) return;
+ if (node == null) {
+ assert request.hasError();
+ return;
+ }
+
Location actualLocation = getActualLocation(request.of(), node);
+ assert actualLocation != null;
Path path = actualLocation.getPath();
// Get the names of the children ...
List<MapNode> children = node.getChildren();
@@ -142,13 +147,19 @@
public void process( ReadAllPropertiesRequest request ) {
MapWorkspace workspace = getWorkspace(request, request.inWorkspace());
MapNode node = getTargetNode(workspace, request, request.at());
- if (node == null) return;
+ if (node == null) {
+ assert request.hasError();
+ return;
+ }
+
// Get the properties of the node ...
Location actualLocation = getActualLocation(request.at(), node);
request.addProperty(propertyFactory.create(DnaLexicon.UUID, node.getUuid()));
for (Property property : node.getProperties().values()) {
request.addProperty(property);
}
+
+ assert actualLocation != null;
request.setActualLocationOfNode(actualLocation);
setCacheableInfo(request);
}
15 years, 11 months
DNA SVN: r1549 - in trunk/dna-jcr/src/main: resources/org/jboss/dna/jcr and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-07 09:39:17 -0500 (Thu, 07 Jan 2010)
New Revision: 1549
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties
Log:
DNA-591
Applied patch that cleanly (i.e., with proper internationalization) corrects the NPE and provides a reasonably useful error message instead.
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2010-01-07 07:22:38 UTC (rev 1548)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2010-01-07 14:39:17 UTC (rev 1549)
@@ -160,6 +160,8 @@
public static I18n cannotRedefineProperty;
public static I18n autocreatedPropertyNeedsDefault;
public static I18n singleValuedPropertyNeedsSingleValuedDefault;
+ public static I18n couldNotFindDefinitionOfRequiredPrimaryType;
+ public static I18n cannotRedefineChildNodeWithIncompatibleDefinition;
public static I18n noDefinition;
public static I18n noSnsDefinition;
@@ -174,6 +176,7 @@
public static I18n cannotUnregisterSupertype;
public static I18n cannotUnregisterRequiredPrimaryType;
public static I18n cannotUnregisterDefaultPrimaryType;
+ public static I18n cannotUnregisterInUseType;
public static I18n cannotAddMixin;
public static I18n invalidMixinTypeForNode;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2010-01-07 07:22:38 UTC (rev 1548)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2010-01-07 14:39:17 UTC (rev 1549)
@@ -45,6 +45,7 @@
import javax.jcr.version.OnParentVersionAction;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
+import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.text.TextEncoder;
import org.jboss.dna.common.text.XmlNameEncoder;
import org.jboss.dna.common.util.CheckArg;
@@ -1922,23 +1923,32 @@
for (JcrNodeDefinition ancestor : ancestors) {
if (ancestor.isProtected()) {
throw new InvalidNodeTypeDefinitionException(
- JcrI18n.cannotOverrideProtectedDefinition.text(ancestor.getDeclaringNodeType()
- .getName(),
+ JcrI18n.cannotOverrideProtectedDefinition.text(ancestor.getDeclaringNodeType().getName(),
"child node"));
}
if (ancestor.isMandatory() && !node.isMandatory()) {
throw new InvalidNodeTypeDefinitionException(
- JcrI18n.cannotMakeMandatoryDefinitionOptional.text(ancestor.getDeclaringNodeType()
- .getName(),
+ JcrI18n.cannotMakeMandatoryDefinitionOptional.text(ancestor.getDeclaringNodeType().getName(),
"child node"));
}
- for (int i = 0; i < ancestor.getRequiredPrimaryTypes().length; i++) {
- NodeType apt = ancestor.getRequiredPrimaryTypes()[i];
+ Name[] requiredPrimaryTypeNames = ancestor.requiredPrimaryTypeNames();
+ for (int i = 0; i < requiredPrimaryTypeNames.length; i++) {
+ NodeType apt = findTypeInMapOrList(requiredPrimaryTypeNames[i], pendingTypes);
+
+ if (apt == null) {
+ I18n msg = JcrI18n.couldNotFindDefinitionOfRequiredPrimaryType;
+ throw new InvalidNodeTypeDefinitionException(msg.text(requiredPrimaryTypeNames[i],
+ node.getName(),
+ node.getDeclaringNodeType()));
+
+ }
+
boolean found = false;
- for (Name name : node.getRequiredPrimaryTypeNames()) {
+
+ for (Name name : node.requiredPrimaryTypeNames()) {
JcrNodeType npt = findTypeInMapOrList(name, pendingTypes);
if (npt.isNodeType(apt.getName())) {
@@ -1947,12 +1957,8 @@
}
}
if (!found) {
- throw new InvalidNodeTypeDefinitionException(
- "Cannot redefine child node '"
- + nodeName
- + "' with required type '"
- + apt.getName()
- + "' with new child node that does not required that type or a subtype of that type.");
+ I18n msg = JcrI18n.cannotRedefineChildNodeWithIncompatibleDefinition;
+ throw new InvalidNodeTypeDefinitionException(msg.text(nodeName, apt.getName(), node.getDeclaringNodeType()));
}
}
@@ -1995,16 +2001,15 @@
Value[] defaultValues = prop.getDefaultValues();
if (prop.isAutoCreated() && !prop.isProtected() && (defaultValues == null || defaultValues.length == 0)) {
- throw new InvalidNodeTypeDefinitionException(JcrI18n.autocreatedPropertyNeedsDefault.text(prop.getName(),
- prop.getDeclaringNodeType()
- .getName()));
+ throw new InvalidNodeTypeDefinitionException(
+ JcrI18n.autocreatedPropertyNeedsDefault.text(prop.getName(),
+ prop.getDeclaringNodeType().getName()));
}
if (!prop.isMultiple() && (defaultValues != null && defaultValues.length > 1)) {
throw new InvalidNodeTypeDefinitionException(
JcrI18n.singleValuedPropertyNeedsSingleValuedDefault.text(prop.getName(),
- prop.getDeclaringNodeType()
- .getName()));
+ prop.getDeclaringNodeType().getName()));
}
Name propName = context.getValueFactories().getNameFactory().create(prop.getName());
@@ -2018,15 +2023,13 @@
for (JcrPropertyDefinition ancestor : ancestors) {
if (ancestor.isProtected()) {
throw new InvalidNodeTypeDefinitionException(
- JcrI18n.cannotOverrideProtectedDefinition.text(ancestor.getDeclaringNodeType()
- .getName(),
+ JcrI18n.cannotOverrideProtectedDefinition.text(ancestor.getDeclaringNodeType().getName(),
"property"));
}
if (ancestor.isMandatory() && !prop.isMandatory()) {
throw new InvalidNodeTypeDefinitionException(
- JcrI18n.cannotMakeMandatoryDefinitionOptional.text(ancestor.getDeclaringNodeType()
- .getName(),
+ JcrI18n.cannotMakeMandatoryDefinitionOptional.text(ancestor.getDeclaringNodeType().getName(),
"property"));
}
@@ -2037,16 +2040,14 @@
&& !Arrays.equals(ancestor.getValueConstraints(), prop.getValueConstraints())) {
throw new InvalidNodeTypeDefinitionException(
JcrI18n.constraintsChangedInSubtype.text(propName,
- ancestor.getDeclaringNodeType()
- .getName()));
+ ancestor.getDeclaringNodeType().getName()));
}
if (!isAlwaysSafeConversion(prop.getRequiredType(), ancestor.getRequiredType())) {
throw new InvalidNodeTypeDefinitionException(
JcrI18n.cannotRedefineProperty.text(propName,
PropertyType.nameFromValue(prop.getRequiredType()),
- ancestor.getDeclaringNodeType()
- .getName(),
+ ancestor.getDeclaringNodeType().getName(),
PropertyType.nameFromValue(ancestor.getRequiredType())));
}
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 2010-01-07 07:22:38 UTC (rev 1548)
+++ trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties 2010-01-07 14:39:17 UTC (rev 1549)
@@ -144,6 +144,8 @@
cannotRedefineProperty=Cannot redefine property '{0}' with new type '{1}' when existing property with same name in type '{2}' has incompatible type '{3}'
autocreatedPropertyNeedsDefault=Auto-created property '{0}' in type '{1}' must specify a default value
singleValuedPropertyNeedsSingleValuedDefault=Single-valued property '{0}' in type '{1}' cannot have multiple default values
+couldNotFindDefinitionOfRequiredPrimaryType = Could not find node type definition for the type of required primary type "{0}" while validating child node definition "{1}" of node type "{2}"
+cannotRedefineChildNodeWithIncompatibleDefinition = Cannot redefine child node "{0}" with required type "{1}" in node type "{2}" with new child node that does not require that type or a subtype of that type.
noDefinition=Cannot find a definition for the {0} named '{1}' on the node at '{2}' with primary type '{3}' and mixin types: {4}
noSnsDefinition=Cannot find a definition that allows same-name siblings for the child node named '{0}' on the node at '{1}' with primary type '{2}' and mixin types: {3} and a child node already exists with this name
@@ -158,6 +160,7 @@
cannotUnregisterSupertype=Cannot unregister type '{0}' which is supertype of type '{1}'
cannotUnregisterRequiredPrimaryType=Cannot unregister type '{0}' which is the required primary type for child node '{2}' on type '{1}'
cannotUnregisterDefaultPrimaryType=Cannot unregister type '{0}' which is the default primary type for child node '{2}' of type '{1}'
+cannotUnregisterInUseType=Cannot unregister type '{0}' because it is currently being used on at least one node
cannotAddMixin = This node does not allow adding the mixin type "{0}"
invalidMixinTypeForNode = "{0}" is not currently a mixin type for node "{1}"
15 years, 11 months
DNA SVN: r1548 - trunk/extensions/dna-connector-jdbc-metadata.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2010-01-07 02:22:38 -0500 (Thu, 07 Jan 2010)
New Revision: 1548
Modified:
trunk/extensions/dna-connector-jdbc-metadata/pom.xml
Log:
Changed the module description for 'dna-connector-jdbc-metadata' to specify that it is a connector for JDBC schema/metadata
Modified: trunk/extensions/dna-connector-jdbc-metadata/pom.xml
===================================================================
--- trunk/extensions/dna-connector-jdbc-metadata/pom.xml 2010-01-07 07:22:26 UTC (rev 1547)
+++ trunk/extensions/dna-connector-jdbc-metadata/pom.xml 2010-01-07 07:22:38 UTC (rev 1548)
@@ -10,7 +10,7 @@
<!-- The groupId and version values are inherited from parent -->
<artifactId>dna-connector-jdbc-metadata</artifactId>
<packaging>jar</packaging>
- <name>JBoss DNA Connector to JDBC</name>
+ <name>JBoss DNA Connector to JDBC Schemas</name>
<description>JBoss DNA Connector that processes JDBC metadata</description>
<url>http://labs.jboss.org/dna</url>
<dependencies>
15 years, 11 months
DNA SVN: r1547 - in trunk: docs/examples/gettingstarted and 1 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2010-01-07 02:22:26 -0500 (Thu, 07 Jan 2010)
New Revision: 1547
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
trunk/docs/examples/gettingstarted/pom.xml
trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties
Log:
DNA-616 The problem has to do with the fact that this example uses a FederatedRepositorySource as a source for a JpaRepository (which creates a FederatedRepositorySource on top of the supplied source). Thus, there is a FederatedRepositorySource that uses another FederatedRepositorySource, and this is the condition that causes the deadlock.
When the JcrRepository is created, it uses a SearchIndexer to crawl the content and create the requisite indexes for query/search. The SearchIndexer is create a CompositeRequestChannel (which it uses to submit to the designated repository source a CompositeRequest that remains open, allowing the SearchIndexer to supply requests and then use those requests to build other requests that are submitted within the same execution/transaction), and is submitting a ReadBranchRequest to the source that happens to be the lower FederatedRepositorySource. The FederatedRepositorySource returns a connection that has an execute(...) method that implements the work by using the fork-join algorithm to process the request, which in this case is the CompositeRequest (owned by the CompositeRequestChannel created by the SearchIndexer).
Now, the ForkRequestProcessor works on all the incoming request, which again is the CompositeRequest. The FRP's process(CompositeRequest) is actually inherited from RequestProcessor, and simply uses an iterator to get all of the requests within the CompositeRequest. The iterator promptly returns the first ReadBranchRequest, so the ForkRequestProcessor handles this via it's process(ReadBranchRequest), and like all of the ForkRequestProcessor.process(...) methods, forks the request into appropriate requests to submit to the underlying (federated) sources, and then it enqueues the forked requests into a queue.
Note that the ForkRequestProcessor does NOT mark the requests it processes as being completed. After all, this is the job of the JoinRequestProcessor.
Meanwhile, the ForkRequestProcessor.process(ReadBranchRequest) completes and returns, and the iterator in the ForkRequestProcessor.process(CompositeRequest) then attempts to get the next request.
But the SearchIndexer has only added one ReadBranchRequest and is waiting/blocking until that request is completed before it continues. But the FederatedRepositoryConnection is waiting/blocking until the next request is added to the CompositeRequest. Thus the deadlock.
The only way to break this deadlock is for the ReadRequestBranch to be completed. But, because of the way that FederatedRepositoryConnection.execute(...) is implemented, the ForkRequestProcessor.process(request) must complete before the JoinRequestProcessor is started. So we need to create and start the JoinRequestProcessor without waiting for the ForkRequestProcessor.process(request) to complete.
The solution is actually coded in the FederatedRepositoryConnection.execute(...) - there is a 'shouldProcessSynchronously(Request)' method that returns whether the ForkRequestProcessor should be processed synchronously or asynchronously, and is implemented to always return 'true' (synchronous). The solution to this problem requires that the method return 'false' for CompositeRequests that contain more than one (or an unknown number) of requests. (In other cases, there is just one request, so the forking can be done synchronously, saving the work of pushing the fork processing into the executor service.)
Thus, the 'shouldProcessSynchronously(Request)' was implemented to do this, and the test completed ... with an error. This error is caused by a bug in the JoinRequestProcessor.process(ReadBranchRequest) that failed to properly calculate the projected actual Locations for the ProxyNodes from the source requests. (Apparently the SearchIndexer reads a branch that is deeper than was previously tested.)
Fixing the JoinRequestProcessor.process(ReadBranchRequest) allows the repository example test cases to complete successfully.
See the attached patch, which was committed and verified with a full integration build (all unit and integration tests pass). The patch also changes the log level of the repository example back to 'ERROR' (what it was previously), and also re-enables the 'docs/examples/gettingstarted/repository' project in the 'docs/examples/gettingstarted/pom.xml'.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2010-01-07 04:05:33 UTC (rev 1546)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2010-01-07 07:22:26 UTC (rev 1547)
@@ -134,14 +134,18 @@
}
protected boolean shouldProcessSynchronously( Request request ) {
+ if (request instanceof CompositeRequest) {
+ CompositeRequest composite = (CompositeRequest)request;
+ if (composite.size() == 1) return true;
+ // There is more than one request, and the JoinRequestProcessor needs to be able to run even if
+ // the ForkRequestProcessor is processing incoming requests. Normally this would work fine,
+ // but if the incoming request is a CompositeRequestChannel.CompositeRequest, the ForkRequestProcessor
+ // will block if the channel is still open. In a synchronous mode, this prevents the JoinRequestProcessor
+ // from completing the incoming requests. See DNA-616 for details.
+ return false;
+ }
+ // Otherwise, its just a single request ...
return true;
- // if (request instanceof CompositeRequest) {
- // CompositeRequest composite = (CompositeRequest)request;
- // if (composite.size() == 1) return true;
- // return false;
- // }
- // // Otherwise, its just a single request ...
- // return true;
}
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java 2010-01-07 04:05:33 UTC (rev 1546)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java 2010-01-07 07:22:26 UTC (rev 1547)
@@ -611,7 +611,14 @@
ReadNodeRequest placeholderRequest = new ReadNodeRequest(placeholder.location(), workspace.getName());
List<Location> children = new ArrayList<Location>(placeholder.children().size());
for (ProjectedNode child : placeholder.children()) {
- children.add(child.location()); // the ProxyNodes will have only a path!
+ if (child instanceof ProxyNode) {
+ ProxyNode proxy = (ProxyNode)child;
+ children.add(proxy.federatedLocation()); // the ProxyNodes will have only a path!
+ proxy.federatedLocation();
+ } else {
+ assert child instanceof PlaceholderNode;
+ children.add(child.location());
+ }
}
placeholderRequest.addChildren(children);
placeholderRequest.addProperties(placeholder.properties().values());
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2010-01-07 04:05:33 UTC (rev 1546)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2010-01-07 07:22:26 UTC (rev 1547)
@@ -497,6 +497,17 @@
return actual;
}
+ protected Location determineActualLocation( Location actualInSource,
+ Projection projection ) {
+ assert projection != null;
+ // Get the projection from the source-specific location ...
+ Path pathInSource = actualInSource.getPath();
+ for (Path path : projection.getPathsInRepository(pathInSource, pathFactory)) {
+ return actualInSource.with(path);
+ }
+ return actualInSource;
+ }
+
/**
* {@inheritDoc}
*
@@ -657,6 +668,8 @@
projectToFederated(actualLocation, projection, request, parent, children, properties);
}
Location locationOfProxy = readFromSource.getActualLocationOfNode();
+ // The location is in terms of the source, so get the projected location ...
+ locationOfProxy = determineActualLocation(locationOfProxy, projection);
actualLocationsOfProxyNodes.put(locationOfProxy.getPath(), locationOfProxy);
}
setCacheableInfo(request, fromSource.getCachePolicy());
Modified: trunk/docs/examples/gettingstarted/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/pom.xml 2010-01-07 04:05:33 UTC (rev 1546)
+++ trunk/docs/examples/gettingstarted/pom.xml 2010-01-07 07:22:26 UTC (rev 1547)
@@ -10,7 +10,7 @@
<modules>
<module>sequencers</module>
- <!-- module>repositories</module -->
+ <module>repositories</module>
</modules>
<dependencyManagement>
Modified: trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties 2010-01-07 04:05:33 UTC (rev 1546)
+++ trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties 2010-01-07 07:22:26 UTC (rev 1547)
@@ -5,7 +5,7 @@
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
# Root logger option
-log4j.rootLogger=WARNING, stdout
+log4j.rootLogger=ERROR, stdout
# Set up the default logging to be INFO level, then override specific units
-log4j.logger.org.jboss.dna=WARNING
+log4j.logger.org.jboss.dna=ERROR
15 years, 11 months
DNA SVN: r1546 - trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-06 23:05:33 -0500 (Wed, 06 Jan 2010)
New Revision: 1546
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
Log:
DNA-617 NPE while updating indexes (during integration tests)
Applied the patch to correct an issue in the connector that caused it calculate an SNS index of 2 for all nodes whose SNS index was not supposed to be 1. The expanded TCK test data exposed this.
Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java 2010-01-07 02:59:55 UTC (rev 1545)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java 2010-01-07 04:05:33 UTC (rev 1546)
@@ -363,9 +363,13 @@
while (iter.hasPrevious()) {
Location existing = iter.previous();
Path.Segment segment = existing.getPath().getLastSegment();
- if (!segment.getName().equals(childName)) continue;
- // Otherwise the name matched, so get the indexes ...
- nextSnsIndex = segment.getIndex() + 1;
+ if (segment.getName().equals(childName)) {
+ // Otherwise the name matched, so get the indexes ...
+ nextSnsIndex = segment.getIndex() + 1;
+
+ // We've found the last match, so no need to loop further
+ break;
+ }
}
}
} else {
15 years, 11 months
DNA SVN: r1545 - trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-06 21:59:55 -0500 (Wed, 06 Jan 2010)
New Revision: 1545
Modified:
trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java
Log:
Fixed eclipse warning in a different way
Modified: trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java
===================================================================
--- trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java 2010-01-07 02:08:01 UTC (rev 1544)
+++ trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java 2010-01-07 02:59:55 UTC (rev 1545)
@@ -121,7 +121,11 @@
called = true;
}
- @SuppressWarnings( "unused" )
+ /**
+ * @param context
+ * @param output
+ * @param enumMetadata
+ */
public void recordEnum( StreamSequencerContext context,
SequencerOutput output,
EnumMetadata enumMetadata ) {
15 years, 11 months
DNA SVN: r1544 - trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-06 21:08:01 -0500 (Wed, 06 Jan 2010)
New Revision: 1544
Modified:
trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties
Log:
DNA-625 JdbcMetadataRepositoryTckTest Failing When Run From Command-Line
Applied patch that shrinks the size of the repository for the test back down.
Modified: trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties
===================================================================
--- trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties 2010-01-07 01:21:20 UTC (rev 1543)
+++ trunk/dna-integration-tests/src/test/resources/tck/jdbcmeta/repositoryOverlay.properties 2010-01-07 02:08:01 UTC (rev 1544)
@@ -5,7 +5,7 @@
javax.jcr.tck.dnaNodeTypePath=/org/jboss/dna/connector/meta/jdbc/connector-metajdbc.cnd
# The fan-out from the tables node is HUGE in HSQLDB. This allows the tests to complete reasonably quickly.
-javax.jcr.tck.testroot=/default/INFORMATION_SCHEMA
+javax.jcr.tck.testroot=/default/INFORMATION_SCHEMA/tables/SYSTEM_USERS
# There's only one workspace per repository for this connector right now
javax.jcr.tck.workspacename=default
15 years, 11 months
DNA SVN: r1543 - trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2010-01-06 20:21:20 -0500 (Wed, 06 Jan 2010)
New Revision: 1543
Modified:
trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java
Log:
Fixed eclipse warnings
Modified: trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java
===================================================================
--- trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java 2010-01-07 01:16:33 UTC (rev 1542)
+++ trunk/extensions/dna-sequencer-classfile/src/test/java/org/jboss/dna/sequencer/classfile/ClassFileSequencerTest.java 2010-01-07 01:21:20 UTC (rev 1543)
@@ -121,6 +121,7 @@
called = true;
}
+ @SuppressWarnings( "unused" )
public void recordEnum( StreamSequencerContext context,
SequencerOutput output,
EnumMetadata enumMetadata ) {
15 years, 11 months