]> err.no Git - sope/commitdiff
started xmlrpc samples
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 24 Oct 2004 18:27:09 +0000 (18:27 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 24 Oct 2004 18:27:09 +0000 (18:27 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@315 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/samples/xmlrpc/GNUmakefile [new file with mode: 0644]
sope-appserver/samples/xmlrpc/NGBloggerClient.h [new file with mode: 0644]
sope-appserver/samples/xmlrpc/NGBloggerClient.m [new file with mode: 0644]
sope-appserver/samples/xmlrpc/blogger_zidestore.m [new file with mode: 0644]
sope-appserver/samples/xmlrpc/common.h [new file with mode: 0644]
sope-appserver/samples/xmlrpc/meerkat_xml_channels.m [new file with mode: 0644]

diff --git a/sope-appserver/samples/xmlrpc/GNUmakefile b/sope-appserver/samples/xmlrpc/GNUmakefile
new file mode 100644 (file)
index 0000000..cca0ec9
--- /dev/null
@@ -0,0 +1,20 @@
+# GNUstep makefile
+
+-include ../../../config.make
+include $(GNUSTEP_MAKEFILES)/common.make
+
+TOOL_NAME = \
+       meerkat_xml_channels    \
+       blogger_zidestore
+
+meerkat_xml_channels_OBJC_FILES += meerkat_xml_channels.m
+
+blogger_zidestore_OBJC_FILES += blogger_zidestore.m NGBloggerClient.m
+
+ADDITIONAL_TOOL_LIBS += \
+       -lNGXmlRpc -lNGObjWeb -lNGMime -lNGStreams -lNGExtensions -lEOControl \
+       -lXmlRpc -lDOM -lSaxObjC
+
+-include GNUmakefile.preamble
+include $(GNUSTEP_MAKEFILES)/tool.make
+-include GNUmakefile.postamble
diff --git a/sope-appserver/samples/xmlrpc/NGBloggerClient.h b/sope-appserver/samples/xmlrpc/NGBloggerClient.h
new file mode 100644 (file)
index 0000000..22c6fe7
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+  Copyright (C) 2004 Helge Hess
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#ifndef __xmlrpc_NGBloggerClient_H__
+#define __xmlrpc_NGBloggerClient_H__
+
+#import <Foundation/NSObject.h>
+
+/*
+  NGBloggerClient
+
+  Note: this is only demo code and far from being a complete Blogger client!
+        (who knows, it could evolve into one ;-)
+*/
+
+@class NSString, NSArray;
+@class NGXmlRpcClient;
+
+@interface NGBloggerClient : NSObject
+{
+  NGXmlRpcClient *xmlrpc;
+  NSString *appid;
+  NSString *login;
+  NSString *password;
+}
+
+- (id)initWithClient:(NGXmlRpcClient *)_client;
+- (id)initWithURL:(id)_url;
+
+/* accessors */
+
+- (NGXmlRpcClient *)client;
+
+- (void)setLogin:(NSString *)_value;
+- (NSString *)login;
+
+- (void)setPassword:(NSString *)_value;
+- (NSString *)password;
+
+/* operations */
+
+- (NSArray *)getUsersBlogs;
+
+@end
+
+#endif /* __xmlrpc_NGBloggerClient_H__ */
diff --git a/sope-appserver/samples/xmlrpc/NGBloggerClient.m b/sope-appserver/samples/xmlrpc/NGBloggerClient.m
new file mode 100644 (file)
index 0000000..c34cc3a
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+  Copyright (C) 2004 Helge Hess
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include "NGBloggerClient.h"
+#include <NGXmlRpc/NGXmlRpcClient.h>
+#include "common.h"
+
+@implementation NGBloggerClient
+
+- (id)initWithClient:(NGXmlRpcClient *)_client {
+  if (_client == nil) {
+    [self release];
+    return nil;
+  }
+  if ((self = [super init])) {
+    self->xmlrpc   = [_client retain];
+    self->appid    = @"NGBloggerClient";
+    self->login    = @"NGBloggerClient";
+    self->password = @"NGBloggerClient";
+  }
+  return self;
+}
+
+- (id)initWithURL:(id)_url {
+  NGXmlRpcClient *client;
+  
+  client = [[NGXmlRpcClient alloc] initWithURL:_url];
+  self = [self initWithClient:client];
+  [client release];
+  return self;
+}
+
+- (id)init {
+  return [self initWithClient:nil];
+}
+
+- (void)dealloc {
+  [self->appid    release];
+  [self->login    release];
+  [self->password release];
+  [self->xmlrpc   release];
+  [super dealloc];
+}
+
+/* accessors */
+
+- (NGXmlRpcClient *)client {
+  return self->xmlrpc;
+}
+
+- (void)setLogin:(NSString *)_login {
+  ASSIGNCOPY(self->login, _login);
+  [self->xmlrpc setUserName:self->login];
+}
+- (NSString *)login {
+  return self->login;
+}
+
+- (void)setPassword:(NSString *)_value {
+  ASSIGNCOPY(self->password, _value);
+  [self->xmlrpc setPassword:_value];
+}
+- (NSString *)password {
+  return self->password;
+}
+
+/* operations */
+
+- (NSArray *)getUsersBlogs {
+  return [self->xmlrpc call:@"blogger.getUsersBlogs",
+             self->appid, self->login, self->password, nil];
+}
+
+@end /* NGBloggerClient */
diff --git a/sope-appserver/samples/xmlrpc/blogger_zidestore.m b/sope-appserver/samples/xmlrpc/blogger_zidestore.m
new file mode 100644 (file)
index 0000000..4ca8f2e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+  Copyright (C) 2004 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include "NGBloggerClient.h"
+#include "common.h"
+
+static void runIt(void) {
+  NGBloggerClient *client;
+  NSString     *url, *login, *password;
+  id result;
+  
+  // ADJUST!
+  login    = @"helge";
+  password = @"secret";
+  url      = @"http://localhost/zidestore/so/helge";
+  
+  client = [[NGBloggerClient alloc] initWithURL:url];
+  [client setLogin:login];
+  [client setPassword:password];
+  
+  result = [client getUsersBlogs];
+  NSLog(@"result: %@", result);
+  
+  [client release];
+}
+
+int main(int argc, char **argv, char **env) {
+  NSAutoreleasePool *pool;
+  
+  pool = [[NSAutoreleasePool alloc] init];
+#if LIB_FOUNDATION_LIBRARY || defined(GS_PASS_ARGUMENTS)
+  [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
+#endif
+  
+  runIt();
+  [pool release];
+  return 0;
+}
diff --git a/sope-appserver/samples/xmlrpc/common.h b/sope-appserver/samples/xmlrpc/common.h
new file mode 100644 (file)
index 0000000..da8032a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  Copyright (C) 2004 Helge Hess
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#import <Foundation/Foundation.h>
+
+#if !LIB_FOUNDATION_LIBRARY
+#  import <NGExtensions/NGObjectMacros.h>
+#  import <NGExtensions/NSString+Ext.h>
+#endif
+
+#include <NGExtensions/NGExtensions.h>
+
diff --git a/sope-appserver/samples/xmlrpc/meerkat_xml_channels.m b/sope-appserver/samples/xmlrpc/meerkat_xml_channels.m
new file mode 100644 (file)
index 0000000..7f06385
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+  Copyright (C) 2004 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include <NGXmlRpc/NGXmlRpcClient.h>
+#import <Foundation/Foundation.h>
+
+static void runIt(void) {
+  NGXmlRpcClient *client;
+  NSString *url;
+  
+  url = @"http://www.oreillynet.com/meerkat/xml-rpc/server.php";
+  client = [[NGXmlRpcClient alloc] initWithURL:url];
+  
+  NSLog(@"result: %@", 
+       [client call:@"meerkat.getChannelsBySubstring", @"XML", nil]);
+  
+  [client release];
+}
+
+int main(int argc, char **argv, char **env) {
+  NSAutoreleasePool *pool;
+  
+  pool = [[NSAutoreleasePool alloc] init];
+#if LIB_FOUNDATION_LIBRARY || defined(GS_PASS_ARGUMENTS)
+  [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
+#endif
+  
+  runIt();
+  [pool release];
+  return 0;
+}