KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > media > urlcomposers > omroep > CgiSbURLComposer


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.applications.media.urlcomposers.omroep;
12 import org.mmbase.applications.media.Format;
13 import org.mmbase.applications.media.urlcomposers.RamURLComposer;
14 import org.mmbase.applications.media.urlcomposers.RealURLComposer;
15
16 import java.util.*;
17
18
19 /**
20  * An example. Produces an URL to the omroep cgi-scripts (for real and wm)
21  *
22  * @author Michiel Meeuwissen
23  * @version $Id: CgiSbURLComposer.java,v 1.4 2006/04/12 00:01:21 michiel Exp $
24  * @since MMBase-1.7
25  */

26 public class CgiSbURLComposer extends RamURLComposer {
27
28
29     protected String JavaDoc getBandPrefix() {
30         return "sb.";
31     }
32     protected String JavaDoc getBand() {
33         return "smalband";
34     }
35     public String JavaDoc getGUIIndicator(Map options) {
36         return super.getGUIIndicator(options) + " (" + getBand() +")";
37     }
38
39
40     /**
41      * These scripts actually wrap the source in a ram or wmp
42      */

43     public Format getFormat() {
44         Format format = super.getFormat();
45         if (format == Format.RM) return Format.RAM;
46         if (format == Format.RA) return Format.RAM;
47         if (format == Format.ASF) return Format.WMP;
48         return format;
49     }
50
51     /**
52      * Host must be cgi.omroep.nl script.
53      */

54     public boolean canCompose() {
55         return provider.getStringValue("host").equals("cgi.omroep.nl") && provider.getStringValue("rootpath").charAt(0) == '%';
56     }
57
58
59     protected StringBuffer JavaDoc getURLBuffer() {
60         String JavaDoc rootPath = provider.getStringValue("rootpath").substring(1);
61         StringBuffer JavaDoc buff = new StringBuffer JavaDoc(provider.getStringValue("protocol") + "://cgi.omroep.nl" + rootPath);
62         int lastSlash = RealSbURLComposer.addURL(buff, source.getStringValue("url"));
63         buff.insert(lastSlash + 1, getBandPrefix());
64         RealURLComposer.getRMArgs(buff, fragment, info); // append time, title
65
return buff;
66     }
67
68 }
69
70
71
Popular Tags