@@ -532,9 +532,17 @@ public DataFile[] getDataFiles() {
532532 return res .toArray (new DataFile []{});
533533 }
534534
535+ public Map <Integer , DataFile > getDataFilesMap () {
536+ final Map <Integer , DataFile > res = new HashMap <>();
537+ for (Object o : tDataFile .getIndexFieldByColumn ("fileId" ).getIndex ().getContent ()) {
538+ res .put (((DataFile )((DataChunk )o ).getEntity ()).getFileId (), (DataFile )((DataChunk )o ).getEntity ());
539+ }
540+ return res ;
541+ }
542+
535543 public MgmtModule [] getMgmtModules () {
536544 final Table t = getTableByName ("su.interference.persistent.MgmtModule" );
537- final ArrayList <MgmtModule > res = new ArrayList <MgmtModule >();
545+ final ArrayList <MgmtModule > res = new ArrayList <>();
538546 for (Object o : t .getIndexFieldByColumn ("moduleId" ).getIndex ().getContent ()) {
539547 res .add ((MgmtModule )((DataChunk )o ).getEntity ());
540548 }
@@ -551,6 +559,15 @@ public synchronized Cursor getCursorById (long id) {
551559 return (Cursor )((DataChunk )t .getIndexFieldByColumn ("cursorId" ).getIndex ().getObjectByKey (id )).getEntity ();
552560 }
553561
562+ public synchronized List <Cursor > getCursors () {
563+ final Table t = getTableByName ("su.interference.persistent.Cursor" );
564+ final ArrayList <Cursor > res = new ArrayList <>();
565+ for (Object o : t .getIndexFieldByColumn ("cursorId" ).getIndex ().getContent ()) {
566+ res .add ((Cursor )((DataChunk )o ).getEntity ());
567+ }
568+ return res ;
569+ }
570+
554571 public Table getTableById (int id ) {
555572 if (tt != null ) {
556573 final MapField map = tt .getMapFieldByColumn ("objectId" );
@@ -564,6 +581,22 @@ public Table getTableById (int id) {
564581 return null ;
565582 }
566583
584+ public List <Table > getTables () {
585+ final List <Table > result = new ArrayList <>();
586+ if (tt != null ) {
587+ final MapField map = tt .getMapFieldByColumn ("objectId" );
588+ if (map != null ) {
589+ for (Object o : map .getMap ().entrySet ()) {
590+ final DataChunk c = (DataChunk ) ((Map .Entry ) o ).getValue ();
591+ if (c != null ) {
592+ result .add ((Table ) c .getEntity ());
593+ }
594+ }
595+ }
596+ }
597+ return result ;
598+ }
599+
567600 public synchronized Table getTableByName (String name ) {
568601 final MapField map = tt .getMapFieldByColumn ("name" );
569602 if (map != null && name != null ) {
@@ -584,6 +617,22 @@ public Map getFramesMap () {
584617 return ixf .getMap ();
585618 }
586619
620+ public List <FrameData > getSortedDataFrames (Map <Integer , DataFile > dfsmap , int type ) {
621+ final MapField ixf = tFrameData .getMapFieldByColumn ("frameId" );
622+ final ArrayList <FrameData > r = new ArrayList <>();
623+ //ixf.getMap().values().stream().map(o -> ((DataChunk) o).getEntity()).filter(o -> dfsmap.get(((FrameData) o).getAllocFile()).getType() == type).sorted().forEach(o -> r.add((FrameData) o));
624+ for (Object o : ixf .getMap ().values ()) {
625+ FrameData fd = (FrameData ) ((DataChunk ) o ).getEntity ();
626+ int fileId = (int ) fd .getFile ();
627+ System .out .println (fileId );
628+ if (dfsmap .get (fileId ).getType () == type ) {
629+ r .add (fd );
630+ }
631+ }
632+ Collections .sort (r );
633+ return r ;
634+ }
635+
587636 public FrameData getFrameById (long id ) {
588637 final MapField ixf = tFrameData .getMapFieldByColumn ("frameId" );
589638 final Map ixl = ixf .getMap ();
@@ -638,6 +687,19 @@ public ArrayList<DataFile> getDataFilesByType (int id) {
638687 return r ;
639688 }
640689
690+ public synchronized List <Session > getSessions () {
691+ List <Session > res = new ArrayList <>();
692+ if (Instance .getInstance ().systemState ==Instance .SYSTEM_STATE_UP ) {
693+ Table t = getTableByName ("su.interference.persistent.Session" );
694+ for (Object o : t .getIndexFieldByColumn ("sessionId" ).getIndex ().getContent ()) {
695+ res .add ((Session ) ((DataChunk ) o ).getEntity ());
696+ }
697+ } else {
698+ res .add (Session .getDntmSession ());
699+ }
700+ return res ;
701+ }
702+
641703 public synchronized Session getSession (String sessionId ) {
642704 if (sessionId == null ) {
643705 return null ;
@@ -701,14 +763,19 @@ public ArrayList<FrameSync> getSyncFrames(int nodeId) {
701763 return r ;
702764 }
703765
766+ public synchronized Process getProcessById (int id ) {
767+ final Table t = getTableByName ("su.interference.persistent.Process" );
768+ return (Process )((DataChunk )t .getIndexFieldByColumn ("processId" ).getIndex ().getObjectByKey (id )).getEntity ();
769+ }
770+
704771 public synchronized Process getProcessByName (String name ) {
705772 final Table t = getTableByName ("su.interference.persistent.Process" );
706773 return (Process )((DataChunk )t .getIndexFieldByColumn ("processName" ).getIndex ().getObjectByKey (name )).getEntity ();
707774 }
708775
709776 public synchronized List <Process > getProcesses () {
710777 final Table t = getTableByName ("su.interference.persistent.Process" );
711- final ArrayList <Process > r = new ArrayList <Process >();
778+ final ArrayList <Process > r = new ArrayList <>();
712779 for (Object o : t .getIndexFieldByColumn ("processId" ).getIndex ().getContent ()) {
713780 r .add ((Process )((DataChunk )o ).getEntity ());
714781 }
0 commit comments