KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snipsnap > snip > SnipSpace


1 /* n
2  * This file is part of "SnipSnap Wiki/Weblog".
3  *
4  * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
5  * All Rights Reserved.
6  *
7  * Please visit http://snipsnap.org/ for updates and contact.
8  *
9  * --LICENSE NOTICE--
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  * --LICENSE NOTICE--
24  */

25 package org.snipsnap.snip;
26
27 import org.apache.lucene.search.Hits;
28
29 import java.sql.Timestamp JavaDoc;
30 import java.util.List JavaDoc;
31
32 /**
33  * SnipSpace interface handles all the operations with snips like
34  * loading, storing, searching et.c
35  *
36  * @author Stephan J. Schmidt
37  * @version $Id: SnipSpace.java 1606 2004-05-17 10:56:18Z leo $
38  */

39
40 public interface SnipSpace {
41   public String JavaDoc getETag();
42
43   // A snip is changed by the user (created, stored)
44
public void changed(Snip snip);
45
46   public void init();
47
48   public void setETag();
49
50   public int getSnipCount();
51
52   public List JavaDoc getChanged();
53
54   public List JavaDoc getChanged(int count);
55
56   public List JavaDoc getAll();
57
58   public List JavaDoc getSince(Timestamp JavaDoc date);
59
60   public List JavaDoc getByDate(String JavaDoc nameSpace, String JavaDoc start, String JavaDoc end);
61
62   /**
63    * A list of Snips, ordered by "hotness", currently
64    * viewcount.
65    *
66    * @param count number of snips in the result
67    * @return List of snips, ordered by hotness
68    */

69   public List JavaDoc getHot(int count);
70
71   public List JavaDoc getComments(Snip snip);
72
73   public List JavaDoc getByUser(String JavaDoc login);
74
75   public List JavaDoc getChildren(Snip snip);
76
77   public List JavaDoc getChildrenDateOrder(Snip snip, int count);
78
79   public List JavaDoc getChildrenModifiedOrder(Snip snip, int count);
80
81   public void reIndex();
82
83   public Hits search(String JavaDoc queryString);
84
85   public Blog getBlog();
86
87   public Blog getBlog(String JavaDoc name);
88
89   public boolean exists(String JavaDoc name);
90
91   public Snip[] match(String JavaDoc pattern);
92
93   public Snip[] match(String JavaDoc start, String JavaDoc end);
94
95   public Snip load(String JavaDoc name);
96
97   public void store(Snip snip);
98
99   /**
100    * Method with with wich the system can store snips.
101    * This methode does not change the mTime, the mUser,
102    * reindex the snip or add the snip to the modified list
103    *
104    * @param snip The snip to store
105    */

106   public void systemStore(Snip snip);
107
108   /**
109    * Delays the storage of a snip for some time. Some information
110    * in a snip are changeg every view. To not store a snip every
111    * time it is viewed, delay the store and wait until some changes
112    * are cummulated. Should only be used, when the loss of the
113    * changes is tolerable.
114    *
115    * @param snip Snip to delay for storage
116    */

117   public void delayedStore(Snip snip);
118
119   /**
120    * Create a new snip with the specified content.
121    * @param name the name of the new snip
122    * @param content initial content
123    * @return the new copied snip
124    */

125   public Snip create(String JavaDoc name, String JavaDoc content);
126
127   public void remove(Snip snip);
128 }
Popular Tags