[Mulgara-svn] r465 - in branches/mgr-58/src/jar: resolver/java/org/mulgara/resolver resolver-spi/java/org/mulgara/resolver/spi

andrae at mulgara.org andrae at mulgara.org
Wed Oct 10 08:32:37 UTC 2007


Author: andrae
Date: 2007-10-10 03:32:37 -0500 (Wed, 10 Oct 2007)
New Revision: 465

Modified:
   branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/DatabaseMetadata.java
   branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/FactoryInitializer.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/Database.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactoryInitializer.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseMetadataImpl.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseResolverFactoryInitializer.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSecurityAdapterInitializer.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSession.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSessionFactory.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
   branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
Log:
Cleaning up access to the databaseURI to ensure it is always delegated to the
database-metadata.  This ensures we always use the correct canonicallised URI.



Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/Database.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/Database.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/Database.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -193,7 +193,7 @@
   private final Map unmodifiableInternalResolverFactoryMap =
     Collections.unmodifiableMap(internalResolverFactoryMap);
 
-  private DatabaseMetadata metadata;
+  private DatabaseMetadataImpl metadata;
 
   /** The URI of the model type used for system models.  */
   URI systemModelTypeURI = null;
@@ -260,12 +260,6 @@
    */
   private final MulgaraTransactionManager transactionManager;
 
