package org.syrup.services;
import java.util.Hashtable;
import javax.naming.Name;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
/**
* Implements an ObjectFactory to build implementations of a BlobClient.
*
* @author Robbert van Dalen
*/
public class BlobClientFactory implements ObjectFactory
{
static final String COPYRIGHT = "Copyright 2005 Robbert van Dalen."
+ "At your option, you may copy, distribute, or make derivative works under "
+ "the terms of The Artistic License. This License may be found at "
+ "http://www.opensource.org/licenses/artistic-license.php. "
+ "THERE IS NO WARRANTY; USE THIS PRODUCT AT YOUR OWN RISK.";
public Object getObjectInstance(Object obj, Name name,
javax.naming.Context ctx, Hashtable env) throws Exception
{
if (obj instanceof Reference)
{
Reference ref = (Reference) obj;
RefAddr addr = ref.get("blobclient");
if (addr != null)
{
return new BlobClient((String) addr.getContent());
}
}
return null;
}
}
|