org.limitless.nmc.Client
Class MuConnectionFactory

java.lang.Object
  extended by org.limitless.nmc.Client.MuConnectionFactory

public class MuConnectionFactory
extends java.lang.Object

This is a factory that allows "connector" factories to be registered and which creates MuConnector's on demand. It acts as a singleton. The URL format for a MuConnection is: mu-type://loginName:password@address:port/muck-short-name For example: muck://male:guest@nameless.muck.limitless.org/nmcguest The muck-short-name is basically optional...it's not used anywhere.


Nested Class Summary
static interface MuConnectionFactory.ConnectionFactory
          A ConnectionFactory creates a connection channel object on demand.
static class MuConnectionFactory.PropertyLoadFails
          This is thrown if a request to load properties can't be done.
 
Field Summary
private  java.util.Map factoryMap
          This map has (String,ConnectionFactory) format and is used to hold all the known factories
private static MuConnectionFactory instance
          Singleton instance attribute
(package private) static org.apache.log4j.Logger logger
          Log4J Logger
private static java.lang.String MuKeyPrefix
           
 
Constructor Summary
MuConnectionFactory()
           
 
Method Summary
 void addFactory(java.lang.String key, MuConnectionFactory.ConnectionFactory factory)
          add a new connection factory
 MuConnector create(java.lang.String serverType, MuLoginDescription description)
          This creates a new MU connector given the parts seperately constructed, and is used mostly for debugging.
 MuConnector create(UriIdentifier id)
          This creates a connector given a URL
private  MuConnectionFactory.ConnectionFactory findFactory(java.lang.String key)
          This locates a factory given a key
static MuConnectionFactory Instance()
          Singleton instancing method
 void setupFromPropertyFile(java.lang.String propertyFilename)
          This reads in a property file of protocol to class mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Log4J Logger


MuKeyPrefix

private static final java.lang.String MuKeyPrefix
See Also:
Constant Field Values

instance

private static MuConnectionFactory instance
Singleton instance attribute


factoryMap

private java.util.Map factoryMap
This map has (String,ConnectionFactory) format and is used to hold all the known factories

Constructor Detail

MuConnectionFactory

public MuConnectionFactory()
Method Detail

addFactory

public void addFactory(java.lang.String key,
                       MuConnectionFactory.ConnectionFactory factory)
add a new connection factory


Instance

public static MuConnectionFactory Instance()
Singleton instancing method


create

public MuConnector create(java.lang.String serverType,
                          MuLoginDescription description)
                   throws NMCNotFound,
                          java.net.UnknownHostException
This creates a new MU connector given the parts seperately constructed, and is used mostly for debugging.

Throws:
NMCNotFound
java.net.UnknownHostException

create

public MuConnector create(UriIdentifier id)
                   throws java.net.MalformedURLException,
                          NMCNotFound,
                          java.net.UnknownHostException
This creates a connector given a URL

Throws:
java.net.MalformedURLException
NMCNotFound
java.net.UnknownHostException

findFactory

private MuConnectionFactory.ConnectionFactory findFactory(java.lang.String key)
                                                   throws NMCNotFound
This locates a factory given a key

Throws:
NMCNotFound

setupFromPropertyFile

public void setupFromPropertyFile(java.lang.String propertyFilename)
                           throws MuConnectionFactory.PropertyLoadFails
This reads in a property file of protocol to class mappings. The file is searched for using the class-loader's getResource() so when the property filename is given, it should refer to a file that is located by the working classloader, not the system classloader.

The format in the file is: mu.type=class
Such as: mu.muck=MuckConnection.Factory

Throws:
MuConnectionFactory.PropertyLoadFails


Copyright © 1995, 2004 Limitless Knowledge Association, All Rights Reserved.