gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] fenfire/org/fenfire modules/pp/PPActionsImpl.ja...


From: Matti Katila
Subject: [Gzz-commits] fenfire/org/fenfire modules/pp/PPActionsImpl.ja...
Date: Fri, 07 Mar 2003 11:47:26 -0500

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Matti Katila <address@hidden>   03/03/07 11:47:22

Modified files:
        org/fenfire/modules/pp: PPActionsImpl.java 
Added files:
        org/fenfire/modules/pp: PPVocab.java pp.py 
        org/fenfire/util: URN5Namespace.java 

Log message:
        fixes + files adding

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPVocab.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/pp.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPActionsImpl.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/util/URN5Namespace.java?rev=1.1

Patches:
Index: fenfire/org/fenfire/modules/pp/PPActionsImpl.java
diff -u fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.4 
fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.5
--- fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.4       Fri Mar  7 
09:58:27 2003
+++ fenfire/org/fenfire/modules/pp/PPActionsImpl.java   Fri Mar  7 11:47:20 2003
@@ -1,13 +1,10 @@
 //(c): Tuomas J. Lukka and Matti Katila
 
 package org.fenfire.modules.pp;
-
-//import java.util.*;
+import org.fenfire.util.URN5Namespace;
 import java.io.IOException;
 import java.rmi.*;
 import java.rmi.server.*;
-
-//import gzz.util.URN5NameSpace;
 import com.hp.hpl.mesa.rdf.jena.vocabulary.RDF;
 import com.hp.hpl.mesa.rdf.jena.model.*;
 import com.hp.hpl.mesa.rdf.jena.common.*;
@@ -15,83 +12,42 @@
 /** The implementation of PPActions.
  */
 public class PPActionsImpl extends UnicastRemoteObject implements PPActions {
-public static final String rcsid = "$Id: PPActionsImpl.java,v 1.4 2003/03/07 
14:58:27 mudyc Exp $";
+public static final String rcsid = "$Id: PPActionsImpl.java,v 1.5 2003/03/07 
16:47:20 mudyc Exp $";
     public static final boolean dbg = true;
     protected static void p(String s) { if(dbg) pa(s); }
     protected static void pa(String s) { System.out.println(s); }
 
-
-    class URN5NameSpace {
-       public String generateId() {  return "foobar"; }
-    }
-
-
-    // Propertys
-    static public Property CONTAINS;
-    static public Property CREATION_TIME;
-    static public Property COORD_X; 
-    static public Property COORD_Y; 
-    static public Property DEPTH;
-
-
-    // Resources
-    static public Resource PAPER_TYPE;
-    static public Resource NOTE;
-
-    
+    private PPVocab PP = new PPVocab();
+    private Model model;
+    public void setModel(Model model) { this.model = model; }
 
     public PPActionsImpl(Model model) throws RemoteException {
        super();
        setModel(model);
-
-       String pp_voc = "http://fenfire.org/vocabulary/pp.html";;
-       try {
-           // Propertys
-           CONTAINS = new PropertyImpl(pp_voc+"#contains");
-           CREATION_TIME = new PropertyImpl(pp_voc + "#creationTime");
-           COORD_X = new PropertyImpl(pp_voc + "#coordX");
-           COORD_Y = new PropertyImpl(pp_voc + "#coordY");
-           DEPTH = new PropertyImpl(pp_voc + "#depth");
-
-           // Resources
-           PAPER_TYPE = new ResourceImpl(pp_voc + "#paper_type");
-           NOTE = new ResourceImpl(pp_voc + "#note");
-       } catch (RDFException e) {
-           pa("Failed: "+e);
-       }
     }
 
-    private Model model;
-    public void setModel(Model model) { this.model = model; }
 
 
     // --- implement PPActions
     //
     public String newPaper() throws RemoteException 
-    { synchronized(model) {
-       /*
-       Cell n = center.h(d.d1, 1).N(d.d1);
-       n.setText("Uusi paperi");
-       return n.getId();
-       */
-       
-       try {
-
-           // We need a unique uri for paper   
-           String uri = (new URN5NameSpace()).generateId();
-           Resource paper = model.createResource(uri);
-
-           // and resource must be also paper..
-           paper.addProperty(RDF.type, PAPER_TYPE);
+    { synchronized(model) { try {
 
-           // set creation time
-           paper.addProperty(CREATION_TIME, "123");  // XXX we need iso 8601 
time presentation here
+       // We need a unique uri for paper       
+       String uri = URN5Namespace.instance.generateId();
+       Resource paper = model.createResource(uri);
+
+       // and resource must be also paper..
+       paper.addProperty(RDF.type, PP.PaperType);
+
+       // set creation time
+       // XXX we need iso 8601 time presentation here
+       paper.addProperty(PP.CreationTime, "123");  
        
-           return uri;
-       } catch (RDFException e) {
-           return "";
-       }
-    }}
+       return uri;
+    } catch (RDFException e) {
+       return "";
+    }}}
 
 
     public void deletePaper(String paperURI) throws RemoteException 
@@ -123,19 +79,19 @@
        Resource paper = model.getResource(paperURI);
        
        // We need a unique uri for note        
-       String uri = (new URN5NameSpace()).generateId();
+       String uri = URN5Namespace.instance.generateId();
        Resource note = model.createResource(uri);
-       note.addProperty(RDF.type, NOTE);
+       note.addProperty(RDF.type, PP.Note);
 
        // set note to paper
-       paper.addProperty(CONTAINS, note);
+       paper.addProperty(PP.Contains, note);
 
        // set coords
-       note.addProperty(COORD_X, ""+x);
-       note.addProperty(COORD_X, ""+x);
+       note.addProperty(PP.CoordX, ""+x);
+       note.addProperty(PP.CoordX, ""+x);
 
        // set depth...
-       note.addProperty(DEPTH,  "5");
+       note.addProperty(PP.Depth,  "5");
 
        // scale etc..  XXX
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]