[Mulgara-svn] r507 - branches/nw-interface/src/jar/query/java/org/mulgara/server
pag at mulgara.org
pag at mulgara.org
Fri Nov 2 21:13:14 UTC 2007
Author: pag
Date: 2007-11-02 15:13:13 -0600 (Fri, 02 Nov 2007)
New Revision: 507
Modified:
branches/nw-interface/src/jar/query/java/org/mulgara/server/SessionFactoryFactory.java
Log:
Made DEFAULT_SERVER_NAME public, and cleaned up for for formatting and generics
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/server/SessionFactoryFactory.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/server/SessionFactoryFactory.java 2007-11-02 21:11:55 UTC (rev 506)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/server/SessionFactoryFactory.java 2007-11-02 21:13:13 UTC (rev 507)
@@ -30,8 +30,6 @@
// Java 2 Standard Packages
import java.net.*;
import java.io.*;
-import java.util.*;
-import javax.naming.*;
// Third party packages
import org.apache.log4j.Logger; // Apache Log4J
@@ -65,20 +63,15 @@
*/
public class SessionFactoryFactory {
- /**
- * Logger.
- *
- * This is named after the class.
- */
- private static final Logger logger =
- Logger.getLogger(SessionFactoryFactory.class.getName());
+ /** Logger. This is named after the class. */
+ private static final Logger logger = Logger.getLogger(SessionFactoryFactory.class.getName());
+ /** Server name used if one is not configured */
+ public final static String DEFAULT_SERVER_NAME = "server1";
+
/** SessionFactory implementation */
private String className = "org.mulgara.store.xa.XADatabaseImpl";
- /** Server name used if one is not configured */
- private final static String DEFAULT_SERVER_NAME = "server1";
-
/** default location of the config file */
private static final String CONFIG_PATH = "conf/mulgara-x-config.xml";
@@ -167,19 +160,20 @@
* @throws SessionFactoryException
* @return SessionFactory
*/
+ @SuppressWarnings("unchecked")
public SessionFactory getTripleStoreImplementation(String className,
- Class[] argTypes, Object[] args) throws SessionFactoryException {
+ Class<?>[] argTypes, Object[] args) throws SessionFactoryException {
try {
//load class
- Class storeClass = Class.forName(className);
+ Class<? extends SessionFactory> storeClass = (Class<? extends SessionFactory>)Class.forName(className);
//get appropriate constructor
- Constructor constructor = storeClass.getConstructor(argTypes);
+ Constructor<? extends SessionFactory> constructor = storeClass.getConstructor(argTypes);
//instantiate
- return (SessionFactory) constructor.newInstance(args);
+ return constructor.newInstance(args);
}
catch (Exception exception) {
@@ -200,7 +194,7 @@
public SessionFactory newSessionFactory()
throws SessionFactoryException {
- URI serverURI = this.getDefaultServerURI();
+ URI serverURI = getDefaultServerURI();
File directory = new File(System.getProperty("java.io.tmpdir"));
return this.newSessionFactory(serverURI, directory);
@@ -212,20 +206,19 @@
* @param serverURI the internet server to connect this session to.
* @param directory The directory to use for storage of triplestore data
*
- * @throws SessionFactoryException if a connection can't be established to
- * the server
+ * @throws SessionFactoryException if a connection can't be established to the server
* @return SessionFactory
*/
public SessionFactory newSessionFactory(URI serverURI, File directory)
throws SessionFactoryException {
//arguments to constructor
- Class [] argTypes = new Class [] {
+ Class<?>[] argTypes = new Class [] {
serverURI.getClass(),
directory.getClass(),
mulgaraConfig.getClass()
};
- Object [] args = new Object [] {
+ Object[] args = new Object [] {
serverURI,
directory,
mulgaraConfig
@@ -248,8 +241,8 @@
SessionFactoryConfiguration config = getConfiguration(inStream);
//arguments to constructor
- Class [] argTypes = config.getConfigurationTypes();
- Object [] args = config.getConfigurationObjects();
+ Class<?>[] argTypes = config.getConfigurationTypes();
+ Object[] args = config.getConfigurationObjects();
return getTripleStoreImplementation(config.getClassName(), argTypes, args);
}
@@ -277,7 +270,7 @@
throws SessionFactoryException {
//arguments to constructor
- Class [] argTypes = new Class [] {
+ Class<?>[] argTypes = new Class[] {
uri.getClass(),
directory.getClass(),
securityDomain.getClass(),
@@ -287,7 +280,7 @@
temporaryStringPoolFactoryClassName.getClass(),
systemResolverFactoryClassName.getClass()
};
- Object [] args = new Object [] {
+ Object[] args = new Object[] {
uri,
directory,
securityDomain,
@@ -402,7 +395,7 @@
if ((serverName != null)
&& (!"".equals(serverName))) {
- URI uri = this.getServerURI(serverName);
+ URI uri = getServerURI(serverName);
sessionConfig.setServerURI(uri.toString());
}
More information about the Mulgara-svn
mailing list