2 * Copyright 2005 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.wamblee.crawler.kiss;
19 import org.wamblee.crawler.Action;
20 import org.wamblee.crawler.PageException;
25 public class Program {
27 private static final String RECORD_ACTION = "record";
28 private static final String INDENT = " ";
30 private String _channel;
32 private String _description;
33 private String _keywords;
34 private TimeInterval _interval;
35 private Action _programInfo;
37 public Program(String aChannel, String aName, String aDescription, String aKeywords, TimeInterval aInterval, Action aProgramInfo) {
40 _description = aDescription;
41 _keywords = aKeywords;
42 _interval = aInterval;
43 _programInfo = aProgramInfo;
46 public String getChannel() {
50 public String getName() {
54 public String getDescription() {
58 public String getKeywords() {
62 public TimeInterval getInterval() {
66 public boolean record() throws PageException {
67 Action record = _programInfo.execute().getAction(RECORD_ACTION);
68 if ( record == null) {
75 public void accept(Visitor aVisitor) {
76 aVisitor.visitProgram(this);
80 * @see java.lang.Object#toString()
83 public String toString() {
84 return _interval + " - " + _name + " (" + _channel + "/" + _keywords + ")" + "\n" +
85 (INDENT + _description).replaceAll("\n", "\n" + INDENT);