Esempio n. 1
0
  @Override
  public void afterZoneStart() {
    BFLogger.getInstance().info("AfterZoneStart");
    BFSessionManager.getInstance().setSessionEvent(new BFSessionEvent());
    Session session = HibernateFactoryUtil.getInstance().getCurrentSession();
    Transaction tx = null;
    try {
      tx = session.beginTransaction();

      tx.commit();
    } catch (Exception ex) {
      BFLogger.getInstance().error(ex.getMessage(), ex);
      if (tx != null && tx.isActive()) {
        tx.rollback();
      }
    }
  }
Esempio n. 2
0
 @Override
 public void beforeZoneStart() {
   BFLogger.getInstance().info("BeforeZoneStart");
   try {
     zone.setMonitorFolder(new File(".").getCanonicalPath() + "/target/classes");
     zone.setSessionTimeout(30);
   } catch (IOException ex) {
     Logger.getLogger(ChatActivity.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
Esempio n. 3
0
 @Override
 public void afterZoneStop() {
   BFLogger.getInstance().info("AfterZoneStart");
 }
Esempio n. 4
0
 @Override
 public void beforeZoneStop() {
   BFLogger.getInstance().info("BeforeZoneStop");
 }
Esempio n. 5
0
  private void loadConfig() {
    try {
      File file = new File("config.xml");
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file);
      doc.getDocumentElement().normalize();

      this.portSocket =
          Integer.parseInt(
              doc.getElementsByTagName("port_socket")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
      this.portWebSocket =
          Integer.parseInt(
              doc.getElementsByTagName("port_websocket")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
      // HuongNS
      this.portWebSocketSSL =
          Integer.parseInt(
              doc.getElementsByTagName("port_websocketSSL")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
      this.portTelnet =
          Integer.parseInt(
              doc.getElementsByTagName("port_telnet")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
      this.enableZip =
          (Integer.parseInt(
                  doc.getElementsByTagName("enable_zip")
                      .item(0)
                      .getChildNodes()
                      .item(0)
                      .getNodeValue())
              == 1);
      this.reloadClassPaths =
          doc.getElementsByTagName("reload_class_path")
              .item(0)
              .getChildNodes()
              .item(0)
              .getNodeValue()
              .split(";");
      this.sessionTimeout =
          Integer.parseInt(
              doc.getElementsByTagName("session_timeout")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue());
      this.certificateFile =
          doc.getElementsByTagName("certificate_file")
              .item(0)
              .getChildNodes()
              .item(0)
              .getNodeValue();
      this.privateFile =
          doc.getElementsByTagName("private_file").item(0).getChildNodes().item(0).getNodeValue();
    } catch (Exception ex) {
      BFLogger.getInstance().error(ex.getMessage(), ex);
      System.exit(0);
    }
  }