-  /** The unique {@link URI} naming this database.  */
-  private final URI uri;
-
-  /** The set of alternative hostnames for the current host. */
-  private final Set hostnameAliases;
-
   /**
    * A {@link SessionFactory} that produces {@link Session}s which aren't
    * subject to the registered {@link SecurityAdapter}s.
@@ -460,11 +454,11 @@
     // Validate parameters.
     if (uri == null) {
       throw new IllegalArgumentException("Null 'uri' parameter");
-    }
-    if (uri.getFragment() != null) {
+    } else if (uri.isOpaque()) {
+      throw new IllegalArgumentException("Database URI can't be opaque: " + uri);
+    } else if (uri.getFragment() != null) {
       throw new IllegalArgumentException("Database URI can't have a fragment part: " + uri);
-    }
-    if (uri.getQuery() != null) {
+    } else if (uri.getQuery() != null) {
       throw new IllegalArgumentException("Database URI can't have a query part: " + uri);
     }
     if (transactionManagerFactory == null) {
@@ -490,7 +484,6 @@
     }
 
     // Initialize fields
-    this.uri                       = uri;
     this.directory                 = directory;
     this.securityDomainURI         = securityDomainURI;
     this.transactionManagerFactory = transactionManagerFactory;
@@ -521,70 +514,30 @@
       logger.debug("Creating initialization session");
     }
 
-    // Create the set of alternative names for the current host.
-    Set hostNames = new HashSet();
-    hostNames.addAll(Arrays.asList(new String[] {"localhost", "127.0.0.1"}));
+    // Manage hostname aliases
+    Set hostnameAliases = identifyHostnames();
+    setHostnameAliases(hostnameAliases);
 
-    // Attempt to obtain the IP address
-    try {
-    	hostNames.add(InetAddress.getLocalHost().getHostAddress());
-    } catch(UnknownHostException ex) {
-      logger.info("Unable to obtain local host address "+
-          "aliases", ex);
-    }
-    // Attempt to obtain the localhost name
-    try {
-    	hostNames.add(InetAddress.getLocalHost().getHostName());
-    } catch(UnknownHostException ex) {
-      logger.info("Unable to obtain local host name for  "+
-          "aliases", ex);
-    }
-    if (startupLogger.isInfoEnabled()) {
-      StringBuffer aliases =
-        new StringBuffer("Host name aliases for this server are: [");
-      for (Iterator it = hostNames.iterator(); it.hasNext(); ) {
-        aliases.append(it.next().toString());
-        if (it.hasNext()) {
-          aliases.append(", ");
-        }
-      }
-      aliases.append("]");
-      startupLogger.info(aliases.toString());
-    }
+    metadata =
+      new DatabaseMetadataImpl(uri,
+                               hostnameAliases,
+                               securityDomainURI);
 
-    if (!uri.isOpaque()) {
-      String currentHost = uri.getHost();
-      if (currentHost != null) {
-        hostNames.add(currentHost.toLowerCase());
-      }
-    }
-    hostnameAliases = Collections.unmodifiableSet(hostNames);
-    setHostnameAliases(hostNames);
-
     // Create an instance of ResolverSessionFactory
     DatabaseFactoryInitializer persistentStringPoolFactoryInitializer =
-      new DatabaseFactoryInitializer(uri,
-                                     hostnameAliases,
-                                     persistentStringPoolDirectory);
+      new DatabaseFactoryInitializer(metadata, persistentStringPoolDirectory);
 
     DatabaseFactoryInitializer persistentNodePoolFactoryInitializer =
-      new DatabaseFactoryInitializer(uri,
-                                     hostnameAliases,
-                                     persistentNodePoolDirectory);
+      new DatabaseFactoryInitializer(metadata, persistentNodePoolDirectory);
 
     DatabaseFactoryInitializer temporaryStringPoolFactoryInitializer =
-      new DatabaseFactoryInitializer(uri,
-                                     hostnameAliases,
-                                     temporaryStringPoolDirectory);
+      new DatabaseFactoryInitializer(metadata, temporaryStringPoolDirectory);
 
     DatabaseFactoryInitializer temporaryNodePoolFactoryInitializer =
-      new DatabaseFactoryInitializer(uri,
-                                     hostnameAliases,
-                                     temporaryNodePoolDirectory);
+      new DatabaseFactoryInitializer(metadata, temporaryNodePoolDirectory);
 
     spSessionFactory = new StringPoolSessionFactory(
-      uri,
-      hostnameAliases,
+      metadata,
       persistentStringPoolFactoryClassName,
       persistentStringPoolFactoryInitializer,
       persistentNodePoolFactoryClassName,
@@ -601,8 +554,7 @@
     temporaryStringPoolFactoryInitializer.close();
     temporaryNodePoolFactoryInitializer.close();
 
-    DatabaseFactoryInitializer initializer =
-        new DatabaseFactoryInitializer(uri, hostnameAliases, directory);
+    DatabaseFactoryInitializer initializer = new DatabaseFactoryInitializer(metadata, directory);
 
     jrdfSessionFactory =
         new JRDFResolverSessionFactory(initializer, spSessionFactory);
@@ -611,9 +563,7 @@
     initializer.close();
 
     // Create the temporary resolver factory
-    initializer = new DatabaseFactoryInitializer(
-      uri, hostnameAliases, temporaryResolverDirectory
-    );
+    initializer = new DatabaseFactoryInitializer(metadata, temporaryResolverDirectory);
     temporaryResolverFactory = ResolverFactoryFactory.newSystemResolverFactory(
       temporaryResolverFactoryClassName, initializer, spSessionFactory
     );
@@ -621,41 +571,17 @@
     resolverFactoryList.add(temporaryResolverFactory);
 
     // Determine temporary model type URI
-    /*
-    // TODO: be less "clever" and more fault-tolerant in doing this
-    temporaryModelTypeURI =
-      (URI) ((Map.Entry) internalResolverFactoryMap.entrySet()
-                                                   .iterator()
-                                                   .next()).getKey();
-    */
     temporaryModelTypeURI = new URI(Mulgara.NAMESPACE + "MemoryModel");
     assert temporaryModelTypeURI != null;
 
-    /*
-    // Discard any temporary resolver state
-    if (temporaryResolverFactory instanceof SystemResolverFactory) {
-      try {
-        recoverDatabase(new SimpleXARecoveryHandler[] {
-          spSessionFactory,
-          (SystemResolverFactory) temporaryResolverFactory
-        });
-      }
-      catch (SimpleXAResourceException es) {
-        logger.fatal("Failed to recover cache");
-        throw new InitializerException("Failed to recover cache", es);
-      }
-    }
-    */
-
     // Create the system resolver factory
