Package ru.vassaev.core.exception

Examples of ru.vassaev.core.exception.SysException


        if (ids.size() != 1)
          return pi.value;
        try {
        return stmt.getObject(ids.get(0));
      } catch (SQLException e) {
        throw new SysException(e);
      }
//      }
    }
View Full Code Here


    protected void initialize() throws SysException{
        session = Session.getDefaultInstance(getInitProperties(), null);
        try {
            pop3Store = session.getStore("pop3");
        } catch (NoSuchProviderException ex) {
            throw new SysException(ex);
        }
        Properties props = getInitProperties();
        pop3host = props.getProperty("mail.pop3.host");
        username = props.getProperty("mail.pop3.username");
        password = props.getProperty("mail.pop3.password");
View Full Code Here

            }

            folder.close(true);
            return true;
        } catch (MessagingException ex) {
            throw new SysException(ex);
        } catch (FileNotFoundException ex) {
            throw new SysException(ex);
        } catch (IOException ex) {
            throw new SysException(ex);
        }
    }
View Full Code Here

      lrc ^= FLD;
      add[0] = FLD;
      try {
        b = e.getKey().getBytes(charset)[0];
      } catch (UnsupportedEncodingException e1) {
        throw new SysException(e1);
      }
      lrc ^= b;
      add[1] = b;
      for (i = 0; i < val.length; i++) {
        b = val[i];
View Full Code Here

      len = len - dta.length;
    if (val != null) {
      try {
        dta = val.getBytes(charset);
      } catch (UnsupportedEncodingException e) {
        throw new SysException(e);
      }
      data.put(key, dta);
      len += dta.length;
    }
  }
