[Mc4j-cvs] mc4j/src/org/mc4j/console/connection/install/finder ServerInstallInfo.java,1.4,1.5 FileSy
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2006-04-12 19:14:41
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/install/finder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20162/src/org/mc4j/console/connection/install/finder Modified Files: ServerInstallInfo.java FileSystemModel.java ServerInstallFinder.java Log Message: Merging EMS into head for the 2.0 release work Index: ServerInstallFinder.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/install/finder/ServerInstallFinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ServerInstallFinder.java 5 Oct 2004 05:15:58 -0000 1.2 --- ServerInstallFinder.java 12 Apr 2006 19:13:58 -0000 1.3 *************** *** 17,27 **** package org.mc4j.console.connection.install.finder; ! import org.mc4j.console.ManagementNode; ! import org.mc4j.console.connection.install.ConnectionTypeDescriptor; ! import java.util.Map; import java.util.HashMap; import java.util.Iterator; ! import java.io.File; /** --- 17,27 ---- package org.mc4j.console.connection.install.finder; ! import org.mc4j.ems.connection.ConnectionFactory; ! import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor; ! import java.io.File; import java.util.HashMap; import java.util.Iterator; ! import java.util.Map; /** *************** *** 31,34 **** --- 31,40 ---- public class ServerInstallFinder { + /** + * A map of the install directory to the recognition file used to recognize + * that install. + */ + private Map<File,File> recognitionFiles = new HashMap<File, File>(); + public static void main(String[] args) { outputClassloaders(ServerInstallFinder.class.getClassLoader()); *************** *** 57,62 **** public ServerInstallFinder() { ! for (int i = 0; i < ManagementNode.CONNECTION_DESCRIPTORS.length; i++) { ! ConnectionTypeDescriptor connectionDescriptor = ManagementNode.CONNECTION_DESCRIPTORS[i]; if (connectionDescriptor.getRecongnitionPath() != null) { recognitionMap.put(connectionDescriptor.getRecongnitionPath(), connectionDescriptor); --- 63,68 ---- public ServerInstallFinder() { ! ! for (ConnectionTypeDescriptor connectionDescriptor : ConnectionFactory.getConnectionTypes()) { if (connectionDescriptor.getRecongnitionPath() != null) { recognitionMap.put(connectionDescriptor.getRecongnitionPath(), connectionDescriptor); *************** *** 67,72 **** public void testDir(File file) { File[] children = file.listFiles(); ! for (int i = 0; i < children.length; i++) { ! File child = children[i]; if (child.isDirectory()) { ConnectionTypeDescriptor type = getServerTypePath(child); --- 73,77 ---- public void testDir(File file) { File[] children = file.listFiles(); ! for (File child : children) { if (child.isDirectory()) { ConnectionTypeDescriptor type = getServerTypePath(child); *************** *** 79,82 **** --- 84,91 ---- } + public File getRecognitionFile(File intallDirectory) { + return this.recognitionFiles.get(intallDirectory); + } + public ConnectionTypeDescriptor getServerTypePath(File file) { for (Iterator iterator = recognitionMap.entrySet().iterator(); iterator.hasNext();) { *************** *** 85,95 **** ConnectionTypeDescriptor descriptor = (ConnectionTypeDescriptor) entry.getValue(); ! if (matches(file, recognition)) return descriptor; } return null; } ! public boolean matches(File file, String recognition) { int l = recognition.indexOf('/'); String name = recognition; --- 94,107 ---- ConnectionTypeDescriptor descriptor = (ConnectionTypeDescriptor) entry.getValue(); ! File recognitionFile = matches(file, recognition); ! if (recognitionFile != null) { ! recognitionFiles.put(file, recognitionFile); return descriptor; + } } return null; } ! public File matches(File parentFile, String recognition) { int l = recognition.indexOf('/'); String name = recognition; *************** *** 100,113 **** } ! File curFile = new File(file.getAbsoluteFile() + "/" + name); ! if (!curFile.exists()) ! return false; ! ! if (nextName != null) { ! return matches(curFile,nextName); } else { ! return true; ! } } --- 112,133 ---- } ! if ("*".equals(name)) { ! File[] children = parentFile.listFiles(new FileSystemModel.DirectoryFilter()); ! for (File child : children) { ! File found = matches(child,nextName); ! if (found != null) return found; ! } ! return null; } else { ! File curFile = new File(parentFile.getAbsoluteFile() + "/" + name); ! if (!curFile.exists()) ! return null; + if (nextName != null) { + return matches(curFile,nextName); + } else { + return curFile; + } + } } Index: ServerInstallInfo.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/install/finder/ServerInstallInfo.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServerInstallInfo.java 14 Mar 2005 15:16:14 -0000 1.4 --- ServerInstallInfo.java 12 Apr 2006 19:13:58 -0000 1.5 *************** *** 17,21 **** package org.mc4j.console.connection.install.finder; ! import org.mc4j.console.connection.install.ConnectionTypeDescriptor; import java.io.File; --- 17,21 ---- package org.mc4j.console.connection.install.finder; ! import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor; import java.io.File; Index: FileSystemModel.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/install/finder/FileSystemModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileSystemModel.java 14 Mar 2005 15:16:04 -0000 1.3 --- FileSystemModel.java 12 Apr 2006 19:13:58 -0000 1.4 *************** *** 17,31 **** package org.mc4j.console.connection.install.finder; - import org.mc4j.console.connection.install.ConnectionTypeDescriptor; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; - import javax.swing.event.TreeModelListener; - import java.util.Map; - import java.util.HashMap; - import java.util.Vector; - import java.util.Arrays; import java.io.File; import java.io.FileFilter; /** --- 17,32 ---- package org.mc4j.console.connection.install.finder; + import org.mc4j.ems.connection.support.metadata.ConnectionTypeDescriptor; + + import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import java.io.File; import java.io.FileFilter; + import java.util.Arrays; + import java.util.HashMap; + import java.util.Map; + import java.util.Vector; /** *************** *** 97,101 **** ConnectionTypeDescriptor type = finder.getServerTypePath(f); if (type != null) { ! File recognitionFile = new File(f.getAbsolutePath() + "/" + type.getRecongnitionPath()); String version = type.getServerVersion(recognitionFile); if (version == null) { --- 98,102 ---- ConnectionTypeDescriptor type = finder.getServerTypePath(f); if (type != null) { ! File recognitionFile = finder.getRecognitionFile(f); String version = type.getServerVersion(recognitionFile); if (version == null) { |