1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package examples;
29
30 import java.io.File;
31
32 import java.util.Date;
33
34 import sfutils.Administrator;
35 import sfutils.Project;
36
37 import sfutils.frs.FileRelease;
38 import sfutils.frs.FileSpecification;
39 import sfutils.frs.Package;
40
41 import sfutils.frs.web.HttpUnitPublisher;
42
43 /***
44 * An example of how to use the file release system classes. This example will
45 * compile, but will not work as all of the parameters (file names, project
46 * names, passwords and the like) are fictitious.
47 *
48 * @author <a href="mailto:ljnelson94@alumni.amherst.edu">Laird Nelson</a>
49 * @version $Revision: 1.3 $ $Date: 2003/07/12 16:13:23 $
50 * @since July 7, 2003
51 */
52 public class BasicUsageExample {
53
54 /***
55 * Creates a new {@link BasicUsageExample}. Not used.
56 */
57 private BasicUsageExample() {
58 super();
59 }
60
61 /***
62 * If this were a fully-functional class, this method would create a {@link
63 * FileRelease} and {@linkplain FileRelease#publish() publish it}.
64 *
65 * @param args
66 * the command line arguments; ignored
67 * @exception Exception
68 * if an error occurs, which it will if this method is actually
69 * invoked
70 */
71 public static final void main(final String[] args) throws Exception {
72
73 final Administrator admin = new Administrator();
74 admin.setName("username");
75 admin.setPassword("password");
76
77 final Project project = new Project();
78 project.setName("My Project");
79 project.setShortName("myproj");
80 project.setAdministrator(admin);
81
82 final Package packaj = new Package();
83 packaj.setName("myproj");
84 packaj.setHidden(false);
85 packaj.setProject(project);
86
87 final FileRelease release = new FileRelease();
88 release.setName("myproj-1.0");
89 release.setPackage(packaj);
90 release.setHidden(false);
91 release.setReleaseDate(new Date());
92 release.setNotifyOthers(true);
93
94 final File changeLogFile = new File("/path/to/changelog.txt");
95 release.setChangeLogFile(changeLogFile);
96
97 release.setReleaseNotes("Behold the release notes");
98
99 final FileSpecification spec1 = new FileSpecification();
100 spec1.setFile(new File("/path/to/file1.txt"));
101 spec1.setFileType(FileSpecification.TEXT_FILE);
102 spec1.setProcessorType(FileSpecification.PLATFORM_INDEPENDENT_PROCESSOR);
103 spec1.setReleaseDate(new Date());
104
105 release.setFileSpecifications(new FileSpecification[] { spec1 });
106
107 release.setPublisher(new HttpUnitPublisher());
108 release.publish();
109
110 }
111
112 }