You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(18) |
Aug
(33) |
Sep
(30) |
Oct
(27) |
Nov
(59) |
Dec
(30) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(67) |
Feb
(44) |
Mar
(70) |
Apr
(73) |
May
(119) |
Jun
(31) |
Jul
(92) |
Aug
(86) |
Sep
(76) |
Oct
(152) |
Nov
(156) |
Dec
(85) |
2008 |
Jan
(111) |
Feb
(121) |
Mar
(107) |
Apr
(102) |
May
(45) |
Jun
(65) |
Jul
(62) |
Aug
(133) |
Sep
(56) |
Oct
(56) |
Nov
(17) |
Dec
(15) |
2009 |
Jan
(10) |
Feb
(5) |
Mar
(10) |
Apr
(14) |
May
(49) |
Jun
(94) |
Jul
(67) |
Aug
(23) |
Sep
(9) |
Oct
(92) |
Nov
(26) |
Dec
(51) |
2010 |
Jan
(105) |
Feb
(83) |
Mar
(52) |
Apr
(59) |
May
(68) |
Jun
(71) |
Jul
(127) |
Aug
(49) |
Sep
(91) |
Oct
(27) |
Nov
(33) |
Dec
(26) |
2011 |
Jan
(26) |
Feb
(45) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(15) |
Jul
(45) |
Aug
(33) |
Sep
(50) |
Oct
(22) |
Nov
(10) |
Dec
(21) |
2012 |
Jan
(33) |
Feb
(24) |
Mar
(36) |
Apr
(60) |
May
(60) |
Jun
(43) |
Jul
(114) |
Aug
(19) |
Sep
(35) |
Oct
(24) |
Nov
(64) |
Dec
(12) |
2013 |
Jan
(54) |
Feb
(58) |
Mar
(51) |
Apr
(46) |
May
(21) |
Jun
(29) |
Jul
(25) |
Aug
(25) |
Sep
(13) |
Oct
(7) |
Nov
(14) |
Dec
(27) |
2014 |
Jan
(10) |
Feb
(7) |
Mar
(16) |
Apr
(14) |
May
(19) |
Jun
(8) |
Jul
(15) |
Aug
(11) |
Sep
(5) |
Oct
(11) |
Nov
(11) |
Dec
(4) |
2015 |
Jan
(52) |
Feb
(27) |
Mar
(22) |
Apr
(17) |
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <mg...@us...> - 2006-09-14 15:40:36
|
Revision: 129 http://svn.sourceforge.net/obo/?rev=129&view=rev Author: mgibson Date: 2006-09-14 08:40:27 -0700 (Thu, 14 Sep 2006) Log Message: ----------- flbaseDataAdapter (pase?) has setAdapterValue to comform to DataAdapterI new method - its a no op as just pastes to clipboard - no value needed (like filename) Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java Modified: phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java 2006-09-14 15:36:29 UTC (rev 128) +++ phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java 2006-09-14 15:40:27 UTC (rev 129) @@ -17,11 +17,16 @@ Pheno-Syntax data adapter? Pheno Syntax need to be able to write to a file as well as also write to flybases proforma app - i think those are 2 different data adapters sharing Syntax objects - PhenoSyntaxFileAdapter - and FlybaseProformaAdapter or something like that - todo... */ + and FlybaseProformaAdapter or something like that - todo... + this is really a serialized clipboard adapter at this point - i think +flybase is going to be more tightly integrated */ public class FlybaseDataAdapter implements DataAdapterI { private static ClipboardOwner clipboardOwner = new PhenoteClipboardOwner(); + /** no adapter value (ie filename) to set for clipboard - no op */ + public void setAdapterValue(String filename) {} + public void commit(CharacterListI charList) { System.out.println("copying character list to clipboard"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-14 15:36:34
|
Revision: 128 http://svn.sourceforge.net/obo/?rev=128&view=rev Author: mgibson Date: 2006-09-14 08:36:29 -0700 (Thu, 14 Sep 2006) Log Message: ----------- phenote script for running phenote from command line in unix - sh script was trying to use ant for this but ant is really annoying with command line parameters Added Paths: ----------- phenote/trunk/phenote Added: phenote/trunk/phenote =================================================================== --- phenote/trunk/phenote (rev 0) +++ phenote/trunk/phenote 2006-09-14 15:36:29 UTC (rev 128) @@ -0,0 +1,3 @@ +#!/bin/sh + +java -Xmx200M -classpath classfiles:jars/oboedit.jar:jars/org.geneontology.jar:jars/BrowserLauncher2-10rc4.jar:jars/junit-4.0.jar:jars/tomcat-servlet.jar:jars/xbean.jar:jars/jsr173_1.0_api.jar:jars/phenoxmlbeans.jar:jars/phenoteconfigbeans.jar:jars/log4j-1.2.13.jar:jars/te-common.jar phenote.main.Phenote $@ Property changes on: phenote/trunk/phenote ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-14 15:33:55
|
Revision: 127 http://svn.sourceforge.net/obo/?rev=127&view=rev Author: mgibson Date: 2006-09-14 08:33:40 -0700 (Thu, 14 Sep 2006) Log Message: ----------- can now read files from command line with phenote -f psfile.psx will figure data adapter from suffix .psx & .syn -> pheno syntax .xml -> pheno xml .pxml? working on writeback from cmd line Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/doc/todo phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java phenote/trunk/src/java/phenote/main/Phenote.java Added Paths: ----------- phenote/trunk/jars/te-common.jar phenote/trunk/src/java/phenote/main/CommandLine.java Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/build.xml 2006-09-14 15:33:40 UTC (rev 127) @@ -144,6 +144,7 @@ <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <arg value="-c"/> + <!-- from command line with -DCONF-FILE=initial-zfin.cfg --> <arg value="${CONF_FILE}"/> <classpath> <pathelement path="${classfiles}"/> Modified: phenote/trunk/doc/todo =================================================================== --- phenote/trunk/doc/todo 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/doc/todo 2006-09-14 15:33:40 UTC (rev 127) @@ -1,3 +1,11 @@ +on load keeps blank character (from before load) around in table - shouldnt + +auto load from sourcforge or bioportal + +post compose gui +post compose syntax +post compose pheno xml + column sorting - do shift for descending, also if new added sort it in, and perhaps indicate sorted column in header with < & >? Added: phenote/trunk/jars/te-common.jar =================================================================== (Binary files differ) Property changes on: phenote/trunk/jars/te-common.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java 2006-09-14 15:33:40 UTC (rev 127) @@ -10,4 +10,11 @@ public void commit(CharacterListI charList); + /** Set value to use for loading or writeback, for a file adapter this would be + the file name - is there a better name for this method? + For now just doing String - which may be sufficient - may need an + AdapterValue/DataInput object if this gets more involved - but that may + not be necasary - certianly string ok for now */ + public void setAdapterValue(String adapterValue); + } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-09-14 15:33:40 UTC (rev 127) @@ -23,12 +23,19 @@ public class PhenoSyntaxFileAdapter implements DataAdapterI { private File previousFile; + private File file; + /** command line setting of file */ + public void setAdapterValue(String filename) { + file = new File(filename); + } + /** this should return CharacterList and caller should load CharListMan or CLM makes the call itself? */ public void load() { - File file = getFileFromUser(previousFile); + if (file == null) + file = getFileFromUser(previousFile); if (file == null) return; previousFile = file; @@ -51,6 +58,7 @@ catch (IOException e) { System.out.println("PhenoSyntax read failure "+e); } + file = null; // null it for next load/commit } /** returns null if user fails to pick a file */ @@ -60,7 +68,8 @@ public void commit(CharacterListI charList) { - File file = getFileFromUser(previousFile); + if (file == null) + file = getFileFromUser(previousFile); if (file == null) return; previousFile = file; @@ -85,6 +94,7 @@ } } pw.close(); + file = null; } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-09-14 15:33:40 UTC (rev 127) @@ -29,13 +29,20 @@ private Set genotypesAlreadyAdded = new HashSet<String>(); private File previousFile; + private File file; + /** command line setting of file */ + public void setAdapterValue(String filename) { + file = new File(filename); + } + public void load() {} public void commit(CharacterListI charList) { - File file = getFileFromUser(previousFile); if (file == null) + file = getFileFromUser(previousFile); + if (file == null) return; previousFile = file; Added: phenote/trunk/src/java/phenote/main/CommandLine.java =================================================================== --- phenote/trunk/src/java/phenote/main/CommandLine.java (rev 0) +++ phenote/trunk/src/java/phenote/main/CommandLine.java 2006-09-14 15:33:40 UTC (rev 127) @@ -0,0 +1,310 @@ +package phenote.main; + +import com.townleyenterprises.command.CommandOption; +import com.townleyenterprises.command.CommandParser; +import com.townleyenterprises.command.DefaultCommandListener; + +import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter; +import phenote.dataadapter.phenoxml.PhenoXmlAdapter; + +/** a lot of this is copied from apollo.main.CommandLine - theres potential for + some generic super class but where would it go? in a jar file with one class? + org.bdgp? */ +public class CommandLine { + + /** the class that parses all the options */ + private CommandParser parser; + /** stores adapter class, filenames, etc. for reading data */ + private IOOptions readOptions; + /** stores adapter class, filenames, etc. for writing data */ + private IOOptions writeOptions; + private CommandOption inputFile = new InputFileCommandOption(); + //private CommandOption inputFmtOption = new InputFormatCommandOption(); + private CommandOption writeFile = new WriteFileCommandOption(); + + CommandOption[] options = new CommandOption[] { inputFile, writeFile }; + + // this guarantees that we get the right classes (compile time check) + private final static String PHENOXML = PhenoXmlAdapter.class.getName(); + private final static String PHENOSYNTAX = PhenoSyntaxFileAdapter.class.getName(); + + // there can be only one instance of this class (per JVM) + private static CommandLine commandLineSingleton; + + public static CommandLine inst() { + if (commandLineSingleton == null) + commandLineSingleton = new CommandLine(); + return commandLineSingleton; + } + + /** + * Set command-line arguments passed along from main(). + * + * @param args argStrings from command line + */ + public void setArgs(String[] args) throws Exception { + if (args.length == 0) + return; + if (parser != null) { + System.out.println("CommandLine: WARNING multiple calls to setArgs(), ignoring"); + return; // ? + } + parser = new CommandParser("Phenote"); // help text? + parser.addCommandListener(new DefaultCommandListener("Options",options)); + parser.parse(args); + //addConstraints(parser); + // does execute() on CommandOptions, throws generic Exception + //try { // should i wrap the exception like apollo? + parser.executeCommands(); + //} catch (Exception e) { throw new ApolloAdapterException(e); } + } + + /** + * If input & output (or batch) is fully specified, then we are in command line + * mode; no need for GUI. + */ + public static boolean isInCommandLineMode() { + return inst().writeIsSpecified(); //|| inst().isBatchMode(); + } + + /** if read has been (correctly) specified, read adapter is non null */ + boolean readIsSpecified() { + return getReadOptions().getSpecifiedState(); + } + + boolean writeIsSpecified() { + return getWriteOptions().getSpecifiedState(); + } + + private IOOptions getReadOptions() { + if (readOptions == null) + readOptions = new IOOptions(true); + return readOptions; + } + + private IOOptions getWriteOptions() { + if (writeOptions == null) + writeOptions = new IOOptions(false); + return writeOptions; + } + + /** + * If input/read was specified on the command line this returns the + * correctly-initialized read data adapter for it. Note that + * adapter returned may be the same object as that returned by + * <code>getWriteAdapter()</code> + * @return null if no read adapter specified on command line. + */ + DataAdapterI getReadAdapter() throws Exception { + IOOptions ioo = getReadOptions(); + DataAdapterI adapter = ioo.getAdapter(); + adapter.setAdapterValue(ioo.getAdapterValue()); + return adapter; + } + + + /** INPUT FILE COMMAND OPTION */ + private class InputFileCommandOption extends CommandOption { + private final static String help = + "Specify filename to read in (phenoxml.xml,phenosyntax.syn)"; + private InputFileCommandOption() { + // true -> has argument + super("inputFile",'f',true,"filename",help); + } + public void execute() throws Exception { + //System.out.println("executing input file command option "+getArg()); + getReadOptions().setFilename(getArg()); + setAdapterForFile(getReadOptions(), false); + } + } + + /** + * OUTPUT FILE COMMAND OPTION Specifies name of target/output file. + */ + private class WriteFileCommandOption extends CommandOption { + private WriteFileCommandOption() { + super("writeFile",'w',true,"filename","Filename to write to"); + } + public void execute() throws Exception { + getWriteOptions().setFilename(getArg()); + setAdapterForFile(getWriteOptions(), false); // sets data adapter from file suffix + } + } + + + /** + * Read & write file method. Retrieves data adapter either from format option or + * suffix and sets its DataInput with filename + */ + private void setAdapterForFile(IOOptions options, boolean setAdapterInput) + throws Exception + { + DataAdapterI adapter = getAdapterForFile(options); + if (!options.hasAdapter()) + options.setAdapter(adapter); + // is it scandalous to use DataInput for output?? should be called DataInfo? + // of DataSpecifitation? + String inputFile = options.getFilename(); + //DataInputType inputType = DataInputType.FILE; + //if (inputFile.startsWith("http:") || inputFile.startsWith("file:")) { + //inputType = DataInputType.URL; } + //DataInput di = new DataInput(inputType, inputFile); + // gff input may have seq file. + //if (haveSequenceFilename()) di.setSequenceFilename(getSequenceFilename()); + //options.setDataInput(di); + adapter.setAdapterValue(inputFile); + options.setSpecifiedState(true); + //if (setAdapterInput) adapter.setDataInput(di); + } + + private DataAdapterI getAdapterForFile(IOOptions options) throws Exception { + //DataAdapterI adapter; + // first see if input format explicitly specified + if (options.hasAdapter()) + return options.getAdapter(); + + // if nothing specified try to get format from file suffix + try { return getDataAdapterFromSuffix(options.getFilename()); } + catch (AdapterEx e) { + throw new AdapterEx("No input format specified and "+e.getMessage()); + } + + //return adapter; + } + + private DataAdapterI getDataAdapterFromSuffix(String filename) throws AdapterEx { + String suffix = getFileSuffix(filename); + // anything with game in it?? + if (suffix.matches(".*syn.*|psx")) // ??? + return getDataAdapter(PHENOSYNTAX); + if (suffix.matches(".*xml.*")) + return getDataAdapter(PHENOXML); + // configuration can specify what to do with .xml suffix (game or chado) + //else if (suffix.equals("xml") && xmlSuffixIsConfigged()) + // return getConfiggedXmlDataAdapter(); + throw new AdapterEx("Suffix "+suffix+" doesnt map to known format"); + } + + private class AdapterEx extends Exception { + private AdapterEx(String m) { super(m); } + private AdapterEx(Exception e) { super(e.getMessage()); } // save e? + } + + /** should this include the '.'? probably not. changing it to not include . */ + private String getFileSuffix(String filename) { + int index = filename.lastIndexOf('.'); + return filename.substring(index+1); // 1 past . + } + + private DataAdapterI getDataAdapter(String classString) throws AdapterEx { + try { + // introspection? or switch on string? + Class c = Class.forName(classString); + Object o = c.newInstance(); + if (!(o instanceof DataAdapterI)) // shouldnt happen + System.out.println("Class string is not data adapter "+o); + return (DataAdapterI)o; + } catch (Exception e) { throw new AdapterEx(e); } + } + + // eventually - multiple xmls? +// private boolean xmlSuffixIsConfigged() { +// return Config.commandLineXmlFileFormatIsConfigged(); +// } + +// private ApolloDataAdapterI getConfiggedXmlDataAdapter() { +// String config = Config.getCommandLineXmlFileFormat(); +// if (config.equalsIgnoreCase("game")) +// return getDataAdapter(GAME); +// if (config.equalsIgnoreCase("chado")) +// return getDataAdapter(CHADOXML); +// return null; +// } + + void printHelp() { + parser.help(); + } + + private void error(String m) throws Exception { + System.out.println(m); + printHelp(); + throw new Exception(m); + } + + + // ----------------------------------------------------------------------- + // IOOptions inner class + // ----------------------------------------------------------------------- + + /** + * IOOptions holds state for either read or write + */ + private class IOOptions { + private DataAdapterI adapter; + private String filename; + private boolean specified = false; + private boolean isRead; + private String adapterValue; + + + // ---------------------------------------------- + // Constructor + // ---------------------------------------------- + + private IOOptions(boolean isRead) { + this.isRead = isRead; + } + + // ---------------------------------------------- + // CommandLine - simple getters/setters + // ---------------------------------------------- + + private String getAdapterValue() { return adapterValue; } + + private void setFilename(String filename) { + this.filename = filename; + adapterValue = filename; + } + private String getFilename() { return filename; } + + private void setSpecifiedState(boolean specified) { this.specified = specified; } + private boolean getSpecifiedState() { return specified; } + + // ---------------------------------------------- + // CommandLine + // ---------------------------------------------- + + private void setAdapter(DataAdapterI adapter) { + this.adapter = adapter; + } + private DataAdapterI getAdapter() throws Exception { + if (adapter == null) { + //System.out.println("dont have adapter"); + // if not set from file extension get from format option +// if (isRead) { +// adapter = inputFmtOption.getAdapter(); +// } else { +// adapter = outputFmtOption.getAdapter(); +// } + } + return adapter; + } + private boolean hasAdapter() throws Exception { return getAdapter() != null; } + + /** type of input - type only needed for input */ + //private void setInputType(String inputTypeString) { + // actually i think this is adapter dependent - for game want to do + // stringToType - for chado its a so type + //try {inputType = DataInputType.stringToType(inputTypeString); } + //catch (UnknownTypeException e) { + // System.out.println(e.getMessage()+" Can not set input type"); } + //} + //private DataInputType getInputType() { return inputType; } + //private boolean haveInputType() { return inputType != null; } + + //private void setDataInput(DataInput dataInput) { this.dataInput = dataInput; } + //private DataInput getDataInput() { return this.dataInput; } + + } +} Modified: phenote/trunk/src/java/phenote/main/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java 2006-09-13 14:31:06 UTC (rev 126) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2006-09-14 15:33:40 UTC (rev 127) @@ -35,6 +35,7 @@ private TermPanel termPanel; private static Phenote phenote; private TermInfo termInfo; + private CommandLine commandLine = CommandLine.inst(); public static void main(String[] args) { @@ -46,35 +47,50 @@ catch (UnsupportedLookAndFeelException e) { System.out.println("Failed to set to Java/Metal look & feel"); } - //System.out.println("sys CONFIG prop "+System.getProperty("CONFIG")); phenote = getPhenote(); - phenote.initConfig(args); + //phenote.initConfig(args); + phenote.doCommandLine(args); // does config // put this is in a phenote.util.Log class? - get file from config - default? try { DOMConfigurator.configure(Config.inst().getLogConfigUrl()); } catch (FileNotFoundException e) { LOG.error(e.getMessage()); } phenote.initOntologies(); + phenote.loadFromCommandLine(); // cant load data til ontologies loaded i think + phenote.initGui(); } /** private constructor -> singleton */ private Phenote() {} - /** args is most likely null if not called from command line */ - public void initConfig(String[] args) { - // gets config file from command line & loads - if no config file - // loads default. should actually put that logic here. - doCommandLine(args); // load config file - } +// /** args is most likely null if not called from command line */ +// public void initConfig(String[] args) { +// // gets config file from command line & loads - if no config file +// // loads default. should actually put that logic here. +// doCommandLine(args); // load config file +// } public void initOntologies() { OntologyDataAdapter oda = new OntologyDataAdapter(); // singleton? oda.loadOntologies(); // loads up OntologyManager } + + private void loadFromCommandLine() { + //LOG.debug("read spec "+commandLine.readIsSpecified()); + if (!commandLine.readIsSpecified()) return; + try { commandLine.getReadAdapter().load(); } + catch (Exception e) { LOG.error("Failed to do load via command line "+e); } + } public void initGui() { makeWindow(); } + private void doCommandLine(String[] args) { + doCommandLineOld(args); // -c -i --> move to CommandLine! + try { commandLine.setArgs(args); } // no log yet - sys.out + catch (Exception e) { System.out.println("Command line read failed"+e); } + } + /** for now just looking for '-c configFile.cfg', use command line package if we need to get more sophisticated so if user has personal config file should override this - however maybe @@ -85,7 +101,7 @@ and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg (if it exists) - we can always add --init later if we need it -c overwrites, -i doesnt -i is for initial startup of phenote */ - private void doCommandLine(String[] args) { + private void doCommandLineOld(String[] args) { String configFile = getConfigFileFromCommandLine(args); // if no config file specified then set default initial config file. this will be // overridden by a personal config file if it exists This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-13 14:31:11
|
Revision: 126 http://svn.sourceforge.net/obo/?rev=126&view=rev Author: mgibson Date: 2006-09-13 07:31:06 -0700 (Wed, 13 Sep 2006) Log Message: ----------- woops forgot to add the new FileUtil class that deals with finding files - config & obo Added Paths: ----------- phenote/trunk/src/java/phenote/util/FileUtil.java Added: phenote/trunk/src/java/phenote/util/FileUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/FileUtil.java (rev 0) +++ phenote/trunk/src/java/phenote/util/FileUtil.java 2006-09-13 14:31:06 UTC (rev 126) @@ -0,0 +1,58 @@ +package phenote.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +public class FileUtil { + + //private static final Logger LOG = Logger.getLogger(FileUtil.class); + + public static URL findUrl(String filename) throws FileNotFoundException { + List<URL> possibleUrls = getPossibleUrls(filename); + for (URL u : possibleUrls) + if (urlExists(u)) return u; + System.out.println("Failed to find file "+filename); + //LOG.error("Failed to find file "+filename); + throw new FileNotFoundException(filename+" not found"); + } + + private static List<URL> getPossibleUrls(String filename) { + List<URL> urls = new ArrayList(5); + addFile(filename,urls); // full path or relative to pwd + addFile("conf/"+filename,urls); + addFile("obo-files/"+filename,urls);//this is obo-files specific - separate method? +// URL jarUrl = FileUtil.class.getResource(filename); +// if (jarUrl != null) urls.add(jarUrl); +// jarUrl = FileUtil.class.getResource("/"+filename); +// if (jarUrl != null) urls.add(jarUrl); + return urls; + } + + private static void addFile(String filename,List<URL> urls) { + try { + URL u = new File(filename).toURL(); + if (u != null) urls.add(u); + URL jarUrl = FileUtil.class.getResource(filename); + if (jarUrl != null) urls.add(jarUrl); + jarUrl = FileUtil.class.getResource("/"+filename); + if (jarUrl != null) urls.add(jarUrl); + } catch (MalformedURLException e) { + System.out.println("bad file url "+e); + //LOG.error("bad file url "+e); + } + } + + private static boolean urlExists(URL u) { + try { u.openStream(); } + catch (IOException e) { return false; } + return true; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-13 14:05:52
|
Revision: 125 http://svn.sourceforge.net/obo/?rev=125&view=rev Author: mgibson Date: 2006-09-13 07:05:41 -0700 (Wed, 13 Sep 2006) Log Message: ----------- repackaged phenote.gui.Phenote to new package main -> phenote.main.Phenote which is now the new run class. in preparation for a new command line class (that didnt belong in gui package) and Phenote deserved its own package. Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/GridBagUtil.java phenote/trunk/src/java/phenote/gui/MenuManager.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/gui/TermPanel.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/java/test/phenote/gui/TestPhenote.java Added Paths: ----------- phenote/trunk/src/java/phenote/main/ phenote/trunk/src/java/phenote/main/Phenote.java Removed Paths: ------------- phenote/trunk/src/java/phenote/gui/Phenote.java Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/build.xml 2006-09-13 14:05:41 UTC (rev 125) @@ -73,7 +73,7 @@ <!-- runs off classfiles not jar, todo: run-jar --> <target name="run" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <classpath> <pathelement path="${classfiles}"/> @@ -86,7 +86,7 @@ </target> <target name="zfin" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <arg value="-c"/> <arg value="initial-zfin.cfg"/> @@ -101,7 +101,7 @@ </target> <target name="fly" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <arg value="-c"/> <arg value="initial-flybase.cfg"/> @@ -116,7 +116,7 @@ </target> <target name="obd" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <arg value="-c"/> <arg value="obd.cfg"/> @@ -130,7 +130,7 @@ </java> </target> <target name="run-jar" > - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <classpath> <fileset dir="${lib}"> @@ -141,7 +141,7 @@ </target> <target name="run-conf" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <java classname="phenote.main.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <arg value="-c"/> <arg value="${CONF_FILE}"/> Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-09-13 14:05:41 UTC (rev 125) @@ -34,7 +34,7 @@ /** Character panel has character table and del add copy buttons to manipulate * table. Modifications to fields modify columns in selected row in table * for now no explicit commit - may be configurable later */ -class CharacterTablePanel extends JPanel { +public class CharacterTablePanel extends JPanel { private JTable characterTable; private CharacterTableModel characterTableModel; @@ -51,7 +51,7 @@ private static final String SAVE_STRING = "Save data"; private boolean SANDBOX_MODE = true; // get from config... - CharacterTablePanel(TermPanel tp) { + public CharacterTablePanel(TermPanel tp) { termPanel = tp; init(); } Modified: phenote/trunk/src/java/phenote/gui/GridBagUtil.java =================================================================== --- phenote/trunk/src/java/phenote/gui/GridBagUtil.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/GridBagUtil.java 2006-09-13 14:05:41 UTC (rev 125) @@ -5,9 +5,9 @@ /** Convenience methods for making GridBagConstraints for GridBagLayout */ -class GridBagUtil { +public class GridBagUtil { - static GridBagConstraints makeConstraint(int x, int y, int horizPad, int vertPad) { + public static GridBagConstraints makeConstraint(int x,int y,int horizPad,int vertPad) { return makeConstraint(x,y,horizPad,vertPad,GridBagConstraints.WEST); } static GridBagConstraints makeConstraint(int x, int y, int horizPad, int vertPad, Modified: phenote/trunk/src/java/phenote/gui/MenuManager.java =================================================================== --- phenote/trunk/src/java/phenote/gui/MenuManager.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/MenuManager.java 2006-09-13 14:05:41 UTC (rev 125) @@ -4,7 +4,7 @@ import javax.swing.JFrame; import javax.swing.JMenuBar; -class MenuManager { +public class MenuManager { private FileMenu fileMenu; @@ -14,7 +14,7 @@ public static MenuManager inst() { return singleton; } - static void createMenuManager(JFrame frame) { + public static void createMenuManager(JFrame frame) { singleton.initMenus(frame); } Deleted: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-09-13 14:05:41 UTC (rev 125) @@ -1,169 +0,0 @@ -package phenote.gui; - -// package phenote.main? - -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.BoxLayout; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.plaf.metal.MetalLookAndFeel; -import java.io.FileNotFoundException; - -import org.apache.log4j.Logger; -import org.apache.log4j.xml.DOMConfigurator; - -import phenote.config.Config; -import phenote.config.ConfigException; -import phenote.dataadapter.OntologyDataAdapter; - -public class Phenote { - - private static final String VERSION = "0.8 dev"; - //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; - private static final Logger LOG = Logger.getLogger(Phenote.class); - - private CharacterTablePanel characterTablePanel; - private TermPanel termPanel; - private static Phenote phenote; - private TermInfo termInfo; - - - public static void main(String[] args) { - System.out.println("This is Phenote version "+VERSION); - // default mac lok & feel is "Mac OS X", but the JComboBox is buggy - try { - UIManager.setLookAndFeel(new MetalLookAndFeel()); - } - catch (UnsupportedLookAndFeelException e) { - System.out.println("Failed to set to Java/Metal look & feel"); - } - //System.out.println("sys CONFIG prop "+System.getProperty("CONFIG")); - phenote = getPhenote(); - phenote.initConfig(args); - // put this is in a phenote.util.Log class? - get file from config - default? - try { DOMConfigurator.configure(Config.inst().getLogConfigUrl()); } - catch (FileNotFoundException e) { LOG.error(e.getMessage()); } - phenote.initOntologies(); - phenote.initGui(); - } - - /** private constructor -> singleton */ - private Phenote() {} - - /** args is most likely null if not called from command line */ - public void initConfig(String[] args) { - // gets config file from command line & loads - if no config file - // loads default. should actually put that logic here. - doCommandLine(args); // load config file - } - - public void initOntologies() { - OntologyDataAdapter oda = new OntologyDataAdapter(); // singleton? - oda.loadOntologies(); // loads up OntologyManager - } - - public void initGui() { - makeWindow(); - } - - /** for now just looking for '-c configFile.cfg', use command line package - if we need to get more sophisticated - so if user has personal config file should override this - however maybe - there should be a distinction between initial config file and user made configs - well really the initials are db/species specific - so could be - --initialConfig zf|fb|obd - actually da heck with that with entity chooser just - put all 3 ontologies in one which is then the default (unspecified on cmd line) - and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg - (if it exists) - we can always add --init later if we need it - -c overwrites, -i doesnt -i is for initial startup of phenote */ - private void doCommandLine(String[] args) { - String configFile = getConfigFileFromCommandLine(args); - // if no config file specified then set default initial config file. this will be - // overridden by a personal config file if it exists - if (configFile == null) - configFile = Config.DEFAULT_CONFIG_FILE; - try { - if (isOverwriteConfigFile(args)) - Config.inst().setOverwriteConfigFile(configFile); // causes parse of file->.phenote - else - Config.inst().setInitialConfigFile(configFile); - } catch (ConfigException e) { - LOG.fatal("EXITING! Fatal error in config file: "+e.getMessage()); - e.printStackTrace(); // log? - System.exit(1); - } - } - - private boolean isInitialConfigFile(String args[]) { - if (args == null || args.length < 2) return false; - return args[0].equals("-i"); - } - private boolean isOverwriteConfigFile(String args[]) { - if (args == null || args.length < 2) return false; - return args[0].equals("-c"); - } - - private String getConfigFileFromCommandLine(String args[]) { - // need 2 args - if (args == null || args.length < 2) return null; - //String firstArg = args[0]; - if (!isInitialConfigFile(args) && !isOverwriteConfigFile(args)) return null; - String configFile = args[1]; - return configFile; - } - - private void makeWindow() { - JFrame frame = new JFrame("Phenote "+VERSION); // this may be changed to applet... - frame.getContentPane().add(makeMainPanel()); - MenuManager.createMenuManager(frame); - frame.setPreferredSize(new Dimension(1000,550)); - frame.pack(); - frame.setVisible(true); - } - - /** main panel contains TermPanel CharTablePanel & TermInfo */ - private JPanel makeMainPanel() { - JPanel mainPanel = new JPanel(new GridBagLayout()); // ?? - - JPanel termAndTablePanel = new JPanel(); - BoxLayout bl = new BoxLayout(termAndTablePanel,BoxLayout.Y_AXIS); - termAndTablePanel.setLayout(bl); - - //termAndInstancePanel.add(makeTermPanel()); - termPanel = new TermPanel(); - termAndTablePanel.add(termPanel); - - characterTablePanel = new CharacterTablePanel(termPanel); - // eventually switch to event listener - no explicit connection... - //termPanel.setCharacterTablePanel(characterTablePanel); - termAndTablePanel.add(characterTablePanel); - - GridBagConstraints gbc = GridBagUtil.makeConstraint(0,0,5,5); - mainPanel.add(termAndTablePanel,gbc); - - termInfo = new TermInfo(termPanel); - ++gbc.gridx; // ?? - gbc.anchor = GridBagConstraints.NORTHWEST; - mainPanel.add(termInfo.getComponent(),gbc); - - return mainPanel; - } - - public static Phenote getPhenote() { // singleton - if (phenote == null) phenote = new Phenote(); - return phenote; - } - // These methods are actually for TestPhenote - TermPanel getTermPanel() { return termPanel; } - TermInfo getTermInfo() { return termInfo; } - CharacterTablePanel getCharacterTablePanel() { return characterTablePanel; } -} - - -// SearchPanel searchPanel = new SearchPanel(termPanel); -// mainPanel.add(searchPanel); -// termPanel.setSearchPanel(searchPanel); Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-09-13 14:05:41 UTC (rev 125) @@ -38,7 +38,7 @@ import phenote.gui.selection.TermSelectionEvent; import phenote.gui.selection.TermSelectionListener; -class TermInfo { +public class TermInfo { //private JEditorPane textArea; private JTextComponent textArea; @@ -49,11 +49,11 @@ private OBOClass previousOboClass=null; // for undo - not implemented yet - TermInfo(TermPanel termPanel) { + public TermInfo(TermPanel termPanel) { SelectionManager.inst().addTermSelectionListener(new InfoTermSelectionListener()); } - JComponent getComponent() { + public JComponent getComponent() { JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap termInfoPanel.setPreferredSize(new Dimension(600,700)); termInfoPanel.setMinimumSize(new Dimension(350,500)); Modified: phenote/trunk/src/java/phenote/gui/TermPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-09-13 14:05:41 UTC (rev 125) @@ -31,13 +31,13 @@ also has SearchParamPanel. */ -class TermPanel extends JPanel { +public class TermPanel extends JPanel { private List<CharFieldGui> charFieldGuiList = new ArrayList<CharFieldGui>(8); private SearchParamPanel searchParamPanel; // searchParamManager? private OntologyManager ontologyManager = OntologyManager.inst(); - TermPanel() { + public TermPanel() { init(); } Copied: phenote/trunk/src/java/phenote/main/Phenote.java (from rev 124, phenote/trunk/src/java/phenote/gui/Phenote.java) =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java (rev 0) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2006-09-13 14:05:41 UTC (rev 125) @@ -0,0 +1,174 @@ +package phenote.main; + +// package phenote.main? + +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import javax.swing.BoxLayout; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.plaf.metal.MetalLookAndFeel; +import java.io.FileNotFoundException; + +import org.apache.log4j.Logger; +import org.apache.log4j.xml.DOMConfigurator; + +import phenote.config.Config; +import phenote.config.ConfigException; +import phenote.dataadapter.OntologyDataAdapter; +import phenote.gui.CharacterTablePanel; +import phenote.gui.GridBagUtil; +import phenote.gui.MenuManager; +import phenote.gui.TermInfo; +import phenote.gui.TermPanel; + +public class Phenote { + + private static final String VERSION = "0.8 dev"; + //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; + private static final Logger LOG = Logger.getLogger(Phenote.class); + + private CharacterTablePanel characterTablePanel; + private TermPanel termPanel; + private static Phenote phenote; + private TermInfo termInfo; + + + public static void main(String[] args) { + System.out.println("This is Phenote version "+VERSION); + // default mac lok & feel is "Mac OS X", but the JComboBox is buggy + try { + UIManager.setLookAndFeel(new MetalLookAndFeel()); + } + catch (UnsupportedLookAndFeelException e) { + System.out.println("Failed to set to Java/Metal look & feel"); + } + //System.out.println("sys CONFIG prop "+System.getProperty("CONFIG")); + phenote = getPhenote(); + phenote.initConfig(args); + // put this is in a phenote.util.Log class? - get file from config - default? + try { DOMConfigurator.configure(Config.inst().getLogConfigUrl()); } + catch (FileNotFoundException e) { LOG.error(e.getMessage()); } + phenote.initOntologies(); + phenote.initGui(); + } + + /** private constructor -> singleton */ + private Phenote() {} + + /** args is most likely null if not called from command line */ + public void initConfig(String[] args) { + // gets config file from command line & loads - if no config file + // loads default. should actually put that logic here. + doCommandLine(args); // load config file + } + + public void initOntologies() { + OntologyDataAdapter oda = new OntologyDataAdapter(); // singleton? + oda.loadOntologies(); // loads up OntologyManager + } + + public void initGui() { + makeWindow(); + } + + /** for now just looking for '-c configFile.cfg', use command line package + if we need to get more sophisticated + so if user has personal config file should override this - however maybe + there should be a distinction between initial config file and user made configs + well really the initials are db/species specific - so could be + --initialConfig zf|fb|obd - actually da heck with that with entity chooser just + put all 3 ontologies in one which is then the default (unspecified on cmd line) + and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg + (if it exists) - we can always add --init later if we need it + -c overwrites, -i doesnt -i is for initial startup of phenote */ + private void doCommandLine(String[] args) { + String configFile = getConfigFileFromCommandLine(args); + // if no config file specified then set default initial config file. this will be + // overridden by a personal config file if it exists + if (configFile == null) + configFile = Config.DEFAULT_CONFIG_FILE; + try { + if (isOverwriteConfigFile(args)) + Config.inst().setOverwriteConfigFile(configFile); // causes parse of file->.phenote + else + Config.inst().setInitialConfigFile(configFile); + } catch (ConfigException e) { + LOG.fatal("EXITING! Fatal error in config file: "+e.getMessage()); + e.printStackTrace(); // log? + System.exit(1); + } + } + + private boolean isInitialConfigFile(String args[]) { + if (args == null || args.length < 2) return false; + return args[0].equals("-i"); + } + private boolean isOverwriteConfigFile(String args[]) { + if (args == null || args.length < 2) return false; + return args[0].equals("-c"); + } + + private String getConfigFileFromCommandLine(String args[]) { + // need 2 args + if (args == null || args.length < 2) return null; + //String firstArg = args[0]; + if (!isInitialConfigFile(args) && !isOverwriteConfigFile(args)) return null; + String configFile = args[1]; + return configFile; + } + + private void makeWindow() { + JFrame frame = new JFrame("Phenote "+VERSION); // this may be changed to applet... + frame.getContentPane().add(makeMainPanel()); + MenuManager.createMenuManager(frame); + frame.setPreferredSize(new Dimension(1000,550)); + frame.pack(); + frame.setVisible(true); + } + + /** main panel contains TermPanel CharTablePanel & TermInfo */ + private JPanel makeMainPanel() { + JPanel mainPanel = new JPanel(new GridBagLayout()); // ?? + + JPanel termAndTablePanel = new JPanel(); + BoxLayout bl = new BoxLayout(termAndTablePanel,BoxLayout.Y_AXIS); + termAndTablePanel.setLayout(bl); + + //termAndInstancePanel.add(makeTermPanel()); + termPanel = new TermPanel(); + termAndTablePanel.add(termPanel); + + characterTablePanel = new CharacterTablePanel(termPanel); + // eventually switch to event listener - no explicit connection... + //termPanel.setCharacterTablePanel(characterTablePanel); + termAndTablePanel.add(characterTablePanel); + + GridBagConstraints gbc = GridBagUtil.makeConstraint(0,0,5,5); + mainPanel.add(termAndTablePanel,gbc); + + termInfo = new TermInfo(termPanel); + ++gbc.gridx; // ?? + gbc.anchor = GridBagConstraints.NORTHWEST; + mainPanel.add(termInfo.getComponent(),gbc); + + return mainPanel; + } + + public static Phenote getPhenote() { // singleton + if (phenote == null) phenote = new Phenote(); + return phenote; + } + // These methods are actually for TestPhenote + public TermPanel getTermPanel() { return termPanel; } + public TermInfo getTermInfo() { return termInfo; } + public CharacterTablePanel getCharacterTablePanel() { return characterTablePanel; } +} + + +// SearchPanel searchPanel = new SearchPanel(termPanel); +// mainPanel.add(searchPanel); +// termPanel.setSearchPanel(searchPanel); Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-13 14:05:41 UTC (rev 125) @@ -20,7 +20,7 @@ import phenote.util.HtmlUtil; import phenote.config.Config; import phenote.config.ConfigException; -import phenote.gui.Phenote; // move to main package +import phenote.main.Phenote; public class PhenoteServlet extends HttpServlet { Modified: phenote/trunk/src/java/test/phenote/gui/TestPhenote.java =================================================================== --- phenote/trunk/src/java/test/phenote/gui/TestPhenote.java 2006-09-12 23:01:03 UTC (rev 124) +++ phenote/trunk/src/java/test/phenote/gui/TestPhenote.java 2006-09-13 14:05:41 UTC (rev 125) @@ -1,5 +1,7 @@ package phenote.gui; +// move to main package?? + import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; @@ -25,6 +27,7 @@ import phenote.dataadapter.fly.FlyCharListTransferable; import phenote.dataadapter.fly.FlybaseDataAdapter; import phenote.util.HtmlUtil; +import phenote.main.Phenote; // making same package as phenotes giving us access to package methods! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-12 23:01:20
|
Revision: 124 http://svn.sourceforge.net/obo/?rev=124&view=rev Author: mgibson Date: 2006-09-12 16:01:03 -0700 (Tue, 12 Sep 2006) Log Message: ----------- got log4j working for standalone - standalone logs to stdout in addition to file - and starting to switch print statements over to log statements - as in OntologyDataAdapter. you can config the log configuration with <log config-file="conf/log4j-standalone.xml" /> defaults to conf/log4j.xml (no stdout - for servlet) Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/log4j.xml phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd phenote/trunk/jars/phenoteconfigbeans.jar phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Added Paths: ----------- phenote/trunk/conf/log4j-standalone.xml Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/conf/initial-flybase.cfg 2006-09-12 23:01:03 UTC (rev 124) @@ -3,6 +3,8 @@ <dataadapter name="phenosyntax"/> + <log config-file="conf/log4j-standalone.xml" /> + <field name="Pub" /> <field name="Genotype" type="free_text"/> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/conf/initial-zfin.cfg 2006-09-12 23:01:03 UTC (rev 124) @@ -4,6 +4,8 @@ <check-for-new-ontologies intervalMinutes="5"/> + <log config-file="conf/log4j.xml"/> + <field name="Pub" /> <field name="Genotype" type="free_text"/> Added: phenote/trunk/conf/log4j-standalone.xml =================================================================== --- phenote/trunk/conf/log4j-standalone.xml (rev 0) +++ phenote/trunk/conf/log4j-standalone.xml 2006-09-12 23:01:03 UTC (rev 124) @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="debug"/> + <appender-ref ref="MAIN" /> + <appender-ref ref="console"/> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> + Modified: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/conf/log4j.xml 2006-09-12 23:01:03 UTC (rev 124) @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> @@ -19,7 +20,7 @@ </appender> <category name="phenote" additivity="true"> - <priority value="error"/> + <priority value="info"/> <appender-ref ref="MAIN" /> </category> Modified: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/conf/phenote-config.rnc 2006-09-12 23:01:03 UTC (rev 124) @@ -5,6 +5,7 @@ element phenote-configuration { attribute version { xsd:float }, check-for-new-ontologies, + log, dataadapter*, field* } @@ -15,12 +16,18 @@ attribute name {"phenoxml" | "phenosyntax"} } -## Whether to +## Whether to check if ontology(obo) has been updated/more current obo file check-for-new-ontologies = element check-for-new-ontologies { attribute intervalMinutes { xsd:integer } } +## Where the config file for log4j is +log = + element log { + attribute config-file { text } + } + field = element field { attribute name { "Pub" | "Genotype" | "Genetic Context" | "Entity" | "Quality" }, Modified: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/conf/phenote-config.xsd 2006-09-12 23:01:03 UTC (rev 124) @@ -4,6 +4,7 @@ <xs:complexType> <xs:sequence> <xs:element ref="x:check-for-new-ontologies"/> + <xs:element ref="x:log"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:dataadapter"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:field"/> </xs:sequence> @@ -30,6 +31,11 @@ <xs:attribute name="intervalMinutes" use="required" type="xs:integer"/> </xs:complexType> </xs:element> + <xs:element name="log"> + <xs:complexType> + <xs:attribute name="config-file" use="required"/> + </xs:complexType> + </xs:element> <xs:element name="field"> <xs:complexType> <xs:sequence> Modified: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-09-12 23:01:03 UTC (rev 124) @@ -28,7 +28,9 @@ import phenote.config.xml.DataadapterDocument.Dataadapter; import phenote.config.xml.FieldDocument.Field; import phenote.config.xml.OntologyDocument.Ontology; +import phenote.config.xml.LogDocument.Log; +import phenote.util.FileUtil; import phenote.datamodel.CharFieldEnum; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.fly.FlybaseDataAdapter; @@ -52,6 +54,7 @@ private List<FieldConfig> fieldList = new ArrayList<FieldConfig>(); private boolean checkForNewOntologies = false; private int newOntologyCheckMinutes = 10; + private String logConfigFile = "conf/log4j.xml"; // default log config file /** singleton */ private Config() { @@ -160,6 +163,10 @@ /** How many minutes between checks for new ontologies */ public int getOntologyCheckMinutes() { return newOntologyCheckMinutes; } + public URL getLogConfigUrl() throws FileNotFoundException { + return FileUtil.findUrl(logConfigFile); + } + private FieldConfig getLumpConfig() { // name = Taxonmony, file = BTO.obo... return lumpConfig; @@ -203,13 +210,6 @@ return fieldList; } - /** Default entity list is the anatomy ontology -- DELETE*/ - private List<OntologyConfig> defaultEntityConfigList() { - OntologyConfig oc = new OntologyConfig("Anatomy","anatomy.obo"); - List<OntologyConfig> l = new ArrayList<OntologyConfig>(1); - l.add(oc); - return l; - } /** parse xml file with xml beans (phenoteconfigbeans.xml). Put in own class? */ private void parseXmlFile(String filename) throws ConfigException { @@ -230,6 +230,11 @@ newOntologyCheckMinutes = bi.intValue(); } + // LOG CONFIG FILE + Log log = pc.getLog(); + if (log != null && log.getConfigFile() != null) { + logConfigFile = log.getConfigFile().getStringValue(); + } // DATA ADAPTERS Dataadapter[] adapters = pc.getDataadapterArray(); @@ -256,37 +261,9 @@ } private URL getConfigUrl(String filename) throws FileNotFoundException { - List<URL> possibleUrls = getPossibleUrls(filename); - for (URL u : possibleUrls) - if (urlExists(u)) return u; - System.out.println("Failed to find file "+filename); - throw new FileNotFoundException(filename+" not found"); + return FileUtil.findUrl(filename); } - private List<URL> getPossibleUrls(String filename) { - List<URL> urls = new ArrayList(5); - try { - URL u = new File(filename).toURL(); - if (u != null) urls.add(u); - u = new File("conf/"+filename).toURL(); - if (u != null) urls.add(u); - } catch (MalformedURLException e) { - System.out.println("bad file url "+e); - } - URL jarUrl = Config.class.getResource(filename); - if (jarUrl != null) urls.add(jarUrl); - jarUrl = Config.class.getResource("/"+filename); - if (jarUrl != null) urls.add(jarUrl); - return urls; - } - - private boolean urlExists(URL u) { - try { u.openStream(); } - catch (IOException e) { return false; } - //System.out.println("url suceeded "+u); - return true; - } - // do some other way? DataAdapterManager has mapping? DataAdapter has mapping? // DataAdapterManager.getAdapter(name)??? private void addDataAdapterFromString(String daString) { @@ -345,6 +322,44 @@ } // OLD OLD OLD - DELETE - DOM STUFF - replaced with xml beans +// /** Default entity list is the anatomy ontology -- DELETE*/ +// private List<OntologyConfig> defaultEntityConfigList() { +// OntologyConfig oc = new OntologyConfig("Anatomy","anatomy.obo"); +// List<OntologyConfig> l = new ArrayList<OntologyConfig>(1); +// l.add(oc); +// return l; +// } +// List<URL> possibleUrls = getPossibleUrls(filename); +// for (URL u : possibleUrls) +// if (urlExists(u)) return u; +// System.out.println("Failed to find file "+filename); +// throw new FileNotFoundException(filename+" not found"); +// } + +// private List<URL> getPossibleUrls(String filename) { +// List<URL> urls = new ArrayList(5); +// try { +// URL u = new File(filename).toURL(); +// if (u != null) urls.add(u); +// u = new File("conf/"+filename).toURL(); +// if (u != null) urls.add(u); +// } catch (MalformedURLException e) { +// System.out.println("bad file url "+e); +// } +// URL jarUrl = Config.class.getResource(filename); +// if (jarUrl != null) urls.add(jarUrl); +// jarUrl = Config.class.getResource("/"+filename); +// if (jarUrl != null) urls.add(jarUrl); +// return urls; +// } + +// private boolean urlExists(URL u) { +// try { u.openStream(); } +// catch (IOException e) { return false; } +// //System.out.println("url suceeded "+u); +// return true; +// } + // public OntologyConfig getPatoOntologyConfig() { // return getPatoConfig().getOntologyConfig(); // } Modified: phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-09-12 23:01:03 UTC (rev 124) @@ -10,6 +10,7 @@ import java.util.Iterator; import java.util.List; +import org.apache.log4j.Logger; import org.geneontology.oboedit.datamodel.OBOSession; import org.geneontology.oboedit.datamodel.impl.OBOSessionImpl; import org.geneontology.dataadapter.DataAdapterException; @@ -17,6 +18,7 @@ import org.geneontology.dataadapter.IOOperation; import org.geneontology.oboedit.dataadapter.OBOFileAdapter; +import phenote.util.FileUtil; import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; import phenote.datamodel.Ontology; @@ -34,6 +36,7 @@ private Config config; private OntologyManager ontologyManager = OntologyManager.inst(); private boolean loadingOntologies = false; + private static final Logger LOG = Logger.getLogger(OntologyDataAdapter.class); public OntologyDataAdapter() { config = Config.inst(); @@ -54,7 +57,8 @@ Ontology o = loadOntology(oc); cf.addOntology(o); } catch (FileNotFoundException e) { - System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + //System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + LOG.error(e.getMessage()+" ignoring ontology, fix config! "); } } } @@ -70,19 +74,10 @@ /** Load up/cache Sets for all ontologies used, anatomyOntologyTermSet * and patoOntologyTermSet -- move to dataadapter/OntologyDataAdapter... */ private Ontology loadOntology(OntologyConfig ontCfg) throws FileNotFoundException { -// URL url = findFile(ontCfg.ontologyFile); // throws FileNotFoundEx -// File file = new File(url.getFile()); -// long date = file.lastModified(); -// System.out.println("url path "+url.getPath()+" file "+file+" mod "+date+" "+new Date(date)); -// OBOSession oboSession = getOboSession(url); Ontology ontology = new Ontology(ontCfg.name); if (ontCfg.hasFilter()) // set filter before loading obo session ontology.setFilter(ontCfg.getFilter()); loadOboSession(ontology,ontCfg.ontologyFile); // throws FileNotFoundEx -// if (date > 0) { // jar files have 0 date??? -// ontology.setTimestamp(date); -// ontology.setSource(file.toString()); -// } return ontology; } @@ -103,44 +98,47 @@ /** Look for file in current directory (.) and jar file */ private URL findFile(String fileName) throws FileNotFoundException { + return FileUtil.findUrl(fileName); + } - // first try file as is (full path provided) - File file = new File(fileName); - if (file.exists()) - return makeUrl(fileName); +// // first try file as is (full path provided) +// File file = new File(fileName); +// if (file.exists()) +// return makeUrl(fileName); - String oboFileDir = "obo-files/"; - // try current directory + obo-file dir - String currentDir = "./" + oboFileDir + fileName; - file = new File(currentDir); - if (file.exists()) - return makeUrl(currentDir); +// String oboFileDir = "obo-files/"; +// // try current directory + obo-file dir +// String currentDir = "./" + oboFileDir + fileName; +// file = new File(currentDir); +// if (file.exists()) +// return makeUrl(currentDir); - // try jar - hopefully this works... jar files have to have '/' prepended - // first try without obo-files dir (in jar) - String jarFile = "/" + fileName; - URL url = Ontology.class.getResource(jarFile); // looks in jar - // 2nd try with obo-files dir in jar file (i used to do it this way) - if (url == null) { - jarFile = "/" + oboFileDir + fileName; - url = Ontology.class.getResource(jarFile); // looks in jar - } +// // try jar - hopefully this works... jar files have to have '/' prepended +// // first try without obo-files dir (in jar) +// String jarFile = "/" + fileName; +// URL url = Ontology.class.getResource(jarFile); // looks in jar +// // 2nd try with obo-files dir in jar file (i used to do it this way) +// if (url == null) { +// jarFile = "/" + oboFileDir + fileName; +// url = Ontology.class.getResource(jarFile); // looks in jar +// } - if (url == null) { - throw new FileNotFoundException("No file found for "+fileName); - } - return url; - } +// if (url == null) { +// throw new FileNotFoundException("No file found for "+fileName); +// } +// return url; +// } - private URL makeUrl(String file) { - try { - return new URL("file:"+file); - } - catch (MalformedURLException e) { - System.out.println("malformed url "+file+" "+e); - return null; - } - } +// private URL makeUrl(String file) { +// try { +// return new URL("file:"+file); +// } +// catch (MalformedURLException e) { +// //System.out.println("malformed url "+file+" "+e); +// LOG.error("malformed url "+file+" "+e); +// return null; +// } +// } // String -> url to handle web start jar obo files @@ -158,7 +156,8 @@ return os; } catch (DataAdapterException e) { - System.out.println("got data adapter exception: "+e); + //System.out.println("got data adapter exception: "+e); + LOG.error("got data adapter exception: "+e); return null; // empty session? } } @@ -168,24 +167,29 @@ public void run() { int checkMilliSecs = config.getOntologyCheckMinutes() * 60000; + //int checkMilliSecs = 6000;//0.6 * 60000; // debug - 10 secs while(true) { // sleep in milliseconds try { sleep(checkMilliSecs); } - catch (InterruptedException e) { System.out.println("interrupted"); } + catch (InterruptedException e) { LOG.error("thread interrupted??"); } // if still loading ontologies from previous run then dont bother if (loadingOntologies) { - System.out.println("Ontologies are being loaded - ontology checker going "+ - "back to sleep"); + //System.out.println("Ontologies are being loaded - ontology checker going "+ + // "back to sleep"); + LOG.info("Ontologies are being loaded - ontology checker going "+ + "back to sleep"); continue; } - System.out.println("checking for new obo files..."); + LOG.info("checking for new obo files..."); + //System.out.println("checking for new obo files..."); // check for files... synchOntologies(); } } + /** Checks for new obo files */ private void synchOntologies() { for (CharField cf : ontologyManager.getCharFieldList()) { for (Ontology o : cf.getOntologyList()) { @@ -195,11 +199,14 @@ long newTimestamp = new File(file).lastModified(); if (newTimestamp > oldTimestamp) { Date d = new Date(newTimestamp); - System.out.println("loading new obo file "+file+" new date "+d); + //System.out.println("loading new obo file "+file+" new date "+d); + LOG.info("LOG loading new obo file "+file+" new date "+d); try { loadOboSession(o,file); } catch (FileNotFoundException e) { // shouldnt happen - System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + //System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + LOG.error(e.getMessage()+" ignoring ontology, fix config! "); + // LOG.debug(stacktrace)??? no string for stack trace... hmm... } } } @@ -209,6 +216,19 @@ } + + + +// GARBAGE +// if (date > 0) { // jar files have 0 date??? +// ontology.setTimestamp(date); +// ontology.setSource(file.toString()); +// } +// URL url = findFile(ontCfg.ontologyFile); // throws FileNotFoundEx +// File file = new File(url.getFile()); +// long date = file.lastModified(); +// System.out.println("url path "+url.getPath()+" file "+file+" mod "+date+" "+new Date(date)); +// OBOSession oboSession = getOboSession(url); // Ontology pato = loadOntology(config.getPatoOntologyConfig()); // ontologyManager.setPatoOntology(pato); Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-09-12 23:01:03 UTC (rev 124) @@ -11,7 +11,11 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; +import java.io.FileNotFoundException; +import org.apache.log4j.Logger; +import org.apache.log4j.xml.DOMConfigurator; + import phenote.config.Config; import phenote.config.ConfigException; import phenote.dataadapter.OntologyDataAdapter; @@ -20,6 +24,7 @@ private static final String VERSION = "0.8 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; + private static final Logger LOG = Logger.getLogger(Phenote.class); private CharacterTablePanel characterTablePanel; private TermPanel termPanel; @@ -39,6 +44,9 @@ //System.out.println("sys CONFIG prop "+System.getProperty("CONFIG")); phenote = getPhenote(); phenote.initConfig(args); + // put this is in a phenote.util.Log class? - get file from config - default? + try { DOMConfigurator.configure(Config.inst().getLogConfigUrl()); } + catch (FileNotFoundException e) { LOG.error(e.getMessage()); } phenote.initOntologies(); phenote.initGui(); } @@ -84,8 +92,8 @@ else Config.inst().setInitialConfigFile(configFile); } catch (ConfigException e) { - System.out.println("EXITING! Fatal error in config file: "+e.getMessage()); - e.printStackTrace(); + LOG.fatal("EXITING! Fatal error in config file: "+e.getMessage()); + e.printStackTrace(); // log? System.exit(1); } } Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-11 15:29:06 UTC (rev 123) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-12 23:01:03 UTC (rev 124) @@ -25,7 +25,8 @@ public class PhenoteServlet extends HttpServlet { private static final String CONFIG_FILE_PARAM = "configuration-file"; - private static final Logger LOG = Logger.getLogger(PhenoteServlet.class); + // PhenoteServlet.class is the distinct name for this logger + private static final Logger LOG = Logger.getLogger(PhenoteServlet.class); //private String configurationFileName; not sure needs to be var private Date initDate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-11 15:29:10
|
Revision: 123 http://svn.sourceforge.net/obo/?rev=123&view=rev Author: mgibson Date: 2006-09-11 08:29:06 -0700 (Mon, 11 Sep 2006) Log Message: ----------- took out ctrl-Ms Modified Paths: -------------- phenote/trunk/conf/log4j.xml Modified: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml 2006-09-08 22:48:37 UTC (rev 122) +++ phenote/trunk/conf/log4j.xml 2006-09-11 15:29:06 UTC (rev 123) @@ -1,31 +1,31 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> - - <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="phenote_log4j.log" /> - <param name="Append" value="true" /> - <param name="MaxFileSize" value="1MB" /> - <param name="MaxBackupIndex" value="10" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <category name="phenote" additivity="true"> - <priority value="error"/> - <appender-ref ref="MAIN" /> - </category> - - <root> - <priority value="info" /> - <appender-ref ref="MAIN" /> - </root> -</log4j:configuration> - +<?xml version="1.0" encoding="UTF-8" ?> + +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="error"/> + <appender-ref ref="MAIN" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-09-07 19:02:01
|
Revision: 121 http://svn.sourceforge.net/obo/?rev=121&view=rev Author: cmpich Date: 2006-09-07 12:01:55 -0700 (Thu, 07 Sep 2006) Log Message: ----------- Added console appender Modified Paths: -------------- phenote/trunk/conf/log4j.xml Modified: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml 2006-09-07 16:55:37 UTC (rev 120) +++ phenote/trunk/conf/log4j.xml 2006-09-07 19:01:55 UTC (rev 121) @@ -1,27 +1,31 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> - - <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="phenote_log4j.log" /> - <param name="Append" value="true" /> - <param name="MaxFileSize" value="1MB" /> - <param name="MaxBackupIndex" value="10" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <category name="phenote" additivity="true"> - <priority value="error"/> - <appender-ref ref="MAIN" /> - </category> - - <root> - <priority value="info" /> - <appender-ref ref="MAIN" /> - </root> -</log4j:configuration> - +<?xml version="1.0" encoding="UTF-8" ?> + +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="error"/> + <appender-ref ref="MAIN" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-07 16:55:41
|
Revision: 120 http://svn.sourceforge.net/obo/?rev=120&view=rev Author: mgibson Date: 2006-09-07 09:55:37 -0700 (Thu, 07 Sep 2006) Log Message: ----------- took out ctrl-M's Modified Paths: -------------- phenote/trunk/conf/log4j.xml Modified: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml 2006-09-07 16:43:37 UTC (rev 119) +++ phenote/trunk/conf/log4j.xml 2006-09-07 16:55:37 UTC (rev 120) @@ -1,26 +1,27 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> - - <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="phenote_log4j.log" /> - <param name="Append" value="true" /> - <param name="MaxFileSize" value="1MB" /> - <param name="MaxBackupIndex" value="10" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <category name="phenote" additivity="true"> - <priority value="error"/> - <appender-ref ref="MAIN" /> - </category> - - <root> - <priority value="info" /> - <appender-ref ref="MAIN" /> - </root> -</log4j:configuration> +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="error"/> + <appender-ref ref="MAIN" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-09-07 16:43:43
|
Revision: 119 http://svn.sourceforge.net/obo/?rev=119&view=rev Author: cmpich Date: 2006-09-07 09:43:37 -0700 (Thu, 07 Sep 2006) Log Message: ----------- 1) Changed war-target to include minimal set of files. 2) Added log4j library and used it to replace System.out calls by log.info/error calls. Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Added Paths: ----------- phenote/trunk/conf/log4j.xml phenote/trunk/jars/log4j-1.2.13.jar Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-09-06 22:04:27 UTC (rev 118) +++ phenote/trunk/build.xml 2006-09-07 16:43:37 UTC (rev 119) @@ -303,12 +303,16 @@ <target name="war" depends="jar, war-clean"> <mkdir dir="war-deployment"/> <war destfile="war-deployment/phenote.war" webxml="src/web/WEB-INF/web.xml"> - <fileset dir="src/web"/> - <lib dir="${lib}"/> - <classes dir="${classfiles}"/> - <zipfileset dir="${obo}"/> - <!-- prefix="obo-files"/ ??? --> - <zipfileset dir="${conf}"/> + <fileset dir="src/web"> + <exclude name="perl/*" /> + </fileset> + <lib dir="${lib}"> + <exclude name="junit-4.0.jar" /> + <exclude name="BrowserLauncher2-10rc4.jar" /> + <exclude name="tomcat-servlet.jar" /> + </lib> + <classes dir="${obo}" /> + <classes dir="${conf}" /> </war> </target> Added: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml (rev 0) +++ phenote/trunk/conf/log4j.xml 2006-09-07 16:43:37 UTC (rev 119) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="error"/> + <appender-ref ref="MAIN" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> Added: phenote/trunk/jars/log4j-1.2.13.jar =================================================================== (Binary files differ) Property changes on: phenote/trunk/jars/log4j-1.2.13.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-06 22:04:27 UTC (rev 118) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-07 16:43:37 UTC (rev 119) @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; import org.geneontology.oboedit.datamodel.OBOClass; +import org.apache.log4j.Logger; import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; @@ -23,196 +24,219 @@ public class PhenoteServlet extends HttpServlet { - private static final String CONFIG_FILE_PARAM = "configuration-file"; + private static final String CONFIG_FILE_PARAM = "configuration-file"; + private static final Logger LOG = Logger.getLogger(PhenoteServlet.class); - //private String configurationFileName; not sure needs to be var - private Date initDate; - private Phenote phenote; + //private String configurationFileName; not sure needs to be var + private Date initDate; + private Phenote phenote; - /** if <load-on-startup>1</load-on-startup> is in web.xml then init will - happen when web server started (or if code recompiled) - so this is where - the ontology reading & caching goes */ - public void init() throws ServletException { - initDate = new Date(); - super.init(); - // makes links for term info - put this method in Phenote? - HtmlUtil.setStandAlone(false); - phenote = Phenote.getPhenote(); - // from web.xml - String configFile = getInitParameter(CONFIG_FILE_PARAM); - // just in case not in web.xml - if (configFile == null || configFile.equals("")) - configFile = "/initial-zfin.cfg"; - try { - Config.inst().setConfigFile(configFile); // causes parse of file - } catch (ConfigException e) { - String m = "Error in config file: "+configFile+" "+e.getMessage(); - System.out.println(m); - throw new ServletException(m); // ?? - } - // cheesy - revisit - //String[] args = {"-c","initial-zfin.cfg"}; - //phenote.initConfig(args); // hardwire for now to zfin - phenote.initOntologies(); - // this is not running as a separate thread - investigate + /** + * if <load-on-startup>1</load-on-startup> is in web.xml then init will + * happen when web server started (or if code recompiled) - so this is where + * the ontology reading & caching goes + */ + public void init() throws ServletException { + initDate = new Date(); + super.init(); + // makes links for term info - put this method in Phenote? + HtmlUtil.setStandAlone(false); + phenote = Phenote.getPhenote(); + // from web.xml + String configFile = getInitParameter(CONFIG_FILE_PARAM); + // just in case not in web.xml + if (configFile == null || configFile.equals("")) + configFile = "/initial-zfin.cfg"; + try { + Config.inst().setConfigFile(configFile); // causes parse of file + } catch (ConfigException e) { + String m = "Error in config file: " + configFile + " " + e.getMessage(); + LOG.error(m); + throw new ServletException(m); // ?? + } + // cheesy - revisit + //String[] args = {"-c","initial-zfin.cfg"}; + //phenote.initConfig(args); // hardwire for now to zfin + phenote.initOntologies(); + // this is not running as a separate thread - investigate // System.out.println("ontologies loaded - starting file checking thread"); // OntologyFileCheckThread ofct = new OntologyFileCheckThread(); // ofct.start(); // is this not running as threaded? // System.out.println("file thread launched - moving on"); - } + } - /** AUTO COMPLETE REQUEST - this should be done in java server faces/pages(?), post comes from ajax - autocompleter on typing in stuff */ - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { - + /** + * AUTO COMPLETE REQUEST + * this should be done in java server faces/pages(?), post comes from ajax + * autocompleter on typing in stuff + */ + public void doPost(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { - // dont know where this goes??? - System.out.println("servlet doPost "+new Date()); - System.err.println("is term comp request: "+isTermCompletionRequest(request)); + // dont know where this goes??? + LOG.debug("servlet doPost " + new Date()); + LOG.info("is term comp request: " + isTermCompletionRequest(request)); - PrintWriter out = response.getWriter(); + PrintWriter out = response.getWriter(); - if (isTermCompletionRequest(request)) { - String userInput = getTermCompletionParam(request); - System.out.println("ontology? "+getOntologyParamString(request)+" param entityInput? "+getTermCompletionParam(request)); + if (isTermCompletionRequest(request)) { + String userInput = getTermCompletionParam(request); + LOG.info("ontology? " + getOntologyParamString(request) + " param entityInput? " + getTermCompletionParam(request)); //ResourceBundle r=ResourceBundle.getBundle("LocalStrings",request.getLocale()); - //Content-Type: text/html; charset=ISO-8859-1 - response.setContentType("text/html"); - //out.println("Content-Type: text/html; charset=ISO-8859-1"); // this messes things up + //Content-Type: text/html; charset=ISO-8859-1 + response.setContentType("text/html"); + //out.println("Content-Type: text/html; charset=ISO-8859-1"); // this messes things up // String list = "<ul><li onmouseover=\"set_ontology()\" id=\"termId\" "+ // "onclick=\"set_ontology()\">"+userInput+"</li>\n"+ // "<li onmouseover=\"set_ontology()\" id=\"termId\" onclick=\"set_ontology()\">"+ // "test</li>\n<li onmouseover=\"set_ontology()\" id=\"termId\" onclick=\"set_ontology()\">dude</li></ul>"; - String ontol = getOntologyParamString(request); - String list = getCompletionList(userInput,ontol); - System.out.println("printing to response writer: "+substring(list,55)+"..."); - out.println(list); + String ontol = getOntologyParamString(request); + String list = getCompletionList(userInput, ontol); + LOG.debug("printing to response writer: " + substring(list, 55) + "..."); + out.println(list); + } + } - - } - private boolean isTermCompletionRequest(HttpServletRequest req) { - return getTermCompletionParam(req) != null; - } + private boolean isTermCompletionRequest(HttpServletRequest req) { + return getTermCompletionParam(req) != null; + } - /** this should be renamed from unintuitive "ontologyname" */ - private String getTermCompletionParam(HttpServletRequest req) { - String par = req.getParameter("userInput"); // new way - if (par ==null) - par = req.getParameter("qualityInput"); // for now - pase i think - if (par == null) - par = req.getParameter("entityInput"); - return par; - } + /** + * this should be renamed from unintuitive "ontologyname" + */ + private String getTermCompletionParam(HttpServletRequest req) { + String par = req.getParameter("userInput"); // new way + if (par == null) + par = req.getParameter("qualityInput"); // for now - pase i think + if (par == null) + par = req.getParameter("entityInput"); + return par; + } - private String getOntologyParamString(HttpServletRequest req) { - return req.getParameter("ontologyName"); - } + private String getOntologyParamString(HttpServletRequest req) { + return req.getParameter("ontologyName"); + } - - /** TERM INFO request - i cant tell ya why but term info is done with a get and term completion - is done with a post - is there rhyme or reason to this? */ - public void doGet(HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { - if (true || isTermInfoRequest(request)) { - PrintWriter out = response.getWriter(); - String termId = getTermIdFromTermInfoRequest(request); - String ontologyName = getOntologyParamString(request); - System.out.println("doGet term info param: "+termId+" ont "+ontologyName); + /** + * TERM INFO request + * i cant tell ya why but term info is done with a get and term completion + * is done with a post - is there rhyme or reason to this? + */ + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + if (true || isTermInfoRequest(request)) { + PrintWriter out = response.getWriter(); + String termId = getTermIdFromTermInfoRequest(request); + String ontologyName = getOntologyParamString(request); + LOG.info("doGet term info param: " + termId + " ont " + ontologyName); // out.println("<table><tr><td class=\"label\">Ontology</td> "+ // "<td class=\"data\">"+initDate+"</td></tr>\n"+ // "<tr><td class=\"label\">Term name...</td><td class=\"data\">" // +userInput+"</td></tr></table>"); - Ontology ont = getOntology(ontologyName); - if (ont == null) { - System.out.println("ERROR: Failed to get ontology for "+ontologyName); - return; - } - OBOClass oboClass = getOntology(ontologyName).getOboClass(termId); - if (oboClass == null) { - System.out.println("term info: no obo class found for "+termId); - return; - } - System.out.println("term info "+substring(HtmlUtil.termInfo(oboClass),60)); - out.println(HtmlUtil.termInfo(oboClass,ontologyName)); + Ontology ont = getOntology(ontologyName); + if (ont == null) { + LOG.error("ERROR: Failed to get ontology for " + ontologyName); + return; + } + OBOClass oboClass = getOntology(ontologyName).getOboClass(termId); + if (oboClass == null) { + LOG.error("term info: no obo class found for " + termId); + return; + } + LOG.info("term info " + substring(HtmlUtil.termInfo(oboClass), 60)); + out.println(HtmlUtil.termInfo(oboClass, ontologyName)); + } } - } - private String substring(String s,int sz) { - sz = (s.length() <= sz) ? s.length() : sz; - return s.substring(0,sz); - } + private String substring(String s, int sz) { + sz = (s.length() <= sz) ? s.length() : sz; + return s.substring(0, sz); + } - private boolean isTermInfoRequest(HttpServletRequest req) { - return getTermIdFromTermInfoRequest(req) != null; - } + private boolean isTermInfoRequest(HttpServletRequest req) { + return getTermIdFromTermInfoRequest(req) != null; + } - private String getTermIdFromTermInfoRequest(HttpServletRequest req) { - return req.getParameter("termId"); - } + private String getTermIdFromTermInfoRequest(HttpServletRequest req) { + return req.getParameter("termId"); + } - // List<String>? String[]? or String htmlLiString? - // for now just return html ul-li list w onmouseover - private String getCompletionList(String userInput,String ontol) { - StringBuffer sb = new StringBuffer("<ul>"); - // for now just grab the pato ontology - eventuall redo for multiple/config - Ontology ontology = getOntology(ontol); - if (ontology == null) { - System.out.println("failed to get "+ontol+" from ontology manager"); - return "ontology retrieval failed"; + // List<String>? String[]? or String htmlLiString? + // for now just return html ul-li list w onmouseover + private String getCompletionList(String userInput, String ontol) { + StringBuffer sb = new StringBuffer("<ul>"); + // for now just grab the pato ontology - eventuall redo for multiple/config + Ontology ontology = getOntology(ontol); + if (ontology == null) { + LOG.error("failed to get " + ontol + " from ontology manager"); + return "ontology retrieval failed"; + } + Vector<OBOClass> v = ontology.getSearchTerms(userInput, getSearchParams()); + for (OBOClass oc : v) + sb.append(makeCompListHtmlItem(oc, ontol)); + sb.append("</ul>"); + return sb.toString(); } - Vector<OBOClass> v = ontology.getSearchTerms(userInput,getSearchParams()); - for (OBOClass oc : v) - sb.append(makeCompListHtmlItem(oc,ontol)); - sb.append("</ul>"); - return sb.toString(); - } - /** returns null if ontolName not found */ - private Ontology getOntology(String ontolName) { // termid?? or ontology name? - //return getQualityOntology(); - return OntologyManager.getOntologyForName(ontolName); - } - - // for now... - private Ontology getQualityOntology() { - for (CharField cf : OntologyManager.inst().getCharFieldList()) - if (cf.getCharFieldEnum() == CharFieldEnum.QUALITY) - return cf.getFirstOntology(); - System.out.println("quality ontology not found in ontology manager"); - return null; - } + /** + * returns null if ontolName not found + */ + private Ontology getOntology(String ontolName) { // termid?? or ontology name? + //return getQualityOntology(); + return OntologyManager.getOntologyForName(ontolName); + } - private String makeCompListHtmlItem(OBOClass term,String ontol) { - String id = "'"+term.getID()+"'"; - String info = "\"getTermInfo("+id+",'"+ontol+"')\""; - return "<li onmouseover="+info+" id="+id+" "+ - "onclick="+info+">"+term.getName()+"</li>\n"; - } + // for now... + private Ontology getQualityOntology() { + for (CharField cf : OntologyManager.inst().getCharFieldList()) + if (cf.getCharFieldEnum() == CharFieldEnum.QUALITY) + return cf.getFirstOntology(); + LOG.error("quality ontology not found in ontology manager"); + return null; + } - /** for now search params hard wired - eventually from buttons on web page */ - private SearchParamsI getSearchParams() { - return new HardWiredSearchParams(); - } + private String makeCompListHtmlItem(OBOClass term, String ontol) { + String id = "'" + term.getID() + "'"; + String info = "\"getTermInfo(" + id + ",'" + ontol + "')\""; + return "<li onmouseover=" + info + " id=" + id + " " + + "onclick=" + info + ">" + term.getName() + "</li>\n"; + } - private class HardWiredSearchParams implements SearchParamsI { - public boolean searchTerms() { return true; } - public boolean searchSynonyms() { return false; } - public boolean searchDefinitions() { return false; } - /** Whether to include obsoletes in searching terms, syns, & definitions - This should be in conjunction with the other 3 */ - public boolean searchObsoletes() { return false; } - } + /** + * for now search params hard wired - eventually from buttons on web page + */ + private SearchParamsI getSearchParams() { + return new HardWiredSearchParams(); + } + private class HardWiredSearchParams implements SearchParamsI { + public boolean searchTerms() { + return true; + } + + public boolean searchSynonyms() { + return false; + } + + public boolean searchDefinitions() { + return false; + } + + /** + * Whether to include obsoletes in searching terms, syns, & definitions + * This should be in conjunction with the other 3 + */ + public boolean searchObsoletes() { + return false; + } + } + } - // ---> OntologyDataAdapter - moved to // /** thread wakes up and checks if theres a new ontology file - if so loads it // this should go in ontology data adapter... not here and configged */ @@ -223,8 +247,7 @@ // while(true) { // System.out.println("checking for new files..."); // // check for files... - - + // // sleep in milliseconds - sleep for 5 seconds for now (test) // try { sleep(5000); } // catch (InterruptedException e) { System.out.println("interrupted"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-06 22:04:33
|
Revision: 118 http://svn.sourceforge.net/obo/?rev=118&view=rev Author: mgibson Date: 2006-09-06 15:04:27 -0700 (Wed, 06 Sep 2006) Log Message: ----------- release 0.7 - pheno syntax entity choosers... Added Paths: ----------- phenote/tags/release-0.7/ Copied: phenote/tags/release-0.7 (from rev 117, phenote/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-09-06 21:09:46
|
Revision: 117 http://svn.sourceforge.net/obo/?rev=117&view=rev Author: cmpich Date: 2006-09-06 14:09:43 -0700 (Wed, 06 Sep 2006) Log Message: ----------- changed war target to point to a different dir. Added a tag to create that directory if not present Modified Paths: -------------- phenote/trunk/build.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-09-06 19:11:08 UTC (rev 116) +++ phenote/trunk/build.xml 2006-09-06 21:09:43 UTC (rev 117) @@ -9,142 +9,126 @@ <project name="phenote" default="compile" basedir="."> - <description>phenote ant build</description> - <!-- allows for use of environment vars --> - <property environment="env"/> - <!-- property name="src-svn" value="./src/java" / --> - <property name="src" value="./src/java" /> - <property name="test" value="./src/java/test" /> - <!-- where classes go --> - <property name="classfiles" value="classfiles" /> - <property name="web-classfiles" value="${env.PHENOTE_WEB_CLASSFILES}" /> - <property name="web-conf" value="${env.PHENOTE_WEB_CONF_FILES}"/> - <property name="web-html" value="${env.PHENOTE_WEB_HTML}"/> - <property name="web-jars" value="${env.PHENOTE_WEB_JAR_DIR}" /> - <property name="web.xml-dir" value="${env.PHENOTE_WEB_XML_DIR}" /> - - <property name="lib" value="jars" /> - <property name="jarfile" value="jars/phenote.jar"/> - <property name="obo" value="obo-files" /> - <property name="conf" value="conf" /> - <!-- override this from command line with -DCONF-FILE=initial-zfin.cfg --> - <property name="CONF_FILE" value="initial-flybase.cfg"/> + <description>phenote ant build</description> + <!-- allows for use of environment vars --> + <property environment="env"/> + <!-- property name="src-svn" value="./src/java" / --> + <property name="src" value="./src/java"/> + <property name="test" value="./src/java/test"/> + <!-- where classes go --> + <property name="classfiles" value="classfiles"/> + <property name="web-classfiles" value="${env.PHENOTE_WEB_CLASSFILES}"/> + <property name="web-conf" value="${env.PHENOTE_WEB_CONF_FILES}"/> + <property name="web-html" value="${env.PHENOTE_WEB_HTML}"/> + <property name="web-jars" value="${env.PHENOTE_WEB_JAR_DIR}"/> + <property name="web.xml-dir" value="${env.PHENOTE_WEB_XML_DIR}"/> - <!-- The init target makes sure that the prerequisite directories exist. --> - <target name="init"> - <mkdir dir="${classfiles}" /> - </target> + <property name="lib" value="jars"/> + <property name="jarfile" value="jars/phenote.jar"/> + <property name="obo" value="obo-files"/> + <property name="conf" value="conf"/> + <!-- override this from command line with -DCONF-FILE=initial-zfin.cfg --> + <property name="CONF_FILE" value="initial-flybase.cfg"/> + <!-- The init target makes sure that the prerequisite directories exist. --> + <target name="init"> + <mkdir dir="${classfiles}"/> + </target> - <!-- The classpath includes all the jar files jars dir, excluding - jars/phenote.jar if it exists. --> - <path id="project.classpath"> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </path> - <path id="project.classpath2"> - <fileset dir="${lib}"> - <exclude name="phenote.jar"/> - <exclude name="META-INF"/> - </fileset> - </path> + <!-- The classpath includes all the jar files jars dir, excluding +jars/phenote.jar if it exists. --> + <path id="project.classpath"> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </path> - <path id="project.classpath3"> - <fileset dir="${lib}"> - <patternset id="non-phenote-jars"> - <include name="**/*.jar"/> - <exclude name="**/phenote.jar"/> - <exclude name="test/**"/> - </patternset> - </fileset> - </path> + <path id="project.classpath2"> + <fileset dir="${lib}"> + <exclude name="phenote.jar"/> + <exclude name="META-INF"/> + </fileset> + </path> - <!-- The compile target runs javac on all the java files, and saves - them into the classfiles directory. excludes="test/**" --> - <target name="compile" depends="init"> - <javac srcdir="${src}" destdir="${classfiles}" debug="yes" excludes="test/**"> - <classpath refid="project.classpath3"/> - </javac> - </target> + <path id="project.classpath3"> + <fileset dir="${lib}"> + <patternset id="non-phenote-jars"> + <include name="**/*.jar"/> + <exclude name="**/phenote.jar"/> + <exclude name="test/**"/> + </patternset> + </fileset> + </path> + <!-- The compile target runs javac on all the java files, and saves +them into the classfiles directory. excludes="test/**" --> + <target name="compile" depends="init"> + <javac srcdir="${src}" destdir="${classfiles}" debug="yes" excludes="test/**"> + <classpath refid="project.classpath3"/> + </javac> + </target> - <!-- runs off classfiles not jar, todo: run-jar --> - <target name="run" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> - <!-- arg value="-c configfilehereventually"/ --> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> - <target name="zfin" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> - <!-- arg value="-c configfilehereventually"/ --> - <arg value="-c"/> - <arg value="initial-zfin.cfg"/> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> + <!-- runs off classfiles not jar, todo: run-jar --> + <target name="run" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> - <target name="fly" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> - <!-- arg value="-c configfilehereventually"/ --> - <arg value="-c"/> - <arg value="initial-flybase.cfg"/> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> + <target name="zfin" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="initial-zfin.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> - <target name="obd" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> - <!-- arg value="-c configfilehereventually"/ --> - <arg value="-c"/> - <arg value="obd.cfg"/> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> + <target name="fly" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="initial-flybase.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> - <target name="run-conf" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> - <!-- arg value="-c configfilehereventually"/ --> - <arg value="-c"/> - <arg value="${CONF_FILE}"/> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> - + <target name="obd" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="obd.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> <target name="run-jar" > <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> @@ -156,185 +140,203 @@ </java> </target> + <target name="run-conf" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="${CONF_FILE}"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> - <target name="test" depends="build-test"> - <java classname="org.junit.runner.JUnitCore" fork="yes" jvmargs="-Xmx120M"> - <arg value="phenote.gui.TestPhenote"/> - <classpath> - <pathelement path="${classfiles}"/> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </classpath> - </java> - </target> - <!-- The clean target just erases the classes --> - <target name="clean"> - <delete dir="${classfiles}"/> - </target> + <target name="test" depends="build-test"> + <java classname="org.junit.runner.JUnitCore" fork="yes" jvmargs="-Xmx120M"> + <arg value="phenote.gui.TestPhenote"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> - <!-- clean and compile everything --> - <target name="build-all" depends="clean,compile,build-test"/> + <!-- The clean target just erases the classes --> + <target name="clean"> + <delete dir="${classfiles}"/> + </target> + <!-- clean and compile everything --> + <target name="build-all" depends="clean,compile,build-test"/> - <target name="build-test" depends="compile"> - <javac srcdir="${test}" destdir="${classfiles}" debug="yes"> - <classpath refid="project.classpath"/> - </javac> - </target> - <!-- JAR The jar target compiles everything, and produces a phenote.jar in - phenote/jars/phenote.jar. --> - <target name="jar" depends="compile"> - <jar destfile="${jarfile}"> - <fileset dir="${classfiles}"/> - <fileset file="${obo}/*.obo"/> - <fileset file="${conf}/*.cfg"/> - </jar> - </target> + <target name="build-test" depends="compile"> + <javac srcdir="${test}" destdir="${classfiles}" debug="yes"> + <classpath refid="project.classpath"/> + </javac> + </target> -<!-- file=${obo}/*.obo --> + <!-- JAR The jar target compiles everything, and produces a phenote.jar in + phenote/jars/phenote.jar. --> + <target name="jar" depends="compile"> + <jar destfile="${jarfile}"> + <fileset dir="${classfiles}"/> + <fileset file="${obo}/*.obo"/> + <fileset file="${conf}/*.cfg"/> + </jar> + </target> + <!-- file=${obo}/*.obo --> - <target name="javadoc"> - <javadoc - destdir="doc/api" - author="true" - version="true" - use="true" - windowtitle="Phenote API" - package="true"> - <!-- this aint pickin everything up??? --> - <packageset dir="${src}" defaultexcludes="no"> - <include name="phenote/*/**"/> - <!-- exclude name="com/dummy/test/doc-files/**"/ --> - </packageset> + <target name="javadoc"> + <javadoc + destdir="doc/api" + author="true" + version="true" + use="true" + windowtitle="Phenote API" + package="true"> - <classpath refid="project.classpath"/> + <!-- this aint pickin everything up??? --> + <packageset dir="${src}" defaultexcludes="no"> + <include name="phenote/*/**"/> + <!-- exclude name="com/dummy/test/doc-files/**"/ --> + </packageset> - <doctitle><![CDATA[<h1>Phenote</h1>]]></doctitle> - </javadoc> - </target> + <classpath refid="project.classpath"/> - <property name="dist" value="0.6"/> + <doctitle><![CDATA[<h1>Phenote</h1>]]></doctitle> + </javadoc> + </target> - <target name="tar"> - <mkdir dir="tars/${dist}"/> - <tar destfile="tars/${dist}/phenote-${dist}.tar"> - <tarfileset dir ="."> - <exclude name="${dist}/**"/> - <exclude name="svn-phenote/**"/> - <exclude name="tars/**"/> - <exclude name="src/obo-files/**"/> - <exclude name="*.tar"/> - <exclude name="*.jar"/> - <exclude name="garbage/**"/> - <exclude name="oldjars/**"/> - <exclude name="src/java/**"/> - <exclude name="web-classfiles/**"/> - <exclude name="web-interface/**"/> - <exclude name="web-deployment/**"/> - </tarfileset> - </tar> - <gzip zipfile="tars/${dist}/phenote-${dist}.tar.gz" src="tars/${dist}/phenote-${dist}.tar"/> - </target> + <property name="dist" value="0.6"/> - <target name="tar-source"> - <mkdir dir="tars/${dist}"/> - <tar destfile="tars/${dist}/phenote-${dist}-src.tar"> - <tarfileset dir ="."> - <exclude name="${dist}/**"/> - <exclude name="svn-phenote/**"/> - <exclude name="tars/**"/> - <exclude name="src/obo-files/**"/> - <!-- for now take out go as its 8.5M & not being used yet --> - <exclude name="obo-files/gene_ontology.obo"/> - <exclude name="*.tar"/> - <exclude name="*.jar"/> - <exclude name="garbage/**"/> - <exclude name="oldjars/**"/> - <!-- exclude name="jars/phenote.jar"/ --> - <exclude name="doc/**"/> - <exclude name="classfiles/**"/> - <exclude name="web-classfiles/**"/> - <exclude name="web-interface/**"/> - <exclude name="web-deployment/**"/> - </tarfileset> - </tar> - <gzip zipfile="tars/${dist}/phenote-${dist}-src.tar.gz" src="tars/${dist}/phenote-${dist}-src.tar"/> - </target> + <target name="tar"> + <mkdir dir="tars/${dist}"/> + <tar destfile="tars/${dist}/phenote-${dist}.tar"> + <tarfileset dir="."> + <exclude name="${dist}/**"/> + <exclude name="svn-phenote/**"/> + <exclude name="tars/**"/> + <exclude name="src/obo-files/**"/> + <exclude name="*.tar"/> + <exclude name="*.jar"/> + <exclude name="garbage/**"/> + <exclude name="oldjars/**"/> + <exclude name="src/java/**"/> + <exclude name="web-classfiles/**"/> + <exclude name="web-interface/**"/> + <exclude name="web-deployment/**"/> + </tarfileset> + </tar> + <gzip zipfile="tars/${dist}/phenote-${dist}.tar.gz" src="tars/${dist}/phenote-${dist}.tar"/> + </target> - <target name="gzip-tar"> - <gzip zipfile="tars/${dist}/phenote-${dist}.tar.gz" src="tars/${dist}/phenote-${dist}.tar"/> - </target> + <target name="tar-source"> + <mkdir dir="tars/${dist}"/> + <tar destfile="tars/${dist}/phenote-${dist}-src.tar"> + <tarfileset dir="."> + <exclude name="${dist}/**"/> + <exclude name="svn-phenote/**"/> + <exclude name="tars/**"/> + <exclude name="src/obo-files/**"/> + <!-- for now take out go as its 8.5M & not being used yet --> + <exclude name="obo-files/gene_ontology.obo"/> + <exclude name="*.tar"/> + <exclude name="*.jar"/> + <exclude name="garbage/**"/> + <exclude name="oldjars/**"/> + <!-- exclude name="jars/phenote.jar"/ --> + <exclude name="doc/**"/> + <exclude name="classfiles/**"/> + <exclude name="web-classfiles/**"/> + <exclude name="web-interface/**"/> + <exclude name="web-deployment/**"/> + </tarfileset> + </tar> + <gzip zipfile="tars/${dist}/phenote-${dist}-src.tar.gz" src="tars/${dist}/phenote-${dist}-src.tar"/> + </target> - <target name="compile-servlet"> - <javac srcdir="${src}" destdir="${web-classfiles}" debug="yes" excludes="test/**"> - <classpath refid="project.classpath3"/> - </javac> - </target> + <target name="gzip-tar"> + <gzip zipfile="tars/${dist}/phenote-${dist}.tar.gz" src="tars/${dist}/phenote-${dist}.tar"/> + </target> - <!-- web-deployment & web-config-files should be a symoblic link to ones web site --> - <target name="web-deployment" depends="compile-servlet"> - <copy todir="${web-html}"> - <fileset dir="src/web"/> - </copy> - <copy todir="${web-conf}"> - <fileset dir="conf"> - <include name="*.cfg"/> - </fileset> - </copy> - <copy todir="${web-conf}"> - <fileset dir="obo-files" /> - </copy> - <copy todir="${web-jars}"> - <fileset dir="${lib}"> - <include name="*.jar"/> - <exclude name="phenote.jar"/> - </fileset> - </copy> - <copy todir="${web.xml-dir}"> - <fileset file="src/web/WEB-INF/web.xml" /> - </copy> - </target> + <target name="compile-servlet"> + <javac srcdir="${src}" destdir="${web-classfiles}" debug="yes" excludes="test/**"> + <classpath refid="project.classpath3"/> + </javac> + </target> - <target name="war" depends="jar"> - <war destfile="war-deployment-link/phenote.war" webxml="src/web/web.xml"> - <fileset dir="src/web"/> - <lib dir="${lib}"/> - <classes dir="${classfiles}" /> - <zipfileset dir="${obo}"/> <!-- prefix="obo-files"/ ??? --> - <zipfileset dir="${conf}"/> - </war> - </target> + <!-- web-deployment & web-config-files should be a symoblic link to ones web site --> + <target name="web-deployment" depends="compile-servlet"> + <copy todir="${web-html}"> + <fileset dir="src/web"/> + </copy> + <copy todir="${web-conf}"> + <fileset dir="conf"> + <include name="*.cfg"/> + </fileset> + </copy> + <copy todir="${web-conf}"> + <fileset dir="obo-files"/> + </copy> + <copy todir="${web-jars}"> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </copy> + <copy todir="${web.xml-dir}"> + <fileset file="src/web/WEB-INF/web.xml"/> + </copy> + </target> - <target name="war-clean"> - <delete file="war-deployment-link/phenote.war"/> - </target> + <target name="war" depends="jar, war-clean"> + <mkdir dir="war-deployment"/> + <war destfile="war-deployment/phenote.war" webxml="src/web/WEB-INF/web.xml"> + <fileset dir="src/web"/> + <lib dir="${lib}"/> + <classes dir="${classfiles}"/> + <zipfileset dir="${obo}"/> + <!-- prefix="obo-files"/ ??? --> + <zipfileset dir="${conf}"/> + </war> + </target> - <target name="war-no-jar-depend"> - <delete file="war-deployment-link/phenote.war"/> - <war destfile="war-deployment-link/phenote.war" webxml="src/web/web.xml"> - <fileset dir="src/web"/> - <lib dir="${lib}"/> - <classes dir="${classfiles}" /> - <zipfileset dir="${obo}"/> <!-- prefix="obo-files"/ ??? --> - <zipfileset dir="${conf}"/> - </war> - </target> - - <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="${lib}/xbean.jar" /> + <target name="war-clean"> + <delete dir="war-deployment"/> + </target> -<!-- classgendir="${build.dir}" - if not doing jar but classes, schema is directory + <target name="war-no-jar-depend"> + <delete file="war-deployment/phenote.war"/> + <war destfile="war-deployment/phenote.war" webxml="src/web/WEB-INF/web.xml"> + <fileset dir="src/web"/> + <lib dir="${lib}"/> + <classes dir="${classfiles}"/> + <zipfileset dir="${obo}"/> + <!-- prefix="obo-files"/ ??? --> + <zipfileset dir="${conf}"/> + </war> + </target> + + <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="${lib}/xbean.jar"/> + + <!-- classgendir="${build.dir}" - if not doing jar but classes, schema is directory where xsd files are (conf) --> - <target name="xml-beans"> - <xmlbean schema="${conf}" destfile="${lib}/phenotexmlbeans.jar" classpath="${project.classpath3}" - failonerror="true" javasource="1.5" > - </xmlbean> - </target> + <target name="xml-beans"> + <xmlbean schema="${conf}" destfile="${lib}/phenotexmlbeans.jar" classpath="${project.classpath3}" + failonerror="true" javasource="1.5"> + </xmlbean> + </target> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-06 19:11:24
|
Revision: 116 http://svn.sourceforge.net/obo/?rev=116&view=rev Author: mgibson Date: 2006-09-06 12:11:08 -0700 (Wed, 06 Sep 2006) Log Message: ----------- phenote now checks for new ontologies - records the modification date of the obo files and when the thread wakes up it checks if any of the obo files are more current and if so loads them. configured with <check-for-new-ontologies intervalMinutes="5"/> which will wake up every 5 minutes. this is a start - christian talks of adding a logger & scheduler Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd phenote/trunk/jars/phenoteconfigbeans.jar phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java phenote/trunk/src/java/phenote/datamodel/Ontology.java phenote/trunk/src/java/phenote/datamodel/OntologyManager.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/build.xml 2006-09-06 19:11:08 UTC (rev 116) @@ -145,6 +145,16 @@ </java> </target> + <target name="run-jar" > + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <classpath> + <fileset dir="${lib}"> + <include name="*.jar"/> + </fileset> + </classpath> + </java> + </target> <target name="test" depends="build-test"> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/conf/initial-zfin.cfg 2006-09-06 19:11:08 UTC (rev 116) @@ -2,6 +2,8 @@ <dataadapter name="phenosyntax"/> + <check-for-new-ontologies intervalMinutes="5"/> + <field name="Pub" /> <field name="Genotype" type="free_text"/> Modified: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/conf/phenote-config.rnc 2006-09-06 19:11:08 UTC (rev 116) @@ -3,6 +3,7 @@ start = element phenote-configuration { + check-for-new-ontologies, dataadapter*, field* } @@ -13,6 +14,12 @@ attribute name {"phenoxml" | "phenosyntax"} } +## Whether to +check-for-new-ontologies = + element check-for-new-ontologies { + attribute intervalMinutes { xsd:integer } + } + field = element field { attribute name { "Pub" | "Genotype" | "Genetic Context" | "Entity" | "Quality" }, Modified: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/conf/phenote-config.xsd 2006-09-06 19:11:08 UTC (rev 116) @@ -3,6 +3,7 @@ <xs:element name="phenote-configuration"> <xs:complexType> <xs:sequence> + <xs:element ref="x:check-for-new-ontologies"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:dataadapter"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:field"/> </xs:sequence> @@ -23,6 +24,11 @@ </xs:attribute> </xs:complexType> </xs:element> + <xs:element name="check-for-new-ontologies"> + <xs:complexType> + <xs:attribute name="intervalMinutes" use="required" type="xs:integer"/> + </xs:complexType> + </xs:element> <xs:element name="field"> <xs:complexType> <xs:sequence> Modified: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-09-06 19:11:08 UTC (rev 116) @@ -7,6 +7,7 @@ import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; +import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; @@ -23,6 +24,7 @@ // in phenoteconfigbeans.jar code generate xml beans import phenote.config.xml.PhenoteConfigurationDocument; import phenote.config.xml.PhenoteConfigurationDocument.PhenoteConfiguration; +import phenote.config.xml.CheckForNewOntologiesDocument.CheckForNewOntologies; import phenote.config.xml.DataadapterDocument.Dataadapter; import phenote.config.xml.FieldDocument.Field; import phenote.config.xml.OntologyDocument.Ontology; @@ -48,6 +50,8 @@ //private FieldConfig geneticContextConfig; private List<DataAdapterI> dataAdapterList; private List<FieldConfig> fieldList = new ArrayList<FieldConfig>(); + private boolean checkForNewOntologies = false; + private int newOntologyCheckMinutes = 10; /** singleton */ private Config() { @@ -148,6 +152,14 @@ return dataAdapterList.get(0); } + /** perhaps not best name - check if ontology is still fresh, if something newer + than load it - for obo files check file date - get this into config file! */ + public boolean checkForNewOntologies() { + return checkForNewOntologies; + } + /** How many minutes between checks for new ontologies */ + public int getOntologyCheckMinutes() { return newOntologyCheckMinutes; } + private FieldConfig getLumpConfig() { // name = Taxonmony, file = BTO.obo... return lumpConfig; @@ -207,12 +219,26 @@ PhenoteConfigurationDocument pcd = PhenoteConfigurationDocument.Factory.parse(configUrl);//configFile); PhenoteConfiguration pc = pcd.getPhenoteConfiguration(); + + + // CHECK FOR ONTOLOGIES + CheckForNewOntologies cfno = pc.getCheckForNewOntologies(); + if (cfno != null) { // ? + checkForNewOntologies = true; + BigInteger bi = cfno.getIntervalMinutes(); + if (bi != null) + newOntologyCheckMinutes = bi.intValue(); + } + + + // DATA ADAPTERS Dataadapter[] adapters = pc.getDataadapterArray(); for (Dataadapter da : adapters) { String name = da.getName().toString(); addDataAdapterFromString(name); } + // FIELDS Field[] fields = pc.getFieldArray(); for (Field f : fields) { makeFieldConfig(f); Modified: phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-09-06 19:11:08 UTC (rev 116) @@ -1,10 +1,12 @@ package phenote.dataadapter; import java.io.File; +import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collection; +import java.util.Date; import java.util.Iterator; import java.util.List; @@ -25,26 +27,35 @@ /** is this really a data adapter? - OntologyLoader? this isnt a data adapter it doesnt load & commit character data - just loads ontologies. rename OntologyLoader - for now can stay in dataadapter package */ + for now can stay in dataadapter package + this is specifically a OboFileLoader - other kinds of ontology loading may com along*/ public class OntologyDataAdapter { private Config config; private OntologyManager ontologyManager = OntologyManager.inst(); + private boolean loadingOntologies = false; public OntologyDataAdapter() { config = Config.inst(); + if (config.checkForNewOntologies()) { + new OntologyFileCheckThread().start(); + } } public void loadOntologies() { - + loadingOntologies = true; for (FieldConfig fieldConfig : config.getFieldConfigList()) { CharFieldEnum fce = fieldConfig.getCharFieldEnum(); CharField cf = new CharField(fce); if (fieldConfig.hasOntologies()) { //cf = new CharField(fce,o); for (OntologyConfig oc : fieldConfig.getOntologyConfigList()) { - Ontology o = loadOntology(oc); - cf.addOntology(o); + try { + Ontology o = loadOntology(oc); + cf.addOntology(o); + } catch (FileNotFoundException e) { + System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + } } } else { @@ -52,22 +63,44 @@ } ontologyManager.addField(cf); } - + loadingOntologies = false; } /** Load up/cache Sets for all ontologies used, anatomyOntologyTermSet * and patoOntologyTermSet -- move to dataadapter/OntologyDataAdapter... */ - private Ontology loadOntology(OntologyConfig ontCfg) { - OBOSession oboSession = getOboSession(findFile(ontCfg.ontologyFile)); - Ontology ontology = new Ontology(ontCfg.name,oboSession); + private Ontology loadOntology(OntologyConfig ontCfg) throws FileNotFoundException { +// URL url = findFile(ontCfg.ontologyFile); // throws FileNotFoundEx +// File file = new File(url.getFile()); +// long date = file.lastModified(); +// System.out.println("url path "+url.getPath()+" file "+file+" mod "+date+" "+new Date(date)); +// OBOSession oboSession = getOboSession(url); + Ontology ontology = new Ontology(ontCfg.name); + loadOboSession(ontology,ontCfg.ontologyFile); // throws FileNotFoundEx +// if (date > 0) { // jar files have 0 date??? +// ontology.setTimestamp(date); +// ontology.setSource(file.toString()); +// } return ontology; } + private void loadOboSession(Ontology o,String filename) throws FileNotFoundException { + URL url = findFile(filename); // throws FileNotFoundEx + OBOSession oboSession = getOboSession(url); + o.setOboSession(oboSession); + File file = new File(url.getFile()); + long date = file.lastModified(); + System.out.println(" file "+file+" mod "+date+" "+new Date(date)); + if (date > 0) { // jar files have 0 date??? + o.setTimestamp(date); + o.setSource(file.toString()); + } + } + /** Look for file in current directory (.) and jar file */ - private URL findFile(String fileName) { + private URL findFile(String fileName) throws FileNotFoundException { // first try file as is (full path provided) File file = new File(fileName); @@ -92,8 +125,7 @@ } if (url == null) { - System.out.println("No file found in pwd or jar for "+fileName); - return null; + throw new FileNotFoundException("No file found for "+fileName); } return url; } @@ -129,6 +161,50 @@ } } + private class OntologyFileCheckThread extends Thread { + + public void run() { + + int checkMilliSecs = config.getOntologyCheckMinutes() * 60000; + + while(true) { + // sleep in milliseconds + try { sleep(checkMilliSecs); } + catch (InterruptedException e) { System.out.println("interrupted"); } + + // if still loading ontologies from previous run then dont bother + if (loadingOntologies) { + System.out.println("Ontologies are being loaded - ontology checker going "+ + "back to sleep"); + continue; + } + System.out.println("checking for new obo files..."); + // check for files... + synchOntologies(); + } + } + + private void synchOntologies() { + for (CharField cf : ontologyManager.getCharFieldList()) { + for (Ontology o : cf.getOntologyList()) { + if (o.getSource() == null) continue; + String file = o.getSource(); + long oldTimestamp = o.getTimestamp(); + long newTimestamp = new File(file).lastModified(); + if (newTimestamp > oldTimestamp) { + Date d = new Date(newTimestamp); + System.out.println("loading new obo file "+file+" new date "+d); + try { + loadOboSession(o,file); + } catch (FileNotFoundException e) { // shouldnt happen + System.out.println(e.getMessage()+" ignoring ontology, fix config! "); + } + } + } + } + } + } + } // Ontology pato = loadOntology(config.getPatoOntologyConfig()); Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-09-06 19:11:08 UTC (rev 116) @@ -24,10 +24,27 @@ private OBOSession oboSession; private List<OBOClass> sortedTerms; private List<OBOClass> sortedObsoleteTerms; + /** well this stuff is specific to ontologies from files (eg obo), perhaps there + needs to be some sort of wrapper or subclass? need to think about this... + for now just shoving in here */ + private String source; // "source" is slightly generic isnt it? + + /** this may be general? maybe should be a real date - this is the time of the ontology + for files this would be the modification date, for loading from database somewhere + obd? zfin? this would be the time of the load */ + private long ontologyTimestamp; - public Ontology(String name,OBOSession oboSession) { +// public Ontology(String name,OBOSession oboSession) { +// this.name = name; +// this.oboSession = oboSession; +// makeSortedLists(oboSession); +// } + public Ontology(String name) { this.name = name; - this.oboSession = oboSession; + } + + public void setOboSession(OBOSession os) { + oboSession = os; makeSortedLists(oboSession); } @@ -238,7 +255,14 @@ return sortedTerms; } + /** moght move this elsewhere - subclass? data adap specific wrapper? */ + public void setTimestamp(long t) { ontologyTimestamp = t; } + public long getTimestamp() { return ontologyTimestamp; } + /** for obo files this is the filename */ + public void setSource(String s) { source = s; } + public String getSource() { return source; } + /** does unique check w map */ private class UniqueTermList { private Vector<OBOClass> searchTerms = new Vector<OBOClass>(); Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-09-06 19:11:08 UTC (rev 116) @@ -17,7 +17,7 @@ private static OntologyManager singleton; - // isnt this redundant with charFieldList? convenience? + // isnt this redundant with charFieldList? convenience? - phase out! just getOClass private List<Ontology> allOntologyList = new ArrayList<Ontology>(); /** CharFields generically hold one or more ontologies - are charFields that dont have ontologies in this list?? not sure */ @@ -66,6 +66,7 @@ the id prefix AO,GO,PATO... */ public OBOClass getOboClass(String id) { OBOClass oboClass; +// this seems to be the sole reason for ontology list - silly! Iterator<Ontology> iter = allOntologyList.iterator(); while (iter.hasNext()) { Ontology o = iter.next(); Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-05 15:35:04 UTC (rev 115) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-09-06 19:11:08 UTC (rev 116) @@ -57,7 +57,7 @@ // this is not running as a separate thread - investigate // System.out.println("ontologies loaded - starting file checking thread"); // OntologyFileCheckThread ofct = new OntologyFileCheckThread(); -// ofct.run(); // is this not running as threaded? +// ofct.start(); // is this not running as threaded? // System.out.println("file thread launched - moving on"); } @@ -210,26 +210,27 @@ public boolean searchObsoletes() { return false; } } +} - /** thread wakes up and checks if theres a new ontology file - if so loads it - this should go in ontology data adapter... not here and configged */ - private class OntologyFileCheckThread extends Thread { - public void run() { +// ---> OntologyDataAdapter - moved to +// /** thread wakes up and checks if theres a new ontology file - if so loads it +// this should go in ontology data adapter... not here and configged */ +// private class OntologyFileCheckThread extends Thread { - while(true) { - System.out.println("checking for new files..."); - // check for files... +// public void run() { + +// while(true) { +// System.out.println("checking for new files..."); +// // check for files... - // sleep in milliseconds - sleep for 5 seconds for now (test) - try { sleep(5000); } - catch (InterruptedException e) { System.out.println("interrupted"); } - } - } - } +// // sleep in milliseconds - sleep for 5 seconds for now (test) +// try { sleep(5000); } +// catch (InterruptedException e) { System.out.println("interrupted"); } +// } +// } +// } -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-09-05 15:35:16
|
Revision: 115 http://svn.sourceforge.net/obo/?rev=115&view=rev Author: mgibson Date: 2006-09-05 08:35:04 -0700 (Tue, 05 Sep 2006) Log Message: ----------- initial config files are now copied to .phenote/my-phenote.cfg file. this allows the config file to be accessible when running off webstart jar - previoulsy config files were buried in jar in accessible. theres now 2 cmd line options -i & -c - -i is for initial config and will only be used if nothing in my-phenote.cfg - and if so will get copied to my-phenote - -c overrides and overwrites whatevers in my-phenote. eventually there will be a gui for config as users dont want to have to mutz with a xml file. Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/doc/todo phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/ConfigException.java phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java phenote/trunk/src/java/phenote/gui/Phenote.java Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/build.xml 2006-09-05 15:35:04 UTC (rev 115) @@ -17,11 +17,11 @@ <property name="test" value="./src/java/test" /> <!-- where classes go --> <property name="classfiles" value="classfiles" /> - <!-- symbolic link over to web world --> <property name="web-classfiles" value="${env.PHENOTE_WEB_CLASSFILES}" /> <property name="web-conf" value="${env.PHENOTE_WEB_CONF_FILES}"/> <property name="web-html" value="${env.PHENOTE_WEB_HTML}"/> <property name="web-jars" value="${env.PHENOTE_WEB_JAR_DIR}" /> + <property name="web.xml-dir" value="${env.PHENOTE_WEB_XML_DIR}" /> <property name="lib" value="jars" /> <property name="jarfile" value="jars/phenote.jar"/> @@ -285,7 +285,10 @@ <include name="*.jar"/> <exclude name="phenote.jar"/> </fileset> - </copy> + </copy> + <copy todir="${web.xml-dir}"> + <fileset file="src/web/WEB-INF/web.xml" /> + </copy> </target> <target name="war" depends="jar"> Modified: phenote/trunk/doc/todo =================================================================== --- phenote/trunk/doc/todo 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/doc/todo 2006-09-05 15:35:04 UTC (rev 115) @@ -1,3 +1,12 @@ +column sorting - do shift for descending, also if new added sort it +in, and perhaps indicate sorted column in header with < & >? + +bug: pasting from one phenote to another doesnt work - i think its +because the data flavors are 2 different instances in 2 different jvms +even though in theory its a singleton: +loading CharacterList from clipboard if there +Failed to get character list from clipboard: java.awt.datatransfer.UnsupportedFlavorException: Fly Character List + fly data adapter needs to check for empty/null entity & value - should be required Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-09-05 15:35:04 UTC (rev 115) @@ -1,8 +1,10 @@ package phenote.config; import java.io.IOException; +import java.io.InputStream; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import java.net.MalformedURLException; @@ -52,15 +54,82 @@ //parseXmlFile("./conf/initial-flybase.cfg"); // hardwired for now... } - /** This is the config file from command line - - todo... if user has personal config file use that instead */ + /** This is setting config file with nothing to do with personal config + this is for the servlet where config file location is set in web.xml */ public void setConfigFile(String configFile) throws ConfigException { - this.configFile = configFile; // ?? + setConfigFile(configFile,false,false); // dont use .phenote by default (servlet) + } + + /** This is for when phenote is first installed and one of the default config + files is used - the -i option if you will. The initial config file will + get copied to .phenote/my-phenote.cfg if it doesnt already exist. if it + exists then this file is ignored */ + public void setInitialConfigFile(String configFile) throws ConfigException { + setConfigFile(configFile,true,false); + } + + public void setOverwriteConfigFile(String configFile) throws ConfigException { + setConfigFile(configFile,true,true); + } + + /** if usePersonalConfig is false then ignore personal(my-phenote.cfg). if true + then overwrite personal if overwritePersonal is true, otherwise only write + to personal if personal doesnt exist, if personal exists ignore passed in + config file (its an initial config -i) */ + private void setConfigFile(String file, boolean usePersonalConfig, + boolean overwritePersonalConfig) + throws ConfigException { + this.configFile = file; // ?? + // look to see if config file in ~/.phenote - if not copy there + if (usePersonalConfig) { // for standalone not servlet + configFile = getMyPhenoteConfig(configFile,overwritePersonalConfig); + } System.out.println("Attempting to read config from "+configFile); //parseXmlFileWithDom(configFile); // do parse here? - parseXmlFile(configFile); // thorws ex + //URL configUrl = getConfigUrl(filename); + //System.out.println("config file: "+configUrl); + parseXmlFile(configFile); // throws ex } + private String getMyPhenoteConfig(String passedInConfig, + boolean overwritePersonalCfg) + throws ConfigException { + String home = System.getProperty("user.home"); + File dotPhenote = new File(home+"/.phenote"); + if (!dotPhenote.exists()) { + System.out.println("creating "+dotPhenote+" directory"); + dotPhenote.mkdir(); + } + File myPhenote = new File(dotPhenote,"my-phenote.cfg"); + // if file doesnt exist yet or overwrite, copy over passedInConfig + if (!myPhenote.exists() || overwritePersonalCfg) { + String s = overwritePersonalCfg ? " getting overwritten" : " does not exist"; + System.out.println(myPhenote+s+" Copying "+passedInConfig); + try { + URL passedInUrl = getConfigUrl(passedInConfig); + copyUrlToFile(passedInUrl,myPhenote); + } catch (FileNotFoundException e) { + throw new ConfigException(e); + } + } + return myPhenote.toString(); // ? + } + + /** goes thru url line by line and copies to file - is there a better way to + do this? */ + private void copyUrlToFile(URL configUrl,File myPhenote) throws ConfigException { + try { + InputStream is = configUrl.openStream(); + FileOutputStream os = new FileOutputStream(myPhenote); + for(int next = is.read(); next != -1; next = is.read()) { + os.write(next); + } + is.close(); + os.flush(); + os.close(); + } catch (Exception e) { throw new ConfigException(e); } + } + public static Config inst() { return singleton; } @@ -99,49 +168,6 @@ return lumpConfig.getOntologyConfig(); } -// public OntologyConfig getPatoOntologyConfig() { -// return getPatoConfig().getOntologyConfig(); -// } - - /** paot config should always be present, make default if not set from xml */ -// private FieldConfig getPatoConfig() { -// if (patoConfig == null) { -// System.out.println("error pato config is null, making default"); -// OntologyConfig o = OntologyConfig.defaultPato; -// patoConfig = new FieldConfig(CharFieldEnum.PATO,o); -// } -// return patoConfig; -// } - -// public boolean hasGeneticContextField() { -// return geneticContextConfig != null; -// } - -// public OntologyConfig getGeneticContextOntologyConfig() { -// if (!hasGeneticContextField()) return null; -// return getGeneticContextConfig().getOntologyConfig(); // check if has ont? -// } - -// public FieldConfig getGeneticContextConfig() { -// return geneticContextConfig; -// } - -// private void initGeneticContextConfig(OntologyConfig oc) { -// geneticContextConfig = new FieldConfig(CharFieldEnum.GENETIC_CONTEXT,oc); -// } - -// private FieldConfig getEntityConfig() { -// if (entityConfig == null) -// entityConfig = new FieldConfig(CharFieldEnum.ENTITY,"Entity"); -// return entityConfig; -// } - -// public List<OntologyConfig> getEntityOntologyConfigs() { -// // if (entityConfigList.isEmpty()) entityConfigList = defaultEntityConfigList(); -// // return entityConfigList; -// return getEntityConfig().getOntologyConfigList(); -// } - public int getNumberOfFields() { return getFieldConfigList().size(); } @@ -151,10 +177,6 @@ return getFieldConfig(index).getLabel(); } -// public String getFieldName(int index) { -// return getFieldConfig(index).getLabel(); -// } - public CharFieldEnum getCharFieldEnum(int index) { return getFieldConfig(index).getCharFieldEnum(); } @@ -164,29 +186,11 @@ return getFieldConfigList().get(index); } - /** OntologyDataAdapter calls this to figure which ontologies to load */ public List<FieldConfig> getFieldConfigList() { -// if (fieldList == null) -// initFieldConfigList(); return fieldList; } -// // refactor! - just have it come straight from xml parse! -// private void initFieldConfigList() { -// //fieldList = new ArrayList<FieldConfig>(); -// if (hasLumpField()) { -// fieldList.add(getLumpConfig()); -// } -// if (hasGeneticContextField()) { -// fieldList.add(getGeneticContextConfig()); -// } -// // entity config should always be present shouldnt it? -// fieldList.add(getEntityConfig()); -// fieldList.add(getPatoConfig()); // pato required -// } - - /** Default entity list is the anatomy ontology -- DELETE*/ private List<OntologyConfig> defaultEntityConfigList() { OntologyConfig oc = new OntologyConfig("Anatomy","anatomy.obo"); @@ -195,7 +199,6 @@ return l; } - /** parse xml file with xml beans (phenoteconfigbeans.xml). Put in own class? */ private void parseXmlFile(String filename) throws ConfigException { try { @@ -212,8 +215,6 @@ Field[] fields = pc.getFieldArray(); for (Field f : fields) { - //String name = f.getName().getStringValue(); - //String file = f.getFile().getStringValue(); makeFieldConfig(f); } @@ -221,12 +222,10 @@ catch (IOException ie) { System.out.println("IOException on config parse "+ie); throw new ConfigException("io exception with config file "+ie.getMessage()); - //System.exit(1); } catch (XmlException xe) { System.out.println("Parse of config xml file failed "+xe); throw new ConfigException("Xml exception in config file "+xe.getMessage()); - //System.exit(1); // bad for servlet to exit } } @@ -314,7 +313,71 @@ } // OLD OLD OLD - DELETE - DOM STUFF - replaced with xml beans +// public OntologyConfig getPatoOntologyConfig() { +// return getPatoConfig().getOntologyConfig(); +// } + /** paot config should always be present, make default if not set from xml */ +// private FieldConfig getPatoConfig() { +// if (patoConfig == null) { +// System.out.println("error pato config is null, making default"); +// OntologyConfig o = OntologyConfig.defaultPato; +// patoConfig = new FieldConfig(CharFieldEnum.PATO,o); +// } +// return patoConfig; +// } + +// public boolean hasGeneticContextField() { +// return geneticContextConfig != null; +// } + +// public OntologyConfig getGeneticContextOntologyConfig() { +// if (!hasGeneticContextField()) return null; +// return getGeneticContextConfig().getOntologyConfig(); // check if has ont? +// } + +// public FieldConfig getGeneticContextConfig() { +// return geneticContextConfig; +// } + +// private void initGeneticContextConfig(OntologyConfig oc) { +// geneticContextConfig = new FieldConfig(CharFieldEnum.GENETIC_CONTEXT,oc); +// } + +// private FieldConfig getEntityConfig() { +// if (entityConfig == null) +// entityConfig = new FieldConfig(CharFieldEnum.ENTITY,"Entity"); +// return entityConfig; +// } + +// public List<OntologyConfig> getEntityOntologyConfigs() { +// // if (entityConfigList.isEmpty()) entityConfigList = defaultEntityConfigList(); +// // return entityConfigList; +// return getEntityConfig().getOntologyConfigList(); +// } + +// public String getFieldName(int index) { +// return getFieldConfig(index).getLabel(); +// } + //String name = f.getName().getStringValue(); + //String file = f.getFile().getStringValue(); +// if (fieldList == null) +// initFieldConfigList(); +// // refactor! - just have it come straight from xml parse! +// private void initFieldConfigList() { +// //fieldList = new ArrayList<FieldConfig>(); +// if (hasLumpField()) { +// fieldList.add(getLumpConfig()); +// } +// if (hasGeneticContextField()) { +// fieldList.add(getGeneticContextConfig()); +// } +// // entity config should always be present shouldnt it? +// fieldList.add(getEntityConfig()); +// fieldList.add(getPatoConfig()); // pato required +// } + + // /** Throws ParserConfig,SAXEx, & IOException if problems - sep class? */ // private Document getDocument(String filename) throws Exception { // DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Modified: phenote/trunk/src/java/phenote/config/ConfigException.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigException.java 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/src/java/phenote/config/ConfigException.java 2006-09-05 15:35:04 UTC (rev 115) @@ -1,5 +1,11 @@ package phenote.config; public class ConfigException extends Exception { + private Exception wrappedEx; ConfigException(String m) { super(m); } + ConfigException(Exception e) { + this(e.getMessage()); + wrappedEx = e; + } + public Exception getWrappedException() { return wrappedEx; } } Modified: phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-09-05 15:35:04 UTC (rev 115) @@ -68,10 +68,16 @@ /** Look for file in current directory (.) and jar file */ private URL findFile(String fileName) { + + // first try file as is (full path provided) + File file = new File(fileName); + if (file.exists()) + return makeUrl(fileName); + String oboFileDir = "obo-files/"; // try current directory + obo-file dir String currentDir = "./" + oboFileDir + fileName; - File file = new File(currentDir); + file = new File(currentDir); if (file.exists()) return makeUrl(currentDir); Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-31 22:49:12 UTC (rev 114) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-09-05 15:35:04 UTC (rev 115) @@ -18,7 +18,7 @@ public class Phenote { - private static final String VERSION = "0.7.5 dev"; + private static final String VERSION = "0.7.6 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; @@ -70,13 +70,19 @@ --initialConfig zf|fb|obd - actually da heck with that with entity chooser just put all 3 ontologies in one which is then the default (unspecified on cmd line) and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg - (if it exists) - we can always add --init later if we need it */ + (if it exists) - we can always add --init later if we need it + -c overwrites, -i doesnt -i is for initial startup of phenote */ private void doCommandLine(String[] args) { String configFile = getConfigFileFromCommandLine(args); + // if no config file specified then set default initial config file. this will be + // overridden by a personal config file if it exists if (configFile == null) configFile = Config.DEFAULT_CONFIG_FILE; try { - Config.inst().setConfigFile(configFile); // causes parse of file + if (isOverwriteConfigFile(args)) + Config.inst().setOverwriteConfigFile(configFile); // causes parse of file->.phenote + else + Config.inst().setInitialConfigFile(configFile); } catch (ConfigException e) { System.out.println("EXITING! Fatal error in config file: "+e.getMessage()); e.printStackTrace(); @@ -84,11 +90,20 @@ } } + private boolean isInitialConfigFile(String args[]) { + if (args == null || args.length < 2) return false; + return args[0].equals("-i"); + } + private boolean isOverwriteConfigFile(String args[]) { + if (args == null || args.length < 2) return false; + return args[0].equals("-c"); + } + private String getConfigFileFromCommandLine(String args[]) { // need 2 args - if (args == null || args.length <= 1) return null; - String firstArg = args[0]; - if (!firstArg.equals("-c")) return null; + if (args == null || args.length < 2) return null; + //String firstArg = args[0]; + if (!isInitialConfigFile(args) && !isOverwriteConfigFile(args)) return null; String configFile = args[1]; return configFile; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-08-31 22:49:15
|
Revision: 114 http://svn.sourceforge.net/obo/?rev=114&view=rev Author: cmpich Date: 2006-08-31 15:49:12 -0700 (Thu, 31 Aug 2006) Log Message: ----------- Change in the url-pattern of the web.xml required a change in this file to call the servlet under the context the app runs Modified Paths: -------------- phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-31 22:46:16 UTC (rev 113) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-31 22:49:12 UTC (rev 114) @@ -117,14 +117,14 @@ <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> - var complete = new Ajax.Autocompleter( 'qualityInput', 'quality_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=quality',paramName: "userInput" }) + var complete = new Ajax.Autocompleter( 'qualityInput', 'quality_auto_complete', '../Phenote',{parameters:'ontologyName=quality',paramName: "userInput" }) <!-- complete.options.defaultParams = "ontology=quality"; --> <!-- complete.options.parameters = "ontology=quality"; --> <!-- more params? 'ontology=quality&x=y&...' --> </script> <script type="text/javascript"> - var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=ZF',paramName: "userInput"}) + var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '../Phenote',{parameters:'ontologyName=ZF',paramName: "userInput"}) </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-08-31 22:46:20
|
Revision: 113 http://svn.sourceforge.net/obo/?rev=113&view=rev Author: cmpich Date: 2006-08-31 15:46:16 -0700 (Thu, 31 Aug 2006) Log Message: ----------- moved web.xml to WEB-INF/web.xml Modified url-pattern: remove /phenote prefix to allow running the servlet in contexts other than /phenote Added Paths: ----------- phenote/trunk/src/web/WEB-INF/ phenote/trunk/src/web/WEB-INF/web.xml Removed Paths: ------------- phenote/trunk/src/web/web.xml Copied: phenote/trunk/src/web/WEB-INF/web.xml (from rev 111, phenote/trunk/src/web/web.xml) =================================================================== --- phenote/trunk/src/web/WEB-INF/web.xml (rev 0) +++ phenote/trunk/src/web/WEB-INF/web.xml 2006-08-31 22:46:16 UTC (rev 113) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE web-app + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" + "http://java.sun.com/j2ee/dtds/web-app_2_4.dtd"> + +<web-app> + <servlet> + <servlet-name>Phenote</servlet-name> + <servlet-class>phenote.servlet.PhenoteServlet</servlet-class> + <init-param> + <param-name>"-Xmx"</param-name> + <param-value>200M</param-value> + </init-param> + <init-param> + <param-name>configuration-file</param-name> + <param-value>/initial-zfin.cfg</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>Phenote</servlet-name> + <url-pattern>/Phenote</url-pattern> + </servlet-mapping> +</web-app> Deleted: phenote/trunk/src/web/web.xml =================================================================== --- phenote/trunk/src/web/web.xml 2006-08-31 21:50:18 UTC (rev 112) +++ phenote/trunk/src/web/web.xml 2006-08-31 22:46:16 UTC (rev 113) @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" - "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> - -<web-app> - <servlet> - <servlet-name>Phenote</servlet-name> - <servlet-class>phenote.servlet.PhenoteServlet</servlet-class> - <init-param> - <param-name>"-Xmx"</param-name> - <param-value>200M</param-value> - </init-param> - <init-param> - <param-name>configuration-file</param-name> - <param-value>/initial-zfin.cfg</param-value> - </init-param> - <load-on-startup>1</load-on-startup> - </servlet> - - <servlet-mapping> - <servlet-name>Phenote</servlet-name> - <!-- url-pattern>/Phenote</url-pattern --> - <url-pattern>/phenote/Phenote</url-pattern> - </servlet-mapping> -</web-app> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 21:50:28
|
Revision: 112 http://svn.sourceforge.net/obo/?rev=112&view=rev Author: mgibson Date: 2006-08-31 14:50:18 -0700 (Thu, 31 Aug 2006) Log Message: ----------- character table now sorts its contents by clicking on a column header will sort ascending according to that column. this actually sorts the data itself - not just the view - for now i think thats ok - no biggie probably - in fact may be somewhat handy Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java phenote/trunk/src/java/phenote/datamodel/CharacterList.java phenote/trunk/src/java/phenote/datamodel/CharacterListI.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-31 20:12:31 UTC (rev 111) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-31 21:50:18 UTC (rev 112) @@ -2,7 +2,6 @@ import org.geneontology.oboedit.datamodel.OBOClass; -//import phenote.datamodel.CharField.CharFieldEnum; /** At the moment char field values can be Strings (genotype) and OBOClasses, and possibly more coming (Genotype?). This class attempts to hide the details of the actual Modified: phenote/trunk/src/java/phenote/datamodel/CharacterList.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-08-31 20:12:31 UTC (rev 111) +++ phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-08-31 21:50:18 UTC (rev 112) @@ -2,6 +2,8 @@ import java.util.ArrayList; import java.util.List; +import java.util.Collections; +import java.util.Comparator; /** i made this as a transferable when i didnt get the whole transferable thing and now i dont whether to scrap it or not. all it is at the moment is a @@ -25,4 +27,38 @@ } return true; } + + // ?? + public void sortBy(CharFieldEnum cfe) { + Collections.sort(characterList,getComparator(cfe)); + } + + private Comparator<CharacterI> getComparator(final CharFieldEnum cfe) { + return new Comparator<CharacterI>() { + public int compare(CharacterI c1, CharacterI c2) { + String s1 = cfe.getValue(c1).getName(); + String s2 = cfe.getValue(c2).getName(); + return s1.compareTo(s2); + } + }; + } } + +// private class CharFieldComparator<CharacterI> implements Comparator { +// private CharFieldEnum charFieldEnum; +// private CharFieldComparator(CharFieldEnum cfe) { +// charFieldEnum = cfe; +// } +// public int compare(CharacterI c1, CharacterI c2) { +// String s1 = charFieldEnum.getValue(c1).getName(); +// String s2 = charFieldEnum.getValue(c2).getName(); +// return s1.compareTo(s2); +// } +// } + + +// Comparator<String> comparator = new Comparator<String>() { +// public int compare(String s1, String s2) { // Ignore null for brevity +// return -s1.compareTo(s2); +// } +// }; Modified: phenote/trunk/src/java/phenote/datamodel/CharacterListI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-08-31 20:12:31 UTC (rev 111) +++ phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-08-31 21:50:18 UTC (rev 112) @@ -14,4 +14,6 @@ public int size(); public List<CharacterI> getList(); public boolean equals(CharacterListI cl); + /** Sort data by char field enum field */ + public void sortBy(CharFieldEnum cfe); } Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-08-31 20:12:31 UTC (rev 111) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-08-31 21:50:18 UTC (rev 112) @@ -7,7 +7,7 @@ /** The way editing works is gui makes update transaction (see CharFieldGui and AutoComboBox) and calls EditManager.updateModel(), EM calls UpdateTrans constructs CharFieldValues and calls - CVF..editModel which call charFieldEnum.setValue which calls the appropriate + CVF.editModel which call charFieldEnum.setValue which calls the appropriate method in CharacterI. EM also shoots out char change event to its listeners UpdateTrans takes Strings(for free text) or OBOClasses(ontologies). */ Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-31 20:12:31 UTC (rev 111) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-31 21:50:18 UTC (rev 112) @@ -116,8 +116,13 @@ return false; } + /** hmmmm... do we sort data or some view of data, view is probably cleaner + but for now just sort data itself? dont yet have separate view objects to + sort */ void setSortKey(int col) { - + CharFieldEnum cfe = getCharFieldEnum(col); + characterList.sortBy(cfe); // ??? + fireTableDataChanged(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 20:12:37
|
Revision: 111 http://svn.sourceforge.net/obo/?rev=111&view=rev Author: mgibson Date: 2006-08-31 13:12:31 -0700 (Thu, 31 Aug 2006) Log Message: ----------- Config now throws an excpetion when parsing config file fails instead of exiting which doesnt play well in a servlet context - standalone catches exception and exits - servlet catches exception and throws Servlet Exception also some nascent column sorting stuff Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Added Paths: ----------- phenote/trunk/src/java/phenote/config/ConfigException.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-31 20:12:31 UTC (rev 111) @@ -54,11 +54,11 @@ /** This is the config file from command line - todo... if user has personal config file use that instead */ - public void setConfigFile(String configFile) { + public void setConfigFile(String configFile) throws ConfigException { this.configFile = configFile; // ?? System.out.println("Attempting to read config from "+configFile); //parseXmlFileWithDom(configFile); // do parse here? - parseXmlFile(configFile); + parseXmlFile(configFile); // thorws ex } public static Config inst() { @@ -197,7 +197,7 @@ /** parse xml file with xml beans (phenoteconfigbeans.xml). Put in own class? */ - private void parseXmlFile(String filename) { + private void parseXmlFile(String filename) throws ConfigException { try { URL configUrl = getConfigUrl(filename); System.out.println("config file: "+configUrl); @@ -219,12 +219,14 @@ } catch (IOException ie) { - System.out.println("EXITING! IOException on config parse "+ie); - System.exit(1); + System.out.println("IOException on config parse "+ie); + throw new ConfigException("io exception with config file "+ie.getMessage()); + //System.exit(1); } catch (XmlException xe) { - System.out.println("EXITING! Parse of config xml file failed "+xe); - System.exit(1); + System.out.println("Parse of config xml file failed "+xe); + throw new ConfigException("Xml exception in config file "+xe.getMessage()); + //System.exit(1); // bad for servlet to exit } } Added: phenote/trunk/src/java/phenote/config/ConfigException.java =================================================================== --- phenote/trunk/src/java/phenote/config/ConfigException.java (rev 0) +++ phenote/trunk/src/java/phenote/config/ConfigException.java 2006-08-31 20:12:31 UTC (rev 111) @@ -0,0 +1,5 @@ +package phenote.config; + +public class ConfigException extends Exception { + ConfigException(String m) { super(m); } +} Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-31 20:12:31 UTC (rev 111) @@ -137,7 +137,6 @@ private class TextKeyListener extends java.awt.event.KeyAdapter { public void keyPressed(java.awt.event.KeyEvent e) { - System.out.println("got key event mod "+e.getKeyModifiersText(e.getModifiers())+" char "+e.getKeyChar()+" mod int "+e.getModifiers()); // on a mac Command-V is paste. this aint so with java/metal look&feel if (e.getKeyChar() == 'v' && e.getKeyModifiersText(e.getModifiers()).equals("Command")) { @@ -146,9 +145,6 @@ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); try { Transferable t = c.getContents(null); // null? - //DataFlavor[] dfArr = t.getTransferDataFlavors(); - //for (DataFlavor df : dfArr) System.out.println("df "+df); - //System.out.println("clip "+c+" nm "+c.getName()+" cont "+c.getContents(null)+" trans data "+c.getContents(null).getTransferData(DataFlavor.stringFlavor)); Object s = t.getTransferData(DataFlavor.stringFlavor); // this isnt quite right as it should just insert the text not wipe // it out - but probably sufficient for now? Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-31 20:12:31 UTC (rev 111) @@ -116,6 +116,10 @@ return false; } + void setSortKey(int col) { + + } + } //--rowCount; // hmmmmm - this cant be hardwired, needs to work with config Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-31 20:12:31 UTC (rev 111) @@ -2,8 +2,11 @@ import java.awt.Dimension; import java.awt.GridLayout; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import javax.swing.Box; import javax.swing.JButton; @@ -64,6 +67,7 @@ CharacterSelectionListener isl = new CharacterSelectionListener(); characterTable.getSelectionModel().addListSelectionListener(isl); characterTable.setRowSelectionInterval(0,0); // select 1st row + characterTable.getTableHeader().addMouseListener(new TableSorter()); JScrollPane tableScroll = new JScrollPane(characterTable); verticalScrollBar = tableScroll.getVerticalScrollBar();//needed for scroll to new @@ -250,6 +254,24 @@ } } + + private class TableSorter extends MouseAdapter { + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() != 1) return; // ? + Point p = e.getPoint(); + int col = characterTable.getTableHeader().columnAtPoint(p); + if (col == -1) return; + // shift for descending + // int shiftPressedInt = e.getModifiers()&InputEvent.SHIFT_MASK; + // boolean shiftPressed = (shiftPressedInt != 0); + // boolean descending = shiftPressed; + //if (model.defaultSortingIsDescending(column))descending = !descending;dont have + characterTableModel.setSortKey(col); //, descending); + //table.requestFocus(); + + } + } + // for test void pressCommitButtonTest() { commitButton.doClick(); Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-31 20:12:31 UTC (rev 111) @@ -13,6 +13,7 @@ import javax.swing.plaf.metal.MetalLookAndFeel; import phenote.config.Config; +import phenote.config.ConfigException; import phenote.dataadapter.OntologyDataAdapter; public class Phenote { @@ -74,7 +75,13 @@ String configFile = getConfigFileFromCommandLine(args); if (configFile == null) configFile = Config.DEFAULT_CONFIG_FILE; - Config.inst().setConfigFile(configFile); // causes parse of file + try { + Config.inst().setConfigFile(configFile); // causes parse of file + } catch (ConfigException e) { + System.out.println("EXITING! Fatal error in config file: "+e.getMessage()); + e.printStackTrace(); + System.exit(1); + } } private String getConfigFileFromCommandLine(String args[]) { Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 19:45:49 UTC (rev 110) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 20:12:31 UTC (rev 111) @@ -18,6 +18,7 @@ import phenote.datamodel.SearchParamsI; import phenote.util.HtmlUtil; import phenote.config.Config; +import phenote.config.ConfigException; import phenote.gui.Phenote; // move to main package public class PhenoteServlet extends HttpServlet { @@ -38,8 +39,17 @@ HtmlUtil.setStandAlone(false); phenote = Phenote.getPhenote(); // from web.xml - String configurationFileName = getInitParameter(CONFIG_FILE_PARAM); - Config.inst().setConfigFile(configurationFileName); // causes parse of file + String configFile = getInitParameter(CONFIG_FILE_PARAM); + // just in case not in web.xml + if (configFile == null || configFile.equals("")) + configFile = "/initial-zfin.cfg"; + try { + Config.inst().setConfigFile(configFile); // causes parse of file + } catch (ConfigException e) { + String m = "Error in config file: "+configFile+" "+e.getMessage(); + System.out.println(m); + throw new ServletException(m); // ?? + } // cheesy - revisit //String[] args = {"-c","initial-zfin.cfg"}; //phenote.initConfig(args); // hardwire for now to zfin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 19:45:57
|
Revision: 110 http://svn.sourceforge.net/obo/?rev=110&view=rev Author: mgibson Date: 2006-08-31 12:45:49 -0700 (Thu, 31 Aug 2006) Log Message: ----------- commented out alert on switching ontologies Modified Paths: -------------- phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-31 16:47:35 UTC (rev 109) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-31 19:45:49 UTC (rev 110) @@ -30,7 +30,7 @@ <!-- entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; --> entityAutoCompleter.options.defaultParams = "ontologyName=" + ontologyName; - alert(entityAutoCompleter.options.defaultParams); + <!-- alert(entityAutoCompleter.options.defaultParams); --> } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 16:47:44
|
Revision: 109 http://svn.sourceforge.net/obo/?rev=109&view=rev Author: mgibson Date: 2006-08-31 09:47:35 -0700 (Thu, 31 Aug 2006) Log Message: ----------- servlet now loads config file from web.xml as it should - was hardwired - fix came from christian Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/web/web.xml Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 16:16:00 UTC (rev 108) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 16:47:35 UTC (rev 109) @@ -17,10 +17,14 @@ import phenote.datamodel.OntologyManager; import phenote.datamodel.SearchParamsI; import phenote.util.HtmlUtil; +import phenote.config.Config; import phenote.gui.Phenote; // move to main package public class PhenoteServlet extends HttpServlet { + private static final String CONFIG_FILE_PARAM = "configuration-file"; + + //private String configurationFileName; not sure needs to be var private Date initDate; private Phenote phenote; @@ -33,9 +37,12 @@ // makes links for term info - put this method in Phenote? HtmlUtil.setStandAlone(false); phenote = Phenote.getPhenote(); + // from web.xml + String configurationFileName = getInitParameter(CONFIG_FILE_PARAM); + Config.inst().setConfigFile(configurationFileName); // causes parse of file // cheesy - revisit - String[] args = {"-c","initial-zfin.cfg"}; - phenote.initConfig(args); // hardwire for now to zfin + //String[] args = {"-c","initial-zfin.cfg"}; + //phenote.initConfig(args); // hardwire for now to zfin phenote.initOntologies(); // this is not running as a separate thread - investigate // System.out.println("ontologies loaded - starting file checking thread"); Modified: phenote/trunk/src/web/web.xml =================================================================== --- phenote/trunk/src/web/web.xml 2006-08-31 16:16:00 UTC (rev 108) +++ phenote/trunk/src/web/web.xml 2006-08-31 16:47:35 UTC (rev 109) @@ -7,6 +7,14 @@ <servlet> <servlet-name>Phenote</servlet-name> <servlet-class>phenote.servlet.PhenoteServlet</servlet-class> + <init-param> + <param-name>"-Xmx"</param-name> + <param-value>200M</param-value> + </init-param> + <init-param> + <param-name>configuration-file</param-name> + <param-value>/initial-zfin.cfg</param-value> + </init-param> <load-on-startup>1</load-on-startup> </servlet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 16:16:08
|
Revision: 108 http://svn.sourceforge.net/obo/?rev=108&view=rev Author: mgibson Date: 2006-08-31 09:16:00 -0700 (Thu, 31 Aug 2006) Log Message: ----------- fixed bug for onclick of term in completion list for term info - wasnt including the ontology name as param Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 16:07:57 UTC (rev 107) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 16:16:00 UTC (rev 108) @@ -174,9 +174,9 @@ private String makeCompListHtmlItem(OBOClass term,String ontol) { String id = "'"+term.getID()+"'"; - return "<li onmouseover=\"getTermInfo("+id+",'"+ontol+"')\" id="+id+" "+ -// this is wrong - needs ontology name as well... - "onclick=\"getTermInfo("+id+")\">"+term.getName()+"</li>\n"; + String info = "\"getTermInfo("+id+",'"+ontol+"')\""; + return "<li onmouseover="+info+" id="+id+" "+ + "onclick="+info+">"+term.getName()+"</li>\n"; } /** for now search params hard wired - eventually from buttons on web page */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-31 16:08:09
|
Revision: 107 http://svn.sourceforge.net/obo/?rev=107&view=rev Author: mgibson Date: 2006-08-31 09:07:57 -0700 (Thu, 31 Aug 2006) Log Message: ----------- comented out nascent thread for obo file checking from servlet - wasnt acutally working as thread updated pato -> quality ontology name and Anatomy -> ZF for zfin Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/CharacterI.java phenote/trunk/src/java/phenote/gui/AutoComboBox.java phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/web/html/ncbo.html phenote/trunk/src/web/javascript/ncbo-term-info.js Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/build.xml 2006-08-31 16:07:57 UTC (rev 107) @@ -21,6 +21,8 @@ <property name="web-classfiles" value="${env.PHENOTE_WEB_CLASSFILES}" /> <property name="web-conf" value="${env.PHENOTE_WEB_CONF_FILES}"/> <property name="web-html" value="${env.PHENOTE_WEB_HTML}"/> + <property name="web-jars" value="${env.PHENOTE_WEB_JAR_DIR}" /> + <property name="lib" value="jars" /> <property name="jarfile" value="jars/phenote.jar"/> <property name="obo" value="obo-files" /> @@ -278,6 +280,12 @@ <copy todir="${web-conf}"> <fileset dir="obo-files" /> </copy> + <copy todir="${web-jars}"> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </copy> </target> <target name="war" depends="jar"> Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-31 16:07:57 UTC (rev 107) @@ -52,6 +52,8 @@ //parseXmlFile("./conf/initial-flybase.cfg"); // hardwired for now... } + /** This is the config file from command line - + todo... if user has personal config file use that instead */ public void setConfigFile(String configFile) { this.configFile = configFile; // ?? System.out.println("Attempting to read config from "+configFile); Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-31 16:07:57 UTC (rev 107) @@ -9,79 +9,10 @@ // associates enum & ontologies public class CharField { - // separate class? labels? methods? subclasses? - // is this taking enums too far? or a good use of them? - // would it be nice to have a class that wrapped String and OBOClass? - // and all possible field values? or would that be annoying? -// public enum CharFieldEnum { - -// PUB("Pub") { -// public void setValue(CharacterI c, CharFieldValue v) { -// c.setPub(v.getName()); -// } -// public CharFieldValue getValue(CharacterI c) { -// return new CharFieldValue(c.getPub(),c,this); -// } -// }, -// LUMP("Genotype") { // genotype? default? -// public void setValue(CharacterI c, CharFieldValue v) { -// c.setGenotype(v.getName()); -// } -// public CharFieldValue getValue(CharacterI c) { -// return new CharFieldValue(c.getGenotype(),c,this); -// } -// }, -// GENETIC_CONTEXT("Genetic Context") { -// public void setValue(CharacterI c, CharFieldValue v) { -// c.setGeneticContext(v.getOboClass()); -// } -// public CharFieldValue getValue(CharacterI c) { -// return new CharFieldValue(c.getGeneticContext(),c,this); -// } -// }, -// ENTITY("Entity") { -// public void setValue(CharacterI c, CharFieldValue v) { -// c.setEntity(v.getOboClass()); -// } -// public CharFieldValue getValue(CharacterI c) { -// return new CharFieldValue(c.getEntity(),c,this); -// } -// }, -// QUALITY("Quality") { -// public void setValue(CharacterI c, CharFieldValue v) { -// c.setQuality(v.getOboClass()); -// } -// public CharFieldValue getValue(CharacterI c) { -// return new CharFieldValue(c.getQuality(),c,this); -// } -// }; - - -// // CHAR FIELD ENUM vars & methods (make its own class!) -// private final String name; -// private CharFieldEnum(String name) { this.name = name; } -// public String toString() { return name; } -// public abstract void setValue(CharacterI c, CharFieldValue v); -// public abstract CharFieldValue getValue(CharacterI c); - -// // unclear if we need this??? need it in generic field config -// public static CharFieldEnum getCharFieldEnum(String fieldString) { -// for ( CharFieldEnum cfe : CharFieldEnum.values()) { -// if (cfe.name.equalsIgnoreCase(fieldString)) -// return cfe; -// } -// System.out.println("ERROR: No Char Field found for string "+fieldString); -// return null; -// } - -// }; - - // CHAR FIELD VARS private List<Ontology> ontologyList = new ArrayList<Ontology>(3); private CharFieldEnum charFieldEnum; // or subclass private String name; - public CharField(CharFieldEnum c) { charFieldEnum = c; } @@ -135,7 +66,7 @@ return getOntologyForName(ontologyName) != null; } - /** Returns Ontology with name ontologyName, null if dont have it */ + /** Returns Ontology with name ontologyName (ignores case), null if dont have it */ public Ontology getOntologyForName(String ontologyName) { for (Ontology o : getOntologyList()) { if (o.getName().equalsIgnoreCase(ontologyName)) @@ -170,3 +101,69 @@ // above would be setValue(CharFieldValue) // getValue(CharFieldValue) + // separate class? labels? methods? subclasses? + // is this taking enums too far? or a good use of them? + // would it be nice to have a class that wrapped String and OBOClass? + // and all possible field values? or would that be annoying? +// public enum CharFieldEnum { + +// PUB("Pub") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setPub(v.getName()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getPub(),c,this); +// } +// }, +// LUMP("Genotype") { // genotype? default? +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setGenotype(v.getName()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getGenotype(),c,this); +// } +// }, +// GENETIC_CONTEXT("Genetic Context") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setGeneticContext(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getGeneticContext(),c,this); +// } +// }, +// ENTITY("Entity") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setEntity(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getEntity(),c,this); +// } +// }, +// QUALITY("Quality") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setQuality(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getQuality(),c,this); +// } +// }; + + +// // CHAR FIELD ENUM vars & methods (make its own class!) +// private final String name; +// private CharFieldEnum(String name) { this.name = name; } +// public String toString() { return name; } +// public abstract void setValue(CharacterI c, CharFieldValue v); +// public abstract CharFieldValue getValue(CharacterI c); + +// // unclear if we need this??? need it in generic field config +// public static CharFieldEnum getCharFieldEnum(String fieldString) { +// for ( CharFieldEnum cfe : CharFieldEnum.values()) { +// if (cfe.name.equalsIgnoreCase(fieldString)) +// return cfe; +// } +// System.out.println("ERROR: No Char Field found for string "+fieldString); +// return null; +// } + +// }; Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-31 16:07:57 UTC (rev 107) @@ -3,7 +3,12 @@ import org.geneontology.oboedit.datamodel.OBOClass; /** CharacterIs are the building blocks of phenotypes. All the Characters for a - genotype make up a Phenotype - at least thats my understanding. */ + genotype make up a Phenotype - at least thats my understanding. + an alternate approach would be to just have a list of CharFields, it would + certainly be more generic - hybrid approach would be to retain these fields + but also have a CharField list that can just come from config (& take out enum + in config xsd for field names) - downside: lose strong typing, and a config + misspelling would end up in a char field */ public interface CharacterI { public String getEntityName(); Modified: phenote/trunk/src/java/phenote/gui/AutoComboBox.java =================================================================== --- phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-31 16:07:57 UTC (rev 107) @@ -1,6 +1,7 @@ package phenote.gui; import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -52,6 +53,7 @@ AutoComboBox(Ontology ontology,SearchParamsI sp) { // this inner class enables retrieving of JList for mouse over // this will probably throw errors if non metal look & feel is used + //setFont(new Font("Courier",Font.PLAIN,12)); setUI(new MetalListComboUI()); setOntology(ontology); @@ -59,7 +61,7 @@ setEditable(true); AutoTextFieldEditor autoTextFieldEditor = new AutoTextFieldEditor(); this.setEditor(autoTextFieldEditor); - setPreferredSize(new Dimension(325,22)); + setPreferredSize(new Dimension(350,22)); addCompletionListListener(new CompletionListListener()); @@ -276,6 +278,8 @@ // too soon - text field doesnt have text yet.... hmmmm.... String input = getText(); // this is a vector of OBOClasses + // i think ultimately we will need to wrap the OBOClass to be able to + // have more control over the string - cut off w ... & [syn][obs] tags Vector<OBOClass> v = getTerms(input); // throws IllegalStateException, Attempt to mutate in notification // this tries to change text field amidst notification hmmmm..... Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-31 16:07:57 UTC (rev 107) @@ -17,7 +17,7 @@ public class Phenote { - private static final String VERSION = "0.7.4 dev"; + private static final String VERSION = "0.7.5 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; @@ -62,7 +62,14 @@ } /** for now just looking for '-c configFile.cfg', use command line package - if we need to get more sophisticated */ + if we need to get more sophisticated + so if user has personal config file should override this - however maybe + there should be a distinction between initial config file and user made configs + well really the initials are db/species specific - so could be + --initialConfig zf|fb|obd - actually da heck with that with entity chooser just + put all 3 ontologies in one which is then the default (unspecified on cmd line) + and -c file.cfg will load/overwrite that cfg into .phenote/my-phenote.cfg + (if it exists) - we can always add --init later if we need it */ private void doCommandLine(String[] args) { String configFile = getConfigFileFromCommandLine(args); if (configFile == null) Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-31 16:07:57 UTC (rev 107) @@ -37,8 +37,11 @@ String[] args = {"-c","initial-zfin.cfg"}; phenote.initConfig(args); // hardwire for now to zfin phenote.initOntologies(); - OntologyFileCheckThread ofct = new OntologyFileCheckThread(); - ofct.run(); + // this is not running as a separate thread - investigate +// System.out.println("ontologies loaded - starting file checking thread"); +// OntologyFileCheckThread ofct = new OntologyFileCheckThread(); +// ofct.run(); // is this not running as threaded? +// System.out.println("file thread launched - moving on"); } @@ -82,7 +85,7 @@ private String getTermCompletionParam(HttpServletRequest req) { String par = req.getParameter("userInput"); // new way if (par ==null) - par = req.getParameter("patoInput"); // for now + par = req.getParameter("qualityInput"); // for now - pase i think if (par == null) par = req.getParameter("entityInput"); return par; @@ -108,7 +111,6 @@ // "<td class=\"data\">"+initDate+"</td></tr>\n"+ // "<tr><td class=\"label\">Term name...</td><td class=\"data\">" // +userInput+"</td></tr></table>"); - // for now hard wire to pato Ontology ont = getOntology(ontologyName); if (ont == null) { System.out.println("ERROR: Failed to get ontology for "+ontologyName); @@ -173,6 +175,7 @@ private String makeCompListHtmlItem(OBOClass term,String ontol) { String id = "'"+term.getID()+"'"; return "<li onmouseover=\"getTermInfo("+id+",'"+ontol+"')\" id="+id+" "+ +// this is wrong - needs ontology name as well... "onclick=\"getTermInfo("+id+")\">"+term.getName()+"</li>\n"; } @@ -198,11 +201,13 @@ public void run() { while(true) { + System.out.println("checking for new files..."); // check for files... // sleep in milliseconds - sleep for 5 seconds for now (test) - //sleep(5000); + try { sleep(5000); } + catch (InterruptedException e) { System.out.println("interrupted"); } } } } Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-31 16:07:57 UTC (rev 107) @@ -23,7 +23,7 @@ <script type="text/javascript"> function setEntityOntology(selectedOntology) { if (selectedOntology == 'AO') { - ontologyName = 'Anatomy'; <!-- ZFA --> + ontologyName = 'ZF'; <!-- ZF Anatomy --> } else if (selectedOntology == 'GO') { ontologyName = 'GO'; } @@ -81,7 +81,7 @@ <!-- tr -- --> <!-- td --> - <!-- PATO --> + <!-- QUALITY --> <div style="clear: left;"> <!-- div width="20%" --> @@ -91,9 +91,9 @@ <label>Quality: </label> <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> - <input autocomplete="off" id="patoInput" name="patoInput" size="40" type="text" value="" /> + <input autocomplete="off" id="qualityInput" name="qualityInput" size="40" type="text" value="" /> </br> - <div class="auto_complete" id="pato_auto_complete"></div> + <div class="auto_complete" id="quality_auto_complete"></div> </fieldset> </div> @@ -108,8 +108,8 @@ <script type="text/javascript"> - <!-- this is the crucial javascript bit here, patoInput is the --> - <!-- input field, i pato_auto_complete is the div where--> + <!-- this is the crucial javascript bit here, qualityInput is the --> + <!-- input field, i quality_auto_complete is the div where--> <!--the auto completion will pop up, and the last param is the--> <!-- script that will does the fetching of terms --> <!-- Autocomp is in js/prototype/controls.js --> @@ -117,14 +117,14 @@ <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> - var complete = new Ajax.Autocompleter( 'patoInput', 'pato_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=pato',paramName: "userInput" }) - <!-- complete.options.defaultParams = "ontology=pato"; --> - <!-- complete.options.parameters = "ontology=pato"; --> - <!-- more params? 'ontology=pato&x=y&...' --> + var complete = new Ajax.Autocompleter( 'qualityInput', 'quality_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=quality',paramName: "userInput" }) + <!-- complete.options.defaultParams = "ontology=quality"; --> + <!-- complete.options.parameters = "ontology=quality"; --> + <!-- more params? 'ontology=quality&x=y&...' --> </script> <script type="text/javascript"> - var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) + var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=ZF',paramName: "userInput"}) </script> Modified: phenote/trunk/src/web/javascript/ncbo-term-info.js =================================================================== --- phenote/trunk/src/web/javascript/ncbo-term-info.js 2006-08-29 22:13:13 UTC (rev 106) +++ phenote/trunk/src/web/javascript/ncbo-term-info.js 2006-08-31 16:07:57 UTC (rev 107) @@ -33,7 +33,7 @@ // ontologyinfo is the div where the table goes for term info // note: this is a "get" not a post! (term comp is post) - //var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars, onComplete: document.forms[0].patoInput.value = '' } ); + //var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars, onComplete: document.forms[0].qualityInput.value = '' } ); // take out wipe out on complete var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars } ); // have to have [1] next to form item because the edit subform and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-29 22:13:17
|
Revision: 106 Author: mgibson Date: 2006-08-29 15:13:13 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=106&view=rev Log Message: ----------- so Command-V on mac wasnt working for paste - the reason is that the look & feel is set to java/metal - for 2 reasons - one there was a bug with auto combos on mac - and also because im hacking the look & feel for my auto complete mouse over listening anyways ctrl-V works actually - but i got Cmd V working - well more or less - it wipes out the field and then pastes in - so its not a true insert but good enough for now Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/CharFieldGui.java Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-29 19:59:29 UTC (rev 105) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-29 22:13:13 UTC (rev 106) @@ -1,8 +1,12 @@ package phenote.gui; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Container; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JTextField; @@ -126,9 +130,36 @@ // addGenericDocumentListener... textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); termPanel.addFieldGui(textField,parent); + + textField.addKeyListener(new TextKeyListener()); + } + private class TextKeyListener extends java.awt.event.KeyAdapter { + public void keyPressed(java.awt.event.KeyEvent e) { + System.out.println("got key event mod "+e.getKeyModifiersText(e.getModifiers())+" char "+e.getKeyChar()+" mod int "+e.getModifiers()); + // on a mac Command-V is paste. this aint so with java/metal look&feel + if (e.getKeyChar() == 'v' + && e.getKeyModifiersText(e.getModifiers()).equals("Command")) { + System.out.println("got cmd V paste"); + //System.getClipboard + Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + try { + Transferable t = c.getContents(null); // null? + //DataFlavor[] dfArr = t.getTransferDataFlavors(); + //for (DataFlavor df : dfArr) System.out.println("df "+df); + //System.out.println("clip "+c+" nm "+c.getName()+" cont "+c.getContents(null)+" trans data "+c.getContents(null).getTransferData(DataFlavor.stringFlavor)); + Object s = t.getTransferData(DataFlavor.stringFlavor); + // this isnt quite right as it should just insert the text not wipe + // it out - but probably sufficient for now? + if (s != null) + setText(s.toString()); + } catch (Exception ex) { System.out.println("failed paste "+ex); } + } + } + } + void setText(String text) { // set/getText interface to combo & text field? if (isCombo) comboBox.setText(text); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-29 19:59:33
|
Revision: 105 Author: mgibson Date: 2006-08-29 12:59:29 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=105&view=rev Log Message: ----------- pheno syntax file adapter now remembering directory of previous save or load - doesnt yet retain this over phenote sessions - need to store that in config file? or better yet history file - and have a list of history files - todo Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-29 19:31:57 UTC (rev 104) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-29 19:59:29 UTC (rev 105) @@ -110,7 +110,7 @@ tagStart = found ? m.start() : line.length(); if (found) tagEnd = m.end(); // dont need if not found (last one) String value = line.substring(valueStart,tagStart).trim(); - value = stripComments(value); + value = stripComments(value).trim(); //System.out.println("tag ."+tag+". val ."+value+"."); addTagValToChar(tag,value); } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-29 19:31:57 UTC (rev 104) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-29 19:59:29 UTC (rev 105) @@ -22,12 +22,15 @@ public class PhenoSyntaxFileAdapter implements DataAdapterI { + private File previousFile; + /** this should return CharacterList and caller should load CharListMan or CLM makes the call itself? */ public void load() { - File file = getFileFromUser(); + File file = getFileFromUser(previousFile); if (file == null) return; + previousFile = file; try { CharacterListI charList = new CharacterList(); @@ -51,14 +54,15 @@ } /** returns null if user fails to pick a file */ - private File getFileFromUser() { - return PhenoXmlAdapter.getFile(); // perhaps a util class + private File getFileFromUser(File dir) { + return PhenoXmlAdapter.getFileFromUser(dir); // perhaps a util class } public void commit(CharacterListI charList) { - File file = getFileFromUser(); + File file = getFileFromUser(previousFile); if (file == null) return; + previousFile = file; PrintWriter pw; try { Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-29 19:31:57 UTC (rev 104) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-29 19:59:29 UTC (rev 105) @@ -28,14 +28,16 @@ public class PhenoXmlAdapter implements DataAdapterI { private Set genotypesAlreadyAdded = new HashSet<String>(); + private File previousFile; public void load() {} public void commit(CharacterListI charList) { - File file = getFile(); + File file = getFileFromUser(previousFile); if (file == null) return; + previousFile = file; PhenosetDocument doc = PhenosetDocument.Factory.newInstance(); Phenoset phenoset = doc.addNewPhenoset(); @@ -56,9 +58,9 @@ } } - public static File getFile() { + public static File getFileFromUser(File dir) { // todo - remember last accessed dir - JFileChooser fileChooser = new JFileChooser(); + JFileChooser fileChooser = new JFileChooser(dir); // todo - file filter - only .xml or .phenoxml? int returnVal = fileChooser.showOpenDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-29 19:32:08
|
Revision: 104 Author: mgibson Date: 2006-08-29 12:31:57 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=104&view=rev Log Message: ----------- pheno syntax adapter now reads & writes term names in comments actually will ignore any comments on read-in Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-29 18:11:25 UTC (rev 103) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-29 19:31:57 UTC (rev 104) @@ -70,7 +70,9 @@ private String makeValue(OBOClass term) { // return idPrefixAndName(term); // michael wants ids... - return term.getID(); + //return term.getID(); + // id & commented out name for readability + return term.getID() + " /*" + term.getName() + "*/"; } /** Merges id prefix and name, so for id GO:1234 with name "growth" returns @@ -108,11 +110,17 @@ tagStart = found ? m.start() : line.length(); if (found) tagEnd = m.end(); // dont need if not found (last one) String value = line.substring(valueStart,tagStart).trim(); + value = stripComments(value); //System.out.println("tag ."+tag+". val ."+value+"."); addTagValToChar(tag,value); } } + private String stripComments(String value) { + value = value.replaceAll("/\\*.*\\*/",""); + return value; + } + class SyntaxParseException extends Exception { private String syntaxLine; SyntaxParseException(String syntaxLine) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |