Package org.apache.derby.iapi.tools.i18n

Examples of org.apache.derby.iapi.tools.i18n.LocalizedInput


              LocalizedResource.getInstance().
                    getNewEncodedOutput(sqlOut, outputEncoding);

    Main ijE = new Main(false);
   
    LocalizedInput li = LocalizedResource.getInstance().
              getNewEncodedInput(sqlIn, inputEncoding);
   
    utilMain um = ijE.getutilMain(1, lo);

    return um.goScript(conn, li);
View Full Code Here


  }

  public static void mainCore(String[] args, Main main)
    throws IOException
  {
    LocalizedInput in = null;
    InputStream in1 = null;
    Main me;
    String file;
    String inputResourceName;
    boolean gotProp;

    LocalizedResource langUtil = LocalizedResource.getInstance();
    LocalizedOutput out = langUtil.getNewOutput(System.out);

                // Validate arguments, check for --help.
    if (util.invalidArgs(args)) {
      util.Usage(out);
          return;
    }

    // load the property file if specified
    gotProp = util.getPropertyArg(args);

    // readjust output to derby.ui.locale and derby.ui.codeset if
                // they were loaded from a property file.
    langUtil.init();
    out = langUtil.getNewOutput(System.out);
                main.initAppUI();

    file = util.getFileArg(args);
    inputResourceName = util.getInputResourceNameArg(args);
    if (inputResourceName != null) {
      in = langUtil.getNewInput(util.getResourceAsStream(inputResourceName));
      if (in == null) {
        out.println(langUtil.getTextMessage("IJ_IjErroResoNo",inputResourceName));
        return;
      }
    } else if (file == null) {
      in = langUtil.getNewInput(System.in);
                        out.flush();
              } else {
                    try {
                      final String inFile1 = file;
                      in1 = AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>() {
                    public FileInputStream run() throws FileNotFoundException {
                    return new FileInputStream(inFile1);
                    }
                  });
                        if (in1 != null) {
                            in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
                            in = langUtil.getNewInput(in1);
                        }
                    } catch (PrivilegedActionException e) {
                        if (Boolean.getBoolean("ij.searchClassPath")) {
                            in = langUtil.getNewInput(util.getResourceAsStream(file));
                        }
                        if (in == null) {
                        out.println(langUtil.getTextMessage("IJ_IjErroFileNo",file));
                  return;
                        }
                    }
                }

    final String outFile = util.getSystemProperty("ij.outfile");
    if (outFile != null && outFile.length()>0) {
      LocalizedOutput oldOut = out;
      FileOutputStream fos = AccessController.doPrivileged(new PrivilegedAction<FileOutputStream>() {
        public FileOutputStream run() {
          FileOutputStream out = null;
          try {
            out = new FileOutputStream(outFile);
          } catch (FileNotFoundException e) {
            out = null;
          }
          return out;
        }
      });
      out = langUtil.getNewOutput(fos);

      if (out == null)
         oldOut.println(langUtil.getTextMessage("IJ_IjErroUnabTo",outFile));
 
    }

    // the old property name is deprecated...
    String maxDisplayWidth = util.getSystemProperty("maximumDisplayWidth");
    if (maxDisplayWidth==null)
      maxDisplayWidth = util.getSystemProperty("ij.maximumDisplayWidth");
    if (maxDisplayWidth != null && maxDisplayWidth.length() > 0) {
      try {
        int maxWidth = Integer.parseInt(maxDisplayWidth);
        JDBCDisplayUtil.setMaxDisplayWidth(maxWidth);
      }
      catch (NumberFormatException nfe) {
        out.println(langUtil.getTextMessage("IJ_IjErroMaxiVa", maxDisplayWidth));
      }
    }

    /* Use the main parameter to get to
     * a new Main that we can use. 
     * (We can't do the work in Main(out)
     * until after we do all of the work above
     * us in this method.
     */
    me = main.getMain(out);

    /* Let the processing begin! */
    me.go(in, out);
    in.close(); out.close();
  }
