implemented the initial XML-RPC APIs in Venice - for creating and destroying
"sessions," logging in, posting messages to topics, attaching files to messages, and a couple of minor things that aren't as important right now
This commit is contained in:
59
rpcscripts/conf/conference.js
Normal file
59
rpcscripts/conf/conference.js
Normal file
@@ -0,0 +1,59 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
// Implements the conferencing topic API
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.rpc);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
xreq = bsf.lookupBean("xmlrpc");
|
||||
env = bsf.lookupBean("environment");
|
||||
call_name = env.get("call");
|
||||
|
||||
// All methods have at least three parameters: session, community, conference.
|
||||
if (xreq.paramCount<3)
|
||||
{ // not enough parameters
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
comm = xreq.getParamCommunity(1);
|
||||
conf = xreq.getParamConference(2,comm);
|
||||
|
||||
if ("name"==call_name)
|
||||
{ // venice:conferencing.conference.name <session-id> <community> <conference> [<new-name>]
|
||||
// Retrieves or sets the conference name.
|
||||
if (xreq.paramCount==3)
|
||||
vlib.output(conf.name);
|
||||
else if (xreq.paramCount==4)
|
||||
{ // set the name
|
||||
name = xreq.getParamString(3);
|
||||
conf.name = name;
|
||||
vlib.output(name); // output the new name on success
|
||||
|
||||
} // end else if
|
||||
else // wrong parameter count
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// just in case there's a method name that wasn't listed
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.METHOD_NOT_FOUND,"invalid method name: " + xreq.method));
|
||||
60
rpcscripts/conf/message.js
Normal file
60
rpcscripts/conf/message.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
// Implements the conferencing message API
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.rpc);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
xreq = bsf.lookupBean("xmlrpc");
|
||||
env = bsf.lookupBean("environment");
|
||||
call_name = env.get("call");
|
||||
|
||||
// All methods have at least five parameters: session, community, conference, topic, message.
|
||||
if (xreq.paramCount<5)
|
||||
{ // not enough parameters
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
comm = xreq.getParamCommunity(1);
|
||||
conf = xreq.getParamConference(2,comm);
|
||||
topic = xreq.getParamTopic(3,conf);
|
||||
msg = xreq.getParamPost(4,topic);
|
||||
|
||||
if ("attach"==call_name)
|
||||
{ // venice:conferencing.message.attach <session-id> <community> <conference> <topic> <message> <mime-type>
|
||||
// <filename> <data>
|
||||
if (xreq.paramCount!=8)
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
else if ("base64"!=xreq.getParamType(7))
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"data parameter type mismatch"));
|
||||
else
|
||||
{ // attach the data and return
|
||||
msg.attachData(xreq.getParamString(5),xreq.getParamString(6),vlib.castByteArray(xreq.getParam(7)));
|
||||
vlib.output(vlib.booleanObject(true));
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// just in case there's a method name that wasn't listed
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.METHOD_NOT_FOUND,"invalid method name: " + xreq.method));
|
||||
57
rpcscripts/conf/topic.js
Normal file
57
rpcscripts/conf/topic.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
// Implements the conferencing topic API
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.rpc);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
xreq = bsf.lookupBean("xmlrpc");
|
||||
env = bsf.lookupBean("environment");
|
||||
call_name = env.get("call");
|
||||
|
||||
// All methods have at least four parameters: session, community, conference, topic.
|
||||
if (xreq.paramCount<4)
|
||||
{ // not enough parameters
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
comm = xreq.getParamCommunity(1);
|
||||
conf = xreq.getParamConference(2,comm);
|
||||
topic = xreq.getParamTopic(3,conf);
|
||||
|
||||
if ("postMessage"==call_name)
|
||||
{ // venice:conferencing.topic.postMessage <session-id> <community> <conference> <topic> <pseud> <text>
|
||||
// Posts a message, returns the message number within the topic
|
||||
if (xreq.paramCount!=6)
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
|
||||
else
|
||||
{ // post the message
|
||||
msg = topic.postNewMessage(0,xreq.getParamString(4),xreq.getParamString(5));
|
||||
vlib.output(vlib.createInteger(msg.postNumber));
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// just in case there's a method name that wasn't listed
|
||||
vlib.output(new XmlRpcFault(XmlRpcFault.METHOD_NOT_FOUND,"invalid method name: " + xreq.method));
|
||||
Reference in New Issue
Block a user