-    initializer = new DatabaseFactoryInitializer(
-      uri, hostnameAliases, persistentResolverDirectory
-    );
+    initializer = new DatabaseFactoryInitializer(metadata, persistentResolverDirectory);
     systemResolverFactory = ResolverFactoryFactory.newSystemResolverFactory(
       systemResolverFactoryClassName, initializer, spSessionFactory
     );
     initializer.close();
     resolverFactoryList.add(systemResolverFactory);
+    metadata.initializeSystemModelTypeURI(systemResolverFactory.getSystemModelTypeURI());
 
     // Recover the system resolver state
     try {
@@ -670,14 +596,6 @@
       logger.debug("Added system resolver " + systemResolverFactoryClassName);
     }
 
-
-    URI systemModelURI = new URI(uri.getScheme(), uri.getSchemeSpecificPart(), "");
-    metadata =
-      new DatabaseMetadataImpl(uri,
-                               hostnameAliases,
-                               securityDomainURI,
-                               systemResolverFactory.getSystemModelTypeURI());
-
     DatabaseSession session = new DatabaseSession(
         transactionManager,
         unmodifiableSecurityAdapterList,
@@ -695,7 +613,7 @@
         ruleLoaderClassName);
 
     // Updates metadata to reflect bootstrapped system model.
