]> source.dussan.org Git - gitblit.git/commitdiff
Removed obsolete Build classes and cleanup remnants of reorganization
authorJames Moger <james.moger@gitblit.com>
Wed, 27 Mar 2013 22:40:14 +0000 (18:40 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 27 Mar 2013 22:40:14 +0000 (18:40 -0400)
src/com/gitblit/EnforceAuthenticationFilter.java [deleted file]
src/com/gitblit/wicket/pages/LogoutPage.html [deleted file]
src/main/java/com/gitblit/build/Build.java [deleted file]
src/main/java/com/gitblit/build/BuildGhPages.java [deleted file]
src/main/java/com/gitblit/build/BuildSite.java [deleted file]
src/main/java/com/gitblit/build/BuildThumbnails.java [deleted file]
src/main/java/com/gitblit/build/BuildWebXml.java [deleted file]

diff --git a/src/com/gitblit/EnforceAuthenticationFilter.java b/src/com/gitblit/EnforceAuthenticationFilter.java
deleted file mode 100644 (file)
index 2a17996..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2013 Laurens Vrijnsen
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */package com.gitblit;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.gitblit.models.UserModel;
-
-/**
- * This filter enforces authentication via HTTP Basic Authentication, if the settings indicate so.
- * It looks at the settings "web.authenticateViewPages" and "web.enforceHttpBasicAuthentication"; if
- * both are true, any unauthorized access will be met with a HTTP Basic Authentication header.
- *
- * @author Laurens Vrijnsen
- *
- */
-public class EnforceAuthenticationFilter implements Filter {
-       
-       protected transient Logger logger = LoggerFactory.getLogger(getClass());
-
-       /* 
-        * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
-        */
-       @Override
-       public void init(FilterConfig filterConfig) throws ServletException {
-               // nothing to be done
-
-       } //init
-       
-
-       /* 
-        * This does the actual filtering: is the user authenticated? If not, enforce HTTP authentication (401)
-        * 
-        * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
-        */
-       @Override
-       public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-               
-               /*
-                * Determine whether to enforce the BASIC authentication:
-                */
-               @SuppressWarnings("static-access")
-               Boolean mustForceAuth = GitBlit.self().getBoolean(Keys.web.authenticateViewPages, false)
-                                                               && GitBlit.self().getBoolean(Keys.web.enforceHttpBasicAuthentication, false);
-               
-               HttpServletRequest  HttpRequest  = (HttpServletRequest)request;
-               HttpServletResponse HttpResponse = (HttpServletResponse)response; 
-               UserModel user = GitBlit.self().authenticate(HttpRequest);
-               
-               if (mustForceAuth && (user == null)) {
-                       // not authenticated, enforce now:
-                       logger.debug(MessageFormat.format("EnforceAuthFilter: user not authenticated for URL {0}!", request.toString()));
-                       @SuppressWarnings("static-access")
-                       String CHALLENGE = MessageFormat.format("Basic realm=\"{0}\"", GitBlit.self().getString("web.siteName",""));
-                       HttpResponse.setHeader("WWW-Authenticate", CHALLENGE);
-                       HttpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-                       return;
-
-               } else {
-                       // user is authenticated, or don't care, continue handling
-                       chain.doFilter( request, response );
-                       
-               } // authenticated
-       } // doFilter
-
-       
-       /* 
-        * @see javax.servlet.Filter#destroy()
-        */
-       @Override
-       public void destroy() {
-               // Nothing to be done
-
-       } // destroy
-
-}
diff --git a/src/com/gitblit/wicket/pages/LogoutPage.html b/src/com/gitblit/wicket/pages/LogoutPage.html
deleted file mode 100644 (file)
index d407783..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"  
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  
-      xml:lang="en"  
-      lang="en"> 
-<body>
-<wicket:extend>
-       <div class="navbar navbar-fixed-top">
-               <div class="navbar-inner">
-                       <div class="container">
-                               <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
-                               <span class="icon-bar"></span>
-                               <span class="icon-bar"></span>
-                               <span class="icon-bar"></span>
-                       </a>
-                               <a class="brand" wicket:id="rootLink">
-                                       <img src="gitblt_25_white.png" width="79" height="25" alt="gitblit" class="logo"/>
-                               </a>
-                               
-                       </div>
-               </div>
-       </div>
-                               
-       <!-- subclass content -->
-       <div class="container">
-               <div style="text-align:center" wicket:id="feedback">[Feedback Panel]</div>
-               
-               <h1><wicket:message key="gb.sessionEnded">[Session has ended]</wicket:message></h1>
-               <p><wicket:message key="gb.closeBrowser">[Please close the browser]</wicket:message></p>
-       </div>
-</wicket:extend>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/main/java/com/gitblit/build/Build.java b/src/main/java/com/gitblit/build/Build.java
deleted file mode 100644 (file)
index 3a9ed75..0000000
+++ /dev/null
@@ -1,967 +0,0 @@
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.build;\r
-\r
-import java.io.BufferedInputStream;\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileWriter;\r
-import java.io.FilenameFilter;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.RandomAccessFile;\r
-import java.net.URL;\r
-import java.text.MessageFormat;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Properties;\r
-\r
-import com.gitblit.Constants;\r
-import com.gitblit.utils.StringUtils;\r
-\r
-/**\r
- * The Build class downloads runtime and compile-time jar files from the Apache\r
- * or Eclipse Maven repositories.\r
- * \r
- * It also generates the Keys class from the gitblit.properties file.\r
- * \r
- * Its important that this class have minimal compile dependencies since its\r
- * called very early in the build script.\r
- * \r
- * @author James Moger\r
- * \r
- */\r
-public class Build {\r
-\r
-    private static final String osName = System.getProperty("os.name");\r
-\r
-       public interface DownloadListener {\r
-               public void downloading(String name);\r
-       }\r
-\r
-       /**\r
-        * BuildType enumeration representing compile-time or runtime. This is used\r
-        * to download dependencies either for Gitblit GO runtime or for setting up\r
-        * a development environment.\r
-        */\r
-       public static enum BuildType {\r
-               RUNTIME, COMPILETIME;\r
-       }\r
-\r
-       private static DownloadListener downloadListener;\r
-\r
-       public static void main(String... args) {\r
-               runtime();\r
-               compiletime();\r
-               buildSettingKeys();\r
-               delete(\r
-                               "bcmail-jdk16-1.46.jar",\r
-                               "bcprov-jdk16-1.46.jar",\r
-                               "src/bcmail-jdk16-1.46-sources.jar",\r
-                               "src/bcprov-jdk16-1.46-sources.jar");\r
-       }\r
-\r
-       public static void runtime() {\r
-               downloadFromApache(MavenObject.JCOMMANDER, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JETTY, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JETTY_AJP, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SERVLET, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4JAPI, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.WICKET, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.WICKET_EXT, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.WICKET_AUTH_ROLES, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.WICKET_GOOGLE_CHARTS, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_MAIL, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_PKIX, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.ROME, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JDOM, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.GSON, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.MAIL, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.GROOVY, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_HIGHLIGHTER, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_MEMORY, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_QUERIES, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JAKARTA_REGEXP, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.UNBOUND_ID, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.IVY, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JCALENDAR, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.COMMONS_COMPRESS, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.XZ, BuildType.RUNTIME);\r
-\r
-               //needed for selenium ui tests\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_API, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_FF, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_JAVA, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_REMOTE, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_SUPPORT, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.GUAVA, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.JSON, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.COMMONS_EXEC, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPCLIENT, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPCORE, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPMIME, BuildType.RUNTIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.COMMONS_LOGGING, BuildType.RUNTIME);\r
-               \r
-               downloadFromEclipse(MavenObject.JGIT, BuildType.RUNTIME);\r
-               downloadFromEclipse(MavenObject.JGIT_HTTP, BuildType.RUNTIME);\r
-       }\r
-\r
-       public static void compiletime() {\r
-               downloadFromApache(MavenObject.JUNIT, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.HAMCREST, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JCOMMANDER, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JETTY, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JETTY_AJP, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.SERVLET, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.SLF4JAPI, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.SLF4LOG4J, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.LOG4J, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.WICKET, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.WICKET_EXT, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.WICKET_AUTH_ROLES, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.WICKET_GOOGLE_CHARTS, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_MAIL, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_PKIX, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JSCH, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.ROME, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JDOM, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.GSON, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.MAIL, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.GROOVY, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.LUCENE, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.LUCENE_HIGHLIGHTER, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.LUCENE_MEMORY, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.LUCENE_QUERIES, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JAKARTA_REGEXP, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.UNBOUND_ID, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.IVY, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.JCALENDAR, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.COMMONS_COMPRESS, BuildType.COMPILETIME);\r
-               downloadFromApache(MavenObject.XZ, BuildType.COMPILETIME);\r
-\r
-               //needed for selenium ui tests\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_API, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_FF, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_JAVA, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_REMOTE, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.SEL_SUPPORT, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.GUAVA, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.JSON, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.COMMONS_EXEC, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPCLIENT, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPCORE, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.HTTPMIME, BuildType.COMPILETIME);\r
-               downloadFromApacheToExtSelenium(MavenObject.COMMONS_LOGGING, BuildType.COMPILETIME);\r
-               \r
-               downloadFromEclipse(MavenObject.JGIT, BuildType.COMPILETIME);\r
-               downloadFromEclipse(MavenObject.JGIT_HTTP, BuildType.COMPILETIME);\r
-\r
-               // needed for site publishing\r
-               downloadFromApache(MavenObject.COMMONSNET, BuildType.RUNTIME);\r
-       }\r
-       \r
-       private static void delete(String... files) {\r
-               for (String name : files) {\r
-                       File file = new File("ext", name);\r
-                       if (file.exists()) {\r
-                               file.delete();\r
-                       }\r
-               }\r
-       }\r
-\r
-       public static void federationClient() {\r
-               downloadFromApache(MavenObject.JCOMMANDER, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SERVLET, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.MAIL, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4JAPI, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.GSON, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_HIGHLIGHTER, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_MEMORY, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LUCENE_QUERIES, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JAKARTA_REGEXP, BuildType.RUNTIME);\r
-\r
-               downloadFromEclipse(MavenObject.JGIT, BuildType.RUNTIME);\r
-       }\r
-\r
-       public static void manager(DownloadListener listener) {\r
-               downloadListener = listener;\r
-               downloadFromApache(MavenObject.GSON, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.ROME, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JDOM, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);\r
-\r
-               downloadFromEclipse(MavenObject.JGIT, BuildType.RUNTIME);\r
-       }\r
-       \r
-       public static void authority(DownloadListener listener) {\r
-               downloadListener = listener;\r
-               downloadFromApache(MavenObject.JCOMMANDER, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4JAPI, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.SLF4LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.LOG4J, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_MAIL, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.BOUNCYCASTLE_PKIX, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.JCALENDAR, BuildType.RUNTIME);\r
-               downloadFromApache(MavenObject.MAIL, BuildType.RUNTIME);\r
-\r
-               downloadFromEclipse(MavenObject.JGIT, BuildType.RUNTIME);\r
-       }\r
-\r
-       /**\r
-        * Builds the Keys class based on the gitblit.properties file and inserts\r
-        * the class source into the project source folder.\r
-        */\r
-       public static void buildSettingKeys() {\r
-               // Load all keys\r
-               Properties properties = new Properties();\r
-               FileInputStream is = null;\r
-               try {\r
-                       is = new FileInputStream(new File("distrib", Constants.PROPERTIES_FILE));\r
-                       properties.load(is);\r
-               } catch (Throwable t) {\r
-                       t.printStackTrace();\r
-               } finally {\r
-                       if (is != null) {\r
-                               try {\r
-                                       is.close();\r
-                               } catch (Throwable t) {\r
-                                       // IGNORE\r
-                               }\r
-                       }\r
-               }\r
-               List<String> keys = new ArrayList<String>(properties.stringPropertyNames());\r
-               Collections.sort(keys);\r
-\r
-               KeyGroup root = new KeyGroup();\r
-               for (String key : keys) {\r
-                       root.addKey(key);\r
-               }\r
-\r
-               // Save Keys class definition\r
-               try {\r
-                       File file = new File("src/com/gitblit/Keys.java");\r
-                       FileWriter fw = new FileWriter(file, false);\r
-                       fw.write(root.generateClass("com.gitblit", "Keys"));\r
-                       fw.close();\r
-               } catch (Throwable t) {\r
-                       t.printStackTrace();\r
-               }\r
-       }\r
-       \r
-       private static class KeyGroup {\r
-               final KeyGroup parent;\r
-               final String namespace;\r
-               \r
-               String name;\r
-               List<KeyGroup> children;                \r
-               List<String> fields;            \r
-               \r
-               KeyGroup() {\r
-                       this.parent = null;\r
-                       this.namespace = "";\r
-                       this.name = ""; \r
-               }\r
-               \r
-               KeyGroup(String namespace, KeyGroup parent) {\r
-                       this.parent = parent;\r
-                       this.namespace = namespace;\r
-                       if (parent.children == null) {\r
-                               parent.children = new ArrayList<KeyGroup>();\r
-                       }\r
-                       parent.children.add(this);\r
-               }\r
-               \r
-               void addKey(String key) {\r
-                       String keyspace = "";\r
-                       String field = key;\r
-                       if (key.indexOf('.') > -1) {\r
-                               keyspace = key.substring(0, key.lastIndexOf('.'));\r
-                               field = key.substring(key.lastIndexOf('.') + 1);\r
-                               KeyGroup group = addKeyGroup(keyspace);\r
-                               group.addKey(field);\r
-                       } else {\r
-                               if (fields == null) {\r
-                                       fields = new ArrayList<String>();\r
-                               }\r
-                               fields.add(key);\r
-                       }\r
-               }\r
-                               \r
-               KeyGroup addKeyGroup(String keyspace) {\r
-                       KeyGroup parent = this;\r
-                       KeyGroup node = null;                   \r
-                       String [] space = keyspace.split("\\.");\r
-                       for (int i = 0; i < space.length; i++) {\r
-                               StringBuilder namespace = new StringBuilder();\r
-                               for (int j = 0; j <= i; j++) {\r
-                                       namespace.append(space[j]);\r
-                                       if (j < i) {\r
-                                               namespace.append('.');\r
-                                       }\r
-                               }\r
-                               if (parent.children != null) {\r
-                                       for (KeyGroup child : parent.children) {\r
-                                               if (child.name.equals(space[i])) {\r
-                                                       node = child;                                   \r
-                                               }\r
-                                       }\r
-                               }\r
-                               if (node == null) {\r
-                                       node = new KeyGroup(namespace.toString(), parent);\r
-                                       node.name = space[i];\r
-                               }\r
-                               parent = node;\r
-                               node = null;\r
-                       }\r
-                       return parent;\r
-               }               \r
-               \r
-               String fullKey(String field) {\r
-                       if (namespace.equals("")) {\r
-                               return field;\r
-                       }\r
-                       return namespace + "." + field;\r
-               }\r
-               \r
-               String generateClass(String packageName, String className) {\r
-                       StringBuilder sb = new StringBuilder();\r
-                       sb.append("package ").append(packageName).append(";\n");\r
-                       sb.append('\n');\r
-                       sb.append("/*\n");\r
-                       sb.append(" * This class is auto-generated from the properties file.\n");\r
-                       sb.append(" * Do not version control!\n");\r
-                       sb.append(" */\n");\r
-                       sb.append(MessageFormat.format("public final class {0} '{'\n\n", className));\r
-                       sb.append(generateClass(this, 0));\r
-                       sb.append("}\n");\r
-                       return sb.toString();\r
-               }\r
-               \r
-               String generateClass(KeyGroup group, int level) {\r
-                       String classIndent = StringUtils.leftPad("", level, '\t');\r
-                       String fieldIndent = StringUtils.leftPad("", level + 1, '\t');\r
-                       \r
-                       // begin class\r
-                       StringBuilder sb = new StringBuilder();\r
-                       if (!group.namespace.equals("")) {\r
-                               sb.append(classIndent).append(MessageFormat.format("public static final class {0} '{'\n\n", group.name));\r
-                               sb.append(fieldIndent).append(MessageFormat.format("public static final String _ROOT = \"{0}\";\n\n", group.namespace));\r
-                       }\r
-                       \r
-                       if (group.fields != null) {\r
-                               // fields\r
-                               for (String field : group.fields) {                                     \r
-                                       sb.append(fieldIndent).append(MessageFormat.format("public static final String {0} = \"{1}\";\n\n", field, group.fullKey(field)));\r
-                               }\r
-                       }\r
-                       if (group.children != null) {\r
-                               // inner classes\r
-                               for (KeyGroup child : group.children) {\r
-                                       sb.append(generateClass(child, level + 1));\r
-                               }\r
-                       }\r
-                       // end class\r
-                       if (!group.namespace.equals("")) {\r
-                               sb.append(classIndent).append("}\n\n");\r
-                       }\r
-                       return sb.toString();                   \r
-               }\r
-       }\r
-\r
-       /**\r
-        * Download a file from the official Apache Maven repository.\r
-        * \r
-        * @param mo\r
-        *            the maven object to download.\r
-        * @return\r
-        */\r
-       private static List<File> downloadFromApache(MavenObject mo, BuildType type) {\r
-               return downloadFromMaven("http://repo1.maven.org/maven2/", mo, type);\r
-       }\r
-\r
-       /**\r
-        * Download a file from the official Eclipse Maven repository.\r
-        * \r
-        * @param mo\r
-        *            the maven object to download.\r
-        * @return\r
-        */\r
-       private static List<File> downloadFromEclipse(MavenObject mo, BuildType type) {\r
-               return downloadFromMaven("http://download.eclipse.org/jgit/maven/", mo, type);\r
-       }\r
-\r
-       /**\r
-        * Download a file from a Maven repository.\r
-        * \r
-        * @param mo\r
-        *            the maven object to download.\r
-        * @return\r
-        */\r
-       private static List<File> downloadFromMaven(String mavenRoot, MavenObject mo, BuildType type, String targetFolder) {\r
-               List<File> downloads = new ArrayList<File>();\r
-               String[] jars = { "" };\r
-               if (BuildType.RUNTIME.equals(type)) {\r
-                       jars = new String[] { "" };\r
-               } else if (BuildType.COMPILETIME.equals(type)) {\r
-                       jars = new String[] { "-sources" };\r
-               }\r
-               for (String jar : jars) {\r
-                       File targetFile = mo.getLocalFile(targetFolder, jar);\r
-                       if ("-sources".equals(jar)) {\r
-                               File relocated = new File(targetFolder+"/src", targetFile.getName());\r
-                               if (targetFile.exists()) {\r
-                                       // move -sources jar to ext/src folder\r
-                                       targetFile.renameTo(relocated);\r
-                               }\r
-                               // -sources jars are located in ext/src\r
-                               targetFile = relocated;\r
-                       }\r
-                       \r
-                       if (targetFile.exists()) {\r
-                               downloads.add(targetFile);\r
-                               removeObsoleteArtifacts(mo, type, targetFile.getParentFile());\r
-                               continue;\r
-                       }\r
-                       String expectedSHA1 = mo.getSHA1(jar);\r
-                       if (expectedSHA1 == null) {\r
-                               // skip this jar\r
-                               continue;\r
-                       }\r
-                       float approximateLength = mo.getApproximateLength(jar);\r
-                       String mavenURL = mavenRoot + mo.getRepositoryPath(jar);\r
-                       if (!targetFile.getAbsoluteFile().getParentFile().exists()) {\r
-                               boolean success = targetFile.getAbsoluteFile().getParentFile().mkdirs();\r
-                               if (!success) {\r
-                                       throw new RuntimeException("Failed to create destination folder structure!");\r
-                               }\r
-                       }\r
-                       if (downloadListener != null) {\r
-                               downloadListener.downloading(mo.name + "...");\r
-                       }\r
-                       ByteArrayOutputStream buff = new ByteArrayOutputStream();\r
-                       try {\r
-                               URL url = new URL(mavenURL);\r
-                               InputStream in = new BufferedInputStream(url.openStream());\r
-                               byte[] buffer = new byte[4096];\r
-                               int downloadedLen = 0;\r
-                               float lastProgress = 0f;\r
-\r
-                               updateDownload(0, targetFile);\r
-                               while (true) {\r
-                                       int len = in.read(buffer);\r
-                                       if (len < 0) {\r
-                                               break;\r
-                                       }\r
-                                       downloadedLen += len;\r
-                                       buff.write(buffer, 0, len);\r
-                                       float progress = downloadedLen / approximateLength;\r
-                                       if (progress - lastProgress >= 0.1f) {\r
-                                               lastProgress = progress;\r
-                                               updateDownload(progress, targetFile);\r
-                                               if (downloadListener != null) {\r
-                                                       int percent = Math.min(100, Math.round(100 * progress));\r
-                                                       downloadListener.downloading(mo.name + " (" + percent + "%)");\r
-                                               }\r
-                                       }\r
-                               }\r
-                               in.close();\r
-                               updateDownload(1f, targetFile);\r
-                               if (downloadListener != null) {\r
-                                       downloadListener.downloading(mo.name + " (100%)");\r
-                               }\r
-\r
-                       } catch (IOException e) {\r
-                               throw new RuntimeException("Error downloading " + mavenURL + " to " + targetFile, e);\r
-                       }\r
-                       byte[] data = buff.toByteArray();\r
-                       String calculatedSHA1 = StringUtils.getSHA1(data);\r
-\r
-                       System.out.println();\r
-\r
-                       if (expectedSHA1.length() == 0) {\r
-                               updateProgress(0, "sha: " + calculatedSHA1);\r
-                               System.out.println();\r
-                       } else {\r
-                               if (!calculatedSHA1.equals(expectedSHA1)) {\r
-                                       throw new RuntimeException("SHA1 checksum mismatch; got: " + calculatedSHA1);\r
-                               }\r
-                       }\r
-                       try {\r
-                               RandomAccessFile ra = new RandomAccessFile(targetFile, "rw");\r
-                               ra.write(data);\r
-                               ra.setLength(data.length);\r
-                               ra.close();\r
-                       } catch (IOException e) {\r
-                               throw new RuntimeException("Error writing to file " + targetFile, e);\r
-                       }\r
-                       downloads.add(targetFile);\r
-                       \r
-                       removeObsoleteArtifacts(mo, type, targetFile.getParentFile());\r
-               }\r
-               return downloads;\r
-       }\r
-       \r
-       /**\r
-        * Download a file from the official Apache Maven repository.\r
-        * \r
-        * @param mo\r
-        *            the maven object to download.\r
-        * @return\r
-        */\r
-       private static List<File> downloadFromApacheToExtSelenium(MavenObject mo,\r
-                       BuildType type) {\r
-               return downloadFromMaven("http://repo1.maven.org/maven2/", mo, type,\r
-                               "ext/seleniumhq");\r
-       }\r
-       \r
-       /**\r
-        * Download a file from the official Apache Maven repository.\r
-        * \r
-        * @param mo\r
-        *            the maven object to download.\r
-        * @return\r
-        */\r
-       private static List<File> downloadFromMaven(String mavenRoot,\r
-                       MavenObject mo, BuildType type) {\r
-               return downloadFromMaven(mavenRoot, mo, type, "ext");\r
-       }\r
-       \r
-       private static void removeObsoleteArtifacts(final MavenObject mo, final BuildType type, File folder) {\r
-               File [] removals = folder.listFiles(new FilenameFilter() {\r
-                       @Override\r
-                       public boolean accept(File dir, String name) {\r
-                               String n = name.toLowerCase();\r
-                               String dep = mo.artifact.toLowerCase();\r
-                               if (n.startsWith(dep)) {\r
-                                       String suffix = "-" + mo.version;\r
-                                       if (type.equals(BuildType.COMPILETIME)) {\r
-                                               suffix += "-sources.jar";\r
-                                       } else {\r
-                                               suffix += ".jar";\r
-                                       }\r
-                                       if (!n.endsWith(suffix)) {\r
-                                               return true;\r
-                                       }\r
-                               }\r
-                               return false;\r
-                       }\r
-               });\r
-               \r
-               // delete any matches\r
-               if (removals != null) {\r
-                       for (File file : removals) {\r
-                               System.out.println("deleting " + file);\r
-                               file.delete();\r
-                       }\r
-               }\r
-       }\r
-\r
-       private static void updateDownload(float progress, File file) {\r
-               updateProgress(progress, "d/l: " + file.getName());\r
-       }\r
-\r
-       private static void updateProgress(float progress, String url) {\r
-        boolean isWindows = osName.contains("Windows");\r
-        String anim = "==========";\r
-               int width = Math.round(anim.length() * progress);\r
-        if (isWindows) System.out.print("\r");\r
-               System.out.print("[");\r
-               System.out.print(anim.substring(0, Math.min(width, anim.length())));\r
-               for (int i = 0; i < anim.length() - width; i++) {\r
-                       System.out.print(' ');\r
-               }\r
-               System.out.print("] " + url);\r
-        if (!isWindows) System.out.println();\r
-       }\r
-\r
-       /**\r
-        * MavenObject represents a complete maven artifact (binary, sources, and\r
-        * javadoc). MavenObjects can be downloaded and checksummed to confirm\r
-        * authenticity.\r
-        */\r
-       private static class MavenObject {\r
-\r
-               public static final MavenObject JCOMMANDER = new MavenObject(\r
-                "jCommander", "com/beust", "jcommander", "1.17",\r
-                34000, 32000, 141000,\r
-                               "219a3540f3b27d7cc3b1d91d6ea046cd8723290e",\r
-                               "0bb50eec177acf0e94d58e0cf07262fe5164331d",\r
-                               "c7adc475ca40c288c93054e0f4fe58f3a98c0cb5");\r
-\r
-               public static final MavenObject JETTY = new MavenObject(\r
-                "Jetty", "org/eclipse/jetty/aggregate", "jetty-webapp", "7.6.8.v20121106",\r
-                1000000, 680000, 2720000,\r
-                "6333969b4d509c4b681e05302ca7ebccb9c3efb5",\r
-                               "354f2752ed6544296bc0fc92e533d68a5b03045b",\r
-                               "");\r
-\r
-               public static final MavenObject JETTY_AJP = new MavenObject(\r
-                "Jetty-AJP", "org/eclipse/jetty", "jetty-ajp", "7.6.8.v20121106",\r
-                32000, 22000, 97000,\r
-                "95bd1c89bb2afd4eeaabc6f4b0183a9f26a522d7",\r
-                "e1fc2539202ebb240a87a080bc44a24c93d7318b",\r
-                "");\r
-               \r
-               public static final MavenObject SERVLET = new MavenObject(\r
-                "Servlet 3.0", "javax/servlet", "javax.servlet-api", "3.0.1",\r
-                84000, 211000, 0,\r
-                               "6bf0ebb7efd993e222fc1112377b5e92a13b38dd",\r
-                               "01952f91d84016a39e31346c9d18bd8c9c4a128a",\r
-                null);\r
-\r
-               public static final MavenObject SLF4JAPI = new MavenObject(\r
-                "SLF4J API", "org/slf4j", "slf4j-api", "1.6.6",\r
-                25500, 45000, 182000,\r
-                               "ce53b0a0e2cfbb27e8a59d38f79a18a5c6a8d2b0",\r
-                               "bcd0e21b1572960cefd449f8a16efab5b6b8e644",\r
-                               "4253b52aabf1c5a5f20c191a261e6ada0fcf621d");\r
-\r
-               public static final MavenObject SLF4LOG4J = new MavenObject(\r
-                "SLF4J LOG4J", "org/slf4j", "slf4j-log4j12", "1.6.6",\r
-                9800, 9500, 52400,\r
-                               "5cd9b4fbc3ff6a97beaade3206137d76f65df805",\r
-                               "497bfac9a678118e7ff75d1f3b8c3bcc06dc9c8c",\r
-                               "69855e2a85d9249bb577df3c5076bc2cb34975d7");\r
-\r
-               public static final MavenObject LOG4J = new MavenObject(\r
-                "Apache LOG4J", "log4j", "log4j", "1.2.17",\r
-                481000, 471000, 1455000,\r
-                "5af35056b4d257e4b64b9e8069c0746e8b08629f",\r
-                               "677abe279b68c5e7490d6d50c6951376238d7d3e",\r
-                               "c10c20168206896442f3192d5417815df7fcbf9a");\r
-\r
-               public static final MavenObject WICKET = new MavenObject(\r
-                "Apache Wicket", "org/apache/wicket", "wicket", "1.4.21",\r
-                1960000, 1906000, 6818000,\r
-                               "cce9dfd3088e18a3cdcf9be33b5b76caa48dc4c6",\r
-                               "e8c2bfe2c96a2da7a0eca947a2f60dc3242e7229",\r
-                               "");\r
-\r
-               public static final MavenObject WICKET_EXT = new MavenObject(\r
-                "Apache Wicket Extensions", "org/apache/wicket", "wicket-extensions", "1.4.21",\r
-                1180000, 1118000, 1458000,\r
-                               "fac510c7ee4399a29b927405ec3de40b67d105d8",\r
-                               "ee3409ce9ed64ad8cc8d69abbd7d63f07e10851a",\r
-                               "");\r
-\r
-               public static final MavenObject WICKET_AUTH_ROLES = new MavenObject(\r
-                               "Apache Wicket Auth Roles", "org/apache/wicket", "wicket-auth-roles", "1.4.21",\r
-                               44000, 45000, 166000,\r
-                "e78df70ca942e2e15287c393f236b32fbe6f9a30",\r
-                               "47c301212cce43a70caa72f41a9a1aefcf26a533",\r
-                               "");\r
-\r
-               public static final MavenObject WICKET_GOOGLE_CHARTS = new MavenObject(\r
-                               "Apache Wicket Google Charts Add-On", "org/wicketstuff", "googlecharts", "1.4.21",\r
-                               34000, 18750, 161000,\r
-                "73d7540267afc3a0e91ca6148d3073e050dba180",\r
-                               "627b125cc6029d4d5c59c3a910c1bef347384d97",\r
-                               "");\r
-\r
-               public static final MavenObject JUNIT = new MavenObject(\r
-                "JUnit", "junit", "junit", "4.10",\r
-                               253000, 141000, 0, "e4f1766ce7404a08f45d859fb9c226fc9e41a861",\r
-                "6c98d6766e72d5575f96c9479d1c1d3b865c6e25", "");\r
-\r
-               public static final MavenObject HAMCREST = new MavenObject(\r
-                "Hamcrest Core", "org/hamcrest", "hamcrest-core", "1.1",\r
-                               77000, 0, 0,\r
-                "860340562250678d1a344907ac75754e259cdb14",\r
-                null,\r
-                "");\r
-\r
-               public static final MavenObject MARKDOWNPAPERS = new MavenObject(\r
-                "MarkdownPapers", "org/tautua/markdownpapers", "markdownpapers-core", "1.3.2",\r
-                92000, 60000, 268000,\r
-                               "da22db6660e90b9a677bbdfc2c511c619ea5c249",\r
-                               "6a7228280a229144afe6c01351a8f44675d8524d",\r
-                               "");\r
-\r
-               public static final MavenObject BOUNCYCASTLE = new MavenObject(\r
-                "BouncyCastle", "org/bouncycastle", "bcprov-jdk15on", "1.47",\r
-                1900000, 1400000, 4670000,\r
-                               "b6f5d9926b0afbde9f4dbe3db88c5247be7794bb",\r
-                               "85e6e1ad449d5a3f09624bf4038fc8d2b02de81c",\r
-                               "");\r
-\r
-               public static final MavenObject BOUNCYCASTLE_MAIL = new MavenObject(\r
-                "BouncyCastle Mail", "org/bouncycastle", "bcmail-jdk15on", "1.47",\r
-                502000, 420000, 482000,\r
-                               "a35ccec640177d0de5815568529021af5546d6a7",\r
-                               "f742330cfe1e7365dbdf773c24b92382172164a7",\r
-                               "");\r
-\r
-               public static final MavenObject BOUNCYCASTLE_PKIX = new MavenObject(\r
-                "BouncyCastle PKIX", "org/bouncycastle", "bcpkix-jdk15on", "1.47",\r
-                502000, 420000, 482000,\r
-                               "cd204e6f26d2bbf65ff3a30de8831d3a1344e851",\r
-                               "80e774a73d0e6a6b40ddf35fff613f9f30fe2a98",\r
-                               "");\r
-\r
-               public static final MavenObject JGIT = new MavenObject(\r
-                "JGit", "org/eclipse/jgit", "org.eclipse.jgit", "2.2.0.201212191850-r",\r
-                1600000, 1565000, 3460000,\r
-                               "97d0761b9dd618d1f9f6c16c35c3ddf045ba536c",\r
-                               "08dcf9546f4d61e1b8a50df5da5513006023b64b",\r
-                               "");\r
-\r
-               public static final MavenObject JGIT_HTTP = new MavenObject(\r
-                "JGit", "org/eclipse/jgit", "org.eclipse.jgit.http.server", "2.2.0.201212191850-r",\r
-                68000, 62000, 110000,\r
-                               "8ad4fc4fb9529d645249bb46ad7e54d98436cb65",\r
-                               "3385cf294957d1d34c1270b468853aea347b36ca",\r
-                               "");\r
-\r
-               public static final MavenObject JSCH = new MavenObject(\r
-                "JSch", "com/jcraft", "jsch", "0.1.44-1",\r
-                214000, 211000, 413000,\r
-                "2e9ae08de5a71bd0e0d3ba2558598181bfa71d4e",\r
-                               "e528f593b19b04d500992606f58b87fcfded8883",\r
-                               "d0ffadd0a4ab909d94a577b5aad43c13b617ddcb");\r
-\r
-               public static final MavenObject COMMONSNET = new MavenObject(\r
-                "commons-net", "commons-net", "commons-net", "1.4.0",\r
-                181000, 0, 0,\r
-                "eb47e8cad2dd7f92fd7e77df1d1529cae87361f7",\r
-                               "",\r
-                "");\r
-\r
-               public static final MavenObject ROME = new MavenObject(\r
-                "rome", "rome", "rome", "0.9",\r
-                               208000, 196000, 407000,\r
-                "dee2705dd01e79a5a96a17225f5a1ae30470bb18",\r
-                               "226f851dc44fd94fe70b9c471881b71f88949cbf",\r
-                               "8d7d867b97eeb3a9196c3926da550ad042941c1b");\r
-\r
-               public static final MavenObject JDOM = new MavenObject(\r
-                "jdom", "jdom", "jdom", "1.0",\r
-                               153000, 235000, 445000,\r
-                "a2ac1cd690ab4c80defe7f9bce14d35934c35cec",\r
-                               "662abe0196cf554d4d7374f5d6382034171b652c",\r
-                               "");\r
-\r
-               public static final MavenObject GSON = new MavenObject(\r
-                "gson", "com/google/code/gson", "gson", "1.7.2",\r
-                174000, 142000, 247000,\r
-                               "112366d8158749e25532ebce162232c6e0fb20a5",\r
-                               "a6fe3006df46174a9c1c56b3c51357b9bfde5874",\r
-                               "537f729ac63b6132a795a3c1f2e13b327e872333");\r
-\r
-               public static final MavenObject MAIL = new MavenObject(\r
-                "javax.mail", "javax/mail", "mail", "1.4.3",\r
-                462000, 642000, 0,\r
-                "8154bf8d666e6db154c548dc31a8d512c273f5ee",\r
-                               "5875e2729de83a4e46391f8f979ec8bd03810c10", null);\r
-\r
-               public static final MavenObject GROOVY = new MavenObject(\r
-                "groovy", "org/codehaus/groovy", "groovy-all", "1.8.8",\r
-                6143000, 2290000, 4608000,\r
-                "98a489343d3c30da817d36cbea5de11ed07bef31",\r
-                               "5f847ed18009f8a034bad3906e39f771c01728c1", "");\r
-\r
-               public static final MavenObject LUCENE = new MavenObject(\r
-                "lucene", "org/apache/lucene", "lucene-core", "3.6.1",\r
-                1540000, 1431000, 3608000,\r
-                "6ae2c83c77a1ffa5840b9151a271ab3f451f6e0c",\r
-                               "6925deb6b78e63bbcac382004f00b98133327057", "");\r
-\r
-               public static final MavenObject LUCENE_HIGHLIGHTER = new MavenObject(\r
-                "lucene highlighter", "org/apache/lucene", "lucene-highlighter", "3.6.1",\r
-                89200, 85000, 0,\r
-                "2bd49695e9891697c5f290aa94c3412dfb95b096",\r
-                               "20ae81816ce9c27186ef0f2e92a57812c9ee3b6c", "");\r
-\r
-               public static final MavenObject LUCENE_MEMORY = new MavenObject(\r
-                "lucene memory", "org/apache/lucene", "lucene-memory", "3.6.1",\r
-                30000, 23000, 0,\r
-                "8c7ca5572edea50973dc0d26cf75c27047eebe7e",\r
-                               "2e291e96d25132e002b1c8240e361d1272d113e1", "");\r
-\r
-               public static final MavenObject LUCENE_QUERIES = new MavenObject(\r
-                "lucene queries", "org/apache/lucene", "lucene-queries", "3.6.1",\r
-                47400, 48600, 0,\r
-                "4ed6022dd4aa80b932a1546e7e39e3b8bbe7acb7",\r
-                               "dc425c75d988e4975d314772035a46b6a17dcc8d", "");\r
-\r
-               public static final MavenObject JAKARTA_REGEXP = new MavenObject(\r
-                "jakarta regexp", "jakarta-regexp", "jakarta-regexp", "1.4",\r
-                28500, 0, 0,\r
-                "0ea514a179ac1dd7e81c7e6594468b9b9910d298",\r
-                               null, "");\r
-               \r
-               public static final MavenObject UNBOUND_ID = new MavenObject(\r
-                "unbound id", "com/unboundid", "unboundid-ldapsdk", "2.3.0",\r
-                1383417, 1439721, 0,\r
-                "6fde8d9fb4ee3e7e3d7e764e3ea57195971e2eb2",\r
-                               "5276d3d29630693dba99ab9f7ea54f4c471d3af1",\r
-                "");\r
-               \r
-               public static final MavenObject IVY = new MavenObject(\r
-                "ivy", "org/apache/ivy", "ivy",        "2.2.0",\r
-                948000, 744000, 0,\r
-                "f9d1e83e82fc085093510f7d2e77d81d52bc2081",\r
-                               "0312527950ad0e8fbab37228fbed3bf41a6fe0a1", "");\r
-\r
-               public static final MavenObject JCALENDAR = new MavenObject(\r
-                "jcalendar", "com/toedter", "jcalendar", "1.3.2",\r
-                127000, 0, 0,\r
-                "323a672aeacb5f5f4461be3b7f7d9d3e4bda80d4",\r
-                               null, "");\r
-\r
-               public static final MavenObject COMMONS_COMPRESS = new MavenObject(\r
-                "commons-compress", "org/apache/commons", "commons-compress", "1.4.1",\r
-                242000, 265000, 0,\r
-                "b02e84a993d88568417536240e970c4b809126fd",\r
-                               "277d39267403965a7a192474794a29bac6760a25", "");\r
-\r
-               public static final MavenObject XZ = new MavenObject(\r
-                "xz", "org/tukaani", "xz", "1.0",\r
-                95000, 120000, 0,\r
-                "ecff5cb8b1189514c9d1d8d68eb77ac372e000c9",\r
-                               "f95e32a5d2dd8da643c4419814415b9704312993", "");\r
-\r
-               public static final MavenObject SEL_JAVA = new MavenObject(\r
-                               "selenium-java", "org/seleniumhq/selenium", "selenium-java",\r
-                               "2.28.0", 984098, 0, 0,\r
-                               "7606286989ac9cb942cc206d975ffe187c18d605", "4ede08d293dc153989a337cd0d31d26421433af5", "");\r
-\r
-               public static final MavenObject SEL_API = new MavenObject(\r
-                               "selenium-api", "org/seleniumhq/selenium", "selenium-api",\r
-                               "2.28.0", 984098, 0, 0,\r
-                               "c4044c40fff65cd25135a5f443638a2b1ccaeac5", "35fc6ec0804ae32b16a56627e69bdcb69995c515", "");\r
-\r
-               public static final MavenObject SEL_REMOTE = new MavenObject(\r
-                               "selenium-remote-driver", "org/seleniumhq/selenium",\r
-                               "selenium-remote-driver", "2.28.0", 984098, 0, 0,\r
-                               "c67f97cd94e02afec92b0ac881844febb4fc90be", "51a9c30de3c8c203cb7a474a10842443005a5fb4", "");\r
-               public static final MavenObject SEL_SUPPORT = new MavenObject(\r
-                               "selenium-support", "org/seleniumhq/selenium",\r
-                               "selenium-support", "2.28.0", 984098, 0, 0,\r
-                               "caf68d6310425f583bc592c08e43066b35eb94f6", "ce3831a601f5f50fda2f4604decde409b6c735a7", "");\r
-               public static final MavenObject SEL_FF = new MavenObject(\r
-                               "selenium-firefox-driver", "org/seleniumhq/selenium",\r
-                               "selenium-firefox-driver", "2.28.0", 984098, 0, 0,\r
-                               "a7c34e45dba39e65467b900aa67611aaa039692d", "aa8cd5fb49ca75a53d5b143406ea3d81ab3eddfd", "");\r
-\r
-               public static final MavenObject GUAVA = new MavenObject("guava",\r
-                               "com/google/guava", "guava", "12.0", 984098, 0, 0,\r
-                               "5bc66dd95b79db1e437eb08adba124a3e4088dc0", "f8b98e61865bed3c39b978ee3bf5c7fb990c4032", "");\r
-\r
-               public static final MavenObject JSON = new MavenObject("json",\r
-                               "org/json", "json", "20080701", 984098, 0, 0,\r
-                               "d652f102185530c93b66158b1859f35d45687258", "71bd54221e701df9d112bf9ba2918e13b0671f3a", "");\r
-\r
-               public static final MavenObject COMMONS_EXEC = new MavenObject(\r
-                               "commons-exec", "org/apache/commons", "commons-exec", "1.1",\r
-                               984098, 0, 0, "07dfdf16fade726000564386825ed6d911a44ba1", "f60bea898e18b308099862e8634d589b06a8b0be",\r
-                               "");\r
-\r
-               public static final MavenObject HTTPCORE = new MavenObject("httpcore",\r
-                               "org/apache/httpcomponents", "httpcore", "4.2.1", 984098, 0, 0,\r
-                               "2d503272bf0a8b5f92d64db78b4ba9abbaccc6fd", "3f6caf5334fa83607b82e2f32dd128a9d8a0ea5e", "");\r
-               \r
-               public static final MavenObject HTTPMIME = new MavenObject("httpmime",\r
-                               "org/apache/httpcomponents", "httpmime", "4.2.1", 984098, 0, 0,\r
-                               "7c772bace9aa31a728c39a88c6ff66a7cd177e89", "", "4e453843ae47f1c2d70e2eb2c13c037de4b614c4");\r
-               \r
-               public static final MavenObject HTTPCLIENT = new MavenObject(\r
-                               "httpclient", "org/apache/httpcomponents", "httpclient",\r
-                               "4.2.1", 984098, 0, 0,\r
-                               "b69bd03af60bf487b3ae1209a644ecac587bf6fc", "6b27312b9c28b59aaeb6c21f3490045690c703d3", "");\r
-               public static final MavenObject COMMONS_LOGGING = new MavenObject(\r
-                               "commons-logging", "commons-logging", "commons-logging",\r
-                               "1.1.1", 984098, 0, 0,\r
-                               "5043bfebc3db072ed80fbd362e7caf00e885d8ae", "f3f156cbff0e0fb0d64bfce31a352cce4a33bc19", "");\r
-               \r
-               public final String name;\r
-               public final String group;\r
-               public final String artifact;\r
-               public final String version;\r
-               public final int approxLibraryLen;\r
-               public final int approxSourcesLen;\r
-               public final int approxJavadocLen;\r
-               public final String librarySHA1;\r
-               public final String sourcesSHA1;\r
-               public final String javadocSHA1;\r
-\r
-               private MavenObject(String name, String group, String artifact, String version,\r
-                               int approxLibraryLen, int approxSourcesLen, int approxJavadocLen,\r
-                               String librarySHA1, String sourcesSHA1, String javadocSHA1) {\r
-                       this.name = name;\r
-                       this.group = group;\r
-                       this.artifact = artifact;\r
-                       this.version = version;\r
-                       this.approxLibraryLen = approxLibraryLen;\r
-                       this.approxSourcesLen = approxSourcesLen;\r
-                       this.approxJavadocLen = approxJavadocLen;\r
-                       this.librarySHA1 = librarySHA1;\r
-                       this.sourcesSHA1 = sourcesSHA1;\r
-                       this.javadocSHA1 = javadocSHA1;\r
-               }\r
-\r
-               private String getRepositoryPath(String jar) {\r
-                       return group + "/" + artifact + "/" + version + "/" + artifact + "-" + version + jar\r
-                                       + ".jar";\r
-               }\r
-\r
-               private File getLocalFile(String basePath, String jar) {\r
-                       return new File(basePath, artifact + "-" + version + jar + ".jar");\r
-               }\r
-\r
-               private String getSHA1(String jar) {\r
-                       if (jar.equals("")) {\r
-                               return librarySHA1;\r
-                       } else if (jar.equals("-sources")) {\r
-                               return sourcesSHA1;\r
-                       } else if (jar.equals("-javadoc")) {\r
-                               return javadocSHA1;\r
-                       }\r
-                       return librarySHA1;\r
-               }\r
-\r
-               private int getApproximateLength(String jar) {\r
-                       if (jar.equals("")) {\r
-                               return approxLibraryLen;\r
-                       } else if (jar.equals("-sources")) {\r
-                               return approxSourcesLen;\r
-                       } else if (jar.equals("-javadoc")) {\r
-                               return approxJavadocLen;\r
-                       }\r
-                       return approxLibraryLen;\r
-               }\r
-\r
-               @Override\r
-               public String toString() {\r
-                       return name;\r
-               }\r
-       }\r
-}\r
diff --git a/src/main/java/com/gitblit/build/BuildGhPages.java b/src/main/java/com/gitblit/build/BuildGhPages.java
deleted file mode 100644 (file)
index 5982ac3..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*\r
- * Copyright 2012 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.build;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.text.MessageFormat;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Set;\r
-import java.util.TreeSet;\r
-\r
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\r
-import org.eclipse.jgit.api.errors.JGitInternalException;\r
-import org.eclipse.jgit.dircache.DirCache;\r
-import org.eclipse.jgit.dircache.DirCacheBuilder;\r
-import org.eclipse.jgit.dircache.DirCacheEntry;\r
-import org.eclipse.jgit.internal.JGitText;\r
-import org.eclipse.jgit.lib.CommitBuilder;\r
-import org.eclipse.jgit.lib.Constants;\r
-import org.eclipse.jgit.lib.FileMode;\r
-import org.eclipse.jgit.lib.ObjectId;\r
-import org.eclipse.jgit.lib.ObjectInserter;\r
-import org.eclipse.jgit.lib.PersonIdent;\r
-import org.eclipse.jgit.lib.RefUpdate;\r
-import org.eclipse.jgit.lib.RefUpdate.Result;\r
-import org.eclipse.jgit.lib.Repository;\r
-import org.eclipse.jgit.lib.RepositoryCache.FileKey;\r
-import org.eclipse.jgit.revwalk.RevCommit;\r
-import org.eclipse.jgit.revwalk.RevWalk;\r
-import org.eclipse.jgit.storage.file.FileRepository;\r
-import org.eclipse.jgit.treewalk.CanonicalTreeParser;\r
-import org.eclipse.jgit.treewalk.TreeWalk;\r
-import org.eclipse.jgit.util.FS;\r
-\r
-import com.beust.jcommander.JCommander;\r
-import com.beust.jcommander.Parameter;\r
-import com.beust.jcommander.ParameterException;\r
-import com.beust.jcommander.Parameters;\r
-import com.gitblit.models.RefModel;\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.StringUtils;\r
-\r
-/**\r
- * Creates or updates a gh-pages branch with the specified content.\r
- * \r
- * @author James Moger\r
- * \r
- */\r
-public class BuildGhPages {\r
-\r
-       public static void main(String[] args) {\r
-               Params params = new Params();\r
-               JCommander jc = new JCommander(params);\r
-               try {\r
-                       jc.parse(args);\r
-               } catch (ParameterException t) {\r
-                       System.err.println(t.getMessage());\r
-                       jc.usage();\r
-               }\r
-\r
-               File source = new File(params.sourceFolder);\r
-               String ghpages = "refs/heads/gh-pages";\r
-               try {                   \r
-                       File gitDir = FileKey.resolve(new File(params.repositoryFolder), FS.DETECTED);\r
-                       Repository repository = new FileRepository(gitDir);\r
-\r
-                       RefModel issuesBranch = JGitUtils.getPagesBranch(repository);\r
-                       if (issuesBranch == null) {\r
-                               JGitUtils.createOrphanBranch(repository, "gh-pages", null);\r
-                       }\r
-\r
-                       System.out.println("Updating gh-pages branch...");\r
-                       ObjectId headId = repository.resolve(ghpages + "^{commit}");\r
-                       ObjectInserter odi = repository.newObjectInserter();\r
-                       try {\r
-                               // Create the in-memory index of the new/updated issue.\r
-                               DirCache index = createIndex(repository, headId, source, params.obliterate);\r
-                               ObjectId indexTreeId = index.writeTree(odi);\r
-\r
-                               // Create a commit object\r
-                               PersonIdent author = new PersonIdent("Gitblit", "gitblit@localhost");\r
-                               CommitBuilder commit = new CommitBuilder();\r
-                               commit.setAuthor(author);\r
-                               commit.setCommitter(author);\r
-                               commit.setEncoding(Constants.CHARACTER_ENCODING);\r
-                               commit.setMessage("updated pages");\r
-                               commit.setParentId(headId);\r
-                               commit.setTreeId(indexTreeId);\r
-\r
-                               // Insert the commit into the repository\r
-                               ObjectId commitId = odi.insert(commit);\r
-                               odi.flush();\r
-\r
-                               RevWalk revWalk = new RevWalk(repository);\r
-                               try {\r
-                                       RevCommit revCommit = revWalk.parseCommit(commitId);\r
-                                       RefUpdate ru = repository.updateRef(ghpages);\r
-                                       ru.setNewObjectId(commitId);\r
-                                       ru.setExpectedOldObjectId(headId);\r
-                                       ru.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);\r
-                                       Result rc = ru.forceUpdate();\r
-                                       switch (rc) {\r
-                                       case NEW:\r
-                                       case FORCED:\r
-                                       case FAST_FORWARD:\r
-                                               break;\r
-                                       case REJECTED:\r
-                                       case LOCK_FAILURE:\r
-                                               throw new ConcurrentRefUpdateException(JGitText.get().couldNotLockHEAD,\r
-                                                               ru.getRef(), rc);\r
-                                       default:\r
-                                               throw new JGitInternalException(MessageFormat.format(\r
-                                                               JGitText.get().updatingRefFailed, ghpages, commitId.toString(), rc));\r
-                                       }\r
-                               } finally {\r
-                                       revWalk.release();\r
-                               }\r
-                       } finally {\r
-                               odi.release();\r
-                       }\r
-                       System.out.println("gh-pages updated.");\r
-               } catch (Throwable t) {\r
-                       t.printStackTrace();\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Creates an in-memory index of the issue change.\r
-        * \r
-        * @param repo\r
-        * @param headId\r
-        * @param sourceFolder\r
-        * @param obliterate\r
-        *            if true the source folder tree is used as the new tree for\r
-        *            gh-pages and non-existent files are considered deleted\r
-        * @return an in-memory index\r
-        * @throws IOException\r
-        */\r
-       private static DirCache createIndex(Repository repo, ObjectId headId, File sourceFolder,\r
-                       boolean obliterate) throws IOException {\r
-\r
-               DirCache inCoreIndex = DirCache.newInCore();\r
-               DirCacheBuilder dcBuilder = inCoreIndex.builder();\r
-               ObjectInserter inserter = repo.newObjectInserter();\r
-\r
-               try {\r
-                       // Add all files to the temporary index\r
-                       Set<String> ignorePaths = new TreeSet<String>();\r
-                       List<File> files = listFiles(sourceFolder);\r
-                       for (File file : files) {\r
-                               // create an index entry for the file\r
-                               final DirCacheEntry dcEntry = new DirCacheEntry(StringUtils.getRelativePath(\r
-                                               sourceFolder.getPath(), file.getPath()));\r
-                               dcEntry.setLength(file.length());\r
-                               dcEntry.setLastModified(file.lastModified());\r
-                               dcEntry.setFileMode(FileMode.REGULAR_FILE);\r
-\r
-                               // add this entry to the ignore paths set\r
-                               ignorePaths.add(dcEntry.getPathString());\r
-\r
-                               // insert object\r
-                               InputStream inputStream = new FileInputStream(file);\r
-                               try {\r
-                                       dcEntry.setObjectId(inserter.insert(Constants.OBJ_BLOB, file.length(),\r
-                                                       inputStream));\r
-                               } finally {\r
-                                       inputStream.close();\r
-                               }\r
-\r
-                               // add to temporary in-core index\r
-                               dcBuilder.add(dcEntry);\r
-                       }\r
-\r
-                       if (!obliterate) {\r
-                               // Traverse HEAD to add all other paths\r
-                               TreeWalk treeWalk = new TreeWalk(repo);\r
-                               int hIdx = -1;\r
-                               if (headId != null)\r
-                                       hIdx = treeWalk.addTree(new RevWalk(repo).parseTree(headId));\r
-                               treeWalk.setRecursive(true);\r
-\r
-                               while (treeWalk.next()) {\r
-                                       String path = treeWalk.getPathString();\r
-                                       CanonicalTreeParser hTree = null;\r
-                                       if (hIdx != -1)\r
-                                               hTree = treeWalk.getTree(hIdx, CanonicalTreeParser.class);\r
-                                       if (!ignorePaths.contains(path)) {\r
-                                               // add entries from HEAD for all other paths\r
-                                               if (hTree != null) {\r
-                                                       // create a new DirCacheEntry with data retrieved\r
-                                                       // from\r
-                                                       // HEAD\r
-                                                       final DirCacheEntry dcEntry = new DirCacheEntry(path);\r
-                                                       dcEntry.setObjectId(hTree.getEntryObjectId());\r
-                                                       dcEntry.setFileMode(hTree.getEntryFileMode());\r
-\r
-                                                       // add to temporary in-core index\r
-                                                       dcBuilder.add(dcEntry);\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               // release the treewalk\r
-                               treeWalk.release();\r
-                       }\r
-                       \r
-                       // finish temporary in-core index used for this commit\r
-                       dcBuilder.finish();\r
-               } finally {\r
-                       inserter.release();\r
-               }\r
-               return inCoreIndex;\r
-       }\r
-\r
-       private static List<File> listFiles(File folder) {\r
-               List<File> files = new ArrayList<File>();\r
-               for (File file : folder.listFiles()) {\r
-                       if (file.isDirectory()) {\r
-                               files.addAll(listFiles(file));\r
-                       } else {\r
-                               files.add(file);\r
-                       }\r
-               }\r
-               return files;\r
-       }\r
-\r
-       /**\r
-        * JCommander Parameters class for BuildGhPages.\r
-        */\r
-       @Parameters(separators = " ")\r
-       private static class Params {\r
-\r
-               @Parameter(names = { "--sourceFolder" }, description = "Source folder for pages", required = true)\r
-               public String sourceFolder;\r
-\r
-               @Parameter(names = { "--repository" }, description = "Repository folder", required = true)\r
-               public String repositoryFolder;\r
-\r
-               @Parameter(names = { "--obliterate" }, description = "Replace gh-pages tree with only the content in your sourcefolder")\r
-               public boolean obliterate;\r
-\r
-       }\r
-}\r
diff --git a/src/main/java/com/gitblit/build/BuildSite.java b/src/main/java/com/gitblit/build/BuildSite.java
deleted file mode 100644 (file)
index efff5a3..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.build;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.FileReader;\r
-import java.io.FilenameFilter;\r
-import java.io.OutputStreamWriter;\r
-import java.nio.charset.Charset;\r
-import java.text.MessageFormat;\r
-import java.text.ParseException;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import com.beust.jcommander.JCommander;\r
-import com.beust.jcommander.Parameter;\r
-import com.beust.jcommander.ParameterException;\r
-import com.beust.jcommander.Parameters;\r
-import com.gitblit.Constants;\r
-import com.gitblit.utils.FileUtils;\r
-import com.gitblit.utils.MarkdownUtils;\r
-import com.gitblit.utils.StringUtils;\r
-\r
-/**\r
- * Builds the web site or deployment documentation from Markdown source files.\r
- * \r
- * All Markdown source files must have the .mkd extension.\r
- * \r
- * Natural string sort order of the Markdown source filenames is the order of\r
- * page links. "##_" prefixes are used to control the sort order.\r
- * \r
- * @author James Moger\r
- * \r
- */\r
-public class BuildSite {\r
-\r
-       private static final String SPACE_DELIMITED = "SPACE-DELIMITED";\r
-\r
-       private static final String CASE_SENSITIVE = "CASE-SENSITIVE";\r
-\r
-       private static final String RESTART_REQUIRED = "RESTART REQUIRED";\r
-\r
-       private static final String SINCE = "SINCE";\r
-\r
-       public static void main(String... args) {\r
-               Params params = new Params();\r
-               JCommander jc = new JCommander(params);\r
-               try {\r
-                       jc.parse(args);\r
-               } catch (ParameterException t) {\r
-                       usage(jc, t);\r
-               }\r
-\r
-               File sourceFolder = new File(params.sourceFolder);\r
-               File destinationFolder = new File(params.outputFolder);\r
-               File[] markdownFiles = sourceFolder.listFiles(new FilenameFilter() {\r
-\r
-                       @Override\r
-                       public boolean accept(File dir, String name) {\r
-                               return name.toLowerCase().endsWith(".mkd");\r
-                       }\r
-               });\r
-               Arrays.sort(markdownFiles);\r
-\r
-               Map<String, String> aliasMap = new HashMap<String, String>();\r
-               for (String alias : params.aliases) {\r
-                       String[] values = alias.split("=");\r
-                       aliasMap.put(values[0], values[1]);\r
-               }\r
-\r
-               System.out.println(MessageFormat.format("Generating site from {0} Markdown Docs in {1} ",\r
-                               markdownFiles.length, sourceFolder.getAbsolutePath()));\r
-\r
-               String htmlHeader = FileUtils.readContent(new File(params.pageHeader), "\n");\r
-\r
-               String htmlAdSnippet = null;\r
-               if (!StringUtils.isEmpty(params.adSnippet)) {\r
-                       File snippet = new File(params.adSnippet);\r
-                       if (snippet.exists()) {\r
-                               htmlAdSnippet = FileUtils.readContent(snippet, "\n");\r
-                       }\r
-               }\r
-               String htmlFooter = FileUtils.readContent(new File(params.pageFooter), "\n");\r
-               final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());\r
-               final String footer = MessageFormat.format(htmlFooter, "generated " + date);\r
-               for (File file : markdownFiles) {\r
-                       String documentName = getDocumentName(file);\r
-                       if (params.skips.contains(documentName)) {\r
-                               continue;\r
-                       }\r
-                       try {\r
-                               String links = createLinks(file, markdownFiles, aliasMap, params.skips);\r
-                               String header = MessageFormat.format(htmlHeader, Constants.FULL_NAME, links);\r
-                               if (!StringUtils.isEmpty(params.analyticsSnippet)) {\r
-                                       File snippet = new File(params.analyticsSnippet);\r
-                                       if (snippet.exists()) {\r
-                                               String htmlSnippet = FileUtils.readContent(snippet, "\n");\r
-                                               header = header.replace("<!-- ANALYTICS -->", htmlSnippet);\r
-                                       }\r
-                               }\r
-\r
-                               String fileName = documentName + ".html";\r
-                               System.out.println(MessageFormat.format("  {0} => {1}", file.getName(), fileName));\r
-                               String rawContent = FileUtils.readContent(file, "\n");\r
-                               String markdownContent = rawContent;\r
-\r
-                               Map<String, List<String>> nomarkdownMap = new HashMap<String, List<String>>();\r
-\r
-                               // extract sections marked as no-markdown\r
-                               int nmd = 0;\r
-                               for (String token : params.nomarkdown) {\r
-                                       StringBuilder strippedContent = new StringBuilder();\r
-\r
-                                       String nomarkdownKey = "%NOMARKDOWN" + nmd + "%";\r
-                                       String[] kv = token.split(":", 2);\r
-                                       String beginToken = kv[0];\r
-                                       String endToken = kv[1];\r
-\r
-                                       // strip nomarkdown chunks from markdown and cache them\r
-                                       List<String> chunks = new Vector<String>();\r
-                                       int beginCode = 0;\r
-                                       int endCode = 0;\r
-                                       while ((beginCode = markdownContent.indexOf(beginToken, endCode)) > -1) {\r
-                                               if (endCode == 0) {\r
-                                                       strippedContent.append(markdownContent.substring(0, beginCode));\r
-                                               } else {\r
-                                                       strippedContent.append(markdownContent.substring(endCode, beginCode));\r
-                                               }\r
-                                               strippedContent.append(nomarkdownKey);\r
-                                               endCode = markdownContent.indexOf(endToken, beginCode);\r
-                                               chunks.add(markdownContent.substring(beginCode, endCode));\r
-                                               nomarkdownMap.put(nomarkdownKey, chunks);\r
-                                       }\r
-\r
-                                       // get remainder of text\r
-                                       if (endCode < markdownContent.length()) {\r
-                                               strippedContent.append(markdownContent.substring(endCode,\r
-                                                               markdownContent.length()));\r
-                                       }\r
-                                       markdownContent = strippedContent.toString();\r
-                                       nmd++;\r
-                               }\r
-\r
-                               // transform markdown to html\r
-                               String content = transformMarkdown(markdownContent.toString());\r
-\r
-                               // reinsert nomarkdown chunks\r
-                               for (Map.Entry<String, List<String>> nomarkdown : nomarkdownMap.entrySet()) {\r
-                                       for (String chunk : nomarkdown.getValue()) {\r
-                                               content = content.replaceFirst(nomarkdown.getKey(), chunk);\r
-                                       }\r
-                               }\r
-\r
-                               for (String token : params.substitutions) {\r
-                                       String[] kv = token.split("=", 2);\r
-                                       content = content.replace(kv[0], kv[1]);\r
-                               }\r
-                               for (String token : params.regex) {\r
-                                       String[] kv = token.split("!!!", 2);\r
-                                       content = content.replaceAll(kv[0], kv[1]);\r
-                               }\r
-                               for (String alias : params.properties) {\r
-                                       String[] kv = alias.split("=", 2);\r
-                                       String loadedContent = generatePropertiesContent(new File(kv[1]));\r
-                                       content = content.replace(kv[0], loadedContent);\r
-                               }\r
-                               for (String alias : params.loads) {\r
-                                       String[] kv = alias.split("=", 2);\r
-                                       String loadedContent = FileUtils.readContent(new File(kv[1]), "\n");\r
-                                       loadedContent = StringUtils.escapeForHtml(loadedContent, false);\r
-                                       loadedContent = StringUtils.breakLinesForHtml(loadedContent);\r
-                                       content = content.replace(kv[0], loadedContent);\r
-                               }\r
-                               OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(\r
-                                               destinationFolder, fileName)), Charset.forName("UTF-8"));\r
-                               writer.write(header);\r
-                               if (!StringUtils.isEmpty(htmlAdSnippet)) {\r
-                                       writer.write(htmlAdSnippet);\r
-                               }\r
-                               writer.write(content);\r
-                               writer.write(footer);\r
-                               writer.close();\r
-                       } catch (Throwable t) {\r
-                               System.err.println("Failed to transform " + file.getName());\r
-                               t.printStackTrace();\r
-                       }\r
-               }\r
-       }\r
-\r
-       private static String getDocumentName(File file) {\r
-               String displayName = file.getName().substring(0, file.getName().lastIndexOf('.'))\r
-                               .toLowerCase();\r
-               int underscore = displayName.indexOf('_') + 1;\r
-               if (underscore > -1) {\r
-                       // trim leading ##_ which is to control display order\r
-                       return displayName.substring(underscore);\r
-               }\r
-               return displayName;\r
-       }\r
-\r
-       private static String createLinks(File currentFile, File[] markdownFiles,\r
-                       Map<String, String> aliasMap, List<String> skips) {\r
-               String linkPattern = "<li><a href=''{0}''>{1}</a></li>";\r
-               String currentLinkPattern = "<li class=''active''><a href=''{0}''>{1}</a></li>";\r
-               StringBuilder sb = new StringBuilder();\r
-               for (File file : markdownFiles) {\r
-                       String documentName = getDocumentName(file);\r
-                       if (!skips.contains(documentName)) {\r
-                               String displayName = documentName;\r
-                               if (aliasMap.containsKey(documentName)) {\r
-                                       displayName = aliasMap.get(documentName);\r
-                               } else {\r
-                                       displayName = displayName.replace('_', ' ');\r
-                               }\r
-                               String fileName = documentName + ".html";\r
-                               if (currentFile.getName().equals(file.getName())) {\r
-                                       sb.append(MessageFormat.format(currentLinkPattern, fileName, displayName));\r
-                               } else {\r
-                                       sb.append(MessageFormat.format(linkPattern, fileName, displayName));\r
-                               }\r
-                       }\r
-               }\r
-               sb.setLength(sb.length() - 3);\r
-               sb.trimToSize();\r
-               return sb.toString();\r
-       }\r
-\r
-       private static String generatePropertiesContent(File propertiesFile) throws Exception {\r
-               // Read the current Gitblit properties\r
-               BufferedReader propertiesReader = new BufferedReader(new FileReader(propertiesFile));\r
-\r
-               Vector<Setting> settings = new Vector<Setting>();\r
-               List<String> comments = new ArrayList<String>();\r
-               String line = null;\r
-               while ((line = propertiesReader.readLine()) != null) {\r
-                       if (line.length() == 0) {\r
-                               Setting s = new Setting("", "", comments);\r
-                               settings.add(s);\r
-                               comments.clear();\r
-                       } else {\r
-                               if (line.charAt(0) == '#') {\r
-                                       comments.add(line.substring(1).trim());\r
-                               } else {\r
-                                       String[] kvp = line.split("=", 2);\r
-                                       String key = kvp[0].trim();\r
-                                       Setting s = new Setting(key, kvp[1].trim(), comments);\r
-                                       settings.add(s);\r
-                                       comments.clear();\r
-                               }\r
-                       }\r
-               }\r
-               propertiesReader.close();\r
-\r
-               StringBuilder sb = new StringBuilder();\r
-               for (Setting setting : settings) {\r
-                       for (String comment : setting.comments) {\r
-                               if (comment.contains(SINCE) || comment.contains(RESTART_REQUIRED)\r
-                                               || comment.contains(CASE_SENSITIVE) || comment.contains(SPACE_DELIMITED)) {\r
-                                       sb.append(MessageFormat.format(\r
-                                                       "<span style=\"color:#004000;\"># <i>{0}</i></span>",\r
-                                                       transformMarkdown(comment)));\r
-                               } else {\r
-                                       sb.append(MessageFormat.format("<span style=\"color:#004000;\"># {0}</span>",\r
-                                                       transformMarkdown(comment)));\r
-                               }\r
-                               sb.append("<br/>\n");\r
-                       }\r
-                       if (!StringUtils.isEmpty(setting.name)) {\r
-                               sb.append(MessageFormat\r
-                                               .format("<span style=\"color:#000080;\">{0}</span> = <span style=\"color:#800000;\">{1}</span>",\r
-                                                               setting.name, StringUtils.escapeForHtml(setting.value, false)));\r
-                       }\r
-                       sb.append("<br/>\n");\r
-               }\r
-\r
-               return sb.toString();\r
-       }\r
-\r
-       private static String transformMarkdown(String comment) throws ParseException {\r
-               String md = MarkdownUtils.transformMarkdown(comment);\r
-               if (md.startsWith("<p>")) {\r
-                       md = md.substring(3);\r
-               }\r
-               if (md.endsWith("</p>")) {\r
-                       md = md.substring(0, md.length() - 4);\r
-               }\r
-               return md;\r
-       }\r
-\r
-       private static void usage(JCommander jc, ParameterException t) {\r
-               System.out.println(Constants.getGitBlitVersion());\r
-               System.out.println();\r
-               if (t != null) {\r
-                       System.out.println(t.getMessage());\r
-                       System.out.println();\r
-               }\r
-               if (jc != null) {\r
-                       jc.usage();\r
-               }\r
-               System.exit(0);\r
-       }\r
-\r
-       /**\r
-        * Setting represents a setting with its comments from the properties file.\r
-        */\r
-       private static class Setting {\r
-               final String name;\r
-               final String value;\r
-               final List<String> comments;\r
-\r
-               Setting(String name, String value, List<String> comments) {\r
-                       this.name = name;\r
-                       this.value = value;\r
-                       this.comments = new ArrayList<String>(comments);\r
-               }\r
-       }\r
-\r
-       /**\r
-        * JCommander Parameters class for BuildSite.\r
-        */\r
-       @Parameters(separators = " ")\r
-       private static class Params {\r
-\r
-               @Parameter(names = { "--sourceFolder" }, description = "Markdown Source Folder", required = true)\r
-               public String sourceFolder;\r
-\r
-               @Parameter(names = { "--outputFolder" }, description = "HTML Ouptut Folder", required = true)\r
-               public String outputFolder;\r
-\r
-               @Parameter(names = { "--pageHeader" }, description = "Page Header HTML Snippet", required = true)\r
-               public String pageHeader;\r
-\r
-               @Parameter(names = { "--pageFooter" }, description = "Page Footer HTML Snippet", required = true)\r
-               public String pageFooter;\r
-\r
-               @Parameter(names = { "--adSnippet" }, description = "Ad HTML Snippet", required = false)\r
-               public String adSnippet;\r
-\r
-               @Parameter(names = { "--analyticsSnippet" }, description = "Analytics HTML Snippet", required = false)\r
-               public String analyticsSnippet;\r
-\r
-               @Parameter(names = { "--skip" }, description = "Filename to skip", required = false)\r
-               public List<String> skips = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--alias" }, description = "Filename=Linkname aliases", required = false)\r
-               public List<String> aliases = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--substitute" }, description = "%TOKEN%=value", required = false)\r
-               public List<String> substitutions = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--load" }, description = "%TOKEN%=filename", required = false)\r
-               public List<String> loads = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--properties" }, description = "%TOKEN%=filename", required = false)\r
-               public List<String> properties = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--nomarkdown" }, description = "%STARTTOKEN%:%ENDTOKEN%", required = false)\r
-               public List<String> nomarkdown = new ArrayList<String>();\r
-\r
-               @Parameter(names = { "--regex" }, description = "searchPattern!!!replacePattern", required = false)\r
-               public List<String> regex = new ArrayList<String>();\r
-\r
-       }\r
-}\r
diff --git a/src/main/java/com/gitblit/build/BuildThumbnails.java b/src/main/java/com/gitblit/build/BuildThumbnails.java
deleted file mode 100644 (file)
index fe06c6c..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.build;\r
-\r
-import java.awt.Dimension;\r
-import java.awt.Image;\r
-import java.awt.image.BufferedImage;\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.FilenameFilter;\r
-import java.io.IOException;\r
-import java.text.MessageFormat;\r
-import java.util.Iterator;\r
-\r
-import javax.imageio.ImageIO;\r
-import javax.imageio.ImageReader;\r
-import javax.imageio.stream.ImageInputStream;\r
-\r
-import com.beust.jcommander.JCommander;\r
-import com.beust.jcommander.Parameter;\r
-import com.beust.jcommander.ParameterException;\r
-import com.beust.jcommander.Parameters;\r
-\r
-/**\r
- * Generates PNG thumbnails of the PNG images from the specified source folder.\r
- * \r
- * @author James Moger\r
- * \r
- */\r
-public class BuildThumbnails {\r
-\r
-       public static void main(String[] args) {\r
-               Params params = new Params();\r
-               JCommander jc = new JCommander(params);\r
-               try {\r
-                       jc.parse(args);\r
-               } catch (ParameterException t) {\r
-                       System.err.println(t.getMessage());\r
-                       jc.usage();\r
-               }\r
-               createImageThumbnail(params.sourceFolder, params.destinationFolder, params.maximumDimension);\r
-       }\r
-\r
-       /**\r
-        * Generates thumbnails from all PNG images in the source folder and saves\r
-        * them to the destination folder.\r
-        * \r
-        * @param sourceFolder\r
-        * @param destinationFolder\r
-        * @param maxDimension\r
-        *            the maximum height or width of the image.\r
-        */\r
-       public static void createImageThumbnail(String sourceFolder, String destinationFolder,\r
-                       int maxDimension) {\r
-               if (maxDimension <= 0) {\r
-                       return;\r
-               }\r
-               File source = new File(sourceFolder);\r
-               File destination = new File(destinationFolder);\r
-               destination.mkdirs();\r
-               File[] sourceFiles = source.listFiles(new FilenameFilter() {\r
-                       @Override\r
-                       public boolean accept(File dir, String name) {\r
-                               return name.toLowerCase().endsWith(".png");\r
-                       }\r
-               });\r
-\r
-               for (File sourceFile : sourceFiles) {\r
-                       File destinationFile = new File(destination, sourceFile.getName());\r
-                       try {\r
-                               Dimension sz = getImageDimensions(sourceFile);\r
-                               int w = 0;\r
-                               int h = 0;\r
-                               if (sz.width > maxDimension) {\r
-                                       // Scale to Width\r
-                                       w = maxDimension;\r
-                                       float f = maxDimension;\r
-                                       // normalize height\r
-                                       h = (int) ((f / sz.width) * sz.height);\r
-                               } else if (sz.height > maxDimension) {\r
-                                       // Scale to Height\r
-                                       h = maxDimension;\r
-                                       float f = maxDimension;\r
-                                       // normalize width\r
-                                       w = (int) ((f / sz.height) * sz.width);\r
-                               }\r
-                               System.out.println(MessageFormat.format(\r
-                                               "Generating thumbnail for {0} as ({1,number,#}, {2,number,#})",\r
-                                               sourceFile.getName(), w, h));\r
-                               BufferedImage image = ImageIO.read(sourceFile);\r
-                               Image scaledImage = image.getScaledInstance(w, h, BufferedImage.SCALE_SMOOTH);\r
-                               BufferedImage destImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);\r
-                               destImage.createGraphics().drawImage(scaledImage, 0, 0, null);\r
-                               FileOutputStream fos = new FileOutputStream(destinationFile);\r
-                               ImageIO.write(destImage, "png", fos);\r
-                               fos.flush();\r
-                               fos.getFD().sync();\r
-                               fos.close();\r
-                       } catch (Throwable t) {\r
-                               t.printStackTrace();\r
-                       }\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Return the dimensions of the specified image file.\r
-        * \r
-        * @param file\r
-        * @return dimensions of the image\r
-        * @throws IOException\r
-        */\r
-       public static Dimension getImageDimensions(File file) throws IOException {\r
-               ImageInputStream in = ImageIO.createImageInputStream(file);\r
-               try {\r
-                       final Iterator<ImageReader> readers = ImageIO.getImageReaders(in);\r
-                       if (readers.hasNext()) {\r
-                               ImageReader reader = readers.next();\r
-                               try {\r
-                                       reader.setInput(in);\r
-                                       return new Dimension(reader.getWidth(0), reader.getHeight(0));\r
-                               } finally {\r
-                                       reader.dispose();\r
-                               }\r
-                       }\r
-               } finally {\r
-                       if (in != null) {\r
-                               in.close();\r
-                       }\r
-               }\r
-               return null;\r
-       }\r
-\r
-       /**\r
-        * JCommander Parameters class for BuildThumbnails.\r
-        */\r
-       @Parameters(separators = " ")\r
-       private static class Params {\r
-\r
-               @Parameter(names = { "--sourceFolder" }, description = "Source folder for raw images", required = true)\r
-               public String sourceFolder;\r
-\r
-               @Parameter(names = { "--destinationFolder" }, description = "Destination folder for thumbnails", required = true)\r
-               public String destinationFolder;\r
-\r
-               @Parameter(names = { "--maximumDimension" }, description = "Maximum width or height for thumbnail", required = true)\r
-               public int maximumDimension;\r
-\r
-       }\r
-}\r
diff --git a/src/main/java/com/gitblit/build/BuildWebXml.java b/src/main/java/com/gitblit/build/BuildWebXml.java
deleted file mode 100644 (file)
index 49a12ab..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.build;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.FileReader;\r
-import java.text.MessageFormat;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-import com.beust.jcommander.JCommander;\r
-import com.beust.jcommander.Parameter;\r
-import com.beust.jcommander.ParameterException;\r
-import com.beust.jcommander.Parameters;\r
-import com.gitblit.Keys;\r
-import com.gitblit.utils.StringUtils;\r
-\r
-/**\r
- * Builds the Gitblit WAR web.xml file by merging the Gitblit GO web.xml file\r
- * with the gitblit.properties comments, settings, and values.\r
- * \r
- * @author James Moger\r
- * \r
- */\r
-public class BuildWebXml {\r
-       private static final String PARAMS = "<!-- PARAMS -->";\r
-\r
-       private static final String[] STRIP_TOKENS = { "<!-- STRIP", "STRIP -->" };\r
-\r
-       private static final String COMMENT_PATTERN = "\n\t<!-- {0} -->";\r
-\r
-       private static final String PARAM_PATTERN = "\n\t<context-param>\n\t\t<param-name>{0}</param-name>\n\t\t<param-value>{1}</param-value>\n\t</context-param>\n";\r
-\r
-       public static void main(String[] args) throws Exception {\r
-               Params params = new Params();\r
-               JCommander jc = new JCommander(params);\r
-               try {\r
-                       jc.parse(args);\r
-               } catch (ParameterException t) {\r
-                       System.err.println(t.getMessage());\r
-                       jc.usage();\r
-               }\r
-               generateWebXml(params);\r
-       }\r
-\r
-       private static void generateWebXml(Params params) throws Exception {\r
-               StringBuilder parameters = new StringBuilder();\r
-               // Read the current Gitblit properties\r
-               if (params.propertiesFile != null) {\r
-                       BufferedReader propertiesReader = new BufferedReader(new FileReader(new File(\r
-                                       params.propertiesFile)));\r
-\r
-                       Vector<Setting> settings = new Vector<Setting>();\r
-                       List<String> comments = new ArrayList<String>();\r
-                       String line = null;\r
-                       while ((line = propertiesReader.readLine()) != null) {\r
-                               if (line.length() == 0) {\r
-                                       comments.clear();\r
-                               } else {\r
-                                       if (line.charAt(0) == '#') {\r
-                                               if (line.length() > 1) {\r
-                                                       comments.add(line.substring(1).trim());\r
-                                               }\r
-                                       } else {\r
-                                               String[] kvp = line.split("=", 2);\r
-                                               String key = kvp[0].trim();\r
-                                               if (!skipKey(key)) {\r
-                                                       Setting s = new Setting(key, kvp[1].trim(), comments);\r
-                                                       settings.add(s);\r
-                                               }\r
-                                               comments.clear();\r
-                                       }\r
-                               }\r
-                       }\r
-                       propertiesReader.close();\r
-\r
-                       for (Setting setting : settings) {\r
-                               for (String comment : setting.comments) {\r
-                                       parameters.append(MessageFormat.format(COMMENT_PATTERN, comment));\r
-                               }\r
-                               parameters.append(MessageFormat.format(PARAM_PATTERN, setting.name,\r
-                                               StringUtils.escapeForHtml(setting.value, false)));\r
-                       }\r
-               }\r
-               // Read the prototype web.xml file\r
-               File webxml = new File(params.sourceFile);\r
-               char[] buffer = new char[(int) webxml.length()];\r
-               FileReader webxmlReader = new FileReader(webxml);\r
-               webxmlReader.read(buffer);\r
-               webxmlReader.close();\r
-               String webXmlContent = new String(buffer);\r
-\r
-               // Insert the Gitblit properties into the prototype web.xml\r
-               for (String stripToken : STRIP_TOKENS) {\r
-                       webXmlContent = webXmlContent.replace(stripToken, "");\r
-               }\r
-               int idx = webXmlContent.indexOf(PARAMS);\r
-               StringBuilder sb = new StringBuilder();\r
-               sb.append(webXmlContent.substring(0, idx));\r
-               sb.append(parameters.toString());\r
-               sb.append(webXmlContent.substring(idx + PARAMS.length()));\r
-\r
-               // Save the merged web.xml to the war build folder\r
-               FileOutputStream os = new FileOutputStream(new File(params.destinationFile), false);\r
-               os.write(sb.toString().getBytes());\r
-               os.close();\r
-       }\r
-\r
-       private static boolean skipKey(String key) {\r
-               return key.startsWith(Keys.server._ROOT);\r
-       }\r
-\r
-       /**\r
-        * Setting represents a setting and its comments from the properties file.\r
-        */\r
-       private static class Setting {\r
-               final String name;\r
-               final String value;\r
-               final List<String> comments;\r
-\r
-               Setting(String name, String value, List<String> comments) {\r
-                       this.name = name;\r
-                       this.value = value;\r
-                       this.comments = new ArrayList<String>(comments);\r
-               }\r
-       }\r
-\r
-       /**\r
-        * JCommander Parameters class for BuildWebXml.\r
-        */\r
-       @Parameters(separators = " ")\r
-       private static class Params {\r
-\r
-               @Parameter(names = { "--sourceFile" }, description = "Source web.xml file", required = true)\r
-               public String sourceFile;\r
-\r
-               @Parameter(names = { "--propertiesFile" }, description = "Properties settings file")\r
-               public String propertiesFile;\r
-\r
-               @Parameter(names = { "--destinationFile" }, description = "Destination web.xml file", required = true)\r
-               public String destinationFile;\r
-               \r
-       }\r
-}\r