[ 
https://issues.apache.org/jira/browse/HDFS-13909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16817348#comment-16817348
 ] 

Íñigo Goiri commented on HDFS-13909:
------------------------------------

That's exactly the point of {{RemoteMethod}}.
In the call, you do:
{code}
RemoteMethod method = new RemoteMethod("addCacheDirective",
new Class<?>[] {CacheDirectiveInfo.class, EnumSet.class},
new RemoteParam(), flags);
{code}

And then extend {{RemoteMethod}} to do something like:
{code}
  public Object[] getParams(RemoteLocationContext context) {
    if (this.params == null) {
      return new Object[] {};
    }
    Object[] objList = new Object[this.params.length];
    for (int i = 0; i < this.params.length; i++) {
      Object currentObj = this.params[i];
      if (currentObj instanceof RemoteParam) {
        RemoteParam paramGetter = (RemoteParam) currentObj;
        // Map the parameter using the context
        if (this.types[i] == CacheDirectiveInfo.class) {
          String path = (String)paramGetter.getParameterForContext(context);
          objList[i] = CacheDirectiveInfo.Builder(path)
              .setPath(new Path(path))
              .build();
        } else {
          objList[i] = paramGetter.getParameterForContext(context);
        }
      } else {
        objList[i] = currentObj;
      }
    }
    return objList;
  }
{code}

> RBF: Add Cache pools and directives related ClientProtocol apis
> ---------------------------------------------------------------
>
>                 Key: HDFS-13909
>                 URL: https://issues.apache.org/jira/browse/HDFS-13909
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Dibyendu Karmakar
>            Assignee: Ayush Saxena
>            Priority: Major
>         Attachments: HDFS-13909-HDFS-13891-01.patch, 
> HDFS-13909-HDFS-13891-02.patch
>
>
> Currently addCachePool, modifyCachePool, removeCachePool, listCachePools, 
> addCacheDirective, modifyCacheDirective, removeCacheDirective, 
> listCacheDirectives these APIs are not implemented in Router.
> This JIRA is intend to implement above mentioned APIs.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to