Commit 1e27dc0c authored by majorb.cadc's avatar majorb.cadc
Browse files

Changed private client to use getInstance()

git-svn-id: https://opencadc.googlecode.com/svn/trunk@978 728ff76a-78ac-11de-a72b-d90af8dea425
parent af053320
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -56,10 +56,9 @@ public class CredPrivateClient

    protected URL baseServiceURL;

    private CredPrivateClient instance;

    /**
     * CredPrivateClient with baseServiceURL as constructor.
     * Implementors must provide an extension of this class of the
     * name ca.nrc.cadc.cred.client.priv.impl.CredPrivateClientImpl.
     * 
     * @param baseServiceURL
     * @throws ClassNotFoundException
@@ -79,15 +78,22 @@ public class CredPrivateClient
     *             no nullary constructor).
     * 
     */
    public CredPrivateClient(URL baseServiceURL)
    public static CredPrivateClient getInstance(URL baseServiceURL)
        throws ClassNotFoundException, IllegalAccessException,
        InstantiationException
    {
        this.baseServiceURL = baseServiceURL;

        Class<?> implClass = Class
                .forName("ca.nrc.cadc.cred.client.priv.impl.CredPrivateClientImpl");
        instance = (CredPrivateClient) implClass.newInstance();
        CredPrivateClient client = (CredPrivateClient) implClass.newInstance();
        client.setBaseServiceURL(baseServiceURL);
        return client;
    }
    
    /**
     * Constructor.
     */
    protected CredPrivateClient()
    {
    }

    /**
@@ -106,4 +112,14 @@ public class CredPrivateClient
                "To be implemented in the subclass");
    }

    protected URL getBaseServiceURL()
    {
        return baseServiceURL;
    }

    protected void setBaseServiceURL(URL baseServiceURL)
    {
        this.baseServiceURL = baseServiceURL;
    }

}