protected File getFile(JPackage pkg, String fileName ) throws IOException { File f = super.getFile(pkg, fileName); options.addGeneratedFile(f); // we can't really tell the file type, for we don't know // what this file is used for. Fortunately, // FILE_TYPE doesn't seem to be used, so it doesn't really // matter what we set. return f; } }
@Override protected void disableXmlSecurity() { super.disableXmlSecurity(); schemaCompiler.getOptions().disableXmlSecurity = true; } }
/** * Utility method for converting a search path string to an array * of directory and JAR file URLs. * * @param path the search path string * @return the resulting array of directory and JAR file URLs */ public static URL[] pathToURLs(String path) { StringTokenizer st = new StringTokenizer(path, File.pathSeparator); URL[] urls = new URL[st.countTokens()]; int count = 0; while (st.hasMoreTokens()) { URL url = fileToURL(new File(st.nextToken())); if (url != null) { urls[count++] = url; } } if (urls.length != count) { URL[] tmp = new URL[count]; System.arraycopy(urls, 0, tmp, 0, count); urls = tmp; } return urls; }
/** * Parses arguments and fill fields of this object. * * @exception BadCommandLineException * thrown when there's a problem in the command-line arguments */ public void parseArguments( String[] args ) throws BadCommandLineException { for (int i = 0; i < args.length; i++) { if(args[i].length()==0) throw new BadCommandLineException(); if (args[i].charAt(0) == '-') { int j = parseArguments(args,i); if(j==0) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); i += (j-1); } else { addFile(args[i]); } } if(destDir == null) destDir = new File("."); if(sourceDir == null) sourceDir = destDir; }
return 1; } else if (args[i].equals("-target")) { String token = requireArgument("-target", args, ++i); target = Target.parse(token); if(target == null) return 2; } else if (args[i].equals("-classpath") || args[i].equals("-cp")) { classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path"); return 2; } else if (args[i].equals("-d")) { destDir = new File(requireArgument("-d", args, ++i)); if (!destDir.exists()) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath())); return 2; } else if (args[i].equals("-s")) { sourceDir = new File(requireArgument("-s", args, ++i)); keep = true; if (!sourceDir.exists()) { return 1; } else if (args[i].equals("-encoding")) { encoding = requireArgument("-encoding", args, ++i); try { if (!Charset.isSupported(encoding)) { disableXmlSecurity(); return 1; } else if (args[i].startsWith("-J")) {
/** * Get a URLClassLoader from using the classpath */ public ClassLoader getClassLoader() { if (classLoader == null) { classLoader = new URLClassLoader(pathToURLs(classpath), this.getClass().getClassLoader()); } return classLoader; }
@Override protected int parseArguments(String[] args, int i) throws BadCommandLineException { int j = super.parseArguments(args, i); if (args[i].equals(SERVICENAME_OPTION)) { serviceName = QName.valueOf(requireArgument(SERVICENAME_OPTION, args, ++i));
public static boolean classExists( Options options, String className) { try { // Takes care of inner classes. getLoadableClassName(className, options.getClassLoader()); return true; } catch(ClassNotFoundException ce) { return false; } }
/** * Parses arguments and fill fields of this object. * * @exception BadCommandLineException * thrown when there's a problem in the command-line arguments */ public void parseArguments( String[] args ) throws BadCommandLineException { for (int i = 0; i < args.length; i++) { if(args[i].length()==0) throw new BadCommandLineException(); if (args[i].charAt(0) == '-') { int j = parseArguments(args,i); if(j==0) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); i += (j-1); } else { addFile(args[i]); } } if(destDir == null) destDir = new File("."); if(sourceDir == null) sourceDir = destDir; }
return 1; } else if (args[i].equals("-target")) { String token = requireArgument("-target", args, ++i); target = Target.parse(token); if(target == null) return 2; } else if (args[i].equals("-classpath") || args[i].equals("-cp")) { classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path"); return 2; } else if (args[i].equals("-d")) { destDir = new File(requireArgument("-d", args, ++i)); if (!destDir.exists()) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath())); return 2; } else if (args[i].equals("-s")) { sourceDir = new File(requireArgument("-s", args, ++i)); keep = true; if (!sourceDir.exists()) { return 1; } else if (args[i].equals("-encoding")) { encoding = requireArgument("-encoding", args, ++i); try { if (!Charset.isSupported(encoding)) { disableXmlSecurity(); return 1; } else if (args[i].startsWith("-J")) {
/** * Get a URLClassLoader from using the classpath */ public ClassLoader getClassLoader() { if (classLoader == null) { classLoader = new URLClassLoader(pathToURLs(classpath), this.getClass().getClassLoader()); } return classLoader; }
@Override protected int parseArguments(String[] args, int i) throws BadCommandLineException { int j = super.parseArguments(args, i); if (args[i].equals(SERVICENAME_OPTION)) { serviceName = QName.valueOf(requireArgument(SERVICENAME_OPTION, args, ++i));
public static boolean classExists( Options options, String className) { try { // Takes care of inner classes. getLoadableClassName(className, options.getClassLoader()); return true; } catch(ClassNotFoundException ce) { return false; } }
/** * Parses arguments and fill fields of this object. * * @exception BadCommandLineException * thrown when there's a problem in the command-line arguments */ public void parseArguments( String[] args ) throws BadCommandLineException { for (int i = 0; i < args.length; i++) { if(args[i].length()==0) throw new BadCommandLineException(); if (args[i].charAt(0) == '-') { int j = parseArguments(args,i); if(j==0) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_INVALID_OPTION(args[i])); i += (j-1); } else { addFile(args[i]); } } if(destDir == null) destDir = new File("."); if(sourceDir == null) sourceDir = destDir; }
return 1; } else if (args[i].equals("-target")) { String token = requireArgument("-target", args, ++i); target = Target.parse(token); if(target == null) return 2; } else if (args[i].equals("-classpath") || args[i].equals("-cp")) { classpath = requireArgument("-classpath", args, ++i) + File.pathSeparator + System.getProperty("java.class.path"); return 2; } else if (args[i].equals("-d")) { destDir = new File(requireArgument("-d", args, ++i)); if (!destDir.exists()) throw new BadCommandLineException(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(destDir.getPath())); return 2; } else if (args[i].equals("-s")) { sourceDir = new File(requireArgument("-s", args, ++i)); keep = true; if (!sourceDir.exists()) { return 1; } else if (args[i].equals("-encoding")) { encoding = requireArgument("-encoding", args, ++i); try { if (!Charset.isSupported(encoding)) { disableXmlSecurity(); return 1; } else if (args[i].startsWith("-J")) {
/** * Get a URLClassLoader from using the classpath */ public ClassLoader getClassLoader() { if (classLoader == null) { classLoader = new URLClassLoader(pathToURLs(classpath), this.getClass().getClassLoader()); } return classLoader; }
@Override protected int parseArguments(String[] args, int i) throws BadCommandLineException { int j = super.parseArguments(args, i); if (args[i].equals(SERVICENAME_OPTION)) { serviceName = QName.valueOf(requireArgument(SERVICENAME_OPTION, args, ++i));
public static boolean classExists( Options options, String className) { try { // Takes care of inner classes. getLoadableClassName(className, options.getClassLoader()); return true; } catch(ClassNotFoundException ce) { return false; } }
@Override protected void disableXmlSecurity() { super.disableXmlSecurity(); schemaCompiler.getOptions().disableXmlSecurity = true; } }
protected File getFile(JPackage pkg, String fileName ) throws IOException { File f = super.getFile(pkg, fileName); options.addGeneratedFile(f); // we can't really tell the file type, for we don't know // what this file is used for. Fortunately, // FILE_TYPE doesn't seem to be used, so it doesn't really // matter what we set. return f; } }