mardi 11 avril 2017

Implementing a Remote Proxy

I'm reading a book on design patterns and am trying to implement the proxy pattern, specifically a remote proxy in one of my applications.

I was thinking of using this pattern when querying a remote REST API, but I'm unsure if what I am thinking of satisfies the definition of a remote proxy.

The below is a simplified version of what I've got so far.

MachineApiProxy would be used by the application to query the remote API that sits on another machine.

// Interface
public interface MachineApi
{
    public Integer Infocon();

    public InetAddress Ip();
}


// Implements above interface
public class MachineApiProxy implements MachineApi
{
    public Integer Infocon()
    {
        // query remote REST API
    }

    public InetAddress Ip()
    {
        // query remote REST API
    }

}

Do you think this satisfies implmenting a remote proxy?

Aucun commentaire:

Enregistrer un commentaire