1 /*
2 * Copyright 1999,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.commons.feedparser.post;
18
19 import java.util.Hashtable;
20 import java.util.Vector;
21
22 import org.apache.xmlrpc.XmlRpcClient;
23
24 /**
25 * A PostAgent allows a developer to post to a given weblog.
26 *
27 * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
28 * @version $Id: MetaWeblogPostAgent.java 373622 2006-01-30 22:53:00Z mvdb $
29 */
30 public class MetaWeblogPostAgent {
31
32 public void newPost( String router,
33 String weblog,
34 String username,
35 String password,
36 PostEntry entry ) throws Exception {
37
38 XmlRpcClient xmlrpc = new XmlRpcClient( router );
39
40 Vector params = new Vector();
41 params.add( weblog);
42 params.add( username );
43 params.add( password );
44
45 Hashtable struct = new Hashtable();
46
47 struct.put( "title", entry.title );
48 struct.put( "description", entry.description );
49
50 params.add( struct );
51 params.add( new Boolean( true ) );
52
53 Vector v = (Vector)xmlrpc.execute( "metaWeblog.newPost", params );
54
55 }
56 }
57