View Javadoc

1   /*
2    * $Id: LibraryEntryConfiguration.java,v 1.6 2005/06/01 19:55:51 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8    
9   package com.bbn.swede.core.libraries;
10  
11  /***
12   * 
13   * A subclass of AbstractConfiguration with convenience accessors, mutators 
14   * and constants specified for LibraryEntries.
15   * <br /> <br />
16   * Each of the getters and setters methods uses an internal string value to
17   * specify the value.  For example, a call to <code>setName(aNameValue)</code> is 
18   * exactly identical to <code>setSystemProperty(ENTRY_NAME_PROPERTY, aNameValue)</code>.
19   * 
20   * 
21   * @author aperezlo
22   */
23  public class LibraryEntryConfiguration extends AbstractConfiguration
24  {
25     /***
26      * Property name for library entry name.
27      */
28     static final String ENTRY_NAME_PROPERTY = "entry-name";
29     /***
30      * Property name for library entry base URI.
31      */
32     static final String ENTRY_URI_PROPERTY = "entry-uri";
33     
34     /***
35      * Property value constant specifying manual library updates.
36      */
37     public static final String ENTRY_UPDATE_SCHEDULE_MANUAL_STR = "manual";
38     /***
39      * Property value constant specifying automatica library updates.
40      */
41     public static final String ENTRY_UPDATE_SCHEDULE_AUTOMATIC_STR = "automatic";
42     /***
43      * Property name for library entry update schedule.
44      */
45     static final String ENTRY_UPDATE_SCHEDULE_PROPERTY = "entry-update-schedule";
46     /***
47      * Property name for library entry update URL.
48      */
49     static final String ENTRY_UPDATE_URL_PROPERTY = "entry-update-url";
50     
51     /***
52      * Property name for library entry download date.
53      */
54     public static final String ENTRY_DATE_FORMAT_STR = "MM/dd/yyyy";
55     
56     /*
57      *  (non-Javadoc)
58      * @see com.bbn.swede.core.libraries.IConfiguration#getPropertiesValidator()
59      */
60     public IConfigurationValidator getPropertiesValidator()
61     {
62        return new ConfigurationValidator(ConfigurationValidator.VALIDATE_ENTRY);
63     }
64     /***
65      * Sets the entry URI.  This is the base URI of the entry, as specified
66      * within the document itself.
67      * @param s The new URI
68      */
69     public void setURI(String s)
70     {
71        setSystemProperty(ENTRY_URI_PROPERTY, s);
72     }
73     /***
74      * Retrieves the entry's URI.  This is the base URI of the entry, as specified
75      * within the document itself.
76      * @return The URI
77      */
78     public String getURI()
79     {
80        return getSystemProperty(ENTRY_URI_PROPERTY);
81     }
82     /***
83      * Sets the entry name.
84      * @param s The new name
85      */
86     public void setName(String s)
87     {
88        setSystemProperty(ENTRY_NAME_PROPERTY, s);
89     }
90     /***
91      * Retrieves the entry's name.
92      * @return the name
93      */
94     public String getName()
95     {
96        return getSystemProperty(ENTRY_NAME_PROPERTY);
97     }
98     /***
99      * Sets the entry URL.  This is the URL the entry was downloaded from.
100     * @param s The new URL
101     */
102    public void setURL(String s)
103    {
104       setSystemProperty(ENTRY_UPDATE_URL_PROPERTY, s);
105    }
106    /***
107     * Retrieves the entry's URL.  This is the URL the entry was downloaded from.
108     * @return The URL
109     */
110    public String getURL()
111    {
112       return getSystemProperty(ENTRY_UPDATE_URL_PROPERTY);
113    }
114    /***
115     * Retrieves the entry's update schedule.
116     * @return The update schedule
117     */
118    public String getUpdateSchedule()
119    {
120       return getSystemProperty(ENTRY_UPDATE_SCHEDULE_PROPERTY);
121    }
122    /***
123     * Sets the entry's update schedule.
124     * @param s The new update schedule
125     */
126    public void setUpdateSchedule(String s)
127    {
128       setSystemProperty(ENTRY_UPDATE_SCHEDULE_PROPERTY, s);
129    }
130 }