[kepler-dev] consolidating org.ecoinformatics with org.kepler
Chad Berkley
berkley at nceas.ucsb.edu
Wed Aug 26 10:58:59 PDT 2009
Yeah, kepler.org is being squatted on. I wonder how much it would cost
to get it and if kepler/core has the money to pay for it. I think you
got an appraisal a while back, right Christopher? I can't remember how
much it was. It would be a nice domain to have.
chad
Christopher Brooks wrote:
> I hate to be picky, but we don't own the kepler.org domain name,
> so technically, this is not right. That said, I'm not opposed.
> However, if someone gets kepler.org and starts writing Java
> code, then we are technically squatting on their java classpath
> and a person would not be able to use their code with our code.
>
> I don't think this is a huge issue, and we could probably go
> ahead with using org.kepler, but I would not personally do it.
>
> Comments?
>
> _Christopher
>
> Chad Berkley wrote:
>> Hi,
>>
>> In an effort to simplify the code base, I'm merging some classes in
>> the org.ecoinformatics.* package to the org.kepler.* package. I've
>> changed the files below. I noticed that the three files I moved
>> (org.ecoinformatics.util.Config, DBConnectionFactory and
>> DelimitedReader) were overridden in at least one module. I did not
>> change this override, so if you are overriding these files, you may
>> need to move your files.
>>
>> Let me know if anyone sees any problems related to this.
>>
>> chad
>>
>>
>> -------- Original Message --------
>> Subject: [kepler-code] r20471 - in trunk/modules:
>> actors/src/org/ecoinformatics/seek/datasource/darwincore
>> actors/src/org/ecoinformatics/seek/datasource/eml/eml2
>> actors/src/org/geon actors/src/org/kepler/dataproxy/datasource/geon
>> actors/src/org/kepler/dataproxy/metadata/ADN actors/src/org/sdm/spa
>> actors/src/org/srb cacheviewer/src/org/daks/cacheviewer/gui
>> component-library/src/org/kepler/objectmanager/library
>> core/src/org/ecoinformatics/util core/src/org/kepler/kar
>> core/src/org/kepler/objectmanager/cache
>> core/src/org/kepler/objectmanager/data
>> core/src/org/kepler/objectmanager/data/text
>> core/src/org/kepler/objectmanager/lsid core/src/org/kepler/util
>> data-handling/src/org/ecoinformatics/seek/dataquery
>> ecogrid/src/org/ecoinformatics/seek/datasource
>> ecogrid/src/org/ecoinformatics/seek/ecogrid
>> ecogrid/src/org/ecoinformatics/seek/ecogrid/quicksearch
>> ecogrid/src/org/kepler/authentication/gui gui/src/org/kepler/gui
>> loader/src/org/kepler/gui module-manager/src/org/kepler/modulemanager
>> ppod-gui/src/ org/daks/ppod/gui ppod-gui/src/org/kepler/gui
>> ppod-gui-1.0/src/org/daks/ppod/gui ppod-gui-1.0/src/org/kepler/gui
>> reporting/src/org/kepler/kar/handlers
>> reporting/src/org/kepler/reporting/rio/util util/src/util
>> Date: Wed, 26 Aug 2009 10:38:15 -0700 (PDT)
>> From: berkley at ecoinformatics.org
>> To: kepler-cvs at kepler-project.org
>>
>> Author: berkley
>> Date: 2009-08-26 10:38:14 -0700 (Wed, 26 Aug 2009)
>> New Revision: 20471
>>
>> Added:
>> trunk/modules/core/src/org/kepler/util/Config.java
>> trunk/modules/core/src/org/kepler/util/DBConnectionFactory.java
>> trunk/modules/core/src/org/kepler/util/DelimitedReader.java
>> Removed:
>> trunk/modules/core/src/org/ecoinformatics/util/Config.java
>>
>> trunk/modules/core/src/org/ecoinformatics/util/DBConnectionFactory.java
>> trunk/modules/core/src/org/ecoinformatics/util/DelimitedReader.java
>> Modified:
>>
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/darwincore/DarwinCoreSchema.java
>>
>>
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/EML2MetadataSpecification.java
>>
>>
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/Eml200DataSource.java
>>
>> trunk/modules/actors/src/org/geon/FilterUI.java
>>
>> trunk/modules/actors/src/org/kepler/dataproxy/datasource/geon/GEONDatabaseResource.java
>>
>>
>> trunk/modules/actors/src/org/kepler/dataproxy/metadata/ADN/ADNMetadataSpecification.java
>>
>> trunk/modules/actors/src/org/sdm/spa/BrowserUI.java
>> trunk/modules/actors/src/org/srb/SRBCreateQueryInterface.java
>>
>> trunk/modules/cacheviewer/src/org/daks/cacheviewer/gui/MenuActions.java
>>
>> trunk/modules/component-library/src/org/kepler/objectmanager/library/LibraryManager.java
>>
>> trunk/modules/core/src/org/kepler/kar/KARBuilder.java
>> trunk/modules/core/src/org/kepler/kar/KARCacheManager.java
>>
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheManager.java
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheUtil.java
>>
>> trunk/modules/core/src/org/kepler/objectmanager/cache/LocalRepositoryManager.java
>>
>>
>> trunk/modules/core/src/org/kepler/objectmanager/data/DataTypeResolver.java
>>
>>
>> trunk/modules/core/src/org/kepler/objectmanager/data/text/TextComplexFormatDataReader.java
>>
>>
>> trunk/modules/core/src/org/kepler/objectmanager/lsid/LSIDGenerator.java
>> trunk/modules/core/src/org/kepler/util/AuthNamespace.java
>> trunk/modules/core/src/org/kepler/util/DotKeplerManager.java
>>
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBDataTypeResolver.java
>>
>>
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTableExistenceChecker.java
>>
>>
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTablesGenerator.java
>>
>>
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DelimiterResolver.java
>>
>>
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/HsqlDataQueryAction.java
>>
>>
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java
>>
>>
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/DocumentType.java
>>
>>
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/EcoGridServicesController.java
>>
>>
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/SearchRegistryAction.java
>>
>>
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/quicksearch/SearchQueryGenerator.java
>>
>>
>> trunk/modules/ecogrid/src/org/kepler/authentication/gui/LDAPLoginGUI.java
>> trunk/modules/gui/src/org/kepler/gui/KeplerApplication.java
>> trunk/modules/gui/src/org/kepler/gui/ViewManager.java
>> trunk/modules/loader/src/org/kepler/gui/KeplerInitializer.java
>>
>> trunk/modules/module-manager/src/org/kepler/modulemanager/Restarter.java
>> trunk/modules/ppod-gui-1.0/src/org/daks/ppod/gui/WorkspacePane.java
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/KeplerInitializer.java
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/TabbedLibraryPane.java
>> trunk/modules/ppod-gui/src/org/daks/ppod/gui/WorkspacePane.java
>> trunk/modules/ppod-gui/src/org/kepler/gui/KeplerInitializer.java
>>
>> trunk/modules/reporting/src/org/kepler/kar/handlers/ReportInstanceKAREntryHandler.java
>>
>>
>> trunk/modules/reporting/src/org/kepler/reporting/rio/util/ImageUtil.java
>> trunk/modules/util/src/util/StaticUtil.java
>> Log:
>> removing the org.ecoinformatics.util package and moving the member
>> classes to org.kepler.util. just trying to simplify the packages and
>> consolidate classes into more easy-to-find packages.
>>
>> Modified:
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/darwincore/DarwinCoreSchema.java
>>
>> ===================================================================
>> ---
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/darwincore/DarwinCoreSchema.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/darwincore/DarwinCoreSchema.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -39,7 +39,7 @@
>> import org.ecoinformatics.ecogrid.EcogridUtils;
>> import org.ecoinformatics.ecogrid.EcogridUtilsNamedNodeIterator;
>> import org.ecoinformatics.seek.datasource.EcogridDataCacheItem;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.objectmanager.cache.DataCacheListener;
>> import org.kepler.objectmanager.cache.DataCacheManager;
>> import org.kepler.objectmanager.cache.DataCacheObject;
>>
>> Modified:
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/EML2MetadataSpecification.java
>>
>> ===================================================================
>> ---
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/EML2MetadataSpecification.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/EML2MetadataSpecification.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -54,7 +54,7 @@
>> import org.ecoinformatics.seek.ecogrid.quicksearch.SearchQueryGenerator;
>> import org.ecoinformatics.seek.ecogrid.quicksearch.SortableResultRecord;
>> import
>> org.ecoinformatics.seek.ecogrid.quicksearch.SortableResultRecordComparator;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.xml.sax.SAXException;
>>
>> import ptolemy.kernel.CompositeEntity;
>>
>> Modified:
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/Eml200DataSource.java
>>
>> ===================================================================
>> ---
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/Eml200DataSource.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/actors/src/org/ecoinformatics/seek/datasource/eml/eml2/Eml200DataSource.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -75,7 +75,7 @@
>> import org.ecoinformatics.seek.querybuilder.DBQueryDef;
>> import org.ecoinformatics.seek.querybuilder.DBQueryDefParserEmitter;
>> import org.ecoinformatics.seek.querybuilder.DBSchemaParserEmitter;
>> -import org.ecoinformatics.util.DelimitedReader;
>> +import org.kepler.util.DelimitedReader;
>> import org.kepler.actor.preview.Previewable;
>> import org.kepler.objectmanager.ActorMetadata;
>> import org.kepler.objectmanager.cache.ActorCacheObject;
>>
>> Modified: trunk/modules/actors/src/org/geon/FilterUI.java
>> ===================================================================
>> --- trunk/modules/actors/src/org/geon/FilterUI.java 2009-08-26
>> 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/actors/src/org/geon/FilterUI.java 2009-08-26
>> 17:38:14 UTC (rev 20471)
>> @@ -37,7 +37,7 @@
>> import java.net.URL;
>> import java.util.Vector;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> import ptolemy.actor.TypedAtomicActor;
>> import ptolemy.actor.TypedIOPort;
>>
>> Modified:
>> trunk/modules/actors/src/org/kepler/dataproxy/datasource/geon/GEONDatabaseResource.java
>>
>> ===================================================================
>> ---
>> trunk/modules/actors/src/org/kepler/dataproxy/datasource/geon/GEONDatabaseResource.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/actors/src/org/kepler/dataproxy/datasource/geon/GEONDatabaseResource.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -47,7 +47,7 @@
>> import org.ecoinformatics.seek.datasource.EcogridMetaDataCacheItem;
>> import org.ecoinformatics.seek.ecogrid.quicksearch.ResultTreeRoot;
>> import org.ecoinformatics.seek.querybuilder.DBQueryDef;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.geon.DatabaseQuery;
>> import org.kepler.dataproxy.datasource.DataSourceInterface;
>> import org.kepler.dataproxy.metadata.ADN.ADNMetadataSpecification;
>>
>> Modified:
>> trunk/modules/actors/src/org/kepler/dataproxy/metadata/ADN/ADNMetadataSpecification.java
>>
>> ===================================================================
>> ---
>> trunk/modules/actors/src/org/kepler/dataproxy/metadata/ADN/ADNMetadataSpecification.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/actors/src/org/kepler/dataproxy/metadata/ADN/ADNMetadataSpecification.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -56,7 +56,7 @@
>> import org.ecoinformatics.seek.ecogrid.quicksearch.SearchQueryGenerator;
>> import org.ecoinformatics.seek.ecogrid.quicksearch.SortableResultRecord;
>> import
>> org.ecoinformatics.seek.ecogrid.quicksearch.SortableResultRecordComparator;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.dataproxy.datasource.geon.GEONDatabaseResource;
>> import org.kepler.dataproxy.datasource.geon.GEONShpResource;
>> import org.xml.sax.SAXException;
>>
>> Modified: trunk/modules/actors/src/org/sdm/spa/BrowserUI.java
>> ===================================================================
>> --- trunk/modules/actors/src/org/sdm/spa/BrowserUI.java 2009-08-26
>> 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/actors/src/org/sdm/spa/BrowserUI.java 2009-08-26
>> 17:38:14 UTC (rev 20471)
>> @@ -45,7 +45,7 @@
>> import java.util.Set;
>> import java.util.TreeSet;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> import ptolemy.actor.IOPort;
>> import ptolemy.actor.TypedAtomicActor;
>>
>> Modified: trunk/modules/actors/src/org/srb/SRBCreateQueryInterface.java
>> ===================================================================
>> --- trunk/modules/actors/src/org/srb/SRBCreateQueryInterface.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/actors/src/org/srb/SRBCreateQueryInterface.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -28,7 +28,7 @@
>> import java.util.Set;
>> import java.util.TreeSet;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> import ptolemy.actor.NoTokenException;
>> import ptolemy.actor.TypedAtomicActor;
>>
>> Modified:
>> trunk/modules/cacheviewer/src/org/daks/cacheviewer/gui/MenuActions.java
>> ===================================================================
>> ---
>> trunk/modules/cacheviewer/src/org/daks/cacheviewer/gui/MenuActions.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/cacheviewer/src/org/daks/cacheviewer/gui/MenuActions.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -1,8 +1,8 @@
>> package org.daks.cacheviewer.gui;
>>
>> import org.daks.cacheviewer.util.DataModel;
>> -import org.ecoinformatics.util.DBConnection;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnection;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>>
>>
>> Modified:
>> trunk/modules/component-library/src/org/kepler/objectmanager/library/LibraryManager.java
>>
>> ===================================================================
>> ---
>> trunk/modules/component-library/src/org/kepler/objectmanager/library/LibraryManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/component-library/src/org/kepler/objectmanager/library/LibraryManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -18,7 +18,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.icon.ComponentEntityConfig;
>> import org.kepler.kar.KARCacheManager;
>> import org.kepler.kar.KARFile;
>>
>> Deleted: trunk/modules/core/src/org/ecoinformatics/util/Config.java
>> ===================================================================
>> --- trunk/modules/core/src/org/ecoinformatics/util/Config.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/core/src/org/ecoinformatics/util/Config.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -1,515 +0,0 @@
>> -/**
>> - * '$RCSfile$'
>> - *
>> - * '$Author$'
>> - * '$Date$'
>> - * '$Revision$'
>> - *
>> - * For Details: http://kepler.ecoinformatics.org
>> - *
>> - * Copyright (c) 2003 The Regents of the University of California.
>> - * All rights reserved.
>> - *
>> - * Permission is hereby granted, without written agreement and without
>> - * license or royalty fees, to use, copy, modify, and distribute this
>> - * software and its documentation for any purpose, provided that the
>> - * above copyright notice and the following two paragraphs appear in
>> - * all copies of this software.
>> - *
>> - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> - * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> - * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> - * OF SUCH DAMAGE.
>> - *
>> - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> - * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> - * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> - */
>> -
>> -package org.ecoinformatics.util;
>> -
>> -import java.io.File;
>> -import java.io.FileInputStream;
>> -import java.io.FileNotFoundException;
>> -import java.io.IOException;
>> -import java.io.InputStream;
>> -import java.net.URI;
>> -import java.net.URL;
>> -import java.util.Collections;
>> -import java.util.Hashtable;
>> -import java.util.Iterator;
>> -import java.util.List;
>> -import java.util.Map;
>> -import java.util.StringTokenizer;
>> -import java.util.Vector;
>> -import java.util.jar.Attributes;
>> -import java.util.jar.JarInputStream;
>> -import java.util.jar.Manifest;
>> -
>> -import javax.xml.transform.TransformerException;
>> -
>> -import org.apache.commons.logging.Log;
>> -import org.apache.commons.logging.LogFactory;
>> -import org.apache.xpath.XPathAPI;
>> -import org.w3c.dom.Node;
>> -import org.w3c.dom.NodeList;
>> -
>> -import edu.ucsb.nceas.configxml.ConfigXML;
>> -import edu.ucsb.nceas.configxml.exception.ElementNotFoundException;
>> -import edu.ucsb.nceas.configxml.exception.IndexTooLargeException;
>> -
>> -/**
>> - *
>> - * configuration file routines
>> - *
>> - */
>> -public class Config {
>> - private static final Log log =
>> LogFactory.getLog(Config.class.getName());
>> - private static final boolean isDebugging = log.isDebugEnabled();
>> - - private static final String configfilename =
>> "configurations/config.xml";
>> -
>> - private static final String settingsdir = ".kepler";
>> -
>> - // Define useful static strings. At some point in time, these
>> could be moved
>> - // into the config.xml file, environment variable, or something else
>> - // which could move this directory to another location.
>> -
>> - // KEPLER_USER_DIR is returned by Config.getUserDirPath().
>> - private static final String KEPLER_USER_DIR = System
>> - .getProperty("user.home")
>> - + File.separator + settingsdir + File.separator;
>> -
>> - // KEPLER_CACHE_DIR is returned by Config.getCacheDirPath().
>> - private static final String KEPLER_CACHE_DIR = KEPLER_USER_DIR +
>> "cache"
>> - + File.separator;
>> -
>> - /**
>> - * The singleton instance.
>> - */
>> - private static Config configure;
>> - static {
>> - try {
>> - configure = new Config();
>> - } catch (FileNotFoundException ex) {
>> - throw new ExceptionInInitializerError(ex);
>> - }
>> - }
>> -
>> - // Instance variables.
>> -
>> - /**
>> - * The underlying ConfigXML object.
>> - */
>> - private ConfigXML config;
>> -
>> - /**
>> - * Error indicator. Set to true if ConfigXML has problems.
>> - */
>> - private boolean error = false;
>> -
>> - /**
>> - * Method for get object as a singleton class
>> - *
>> - * @return Config
>> - */
>> - public static Config getInstance() {
>> - return configure;
>> - }
>> -
>> - /*
>> - * Constructor for ConfigDatasource.
>> - *
>> - * @throws FileNotFoundException
>> - *
>> - * @throws Exception
>> - */
>> - private Config() throws FileNotFoundException {
>> -
>> - InputStream is = null;
>> -
>> - URL kernelConfigURL = ClassLoader.getSystemClassLoader()
>> - .getResource(configfilename);
>> - - File kernelConfigFile = null;
>> - try
>> - {
>> - kernelConfigFile = new File(new URI(kernelConfigURL.toString()));
>> - }
>> - catch(Exception e)
>> - {
>> - throw new FileNotFoundException("Error getting config file from
>> " +
>> - "classpath: " + e.getMessage());
>> - }
>> -
>> - //if (kernelConfig == null) {
>> - if (!kernelConfigFile.exists()) {
>> - throw new FileNotFoundException("Failed to find " +
>> configfilename + " in the classpath: "
>> - + _classpath());
>> - }
>> - log.debug("Opening config.xml file found at: " +
>> kernelConfigFile.getAbsolutePath());
>> - try {
>> - is = (InputStream) new FileInputStream(kernelConfigFile);
>> - if (is == null) {
>> - throw new FileNotFoundException("Failed to find \""
>> - + configfilename + "\" as a resource in the
>> classpath: "
>> - + _classpath());
>> - }
>> - config = new ConfigXML(is,
>> kernelConfigFile.getAbsolutePath());
>> - } catch (FileNotFoundException fnfe) {
>> - error = true;
>> - FileNotFoundException exception = new FileNotFoundException(
>> - "Config file not found at
>> \""
>> - + configfilename
>> - + "\" in the classpath: "
>> - + _classpath());
>> - exception.initCause(fnfe);
>> - throw exception;
>> - } catch (Exception e) {
>> - error = true;
>> - throw new RuntimeException("Unspecified error creating
>> config "
>> - + "object from \"" + configfilename + "\"", e);
>> - } finally {
>> - if (is != null) {
>> - try {
>> - is.close();
>> - } catch (IOException ex) {
>> - throw new RuntimeException("Failed to close \""
>> - + configfilename + "\"", ex);
>> - }
>> - }
>> - }
>> -
>> - }
>> -
>> - /**
>> - * get the classpath from a manifest file
>> - */
>> - private String processManifestClasspath(String classpath) throws
>> IOException
>> - {
>> - File f = new File(classpath);
>> - JarInputStream jar = new JarInputStream(new FileInputStream(f));
>> - Manifest m = jar.getManifest();
>> - Attributes mainAtts = m.getMainAttributes();
>> - Iterator itt = mainAtts.entrySet().iterator();
>> - while(itt.hasNext())
>> - { //find the classpath in the manifest
>> - Map.Entry entry = (Map.Entry)itt.next();
>> - if((((Object)entry.getKey()).toString()).equals("Class-Path"))
>> - {
>> - classpath = (String)entry.getValue();
>> - break;
>> - }
>> - //System.out.println("name: " +
>> ((Object)entry.getKey()).toString());
>> - //System.out.println("val: " +
>> ((Object)entry.getValue()).toString());
>> - }
>> -
>> - //change the manifest classpath into a normal looking classpath
>> - classpath = classpath.replaceAll("\\s",
>> System.getProperty("path.separator"));
>> - //System.out.println("classpath: " + classpath);
>> - return classpath;
>> - }
>> -
>> - /**
>> - * Method to get a string value from config.xml base on given
>> element path
>> - *
>> - * @param path
>> - * String
>> - * @return String
>> - */
>> - public static String getValue(String path) {
>> - Config configInstance = Config.getInstance();
>> - return configInstance.getValueFromPath(path);
>> - }
>> -
>> - private String getValueFromPath(String path) {
>> - if (isDebugging) {
>> - log.debug(path);
>> - }
>> - String value = null;
>> - if (error) {
>> - return value;
>> - }
>> - if (path == null) {
>> - return value;
>> - }
>> - try {
>> - Vector valueVector = config.getValuesForPath(path);
>> - value = (String) valueVector.elementAt(0);
>> - } catch (ElementNotFoundException e1) {
>> - log.debug("Element " + path + " not found");
>> - } catch (Exception e2) {
>> - log.error("Exception occurred:", e2);
>> - }
>> - if (isDebugging) {
>> - log.debug(value);
>> - }
>> - return value;
>> - }// getValues
>> -
>> - /**
>> - * Method returns an unmodifiable list of values from config.xml
>> base on
>> - * given path. If the argument is null or not found in
>> config.xml, return
>> - * EMPTY_LIST.
>> - *
>> - * @param path
>> - * String
>> - * @return Vector
>> - */
>> - public static List getList(String path) {
>> - Config configInstance = Config.getInstance();
>> - return configInstance.getListFromPath(path);
>> - }
>> -
>> - private List getListFromPath(String path) {
>> - List value = Collections.EMPTY_LIST;
>> - if (error) {
>> - return value;
>> - }
>> - if (path == null) {
>> - return value;
>> - }
>> - try {
>> - value =
>> Collections.unmodifiableList(config.getValuesForPath(path));
>> - } catch (ElementNotFoundException e1) {
>> - log.debug("Element " + path + " not found");
>> - } catch (Exception e2) {
>> - log.error("Exception occurred:", e2);
>> - }
>> -
>> - return value;
>> - }// getList
>> -
>> - /**
>> - * Method to get unmodifiable map for some given pathes in
>> config.xml. If
>> - * the arguments are invalid (either null) or not found, return
>> an empty
>> - * map. Here is the segment of config.xml: <parenetElement>
>> - * <keyElement>key1</keyElement> <valueElement>value1</valueElement>
>> - * </parentElement> <parentElement> <keyElement>key2</keyElement>
>> - * <valueElement>value2</valueElement> </parentElement> The
>> parentPath can
>> - * be "//parentElement", keyPath should be "./keyElement", and
>> valuePath
>> - * should be "./valuePath".
>> - *
>> - * @param parentPath
>> - * String
>> - * @param keyPath
>> - * String
>> - * @param valuePath
>> - * String
>> - * @throws ElementNotFoundException
>> - * @throws Exception
>> - * @return Hashtable
>> - */
>> - public static Map getMap(String parentPath, String keyPath,
>> String valuePath) {
>> - Config configInstance = Config.getInstance();
>> - return configInstance.getMapFromPath(parentPath, keyPath,
>> valuePath);
>> - }
>> -
>> - private Map getMapFromPath(String parentPath, String keyPath,
>> - String valuePath) {
>> - Map map = Collections.EMPTY_MAP;
>> - if (error) {
>> - return map;
>> - }
>> - if (parentPath == null || keyPath == null || valuePath ==
>> null) {
>> - return map;
>> - }
>> - NodeList nl = null;
>> - try {
>> - nl = config.getPathContent(parentPath);
>> - } catch (ElementNotFoundException e1) {
>> - log.debug("Element " + parentPath + " not found");
>> - return map;
>> - } catch (TransformerException e2) {
>> - log.error("Transfomer Exception when reading parentPath "
>> - + parentPath, e2);
>> - return map;
>> - }
>> - // At this point nl != null because we didn't get an
>> - // ElementNotFoundException
>> - map = new Hashtable();
>> - try {
>> - for (int i = 0; i < nl.getLength(); i++) {
>> - Node n = nl.item(i);
>> - Node keyNode = XPathAPI.selectSingleNode(n, keyPath);
>> - Node valueNode = XPathAPI.selectSingleNode(n,
>> valuePath);
>> - if (keyNode == null || valueNode == null) {
>> - log.debug("keyNode or valueNode not found at
>> iteration "
>> - + i);
>> - continue;
>> - }
>> -
>> - String keyNodeValue =
>> keyNode.getFirstChild().getNodeValue();
>> - String valueNodeValue = valueNode.getFirstChild()
>> - .getNodeValue();
>> - if (keyNodeValue == null || valueNodeValue == null) {
>> - log
>> - .debug("keyNodeValue or valueNodeValue is
>> null at iteration "
>> - + i);
>> - continue;
>> - }
>> - log.debug("The value of " + keyPath + " " + keyNodeValue
>> - + " and " + " the value of " + valuePath + " "
>> - + valueNodeValue + " are put into mapping");
>> -
>> - map.put(keyNodeValue, valueNodeValue);
>> - } // for
>> - } catch (TransformerException e) {
>> - log.error("Transfomer Exception in loop ", e);
>> - }
>> - return Collections.unmodifiableMap(map);
>> - }// getMap
>> -
>> - /**
>> - * Get a node list base on the given xpath in config file
>> - *
>> - * @param path
>> - * String the xpath
>> - * @return NodeList
>> - */
>> - public static NodeList getNodeListFromPath(String path) {
>> - Config configInstance = Config.getInstance();
>> - return configInstance.getNodeListFromXPath(path);
>> - }
>> -
>> - /*
>> - * This method will get a node list from config file
>> - */
>> - private NodeList getNodeListFromXPath(String xpath) {
>> - NodeList list = null;
>> - if (error) {
>> - return list;
>> - }
>> - try {
>> - list = config.getPathContent(xpath);
>> - } catch (ElementNotFoundException e) {
>> - log.debug("Element Not found for " + xpath);
>> - } catch (TransformerException e2) {
>> - log.error("Transformer Exception for " + xpath);
>> - }
>> - return list;
>> - }
>> -
>> - /**
>> - * Method to get error state
>> - */
>> - public boolean getErrorState() {
>> - return error;
>> - }
>> -
>> - /**
>> - * Returns the path of the Kepler hidden working directory
>> terminated with
>> - * File.seperator. This directory is current coded to be
>> - * ${system.home}/.kepler.
>> - *
>> - * @return the path to the .kepler directory.
>> - * @deprecated use DotKeplerManager.getDotKeplerPath() instead.
>> - */
>> - public static String getUserDirPath() {
>> - return KEPLER_USER_DIR;
>> - }
>> -
>> - /**
>> - * Returns the path to a subdirectory of the working directory.
>> The pathname
>> - * is normalized to use the system style File.separator.
>> - *
>> - *
>> - * @param path
>> - * a subdirectory of the working directory
>> - * @return normalized pathname of the subdirectory.
>> - * @deprecated use DotKeplerManager.getDotKeplerPath(String)
>> instead.
>> - */
>> - public static String getUserDirPath(String path) {
>> - String pdir = KEPLER_USER_DIR + path;
>> - if (pdir.endsWith(File.separator)) {
>> - return pdir;
>> - } else {
>> - return pdir + File.separator;
>> - }
>> - }
>> -
>> - /**
>> - * Returns the path to the Cache working directory terminated with
>> - * File.seperator. This directory is currently in getUserDirPath() +
>> - * "cache".
>> - *
>> - * @return the path to the cache directory
>> - * @deprecated use DotKeplerManager.getCacheDirPath()
>> - */
>> - public static String getCacheDirPath() {
>> - return KEPLER_CACHE_DIR;
>> - }
>> -
>> - /**
>> - * Method save. - pass through to ConfigXML member
>> - *
>> - * @throws Exception
>> - */
>> - public void save() throws Exception {
>> - config.save();
>> - }
>> -
>> - /**
>> - * Method set. - pass through to ConfigXML member
>> - *
>> - * @param arg1
>> - * @param arg2
>> - * @param arg3
>> - * @throws ElementNotFoundException
>> - */
>> - public void set(String arg1, int arg2, String arg3)
>> - throws ElementNotFoundException {
>> - config.set(arg1, arg2, arg3);
>> - }
>> -
>> - /**
>> - * Method deleteSubFields. - pass through to ConfigXML member
>> - *
>> - * @param parentName
>> - * @param i
>> - * @throws IndexTooLargeException
>> - */
>> - public void deleteSubFields(String parentName, int i)
>> - throws IndexTooLargeException {
>> - config.deleteSubFields(parentName, i);
>> - }
>> -
>> - /**
>> - * Method addSubFields. - pass through to ConfigXML member
>> - *
>> - * @param parentName
>> - * @param i
>> - * @param childName
>> - * @param value
>> - * @throws IndexTooLargeException
>> - */
>> - public void addSubField(String parentName, int i, String childName,
>> - String value) throws IndexTooLargeException {
>> - config.addSubField(parentName, i, childName, value);
>> - }
>> -
>> - /** Return the classpath as a string.
>> - * @return the classpath
>> - */
>> - private String _classpath() {
>> - StringBuffer classpath = new StringBuffer();
>> - try {
>> - String cp = System.getProperty("java.class.path");
>> - StringTokenizer st = new StringTokenizer(cp, System
>> - .getProperty("path.separator"));
>> - while (st.hasMoreTokens()) {
>> - if (classpath.length() > 0) {
>> - classpath.append(System.getProperty("path.separator"));
>> - }
>> - classpath.append((String)st.nextToken());
>> - }
>> - } catch (Exception ex) {
>> - classpath.append(ex.toString());
>> - }
>> - return classpath.toString();
>> - }
>> -}
>>
>> Deleted:
>> trunk/modules/core/src/org/ecoinformatics/util/DBConnectionFactory.java
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/ecoinformatics/util/DBConnectionFactory.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/ecoinformatics/util/DBConnectionFactory.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -1,173 +0,0 @@
>> -/**
>> - * '$RCSfile$'
>> - *
>> - * '$Author$'
>> - * '$Date$'
>> - * '$Revision$'
>> - *
>> - * For Details: http://kepler.ecoinformatics.org
>> - *
>> - * Copyright (c) 2003 The Regents of the University of California.
>> - * All rights reserved.
>> - *
>> - * Permission is hereby granted, without written agreement and without
>> - * license or royalty fees, to use, copy, modify, and distribute this
>> - * software and its documentation for any purpose, provided that the
>> - * above copyright notice and the following two paragraphs appear in
>> - * all copies of this software.
>> - *
>> - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> - * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> - * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> - * OF SUCH DAMAGE.
>> - *
>> - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> - * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> - * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> - */
>> -
>> -package org.ecoinformatics.util;
>> -
>> -import java.io.File;
>> -import java.sql.Connection;
>> -import java.sql.SQLException;
>> -
>> -import javax.sql.DataSource;
>> -
>> -import org.apache.commons.logging.Log;
>> -import org.apache.commons.logging.LogFactory;
>> -import org.hsqldb.Server;
>> -import org.hsqldb.jdbc.jdbcDataSource;
>> -import org.kepler.util.DotKeplerManager;
>> -
>> -/**
>> - * DBConnectionFactory creates connections to the hsql database.
>> - * It launches HSQL in "Server" mode and creates a DataSource using
>> the configured
>> - * username, password, and jdbc connection string.
>> - * While it does not provide database connection pooling, it does allow
>> - * multiple simultaneous connections to be made from different JVMs.
>> - *
>> - * @author Kevin Ruland
>> - * @author Ben Leinfelder
>> - *
>> - */
>> -public class DBConnectionFactory {
>> -
>> - private static final String USERNAMEPATH =
>> "//sqlEngine[sqlEngineName=\"hsql\"]/userName";
>> - private static final String PASSWORDPATH =
>> "//sqlEngine[sqlEngineName=\"hsql\"]/password";
>> -
>> - private static String username;
>> - private static String password;
>> - private static String dbName;
>> - private static String dbNamePath;
>> - private static String url;
>> - private static DataSource dataSource;
>> - private static Server server;
>> - - private static Log log =
>> LogFactory.getLog(DBConnectionFactory.class);
>> -
>> - static {
>> - username = Config.getValue(USERNAMEPATH);
>> - password = Config.getValue(PASSWORDPATH);
>> - dbName = "hsqldb";
>> - dbNamePath = DotKeplerManager.getInstance().getCacheDirPath()
>> - + "cachedata" + File.separator + dbName;
>> - - //using the "server" mode to allow multiple JVMs
>> simultaneous access
>> - url = "jdbc:hsqldb:hsql://localhost/" + dbName;
>> - //url = "jdbc:hsqldb:" + dbNamePath;
>> - - server = new Server();
>> - }
>> -
>> - /**
>> - * Method to get a connection to the internal DB.
>> - *
>> - * @throws SQLException
>> - * If there is a problem creating the connection. One
>> possible
>> - * solution is to remove the directory named by
>> - * Config.getCacheDirPath().
>> - * @throws ClassNotFoundException
>> - * @return Connection
>> - */
>> - public static Connection getDBConnection() throws SQLException,
>> - ClassNotFoundException {
>> - return getDBConnection(username, password);
>> - }
>> -
>> - /** Stop the HSQL Server. */
>> - public static void shutdownDBServer() {
>> - server.stop();
>> - }
>> -
>> - private static Connection getDBConnection(String userName, String
>> password)
>> - throws SQLException, ClassNotFoundException {
>> -
>> - Connection conn = null;
>> - try {
>> - conn = dataSource.getConnection();
>> - } catch (Exception e) {
>> - //start the server
>> - launchDBServer();
>> - initDataSource();
>> - }
>> - if (conn != null) {
>> - return conn;
>> - }
>> - //or try again
>> - try {
>> - conn = dataSource.getConnection();
>> - return conn;
>> - } catch (SQLException ex) {
>> - SQLException sqlException = new SQLException(
>> - "Failed to connect to url \""
>> - + url
>> - + "\" as user \""
>> - + userName
>> - + ". Perhaps there was an error launching
>> the db server. "
>> - + "In addition, sometimes the database "
>> - + "cache can become corrupt, so another "
>> - + "solution is to remove the \"" +
>> dbNamePath
>> - + "\" directory.");
>> - sqlException.setNextException(ex);
>> - throw sqlException;
>> - }
>> - }
>> - - /**
>> - * DataSources are "preferred" over DriverManagers..
>> - * @see
>> http://hsqldb.org/doc/src/org/hsqldb/jdbc/jdbcDataSource.html
>> - */
>> - private static void initDataSource() {
>> - //use the simple datasource provided by HSQL
>> - jdbcDataSource ds = new jdbcDataSource();
>> - ds.setDatabase(url);
>> - ds.setUser(username);
>> - ds.setPassword(password);
>> - dataSource = ds;
>> - }
>> - - /**
>> - * Starts the HSQL Server in the first Kepler JVM
>> - * Subsequent JVMs will encounter a non-fatal BindException
>> - * and will carry on, connecting with the first Server
>> - * @see http://hsqldb.org/doc/src/org/hsqldb/Server.html
>> - *
>> - */
>> - private static void launchDBServer() {
>> - if (!log.isDebugEnabled()) {
>> - server.setLogWriter(null);
>> - server.setErrWriter(null);
>> - }
>> - server.setDatabasePath(0, dbNamePath);
>> - server.setDatabaseName(0, dbName);
>> - server.setSilent(true);
>> - server.setTrace(false);
>> - server.setNoSystemExit(true);
>> - server.start();
>> - }
>> -}
>>
>> Deleted:
>> trunk/modules/core/src/org/ecoinformatics/util/DelimitedReader.java
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/ecoinformatics/util/DelimitedReader.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/ecoinformatics/util/DelimitedReader.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -1,517 +0,0 @@
>> -/**
>> - * '$RCSfile$'
>> - *
>> - * '$Author$'
>> - * '$Date$'
>> - * '$Revision$'
>> - *
>> - * For Details: http://kepler.ecoinformatics.org
>> - *
>> - * Copyright (c) 2003 The Regents of the University of California.
>> - * All rights reserved.
>> - *
>> - * Permission is hereby granted, without written agreement and without
>> - * license or royalty fees, to use, copy, modify, and distribute this
>> - * software and its documentation for any purpose, provided that the
>> - * above copyright notice and the following two paragraphs appear in
>> - * all copies of this software.
>> - *
>> - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> - * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> - * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> - * OF SUCH DAMAGE.
>> - *
>> - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> - * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> - * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> - */
>> -
>> -package org.ecoinformatics.util;
>> -
>> -import java.io.InputStream;
>> -import java.io.InputStreamReader;
>> -import java.util.Vector;
>> -
>> -import org.apache.commons.logging.Log;
>> -import org.apache.commons.logging.LogFactory;
>> -
>> -/**
>> - * tokenizes a delimited file. This reader assumes that one record is
>> on one
>> - * line which ends with the line
>> - */
>> -public class DelimitedReader {
>> - private InputStreamReader dataReader;
>> - private Vector[] lines;
>> - private Vector linesVector;
>> - private int numHeaderLines;
>> - private int numRecords;
>> - private boolean stripHeader = false;
>> - private int numCols;
>> - private String delimiter;
>> - private String lineEnding;
>> - private boolean collapseDilimiter = false;
>> - private int numFooterLines = 0;
>> - private Vector footerBuffer = new Vector();
>> - private boolean initializedFooterBuffer = false;
>> - private int headLineNumberCount = 0;
>> - private boolean isLenient = false;
>> - private String discoveredLineEnding = null;
>> - private static Vector possibleLineEndings = null;
>> -
>> - private static Log log;
>> - static {
>> - log =
>> LogFactory.getLog("org.ecoinformatics.util.DelimitedReader");
>> - possibleLineEndings = new Vector();
>> - possibleLineEndings.add("\n");
>> - possibleLineEndings.add("\r");
>> - possibleLineEndings.add("\r\n");
>> - }
>> -
>> - /**
>> - * constructor. reads the csv stream.
>> - *
>> - * @param delimString
>> - * the delimited stream to read
>> - * @param numCols
>> - * the number of columns in the stream
>> - * @param delimiter
>> - * the delimiter to tokenize on
>> - * @param numHeaderLines
>> - * the number of lines to skip at the top of the file
>> - * @param lineEnding
>> - * the line ending char(s)...either "\n"lo (unix),
>> - * @param isLenient
>> - * specifies if extra columns should be ignored "\r\n"
>> (windoze)
>> - * or "\r" (mac)
>> - */
>> - public DelimitedReader(String data, int numCols, String delimiter,
>> - int numHeaderLines, String lineEnding, int numRecords,
>> - boolean isLenient) throws Exception {
>> - this.numHeaderLines = numHeaderLines;
>> - this.numCols = numCols;
>> - this.numRecords = numRecords;
>> - log.debug("Delimiter is: " + delimiter);
>> - this.delimiter = unescapeDelimiter(delimiter);
>> - log.debug("LineEnding is: " + lineEnding);
>> - this.lineEnding = unescapeDelimiter(lineEnding);
>> - this.isLenient = isLenient;
>> -
>> - // lines = new Vector[numRecords + numHeaderLines + 1];
>> - linesVector = new Vector();
>> -
>> - int begin = 0;
>> - int end = 0;
>> - // int i = 0;
>> - while (end < data.length()) { // add each line of the string
>> as an
>> - // element in a vector
>> - end = data.indexOf(this.lineEnding, begin); // DFH
>> 'this.' added
>> - if (end == -1) {
>> - end = data.length();
>> - }
>> - String line = data.substring(begin, end);
>> - if (!line.trim().equals("")) {
>> - // take off the line ending
>> - // MBJ: I commented out the next line as it was
>> improperly
>> - // truncating lines
>> - // I'm not sure why it was there in the first place,
>> as the
>> - // previous substring
>> - // removed the delimiter
>> - // line = line.substring(0, line.length() -
>> - // lineEnding.length());
>> -
>> - // split the line based on the delimiter
>> - Vector v = splitDelimitedRowStringIntoVector(line);
>> - /*
>> - * String[] s = line.split(delimiter.trim(),
>> numCols); Vector v
>> - * = new Vector(); for(int j=0; j<s.length; j++) {
>> - * v.addElement(s[j]); }
>> - *
>> - * if(v.size() < numCols) { int vsize = v.size();
>> for(int j=0;
>> - * j<numCols - vsize; j++) { //add any elements that
>> aren't
>> - * there so that all the records have the //same
>> number of cols
>> - * v.addElement(""); } }
>> - */
>> - // lines[i] = v;
>> - linesVector.add(v);
>> - // i++;
>> - }
>> - // go to the next line
>> - begin = end + this.lineEnding.length(); // DFH 'this.' added
>> - }
>> -
>> - int records = linesVector.size();
>> - if (records != this.numRecords) {
>> - this.numRecords = records;
>> - log
>> - .warn("Metadata disagrees with actual data.
>> Changing number of records to: "
>> - + records);
>> - }
>> - lines = new Vector[records];
>> - for (int k = 0; k < records; k++) {
>> - lines[k] = (Vector) linesVector.get(k);
>> - }
>> - /*
>> - * for(int j=0; j<lines.length; j++) { if(lines[j] == null) {
>> lines[j] =
>> - * new Vector(); } }
>> - */
>> -
>> - }
>> -
>> - /**
>> - * This constructor will read delimitered data from stream rather
>> a string
>> - *
>> - * @param dataStream
>> - * InputStream The input stream
>> - * @param numCols
>> - * int the number of columns
>> - * @param delimiter
>> - * String delimiter the delimiter to tokenize on
>> - * @param numHeaderLines
>> - * int numHeaderLines the number of lines to skip at
>> the top of
>> - * the file
>> - * @param lineEnding
>> - * String lineEnding the line ending char(s)...either
>> "\n"
>> - * (unix),"\r\n" (windoze) or "\r" (mac)
>> - * @param numRecords
>> - * int number of rows in the input stream
>> - */
>> - public DelimitedReader(InputStream dataStream, int numCols,
>> - String delimiter, int numHeaderLines, String lineEnding,
>> - int numRecords, boolean stripHeader) {
>> - this.dataReader = new InputStreamReader(dataStream);
>> - this.numHeaderLines = numHeaderLines;
>> - this.numCols = numCols;
>> - this.numRecords = numRecords;
>> - log.debug("Delimiter is: " + delimiter);
>> - this.delimiter = unescapeDelimiter(delimiter);
>> - log.debug("LineEnding is: " + lineEnding);
>> - this.lineEnding = unescapeDelimiter(lineEnding);
>> - this.stripHeader = stripHeader;
>> -
>> - }
>> -
>> - /**
>> - * Method to set up data stream as source
>> - *
>> - * @param dataStream
>> - * InputStream
>> - */
>> - public void setInputStream(InputStream dataStream) {
>> - this.dataReader = new InputStreamReader(dataStream);
>> - }
>> -
>> - /**
>> - * Method to set up collapseDelimiter. If it is yes, consecutive
>> dilimiters
>> - * will be consider as single dilimiter.
>> - *
>> - * @param collapseDelimiter
>> - */
>> - public void setCollapseDelimiter(boolean collapseDelimiter) {
>> - this.collapseDilimiter = collapseDelimiter;
>> - }
>> -
>> - /**
>> - * Set up the footer line number.
>> - *
>> - * @param numFooterLines
>> - */
>> - public void setNumFooterLines(int numFooterLines) {
>> - this.numFooterLines = numFooterLines;
>> - }
>> -
>> - public boolean isLenient() {
>> - return isLenient;
>> - }
>> -
>> - public void setLenient(boolean isLenient) {
>> - this.isLenient = isLenient;
>> - }
>> -
>> - /**
>> - * This method is from data source as a input stream This method
>> will read
>> - * one row from and return a data vector which element is String
>> and the
>> - * value is field data. After reach the end of stream, empty
>> vector will be
>> - * returned. So this method can be iterated by a while loop until
>> a empty
>> - * vector hited. During the iteration, every data in the stream
>> will be
>> - * pulled out.
>> - *
>> - * @return Vector
>> - */
>> - public Vector getRowDataVectorFromStream() throws Exception {
>> - // System.out.println("the numFootLines is "+numFooterLines);
>> - if (!initializedFooterBuffer) {
>> - for (int i = 0; i < numFooterLines; i++) {
>> - // System.out.println("the initialize with footer
>> lines");
>> - String rowData = readOneRowDataString();
>> - // System.out.println("the data vector in initailize
>> is "+rowData.toString());
>> - footerBuffer.add(rowData);
>> - }
>> - // this is for no footer lines
>> - if (numFooterLines == 0) {
>> - // System.out.println("the initialize without footer
>> lines");
>> - String rowData = readOneRowDataString();
>> - // System.out.println("The initial buffere vector is
>> "+rowData.toString());
>> - footerBuffer.add(rowData);
>> - }
>> - initializedFooterBuffer = true;
>> - }
>> - String nextRowData = readOneRowDataString();
>> - // System.out.println("the row string data from next row
>> "+nextRowData.toString());
>> - String oneRowDataString = null;
>> - Vector oneRowDataVector = new Vector();
>> -
>> - if (nextRowData != null) {
>> - // System.out.println("before nextRowData is empty and
>> nextRowData is "+nextRowData.toString());
>> - oneRowDataString = (String) footerBuffer.remove(0);
>> - reIndexFooterBufferVector();
>> - footerBuffer.add(nextRowData);
>> - } else if (numFooterLines == 0 && !footerBuffer.isEmpty()) {
>> - // System.out.println("find the last line in fottlines
>> num is 0!!!!!!!!");
>> - oneRowDataString = (String) footerBuffer.remove(0);
>> - }
>> - // System.out.println("helere!!!");
>> - if (oneRowDataString != null) {
>> - log.debug("in dataReader is not null");
>> - oneRowDataVector =
>> splitDelimitedRowStringIntoVector(oneRowDataString);
>> - }
>> - // System.out.println("the row data from buffer
>> "+oneRowDataVector.toString());
>> - return oneRowDataVector;
>> - }
>> -
>> - /*
>> - * This method will read a row data from vector. It discard the
>> head lines.
>> - * but it doesn't dsicard footer lines This method will be called by
>> - * getRowDataVectorFromStream
>> - */
>> - private String readOneRowDataString() {
>> - // Vector oneRowDataVector = new Vector();
>> - StringBuffer rowData = new StringBuffer();
>> - String rowDataString = null;
>> - int singleCharactor = -2;
>> -
>> - if (dataReader != null) {
>> - // log.debug("in dataReader is not null");
>> - try {
>> - while (singleCharactor != -1) {
>> - // log.debug("in singleCharactor is not null");
>> - singleCharactor = dataReader.read();
>> - char charactor = (char) singleCharactor;
>> - rowData.append(charactor);
>> - // find string - line ending in the row data
>> - boolean foundLineEnding =
>> (rowData.indexOf(lineEnding) != -1);
>> -
>> - // if we are being lenient, try some other line
>> endings for
>> - // parsing the data
>> - if (!foundLineEnding && this.isLenient()) {
>> - // have we discovered the ending already in
>> this data?
>> - if (this.discoveredLineEnding != null) {
>> - foundLineEnding = (rowData
>> -
>> .indexOf(this.discoveredLineEnding) != -1);
>> - }
>> - // otherwise we need to try a few of them out
>> - else {
>> - for (int i = 0; i <
>> possibleLineEndings.size(); i++) {
>> - String possibleLineEnding = (String)
>> possibleLineEndings
>> - .get(i);
>> - foundLineEnding = (rowData
>> - .indexOf(possibleLineEnding)
>> != -1);
>> - if (foundLineEnding) {
>> - this.discoveredLineEnding =
>> possibleLineEnding;
>> - break;
>> - }
>> - }
>> - }
>> - }
>> - // finally see if we found the end of the line
>> - if (foundLineEnding) {
>> - log.debug("found line ending");
>> - // strip the header lines
>> - if (stripHeader && numHeaderLines > 0
>> - && headLineNumberCount <
>> numHeaderLines) {
>> - // reset string buffer(descard the header
>> line)
>> - rowData = null;
>> - rowData = new StringBuffer();
>> -
>> - } else {
>> - rowDataString = rowData.toString();
>> - log.debug("The row data is " +
>> rowDataString);
>> - break;
>> - }
>> - headLineNumberCount++;
>> - }
>> - }
>> - } catch (Exception e) {
>> - log.debug("Couldn't read data from input stream");
>> - }
>> - }
>> - // System.out.println("the row data before reutrn is
>> "+rowDataString);
>> - return rowDataString;
>> - }
>> -
>> - /*
>> - * This method will forward one index for every element, 1 -> 0,
>> 2->1
>> - */
>> - private void reIndexFooterBufferVector() {
>> - for (int i = 0; i < numFooterLines - 2; i++) {
>> - Vector element = (Vector) footerBuffer.elementAt(i + 1);
>> - footerBuffer.add(i, element);
>> - }
>> - }
>> -
>> - /*
>> - * This method will read a delimitered string and put a
>> delimitered part
>> - * into an element in a vector. If the vector size is less than
>> the column
>> - * number empty string will be added.
>> - */
>> - private Vector splitDelimitedRowStringIntoVector(String data)
>> - throws Exception {
>> - Vector result = new Vector();
>> - if (data == null) {
>> - return result;
>> - }
>> - String[] s = null;
>> - if (!collapseDilimiter) {
>> - s = data.split(delimiter);
>> - } else {
>> - String newDelimiterWithRegExpress = delimiter + "+";
>> - s = data.split(newDelimiterWithRegExpress);
>> -
>> - }
>> -
>> - if (s != null) {
>> - if (!isLenient && s.length > numCols) {
>> - throw new Exception("Metadata sees data has " + numCols
>> - + " columns but actually data has " + s.length
>> - + " columns. Please make sure metadata is
>> correct!");
>> - }
>> - int columnCount = Math.min(s.length, numCols);
>> - for (int j = 0; j < columnCount; j++) {
>> -
>> - if (s[j] != null) {
>> - result.addElement(s[j].trim());
>> - } else {
>> - result.addElement("");
>> - }
>> - }
>> - // add any elements that aren't there so that all the
>> records have
>> - // the
>> - // same number of cols
>> - if (result.size() < numCols) {
>> - int vsize = result.size();
>> - for (int j = 0; j < numCols - vsize; j++) {
>> - result.addElement("");
>> - }
>> - }
>> - }
>> - return result;
>> - }
>> -
>> - /**
>> - * returns the data as an array of vectors. each vector will have
>> the same
>> - * number of elements as there are columns in the data.
>> - *
>> - * @param stripHeaderLines
>> - * true if the header lines should not be included in the
>> - * returned data, false otherwise
>> - */
>> - public Vector[] getTokenizedData(boolean stripHeaderLines) {
>> - if (stripHeaderLines) {
>> - Vector[] strip = null;
>> - if (numRecords > numHeaderLines) {
>> - strip = new Vector[numRecords - numHeaderLines];
>> - for (int i = numHeaderLines; i < lines.length; i++) {
>> - strip[i - numHeaderLines] = lines[i];
>> - }
>> - }
>> - return strip;
>> - } else {
>> - return lines;
>> - }
>> - }
>> -
>> - /**
>> - * returns a string representation of the data
>> - */
>> - public String toString() {
>> - StringBuffer sb = new StringBuffer();
>> - for (int i = 0; i < lines.length; i++) {
>> - log.debug("line[" + (i + 1) + "]: " + lines[i].toString());
>> - for (int j = 0; j < lines[i].size(); j++) {
>> - sb.append((String) lines[i].elementAt(j));
>> - if (j != lines[i].size() - 1) {
>> - sb.append(" || ");
>> - }
>> - }
>> - sb.append(lineEnding);
>> - }
>> - return sb.toString();
>> - }
>> -
>> - /**
>> - * Convert a string escaped representation of a delimiter
>> character into an
>> - * the actual String for that delimiter. This is used for
>> translating
>> - * escaped versions of tab, newline, and carriage return
>> characters to their
>> - * real character values.
>> - *
>> - * @param delimiter
>> - * the String representing the delimiter
>> - * @return the actual String for the delimiter
>> - */
>> - public static String unescapeDelimiter(String delimiter) {
>> - String newDelimiter = delimiter;
>> -
>> - if (delimiter == null) {
>> - log.debug("Delimiter is null and we set up to \n.");
>> - newDelimiter = "\n";
>> - } else if (delimiter.equals("\\t")) {
>> - log.debug("Tab interpreted incorrectly as string.");
>> - newDelimiter = "\t";
>> - } else if (delimiter.equals("\\n")) {
>> - log.debug("Newline interpreted incorrectly as string.");
>> - newDelimiter = "\n";
>> - } else if (delimiter.equals("\\r")) {
>> - log.debug("CR interpreted incorrectly as string.");
>> - newDelimiter = "\r";
>> - } else if (delimiter.equals("\\r\\n")) {
>> - log.debug("CRNL interpreted incorrectly as string.");
>> - newDelimiter = "\r\n";
>> - } else if (delimiter.startsWith("#")) {
>> - log.debug("XML entity charactor.");
>> - String digits = delimiter.substring(1, delimiter.length());
>> - int radix = 10;
>> - if (digits.startsWith("x")) {
>> - log.debug("Radix is " + 16);
>> - radix = 16;
>> - digits = digits.substring(1, digits.length());
>> - }
>> - log.debug("Int value of delimiter is " + digits);
>> -
>> - newDelimiter = transferDigitsToCharString(radix, digits);
>> -
>> - } else if (delimiter.startsWith("0x") ||
>> delimiter.startsWith("0X")) {
>> - int radix = 16;
>> - String digits = delimiter.substring(2, delimiter.length());
>> - log.debug("Int value of delimiter is " + digits);
>> - newDelimiter = transferDigitsToCharString(radix, digits);
>> - }
>> -
>> - return newDelimiter;
>> - }
>> -
>> - private static String transferDigitsToCharString(int radix,
>> String digits) {
>> - if (digits == null) {
>> - return null;
>> - }
>> - Integer integer = Integer.valueOf(digits, radix);
>> - int inter = integer.intValue();
>> - log.debug("The decimal value of char is " + inter);
>> - char charactor = (char) inter;
>> - String newDelimiter = Character.toString(charactor);
>> - log.debug("The new delimter is " + newDelimiter);
>> - return newDelimiter;
>> - }
>> -}
>>
>> Modified: trunk/modules/core/src/org/kepler/kar/KARBuilder.java
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/kar/KARBuilder.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/core/src/org/kepler/kar/KARBuilder.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -43,7 +43,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.moml.NamedObjId;
>> import org.kepler.objectmanager.ActorMetadata;
>> import org.kepler.objectmanager.ObjectManager;
>>
>> Modified: trunk/modules/core/src/org/kepler/kar/KARCacheManager.java
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/kar/KARCacheManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/core/src/org/kepler/kar/KARCacheManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -10,7 +10,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.objectmanager.ObjectManager;
>> import org.kepler.objectmanager.cache.CacheManager;
>> import org.kepler.objectmanager.cache.CacheObject;
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheManager.java
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -50,7 +50,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.kar.KAREntryHandler;
>> import org.kepler.kar.KAREntryHandlerFactory;
>> import org.kepler.objectmanager.lsid.KeplerLSID;
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheUtil.java
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheUtil.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/cache/CacheUtil.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -42,7 +42,7 @@
>> import java.sql.SQLException;
>> import java.sql.Statement;
>>
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>>
>> /**
>> * Class that represents an object in the ObjectCache. This class
>> should be
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/cache/LocalRepositoryManager.java
>>
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/cache/LocalRepositoryManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/cache/LocalRepositoryManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -56,7 +56,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.build.modules.Module;
>> import org.kepler.build.modules.ModuleTree;
>> import org.kepler.build.project.ProjectLocator;
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/data/DataTypeResolver.java
>>
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/data/DataTypeResolver.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/data/DataTypeResolver.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -33,7 +33,7 @@
>> package org.kepler.objectmanager.data;
>>
>> import org.apache.xpath.CachedXPathAPI;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.w3c.dom.Node;
>> import org.w3c.dom.NodeList;
>>
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/data/text/TextComplexFormatDataReader.java
>>
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/data/text/TextComplexFormatDataReader.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/data/text/TextComplexFormatDataReader.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -36,7 +36,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DelimitedReader;
>> +import org.kepler.util.DelimitedReader;
>> import org.kepler.objectmanager.data.db.Attribute;
>> import org.kepler.objectmanager.data.db.Entity;
>>
>>
>> Modified:
>> trunk/modules/core/src/org/kepler/objectmanager/lsid/LSIDGenerator.java
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/objectmanager/lsid/LSIDGenerator.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/core/src/org/kepler/objectmanager/lsid/LSIDGenerator.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -44,7 +44,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.kepler.build.project.ProjectLocator;
>> import org.kepler.objectmanager.cache.CacheException;
>> import org.kepler.objectmanager.cache.CacheManager;
>>
>> Modified: trunk/modules/core/src/org/kepler/util/AuthNamespace.java
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/util/AuthNamespace.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/core/src/org/kepler/util/AuthNamespace.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -25,7 +25,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.build.project.ProjectLocator;
>> import org.w3c.dom.Node;
>> import org.w3c.dom.NodeList;
>>
>> Copied: trunk/modules/core/src/org/kepler/util/Config.java (from rev
>> 20445, trunk/modules/core/src/org/ecoinformatics/util/Config.java)
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/util/Config.java (rev 0)
>> +++ trunk/modules/core/src/org/kepler/util/Config.java 2009-08-26
>> 17:38:14 UTC (rev 20471)
>> @@ -0,0 +1,515 @@
>> +/**
>> + * '$RCSfile$'
>> + *
>> + * '$Author$'
>> + * '$Date$'
>> + * '$Revision$'
>> + *
>> + * For Details: http://kepler.ecoinformatics.org
>> + *
>> + * Copyright (c) 2003 The Regents of the University of California.
>> + * All rights reserved.
>> + *
>> + * Permission is hereby granted, without written agreement and without
>> + * license or royalty fees, to use, copy, modify, and distribute this
>> + * software and its documentation for any purpose, provided that the
>> + * above copyright notice and the following two paragraphs appear in
>> + * all copies of this software.
>> + *
>> + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> + * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> + * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> + * OF SUCH DAMAGE.
>> + *
>> + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> + * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> + * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> + * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> + */
>> +
>> +package org.kepler.util;
>> +
>> +import java.io.File;
>> +import java.io.FileInputStream;
>> +import java.io.FileNotFoundException;
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.net.URI;
>> +import java.net.URL;
>> +import java.util.Collections;
>> +import java.util.Hashtable;
>> +import java.util.Iterator;
>> +import java.util.List;
>> +import java.util.Map;
>> +import java.util.StringTokenizer;
>> +import java.util.Vector;
>> +import java.util.jar.Attributes;
>> +import java.util.jar.JarInputStream;
>> +import java.util.jar.Manifest;
>> +
>> +import javax.xml.transform.TransformerException;
>> +
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +import org.apache.xpath.XPathAPI;
>> +import org.w3c.dom.Node;
>> +import org.w3c.dom.NodeList;
>> +
>> +import edu.ucsb.nceas.configxml.ConfigXML;
>> +import edu.ucsb.nceas.configxml.exception.ElementNotFoundException;
>> +import edu.ucsb.nceas.configxml.exception.IndexTooLargeException;
>> +
>> +/**
>> + *
>> + * configuration file routines
>> + *
>> + */
>> +public class Config {
>> + private static final Log log =
>> LogFactory.getLog(Config.class.getName());
>> + private static final boolean isDebugging = log.isDebugEnabled();
>> + + private static final String configfilename =
>> "configurations/config.xml";
>> +
>> + private static final String settingsdir = ".kepler";
>> +
>> + // Define useful static strings. At some point in time, these
>> could be moved
>> + // into the config.xml file, environment variable, or something else
>> + // which could move this directory to another location.
>> +
>> + // KEPLER_USER_DIR is returned by Config.getUserDirPath().
>> + private static final String KEPLER_USER_DIR = System
>> + .getProperty("user.home")
>> + + File.separator + settingsdir + File.separator;
>> +
>> + // KEPLER_CACHE_DIR is returned by Config.getCacheDirPath().
>> + private static final String KEPLER_CACHE_DIR = KEPLER_USER_DIR +
>> "cache"
>> + + File.separator;
>> +
>> + /**
>> + * The singleton instance.
>> + */
>> + private static Config configure;
>> + static {
>> + try {
>> + configure = new Config();
>> + } catch (FileNotFoundException ex) {
>> + throw new ExceptionInInitializerError(ex);
>> + }
>> + }
>> +
>> + // Instance variables.
>> +
>> + /**
>> + * The underlying ConfigXML object.
>> + */
>> + private ConfigXML config;
>> +
>> + /**
>> + * Error indicator. Set to true if ConfigXML has problems.
>> + */
>> + private boolean error = false;
>> +
>> + /**
>> + * Method for get object as a singleton class
>> + *
>> + * @return Config
>> + */
>> + public static Config getInstance() {
>> + return configure;
>> + }
>> +
>> + /*
>> + * Constructor for ConfigDatasource.
>> + *
>> + * @throws FileNotFoundException
>> + *
>> + * @throws Exception
>> + */
>> + private Config() throws FileNotFoundException {
>> +
>> + InputStream is = null;
>> +
>> + URL kernelConfigURL = ClassLoader.getSystemClassLoader()
>> + .getResource(configfilename);
>> + + File kernelConfigFile = null;
>> + try
>> + {
>> + kernelConfigFile = new File(new URI(kernelConfigURL.toString()));
>> + }
>> + catch(Exception e)
>> + {
>> + throw new FileNotFoundException("Error getting config file from
>> " +
>> + "classpath: " + e.getMessage());
>> + }
>> +
>> + //if (kernelConfig == null) {
>> + if (!kernelConfigFile.exists()) {
>> + throw new FileNotFoundException("Failed to find " +
>> configfilename + " in the classpath: "
>> + + _classpath());
>> + }
>> + log.debug("Opening config.xml file found at: " +
>> kernelConfigFile.getAbsolutePath());
>> + try {
>> + is = (InputStream) new FileInputStream(kernelConfigFile);
>> + if (is == null) {
>> + throw new FileNotFoundException("Failed to find \""
>> + + configfilename + "\" as a resource in the
>> classpath: "
>> + + _classpath());
>> + }
>> + config = new ConfigXML(is,
>> kernelConfigFile.getAbsolutePath());
>> + } catch (FileNotFoundException fnfe) {
>> + error = true;
>> + FileNotFoundException exception = new FileNotFoundException(
>> + "Config file not found at
>> \""
>> + + configfilename
>> + + "\" in the classpath: "
>> + + _classpath());
>> + exception.initCause(fnfe);
>> + throw exception;
>> + } catch (Exception e) {
>> + error = true;
>> + throw new RuntimeException("Unspecified error creating
>> config "
>> + + "object from \"" + configfilename + "\"", e);
>> + } finally {
>> + if (is != null) {
>> + try {
>> + is.close();
>> + } catch (IOException ex) {
>> + throw new RuntimeException("Failed to close \""
>> + + configfilename + "\"", ex);
>> + }
>> + }
>> + }
>> +
>> + }
>> +
>> + /**
>> + * get the classpath from a manifest file
>> + */
>> + private String processManifestClasspath(String classpath) throws
>> IOException
>> + {
>> + File f = new File(classpath);
>> + JarInputStream jar = new JarInputStream(new FileInputStream(f));
>> + Manifest m = jar.getManifest();
>> + Attributes mainAtts = m.getMainAttributes();
>> + Iterator itt = mainAtts.entrySet().iterator();
>> + while(itt.hasNext())
>> + { //find the classpath in the manifest
>> + Map.Entry entry = (Map.Entry)itt.next();
>> + if((((Object)entry.getKey()).toString()).equals("Class-Path"))
>> + {
>> + classpath = (String)entry.getValue();
>> + break;
>> + }
>> + //System.out.println("name: " +
>> ((Object)entry.getKey()).toString());
>> + //System.out.println("val: " +
>> ((Object)entry.getValue()).toString());
>> + }
>> +
>> + //change the manifest classpath into a normal looking classpath
>> + classpath = classpath.replaceAll("\\s",
>> System.getProperty("path.separator"));
>> + //System.out.println("classpath: " + classpath);
>> + return classpath;
>> + }
>> +
>> + /**
>> + * Method to get a string value from config.xml base on given
>> element path
>> + *
>> + * @param path
>> + * String
>> + * @return String
>> + */
>> + public static String getValue(String path) {
>> + Config configInstance = Config.getInstance();
>> + return configInstance.getValueFromPath(path);
>> + }
>> +
>> + private String getValueFromPath(String path) {
>> + if (isDebugging) {
>> + log.debug(path);
>> + }
>> + String value = null;
>> + if (error) {
>> + return value;
>> + }
>> + if (path == null) {
>> + return value;
>> + }
>> + try {
>> + Vector valueVector = config.getValuesForPath(path);
>> + value = (String) valueVector.elementAt(0);
>> + } catch (ElementNotFoundException e1) {
>> + log.debug("Element " + path + " not found");
>> + } catch (Exception e2) {
>> + log.error("Exception occurred:", e2);
>> + }
>> + if (isDebugging) {
>> + log.debug(value);
>> + }
>> + return value;
>> + }// getValues
>> +
>> + /**
>> + * Method returns an unmodifiable list of values from config.xml
>> base on
>> + * given path. If the argument is null or not found in
>> config.xml, return
>> + * EMPTY_LIST.
>> + *
>> + * @param path
>> + * String
>> + * @return Vector
>> + */
>> + public static List getList(String path) {
>> + Config configInstance = Config.getInstance();
>> + return configInstance.getListFromPath(path);
>> + }
>> +
>> + private List getListFromPath(String path) {
>> + List value = Collections.EMPTY_LIST;
>> + if (error) {
>> + return value;
>> + }
>> + if (path == null) {
>> + return value;
>> + }
>> + try {
>> + value =
>> Collections.unmodifiableList(config.getValuesForPath(path));
>> + } catch (ElementNotFoundException e1) {
>> + log.debug("Element " + path + " not found");
>> + } catch (Exception e2) {
>> + log.error("Exception occurred:", e2);
>> + }
>> +
>> + return value;
>> + }// getList
>> +
>> + /**
>> + * Method to get unmodifiable map for some given pathes in
>> config.xml. If
>> + * the arguments are invalid (either null) or not found, return
>> an empty
>> + * map. Here is the segment of config.xml: <parenetElement>
>> + * <keyElement>key1</keyElement> <valueElement>value1</valueElement>
>> + * </parentElement> <parentElement> <keyElement>key2</keyElement>
>> + * <valueElement>value2</valueElement> </parentElement> The
>> parentPath can
>> + * be "//parentElement", keyPath should be "./keyElement", and
>> valuePath
>> + * should be "./valuePath".
>> + *
>> + * @param parentPath
>> + * String
>> + * @param keyPath
>> + * String
>> + * @param valuePath
>> + * String
>> + * @throws ElementNotFoundException
>> + * @throws Exception
>> + * @return Hashtable
>> + */
>> + public static Map getMap(String parentPath, String keyPath,
>> String valuePath) {
>> + Config configInstance = Config.getInstance();
>> + return configInstance.getMapFromPath(parentPath, keyPath,
>> valuePath);
>> + }
>> +
>> + private Map getMapFromPath(String parentPath, String keyPath,
>> + String valuePath) {
>> + Map map = Collections.EMPTY_MAP;
>> + if (error) {
>> + return map;
>> + }
>> + if (parentPath == null || keyPath == null || valuePath ==
>> null) {
>> + return map;
>> + }
>> + NodeList nl = null;
>> + try {
>> + nl = config.getPathContent(parentPath);
>> + } catch (ElementNotFoundException e1) {
>> + log.debug("Element " + parentPath + " not found");
>> + return map;
>> + } catch (TransformerException e2) {
>> + log.error("Transfomer Exception when reading parentPath "
>> + + parentPath, e2);
>> + return map;
>> + }
>> + // At this point nl != null because we didn't get an
>> + // ElementNotFoundException
>> + map = new Hashtable();
>> + try {
>> + for (int i = 0; i < nl.getLength(); i++) {
>> + Node n = nl.item(i);
>> + Node keyNode = XPathAPI.selectSingleNode(n, keyPath);
>> + Node valueNode = XPathAPI.selectSingleNode(n,
>> valuePath);
>> + if (keyNode == null || valueNode == null) {
>> + log.debug("keyNode or valueNode not found at
>> iteration "
>> + + i);
>> + continue;
>> + }
>> +
>> + String keyNodeValue =
>> keyNode.getFirstChild().getNodeValue();
>> + String valueNodeValue = valueNode.getFirstChild()
>> + .getNodeValue();
>> + if (keyNodeValue == null || valueNodeValue == null) {
>> + log
>> + .debug("keyNodeValue or valueNodeValue is
>> null at iteration "
>> + + i);
>> + continue;
>> + }
>> + log.debug("The value of " + keyPath + " " + keyNodeValue
>> + + " and " + " the value of " + valuePath + " "
>> + + valueNodeValue + " are put into mapping");
>> +
>> + map.put(keyNodeValue, valueNodeValue);
>> + } // for
>> + } catch (TransformerException e) {
>> + log.error("Transfomer Exception in loop ", e);
>> + }
>> + return Collections.unmodifiableMap(map);
>> + }// getMap
>> +
>> + /**
>> + * Get a node list base on the given xpath in config file
>> + *
>> + * @param path
>> + * String the xpath
>> + * @return NodeList
>> + */
>> + public static NodeList getNodeListFromPath(String path) {
>> + Config configInstance = Config.getInstance();
>> + return configInstance.getNodeListFromXPath(path);
>> + }
>> +
>> + /*
>> + * This method will get a node list from config file
>> + */
>> + private NodeList getNodeListFromXPath(String xpath) {
>> + NodeList list = null;
>> + if (error) {
>> + return list;
>> + }
>> + try {
>> + list = config.getPathContent(xpath);
>> + } catch (ElementNotFoundException e) {
>> + log.debug("Element Not found for " + xpath);
>> + } catch (TransformerException e2) {
>> + log.error("Transformer Exception for " + xpath);
>> + }
>> + return list;
>> + }
>> +
>> + /**
>> + * Method to get error state
>> + */
>> + public boolean getErrorState() {
>> + return error;
>> + }
>> +
>> + /**
>> + * Returns the path of the Kepler hidden working directory
>> terminated with
>> + * File.seperator. This directory is current coded to be
>> + * ${system.home}/.kepler.
>> + *
>> + * @return the path to the .kepler directory.
>> + * @deprecated use DotKeplerManager.getDotKeplerPath() instead.
>> + */
>> + public static String getUserDirPath() {
>> + return KEPLER_USER_DIR;
>> + }
>> +
>> + /**
>> + * Returns the path to a subdirectory of the working directory.
>> The pathname
>> + * is normalized to use the system style File.separator.
>> + *
>> + *
>> + * @param path
>> + * a subdirectory of the working directory
>> + * @return normalized pathname of the subdirectory.
>> + * @deprecated use DotKeplerManager.getDotKeplerPath(String)
>> instead.
>> + */
>> + public static String getUserDirPath(String path) {
>> + String pdir = KEPLER_USER_DIR + path;
>> + if (pdir.endsWith(File.separator)) {
>> + return pdir;
>> + } else {
>> + return pdir + File.separator;
>> + }
>> + }
>> +
>> + /**
>> + * Returns the path to the Cache working directory terminated with
>> + * File.seperator. This directory is currently in getUserDirPath() +
>> + * "cache".
>> + *
>> + * @return the path to the cache directory
>> + * @deprecated use DotKeplerManager.getCacheDirPath()
>> + */
>> + public static String getCacheDirPath() {
>> + return KEPLER_CACHE_DIR;
>> + }
>> +
>> + /**
>> + * Method save. - pass through to ConfigXML member
>> + *
>> + * @throws Exception
>> + */
>> + public void save() throws Exception {
>> + config.save();
>> + }
>> +
>> + /**
>> + * Method set. - pass through to ConfigXML member
>> + *
>> + * @param arg1
>> + * @param arg2
>> + * @param arg3
>> + * @throws ElementNotFoundException
>> + */
>> + public void set(String arg1, int arg2, String arg3)
>> + throws ElementNotFoundException {
>> + config.set(arg1, arg2, arg3);
>> + }
>> +
>> + /**
>> + * Method deleteSubFields. - pass through to ConfigXML member
>> + *
>> + * @param parentName
>> + * @param i
>> + * @throws IndexTooLargeException
>> + */
>> + public void deleteSubFields(String parentName, int i)
>> + throws IndexTooLargeException {
>> + config.deleteSubFields(parentName, i);
>> + }
>> +
>> + /**
>> + * Method addSubFields. - pass through to ConfigXML member
>> + *
>> + * @param parentName
>> + * @param i
>> + * @param childName
>> + * @param value
>> + * @throws IndexTooLargeException
>> + */
>> + public void addSubField(String parentName, int i, String childName,
>> + String value) throws IndexTooLargeException {
>> + config.addSubField(parentName, i, childName, value);
>> + }
>> +
>> + /** Return the classpath as a string.
>> + * @return the classpath
>> + */
>> + private String _classpath() {
>> + StringBuffer classpath = new StringBuffer();
>> + try {
>> + String cp = System.getProperty("java.class.path");
>> + StringTokenizer st = new StringTokenizer(cp, System
>> + .getProperty("path.separator"));
>> + while (st.hasMoreTokens()) {
>> + if (classpath.length() > 0) {
>> + classpath.append(System.getProperty("path.separator"));
>> + }
>> + classpath.append((String)st.nextToken());
>> + }
>> + } catch (Exception ex) {
>> + classpath.append(ex.toString());
>> + }
>> + return classpath.toString();
>> + }
>> +}
>>
>> Copied:
>> trunk/modules/core/src/org/kepler/util/DBConnectionFactory.java (from
>> rev 20445,
>> trunk/modules/core/src/org/ecoinformatics/util/DBConnectionFactory.java)
>> ===================================================================
>> ---
>> trunk/modules/core/src/org/kepler/util/DBConnectionFactory.java
>> (rev 0)
>> +++ trunk/modules/core/src/org/kepler/util/DBConnectionFactory.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -0,0 +1,173 @@
>> +/**
>> + * '$RCSfile$'
>> + *
>> + * '$Author$'
>> + * '$Date$'
>> + * '$Revision$'
>> + *
>> + * For Details: http://kepler.ecoinformatics.org
>> + *
>> + * Copyright (c) 2003 The Regents of the University of California.
>> + * All rights reserved.
>> + *
>> + * Permission is hereby granted, without written agreement and without
>> + * license or royalty fees, to use, copy, modify, and distribute this
>> + * software and its documentation for any purpose, provided that the
>> + * above copyright notice and the following two paragraphs appear in
>> + * all copies of this software.
>> + *
>> + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> + * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> + * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> + * OF SUCH DAMAGE.
>> + *
>> + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> + * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> + * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> + * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> + */
>> +
>> +package org.kepler.util;
>> +
>> +import java.io.File;
>> +import java.sql.Connection;
>> +import java.sql.SQLException;
>> +
>> +import javax.sql.DataSource;
>> +
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +import org.hsqldb.Server;
>> +import org.hsqldb.jdbc.jdbcDataSource;
>> +import org.kepler.util.DotKeplerManager;
>> +
>> +/**
>> + * DBConnectionFactory creates connections to the hsql database.
>> + * It launches HSQL in "Server" mode and creates a DataSource using
>> the configured
>> + * username, password, and jdbc connection string.
>> + * While it does not provide database connection pooling, it does allow
>> + * multiple simultaneous connections to be made from different JVMs.
>> + *
>> + * @author Kevin Ruland
>> + * @author Ben Leinfelder
>> + *
>> + */
>> +public class DBConnectionFactory {
>> +
>> + private static final String USERNAMEPATH =
>> "//sqlEngine[sqlEngineName=\"hsql\"]/userName";
>> + private static final String PASSWORDPATH =
>> "//sqlEngine[sqlEngineName=\"hsql\"]/password";
>> +
>> + private static String username;
>> + private static String password;
>> + private static String dbName;
>> + private static String dbNamePath;
>> + private static String url;
>> + private static DataSource dataSource;
>> + private static Server server;
>> + + private static Log log =
>> LogFactory.getLog(DBConnectionFactory.class);
>> +
>> + static {
>> + username = Config.getValue(USERNAMEPATH);
>> + password = Config.getValue(PASSWORDPATH);
>> + dbName = "hsqldb";
>> + dbNamePath = DotKeplerManager.getInstance().getCacheDirPath()
>> + + "cachedata" + File.separator + dbName;
>> + + //using the "server" mode to allow multiple JVMs
>> simultaneous access
>> + url = "jdbc:hsqldb:hsql://localhost/" + dbName;
>> + //url = "jdbc:hsqldb:" + dbNamePath;
>> + + server = new Server();
>> + }
>> +
>> + /**
>> + * Method to get a connection to the internal DB.
>> + *
>> + * @throws SQLException
>> + * If there is a problem creating the connection. One
>> possible
>> + * solution is to remove the directory named by
>> + * Config.getCacheDirPath().
>> + * @throws ClassNotFoundException
>> + * @return Connection
>> + */
>> + public static Connection getDBConnection() throws SQLException,
>> + ClassNotFoundException {
>> + return getDBConnection(username, password);
>> + }
>> +
>> + /** Stop the HSQL Server. */
>> + public static void shutdownDBServer() {
>> + server.stop();
>> + }
>> +
>> + private static Connection getDBConnection(String userName, String
>> password)
>> + throws SQLException, ClassNotFoundException {
>> +
>> + Connection conn = null;
>> + try {
>> + conn = dataSource.getConnection();
>> + } catch (Exception e) {
>> + //start the server
>> + launchDBServer();
>> + initDataSource();
>> + }
>> + if (conn != null) {
>> + return conn;
>> + }
>> + //or try again
>> + try {
>> + conn = dataSource.getConnection();
>> + return conn;
>> + } catch (SQLException ex) {
>> + SQLException sqlException = new SQLException(
>> + "Failed to connect to url \""
>> + + url
>> + + "\" as user \""
>> + + userName
>> + + ". Perhaps there was an error launching
>> the db server. "
>> + + "In addition, sometimes the database "
>> + + "cache can become corrupt, so another "
>> + + "solution is to remove the \"" +
>> dbNamePath
>> + + "\" directory.");
>> + sqlException.setNextException(ex);
>> + throw sqlException;
>> + }
>> + }
>> + + /**
>> + * DataSources are "preferred" over DriverManagers..
>> + * @see
>> http://hsqldb.org/doc/src/org/hsqldb/jdbc/jdbcDataSource.html
>> + */
>> + private static void initDataSource() {
>> + //use the simple datasource provided by HSQL
>> + jdbcDataSource ds = new jdbcDataSource();
>> + ds.setDatabase(url);
>> + ds.setUser(username);
>> + ds.setPassword(password);
>> + dataSource = ds;
>> + }
>> + + /**
>> + * Starts the HSQL Server in the first Kepler JVM
>> + * Subsequent JVMs will encounter a non-fatal BindException
>> + * and will carry on, connecting with the first Server
>> + * @see http://hsqldb.org/doc/src/org/hsqldb/Server.html
>> + *
>> + */
>> + private static void launchDBServer() {
>> + if (!log.isDebugEnabled()) {
>> + server.setLogWriter(null);
>> + server.setErrWriter(null);
>> + }
>> + server.setDatabasePath(0, dbNamePath);
>> + server.setDatabaseName(0, dbName);
>> + server.setSilent(true);
>> + server.setTrace(false);
>> + server.setNoSystemExit(true);
>> + server.start();
>> + }
>> +}
>>
>> Copied: trunk/modules/core/src/org/kepler/util/DelimitedReader.java
>> (from rev 20445,
>> trunk/modules/core/src/org/ecoinformatics/util/DelimitedReader.java)
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/util/DelimitedReader.java
>> (rev 0)
>> +++ trunk/modules/core/src/org/kepler/util/DelimitedReader.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -0,0 +1,517 @@
>> +/**
>> + * '$RCSfile$'
>> + *
>> + * '$Author$'
>> + * '$Date$'
>> + * '$Revision$'
>> + *
>> + * For Details: http://kepler.ecoinformatics.org
>> + *
>> + * Copyright (c) 2003 The Regents of the University of California.
>> + * All rights reserved.
>> + *
>> + * Permission is hereby granted, without written agreement and without
>> + * license or royalty fees, to use, copy, modify, and distribute this
>> + * software and its documentation for any purpose, provided that the
>> + * above copyright notice and the following two paragraphs appear in
>> + * all copies of this software.
>> + *
>> + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> + * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
>> + * IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
>> + * OF SUCH DAMAGE.
>> + *
>> + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> + * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY
>> + * OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
>> + * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
>> + */
>> +
>> +package org.kepler.util;
>> +
>> +import java.io.InputStream;
>> +import java.io.InputStreamReader;
>> +import java.util.Vector;
>> +
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>> +
>> +/**
>> + * tokenizes a delimited file. This reader assumes that one record is
>> on one
>> + * line which ends with the line
>> + */
>> +public class DelimitedReader {
>> + private InputStreamReader dataReader;
>> + private Vector[] lines;
>> + private Vector linesVector;
>> + private int numHeaderLines;
>> + private int numRecords;
>> + private boolean stripHeader = false;
>> + private int numCols;
>> + private String delimiter;
>> + private String lineEnding;
>> + private boolean collapseDilimiter = false;
>> + private int numFooterLines = 0;
>> + private Vector footerBuffer = new Vector();
>> + private boolean initializedFooterBuffer = false;
>> + private int headLineNumberCount = 0;
>> + private boolean isLenient = false;
>> + private String discoveredLineEnding = null;
>> + private static Vector possibleLineEndings = null;
>> +
>> + private static Log log;
>> + static {
>> + log = LogFactory.getLog("org.kepler.util.DelimitedReader");
>> + possibleLineEndings = new Vector();
>> + possibleLineEndings.add("\n");
>> + possibleLineEndings.add("\r");
>> + possibleLineEndings.add("\r\n");
>> + }
>> +
>> + /**
>> + * constructor. reads the csv stream.
>> + *
>> + * @param delimString
>> + * the delimited stream to read
>> + * @param numCols
>> + * the number of columns in the stream
>> + * @param delimiter
>> + * the delimiter to tokenize on
>> + * @param numHeaderLines
>> + * the number of lines to skip at the top of the file
>> + * @param lineEnding
>> + * the line ending char(s)...either "\n"lo (unix),
>> + * @param isLenient
>> + * specifies if extra columns should be ignored "\r\n"
>> (windoze)
>> + * or "\r" (mac)
>> + */
>> + public DelimitedReader(String data, int numCols, String delimiter,
>> + int numHeaderLines, String lineEnding, int numRecords,
>> + boolean isLenient) throws Exception {
>> + this.numHeaderLines = numHeaderLines;
>> + this.numCols = numCols;
>> + this.numRecords = numRecords;
>> + log.debug("Delimiter is: " + delimiter);
>> + this.delimiter = unescapeDelimiter(delimiter);
>> + log.debug("LineEnding is: " + lineEnding);
>> + this.lineEnding = unescapeDelimiter(lineEnding);
>> + this.isLenient = isLenient;
>> +
>> + // lines = new Vector[numRecords + numHeaderLines + 1];
>> + linesVector = new Vector();
>> +
>> + int begin = 0;
>> + int end = 0;
>> + // int i = 0;
>> + while (end < data.length()) { // add each line of the string
>> as an
>> + // element in a vector
>> + end = data.indexOf(this.lineEnding, begin); // DFH
>> 'this.' added
>> + if (end == -1) {
>> + end = data.length();
>> + }
>> + String line = data.substring(begin, end);
>> + if (!line.trim().equals("")) {
>> + // take off the line ending
>> + // MBJ: I commented out the next line as it was
>> improperly
>> + // truncating lines
>> + // I'm not sure why it was there in the first place,
>> as the
>> + // previous substring
>> + // removed the delimiter
>> + // line = line.substring(0, line.length() -
>> + // lineEnding.length());
>> +
>> + // split the line based on the delimiter
>> + Vector v = splitDelimitedRowStringIntoVector(line);
>> + /*
>> + * String[] s = line.split(delimiter.trim(),
>> numCols); Vector v
>> + * = new Vector(); for(int j=0; j<s.length; j++) {
>> + * v.addElement(s[j]); }
>> + *
>> + * if(v.size() < numCols) { int vsize = v.size();
>> for(int j=0;
>> + * j<numCols - vsize; j++) { //add any elements that
>> aren't
>> + * there so that all the records have the //same
>> number of cols
>> + * v.addElement(""); } }
>> + */
>> + // lines[i] = v;
>> + linesVector.add(v);
>> + // i++;
>> + }
>> + // go to the next line
>> + begin = end + this.lineEnding.length(); // DFH 'this.' added
>> + }
>> +
>> + int records = linesVector.size();
>> + if (records != this.numRecords) {
>> + this.numRecords = records;
>> + log
>> + .warn("Metadata disagrees with actual data.
>> Changing number of records to: "
>> + + records);
>> + }
>> + lines = new Vector[records];
>> + for (int k = 0; k < records; k++) {
>> + lines[k] = (Vector) linesVector.get(k);
>> + }
>> + /*
>> + * for(int j=0; j<lines.length; j++) { if(lines[j] == null) {
>> lines[j] =
>> + * new Vector(); } }
>> + */
>> +
>> + }
>> +
>> + /**
>> + * This constructor will read delimitered data from stream rather
>> a string
>> + *
>> + * @param dataStream
>> + * InputStream The input stream
>> + * @param numCols
>> + * int the number of columns
>> + * @param delimiter
>> + * String delimiter the delimiter to tokenize on
>> + * @param numHeaderLines
>> + * int numHeaderLines the number of lines to skip at
>> the top of
>> + * the file
>> + * @param lineEnding
>> + * String lineEnding the line ending char(s)...either
>> "\n"
>> + * (unix),"\r\n" (windoze) or "\r" (mac)
>> + * @param numRecords
>> + * int number of rows in the input stream
>> + */
>> + public DelimitedReader(InputStream dataStream, int numCols,
>> + String delimiter, int numHeaderLines, String lineEnding,
>> + int numRecords, boolean stripHeader) {
>> + this.dataReader = new InputStreamReader(dataStream);
>> + this.numHeaderLines = numHeaderLines;
>> + this.numCols = numCols;
>> + this.numRecords = numRecords;
>> + log.debug("Delimiter is: " + delimiter);
>> + this.delimiter = unescapeDelimiter(delimiter);
>> + log.debug("LineEnding is: " + lineEnding);
>> + this.lineEnding = unescapeDelimiter(lineEnding);
>> + this.stripHeader = stripHeader;
>> +
>> + }
>> +
>> + /**
>> + * Method to set up data stream as source
>> + *
>> + * @param dataStream
>> + * InputStream
>> + */
>> + public void setInputStream(InputStream dataStream) {
>> + this.dataReader = new InputStreamReader(dataStream);
>> + }
>> +
>> + /**
>> + * Method to set up collapseDelimiter. If it is yes, consecutive
>> dilimiters
>> + * will be consider as single dilimiter.
>> + *
>> + * @param collapseDelimiter
>> + */
>> + public void setCollapseDelimiter(boolean collapseDelimiter) {
>> + this.collapseDilimiter = collapseDelimiter;
>> + }
>> +
>> + /**
>> + * Set up the footer line number.
>> + *
>> + * @param numFooterLines
>> + */
>> + public void setNumFooterLines(int numFooterLines) {
>> + this.numFooterLines = numFooterLines;
>> + }
>> +
>> + public boolean isLenient() {
>> + return isLenient;
>> + }
>> +
>> + public void setLenient(boolean isLenient) {
>> + this.isLenient = isLenient;
>> + }
>> +
>> + /**
>> + * This method is from data source as a input stream This method
>> will read
>> + * one row from and return a data vector which element is String
>> and the
>> + * value is field data. After reach the end of stream, empty
>> vector will be
>> + * returned. So this method can be iterated by a while loop until
>> a empty
>> + * vector hited. During the iteration, every data in the stream
>> will be
>> + * pulled out.
>> + *
>> + * @return Vector
>> + */
>> + public Vector getRowDataVectorFromStream() throws Exception {
>> + // System.out.println("the numFootLines is "+numFooterLines);
>> + if (!initializedFooterBuffer) {
>> + for (int i = 0; i < numFooterLines; i++) {
>> + // System.out.println("the initialize with footer
>> lines");
>> + String rowData = readOneRowDataString();
>> + // System.out.println("the data vector in initailize
>> is "+rowData.toString());
>> + footerBuffer.add(rowData);
>> + }
>> + // this is for no footer lines
>> + if (numFooterLines == 0) {
>> + // System.out.println("the initialize without footer
>> lines");
>> + String rowData = readOneRowDataString();
>> + // System.out.println("The initial buffere vector is
>> "+rowData.toString());
>> + footerBuffer.add(rowData);
>> + }
>> + initializedFooterBuffer = true;
>> + }
>> + String nextRowData = readOneRowDataString();
>> + // System.out.println("the row string data from next row
>> "+nextRowData.toString());
>> + String oneRowDataString = null;
>> + Vector oneRowDataVector = new Vector();
>> +
>> + if (nextRowData != null) {
>> + // System.out.println("before nextRowData is empty and
>> nextRowData is "+nextRowData.toString());
>> + oneRowDataString = (String) footerBuffer.remove(0);
>> + reIndexFooterBufferVector();
>> + footerBuffer.add(nextRowData);
>> + } else if (numFooterLines == 0 && !footerBuffer.isEmpty()) {
>> + // System.out.println("find the last line in fottlines
>> num is 0!!!!!!!!");
>> + oneRowDataString = (String) footerBuffer.remove(0);
>> + }
>> + // System.out.println("helere!!!");
>> + if (oneRowDataString != null) {
>> + log.debug("in dataReader is not null");
>> + oneRowDataVector =
>> splitDelimitedRowStringIntoVector(oneRowDataString);
>> + }
>> + // System.out.println("the row data from buffer
>> "+oneRowDataVector.toString());
>> + return oneRowDataVector;
>> + }
>> +
>> + /*
>> + * This method will read a row data from vector. It discard the
>> head lines.
>> + * but it doesn't dsicard footer lines This method will be called by
>> + * getRowDataVectorFromStream
>> + */
>> + private String readOneRowDataString() {
>> + // Vector oneRowDataVector = new Vector();
>> + StringBuffer rowData = new StringBuffer();
>> + String rowDataString = null;
>> + int singleCharactor = -2;
>> +
>> + if (dataReader != null) {
>> + // log.debug("in dataReader is not null");
>> + try {
>> + while (singleCharactor != -1) {
>> + // log.debug("in singleCharactor is not null");
>> + singleCharactor = dataReader.read();
>> + char charactor = (char) singleCharactor;
>> + rowData.append(charactor);
>> + // find string - line ending in the row data
>> + boolean foundLineEnding =
>> (rowData.indexOf(lineEnding) != -1);
>> +
>> + // if we are being lenient, try some other line
>> endings for
>> + // parsing the data
>> + if (!foundLineEnding && this.isLenient()) {
>> + // have we discovered the ending already in
>> this data?
>> + if (this.discoveredLineEnding != null) {
>> + foundLineEnding = (rowData
>> +
>> .indexOf(this.discoveredLineEnding) != -1);
>> + }
>> + // otherwise we need to try a few of them out
>> + else {
>> + for (int i = 0; i <
>> possibleLineEndings.size(); i++) {
>> + String possibleLineEnding = (String)
>> possibleLineEndings
>> + .get(i);
>> + foundLineEnding = (rowData
>> + .indexOf(possibleLineEnding)
>> != -1);
>> + if (foundLineEnding) {
>> + this.discoveredLineEnding =
>> possibleLineEnding;
>> + break;
>> + }
>> + }
>> + }
>> + }
>> + // finally see if we found the end of the line
>> + if (foundLineEnding) {
>> + log.debug("found line ending");
>> + // strip the header lines
>> + if (stripHeader && numHeaderLines > 0
>> + && headLineNumberCount <
>> numHeaderLines) {
>> + // reset string buffer(descard the header
>> line)
>> + rowData = null;
>> + rowData = new StringBuffer();
>> +
>> + } else {
>> + rowDataString = rowData.toString();
>> + log.debug("The row data is " +
>> rowDataString);
>> + break;
>> + }
>> + headLineNumberCount++;
>> + }
>> + }
>> + } catch (Exception e) {
>> + log.debug("Couldn't read data from input stream");
>> + }
>> + }
>> + // System.out.println("the row data before reutrn is
>> "+rowDataString);
>> + return rowDataString;
>> + }
>> +
>> + /*
>> + * This method will forward one index for every element, 1 -> 0,
>> 2->1
>> + */
>> + private void reIndexFooterBufferVector() {
>> + for (int i = 0; i < numFooterLines - 2; i++) {
>> + Vector element = (Vector) footerBuffer.elementAt(i + 1);
>> + footerBuffer.add(i, element);
>> + }
>> + }
>> +
>> + /*
>> + * This method will read a delimitered string and put a
>> delimitered part
>> + * into an element in a vector. If the vector size is less than
>> the column
>> + * number empty string will be added.
>> + */
>> + private Vector splitDelimitedRowStringIntoVector(String data)
>> + throws Exception {
>> + Vector result = new Vector();
>> + if (data == null) {
>> + return result;
>> + }
>> + String[] s = null;
>> + if (!collapseDilimiter) {
>> + s = data.split(delimiter);
>> + } else {
>> + String newDelimiterWithRegExpress = delimiter + "+";
>> + s = data.split(newDelimiterWithRegExpress);
>> +
>> + }
>> +
>> + if (s != null) {
>> + if (!isLenient && s.length > numCols) {
>> + throw new Exception("Metadata sees data has " + numCols
>> + + " columns but actually data has " + s.length
>> + + " columns. Please make sure metadata is
>> correct!");
>> + }
>> + int columnCount = Math.min(s.length, numCols);
>> + for (int j = 0; j < columnCount; j++) {
>> +
>> + if (s[j] != null) {
>> + result.addElement(s[j].trim());
>> + } else {
>> + result.addElement("");
>> + }
>> + }
>> + // add any elements that aren't there so that all the
>> records have
>> + // the
>> + // same number of cols
>> + if (result.size() < numCols) {
>> + int vsize = result.size();
>> + for (int j = 0; j < numCols - vsize; j++) {
>> + result.addElement("");
>> + }
>> + }
>> + }
>> + return result;
>> + }
>> +
>> + /**
>> + * returns the data as an array of vectors. each vector will have
>> the same
>> + * number of elements as there are columns in the data.
>> + *
>> + * @param stripHeaderLines
>> + * true if the header lines should not be included in the
>> + * returned data, false otherwise
>> + */
>> + public Vector[] getTokenizedData(boolean stripHeaderLines) {
>> + if (stripHeaderLines) {
>> + Vector[] strip = null;
>> + if (numRecords > numHeaderLines) {
>> + strip = new Vector[numRecords - numHeaderLines];
>> + for (int i = numHeaderLines; i < lines.length; i++) {
>> + strip[i - numHeaderLines] = lines[i];
>> + }
>> + }
>> + return strip;
>> + } else {
>> + return lines;
>> + }
>> + }
>> +
>> + /**
>> + * returns a string representation of the data
>> + */
>> + public String toString() {
>> + StringBuffer sb = new StringBuffer();
>> + for (int i = 0; i < lines.length; i++) {
>> + log.debug("line[" + (i + 1) + "]: " + lines[i].toString());
>> + for (int j = 0; j < lines[i].size(); j++) {
>> + sb.append((String) lines[i].elementAt(j));
>> + if (j != lines[i].size() - 1) {
>> + sb.append(" || ");
>> + }
>> + }
>> + sb.append(lineEnding);
>> + }
>> + return sb.toString();
>> + }
>> +
>> + /**
>> + * Convert a string escaped representation of a delimiter
>> character into an
>> + * the actual String for that delimiter. This is used for
>> translating
>> + * escaped versions of tab, newline, and carriage return
>> characters to their
>> + * real character values.
>> + *
>> + * @param delimiter
>> + * the String representing the delimiter
>> + * @return the actual String for the delimiter
>> + */
>> + public static String unescapeDelimiter(String delimiter) {
>> + String newDelimiter = delimiter;
>> +
>> + if (delimiter == null) {
>> + log.debug("Delimiter is null and we set up to \n.");
>> + newDelimiter = "\n";
>> + } else if (delimiter.equals("\\t")) {
>> + log.debug("Tab interpreted incorrectly as string.");
>> + newDelimiter = "\t";
>> + } else if (delimiter.equals("\\n")) {
>> + log.debug("Newline interpreted incorrectly as string.");
>> + newDelimiter = "\n";
>> + } else if (delimiter.equals("\\r")) {
>> + log.debug("CR interpreted incorrectly as string.");
>> + newDelimiter = "\r";
>> + } else if (delimiter.equals("\\r\\n")) {
>> + log.debug("CRNL interpreted incorrectly as string.");
>> + newDelimiter = "\r\n";
>> + } else if (delimiter.startsWith("#")) {
>> + log.debug("XML entity charactor.");
>> + String digits = delimiter.substring(1, delimiter.length());
>> + int radix = 10;
>> + if (digits.startsWith("x")) {
>> + log.debug("Radix is " + 16);
>> + radix = 16;
>> + digits = digits.substring(1, digits.length());
>> + }
>> + log.debug("Int value of delimiter is " + digits);
>> +
>> + newDelimiter = transferDigitsToCharString(radix, digits);
>> +
>> + } else if (delimiter.startsWith("0x") ||
>> delimiter.startsWith("0X")) {
>> + int radix = 16;
>> + String digits = delimiter.substring(2, delimiter.length());
>> + log.debug("Int value of delimiter is " + digits);
>> + newDelimiter = transferDigitsToCharString(radix, digits);
>> + }
>> +
>> + return newDelimiter;
>> + }
>> +
>> + private static String transferDigitsToCharString(int radix,
>> String digits) {
>> + if (digits == null) {
>> + return null;
>> + }
>> + Integer integer = Integer.valueOf(digits, radix);
>> + int inter = integer.intValue();
>> + log.debug("The decimal value of char is " + inter);
>> + char charactor = (char) inter;
>> + String newDelimiter = Character.toString(charactor);
>> + log.debug("The new delimter is " + newDelimiter);
>> + return newDelimiter;
>> + }
>> +}
>>
>> Modified: trunk/modules/core/src/org/kepler/util/DotKeplerManager.java
>> ===================================================================
>> --- trunk/modules/core/src/org/kepler/util/DotKeplerManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/core/src/org/kepler/util/DotKeplerManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -7,7 +7,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.build.modules.Module;
>> import org.kepler.build.modules.ModuleTree;
>> import org.kepler.build.project.ProjectLocator;
>>
>> Modified:
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBDataTypeResolver.java
>>
>> ===================================================================
>> ---
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBDataTypeResolver.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBDataTypeResolver.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -35,7 +35,7 @@
>> import java.util.Hashtable;
>> import java.util.Map;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.objectmanager.data.UnresolvableTypeException;
>>
>> /**
>>
>> Modified:
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTableExistenceChecker.java
>>
>> ===================================================================
>> ---
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTableExistenceChecker.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTableExistenceChecker.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -39,7 +39,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>>
>> /**
>> * This class will check if a given table name already existed in db.
>> This class
>>
>> Modified:
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTablesGenerator.java
>>
>> ===================================================================
>> ---
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTablesGenerator.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DBTablesGenerator.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -41,9 +41,9 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> -import org.ecoinformatics.util.DelimitedReader;
>> +import org.kepler.util.Config;
>> +import org.kepler.util.DBConnectionFactory;
>> +import org.kepler.util.DelimitedReader;
>> import org.kepler.objectmanager.data.UnresolvableTypeException;
>> import org.kepler.objectmanager.data.db.Attribute;
>> import org.kepler.objectmanager.data.db.Entity;
>>
>> Modified:
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DelimiterResolver.java
>>
>> ===================================================================
>> ---
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DelimiterResolver.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/DelimiterResolver.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -37,7 +37,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> /**
>> * This class will map delimter format in metadata (e.g eml
>> documents) to the
>>
>> Modified:
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/HsqlDataQueryAction.java
>>
>> ===================================================================
>> ---
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/HsqlDataQueryAction.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/data-handling/src/org/ecoinformatics/seek/dataquery/HsqlDataQueryAction.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -41,7 +41,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.DBConnectionFactory;
>>
>> /**
>> * This class will handle data query action base on Hsql sql engine
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java
>>
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -46,7 +46,7 @@
>> import
>> org.ecoinformatics.ecogrid.queryservice.QueryServiceGetToStreamClient;
>> import org.ecoinformatics.seek.ecogrid.EcoGridService;
>> import org.ecoinformatics.seek.ecogrid.EcoGridServicesController;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.objectmanager.cache.BufferedDataCacheObject;
>> import org.kepler.objectmanager.cache.CacheManager;
>>
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/DocumentType.java
>>
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/DocumentType.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/DocumentType.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -38,7 +38,7 @@
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import
>> org.ecoinformatics.seek.ecogrid.exception.UnrecognizedDocumentTypeException;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> /**
>> * This class express a DocumentType object. It has three filed. The
>> namespace -
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/EcoGridServicesController.java
>>
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/EcoGridServicesController.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/EcoGridServicesController.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -41,7 +41,7 @@
>> import org.ecoinformatics.ecogrid.registry.stub.RegistryEntryType;
>> import
>> org.ecoinformatics.ecogrid.registry.stub.RegistryEntryTypeDocumentType;
>> import
>> org.ecoinformatics.seek.ecogrid.exception.InvalidEcoGridServiceException;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.authentication.AuthenticationException;
>> import org.kepler.authentication.AuthenticationManager;
>> import org.kepler.authentication.Domain;
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/SearchRegistryAction.java
>>
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/SearchRegistryAction.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/SearchRegistryAction.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -42,7 +42,7 @@
>> import org.apache.commons.logging.LogFactory;
>> import org.ecoinformatics.ecogrid.client.RegistryServiceClient;
>> import org.ecoinformatics.ecogrid.registry.stub.RegistryEntryType;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> import ptolemy.util.MessageHandler;
>>
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/quicksearch/SearchQueryGenerator.java
>>
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/quicksearch/SearchQueryGenerator.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/ecoinformatics/seek/ecogrid/quicksearch/SearchQueryGenerator.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -43,7 +43,7 @@
>> import org.ecoinformatics.ecogrid.queryservice.query.QueryType;
>> import org.ecoinformatics.ecogrid.queryservice.util.EcogridQueryParser;
>> import
>> org.ecoinformatics.seek.ecogrid.exception.InvalidEcogridQueryException;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.w3c.dom.Node;
>> import org.w3c.dom.NodeList;
>>
>>
>> Modified:
>> trunk/modules/ecogrid/src/org/kepler/authentication/gui/LDAPLoginGUI.java
>> ===================================================================
>> ---
>> trunk/modules/ecogrid/src/org/kepler/authentication/gui/LDAPLoginGUI.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ecogrid/src/org/kepler/authentication/gui/LDAPLoginGUI.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -57,7 +57,7 @@
>> import javax.swing.UIManager;
>>
>> import org.ecoinformatics.seek.ecogrid.MetadataSpecificationInterface;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.authentication.ProxyRepository;
>> import org.kepler.gui.KeplerGraphFrame;
>>
>>
>> Modified: trunk/modules/gui/src/org/kepler/gui/KeplerApplication.java
>> ===================================================================
>> --- trunk/modules/gui/src/org/kepler/gui/KeplerApplication.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/gui/src/org/kepler/gui/KeplerApplication.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -29,7 +29,7 @@
>> import java.io.File;
>> import java.net.URL;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> /**
>> * Main entry point for Kepler. This class reads the configuration
>>
>> Modified: trunk/modules/gui/src/org/kepler/gui/ViewManager.java
>> ===================================================================
>> --- trunk/modules/gui/src/org/kepler/gui/ViewManager.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/gui/src/org/kepler/gui/ViewManager.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -14,7 +14,7 @@
>> import javax.swing.JLabel;
>> import javax.swing.JPanel;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.gui.state.StateChangeMonitor;
>> import org.kepler.gui.state.ViewStateChangeEvent;
>> import org.w3c.dom.Node;
>>
>> Modified: trunk/modules/loader/src/org/kepler/gui/KeplerInitializer.java
>> ===================================================================
>> --- trunk/modules/loader/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/loader/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -44,8 +44,8 @@
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.ecoinformatics.seek.ecogrid.SearchRegistryAction;
>> -import org.ecoinformatics.util.Config;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.Config;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.geon.DBConnectionToken;
>> import org.kepler.util.DotKeplerManager;
>>
>>
>> Modified:
>> trunk/modules/module-manager/src/org/kepler/modulemanager/Restarter.java
>> ===================================================================
>> ---
>> trunk/modules/module-manager/src/org/kepler/modulemanager/Restarter.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/module-manager/src/org/kepler/modulemanager/Restarter.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -175,7 +175,7 @@
>> //Shutdown the database if
>> org.ecoinformatics.util.DBConnectionFactory is present.
>> try
>> {
>> - Class dbConnectionFactory =
>> Class.forName("org.ecoinformatics.util.DBConnectionFactory");
>> + Class dbConnectionFactory =
>> Class.forName("org.kepler.util.DBConnectionFactory");
>> dbConnectionFactory.getMethod("shutdownDBServer", new
>> Class[0]).invoke(null, new Object[0]);
>> }
>> catch (ClassNotFoundException e)
>> @@ -184,19 +184,19 @@
>> }
>> catch (NoSuchMethodException e)
>> {
>> - System.out.println("The method
>> org.ecoinformatics.util.DBConnectionFactory.shutdownDBServer() is
>> missing!");
>> + System.out.println("The method
>> org.kepler.util.DBConnectionFactory.shutdownDBServer() is missing!");
>> e.printStackTrace();
>> return null;
>> }
>> catch (IllegalAccessException e)
>> {
>> - System.out.println("Cannot access
>> org.ecoinformatics.util.DBConnectionFactory.shutdownDBServer()");
>> + System.out.println("Cannot access
>> org.kepler.util.DBConnectionFactory.shutdownDBServer()");
>> e.printStackTrace();
>> return null;
>> }
>> catch (InvocationTargetException e)
>> {
>> - System.out.println("Cannot invoke
>> org.ecoinformatics.util.DBConnectionFactory.shutdownDBServer()");
>> + System.out.println("Cannot invoke
>> org.kepler.util.DBConnectionFactory.shutdownDBServer()");
>> e.printStackTrace();
>> return null;
>> }
>>
>> Modified: trunk/modules/ppod-gui/src/org/daks/ppod/gui/WorkspacePane.java
>> ===================================================================
>> --- trunk/modules/ppod-gui/src/org/daks/ppod/gui/WorkspacePane.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/ppod-gui/src/org/daks/ppod/gui/WorkspacePane.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -66,7 +66,7 @@
>>
>> import javax.swing.event.ChangeEvent;
>> import javax.swing.event.ChangeListener;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.core.loader.ProjectLocator;
>> import org.kepler.gui.TabPane;
>> import org.kepler.gui.TabPaneExtensionExample;
>>
>> Modified:
>> trunk/modules/ppod-gui/src/org/kepler/gui/KeplerInitializer.java
>> ===================================================================
>> --- trunk/modules/ppod-gui/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++ trunk/modules/ppod-gui/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -39,9 +39,9 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> -import org.ecoinformatics.util.DBConnection;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.Config;
>> +import org.kepler.util.DBConnection;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.geon.DBConnectionToken;
>>
>> import ptolemy.actor.gui.Configuration;
>>
>> Modified:
>> trunk/modules/ppod-gui-1.0/src/org/daks/ppod/gui/WorkspacePane.java
>> ===================================================================
>> ---
>> trunk/modules/ppod-gui-1.0/src/org/daks/ppod/gui/WorkspacePane.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ppod-gui-1.0/src/org/daks/ppod/gui/WorkspacePane.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -64,7 +64,7 @@
>>
>> import javax.swing.event.ChangeEvent;
>> import javax.swing.event.ChangeListener;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> /**
>> * A simple pane used to display the workspace.
>>
>> Modified:
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/KeplerInitializer.java
>> ===================================================================
>> ---
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/KeplerInitializer.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -39,9 +39,9 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> -import org.ecoinformatics.util.DBConnection;
>> -import org.ecoinformatics.util.DBConnectionFactory;
>> +import org.kepler.util.Config;
>> +import org.kepler.util.DBConnection;
>> +import org.kepler.util.DBConnectionFactory;
>> import org.geon.DBConnectionToken;
>>
>> import ptolemy.actor.gui.Configuration;
>>
>> Modified:
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/TabbedLibraryPane.java
>> ===================================================================
>> ---
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/TabbedLibraryPane.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/ppod-gui-1.0/src/org/kepler/gui/TabbedLibraryPane.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -46,7 +46,7 @@
>> import javax.swing.event.ChangeEvent;
>> import javax.swing.event.ChangeListener;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.ecoinformatics.seek.ecogrid.SearchRegistryAction;
>>
>>
>>
>> Modified:
>> trunk/modules/reporting/src/org/kepler/kar/handlers/ReportInstanceKAREntryHandler.java
>>
>> ===================================================================
>> ---
>> trunk/modules/reporting/src/org/kepler/kar/handlers/ReportInstanceKAREntryHandler.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/reporting/src/org/kepler/kar/handlers/ReportInstanceKAREntryHandler.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -15,7 +15,7 @@
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.kepler.kar.KAREntry;
>> import org.kepler.kar.KAREntryHandler;
>> import org.kepler.kar.KAREntryHandlerFactory;
>>
>> Modified:
>> trunk/modules/reporting/src/org/kepler/reporting/rio/util/ImageUtil.java
>> ===================================================================
>> ---
>> trunk/modules/reporting/src/org/kepler/reporting/rio/util/ImageUtil.java
>> 2009-08-26 17:28:04 UTC (rev 20470)
>> +++
>> trunk/modules/reporting/src/org/kepler/reporting/rio/util/ImageUtil.java
>> 2009-08-26 17:38:14 UTC (rev 20471)
>> @@ -47,7 +47,7 @@
>> import multivalent.std.adaptor.pdf.PDF;
>> import net.sourceforge.iharder.Base64;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>> import org.jpedal.PdfDecoder;
>>
>> public class ImageUtil {
>>
>> Modified: trunk/modules/util/src/util/StaticUtil.java
>> ===================================================================
>> --- trunk/modules/util/src/util/StaticUtil.java 2009-08-26 17:28:04
>> UTC (rev 20470)
>> +++ trunk/modules/util/src/util/StaticUtil.java 2009-08-26 17:38:14
>> UTC (rev 20471)
>> @@ -70,7 +70,7 @@
>> import org.xml.sax.InputSource;
>> import org.xml.sax.SAXException;
>>
>> -import org.ecoinformatics.util.Config;
>> +import org.kepler.util.Config;
>>
>> /**
>> * This is a utility class. Any static methods that may be needed by
>> multiple
>>
>> _______________________________________________
>> Kepler-cvs mailing list
>> Kepler-cvs at kepler-project.org
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-cvs
>> _______________________________________________
>> Kepler-dev mailing list
>> Kepler-dev at kepler-project.org
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>
More information about the Kepler-dev
mailing list