View Full Code Here

   *           - в случае недостатка параметров или невалидных значений
   */
  public State paramsValidateAndPrepare(Context cntx) throws SysException {
    String poolProcessName = cntx.getPrmString("process_pool");
    if (Null.equ(poolProcessName))
      throw new SysException("Parameter process_pool isn't set");
    prcs = (PoolThread) ApplicationManager.getPoolByName(poolProcessName,
        Process.class);
    // Определение пула контейнеров сообщений
//*
    String poolMessageName = cntx.getPrmString("message_pool");
    if (Null.equ(poolMessageName))
      throw new SysException("Parameter message_pool isn't set");
    poolmsg = (Pool<ByteMsg>) ApplicationManager.getPoolByName(poolMessageName,
        ByteMsg.class);
    if (poolmsg == null)
      throw new SysException("There is no message pool by name '"
          + poolMessageName + "'");
//*/
    host = cntx.getPrmString("host");
    port = Integer.parseInt(cntx.getPrmString("port"));
    return null;
View Full Code Here

  private File occupyFile(File own, ru.vassaev.core.thread.Process prc
      , Context cntx, File from_dir, boolean subdirectories) throws SysException {
    if (!from_dir.exists()) {
      boolean b = from_dir.mkdirs();
      if (!b)
        throw new SysException("Impossible creating directory with path '" + from_dir.getAbsolutePath() + "'");
    }
    if (!from_dir.isDirectory())
      throw new SysException(from_dir.getAbsolutePath() + " is a file");
    File[] fls = from_dir.listFiles();
    for (int i = 0; i < fls.length; i++) {
      File fl = fls[i];
      if (subdirectories && fl.isDirectory()) {
        File x = occupyFile(own, prc, cntx, fl, subdirectories);
        if (x == null)
          continue;
        else
          return x;
      }
      if (fl.isFile()) {
        cntx.log(false, "found file '", fl.getAbsolutePath(), "'");
        String lm = Long.toString(fl.lastModified());
        prc.regResourceName(fl.getName(), "file.NAME");
        prc.regResourceName(lm, "file.LM");
        prc.regResourceName(fl.getParent(), "file.PATH");
        prc.regResourceName(fl.getAbsolutePath(), "file.FULLNAME");
        File f = fl.getParentFile();
        StringBuffer s = new StringBuffer();
        while (!own.equals(f)) {
          s.insert(0, f.getName()).insert(0, File.separatorChar);
          f = f.getParentFile();
        }
        regResourceName(s, "file.RPATH");
        String prc_dir = cntx.getPrmString("path_prc");
        if (prc_dir == null || prc_dir.length() == 0) {
          String skip_dir = cntx.getPrmString("path_skip");
          if (skip_dir == null || skip_dir.length() == 0) {
            fl.delete();
            cntx.log(false, fl.getAbsolutePath(), " was deleted");
            continue;
          }
          File skip_d = new File(skip_dir.toString());
          if (!skip_d.exists()) {
            boolean b = skip_d.mkdirs();
            if (!b)
              throw new SysException("Impossible creating directory with path '" + skip_d.getAbsolutePath() + "'");
          }
          StringBuffer skip_file = new StringBuffer().append(skip_dir)
              .append(File.separatorChar).append(fl.getName()).append('.').append(System.nanoTime());
          cntx.log(false, fl.getAbsolutePath(), " was skipped and removed to ", skip_file);
        } else {
          File prc_d = new File(prc_dir.toString());
          if (!prc_d.exists()) {
            boolean b = prc_d.mkdirs();
            if (!b)
              throw new SysException("Impossible creating directory with path '" + prc_d.getAbsolutePath() + "'");
          }
          StringBuffer prc_file = new StringBuffer().append(prc_dir)
              .append(File.separatorChar).append(fl.getName()).append('.').append(System.nanoTime());
          File prc_fl = new File(prc_file.toString());
          if (fl.renameTo(prc_fl))
View Full Code Here

              }
              File rn_d = new File(rn.toString());
              if (!rn_d.exists()) {
                boolean b = rn_d.mkdirs();
                if (!b)
                  throw new SysException("Impossible creating directory with path '" + rn_d.getAbsolutePath() + "'");
              }
              StringBuffer skip_file = new StringBuffer().append(rn)
                  .append(File.separatorChar).append(d.getName());
              File r = new File(skip_file.toString());
              d.renameTo(r);
              cntx.log(false, d.getAbsolutePath(), " was renamed to ", r.getAbsolutePath());
            }
            wait0();
            continue;
          }

          long wait = Strings.parseIntegerNvl(cntx.getPrmByFullName("wait"), 60000);//!!!
          cntx.log(false, "Start waiting (" + wait + ")");
          State st = cntx_child.ta.waitFinished(cntx_child.id_subject, cntx_child.id_task, wait);
          cntx.log(false, "End waiting");
          if (State.DONE_ERR.equals(st)) {
            String rn = cntx.getPrmString("path_err");
            if (rn == null || rn.length() == 0) {
              cntx.log(false, d.getAbsolutePath(), " wasn't renamed");
              continue;
            }
            File rn_d = new File(rn.toString());
            if (!rn_d.exists()) {
              boolean b = rn_d.mkdirs();
              if (!b)
                throw new SysException("Impossible creating directory with path '" + rn_d.getAbsolutePath() + "'");
            }
            StringBuffer err_file = new StringBuffer().append(rn)
                .append(File.separatorChar).append(d.getName());
            File r = new File(err_file.toString());
            d.renameTo(r);
            cntx.log(false, d.getAbsolutePath(), " was renamed to ", r.getAbsolutePath());
          } else if (State.DONE_OK.equals(st)) {
            String rn = cntx.getPrmString("path_ok");
            if (rn == null || rn.length() == 0) {
              cntx.log(false, d.getAbsolutePath() + " wasn't renamed");
              continue;
            }
            File rn_d = new File(rn.toString());
            if (!rn_d.exists()) {
              boolean b = rn_d.mkdirs();
              if (!b)
                throw new SysException("Impossible creating directory with path '" + rn_d.getAbsolutePath() + "'");
            }
            StringBuffer ok_file = new StringBuffer().append(rn)
                .append(File.separatorChar).append(d.getName());
            File r = new File(ok_file.toString());
            d.renameTo(r);
View Full Code Here

  public JavaProc(center.task.prm.Type tp, String owner, Element e) throws SysException {
    super(tp, owner);
    Element proc = (Element) Strings.getXMLObject(e, "code");
    if (proc == null)
      throw new SysException("There is no Element code");
    //Путь к исходникам
    src_path =
      Prm.getConst((Element)Strings.getXMLObject(e, "src_path"));
    if (src_path == null)
      throw new SysException("There is no Element src_path");
    //Путь к классам
    cls_path =
      Prm.getConst((Element)Strings.getXMLObject(e, "cls_path"));
    if (cls_path == null)
      throw new SysException("There is no Element cls_path");
    //Пакет
    pkgn = Strings.getXMLValue(e, "pkg_name");
    if (pkgn == null)
      throw new SysException("There is no Element pkg_name");
    //Класс
    clsn = Strings.getXMLValue(e, "class_name");
    if (clsn == null)
      throw new SysException("There is no Element class_name");
   
    NodeList nl = proc.getChildNodes();
    StringBuffer sb = new StringBuffer();

    sb.append("public static void exec(Object[] th, String[] sp, Object[] in, Object[] out) throws ")
View Full Code Here

  }

  public State paramsValidateAndPrepare(Context cntx) throws SysException {
    FROM = cntx.getPrmString("msg/FROM");
    if (FROM == null)
      throw new SysException("There is not set param by name 'msg/CC'");
    TO = cntx.getPrmString("msg/TO");
    if (TO == null)
      throw new SysException("There is not set param by name 'msg/TO'");
    CC = cntx.getPrmString("msg/CC");
    BCC = cntx.getPrmString("msg/BCC");
    SUBJECT = cntx.getPrmString("msg/SUBJECT");
    CHARSET = cntx.getPrmNvl("msg/CHARSET", "utf8");
    return null;
View Full Code Here

TOP

Related Classes of ru.vassaev.core.exception.SysException

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.