exportsuitesigner.java.svn-base
来自「cqME :java framework for TCK test.」· SVN-BASE 代码 · 共 95 行
SVN-BASE
95 行
/* * $Id$ * * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */package com.sun.cldc.communication.midp;import java.io.File;import java.net.URL;import java.net.URLClassLoader;import java.util.Vector;/** * Command line proxy to SuiteSigner interface */public class ExportSuiteSigner { public ExportSuiteSigner(String[] args) { parseArgs(args); } public static void main(String[] args) { new ExportSuiteSigner(args).run(); } protected void parseArgs(String[] args) { Vector signerArgs = new Vector(); for (int i = 0; i < args.length; i++) { if (args[i].equals("-signerClass") && (i + 1 < args.length)) { signerClass = args[++i]; } else if (args[i].equals("-signerJar") && (i + 1 < args.length)) { signerJar = args[++i]; } else if (args[i].equals("-arg") && (i + 1 < args.length)) { signerArgs.add(args[++i]); } else if (jarName == null) { jarName = args[i]; } else if (jadName == null) { jadName = args[i]; } else { throw new RuntimeException("Unexpected argument: " + args[i]); } } this.signerArgs = (String[]) signerArgs.toArray( new String[signerArgs.size()]); } protected void run() { SuiteSigner signer; try { ClassLoader loader = new URLClassLoader(new URL[] {new File(signerJar).toURL()}, ClassLoader.getSystemClassLoader()); Class cl = loader.loadClass(signerClass); signer = (SuiteSigner) cl.newInstance(); } catch (Exception e) { throw new RuntimeException("Cannot load suite signer.", e); } try { signer.init(signerArgs); signer.sign(jarName, jadName); } catch (SignerException e) { throw new RuntimeException("Signer error: " + e.getMessage(), e); } } protected String signerClass; protected String signerJar; protected String[] signerArgs; protected String jarName; protected String jadName;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?