-    session.bootstrapSystemModel((DatabaseMetadataImpl)metadata);
+    session.bootstrapSystemModel(metadata);
     session.close();
 
     if (metadata.getSystemModelTypeURI() == null) {
@@ -946,6 +864,48 @@
   // Internal methods
   //
 
+  Set identifyHostnames() {
+    // Create the set of alternative names for the current host.
+    Set hostNames = new HashSet();
+    hostNames.addAll(Arrays.asList(new String[] {"localhost", "127.0.0.1"}));
+
+    // Attempt to obtain the IP address
+    try {
+    	hostNames.add(InetAddress.getLocalHost().getHostAddress());
+    } catch(UnknownHostException ex) {
+      logger.info("Unable to obtain local host address "+
+          "aliases", ex);
+    }
+    // Attempt to obtain the localhost name
+    try {
+    	hostNames.add(InetAddress.getLocalHost().getHostName());
+    } catch(UnknownHostException ex) {
+      logger.info("Unable to obtain local host name for  "+
+          "aliases", ex);
+    }
+    if (startupLogger.isInfoEnabled()) {
+      StringBuffer aliases =
+        new StringBuffer("Host name aliases for this server are: [");
+      for (Iterator it = hostNames.iterator(); it.hasNext(); ) {
+        aliases.append(it.next().toString());
+        if (it.hasNext()) {
+          aliases.append(", ");
+        }
+      }
+      aliases.append("]");
+      startupLogger.info(aliases.toString());
+    }
+
+//    This might cause a problem - but we shouldn't be relying on this.
+//
+//    String currentHost = uri.getHost();
+//    if (currentHost != null) {
+//      hostNames.add(currentHost.toLowerCase());
+//    }
+    return Collections.unmodifiableSet(hostNames);
+  }
+
+
   void addModelType(URI modelTypeURI, ResolverFactory resolverFactory)
     throws InitializerException
   {

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactoryInitializer.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactoryInitializer.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactoryInitializer.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -63,23 +63,17 @@
   /** The databases toplevel directory */
   private File directory;
 
-  /** The unique {@link URI} naming this database. */
-  private final URI databaseURI;
+  /** The database metadata. */
+  private final DatabaseMetadata metadata;
 
-  /** The set of alternative hostnames for the current host. */
-  private final Set hostnameAliases;
-
   /**
    * Sole constructor.
    *
    * @param directory  the persistence directory to offer this component; if
    *   <code>null</code>, no persistence directory will be offered
    */
-  DatabaseFactoryInitializer(
-      URI databaseURI, Set hostnameAliases, File directory
-  ) {
-    this.databaseURI = databaseURI;
-    this.hostnameAliases = hostnameAliases;
+  DatabaseFactoryInitializer(DatabaseMetadata metadata, File directory) {
+    this.metadata = metadata;
     this.directory = directory;
   }
 
@@ -87,16 +81,11 @@
   // Methods implementing FactoryInitializer
   //
 
-  public URI getDatabaseURI() {
+  public DatabaseMetadata getDatabaseMetadata() {
     checkState();
-    return databaseURI;
+    return metadata;
   }
 
-  public Set getHostnameAliases() {
-    checkState();
-    return hostnameAliases;
-  }
-
   public File getDirectory() throws InitializerException
   {
     checkState();

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseMetadataImpl.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseMetadataImpl.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseMetadataImpl.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -97,7 +97,11 @@
   private String serverName;
 
 
-  DatabaseMetadataImpl(URI uri, Set hostnameAliases, URI securityDomainURI, URI systemModelTypeURI)
+  /**
+   * @param uri *://org-id/serverName - used to configure the mulgara instance
+   * with an organisation-id and a serverName.
+   */
+  DatabaseMetadataImpl(URI uri, Set hostnameAliases, URI securityDomainURI)
   {
     logger.debug("Instantiating with uri=" + uri + " hostnameAliases=" + hostnameAliases +
         " securityDomainURI=" + securityDomainURI + " systemModelTypeURI=" + systemModelTypeURI);
@@ -113,19 +117,12 @@
     this.uri = uri;
     this.hostnameAliases = hostnameAliases;
     this.securityDomainURI = securityDomainURI;
-    this.systemModelTypeURI = systemModelTypeURI;
 
     // Set server name from the path part of the server URI.
     serverName = getServerName(uri);
   }
 
 
-  public URI getURI()
-  {
-    return uri;
-  }
-
-
   public URI getSecurityDomainURI()
   {
     return securityDomainURI;
@@ -266,6 +263,17 @@
   }
 
 
+  public void initializeSystemModelTypeURI(URI systemModelTypeURI) {
+    if (systemModelTypeURI == null) {
+      throw new IllegalArgumentException("Attempting to set null systemModelTypeURI");
+    } else if (this.systemModelTypeURI != null) {
+      throw new IllegalArgumentException("Attempting to set systemModelTypeURI twice");
+    }
+
+    this.systemModelTypeURI = systemModelTypeURI;
+  }
+
+
   public void initializeSystemNodes(long systemModelNode, long rdfTypeNode, long systemModelTypeNode)
   {
     if (systemModelNode < 0) {

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseResolverFactoryInitializer.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseResolverFactoryInitializer.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseResolverFactoryInitializer.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -98,9 +98,7 @@
          )
     throws InitializerException
   {
-    super(metadata.getURI(),
-          metadata.getHostnameAliases(),
-          persistenceDirectory);
+    super(metadata, persistenceDirectory);
 
     // Validate parameters
     if (cachedResolverFactorySet == null) {

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSecurityAdapterInitializer.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSecurityAdapterInitializer.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/DatabaseSecurityAdapterInitializer.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -90,7 +90,7 @@
   {
     checkState();
 
-    return databaseMetadata.getURI();
+    return databaseMetadata.getServerURI();
   }
 
   public SessionFactory getUnsecuredSessionFactory() throws InitializerException

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSession.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSession.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSession.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -89,7 +89,7 @@
   /**
    * Constructor.
    *
-   * @param databaseURI URI
+   * @param metadata metadata
    * @param aliases Set of Strings that are alternative hostnames for this host
    * @param persistentStringPool XAStringPool
    * @param persistentNodePool XANodePool
@@ -97,18 +97,15 @@
    * @param temporaryNodePool NodePool
    * @param globalLock Object
    */
-  JRDFResolverSession(URI databaseURI,
-                      Set aliases,
+  JRDFResolverSession(DatabaseMetadata metadata,
                       XAStringPool persistentStringPool,
                       XANodePool persistentNodePool,
                       StringPool temporaryStringPool,
                       NodePool temporaryNodePool,
                       Object globalLock) {
 
-    super(
-        databaseURI, aliases, persistentStringPool, persistentNodePool,
-        temporaryStringPool, temporaryNodePool, globalLock
-    );
+    super(metadata, persistentStringPool, persistentNodePool,
+        temporaryStringPool, temporaryNodePool, globalLock);
 
     this.nodeMapFactory = new BlankNodeMapFactory();
     logger.debug("JRDFResolverSession created.");

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSessionFactory.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSessionFactory.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/JRDFResolverSessionFactory.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -76,12 +76,9 @@
   private static final Logger logger =
     Logger.getLogger(JRDFResolverSessionFactory.class.getName());
 
-  /** The unique {@link URI} naming this database. */
-  private final URI databaseURI;
+  /** DatabaseMetadata */
+  private final DatabaseMetadata metadata;
 
-  /** The set of alternative hostnames for the current host. */
-  private final Set hostnameAliases;
-
   /** The directory used to store resources */
   private File directory = null;
 
@@ -101,8 +98,7 @@
                              StringPoolSessionFactory sessionFactory)
       throws ResolverFactoryException, NodePoolException, StringPoolException, InitializerException
   {
-    this.databaseURI = initializer.getDatabaseURI();
-    this.hostnameAliases = initializer.getHostnameAliases();
+    this.metadata = initializer.getDatabaseMetadata();
     this.directory = initializer.getDirectory();
     this.sessionFactory = sessionFactory;
   }
@@ -118,8 +114,7 @@
     try {
       logger.debug("Obtaining new RO XAResolverSession on SP/NP : " +
                    sessionFactory.getPersistentStringPool().getClass());
-      return new JRDFResolverSession(databaseURI,
-                                     hostnameAliases,
+      return new JRDFResolverSession(metadata,
                                      sessionFactory.getPersistentStringPool().newReadOnlyStringPool(),
                                      sessionFactory.getPersistentNodePool().newReadOnlyNodePool(),
                                      sessionFactory.getTemporaryStringPoolFactory().newStringPool(),
@@ -143,8 +138,7 @@
     try {
       logger.debug("Obtaining new RW XAResolverSession on SP/NP : " +
                    sessionFactory.getPersistentStringPool().getClass());
-      return new JRDFResolverSession(databaseURI,
-                                     hostnameAliases,
+      return new JRDFResolverSession(metadata,
                                      sessionFactory.getPersistentStringPool().newWritableStringPool(),
                                      sessionFactory.getPersistentNodePool().newWritableNodePool(),
                                      sessionFactory.getTemporaryStringPoolFactory().newStringPool(),

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -139,22 +139,19 @@
 
   private Object globalLock;
 
-  StringPoolSession(URI          databaseURI,
-                    Set          hostnameAliases,
-                    XAStringPool persistentStringPool,
-                    XANodePool   persistentNodePool,
-                    StringPool   temporaryStringPool,
-                    NodePool     temporaryNodePool,
-                    Object globalLock)
+  StringPoolSession(DatabaseMetadata  metadata,
+                    XAStringPool      persistentStringPool,
+                    XANodePool        persistentNodePool,
+                    StringPool        temporaryStringPool,
+                    NodePool          temporaryNodePool,
+                    Object            globalLock)
   {
     if (logger.isDebugEnabled()) {
       logger.debug("Constructing StringPoolSession " + System.identityHashCode(this), new Throwable());
     }
 
-    assert databaseURI.getFragment() == null;
-
-    this.databaseURI = databaseURI;
-    this.hostnameAliases = hostnameAliases;
+    this.databaseURI = metadata.getServerURI();
+    this.hostnameAliases = metadata.getHostnameAliases();
     this.persistentStringPool = persistentStringPool;
     this.persistentNodePool = persistentNodePool;
     this.temporaryStringPool = temporaryStringPool;

Modified: branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
===================================================================
--- branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -86,12 +86,9 @@
   private static final Logger logger =
     Logger.getLogger(StringPoolSessionFactory.class.getName());
 
-  /** The unique {@link URI} naming this database. */
-  private final URI databaseURI;
+  /** The database metadata. */
+  private final DatabaseMetadata metadata;
 
-  /** The set of alternative hostnames for the current host. */
-  private final Set hostnameAliases;
-
   /** Where to store literals for this session.  */
   private final XAStringPool persistentStringPool;
 
@@ -109,8 +106,7 @@
   //
 
   StringPoolSessionFactory(
-    URI                        databaseURI,
-    Set                        hostnameAliases,
+    DatabaseMetadata           metadata,
     String                     persistentStringPoolFactoryClassName,
     FactoryInitializer         persistentStringPoolFactoryInitializer,
     String                     persistentNodePoolFactoryClassName,
@@ -123,13 +119,8 @@
     throws ResolverFactoryException, NodePoolException, StringPoolException,
            InitializerException
   {
-    if (logger.isDebugEnabled()) {
-      logger.debug("SPSF created with databaseURI: " + databaseURI);
-    }
+    this.metadata     = metadata;
 
-    this.databaseURI     = databaseURI;
-    this.hostnameAliases = hostnameAliases;
-
     // Create the persistent node pool
     try {
       NodePoolFactory factory =
@@ -205,8 +196,7 @@
       throws ResolverSessionFactoryException {
     try {
       logger.debug("Obtaining new RO XAResolverSession on SP/NP : " + persistentStringPool.getClass());
-      return new StringPoolSession(databaseURI,
-                                   hostnameAliases,
+      return new StringPoolSession(metadata,
                                    persistentStringPool.newReadOnlyStringPool(),
                                    persistentNodePool.newReadOnlyNodePool(),
                                    temporaryStringPoolFactory.newStringPool(),
@@ -223,8 +213,7 @@
       throws ResolverSessionFactoryException {
     try {
       logger.debug("Obtaining new RW XAResolverSession on SP/NP : " + persistentStringPool.getClass());
-      return new StringPoolSession(databaseURI,
-                                   hostnameAliases,
+      return new StringPoolSession(metadata,
                                    persistentStringPool.newWritableStringPool(),
                                    persistentNodePool.newWritableNodePool(),
                                    temporaryStringPoolFactory.newStringPool(),

Modified: branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/DatabaseMetadata.java
===================================================================
--- branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/DatabaseMetadata.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/DatabaseMetadata.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -58,18 +58,8 @@
    */
   public String getServerName();
 
-  /**
-   * A consistent method of extracting a server's name.  Gets the path and
-   * removes all instance of /.
-   *
-   * @return the name of the server based on the URI or null if no path is
-   *   found.
-   */
-//  public String getServerName(URI serverURI);
-
   public URI getServerURI();
 
-  public URI getURI();
   public URI getSecurityDomainURI();
   public URI getSystemModelURI();
   public URI getSystemModelTypeURI();

Modified: branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/FactoryInitializer.java
===================================================================
--- branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/FactoryInitializer.java	2007-10-10 06:01:19 UTC (rev 464)
+++ branches/mgr-58/src/jar/resolver-spi/java/org/mulgara/resolver/spi/FactoryInitializer.java	2007-10-10 08:32:37 UTC (rev 465)
@@ -66,22 +66,12 @@
 
 public interface FactoryInitializer
 {
-
   /**
-   * Obtain the canonical name of this database.
-   * @return the unique {@link URI} naming this database.
-   * @throws IllegalStateException if called outside of initialization
+   * Obtain a reference to the DatabaseMetadata.
    */
-  public URI getDatabaseURI();
+   public DatabaseMetadata getDatabaseMetadata();
 
   /**
-   * Obtain the set of alternative names that the current host is known by.
-   * @return the Set of Strings that enumerates the alternative hostnames.
-   * @throws IllegalStateException if called outside of initialization
-   */
-  public Set getHostnameAliases();
-
-  /**
    * Obtain a persistence directory.
    *
    * @return a subdirectory in the database's persistence directory for the




More information about the Mulgara-svn mailing list