[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/install s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Sun Aug 21 13:37:59 MST 2005
Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install
In directory www.crosswire.org:/tmp/cvs-serv23340/java/jsword/org/crosswire/jsword/book/install
Modified Files:
InstallManager.java Installer.java InstallManager.properties
InstallerFactory.properties
Log Message:
Willie Thean's laf changes.
Added ability to specify proxy for http download.
Changed default logging to INFO.
Index: Installer.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/Installer.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Installer.java 27 Jul 2005 23:25:45 -0000 1.15
--- Installer.java 21 Aug 2005 20:37:56 -0000 1.16
***************
*** 40,51 ****
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
*/
public interface Installer extends BookList
{
/**
* Accessor for the URL
* @return the source url
*/
! String getURL();
/**
--- 40,58 ----
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
*/
public interface Installer extends BookList
{
/**
+ * Get the type of the Installer.
+ * @return the type of the installer
+ */
+ String getType();
+
+ /**
* Accessor for the URL
* @return the source url
*/
! String getInstallerDefinition();
/**
***************
*** 70,73 ****
--- 77,88 ----
* @return whether there is a newer version to install
*/
+ int getSize(Book book);
+
+ /**
+ * Return true if the book is not installed or there is a newer
+ * version to install.
+ * @param book The book meta-data to check on.
+ * @return whether there is a newer version to install
+ */
boolean isNewer(Book book);
Index: InstallManager.properties
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/InstallManager.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** InstallManager.properties 15 Feb 2005 04:32:34 -0000 1.5
--- InstallManager.properties 21 Aug 2005 20:37:56 -0000 1.6
***************
*** 1,3 ****
! #Crosswire-FTP=sword-ftp\://ftp.crosswire.org/pub/sword/raw
! Download\ From\ Crosswire=sword-http\://www.crosswire.org/ftpmirror/pub/sword
! #Beta=sword-ftp\://ftp.sword.cx/pub/sword/betaraw
--- 1,15 ----
! # Format is as follows:
! # Each key is of the form: Installer.n, where n is a unique number.
! # Each value is of the form:
! # driver,label,host,path,proxyHost,proxyPort
! # a value may be empty
! # The drivers are defined in InstallerFactory.properties and in each installer.
!
! # The main "production" download site
! Installer.1=sword-http,Download From Crosswire,www.crosswire.org,/ftpmirror/pub/sword,,
!
! # The beta area is not set up correctly
! #Installer.2=sword-http,Crosswire Beta Downloads,www.crosswire.org,/ftpmirror/pub/sword/betaraw,,
!
! #FTP is no longer supported
! #Installer.3=sword-ftp,Download From Crosswire(FTP),ftp.crosswire.org,/pub/sword/raw,,
Index: InstallerFactory.properties
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/InstallerFactory.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** InstallerFactory.properties 10 Apr 2005 13:15:37 -0000 1.4
--- InstallerFactory.properties 21 Aug 2005 20:37:56 -0000 1.5
***************
*** 1,2 ****
! #sword-ftp: org.crosswire.jsword.book.install.sword.FtpSwordInstallerFactory
! sword-http: org.crosswire.jsword.book.install.sword.HttpSwordInstallerFactory
\ No newline at end of file
--- 1,2 ----
! #sword-ftp=org.crosswire.jsword.book.install.sword.FtpSwordInstallerFactory
! sword-http=org.crosswire.jsword.book.install.sword.HttpSwordInstallerFactory
\ No newline at end of file
Index: InstallManager.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/install/InstallManager.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** InstallManager.java 27 Jul 2005 23:25:45 -0000 1.20
--- InstallManager.java 21 Aug 2005 20:37:56 -0000 1.21
***************
*** 46,49 ****
--- 46,50 ----
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
*/
public class InstallManager
***************
*** 54,57 ****
--- 55,60 ----
public InstallManager()
{
+ installers = new HashMap();
+
try
{
***************
*** 62,71 ****
{
Map.Entry entry = (Map.Entry) it.next();
! String url = (String) entry.getValue();
try
{
! String[] parts = url.split(":"); //$NON-NLS-1$
String type = parts[0];
Class clazz = (Class) factories.get(type);
--- 65,76 ----
{
Map.Entry entry = (Map.Entry) it.next();
! String installerDefinition = (String) entry.getValue();
try
{
! String[] parts = installerDefinition.split(",", 3); //$NON-NLS-1$
String type = parts[0];
+ String name = parts[1];
+ String rest = parts[2];
Class clazz = (Class) factories.get(type);
***************
*** 77,83 ****
{
InstallerFactory ifactory = (InstallerFactory) clazz.newInstance();
! Installer installer = ifactory.createInstaller(url);
! internalAdd((String) entry.getKey(), installer);
}
}
--- 82,88 ----
{
InstallerFactory ifactory = (InstallerFactory) clazz.newInstance();
! Installer installer = ifactory.createInstaller(rest);
! internalAdd(name, installer);
}
}
***************
*** 101,109 ****
{
Properties props = new Properties();
for (Iterator it = installers.keySet().iterator(); it.hasNext(); )
{
String name = (String) it.next();
Installer installer = (Installer) installers.get(name);
! props.setProperty(name, installer.getURL());
}
URL outputURL = Project.instance().getWritablePropertiesURL(getClass().getName()); //$NON-NLS-1$
--- 106,123 ----
{
Properties props = new Properties();
+ StringBuffer buf = new StringBuffer();
+ int i = 1;
for (Iterator it = installers.keySet().iterator(); it.hasNext(); )
{
String name = (String) it.next();
Installer installer = (Installer) installers.get(name);
! // Clear the buffer
! buf.delete(0, buf.length());
! buf.append(installer.getType());
! buf.append(',');
! buf.append(name);
! buf.append(',');
! buf.append(installer.getInstallerDefinition());
! props.setProperty("Installer." + i++, buf.toString()); //$NON-NLS-1$
}
URL outputURL = Project.instance().getWritablePropertiesURL(getClass().getName()); //$NON-NLS-1$
***************
*** 182,186 ****
String name = (String) it.next();
Installer test = (Installer) installers.get(name);
! log.warn(" it isn't equal to " + test.getURL()); //$NON-NLS-1$
}
return null;
--- 196,200 ----
String name = (String) it.next();
Installer test = (Installer) installers.get(name);
! log.warn(" it isn't equal to " + test.getInstallerDefinition()); //$NON-NLS-1$
}
return null;
***************
*** 259,262 ****
--- 273,277 ----
log.warn("duplicate installers: " + name + "=" + tname + ". removing " + tname); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // Can't call removeInstaller while iterating.
it.remove();
fireInstallersChanged(this, tinstaller, false);
***************
*** 346,350 ****
* The list of discovered installers
*/
! private Map installers = new HashMap();
/**
--- 361,365 ----
* The list of discovered installers
*/
! private Map installers;
/**
More information about the jsword-svn
mailing list