gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under
the git version control system
3 import org
.apache
.tools
.ant
.BuildException
;
4 import org
.apache
.tools
.ant
.Task
;
9 * Na osnovu spiska i trenutnog studenta nadji sledeceg.
10 * cita se iz current.txt, a pise u taj i current.properties
11 * Ovo se onda korisiti za kopiranje fajlova u buildu
14 public class next
extends Task
{
15 private String student
, group
;
16 private String current
;
17 private String file
="studenti.txt";
18 private String separator
="\t";
19 private String currentFilename
="current.txt",
20 currentProperties
="current.properties";
23 private void setCurrent(String c
) throws Exception
{
26 String
[] s
= current
.split(separator
);
28 throw new Exception("problem setting current student name - can't split group and name");
37 private void loadCurrent(){
39 File f
= new File(currentFilename
);
41 BufferedReader r
= new BufferedReader(
42 new InputStreamReader(
43 new FileInputStream(f
)));
44 setCurrent(r
.readLine());
48 }catch (Exception ex
) {
49 throw new BuildException(ex
);
53 private void saveCurrent(){
55 PrintWriter w
= new PrintWriter(new FileWriter(currentFilename
));
58 }catch (Exception ex
) {
59 throw new BuildException(ex
);
61 //now the properties file
63 PrintWriter w
= new PrintWriter(new FileWriter(currentProperties
));
64 w
.println("student.group="+group
);
65 w
.println("student.current="+student
);
67 }catch (Exception ex
) {
68 throw new BuildException(ex
);
72 // The method executing the task
73 public void execute() throws BuildException
{
76 BufferedReader r
= new BufferedReader(new InputStreamReader(new FileInputStream(file
)));
77 String s
= r
.readLine();
78 if (current
!= null) {
79 while (s
!=null && s
.compareTo(current
)!=0)
81 setCurrent(r
.readLine());
86 }catch (Exception ex
) {
87 throw new BuildException(ex
);
92 public void setSeparator(String msg
) {
96 public void setFile(String msg
) {
100 public void setCurrentFilename(String msg
) {
101 this.currentFilename
= msg
;
103 public void setCurrentProperties(String msg
) {
104 this.currentProperties
= msg
;
Svarog.pmf.uns.ac.rs/gitweb
maintanance
Doni Pracner