View Full Code Here

  }

  public static void mainCore(String[] args, Main main)
    throws IOException
  {
    LocalizedInput in = null;
    InputStream in1 = null;
    Main me;
    String file;
    String inputResourceName;
    boolean gotProp;

    String tmpUnicode = null;
    Properties connAttributeDefaults = null;

    // load the property file if specified
    gotProp = util.getPropertyArg(args);

    // get the default connection attributes
    connAttributeDefaults = util.getConnAttributeArg(args);
    // adjust the application in accordance with derby.ui.locale and derby.ui.codeset
    main.initAppUI();

    LocalizedResource langUtil = LocalizedResource.getInstance();
       
    LocalizedOutput out = langUtil.getNewOutput(System.out);

    file = util.getFileArg(args);
    inputResourceName = util.getInputResourceNameArg(args);
    if (util.invalidArgs(args, gotProp, file, inputResourceName)) {
      util.Usage(out);
          return;
    }
    else if (inputResourceName != null) {
      in = langUtil.getNewInput(util.getResourceAsStream(inputResourceName));
      if (in == null) {
        out.println(langUtil.getTextMessage("IJ_IjErroResoNo",inputResourceName));
        return;
      }
    } else if (file == null) {
      in = langUtil.getNewInput(System.in);
            out.flush();
      } else {
          try {
        in1 = new FileInputStream(file);
        if (in1 != null) {
                    in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
          in = langUtil.getNewInput(in1);
                }
          } catch (FileNotFoundException e) {
        if (Boolean.getBoolean("ij.searchClassPath")) {
          in = langUtil.getNewInput(util.getResourceAsStream(file));
                }
        if (in == null) {
          out.println(langUtil.getTextMessage("IJ_IjErroFileNo",file));
              return;
        }
          }
      }

    // set initial Unicode Escape Mode
    tmpUnicode = util.getSystemProperty("ij.unicodeEscape");
    if ((tmpUnicode != null) && tmpUnicode.toUpperCase(Locale.ENGLISH).equals("ON")) {
      LocalizedResource.setUnicodeEscape(true);
    }
    String outFile = util.getSystemProperty("ij.outfile");
    if (outFile != null && outFile.length()>0) {
      LocalizedOutput oldOut = out;
      try {
        out = langUtil.getNewOutput(new FileOutputStream(outFile));
      }
      catch (IOException ioe) {
        oldOut.println(langUtil.getTextMessage("IJ_IjErroUnabTo",outFile));
      }
    }

    // the old property name is deprecated...
    String maxDisplayWidth = util.getSystemProperty("maximumDisplayWidth");
    if (maxDisplayWidth==null)
      maxDisplayWidth = util.getSystemProperty("ij.maximumDisplayWidth");
    if (maxDisplayWidth != null && maxDisplayWidth.length() > 0) {
      try {
        int maxWidth = Integer.parseInt(maxDisplayWidth);
        JDBCDisplayUtil.setMaxDisplayWidth(maxWidth);
      }
      catch (NumberFormatException nfe) {
        out.println(langUtil.getTextMessage("IJ_IjErroMaxiVa", maxDisplayWidth));
      }
    }

    /* Use the main parameter to get to
     * a new Main that we can use. 
     * (We can't do the work in Main(out)
     * until after we do all of the work above
     * us in this method.
     */
    me = main.getMain(out);

    /* Let the processing begin! */
    me.go(in, out, connAttributeDefaults);
    in.close(); out.close();
  }
