KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > test > cms > stress > CreateContentCommand


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.test.cms.stress;
10
11 import org.jboss.portal.cms.NodeFactory;
12 import org.jboss.portal.cms.Node;
13 import org.jboss.portal.cms.Content;
14 import org.jboss.portal.cms.NodeException;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @version $Revision: 1.1 $
19  */

20 public class CreateContentCommand extends Command
21 {
22
23    private final String JavaDoc uri;
24    private final String JavaDoc s;
25
26    public CreateContentCommand(String JavaDoc uri, String JavaDoc s)
27    {
28       this.uri = uri;
29       this.s = s;
30    }
31
32    public void execute(Client.Result result, NodeFactory factory) throws NodeException
33    {
34       Content content = new Content(s.getBytes(), "text/html");
35       Node node = factory.getNode(uri);
36       node.createContent(content, true);
37    }
38
39    protected String JavaDoc describe()
40    {
41       return "[createcontent," + uri + "," + s + "]";
42    }
43 }
44
Popular Tags