JabAppendix B

From WikiContent

(Difference between revisions)
Jump to: navigation, search
Line 13: Line 13:
<br>
<br>
<code>
<code>
-
<br>// IQRPC.java
+
<br> // IQRPC.java
-
import org.jabber.jabberbeans.*; import
+
import org.jabber.jabberbeans.*; import
-
org.jabber.jabberbeans.Extension.*;
+
org.jabber.jabberbeans.Extension.*;
-
public class IQRPC extends XMLData implements QueryExtension { private
+
public class IQRPC extends XMLData implements QueryExtension { private
-
String payload;
+
String payload;
public IQRPC(IQRPCBuilder builder) { payload=builder.getPayload();
public IQRPC(IQRPCBuilder builder) { payload=builder.getPayload();
Line 41: Line 41:
<br>// IQRPCBuilder.java
<br>// IQRPCBuilder.java
-
import org.jabber.jabberbeans.*; import
+
import org.jabber.jabberbeans.*; import
-
org.jabber.jabberbeans.Extension.*;
+
org.jabber.jabberbeans.Extension.*;
-
public class IQRPCBuilder implements ExtensionBuilder { private String
+
public class IQRPCBuilder implements ExtensionBuilder { private String
-
payload;
+
payload;
public IQRPCBuilder() { reset();
public IQRPCBuilder() { reset();
Line 61: Line 61:
public Extension build() { return new IQRPC(this);
public Extension build() { return new IQRPC(this);
}
}
-
}
+
}
</code>
</code>

Revision as of 03:21, 17 September 2006

The IQRPC Classes for JabberRPCResponder


This appendix contains the two IQRPC classes, IQRPC and IQRPCBuilder. They are required for the Java JabberRPCResponder script in Section 10.2.

They're essentially modified copies of two existing and equivalent classes for the jabber:iq:time namespace, IQTime and IQTimeBuilder.



The IQRPC Class



// IQRPC.java

import org.jabber.jabberbeans.*; import
org.jabber.jabberbeans.Extension.*;
public class IQRPC extends XMLData implements QueryExtension { private
String payload;
   public IQRPC(IQRPCBuilder builder) { payload=builder.getPayload();
   }
   public String getPayload() { return payload;
   }
   public void appendItem(StringBuffer retval) {
   retval.append("<query xmlns=\"jabber:iq:rpc\">");
   retval.append(payload); retval.append("</query>");
   }
}
}


The IQRPCBuilder Class


// IQRPCBuilder.java

import org.jabber.jabberbeans.*; import
org.jabber.jabberbeans.Extension.*;
public class IQRPCBuilder implements ExtensionBuilder { private String
payload;
   public IQRPCBuilder() { reset();
   }
   public void reset() { payload=null;
   }
   public String getPayload() { return payload;
   }
   public void setPayload(String value) { payload=value;
   }
   public Extension build() { return new IQRPC(this);
   }
}

Personal tools