View Full Code Here

    jj_consume_token(BANG);
    cmd = jj_consume_token(STRING);
          ijResult result = null;
          try {
                Process p = Runtime.getRuntime().exec(stringValue(cmd.image));
                LocalizedInput in = new LocalizedInput(p.getInputStream());
                int c;
                Vector v = new Vector();
                StringBuffer output = new StringBuffer();
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                // echo errors
                in = new LocalizedInput(p.getErrorStream());
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                v.addElement(output);
                result = new ijVectorResult(v,null);
                // wait for completion
                try {
                        p.waitFor();
View Full Code Here

  }

  public static void mainCore(String[] args, Main main)
    throws IOException
  {
    LocalizedInput in = null;
    InputStream in1 = null;
    Main me;
    String file;
    String inputResourceName;
    boolean gotProp;

    Properties connAttributeDefaults = null;

    // load the property file if specified
    gotProp = util.getPropertyArg(args);

    // get the default connection attributes
    connAttributeDefaults = util.getConnAttributeArg(args);
    // adjust the application in accordance with derby.ui.locale and derby.ui.codeset
    main.initAppUI();

    LocalizedResource langUtil = LocalizedResource.getInstance();
       
    LocalizedOutput out = langUtil.getNewOutput(System.out);

    file = util.getFileArg(args);
    inputResourceName = util.getInputResourceNameArg(args);
    if (util.invalidArgs(args, gotProp, file, inputResourceName)) {
      util.Usage(out);
          return;
    }
    else if (inputResourceName != null) {
      in = langUtil.getNewInput(util.getResourceAsStream(inputResourceName));
      if (in == null) {
        out.println(langUtil.getTextMessage("IJ_IjErroResoNo",inputResourceName));
        return;
      }
    } else if (file == null) {
      in = langUtil.getNewInput(System.in);
            out.flush();
      } else {
          try {
        in1 = new FileInputStream(file);
        if (in1 != null) {
                    in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
          in = langUtil.getNewInput(in1);
                }
          } catch (FileNotFoundException e) {
        if (Boolean.getBoolean("ij.searchClassPath")) {
          in = langUtil.getNewInput(util.getResourceAsStream(file));
                }
        if (in == null) {
          out.println(langUtil.getTextMessage("IJ_IjErroFileNo",file));
              return;
        }
          }
      }

    String outFile = util.getSystemProperty("ij.outfile");
    if (outFile != null && outFile.length()>0) {
      LocalizedOutput oldOut = out;
      try {
        out = langUtil.getNewOutput(new FileOutputStream(outFile));
      }
      catch (IOException ioe) {
        oldOut.println(langUtil.getTextMessage("IJ_IjErroUnabTo",outFile));
      }
    }

    // the old property name is deprecated...
    String maxDisplayWidth = util.getSystemProperty("maximumDisplayWidth");
    if (maxDisplayWidth==null)
      maxDisplayWidth = util.getSystemProperty("ij.maximumDisplayWidth");
    if (maxDisplayWidth != null && maxDisplayWidth.length() > 0) {
      try {
        int maxWidth = Integer.parseInt(maxDisplayWidth);
        JDBCDisplayUtil.setMaxDisplayWidth(maxWidth);
      }
      catch (NumberFormatException nfe) {
        out.println(langUtil.getTextMessage("IJ_IjErroMaxiVa", maxDisplayWidth));
      }
    }

    /* Use the main parameter to get to
     * a new Main that we can use. 
     * (We can't do the work in Main(out)
     * until after we do all of the work above
     * us in this method.
     */
    me = main.getMain(out);

    /* Let the processing begin! */
    me.go(in, out, connAttributeDefaults);
    in.close(); out.close();
  }
View Full Code Here

  }

  public static void mainCore(String[] args, Main main)
    throws IOException
  {
    LocalizedInput in = null;
    InputStream in1 = null;
    Main me;
    String file;
    String inputResourceName;
    boolean gotProp;

    LocalizedResource langUtil = LocalizedResource.getInstance();
    LocalizedOutput out = langUtil.getNewOutput(System.out);

                // Validate arguments, check for --help.
    if (util.invalidArgs(args)) {
      util.Usage(out);
          return;
    }

    // load the property file if specified
    gotProp = util.getPropertyArg(args);

    // readjust output to derby.ui.locale and derby.ui.codeset if
                // they were loaded from a property file.
    langUtil.init();
    out = langUtil.getNewOutput(System.out);
                main.initAppUI();

    file = util.getFileArg(args);
    inputResourceName = util.getInputResourceNameArg(args);
    if (inputResourceName != null) {
      in = langUtil.getNewInput(util.getResourceAsStream(inputResourceName));
      if (in == null) {
        out.println(langUtil.getTextMessage("IJ_IjErroResoNo",inputResourceName));
        return;
      }
    } else if (file == null) {
      in = langUtil.getNewInput(System.in);
                        out.flush();
              } else {
                    try {
                      final String inFile1 = file;
                      in1 = (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws FileNotFoundException {
                    return new FileInputStream(inFile1);
                    }
                  });
                        if (in1 != null) {
                            in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
                            in = langUtil.getNewInput(in1);
                        }
                    } catch (PrivilegedActionException e) {
                        if (Boolean.getBoolean("ij.searchClassPath")) {
                            in = langUtil.getNewInput(util.getResourceAsStream(file));
                        }
                        if (in == null) {
                        out.println(langUtil.getTextMessage("IJ_IjErroFileNo",file));
                  return;
                        }
                    }
                }

    final String outFile = util.getSystemProperty("ij.outfile");
    if (outFile != null && outFile.length()>0) {
      LocalizedOutput oldOut = out;
      FileOutputStream fos = (FileOutputStream) AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
          FileOutputStream out = null;
          try {
            out = new FileOutputStream(outFile);
          } catch (FileNotFoundException e) {
            out = null;
          }
          return out;
        }
      });
      out = langUtil.getNewOutput(fos);

      if (out == null)
         oldOut.println(langUtil.getTextMessage("IJ_IjErroUnabTo",outFile));
 
    }

    // the old property name is deprecated...
    String maxDisplayWidth = util.getSystemProperty("maximumDisplayWidth");
    if (maxDisplayWidth==null)
      maxDisplayWidth = util.getSystemProperty("ij.maximumDisplayWidth");
    if (maxDisplayWidth != null && maxDisplayWidth.length() > 0) {
      try {
        int maxWidth = Integer.parseInt(maxDisplayWidth);
        JDBCDisplayUtil.setMaxDisplayWidth(maxWidth);
      }
      catch (NumberFormatException nfe) {
        out.println(langUtil.getTextMessage("IJ_IjErroMaxiVa", maxDisplayWidth));
      }
    }

    /* Use the main parameter to get to
     * a new Main that we can use. 
     * (We can't do the work in Main(out)
     * until after we do all of the work above
     * us in this method.
     */
    me = main.getMain(out);

    /* Let the processing begin! */
    me.go(in, out);
    in.close(); out.close();
  }
