Rupesh029 / typica

Automatically exported from code.google.com/p/typica
Apache License 2.0
0 stars 0 forks source link

Add virtualPath to AWSConnection ctor to support Eucalyptus #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

trying to use the EC2 QUERTY API against an eucalyptus instance whose
endpoint is
http://myeuca.localhost:8888/services/euca

the endpoint to which the requests are sent is built in
com.xerox.amazonws.common.AWSConnection.makeURL(String)

that now looks like

protected URL makeURL(String resource) throws MalformedURLException {
        String protocol = this.isSecure ? "https" : "http";
        return new URL(protocol, this.server, this.port, this.virtualPath +
resource);
    }

What version of the product are you using? On what operating system?

1.5 (as euca doesn't support 2009-03-01 schema)

Please provide any additional information below.

I have modified the ctor as 
    public AWSConnection(String awsAccessId, String awsSecretKey, boolean
isSecure,
                             String server, int port, String virtualPath)
    {
        this.awsAccessId = awsAccessId;
        this.awsSecretKey = awsSecretKey;
        this.isSecure = isSecure;
        this.server = server;
        this.port = port;
        this.virtualPath = sanitise(virtualPath);
        this.headers = new TreeMap<String, List<String>>();
    }

and added 

    private String sanitise(String virtualPath) {
        if (virtualPath == null || "".equals(virtualPath.trim())) {
            return "";
        }
        String ret = virtualPath.trim();
        if (ret.endsWith("/")) {
            ret = ret.substring(0, virtualPath.length() - 1);
        }
        if (ret.length() > 1 && !ret.startsWith("/")) {
            ret = "/" + ret;
        }
        return ret;
    }

I have had to fix the derived classes accordingly

I'd appreciate if you could retrofit these changes in v1.5 and v1.5.1

Original issue reported on code.google.com by smartr...@gmail.com on 1 Apr 2009 at 12:01

GoogleCodeExporter commented 9 years ago
actually sanitise() is

 private String sanitise(String virtualPath) {
        if (virtualPath == null || "".equals(virtualPath.trim())) {
            return "/";
        }
//....
    }

Original comment by smartr...@gmail.com on 1 Apr 2009 at 12:04

GoogleCodeExporter commented 9 years ago
I worked on eucalyptus support back in June. The results were covered in the 
forum;
http://groups.google.com/group/typica/browse_thread/thread/4298336e27d54a4f

released in version 1.6
thanks.

Original comment by dkavan...@gmail.com on 7 Oct 2009 at 7:13