hammant 2002/10/13 05:03:39
Added: altrmi/src/java/org/apache/excalibur/altrmi/registry
BindException.java Binder.java Bound.java
Registry.java
Log:
Add registry
Revision Changes Path
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/BindException.java
Index: BindException.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.registry;
/**
* Bind Exception
* @author Paul Hammant
*/
public class BindException extends Exception
{
/**
* Contruct with a message
* @param message the message
*/
public BindException(String message)
{
super(message);
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/Binder.java
Index: Binder.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.registry;
/**
* Allows binding to an optmized transport.
* @author Paul Hammant
*/
public interface Binder
{
/**
* Bind to an optmized transport
* @param bindParms parameters for that binding.
* @return The bound object
* @throws BindException if a problem
*/
Bound bind(Object[] bindParms) throws BindException;
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/Bound.java
Index: Bound.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.registry;
/**
* A Bound object
* @author Paul Hammant
*/
public interface Bound
{
/**
* Close the binding.
*/
void close();
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/Registry.java
Index: Registry.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.registry;
import java.util.HashMap;
/**
* A simple registry for binding.
* @author Paul Hammant
*/
public class Registry
{
private static Registry INSTANCE;
private HashMap m_map = new HashMap();
/**
* Get the singleton instance
* @return the instance
*/
public static synchronized Registry getInstance()
{
if (INSTANCE == null)
{
INSTANCE = new Registry();
}
return INSTANCE;
}
/**
* Prevent public construction
*/
private Registry()
{
}
/**
* Get a Bound object.
* @param key the key required.
* @return thebound object
*/
public Binder get(String key)
{
return (Binder) m_map.get(key);
}
/**
* Bind an object
* @param key the key
* @param object the object
*/
public void put (String key, Object object)
{
m_map.put(key, object);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>