View Full Code Here

    jj_consume_token(BANG);
    cmd = jj_consume_token(STRING);
          ijResult result = null;
          try {
                Process p = Runtime.getRuntime().exec(stringValue(cmd.image));
                LocalizedInput in = new LocalizedInput(p.getInputStream());
                int c;
                Vector v = new Vector();
                StringBuffer output = new StringBuffer();
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                // echo errors
                in = new LocalizedInput(p.getErrorStream());
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                v.addElement(output);
                result = new ijVectorResult(v,null);
                // wait for completion
                try {
                        p.waitFor();
View Full Code Here

  }

  public static void mainCore(String[] args, Main main)
    throws IOException
  {
    LocalizedInput in = null;
    InputStream in1 = null;
    Main me;
    String file;
    String inputResourceName;
    boolean gotProp;
    Properties connAttributeDefaults = null;

    LocalizedResource langUtil = LocalizedResource.getInstance();
    LocalizedOutput out = langUtil.getNewOutput(System.out);

                // Validate arguments, check for --help.
    if (util.invalidArgs(args)) {
      util.Usage(out);
          return;
    }

    // load the property file if specified
    gotProp = util.getPropertyArg(args);

    // get the default connection attributes
    connAttributeDefaults = util.getConnAttributeArg(args);

    // readjust output to derby.ui.locale and derby.ui.codeset if
                // they were loaded from a property file.
    langUtil.init();
    out = langUtil.getNewOutput(System.out);
                main.initAppUI();

    file = util.getFileArg(args);
    inputResourceName = util.getInputResourceNameArg(args);
    if (inputResourceName != null) {
      in = langUtil.getNewInput(util.getResourceAsStream(inputResourceName));
      if (in == null) {
        out.println(langUtil.getTextMessage("IJ_IjErroResoNo",inputResourceName));
        return;
      }
    } else if (file == null) {
      in = langUtil.getNewInput(System.in);
                        out.flush();
              } else {
                    try {
                        in1 = new FileInputStream(file);
                        if (in1 != null) {
                            in1 = new BufferedInputStream(in1, utilMain.BUFFEREDFILESIZE);
                            in = langUtil.getNewInput(in1);
                        }
                    } catch (FileNotFoundException e) {
                        if (Boolean.getBoolean("ij.searchClassPath")) {
                            in = langUtil.getNewInput(util.getResourceAsStream(file));
                        }
                        if (in == null) {
                        out.println(langUtil.getTextMessage("IJ_IjErroFileNo",file));
                  return;
                        }
                    }
                }

    final String outFile = util.getSystemProperty("ij.outfile");
    if (outFile != null && outFile.length()>0) {
      LocalizedOutput oldOut = out;
      FileOutputStream fos = (FileOutputStream) AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
          FileOutputStream out = null;
          try {
            out = new FileOutputStream(outFile);
          } catch (FileNotFoundException e) {
            out = null;
          }
          return out;
        }
      });
      out = langUtil.getNewOutput(fos);

      if (out == null)
         oldOut.println(langUtil.getTextMessage("IJ_IjErroUnabTo",outFile));
 
    }

    // the old property name is deprecated...
    String maxDisplayWidth = util.getSystemProperty("maximumDisplayWidth");
    if (maxDisplayWidth==null)
      maxDisplayWidth = util.getSystemProperty("ij.maximumDisplayWidth");
    if (maxDisplayWidth != null && maxDisplayWidth.length() > 0) {
      try {
        int maxWidth = Integer.parseInt(maxDisplayWidth);
        JDBCDisplayUtil.setMaxDisplayWidth(maxWidth);
      }
      catch (NumberFormatException nfe) {
        out.println(langUtil.getTextMessage("IJ_IjErroMaxiVa", maxDisplayWidth));
      }
    }

    /* Use the main parameter to get to
     * a new Main that we can use. 
     * (We can't do the work in Main(out)
     * until after we do all of the work above
     * us in this method.
     */
    me = main.getMain(out);

    /* Let the processing begin! */
    me.go(in, out, connAttributeDefaults);
    in.close(); out.close();
  }
View Full Code Here

                  LocalizedResource.getInstance().
                    getNewEncodedOutput(sqlOut, outputEncoding);

        Main ijE = new Main(false);

        LocalizedInput li = LocalizedResource.getInstance().
                getNewEncodedInput(sqlIn, inputEncoding);

        utilMain um = ijE.getutilMain(1, lo, loadSystemProperties);

        return um.goScript(conn, li);
View Full Code Here

    jj_consume_token(BANG);
    cmd = jj_consume_token(STRING);
          ijResult result = null;
          try {
                Process p = Runtime.getRuntime().exec(stringValue(cmd.image));
                LocalizedInput in = new LocalizedInput(p.getInputStream());
                int c;
                Vector v = new Vector();
                StringBuffer output = new StringBuffer();
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                // echo errors
                in = new LocalizedInput(p.getErrorStream());
                // echo output
                while ((c = in.read()) != -1) {
                        output.append((char)c);
                }
                in.close();
                v.addElement(output);
                result = new ijVectorResult(v,null);
                // wait for completion
                try {
                        p.waitFor();
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.tools.i18n.LocalizedInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.