001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018:
019: package org.apache.roller.business.pings;
020:
021: import java.util.List;
022: import org.apache.roller.RollerException;
023: import org.apache.roller.pojos.PingTargetData;
024: import org.apache.roller.pojos.WebsiteData;
025:
026: /**
027: * Manages ping targets.
028: *
029: * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
030: */
031: public interface PingTargetManager {
032:
033: /**
034: * Store a ping target.
035: *
036: * @param pingTarget ping target data object.
037: * @throws RollerException
038: */
039: public void savePingTarget(PingTargetData pingTarget)
040: throws RollerException;
041:
042: /**
043: * Remove a ping target.
044: *
045: * @param id id of the ping target to be removed
046: * @throws RollerException
047: */
048: public void removePingTarget(PingTargetData pingTarget)
049: throws RollerException;
050:
051: /**
052: * Remove all custom targets (regardless of website).
053: */
054: public void removeAllCustomPingTargets() throws RollerException;
055:
056: /**
057: * Retrieve a specific ping target by id.
058: *
059: * @param id id of the ping target to be retrieved.
060: * @return the ping target whose id is specified.
061: * @throws RollerException
062: */
063: public PingTargetData getPingTarget(String id)
064: throws RollerException;
065:
066: /**
067: * Get a list of the common (shared) ping targets.
068: *
069: * @return the list of common ping targets as a <code>List</code> of {@link PingTargetData} objects
070: * @throws RollerException
071: */
072: public List getCommonPingTargets() throws RollerException;
073:
074: /**
075: * Get a list of the custom ping targets for the given website.
076: *
077: * @param website the website whose custom targets should be returned.
078: * @return the list of custom ping targets for the given website as a <code>List</code> of {@link PingTargetData}
079: * objects
080: * @throws RollerException
081: */
082: public List getCustomPingTargets(WebsiteData website)
083: throws RollerException;
084:
085: /**
086: * Check if the ping target has a name that is unique in the appropriate set. If the ping target has no website id
087: * (is common), then this checks if the name is unique amongst common targets, and if custom then unique amongst
088: * custom targets. If the target has a non-null id, then it is allowed to have the same name as tha existing stored
089: * target with the same id.
090: *
091: * @param pingTarget
092: * @return true if the name is unique in the appropriate set (custom or common) ping targets.
093: * @throws RollerException
094: */
095: public boolean isNameUnique(PingTargetData pingTarget)
096: throws RollerException;
097:
098: /**
099: * Check if the url of the ping target is well-formed. For this test, it must parse as a <code>java.net.URL</code>,
100: * with protocol <code>http</code> and a non-empty <code>host</code> portion.
101: *
102: * @param pingTarget
103: * @return true if the <code>pingUrl</code> property of the ping target is a well-formed url.
104: * @throws RollerException
105: */
106: public boolean isUrlWellFormed(PingTargetData pingTarget)
107: throws RollerException;
108:
109: /**
110: * Check if the host portion of the url of the ping target is known, meaning it is either a well-formed IP address
111: * or a hostname that resolves from the server. The ping target url must parse as a <code>java.net.URL</code> in
112: * order for the hostname to be extracted for this test. This will return false if that parsing fails.
113: *
114: * @param pingTarget
115: * @return true if the <code>pingUrl</code> (is well-formed and) the <code>host</code> portion of the url of the
116: * ping target is a valid IP address or a hostname that can be resolved on the server.
117: * @throws RollerException
118: */
119: public boolean isHostnameKnown(PingTargetData pingTarget)
120: throws RollerException;
121:
122: /**
123: * Release all resources associated with Roller session.
124: */
125: public void release();
126:
127: }
|