Package vg.core.exception

Examples of vg.core.exception.CoreException


  /**
   * This method runs system.
   */
  public static synchronized void run() throws CoreException {
    if(instance) return;
    if(config==null) throw new CoreException("config = null",EnumCriticalityException.FAILED);
    if(log==null) throw new CoreException("log = null",EnumCriticalityException.FAILED);
    if(windowMessage==null) throw new CoreException("windowMessage = null",EnumCriticalityException.FAILED);
    if(progressManager == null) throw new CoreException("progressManager = null",EnumCriticalityException.FAILED);
    //finalize of services
    Runtime.getRuntime().addShutdownHook(new Thread() {
      public void run() {
        config.save();
      }
View Full Code Here


  private Graph[] graphArray;
  //-------------------------------------------------------------------------
  public SimpleModel() throws CoreException {
    this.graphArray = new Graph[DEF_COUNT_GRAPHS];
    if(this.graphArray==null)
      throw(new CoreException("[Model.Model] can not allocate memory",EnumCriticalityException.FAILED));
  }
View Full Code Here

        this.graphArray[i] = graph;
        break;
      }
    }
    if(i==DEF_COUNT_GRAPHS) {
      throw(new CoreException("[Model.addGraph] You can not open more "+DEF_COUNT_GRAPHS+" tabs",EnumCriticalityException.WARNING));
    }
    VisualGraph.log.printDebug("[Model.addGraph] after adding a graph.");
    return(number);
  }
View Full Code Here

            return handler.getGraphID();
        } catch (CoreException e) {
          throw e;
        } catch (ParserConfigurationException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());
      throw new CoreException(e.getMessage(), EnumCriticalityException.FAILED);
    } catch (SAXParseException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());     
      throw new CoreException(fileName  + ":" + e.getLineNumber() + ":" + e.getColumnNumber()
          + " " + e.getMessage(), EnumCriticalityException.FAILED);
    } catch (SAXException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());
      throw new CoreException(fileName  + ":" + e.getMessage(), EnumCriticalityException.FAILED);
    } catch (FileNotFoundException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());
      throw new CoreException("File " + fileName + " don't found", EnumCriticalityException.FAILED);
    } catch (IOException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());
      throw new CoreException(e.getMessage(), EnumCriticalityException.FAILED);
    }       
    }
View Full Code Here

            return type.cast(s);
        }

        public Integer getGraphID() throws CoreException{
          if (m_graph == null)
            throw new CoreException(error, EnumCriticalityException.FAILED);
            return m_graph.getStorableId();
        }
View Full Code Here

    try {
      this.graphSkeletons = new HashMap<Integer, GraphNode>();
      this.waitGraphNodes = new HashMap<Integer, ArrayList<GraphNode>>();
      this.dataBase = new SQLite4JavaDataBase();
    } catch (Throwable ex) {   
        throw(new CoreException("[" + this.getClass().getName() + ".SQLite4JavaModel] [FAIL] Exception = " + ex.getMessage(),EnumCriticalityException.FAILED));
    }
  }
View Full Code Here

                    + fileChooser.getSelectedFile().getPath());
                UIEventOpenNewGraph ong = new UIEventOpenNewGraph(newGraphId, parameter.model.getGraphName(newGraphId));
                parameter.userInterface.addEvent(ong);
              } catch (Throwable e) {
                VisualGraph.log.printException(e);
                VisualGraph.windowMessage.showExceptionMessage(new CoreException("Cannot open file.\nException : "
                    + e.getMessage(), EnumCriticalityException.WARNING));
              }
            }
          });
          thread.setDaemon(true)
View Full Code Here

      graph = new StorableGraph(graphName, null, ssg.getStorableId());
      model.addStorableGraph(graph, subgraphIds);
      VisualGraph.progressManager.removeTask(task);
    } catch (IOException e) {
      VisualGraph.log.printStackTrace(e.getStackTrace());
      throw new CoreException(e.getMessage(), EnumCriticalityException.FAILED);
    }   
    return(graph.getStorableId());
  }
