1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. The ASF licenses this file to You 4 * under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. For additional information regarding 15 * copyright in this work, please see the NOTICE file in the top level 16 * directory of this distribution. 17 */ 18 19 package org.apache.roller.model; 20 21 import java.util.List; 22 import org.apache.roller.RollerException; 23 import org.apache.roller.pojos.PingTargetData; 24 import org.apache.roller.pojos.WebsiteData; 25 26 27 /** 28 * Manages ping targets. 29 * 30 * @author <a HREF="mailto:anil@busybuddha.org">Anil Gangolli</a> 31 */ 32 public interface PingTargetManager { 33 34 35 /** 36 * Store a ping target. 37 * 38 * @param pingTarget ping target data object. 39 * @throws RollerException 40 */ 41 public void savePingTarget(PingTargetData pingTarget) throws RollerException; 42 43 44 /** 45 * Remove a ping target. 46 * 47 * @param id id of the ping target to be removed 48 * @throws RollerException 49 */ 50 public void removePingTarget(PingTargetData pingTarget) throws RollerException; 51 52 53 /** 54 * Remove all custom targets (regardless of website). 55 */ 56 public void removeAllCustomPingTargets() throws RollerException; 57 58 59 /** 60 * Retrieve a specific ping target by id. 61 * 62 * @param id id of the ping target to be retrieved. 63 * @return the ping target whose id is specified. 64 * @throws RollerException 65 */ 66 public PingTargetData getPingTarget(String id) throws RollerException; 67 68 69 /** 70 * Get a list of the common (shared) ping targets. 71 * 72 * @return the list of common ping targets as a <code>List</code> of {@link PingTargetData} objects 73 * @throws RollerException 74 */ 75 public List getCommonPingTargets() throws RollerException; 76 77 78 /** 79 * Get a list of the custom ping targets for the given website. 80 * 81 * @param website the website whose custom targets should be returned. 82 * @return the list of custom ping targets for the given website as a <code>List</code> of {@link PingTargetData} 83 * objects 84 * @throws RollerException 85 */ 86 public List getCustomPingTargets(WebsiteData website) throws RollerException; 87 88 89 /** 90 * Check if the ping target has a name that is unique in the appropriate set. If the ping target has no website id 91 * (is common), then this checks if the name is unique amongst common targets, and if custom then unique amongst 92 * custom targets. If the target has a non-null id, then it is allowed to have the same name as tha existing stored 93 * target with the same id. 94 * 95 * @param pingTarget 96 * @return true if the name is unique in the appropriate set (custom or common) ping targets. 97 * @throws RollerException 98 */ 99 public boolean isNameUnique(PingTargetData pingTarget) throws RollerException; 100 101 102 /** 103 * Check if the url of the ping target is well-formed. For this test, it must parse as a <code>java.net.URL</code>, 104 * with protocol <code>http</code> and a non-empty <code>host</code> portion. 105 * 106 * @param pingTarget 107 * @return true if the <code>pingUrl</code> property of the ping target is a well-formed url. 108 * @throws RollerException 109 */ 110 public boolean isUrlWellFormed(PingTargetData pingTarget) throws RollerException; 111 112 113 /** 114 * Check if the host portion of the url of the ping target is known, meaning it is either a well-formed IP address 115 * or a hostname that resolves from the server. The ping target url must parse as a <code>java.net.URL</code> in 116 * order for the hostname to be extracted for this test. This will return false if that parsing fails. 117 * 118 * @param pingTarget 119 * @return true if the <code>pingUrl</code> (is well-formed and) the <code>host</code> portion of the url of the 120 * ping target is a valid IP address or a hostname that can be resolved on the server. 121 * @throws RollerException 122 */ 123 public boolean isHostnameKnown(PingTargetData pingTarget) throws RollerException; 124 125 126 /** 127 * Release all resources associated with Roller session. 128 */ 129 public void release(); 130 131 } 132