pgm: Move non commands into a util package

These aren't executed from the command line.  To keep our package
namespace cleaner, hide them under pgm.util.

Change-Id: If9d64f2a28ae1fd26c2177f44c2ec4e2a2751467
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-11-18 20:00:40 -08:00
parent 0364312405
commit 6afb00678b
14 changed files with 30 additions and 17 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.pgm;
import com.google.gerrit.pgm.util.SiteProgram;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.reviewdb.SchemaVersion;
import com.google.gerrit.reviewdb.SystemConfig;

View File

@@ -19,6 +19,9 @@ import com.google.gerrit.httpd.WebModule;
import com.google.gerrit.lifecycle.LifecycleManager;
import com.google.gerrit.pgm.http.jetty.JettyEnv;
import com.google.gerrit.pgm.http.jetty.JettyModule;
import com.google.gerrit.pgm.util.ErrorLogFile;
import com.google.gerrit.pgm.util.RuntimeShutdown;
import com.google.gerrit.pgm.util.SiteProgram;
import com.google.gerrit.server.config.AuthConfigModule;
import com.google.gerrit.server.config.CanonicalWebUrlModule;
import com.google.gerrit.server.config.CanonicalWebUrlProvider;

View File

@@ -15,6 +15,8 @@
package com.google.gerrit.pgm;
import com.google.gerrit.lifecycle.LifecycleManager;
import com.google.gerrit.pgm.util.RuntimeShutdown;
import com.google.gerrit.pgm.util.SiteProgram;
import com.google.gerrit.server.config.FactoryModule;
import com.google.gerrit.sshd.commands.QueryShell;
import com.google.gerrit.sshd.commands.QueryShell.Factory;

View File

@@ -14,8 +14,13 @@
package com.google.gerrit.pgm;
import static com.google.gerrit.pgm.DataSourceProvider.Type.H2;
import static com.google.gerrit.pgm.util.DataSourceProvider.Type.H2;
import com.google.gerrit.pgm.util.ConsoleUI;
import com.google.gerrit.pgm.util.DataSourceProvider;
import com.google.gerrit.pgm.util.ErrorLogFile;
import com.google.gerrit.pgm.util.LibraryDownloader;
import com.google.gerrit.pgm.util.SiteProgram;
import com.google.gerrit.reviewdb.AuthType;
import com.google.gerrit.reviewdb.Project;
import com.google.gerrit.reviewdb.ReviewDb;

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.pgm;
import com.google.gerrit.pgm.util.AbstractProgram;
/** Display the version of Gerrit. */
public class Version extends AbstractProgram {
@Override

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import com.google.gerrit.util.cli.CmdLineParser;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import static org.eclipse.jgit.util.StringUtils.equalsIgnoreCase;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import com.google.gerrit.lifecycle.LifecycleListener;
import com.google.gerrit.server.config.ConfigUtil;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
public class Die extends RuntimeException {
private static final long serialVersionUID = 1L;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import com.google.gerrit.lifecycle.LifecycleListener;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.util.HttpSupport;
@@ -32,7 +32,7 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/** Get optional or required 3rd party library files into $site_path/lib. */
class LibraryDownloader {
public class LibraryDownloader {
private final ConsoleUI console;
private final File libDirectory;
private boolean required;
@@ -41,32 +41,32 @@ class LibraryDownloader {
private String sha1;
private File dst;
LibraryDownloader(final ConsoleUI console, final File sitePath) {
public LibraryDownloader(final ConsoleUI console, final File sitePath) {
this.console = console;
this.libDirectory = new File(sitePath, "lib");
}
LibraryDownloader setRequired(final boolean required) {
public LibraryDownloader setRequired(final boolean required) {
this.required = required;
return this;
}
LibraryDownloader setName(final String name) {
public LibraryDownloader setName(final String name) {
this.name = name;
return this;
}
LibraryDownloader setJarUrl(final String url) {
public LibraryDownloader setJarUrl(final String url) {
this.jarUrl = url;
return this;
}
LibraryDownloader setSHA1(final String sha1) {
public LibraryDownloader setSHA1(final String sha1) {
this.sha1 = sha1;
return this;
}
void download() {
public void download() {
if (jarUrl == null || !jarUrl.contains("/")) {
throw new IllegalStateException("Invalid JarUrl for " + name);
}

View File

@@ -35,7 +35,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import org.eclipse.jgit.util.CachedAuthenticator;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.pgm;
package com.google.gerrit.pgm.util;
import static com.google.inject.Scopes.SINGLETON;
import static com.google.inject.Stage.PRODUCTION;