-
-
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
unusedTargets.remove(image);
if (!tocTargets.containsKey(image))
{
- log(String.format(
- "Invalid image '%s' at line %d of %s", image, lineNo,
- HELP_HS));
+ log(String.format("Invalid image '%s' at line %d of %s", image,
+ lineNo, HELP_HS));
invalidImageCount++;
}
}
log(unusedTargets.size() + " unused targets");
for (String target : unusedTargets.keySet())
{
- log(String.format(" %s: %s", target,
- unusedTargets.get(target)));
+ log(String.format(" %s: %s", target, unusedTargets.get(target)));
}
log(invalidMapUrlCount + " invalid map urls");
log(invalidImageCount + " invalid image attributes");
- log(String.format(
- "%d internal href links (%d with anchors)", internalHrefCount,
- anchorRefCount));
- log(invalidInternalHrefCount
- + " invalid internal href links");
- log(invalidAnchorRefCount
- + " invalid internal anchor links");
+ log(String.format("%d internal href links (%d with anchors)",
+ internalHrefCount, anchorRefCount));
+ log(invalidInternalHrefCount + " invalid internal href links");
+ log(invalidAnchorRefCount + " invalid internal anchor links");
log(externalHrefCount + " external href links");
if (internetAvailable)
{
- log(invalidExternalHrefCount
- + " invalid external href links");
+ log(invalidExternalHrefCount + " invalid external href links");
}
else
{
{
if (!checkAnchorExists(hrefFile, anchor))
{
- log(String.format(
- "Invalid anchor: %s at line %d of %s", anchor,
- lineNo, getPath(htmlFile)));
+ log(String.format("Invalid anchor: %s at line %d of %s",
+ anchor, lineNo, getPath(htmlFile)));
invalidAnchorRefCount++;
}
}
}
if (badLink)
{
- log(String.format(
- "Invalid href %s at line %d of %s", href, lineNo,
- getPath(htmlFile)));
+ log(String.format("Invalid href %s at line %d of %s", href,
+ lineNo, getPath(htmlFile)));
}
}
data = br.readLine();
}
if (!new File(helpFolder, url).exists())
{
- log(String.format(
- "Invalid url path '%s' at line %d of %s", url, lineNo,
- HELP_JHM));
+ log(String.format("Invalid url path '%s' at line %d of %s", url,
+ lineNo, HELP_JHM));
invalidMapUrlCount++;
}
}
unusedTargets.remove(target);
if (!tocTargets.containsKey(target))
{
- log(String.format(
- "Invalid target '%s' at line %d of %s", target, lineNo,
- HELP_TOC_XML));
+ log(String.format("Invalid target '%s' at line %d of %s", target,
+ lineNo, HELP_TOC_XML));
invalidTargetCount++;
}
}
//========================================================================
//
-
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
// In this example it is the current directory but it can be configured to
// anything that the jvm has access to.
resource_handler.setDirectoriesListed(true);
- resource_handler.setWelcomeFiles(new String[]
- { "applets.html" });
+ resource_handler.setWelcomeFiles(new String[] { "applets.html" });
resource_handler.setResourceBase(".");
// Add the ResourceHandler to the server.
// GzipHandler gzip = new GzipHandler();
// server.setHandler(gzip);
HandlerList handlers = new HandlerList();
- handlers.setHandlers(new Handler[]
- { resource_handler, new DefaultHandler() });
+ handlers.setHandlers(new Handler[] { resource_handler,
+ new DefaultHandler() });
server.setHandler(handlers);
// Start things up! By using the server.join() the server thread will join
// for more details.
server.start();
server.join();
-}
+ }
}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
public class getJavaVersion
{
-/**
- * Takes a set of Jars and/or class files as arguments. Reports the java version for the classes
- */
+ /**
+ * Takes a set of Jars and/or class files as arguments. Reports the java
+ * version for the classes
+ */
public static void main(String[] args) throws IOException
{
- Hashtable observed=new Hashtable();
+ Hashtable observed = new Hashtable();
for (int i = 0; i < args.length; i++)
- {
- checkClassVersion(args[i], observed);
- }
+ {
+ checkClassVersion(args[i], observed);
+ }
printVersions(observed, System.out);
}
- public static void printVersions(Hashtable observed, java.io.PrintStream outs)
+
+ public static void printVersions(Hashtable observed,
+ java.io.PrintStream outs)
{
- if (observed.size()>0)
+ if (observed.size() > 0)
{
- int space=0;
- String key=null;
- for (Enumeration keys = observed.keys(); keys.hasMoreElements(); ) {
+ int space = 0;
+ String key = null;
+ for (Enumeration keys = observed.keys(); keys.hasMoreElements();)
+ {
key = (String) keys.nextElement();
- if (space++>0)
+ if (space++ > 0)
{
outs.print(" ");
}
String version = checkClassVersion(filename);
if (version == null)
{
-// System.err.println("Reading "+filename+" as jar:");
+ // System.err.println("Reading "+filename+" as jar:");
try
{
JarInputStream jis = new JarInputStream(new FileInputStream(
filename));
JarEntry entry;
- Hashtable perjar=new Hashtable();
+ Hashtable perjar = new Hashtable();
while ((entry = jis.getNextJarEntry()) != null)
{
if (entry != null)
}
}
}
- System.err.println("Jar : "+filename);
- printVersions(perjar,System.err);
+ System.err.println("Jar : " + filename);
+ printVersions(perjar, System.err);
} catch (Exception e)
{
{
if (version != null)
{
-// System.err.println("Version is '"+version+"'");
+ // System.err.println("Version is '"+version+"'");
int[] vrs = (int[]) observed.get(version);
if (vrs == null)
{
- vrs = new int[]
- { 0 };
+ vrs = new int[] { 0 };
}
vrs[0]++;
observed.put(version, vrs);
versions.put("52.0", "1.8");
}
- String version = (String) versions.get(major + "."
- + minor);
+ String version = (String) versions.get(major + "." + minor);
if (version == null)
{
// get nearest known version
version = (String) versions.get(major + ".0");
}
-// System.err.println("Version "+version);
+ // System.err.println("Version "+version);
if (version == null)
{
versions.put(major + "." + minor, "Class v" + major + ".0");
}
int minor = in.readUnsignedShort();
int major = in.readUnsignedShort();
-// System.err.println("Version "+major+"."+minor);
+ // System.err.println("Version "+major+"."+minor);
return parseVersions(minor, major);
}
public class help2Website
{
- public static void main(String [] args)
- {
- String line = "";
- try{
- Hashtable targets = new Hashtable();
+ public static void main(String[] args)
+ {
+ String line = "";
+ try
+ {
+ Hashtable targets = new Hashtable();
- File toc = new File("helpTOC.xml");
- File jhm = new File("help.jhm");
+ File toc = new File("helpTOC.xml");
+ File jhm = new File("help.jhm");
- BufferedReader in = new BufferedReader(new FileReader(jhm));
+ BufferedReader in = new BufferedReader(new FileReader(jhm));
- PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
- out.println("<html><head><title>Jalview - Help </title></head>\n"
- +"<body bgcolor=#F1F1F1>\n"
- +"<p><center><strong>Contents</strong></center></p>\n");
+ PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
+ out.println("<html><head><title>Jalview - Help </title></head>\n"
+ + "<body bgcolor=#F1F1F1>\n"
+ + "<p><center><strong>Contents</strong></center></p>\n");
+ StringTokenizer st;
+ StringBuffer indent = new StringBuffer();
+ String target, url, text;
+ while ((line = in.readLine()) != null)
+ {
+ if (line.indexOf("target") == -1)
+ continue;
- StringTokenizer st;
- StringBuffer indent = new StringBuffer();
- String target, url, text;
- while( (line = in.readLine()) != null)
- {
- if(line.indexOf("target")==-1)
- continue;
+ st = new StringTokenizer(line, "\"");
+ st.nextToken(); // <mapID target="
+ target = st.nextToken();
+ st.nextToken(); // " url="
- st = new StringTokenizer(line, "\"");
- st.nextToken(); //<mapID target="
+ url = st.nextToken();
+ targets.put(target, url);
+ }
- target = st.nextToken();
- st.nextToken(); //" url="
+ in = new BufferedReader(new FileReader(toc));
+ while ((line = in.readLine()) != null)
+ {
+ if (line.indexOf("</tocitem>") != -1)
+ indent.setLength(indent.length() - 18);
- url = st.nextToken();
- targets.put(target, url);
- }
+ if (line.indexOf("<tocitem") == -1)
+ continue;
- in = new BufferedReader(new FileReader(toc));
- while( (line = in.readLine()) != null)
- {
- if(line.indexOf("</tocitem>")!=-1)
- indent.setLength(indent.length()-18);
+ st = new StringTokenizer(line, "\"");
+ st.nextToken();
- if(line.indexOf("<tocitem")==-1)
- continue;
+ text = st.nextToken();
+ st.nextToken();
- st = new StringTokenizer(line, "\"");
- st.nextToken();
+ target = st.nextToken();
- text = st.nextToken();
- st.nextToken();
+ if (targets.get(target) != null)
+ {
+ out.println("<br>" + indent + "<a href=\"" + targets.get(target)
+ + "\" target=bodyframe>" + text + "</a>");
+ }
+ else
+ out.println("<br>" + indent + text);
- target = st.nextToken();
+ if (line.indexOf("/>") == -1)
+ indent.append(" ");
- if(targets.get(target)!=null)
- {
- out.println("<br>"+indent+"<a href=\""
- + targets.get(target)
- +"\" target=bodyframe>"
- +text
- +"</a>");
- }
- else
- out.println("<br>"+indent+text);
+ }
+ // Add Googletracker.
+ out.close();
- if(line.indexOf("/>")==-1)
- indent.append(" ");
+ }
- }
- // Add Googletracker.
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
- out.close();
-
- }
-
- catch(Exception ex)
- {
-
- ex.printStackTrace();
-
- System.out.println("\n"+line+"\n");
-
- System.out.println("Usage: move to Help directory. help2Website will read"
- +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");
- }
- }
+ System.out.println("\n" + line + "\n");
+ System.out
+ .println("Usage: move to Help directory. help2Website will read"
+ + "\nhelpTOC.xml and help.jhm producing output helpTOC.html");
+ }
+ }
}