package gov.va.med.hdr.ars.client;

import gov.va.med.hdr.ars.client.webservice.AggregateReportingServiceInterface;

public class ArsServiceFactory
{

    public synchronized AggregateReportingServiceInterface create( String arsWebserviceTimeoutSecs, String arsServiceEndpoint )
    		throws Exception
    {

        AggregateReportingServiceDelegate delegate = getAggregateReportingServiceDelegate( arsWebserviceTimeoutSecs, getArsEndpoint( arsServiceEndpoint ) );

        return delegate;
    }

    /*
     * Convenience methods for unit testing
     */

    private AggregateReportingServiceDelegate getAggregateReportingServiceDelegate( String arsWebserviceTimeoutSecs, String arsServiceEndpoint )
    {
        return new AggregateReportingServiceDelegate( arsWebserviceTimeoutSecs, arsServiceEndpoint );
    }
    
	private String getArsEndpoint(String aServiceUrl) 
	{
		return aServiceUrl.replace("cds-wsclient/cds-service", "AggregateReportingService/ARService?wsdl");
	}

}
