BlobClientFactory.java :  » Workflow-Engines » syrup » org » syrup » services » Java Open Source

Java Open Source » Workflow Engines » syrup 
syrup » org » syrup » services » BlobClientFactory.java
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;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.