KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > joseki > HttpAdd


1 /*
2  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package com.hp.hpl.jena.joseki;
7
8 import java.net.* ;
9 import com.hp.hpl.jena.rdf.model.*;
10
11 /** Add statements to a remote model.
12  * A typical code sequence might be:
13  * <pre>
14  * HttpAdd addOp = new HttpAdd(URL of target) ;
15  * addOp.setModel(your model);
16  * addOp.exec() ;
17  * // resultModel should be an empty model
18  * </pre>
19  * or
20  * <pre>
21  * HttpAdd addOp = new HttpAdd(URL of target) ;
22  * // Collect statements to be added
23  * addOp.add(statement) ;
24  * addOp.add(model) ; // Adds all the statements in a model
25  * addOp.exec() ; // Result is an empty model
26  * </pre>
27  *
28  * The result model will be an empty model for a successful operation.
29  * Any problems cause {@link HttpException} to be thrown on .exec()
30  *
31  * @author Andy Seaborne
32  * @version $Id: HttpAdd.java,v 1.8 2004/04/30 14:13:13 andy_seaborne Exp $
33  */

34 public class HttpAdd extends HttpExecuteModel
35 {
36     /** Create an operation for adding statements to a remote model */
37     public HttpAdd(URL url) throws MalformedURLException
38     {
39         this(url.toString()) ;
40     }
41     
42     /** Create an operation for adding statements to a remote model */
43     public HttpAdd(String JavaDoc urlStr) throws MalformedURLException
44     {
45         super(urlStr, "add") ;
46     }
47
48     /** Accumulate statements to be added when the operations is executed
49      * @param model A set of statements to be added on execution
50      */

51     public void add(Model model) { collect(model) ; }
52     
53     /** Accumulate statements to be added when the operations is executed
54      * @param statement A statement to be added on execution
55      */

56     public void add(Statement statement) { collect(statement) ; }
57 }
58
59
60 /*
61  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
62  * All rights reserved.
63  *
64  * Redistribution and use in source and binary forms, with or without
65  * modification, are permitted provided that the following conditions
66  * are met:
67  * 1. Redistributions of source code must retain the above copyright
68  * notice, this list of conditions and the following disclaimer.
69  * 2. Redistributions in binary form must reproduce the above copyright
70  * notice, this list of conditions and the following disclaimer in the
71  * documentation and/or other materials provided with the distribution.
72  * 3. The name of the author may not be used to endorse or promote products
73  * derived from this software without specific prior written permission.
74  *
75  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
76  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
77  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
78  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
79  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
80  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
81  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
84  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85  */

86  
87
Popular Tags