[Mulgara-svn] r101 - in branches/xafix/src/jar: resolver/java/org/mulgara/resolver resolver-relational/java/org/mulgara/resolver/relational resolver-test/java/org/mulgara/resolver/test resolver-view/java/org/mulgara/resolver/view
andrae at mulgara.org
andrae at mulgara.org
Mon Oct 16 04:26:13 UTC 2006
Author: andrae
Date: 2006-10-15 23:26:12 -0500 (Sun, 15 Oct 2006)
New Revision: 101
Removed:
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJenaDatabaseSession.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java
Modified:
branches/xafix/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
branches/xafix/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
branches/xafix/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/Database.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransactionManager.java
branches/xafix/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
Log:
Two components to this commit:
1. Starting to really flesh out the transactions now - Moving
Database/DatabaseSession/DatabaseOperationContext to use the new architecture.
OperationContext will need to be finished, and made independent of
DatabaseSession - this will entail an 1-n relationship, as we will be 1-1 with
operations rather than 1-1 with sessions. The context will need to register an
XAResource to provide notification of the end of the transaction so caches and
the like can be cleaned up.
2. Removed RelatedTo and started removing Jena. It is going to be faster to
remove these then to port them to the new architecture - neither is useful so
they're gone.
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -155,9 +155,6 @@
String systemResolverFactoryClassName =
"org.mulgara.resolver.memory.MemoryResolverFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
// Create a database which keeps its system models on the Java heap
database = new Database(
databaseURI,
@@ -178,7 +175,6 @@
systemResolverFactoryClassName, // temporary
null,
"", // no rules engine
- relatedQueryHandlerClassName,
"org.mulgara.content.rdfxml.RDFXMLContentHandler");
}
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/Database.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/Database.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/Database.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -49,8 +49,6 @@
import java.util.Set;
import javax.naming.NamingException;
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
import org.apache.log4j.Logger;
import org.jrdf.vocabulary.RDF;
@@ -253,10 +251,9 @@
private final TransactionManagerFactory transactionManagerFactory;
/**
- * JTS transaction manager used to distribute transactions over multiple
- * resolvers.
+ * Transaction manager used to manage transactional operations
*/
- private final TransactionManager transactionManager;
+ private final MulgaraTransactionManager transactionManager;
/** The unique {@link URI} naming this database. */
private final URI uri;
@@ -271,11 +268,6 @@
private final SessionFactory unsecuredSessionFactory =
new UnsecuredSessionFactory();
- /**
- * The related query handler.
- */
- private final String relatedQueryHandler;
-
//
// Constructor
//
@@ -302,7 +294,6 @@
* @throws ResolverException
* @throws ResolverFactoryException
* @throws StringPoolException
- * @throws SystemException
* @throws URISyntaxException
*
* @deprecated This constructor will be removed once back-compatibility to
@@ -316,7 +307,7 @@
NamingException, NodePoolException, QueryException,
ResolverException, ResolverFactoryException,
SecurityAdapterFactoryException, StringPoolException,
- SystemException, URISyntaxException
+ URISyntaxException
{
// Construct this resolver backed by in-memory components
this(uri, // database name
@@ -355,7 +346,6 @@
config.getTemporaryResolverFactory().getDir()
),
config.getRuleLoader().getType(),
- config.getRelatedQueryHandler().getType(),
config.getDefaultContentHandler().getType());
if (logger.isDebugEnabled()) {
@@ -402,8 +392,6 @@
* @param ruleLoaderClassName the name of a
* {@link RuleLoader} implementation which will be used for loading
* rule frameworks, never <code>null</code>
- * @param relatedQueryHandler the name of the class that implements
- * {@link RelatedQueryHandler}
* @param defaultContentHandlerClassName the name of the class that should be
* used to parse external content of unknown MIME type, or
* <code>null</code> to disable blind parsing
@@ -413,7 +401,6 @@
* @throws InitializerException if the {@link NodePoolFactory},
* {@link ResolverFactory}, or {@link StringPoolFactory} instances
* generated from the various class names can't be initialized
- * @throws SystemException if <var>transactionTimeout</var> is negative
*/
public Database(URI uri,
File directory,
@@ -433,12 +420,11 @@
String temporaryResolverFactoryClassName,
File temporaryResolverDirectory,
String ruleLoaderClassName,
- String relatedQueryHandler,
String defaultContentHandlerClassName)
throws ConfigurationException, InitializerException, LocalizeException,
NamingException, NodePoolException, QueryException,
ResolverException, ResolverFactoryException, StringPoolException,
- SystemException, URISyntaxException
+ URISyntaxException
{
if (logger.isDebugEnabled()) {
logger.debug("Constructing database");
@@ -498,9 +484,6 @@
if (ruleLoaderClassName == null) {
throw new IllegalArgumentException("Null 'ruleLoaderClassName' parameter");
}
- if (relatedQueryHandler == null) {
- throw new IllegalArgumentException("Null 'relatedQueryHandler' parameter");
- }
// Initialize fields
this.uri = uri;
@@ -524,22 +507,17 @@
}
assert this.contentHandlers != null;
- // FIXME: Migrate this code inside StringPoolSession. Pass config to StringPoolSession.
- this.transactionManager = transactionManagerFactory.newTransactionManager();
+ this.transactionManager = new MulgaraTransactionManager(transactionManagerFactory);
// Set the transaction timeout to an hour
try {
transactionManager.setTransactionTimeout(transactionTimeout);
- }
- catch (SystemException e) {
+ } catch (MulgaraTransactionException e) {
logger.warn(
"Unable to set transaction timeout to " + transactionTimeout + "s", e
);
}
- // Set related query handler
- this.relatedQueryHandler = relatedQueryHandler;
-
// Enable resolver initialization
if (logger.isDebugEnabled()) {
logger.debug("Creating initialization session");
@@ -556,6 +534,7 @@
logger.info("Unable to obtain local host address "+
"aliases", ex);
}
+
// Attempt to obtain the localhost name
try {
hostNames.add(InetAddress.getLocalHost().getHostName());
@@ -716,7 +695,6 @@
metadata,
contentHandlers,
unmodifiableCachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI,
ruleLoaderClassName);
@@ -933,7 +911,6 @@
metadata,
contentHandlers,
unmodifiableCachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI,
ruleLoaderClassName);
} catch (ResolverFactoryException e) {
@@ -962,7 +939,6 @@
metadata,
contentHandlers,
cachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI);
}
catch (ResolverFactoryException e) {
@@ -991,7 +967,6 @@
metadata,
contentHandlers,
cachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI);
}
catch (ResolverFactoryException e) {
@@ -1231,7 +1206,6 @@
metadata,
contentHandlers,
unmodifiableCachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI,
ruleLoaderClassName);
}
@@ -1261,7 +1235,6 @@
metadata,
contentHandlers,
cachedResolverFactorySet,
- relatedQueryHandler,
temporaryModelTypeURI);
}
catch (ResolverFactoryException e) {
@@ -1269,34 +1242,6 @@
}
}
- /**
- * @return an unsecured {@link Session} to the outer {@link Database}
- */
- public Session newJenaSession() throws QueryException
- {
- try {
- return new LocalJenaDatabaseSession(
- transactionManager,
- Collections.singletonList(
- new SystemModelSecurityAdapter(metadata.getSystemModelNode())
- ),
- unmodifiableSymbolicTransformationList,
- jrdfSessionFactory,
- systemResolverFactory,
- temporaryResolverFactory,
- unmodifiableResolverFactoryList,
- unmodifiableExternalResolverFactoryMap,
- unmodifiableInternalResolverFactoryMap,
- metadata,
- contentHandlers,
- cachedResolverFactorySet,
- relatedQueryHandler,
- temporaryModelTypeURI);
- }
- catch (ResolverFactoryException e) {
- throw new QueryException("Couldn't create session", e);
- }
- }
/**
* {@inheritDoc} This method is a no-op in this implementation.
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -127,7 +127,6 @@
config.getTemporaryResolverFactory().getType(),
subdir(directory, config.getTemporaryResolverFactory().getDir()),
config.getRuleLoader().getType(),
- config.getRelatedQueryHandler().getType(),
config.getDefaultContentHandler().getType());
if (logger.isDebugEnabled()) {
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -128,7 +128,7 @@
private final List securityAdapterList;
private final URI temporaryModelTypeURI;
private final ResolverFactory temporaryResolverFactory;
- private final TransactionManager transactionManager;
+ private final MulgaraTransactionManager transactionManager;
//
// Constructor
@@ -147,7 +147,7 @@
List securityAdapterList,
URI temporaryModelTypeURI,
ResolverFactory temporaryResolverFactory,
- TransactionManager transactionManager)
+ MulgaraTransactionManager transactionManager)
{
assert cachedModelSet != null;
assert cachedResolverFactorySet != null;
@@ -422,38 +422,20 @@
*/
Resolver enlistResolver(Resolver resolver) throws QueryException
{
- // Obtain the transaction over the current thread
- Transaction transaction;
try {
- transaction = transactionManager.getTransaction();
- }
- catch (Exception e) {
- throw new QueryException("Unable to obtain transaction", e);
- }
- if (transaction == null) {
- if (databaseSession.getTransaction() != null) {
- logger.error("Transaction suspended and not resumed when enlisting resolver");
+ MulgaraTransaction transaction = transactionManager.getTransaction();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Enlisting " + resolver);
}
- else {
- logger.error("Not in Transaction when enlisting resolver");
- }
- throw new QueryException("Failed to find transaction when enlisting resolver");
- }
- // Enlist the resolver into the transaction
- XAResource xaResource = resolver.getXAResource();
- if (logger.isDebugEnabled()) {
- logger.debug("Enlisting " + resolver);
- }
+ transaction.enlistResource(resolver.getXAResource());
- try {
- transaction.enlistResource(xaResource);
+ return resolver;
+ } catch (MulgaraTransactionException em) {
+ throw new QueryException("Unable to enlist " + resolver + " into transaction", em);
}
- catch (Exception e) {
- throw new QueryException("Unable to enlist " + resolver + " into transaction", e);
- }
- return resolver;
}
/**
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -166,6 +166,11 @@
*/
private ContentHandlerManager contentHandlers;
+ /**
+ * The transcation manager for this database.
+ */
+ MulgaraTransactionManager transactionManager;
+
//
// Constructor
//
@@ -199,13 +204,11 @@
* never <code>null</code>
* @param contentHandlers contains the list of valid registered content handles
* never <code>null</code>
- * @param relatedQueryClass the name of the class that implements
- * {@link RelatedQueryHandler}
* @param temporaryModelTypeURI the URI of the model type to use to cache
* external models
* @throws IllegalArgumentException if any argument is <code>null</code>
*/
- DatabaseSession(TransactionManager transactionManager,
+ DatabaseSession(MulgaraTransactionManager transactionManager,
List securityAdapterList,
List symbolicTransformationList,
ResolverSessionFactory resolverSessionFactory,
@@ -217,7 +220,6 @@
DatabaseMetadata metadata,
ContentHandlerManager contentHandlers,
Set cachedResolverFactorySet,
- String relatedQueryClass,
URI temporaryModelTypeURI,
String ruleLoaderClassName) throws ResolverFactoryException {
@@ -250,8 +252,6 @@
throw new IllegalArgumentException("Null \"contentHandlers\" parameter");
} else if (metadata == null) {
throw new IllegalArgumentException("Null \"metadata\" parameter");
- } else if (relatedQueryClass == null) {
- throw new IllegalArgumentException("Null \"relatedQueryClass\" parameter");
} else if (ruleLoaderClassName == null) {
ruleLoaderClassName = DUMMY_RULE_LOADER;
}
@@ -268,22 +268,6 @@
);
}
- try {
- if (relatedQueryClass != null) {
- //load class
- Class storeClass = Class.forName(relatedQueryClass);
-
- //get appropriate constructor
- Constructor constructor = storeClass.getConstructor(new Class[] {
- Session.class });
- }
- }
- catch (Exception e) {
- //throw new IllegalArgumentException("Cannot find class: " +
- throw new ResolverFactoryException("Cannot find class: " +
- relatedQueryClass, e);
- }
-
// Initialize fields
this.transactionManager = transactionManager;
this.securityAdapterList = securityAdapterList;
@@ -407,12 +391,11 @@
DatabaseMetadata metadata,
ContentHandlerManager contentHandlers,
Set cachedResolverFactorySet,
- String relatedQueryClass,
URI temporaryModelTypeURI) throws ResolverFactoryException {
this(transactionManager, securityAdapterList, symbolicTransformationList, resolverSessionFactory,
systemResolverFactory, temporaryResolverFactory, resolverFactoryList, externalResolverFactoryMap,
internalResolverFactoryMap, metadata, contentHandlers, cachedResolverFactorySet,
- relatedQueryClass, temporaryModelTypeURI, "");
+ temporaryModelTypeURI, "");
}
public ResolverSession getResolverSession() {
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -171,9 +171,6 @@
String systemResolverFactoryClassName =
"org.mulgara.resolver.memory.MemoryResolverFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
// Create a database which keeps its system models on the Java heap
database = new Database(
databaseURI,
@@ -194,7 +191,6 @@
systemResolverFactoryClassName, // temporary
null,
"", // no rule loader
- relatedQueryHandlerClassName,
null); // no default content handler
//create and populate models
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -519,9 +519,6 @@
String systemResolverFactoryClassName =
"org.mulgara.resolver.memory.MemoryResolverFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
// Create a database which keeps its system models on the Java heap
database = new Database(
databaseURI,
@@ -542,7 +539,6 @@
systemResolverFactoryClassName, // temporary
null,
"", // no rule loader
- relatedQueryHandlerClassName,
null); // no default content handler
if (test.resolvers != null) {
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -171,7 +171,6 @@
"org.mulgara.resolver.memory.MemoryResolverFactory",
null,
"",
- "org.mulgara.resolver.RelatedQueryHandlerImpl",
null); // no default content handler
} catch (Exception e) {
fail(e);
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -33,13 +33,9 @@
import java.net.URISyntaxException;
import java.util.*;
-import javax.transaction.xa.XAResource;
import java.io.InputStream;
import java.io.OutputStream;
-// Java 2 enterprise packages
-import javax.transaction.TransactionManager;
-
// Third party packages
import org.apache.log4j.Logger;
import org.jrdf.graph.*;
@@ -118,28 +114,24 @@
* @param cachedResolverFactorySet contains the resolver factories that are
* to have access to their models cached, never <code>null</code>
* never <code>null</code>
- * @param relatedQueryHandler the name of the class that implements
- * {@link RelatedQueryHandler}
* @param temporaryModelTypeURI the type of model to use as a cache for
* external models
* @throws IllegalArgumentException if any argument is <code>null</code>
*/
- LocalJRDFDatabaseSession(TransactionManager transactionManager,
+ LocalJRDFDatabaseSession(MulgaraTransactionManager transactionManager,
List securityAdapterList, List symbolicTransformationList,
ResolverSessionFactory resolverSessionFactory,
SystemResolverFactory systemResolverFactory,
ResolverFactory temporaryResolverFactory, List resolverFactoryList,
Map externalResolverFactoryMap, Map internalResolverFactoryMap,
DatabaseMetadata metadata, ContentHandlerManager contentHandlers,
- Set cachedResolverFactorySet, String relatedQueryHandler,
- URI temporaryModelTypeURI)
+ Set cachedResolverFactorySet, URI temporaryModelTypeURI)
throws ResolverFactoryException {
super(transactionManager, securityAdapterList, symbolicTransformationList,
resolverSessionFactory,
systemResolverFactory, temporaryResolverFactory, resolverFactoryList,
externalResolverFactoryMap, internalResolverFactoryMap, metadata,
- contentHandlers, cachedResolverFactorySet, relatedQueryHandler,
- temporaryModelTypeURI);
+ contentHandlers, cachedResolverFactorySet, temporaryModelTypeURI);
jrdfFactory = new JRDFFactoryImpl();
}
Deleted: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJenaDatabaseSession.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJenaDatabaseSession.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/LocalJenaDatabaseSession.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -1,445 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-
-// Java 2 enterprise packages
-import javax.transaction.TransactionManager;
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-// JRDF classes
-import org.jrdf.graph.*;
-
-// Jena Classes
-import com.hp.hpl.jena.graph.Node_Variable;
-
-// Local packages
-import org.mulgara.content.ContentHandlerManager;
-import org.mulgara.jena.*;
-import org.mulgara.jrdf.*;
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.*;
-import org.mulgara.resolver.spi.*;
-import org.mulgara.server.*;
-import org.mulgara.store.statement.StatementStore;
-
-/**
- * A JRDF database session.
- *
- * @created 2004-10-26
- *
- * @author Andrew Newman
- *
- * @version $Revision: 1.12 $
- *
- * @modified $Date: 2005/05/19 08:43:59 $ by $Author: raboczi $
- *
- * @maintenanceAuthor $Author: raboczi $
- *
- * @copyright ©2004 <a href="http://www.tucanatech.com/">Tucana
- * Technology, Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class LocalJenaDatabaseSession extends LocalJRDFDatabaseSession
- implements LocalJenaSession {
-
- /**
- * Logger.
- */
- private static final Logger logger =
- Logger.getLogger(LocalJenaDatabaseSession.class.getName());
-
- /**
- * Factory use to map Jena blank nodes to JRDF blank nodes.
- */
- private JenaFactory jenaFactory;
-
- /**
- * Iterator handler.
- */
- private IteratorHandler iteratorHandler = new IteratorHandlerImpl();
-
-
- /**
- * Construct a database session.
- *
- * @param transactionManager the source of transactions for this session,
- * never <code>null</code>
- * @param securityAdapterList {@link List} of {@link SecurityAdapter}s to be
- * consulted before permitting operations, never <code>null</code>
- * @param symbolicTransformationList {@link List} of
- * {@link SymbolicTransformation}s to apply
- * @param resolverSessionFactory source of {@link ResolverSessionFactory}s,
- * never <code>null</code>
- * @param systemResolverFactory Source of {@link SystemResolver}s to manage
- * persistent models, for instance the system model (<code>#</code>); never
- * <code>null</code>
- * @param temporaryResolverFactory Source of {@link Resolver}s to manage
- * models which only last the duration of a transaction, for instance the
- * contents of external RDF/XML documents; never <code>null</code>
- * @param resolverFactoryList the list of registered {@link ResolverFactory}
- * instances to use for constraint resolution, never <code>null</code>
- * @param externalResolverFactoryMap map from URL protocol {@link String}s
- * to {@link ResolverFactory} instances for models accessed via that
- * protocol, never <code>null</code>
- * @param internalResolverFactoryMap map from model type {@link LocalNode}s
- * to {@link ResolverFactory} instances for that model type, never
- * <code>null</code>
- * @param metadata even more parameters from the parent {@link Database},
- * never <code>null</code>
- * @param contentHandlers contains the list of valid registered content handles
- * never <code>null</code>
- * @param relatedQueryHandler the name of the class that implements
- * {@link RelatedQueryHandler}
- * @throws IllegalArgumentException if any argument is <code>null</code>
- */
- LocalJenaDatabaseSession(TransactionManager transactionManager,
- List securityAdapterList, List symbolicTransformationList,
- ResolverSessionFactory resolverSessionFactory,
- SystemResolverFactory systemResolverFactory,
- ResolverFactory temporaryResolverFactory, List resolverFactoryList,
- Map externalResolverFactoryMap, Map internalResolverFactoryMap,
- DatabaseMetadata metadata, ContentHandlerManager contentHandlers,
- Set cachedResolverFactorySet, String relatedQueryHandler,
- URI temporaryModelTypeURI)
- throws ResolverFactoryException {
- super(transactionManager, securityAdapterList, symbolicTransformationList,
- resolverSessionFactory,
- systemResolverFactory, temporaryResolverFactory, resolverFactoryList,
- externalResolverFactoryMap, internalResolverFactoryMap, metadata,
- contentHandlers, cachedResolverFactorySet, relatedQueryHandler,
- temporaryModelTypeURI);
-
- jenaFactory = new JenaFactoryImpl();
- jrdfFactory = new JRDFFactoryImpl(jenaFactory);
- jenaFactory.setJrdfFactory(getJRDFFactory());
- }
-
- public void close() throws QueryException {
- iteratorHandler.close();
- super.close();
- }
-
- /**
- * @throws IllegalArgumentException if the graph given is not a Mulgara graph.
- */
- public com.hp.hpl.jena.util.iterator.ClosableIterator find(URI modelURI,
- com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node predicate,
- com.hp.hpl.jena.graph.Node object)
- throws QueryException, IllegalArgumentException {
-
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
-
- SubjectNode subjectNode;
- PredicateNode predicateNode;
- ObjectNode objectNode;
-
- // Only create a new blank node if not already in JRDF factory
- if (subject.isBlank() && !getJRDFFactory().hasNode(subject)) {
- subjectNode = new BlankNodeImpl();
- }
- else {
- subjectNode = getJRDFFactory().convertNodeToSubject(
- tmpGraph, subject);
- }
-
- predicateNode = getJRDFFactory().convertNodeToPredicate(
- tmpGraph, predicate);
-
- // Only create a new blank node if not already in JRDF factory
- if (object.isBlank() && !getJRDFFactory().hasNode(object)) {
- objectNode = new BlankNodeImpl();
- }
- else {
- objectNode = getJRDFFactory().convertNodeToObject(
- tmpGraph, object);
- }
-
- Answer answer = find(modelURI, subjectNode, predicateNode, objectNode);
-
- com.hp.hpl.jena.graph.Triple triple =
- new com.hp.hpl.jena.graph.Triple(subject, predicate, object);
-
- org.mulgara.jena.AnswerClosableIteratorImpl iter =
- new org.mulgara.jena.AnswerClosableIteratorImpl(answer, triple,
- modelURI, jenaFactory, iteratorHandler);
- return iter;
- }
- catch (URISyntaxException use) {
- throw new QueryException("Failed to find nodes", use);
- }
- catch (GraphElementFactoryException gefe) {
- throw new QueryException("Failed to find nodes", gefe);
- }
- catch (GraphException ge) {
- throw new QueryException("Failed to find nodes", ge);
- }
- }
-
- public boolean contains(URI modelURI, com.hp.hpl.jena.graph.Node subject,
- com.hp.hpl.jena.graph.Node predicate, com.hp.hpl.jena.graph.Node object)
- throws QueryException {
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
-
- SubjectNode subjectNode;
- PredicateNode predicateNode;
- ObjectNode objectNode;
-
- // Only create a new blank node if not already in JRDF factory
- if (subject.isBlank() && !getJRDFFactory().hasNode(subject)) {
- subjectNode = new BlankNodeImpl();
- }
- else {
- subjectNode = getJRDFFactory().convertNodeToSubject(
- tmpGraph, subject);
- }
-
- predicateNode = getJRDFFactory().convertNodeToPredicate(
- tmpGraph, predicate);
-
- // Only create a new blank node if not already in JRDF factory
- if (object.isBlank() && !getJRDFFactory().hasNode(object)) {
- objectNode = new BlankNodeImpl();
- }
- else {
- objectNode = getJRDFFactory().convertNodeToObject(
- tmpGraph, object);
- }
-
- return contains(modelURI, subjectNode, predicateNode, objectNode);
- }
- catch (URISyntaxException use) {
- throw new QueryException("Failed to find nodes", use);
- }
- catch (GraphElementFactoryException gefe) {
- throw new QueryException("Failed to find nodes", gefe);
- }
- catch (GraphException ge) {
- throw new QueryException("Failed to find nodes", ge);
- }
- }
-
- public void insert(URI modelURI,
- com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node predicate,
- com.hp.hpl.jena.graph.Node object) throws QueryException {
- startTransactionalOperation(true);
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
- modify(modelURI, tmpGraph, subject, predicate, object, true);
- return;
- }
- catch (Throwable e) {
- rollbackTransactionalBlock(e);
- }
- finally {
- finishTransactionalOperation("Could not commit insert");
- }
- }
-
- public void insert(URI modelURI, com.hp.hpl.jena.graph.Triple[] triples)
- throws QueryException {
- startTransactionalOperation(true);
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
- for (int index = 0; index < triples.length; index++) {
- modify(modelURI, tmpGraph, triples[index].getSubject(),
- triples[index].getPredicate(), triples[index].getObject(), true);
- }
- return;
- }
- catch (Throwable e) {
- rollbackTransactionalBlock(e);
- }
- finally {
- finishTransactionalOperation("Could not commit insert");
- }
- }
-
- /**
- * Converts Jena objects to JRDF objects and inserts them into the graph.
- *
- * @param modelURI the URI of the model.
- * @param tmpGraph the JRDF graph to use to localize objects.
- * @param subject the subject node to insert.
- * @param predicate the predicate node to insert.
- * @param object the object node to insert
- * @param add true if we're adding the statement, false to remove.
- * @throws Throwable if anything goes wrong.
- */
- private void modify(URI modelURI, JRDFGraph tmpGraph,
- com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node predicate,
- com.hp.hpl.jena.graph.Node object, boolean add) throws Throwable {
-
- SubjectNode subjectNode;
- PredicateNode predicateNode;
- ObjectNode objectNode;
-
- try {
- // Suspend the transaction in case JRDF needs it.
- suspendTransactionalBlock();
-
- // Convert Jena objects to JRDF objects
- subjectNode = getJRDFFactory().convertNodeToSubject(
- tmpGraph, subject);
- predicateNode = getJRDFFactory().convertNodeToPredicate(
- tmpGraph, predicate);
- objectNode = getJRDFFactory().convertNodeToObject(
- tmpGraph, object);
- }
- finally {
-
- // Resume the transaction.
- resumeTransactionalBlock();
- }
-
- Set statements = Collections.singleton(tmpGraph.getElementFactory().
- createTriple(subjectNode, predicateNode, objectNode));
-
- Statements wrapped = new TripleSetWrapperStatements(statements,
- systemResolver, TripleSetWrapperStatements.PERSIST);
- doModify(systemResolver, modelURI, wrapped, add);
- }
-
- public void delete(URI modelURI, com.hp.hpl.jena.graph.Node subject,
- com.hp.hpl.jena.graph.Node predicate, com.hp.hpl.jena.graph.Node object)
- throws QueryException {
- startTransactionalOperation(true);
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
- modify(modelURI, tmpGraph, subject, predicate, object, false);
- return;
- }
- catch (Throwable e) {
- rollbackTransactionalBlock(e);
- }
- finally {
- finishTransactionalOperation("Could not commit insert");
- }
- }
-
- public void delete(URI modelURI, com.hp.hpl.jena.graph.Triple[] triples)
- throws QueryException {
- startTransactionalOperation(true);
- try {
- JRDFGraph tmpGraph = new JRDFGraph(this, modelURI);
- for (int index = 0; index < triples.length; index++) {
- modify(modelURI, tmpGraph, triples[index].getSubject(),
- triples[index].getPredicate(), triples[index].getObject(), false);
- }
- return;
- }
- catch (Throwable e) {
- rollbackTransactionalBlock(e);
- }
- finally {
- finishTransactionalOperation("Could not commit insert");
- }
- }
-
- public long getNumberOfStatements(URI modelURI) throws QueryException {
- return getNumberOfTriples(modelURI);
- }
-
- public JenaFactory getJenaFactory() {
- return jenaFactory;
- }
-
- /**
- * @throws IllegalArgumentException if the graph given is not a Mulgara graph.
- */
- public com.hp.hpl.jena.util.iterator.ClosableIterator findUniqueValues(
- URI modelURI, Node_Variable column) throws QueryException {
-
- Variable realColumn = null;
- if (GraphMulgara.VARIABLES[0].equals(column)) {
- realColumn = StatementStore.VARIABLES[0];
- }
- else if (GraphMulgara.VARIABLES[1].equals(column)) {
- realColumn = StatementStore.VARIABLES[1];
- }
- else if (GraphMulgara.VARIABLES[2].equals(column)) {
- realColumn = StatementStore.VARIABLES[2];
- }
-
- //select $Subject $Predicate $Object
- ConstraintElement[] vars = new ConstraintElement[3];
- vars[0] = (ConstraintElement) StatementStore.VARIABLES[0];
- vars[1] = (ConstraintElement) StatementStore.VARIABLES[1];
- vars[2] = (ConstraintElement) StatementStore.VARIABLES[2];
-
- //where $Subject $Predicate $Object
- ConstraintImpl varConstraint = new ConstraintImpl(vars[0], vars[1], vars[2]);
-
- // Replace with mulgara:is instead. This will be much faster.
- //and ... ... ...
- ConstraintElement[] e = new ConstraintElement[3];
-
- return null;
-
-// try {
-// e[0] = (subject == null)
-// ? (ConstraintElement) StatementStore.VARIABLES[0]
-// : (ConstraintElement) toValue(subject);
-//
-// e[1] = (predicate == null)
-// ? (ConstraintElement) StatementStore.VARIABLES[1]
-// : (ConstraintElement) toValue(predicate);
-//
-// e[2] = (object == null)
-// ? (ConstraintElement) StatementStore.VARIABLES[2]
-// : (ConstraintElement) toValue(object);
-//
-// ConstraintImpl eConstraint = new ConstraintImpl(e[0], e[1], e[2]);
-//
-// return query(new Query(
-// Arrays.asList(vars), // variable list
-// new ModelResource(modelURI), // model expression
-// new ConstraintConjunction(varConstraint, eConstraint), // constraint expr
-// null, // no having
-// Collections.EMPTY_LIST, // no ordering
-// null, // no limit
-// 0, // zero offset
-// new UnconstrainedAnswer() // nothing given
-// ));
-// }
-// catch (QueryException qe) {
-// throw new GraphException("Failed to find the given triple pattern in " +
-// " the model.", qe);
-// }
- }
-}
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -43,8 +43,7 @@
* @licence Open Software License v3.0</a>
*/
public class MulgaraTransaction {
- private MulgaraTransactionManager Mulagaramanager;
- private TransactionManager manager;
+ private MulgaraTransactionManager mulagaraManager;
private Transaction transaction;
private Thread currentThread;
@@ -59,13 +58,10 @@
private int rollback;
private Throwable rollbackCause;
- public MulgaraTransaction(MulgaraTransactionManager mulgaraManager,
- TransactionManager manager) {
- this.mulgaraManager = mulgaraManager;
+ public MulgaraTransaction(MulgaraTransactionManager manager) {
this.manager = manager;
- manager.begin();
- transaction = manager.getTransaction();
+ this.transaction = manager.transactionStart();
inuse = 1; // Note: This implies implict activation as a part of construction.
using = 0;
@@ -85,7 +81,7 @@
if (inuse == 0) {
try {
- TransactionManager.resume(transaction);
+ mulgaraManager.transactionResumed(this);
} catch (Throwable th) {
logger.warn("Error resuming transaction: ", th);
failTransaction();
@@ -111,11 +107,13 @@
if (inuse == 0) {
if (using == 0) {
// END TRANSACTION HERE. But commit might fail.
- TransactionManager.commit(transaction);
+ manager.transactionComplete(this);
} else {
// What happens if suspend fails?
// Rollback and terminate transaction.
- TransactionManager.suspend(transaction);
+ // JTA isn't entirely unambiguous as to the long-term stability of the original
+ // transaction object - can suspend return a new object?
+ this.transaction = manager.transactionSuspended(this);
}
currentThread = null;
}
@@ -199,8 +197,20 @@
}
}
+ //
+ // Note that OperationContext needs to be decoupled from DatabaseSession, so that it is
+ // recreated for each operation - it also needs to provide an XAResource of it's own for
+ // enlisting in the transaction to clean-up caches and the like.
+ //
public void enlistResolver(Resolver resolver) {
XAResource resource = resolver.getXAResource();
transaction.enlistResource(xaResource);
}
+
+ /**
+ * Should only be visible to MulgaraTransactionManager.
+ */
+ protected Transaction getTransaction() {
+ return transaction;
+ }
}
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransactionManager.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransactionManager.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransactionManager.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -54,6 +54,9 @@
/** Map from session to transaction for all 'write' transactions that have been rolledback. */
private Map failedSessions;
+ /** Map from thread to associated transaction. */
+ private Map activeTransactions;
+
private TransactionManager transactionManager;
public MulgaraTransactionManager(TransactionManager transactionManager) {
@@ -86,6 +89,16 @@
writeTransaction = new MulgaraTransaction(this, transactionManager);
}
+
+ public synchronized MulgaraTransaction getTransaction() {
+ MulgaraTransaction transaction = activeTransactions.get(Thread.currentThread());
+ if (transaction != null) {
+ return transaction;
+ } else {
+ throw new MulgaraTransactionException("No transaction assoicated with current thread");
+ }
+ }
+
private synchronized void obtainWriteLock(Session session) {
while (currentWritingSession != null) {
writeLockMutex.wait();
@@ -162,9 +175,34 @@
// Otherwise - no-op.
}
+ //
+ // Transaction livecycle callbacks.
+ //
+
+ public synchronized Transaction transactionStart(MulgaraTransaction transaction) {
+ transactionManager.begin();
+ activeTransactions.put(Thread.currentThread(), transaction);
+
+ return transactionManager.getTransaction();
+ }
+
+ public synchronized void transactionResumed(MulgaraTransaction transaction) {
+ transactionManager.resume(transaction);
+ activeTransactions.put(Thread.currentThread(), transaction.getTransaction());
+ }
+
+ public synchronized Transaction transactionSuspended(MulgaraTransaction transaction) {
+ Transaction transaction = TransactionManager.suspend(transaction);
+ activeTransactions.remove(Thread.currentThread());
+
+ return transaction;
+ }
+
public synchronized void transactionComplete(MulgaraTransaction transaction) {
+ transactionManager.commit(transaction);
if (transaction == writeTransaction) {
releaseWriteLock();
}
+ activeTransactions.remove(Thread.currentThread());
}
}
Deleted: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -1,123 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// JRDF
-import org.jrdf.graph.Node;
-
-// Locally written packages
-import org.mulgara.query.Answer;
-import org.mulgara.query.Query;
-import org.mulgara.query.QueryException;
-import org.mulgara.server.Session;
-
-/**
- * Base class for related query handler implementations.
- *
- * @created 2003-10-27
- *
- * @author David Makepeace
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright © 2001-2003 <A href="http://www.pisoftware.com/">Plugged In
- * Software Pty Ltd</A>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public abstract class RelatedQueryHandler {
-
- /**
- * The session currently being used.
- */
- protected Session session;
-
- /*
- * Create a new related queries.
- *
- * @param newSession the session being used to do the querying.
- * @throws IllegalArgumentException if the session is not DatabaseSession.
- */
- public RelatedQueryHandler(Session newSession) throws IllegalArgumentException {
- if (!(newSession instanceof DatabaseSession)) {
- throw new IllegalArgumentException("Session must be a DatabaseSession");
- }
- session = newSession;
- }
-
- /**
- * Performs an inner query required for {@link #related}
- *
- * @param query the query to execute.
- * @return Answer the result of the query.
- * @throws QueryException if there was an error executing the query.
- */
- protected Answer innerQuery(Query query) throws QueryException {
- return ((DatabaseSession) session).innerQuery(query);
- }
-
- /**
- * Find related RDF nodes.
- *
- * @param baseNode the base RDF node.
- * @param queries the queries to perform
- * @param maxRelated the maximum number of rows to return
- * @param minScore related nodes must have at least this score
- * @return a non-<code>null</code> answer with two columns. The first column
- * is the RDF node and the second column is the score.
- * @throws QueryException if any of the <var>queries</var> can't be processed
- */
- public abstract Answer related(Node baseNode, Query[] queries,
- int maxRelated, double minScore) throws QueryException;
-
- /**
- * Show how two nodes are related.
- *
- * @param baseNode the base RDF node.
- * @param relatedNode the related RDF node.
- * @param queries the queries to perform.
- * @param nrPColumns the number of columns in the query results which identify
- * a category of arc linking the two RDF nodes. The columns used for this
- * purpose start at column 2 (the second column) of the result.
- * @return a non-<code>null</code> answer with two or more columns. The number
- * of columns is the value of the <code>nrColumns</code> parameter plus
- * one. The initial <code>nrPColumns</code> columns identify a particular
- * category of arc linking the two RDF nodes and the last column is the
- * score.
- * @throws QueryException if any of the <var>queries</var> can't be processed
- */
- public abstract Answer howRelated(Node baseNode, Node relatedNode,
- Query[] queries, int nrPColumns) throws QueryException;
-}
Deleted: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -1,94 +0,0 @@
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.sql.SQLException;
-import java.text.NumberFormat;
-import java.util.*;
-
-// Logging classes
-import org.apache.log4j.Logger;
-
-// JRDF
-import org.jrdf.graph.Node;
-
-// Locally written packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.LiteralImpl;
-import org.mulgara.server.*;
-import org.mulgara.store.*;
-import org.mulgara.util.ResultSetRow;
-import org.mulgara.util.TestResultSet;
-
-/**
- * All related queries are found here.
- *
- * @created 2003-10-27
- *
- * @author David Makepeace
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright © 2001-2004 <A href="http://www.PIsoftware.com/">Plugged In
- * Software Pty Ltd</A>
- */
-public class RelatedQueryHandlerImpl extends RelatedQueryHandler {
-
- /**
- * Logger. This is named after the class.
- */
- private final static Logger logger =
- Logger.getLogger(RelatedQueryHandlerImpl.class.getName());
-
- /*
- * Create a new related queries.
- *
- * @param newSession the session being used to do the querying.
- */
- public RelatedQueryHandlerImpl(Session newSession) {
- super(newSession);
- }
-
- /**
- * Find related RDF nodes.
- *
- * @param baseNode the base RDF node.
- * @param queries the queries to perform
- * @param maxRelated the maximum number of rows to return
- * @param minScore related nodes must have at least this score
- * @return a non-<code>null</code> answer with two columns. The first column
- * is the RDF node and the second column is the score.
- * @throws QueryException if any of the <var>queries</var> can't be processed
- */
- public synchronized Answer related(Node baseNode, Query[] queries,
- int maxRelated, double minScore) throws QueryException {
- throw new QueryException("Related queries are not supported in Mulgara");
- }
-
- /**
- * Show how two nodes are related.
- *
- * @param baseNode the base RDF node.
- * @param relatedNode the related RDF node.
- * @param queries the queries to perform.
- * @param nrPColumns the number of columns in the query results which identify
- * a category of arc linking the two RDF nodes. The columns used for this
- * purpose start at column 2 (the second column) of the result.
- * @return a non-<code>null</code> answer with two or more columns. The number
- * of columns is the value of the <code>nrColumns</code> parameter plus
- * one. The initial <code>nrPColumns</code> columns identify a particular
- * category of arc linking the two RDF nodes and the last column is the
- * score.
- * @throws QueryException if any of the <var>queries</var> can't be processed
- */
- public synchronized Answer howRelated(Node baseNode, Node relatedNode,
- Query[] queries, int nrPColumns) throws QueryException {
- throw new QueryException("Related queries are not supported in Mulgara");
- }
-}
Modified: branches/xafix/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -563,9 +563,6 @@
String tempResolverFactoryClassName =
"org.mulgara.resolver.memory.MemoryResolverFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
String ruleLoaderFactoryClassName =
"org.mulgara.rules.RuleLoaderFactory";
@@ -589,7 +586,6 @@
tempResolverFactoryClassName, // temporary models
null, // no dir for temp models
"", // no rule loader
- relatedQueryHandlerClassName,
"org.mulgara.content.rdfxml.RDFXMLContentHandler");
database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);
Modified: branches/xafix/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -225,9 +225,6 @@
String tempResolverFactoryClassName =
"org.mulgara.resolver.memory.MemoryResolverFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
String ruleLoaderFactoryClassName =
"org.mulgara.rules.RuleLoaderFactory";
@@ -251,7 +248,6 @@
tempResolverFactoryClassName, // temporary models
null, // no dir for temp models
"", // no rule loader
- relatedQueryHandlerClassName,
"org.mulgara.content.rio.RDFXMLContentHandler");
database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);
Modified: branches/xafix/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -408,9 +408,6 @@
String tmfClassName = "org.mulgara.resolver.JotmTransactionManagerFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
TransactionManagerFactory transactionManagerFactory =
(TransactionManagerFactory) Beans.instantiate(null, tmfClassName);
@@ -434,7 +431,6 @@
systemResolverFactoryClassName, // temporary
new File(persistenceDirectory, "cache"),
"", // no rule loader
- relatedQueryHandlerClassName,
null); // no default content handler
database.addResolverFactory("org.mulgara.resolver.test.TestResolverFactory", null);
Modified: branches/xafix/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
===================================================================
--- branches/xafix/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java 2006-10-13 11:44:40 UTC (rev 100)
+++ branches/xafix/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java 2006-10-16 04:26:12 UTC (rev 101)
@@ -573,9 +573,6 @@
String tmfClassName = "org.mulgara.resolver.JotmTransactionManagerFactory";
- String relatedQueryHandlerClassName =
- "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
TransactionManagerFactory transactionManagerFactory =
(TransactionManagerFactory) Beans.instantiate(null, tmfClassName);
@@ -599,7 +596,6 @@
systemResolverFactoryClassName, // temporary
new File(persistenceDirectory, "cache"),
"", // no rule loader
- relatedQueryHandlerClassName,
null); // no default content handler
database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);
More information about the Mulgara-svn
mailing list