View Javadoc
1 package net.mlw.fball.loader.yahoo.league; 2 3 import java.io.File; 4 import java.io.FileReader; 5 import java.io.LineNumberReader; 6 7 import net.mlw.fball.bo.Coach; 8 import net.mlw.fball.bo.League; 9 10 import org.apache.commons.logging.Log; 11 import org.apache.commons.logging.LogFactory; 12 13 /*** 14 * @author Matthew L. Wilson 15 * @version $Revision: 1.1 $ $Date: 2004/04/01 21:51:07 $ 16 */ 17 public class CoachLoader extends AbstractLeagueLoader 18 { 19 /*** Commons Logger. **/ 20 private static final Log LOGGER = LogFactory.getLog(CoachLoader.class); 21 22 public void updateLeague(League league) throws Exception 23 { 24 league.getCoaches().clear(); 25 26 File file = new File("/stats/yahoo/leagues/" + league.getId() + "/team.html"); 27 if (file.exists()) 28 { 29 int index = 0; 30 LineNumberReader reader = new LineNumberReader(new FileReader(file)); 31 while (reader.ready()) 32 { 33 String line = reader.readLine(); 34 if (line.indexOf("<td class=tx><a href=\"/f1/show?page=roster&lid=") >= 0) 35 { 36 index = line.indexOf("&mid="); 37 String providerCoachId = line.substring(index + 5, (index = line.indexOf("\"", index))); 38 String name = line.substring(index + 2, line.indexOf("<", index)); 39 40 Coach coach = (Coach) league.getCoaches().get(providerCoachId); 41 if (coach == null) 42 { 43 coach = new Coach(providerCoachId); 44 league.getCoaches().put(providerCoachId, coach); 45 } 46 coach.setName(name); 47 } 48 else if (line.indexOf("(ID#") > 0) 49 { 50 league.setName(line.trim()); 51 } 52 } 53 } 54 } 55 }

This page was automatically generated by Maven