View Full Code Here

      
      String extension = fileName.toLowerCase().replaceAll(".*\\.", "");
     
      IDecoder decoder = decoders.get(extension);
      if (decoder == null)
        throw new CoreException("Couldn't find decoder for *." + extension + "file",
            EnumCriticalityException.ERROR);
      String name = "Unknown";
      int index = fileName.lastIndexOf(File.separatorChar);
      if (index < 0) {
        name = fileName;
      } else {
        name = fileName.substring(index + 1);
      }
        Date d = new Date();

      Integer graphId = decoder.decode(fileName, model, name.replaceFirst("\\..*$", ""));
      if (graphId < 0) {
        VisualGraph.log.printError("[" + this.getClass().getName()
          + ".openGraph] [BAD] Cannot to add graph in model.");
        throw new CoreException("Cannot to add graph in model.", EnumCriticalityException.WARNING);
      }
      openedFilesList.add(fileName);
        VisualGraph.log.printInfo("Graph load time: " + (new Date().getTime() - d.getTime()) / 1000.0 + "sec");
      return graphId;
  }
View Full Code Here

        this.currConnection = DriverManager.getConnection("jdbc:sqlite:data/db/current.db");
        //this.graphSkeletons = new HashMap<Integer, GraphNode>();
        VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [OK] Creating of database");
      } catch (Exception ex) {
        VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [FAIL] Creating of database. Exception : " + ex.getMessage());
        throw(new CoreException("[Model.Model] [Creating of data base] Exception = " + ex.getMessage(),EnumCriticalityException.FAILED));
      }
    //creating of tables---------------------
      VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [PROCESS] Creating of tables");
      Statement currStatement = null;
      try {
        //drop old tables if exists----------
        currStatement = this.currConnection.createStatement();
        currStatement.executeUpdate("drop table if exists com_graph_subgraph;");
        currStatement.executeUpdate("drop table if exists com_subgraph_edge;");
        currStatement.executeUpdate("drop table if exists com_subgraph_vertex;");
        currStatement.executeUpdate("drop table if exists com_edge_attribute;");
        currStatement.executeUpdate("drop table if exists com_vertex_attribute;");
        currStatement.executeUpdate("drop table if exists graph;");
        currStatement.executeUpdate("drop table if exists subgraph;");
        currStatement.executeUpdate("drop table if exists attribute;");
        currStatement.executeUpdate("drop table if exists vertex;");
        currStatement.executeUpdate("drop table if exists edge;");
        //create new tables------------------
        currStatement.executeUpdate("create table vertex (db_id INTEGER PRIMARY KEY, id VARCHAR, db_id_inner_graph INTEGER);");
        currStatement.executeUpdate("create table edge (db_id INTEGER PRIMARY KEY, id VARCHAR, db_id_source INT, db_id_target INT);");
        currStatement.executeUpdate("create table attribute (db_id INTEGER PRIMARY KEY, name VARCHAR, value VARCHAR);");
        currStatement.executeUpdate("create table subgraph (db_id INTEGER PRIMARY KEY, id VARCHAR, name VARCHAR, directed BOOLEAN);");
        currStatement.executeUpdate("create table graph (db_id INTEGER PRIMARY KEY, root_key INTEGER, name VARCHAR);");
       
        currStatement.executeUpdate("create table com_vertex_attribute (db_id INTEGER PRIMARY KEY autoincrement, db_id_vertex INTEGER, db_id_attribute INTEGER);");
        currStatement.executeUpdate("create table com_edge_attribute (db_id INTEGER PRIMARY KEY autoincrement, db_id_edge INTEGER, db_id_attribute INTEGER);");
       
        currStatement.executeUpdate("create table com_subgraph_vertex (db_id INTEGER PRIMARY KEY autoincrement, db_id_subgraph INTEGER, db_id_vertex INTEGER);");
        currStatement.executeUpdate("create table com_subgraph_edge (db_id INTEGER PRIMARY KEY autoincrement, db_id_subgraph INTEGER, db_id_edge INTEGER);");
       
        currStatement.executeUpdate("create table com_graph_subgraph (db_id INTEGER PRIMARY KEY autoincrement, db_id_graph INTEGER, db_id_subgraph INTEGER);");
        VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [OK] Creating of tables");
      } catch (Exception ex) {
        VisualGraph.log.printDebug("[" + this.getClass().getName() + ".SQLiteModel] [FAIL] Creating of tables. Exception : " + ex.getMessage());
        throw(new CoreException("[" + this.getClass().getName() + ".SQLiteModel] [Creating of tables] Exception = " + ex.getMessage(),EnumCriticalityException.FAILED));
      } finally {
        if(currStatement != null) {
          try {
            currStatement.close();
          } catch(SQLException ex) {
View Full Code Here

TOP

Related Classes of vg.core.exception.CoreException

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.