KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > model > PingTargetManager


1 /*
2  * Copyright (c) 2005
3  * Anil R. Gangolli. All rights reserved.
4  *
5  * Distributed with the Roller Weblogger Project under the terms of the Roller Software
6  * License
7  */

8
9 package org.roller.model;
10
11 import org.roller.pojos.PingTargetData;
12 import org.roller.pojos.WebsiteData;
13 import org.roller.RollerException;
14
15 import java.io.Serializable JavaDoc;
16 import java.util.List JavaDoc;
17
18 /**
19  * Manages ping targets.
20  */

21 public interface PingTargetManager extends Serializable JavaDoc
22 {
23     /**
24      * Release all resources associated with Roller session.
25      */

26     public void release();
27
28     /**
29      * Create a common (shared) ping target. This method does not persist the new instance.
30      *
31      * @param name
32      * @param pingUrl
33      * @return the new ping target.
34      * @throws RollerException
35      */

36     public PingTargetData createCommonPingTarget(String JavaDoc name, String JavaDoc pingUrl) throws RollerException;
37
38     /**
39      * Create a custom ping target for the specified website. This method does not persist the new instance.
40      *
41      * @param name a short descriptive name of the ping target
42      * @param pingUrl the URL to which to send pings
43      * @param website the website for which the custom target is created.
44      * @return the new ping target.
45      * @throws RollerException
46      */

47     public PingTargetData createCustomPingTarget(String JavaDoc name, String JavaDoc pingUrl,
48                                                  WebsiteData website) throws RollerException;
49
50     /**
51      * Store a ping target.
52      *
53      * @param pingTarget ping target data object.
54      * @throws RollerException
55      */

56     public void storePingTarget(PingTargetData pingTarget) throws RollerException;
57
58     /**
59      * Retrieve a specific ping target by id.
60      *
61      * @param id id of the ping target to be retrieved.
62      * @return the ping target whose id is specified.
63      * @throws RollerException
64      */

65     public PingTargetData retrievePingTarget(String JavaDoc id) throws RollerException;
66
67     /**
68      * Remove a ping target by id.
69      *
70      * @param id id of the ping target to be removed
71      * @throws RollerException
72      */

73     public void removePingTarget(String JavaDoc id) throws RollerException;
74
75     /**
76      * Get a list of the common (shared) ping targets.
77      *
78      * @return the list of common ping targets as a <code>List</code> of {@link PingTargetData} objects
79      * @throws RollerException
80      */

81     public List JavaDoc getCommonPingTargets() throws RollerException;
82
83     /**
84      * Get a list of the custom ping targets for the given website.
85      *
86      * @param website the website whose custom targets should be returned.
87      * @return the list of custom ping targets for the given website as a <code>List</code> of {@link PingTargetData}
88      * objects
89      * @throws RollerException
90      */

91     public List JavaDoc getCustomPingTargets(WebsiteData website) throws RollerException;
92
93     /**
94      * Remove all of the custom ping targets for the given website.
95      *
96      * @param website the website whose custom ping targets should be removed
97      * @throws RollerException
98      */

99     public void removeCustomPingTargets(WebsiteData website) throws RollerException;
100
101     /**
102      * Remove all custom targets (regardless of website).
103      */

104     public void removeAllCustomPingTargets() throws RollerException;
105
106
107     /**
108      * Check if the ping target has a name that is unique in the appropriate set. If the ping target has no website id
109      * (is common), then this checks if the name is unique amongst common targets, and if custom then unique amongst
110      * custom targets. If the target has a non-null id, then it is allowed to have the same name as tha existing stored
111      * target with the same id.
112      *
113      * @param pingTarget
114      * @return true if the name is unique in the appropriate set (custom or common) ping targets.
115      * @throws RollerException
116      */

117     public boolean isNameUnique(PingTargetData pingTarget) throws RollerException;
118
119     /**
120      * Check if the url of the ping target is well-formed. For this test, it must parse as a <code>java.net.URL</code>,
121      * with protocol <code>http</code> and a non-empty <code>host</code> portion.
122      *
123      * @param pingTarget
124      * @return true if the <code>pingUrl</code> property of the ping target is a well-formed url.
125      * @throws RollerException
126      */

127     public boolean isUrlWellFormed(PingTargetData pingTarget) throws RollerException;
128
129     /**
130      * Check if the host portion of the url of the ping target is known, meaning it is either a well-formed IP address
131      * or a hostname that resolves from the server. The ping target url must parse as a <code>java.net.URL</code> in
132      * order for the hostname to be extracted for this test. This will return false if that parsing fails.
133      *
134      * @param pingTarget
135      * @return true if the <code>pingUrl</code> (is well-formed and) the <code>host</code> portion of the url of the
136      * ping target is a valid IP address or a hostname that can be resolved on the server.
137      * @throws RollerException
138      */

139     public boolean isHostnameKnown(PingTargetData pingTarget) throws RollerException;
140
141 }
142
Popular Tags