Project

General

Profile

fix_all_compile_warnings_6208_v3.diff

Tomasz Domin, 05/02/2022 03:32 PM

Download (71 KB)

View differences:

new/src/com/goldencode/p2j/admin/client/application/home/console/recordlocks/RecordLocksView.java 2022-05-02 09:56:32 +0000
2 2
** Module   : RecordLocksView.java
3 3
** Abstract : RecordLocksView represents a view to access the record locks functionality.
4 4
**
5
** Copyright (c) 2017-2018, Golden Code Development Corporation.
5
** Copyright (c) 2017-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ----------------Description----------------------
8 8
** 001 SBI 20170601 Created initial version.
9 9
** 002 CA  20180605 Added program trace in the record locks view.
10
** 003 TJD 20220331 Removed deprecated reference to Inputdialog.showFilterDialog()
10 11
*/
11 12
/*
12 13
** This program is free software: you can redistribute it and/or modify
......
312 313
   /**
313 314
    * The Filter button click handler.
314 315
    * 
315
    * @param    e
316
    * @param    event
316 317
    *           Click event
317 318
    */
318 319
   @UiHandler("filter")
319
   void onFilter(ClickEvent e)
320
   void onFilterAction(ClickEvent event)
320 321
   {
321
      // trigger for "Filter" dialog
322
      InputDialog.Field newFilter;
322 323
      InputDialog inputDialog = this.inputDialogProvider.get();
323
      inputDialog.showFilterDialog(
324
                                    getUiHandlers().getCurrentFilter(),
325
                                    modalFragment,
326
                                    filter ->
327
                                    {
328
                                       getUiHandlers().setDataSelectionFilter(filter);
329
                                    });
324
      String hlpText = "<h4>Define the filtering specification below. Press the&nbsp;" +
325
                       "'OK' button without any specification to remove any&nbsp;" +
326
                       "previous filter.</h4>";
327
      inputDialog.build("Filter", hlpText , new InputDialog.Field[]
328
      {
329
         newFilter = new InputDialog.Field("Filter", getUiHandlers().getCurrentFilter(), true)
330
      });
331
      inputDialog.show(modalFragment, true, values ->
332
      {
333
         if (values != null)
334
         {
335
            String newFilterValue = (String) values.get(newFilter);
336
            getUiHandlers().setDataSelectionFilter(newFilterValue);
337
            logger.info("inputDialog -> " + newFilterValue);
338
         }
339
      });
330 340
   }
331 341
   
332 342
   /**
new/src/com/goldencode/p2j/admin/client/application/home/print/PrintPreviewView.java 2022-05-02 09:56:32 +0000
2 2
** Module   : PrintPreviewView.java
3 3
** Abstract : PrintPreviewView defines UI to work with print preview.
4 4
**
5
** Copyright (c) 2017, Golden Code Development Corporation.
5
** Copyright (c) 2017-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ----------------Description----------------------
8 8
** 001 SBI 20170601 Created initial version.
9
** 002 TJD 20220331 Removed deprecated reference to Inputdialog.showFilterDialog()
9 10
*/
10 11
/*
11 12
** This program is free software: you can redistribute it and/or modify
......
453 454
   @UiHandler("filterAction")
454 455
   void onFilterAction(ClickEvent event)
455 456
   {
457
      InputDialog.Field newFilter;
456 458
      InputDialog inputDialog = this.inputDialogProvider.get();
457
      inputDialog.showFilterDialog(
458
                                    getUiHandlers().getCurrentFilter(),
459
                                    modalFragment,
460
                                    filter ->
461
                                    {
462
                                       previewContainer.clear();
463
                                       previewContent.clearContent();
464
                                       previewContent.setRowCount(0, true);
465
                                       pager.setPageStart(0);
466
                                       getUiHandlers().setDataSelectionFilter(filter);
467
                                    });
468

  
459
      String hlpText = "<h4>Define the filtering specification below. Press the&nbsp;" +
460
               "'OK' button without any specification to remove any&nbsp;" +
461
               "previous filter.</h4>";
462
      inputDialog.build("Filter", hlpText , new InputDialog.Field[]
463
      {
464
         newFilter = new InputDialog.Field("Filter", getUiHandlers().getCurrentFilter(), true)
465
      });
466
      inputDialog.show(modalFragment, true, values ->
467
      {
468
         if (values != null)
469
         {
470
            String newFilterValue = (String) values.get(newFilter);
471
            getUiHandlers().setDataSelectionFilter(newFilterValue);
472
            logger.info("inputDialog -> " + newFilterValue);
473
         }
474
      });
469 475
   }
470 476

  
471 477
   /**
new/src/com/goldencode/p2j/admin/client/widget/dialog/InputDialog.java 2022-05-02 09:56:32 +0000
2 2
** Module   : InputDialog.java
3 3
** Abstract : Generic input data dialog.
4 4
**
5
** Copyright (c) 2017-2019, Golden Code Development Corporation.
5
** Copyright (c) 2017-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- --------------------------------Description-----------------------------------
8 8
** 001 HC  20170612 Initial version.
9 9
** 002 EVL 20170926 Javadoc fix.
10 10
** 003 OM  20190111 Got rid of compile warning related to ambiguous method call.
11
*/
11
** 004 TJD 20220331 Removed deprecated Inputdialog.showFilterDialog()
12
**/
12 13

  
13 14
/*
14 15
** This program is free software: you can redistribute it and/or modify
......
1716 1717
      }
1717 1718
   }
1718 1719

  
1719
   /**
1720
    * Builds and shows a filter input dialog.
1721
    * TOOD: This method should not be here, InputDialog class should not handle any specific
1722
    *       application logic.
1723
    *
1724
    * @param   filter
1725
    *          The initial filter value.
1726
    * @param   parent
1727
    *          The modal dialog parent.
1728
    * @param   actionHandler
1729
    *          The callback called when the dialog is dismissed.
1730
    */
1731
   @Deprecated
1732
   public void showFilterDialog(String filter, HasWidgets parent, Consumer<String> actionHandler)
1733
   {
1734
      String hlpText = "<h4>Define the filtering specification below. Press the&nbsp;" +
1735
                       "'OK' button without any specification to remove any&nbsp;" +
1736
                       "previous filter.</h4>";
1737
      String label = "Filter";
1738
      
1739
      InputDialog.Field fFilter;
1740
      
1741
      build("Filter", hlpText, new InputDialog.Field[]
1742
      {
1743
         fFilter = new InputDialog.Field(label, filter, true)
1744
      });
1745
      show(parent, true, values ->
1746
      {
1747
         if (values != null)
1748
         {
1749
            actionHandler.accept((String) values.get(fFilter));
1750
         }
1751
      });
1752
   }
1720

  
1753 1721
}
new/src/com/goldencode/p2j/main/WebClientsManager.java 2022-05-02 09:56:32 +0000
2 2
** Module   : WebClientsManager.java
3 3
** Abstract : WebClientsManager implements business methods to allocate and release web clients.
4 4
**
5
** Copyright (c) 2017-2021, Golden Code Development Corporation.
5
** Copyright (c) 2017-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ----------------Description----------------------
8 8
** 001 SBI 20170628 Created initial version.
......
14 14
** 005 IAS 20210412 Used daemon thread pool for the HTTP client.
15 15
** 006 SBI 20210926 Added allocateAgentPorts, updateOptionsForJavaDebuggerAndJMXAgents, isAgentRangeConfigured
16 16
**                  to manage agent ports for new web client.
17
*/
17
** 007 TJD 20220331 Replaced deprecated new SslContextFactory() with SslContextFactory.Client()
18
**/
18 19
/*
19 20
** This program is free software: you can redistribute it and/or modify
20 21
** it under the terms of the GNU Affero General Public License as
......
239 240
      if (portsRestricted)
240 241
      {
241 242
         // setup ssl engine to test
242
         SslContextFactory sslContextFactory = new SslContextFactory();
243
         SslContextFactory sslContextFactory = new SslContextFactory.Client();
243 244
         SSLContext sslContext = SecurityManager.getInstance().getSecureSocketContext();
244 245
         sslContextFactory.setSslContext(sslContext);
245 246
         
new/src/com/goldencode/p2j/oo/web/WebResponseWriter.java 2022-05-02 09:56:32 +0000
15 15
**                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
16 16
**                  be tracked.
17 17
**                  All TypeFactory.object variable definitions must be done outside of the top-level block.
18
**     TJD 20220331 Suppress warnings in writeStatusLine 
18 19
*/
19 20

  
20 21
/*
......
500 501
      }));
501 502
   }
502 503

  
504
   @SuppressWarnings("deprecation")
503 505
   @LegacySignature(type = Type.METHOD, name = "WriteStatusLine")
504 506
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
505 507
   protected void writeStatusLine()
......
516 518
            {
517 519
               httpResponse.setStatus(response.ref().getStatusCode().intValue(), 
518 520
                        response.ref().getStatusReason().toStringMessage());
519
               
520 521
            }
521 522
         }
522 523
      }));
new/src/com/goldencode/p2j/persist/DatabaseStatistics.java 2022-05-02 09:56:32 +0000
2 2
** Module   : DatabaseStatistics.java
3 3
** Abstract : Collects query and second level cache database statistics
4 4
**
5
** Copyright (c) 2015-2019, Golden Code Development Corporation.
5
** Copyright (c) 2015-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ---------------------------------Description---------------------------------
8 8
** 001 ECF 20150726 Created initial version.
......
11 11
** 004 ECF 20171127 Prepended "./" to database URL.
12 12
** 005 SBI 20180518 Renamed file-system/pkgroot into legacy-system/pkgroot.
13 13
** 006 OM  20191113 Dropped Hibernate support. Deprecated this class.
14
**     TJD 20220331 Removed deprecation from class,
15
**                  as Hibernate is no longer in use it needs to be reimplemented
14 16
*/
15 17

  
16 18
/*
......
130 132
 * <p>
131 133
 * TODO: document <code>perfdb</code> schema.
132 134
 *
133
 * @deprecated Hibernate no longer in use; needs reimplementation or removal.
134 135
 */
135 136
public final class DatabaseStatistics
136 137
{
new/src/com/goldencode/p2j/persist/dialect/P2JPostgreSQLDialect.java 2022-05-02 09:56:32 +0000
111 111
**     IAS 20210803          Generate 'words' UDFs which can switch between using Java and SQL
112 112
**                           low-level UDFs 
113 113
**     IAS 20211223          Special processing of errors raised by UDFs. 
114
**     IAS 20220112          Resolve dialect by JDBC database type. 
114
**     IAS 20220112          Resolve dialect by JDBC database type.
115
**     TJD 20220331          Removed reference to IOUtils.toInputStream
115 116
*/
116 117

  
117 118
/*
......
170 171
package com.goldencode.p2j.persist.dialect;
171 172

  
172 173
import java.io.*;
174
import java.nio.charset.Charset;
173 175
import java.sql.*;
174 176
import java.sql.Date;
175 177
import java.text.*;
......
2126 2128
      public InputStream getAsciiStream() 
2127 2129
      throws SQLException
2128 2130
      {
2129
         return IOUtils.toInputStream(data);
2131
         return new ByteArrayInputStream(data.getBytes(Charset.defaultCharset()));
2130 2132
      }
2131 2133

  
2132 2134
      /**
new/src/com/goldencode/p2j/persist/id/IdentityPool.java 2022-05-02 09:56:32 +0000
31 31
** 129 ECF 20200906          New ORM implementation.
32 32
**     CA  20220210          Removed Commitable.rollbackPending and its notifications, as there is no actual 
33 33
**                           implementation of this method.
34
**     TJD 20220331          Removed unused/deprecated KeyScanner
34 35
*/
35 36

  
36 37
/*
......
444 445
      
445 446
      if (scanMethod != ScanMethod.NONE)
446 447
      {
447
         Thread scanningThread = new Thread(new KeyScanner());
448
         scanningThread.setName("Identity pool scanning thread");
449
         scanningThread.setDaemon(true);
450
         scanningThread.start();
448
         LOG.log(Level.WARNING, "The only supported ScanMethod is NONE");
451 449
      }
452 450
   }
453 451
   
......
572 570
      }
573 571
   }
574 572
   
575
   /**
576
    * This helper class implements functionality of Identity pool scanning thread.
577
    */
578
   private class KeyScanner
579
   implements Runnable
580
   {
581
      /** Key retriever which is used to scan for available keys. */
582
      private KeyRetriever keyRetriever;
583
      
584
      /**
585
       * Performs periodical scanning for available keys.
586
       */
587
      public void run()
588
      {
589
         // Create and initialize key retriever.
590
         switch (scanMethod)
591
         {
592
            case JDBC:
593
               keyRetriever = new JdbcKeyRetriever();
594
               break;
595
            case STORED_PROCEDURE:
596
               keyRetriever = new StoredProcKeyRetriever();
597
               break;
598
            case NONE:
599
               return;
600
         }
601
         
602
         keyRetriever.initialize(database);
603
         
604
         Session session = null;
605
         
606
         // Main loop.
607
         while (true)
608
         {
609
            try
610
            {
611
               if (stopped)
612
               {
613
                  if (session != null)
614
                  {
615
                     session.close();
616
                  }
617
                  
618
                  return;
619
               }
620
               
621
               if (session == null)
622
               {
623
                  session = new Session(database);
624
               }
625
               
626
               // Determine lower bound for scanning.
627
               long minKey = Math.max(maxKey - scanRange + 1, 1);
628
               long oldMaxKey = maxKey;
629
               
630
               // Move down the upper bound for scanning. Do it now because we
631
               // don't want to scan a range twice if any error has occurred.
632
               maxKey = minKey - 1;
633
               
634
               long startTime, endTime;
635
               List<Range> newKeys;
636
               try
637
               {
638
                  synchronized (currentlyScannedRange)
639
                  {
640
                     currentlyScannedRange.setBounds(minKey, oldMaxKey);
641
                  }
642
                  
643
                  // Retrieve available keys.
644
                  startTime = System.currentTimeMillis();
645
                  newKeys = keyRetriever.retrieveFreeKeys(minKey, oldMaxKey, session);
646
                  
647
                  endTime = System.currentTimeMillis();
648
               }
649
               finally
650
               {
651
                  synchronized (currentlyScannedRange)
652
                  {
653
                     currentlyScannedRange.makeEmpty();
654
                  }
655
               }
656
               
657
               int newKeysCount = 0;
658
               if (newKeys != null)
659
               {
660
                  for (Range range : newKeys)
661
                  {
662
                     newKeysCount += range.getRangeSize();
663
                  }
664
               }
665
               
666
               if (LOG.isLoggable(Level.FINE))
667
               {
668
                  LOG.log(Level.FINE,
669
                          "Range [" + minKey + ", " + oldMaxKey + "] was " +
670
                          "scanned in " + (endTime - startTime) + " ms. " +
671
                          newKeysCount + " free keys were found.");
672
                  
673
                  if (newKeys != null)
674
                  {
675
                     for (Range range : newKeys)
676
                     {
677
                        LOG.log(Level.FINE, "Found range: " + range);
678
                     }
679
                  }
680
               }
681
               
682
               // Add recently retrieved keys to the main pool.
683
               long newPoolSize;
684
               synchronized (keysPool)
685
               {
686
                  if (newKeys != null)
687
                  {
688
                     // Get reclaimed keys that should be moved from reclaimed
689
                     // keys pool to the main keys pool.
690
                     SortedSet<Long> reclaimedKeysToMove =
691
                        reclaimedKeysPool.subSet(minKey, oldMaxKey + 1);
692
                     
693
                     for (Range range : newKeys)
694
                     {
695
                        // Check whether some numbers in this range are
696
                        // already present in the reclaimed keys.
697
                        Iterator<Long> iter = reclaimedKeysToMove.iterator();
698
                        while (iter.hasNext())
699
                        {
700
                           Long key = iter.next();
701
                           if (range.contains(key))
702
                           {
703
                              // Key is also deleted for reclaimedKeysPool
704
                              // (because it backs reclaimedKeysToMove subset)
705
                              iter.remove();
706
                              poolSize--;
707
                           }
708
                        }
709
                     }
710
                     
711
                     // Add remaining reclaimed keys to the ranges.
712
                     for (Long key : reclaimedKeysToMove)
713
                     {
714
                        newKeys.add(new Range(key));
715
                     }
716
                     
717
                     // Get all handed out keys.
718
                     SortedSet<Long> allKeysInHands = handedOutKeys.subSet(minKey, oldMaxKey + 1);
719
                     allKeysInHands.addAll(pendingHandedOutKeys);
720
                     
721
                     // Remove keys handed out from the new keys.
722
                     for (Range range : newKeys)
723
                     {
724
                        SortedSet<Long> extractedNumbers
725
                           = allKeysInHands.subSet(range.getLowerBound(),
726
                                                   range.getUpperBound() + 1);
727
                        
728
                        if (extractedNumbers.isEmpty())
729
                        {
730
                           keysPool.add(range);
731
                           poolSize += range.getRangeSize();
732
                           
733
                           if (LOG.isLoggable(Level.FINE))
734
                           {
735
                              LOG.log(Level.FINE, "Scanned range was added: " + range);
736
                           }
737
                        }
738
                        else
739
                        {
740
                           List<Range> subranges = range.splitRange(extractedNumbers);
741
                           
742
                           for (Range subrange : subranges)
743
                           {
744
                              keysPool.add(subrange);
745
                              poolSize += subrange.getRangeSize();
746
                              
747
                              if (LOG.isLoggable(Level.FINE))
748
                              {
749
                                 LOG.log(Level.FINE, "Scanned range was added: " + subrange);
750
                              }
751
                           }
752
                        }
753
                     }
754
                     
755
                     // delete keys from reclaimedKeysPool (they have already 
756
                     // been moved to keysPool)
757
                     poolSize -= reclaimedKeysToMove.size();
758
                     reclaimedKeysToMove.clear();
759
                  }
760
                  
761
                  pendingHandedOutKeys.clear();
762
                  newPoolSize = poolSize;
763
               }
764
               
765
               if (minKey == 1)
766
               {
767
                  if (LOG.isLoggable(Level.FINE))
768
                  {
769
                     LOG.log(Level.FINE, "The entire database has been scanned.");
770
                  }
771
                  
772
                  session.close();
773
                  session = null;
774
                  
775
                  return;
776
               }
777
               
778
               // Determine whether we have to perform next scan and time
779
               // delay before it.
780
               boolean performNextScan = false;
781
               int delay = 0;
782
               if (newPoolSize < scanThreshold)
783
               {
784
                  // We have the number of keys below the scanThreshold.
785
                  performNextScan = true;
786
                  
787
                  // Double scan interval.
788
                  scanInterval = Math.min(scanInterval * 2, maximumScanInterval);
789
                  delay = Math.max(scanInterval, scanDelay);
790
               }
791
               else if (newPoolSize < targetSize)
792
               {
793
                  // We have the number of keys below the targetSize.
794
                  performNextScan = true;
795
                  delay = scanDelay;
796
               }
797
               
798
               if (!performNextScan)
799
               {
800
                  // Close the session since we do not know how soon the next
801
                  // scan will be performed.
802
                  session.close();
803
                  session = null;
804
                  
805
                  if (LOG.isLoggable(Level.FINE))
806
                  {
807
                     LOG.log(Level.FINE, "Waiting for pool to shrink to scanThreshold.");
808
                  }
809
                  
810
                  try
811
                  {
812
                     synchronized (waitLock)
813
                     {
814
                        if (stopped)
815
                        {
816
                           return;
817
                        }
818
                        
819
                        waitLock.wait();
820
                     }
821
                  }
822
                  catch (InterruptedException e)
823
                  {
824
                     // Ignore.
825
                  }
826
               }
827
               else
828
               {
829
                  if (LOG.isLoggable(Level.FINE))
830
                  {
831
                     LOG.log(Level.FINE, "Next scan will be forced in " + delay + " seconds.");
832
                  }
833
                  
834
                  if (delay > sessionHoldTime)
835
                  {
836
                     // Close the session if the next scan will not be performed soon enough.
837
                     session.close();
838
                     session = null;
839
                  }
840
                  
841
                  if (delay > 0)
842
                  {
843
                     try
844
                     {
845
                        // Pause.
846
                        Thread.sleep(delay * 1000);
847
                     }
848
                     catch (InterruptedException e)
849
                     {
850
                        // Ignore.
851
                     }
852
                  }
853
               }
854
            }
855
            catch (PersistenceException exc)
856
            {
857
               if (session != null)
858
               {
859
                  try
860
                  {
861
                     session.close();
862
                  }
863
                  catch (PersistenceException exc2)
864
                  {
865
                     // ignore
866
                  }
867
               }
868
               LOG.log(Level.SEVERE,
869
                       "Identity pool has been stopped because of an exception:", exc);
870
               return;
871
            }
872
            catch (OutOfMemoryError oome)
873
            {
874
               try
875
               {
876
                  LOG.log(Level.SEVERE, "OOME into id pool scanning thread", oome);
877
                  
878
                  // Some delay to let OOME disappear.
879
                  Thread.sleep(5000);
880
               }
881
               catch (OutOfMemoryError | InterruptedException e)
882
               {
883
                  // Ignore.
884
               }
885
            }
886
         }
887
      }
888
   }
889 573
   
890 574
   /**
891 575
    * Context-local container which manages the keys which were returned by
......
971 655
    */
972 656
   private enum ScanMethod
973 657
   {
974
      /** Retrieve keys using SQL queries */
975
      JDBC,
976
      
977
      /** Retrieve keys by calling a stored procedure */
978
      STORED_PROCEDURE,
979
      
658
   
980 659
      /** Do not retrieve keys */
981 660
      NONE
982 661
   }
new/src/com/goldencode/p2j/persist/id/JdbcKeyRetriever.java 1970-01-01 00:00:00 +0000
1
/*
2
** Module   : JdbcKeyRetriever.java
3
** Abstract : KeyRetriever implementation which retrieves keys using SQL
4
**            queries.
5
**
6
** Copyright (c) 2005-2020, Golden Code Development Corporation.
7
**
8
** -#- -I- --Date-- --JPRM-- ----------------------------Description----------------------------
9
** 001 SVL 20080827  @39779  Created initial version. Retrieves free keys using two subsequent 
10
**                           queries.
11
** 002 SVL 20091126  @44444  Use external function for retrieving the list of database tables.
12
** 003 SVL 20120331          Upgraded to Hibernate 4.
13
** 004 OM  20140603          Use multiple queries in order to workaround the SQL Server limitation
14
**                           of maximum 2100 parameters per query.
15
** 005 OM  20151130          Adjusted the theoretical number of parameters per query to practical
16
**                           value.
17
** 006 ECF 20200906          Deprecated this class.
18
**                           TODO: eliminate dependencies and remove the class.
19
*/
20
/*
21
** This program is free software: you can redistribute it and/or modify
22
** it under the terms of the GNU Affero General Public License as
23
** published by the Free Software Foundation, either version 3 of the
24
** License, or (at your option) any later version.
25
**
26
** This program is distributed in the hope that it will be useful,
27
** but WITHOUT ANY WARRANTY; without even the implied warranty of
28
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
** GNU Affero General Public License for more details.
30
**
31
** You may find a copy of the GNU Affero GPL version 3 at the following
32
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
33
** 
34
** Additional terms under GNU Affero GPL version 3 section 7:
35
** 
36
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
37
**   terms apply to the works covered under the License.  These additional terms
38
**   are non-permissive additional terms allowed under Section 7 of the GNU
39
**   Affero GPL version 3 and may not be removed by you.
40
** 
41
**   0. Attribution Requirement.
42
** 
43
**     You must preserve all legal notices or author attributions in the covered
44
**     work or Appropriate Legal Notices displayed by works containing the covered
45
**     work.  You may not remove from the covered work any author or developer
46
**     credit already included within the covered work.
47
** 
48
**   1. No License To Use Trademarks.
49
** 
50
**     This license does not grant any license or rights to use the trademarks
51
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
52
**     of Golden Code Development Corporation. You are not authorized to use the
53
**     name Golden Code, FWD, or the names of any author or contributor, for
54
**     publicity purposes without written authorization.
55
** 
56
**   2. No Misrepresentation of Affiliation.
57
** 
58
**     You may not represent yourself as Golden Code Development Corporation or FWD.
59
** 
60
**     You may not represent yourself for publicity purposes as associated with
61
**     Golden Code Development Corporation, FWD, or any author or contributor to
62
**     the covered work, without written authorization.
63
** 
64
**   3. No Misrepresentation of Source or Origin.
65
** 
66
**     You may not represent the covered work as solely your work.  All modified
67
**     versions of the covered work must be marked in a reasonable way to make it
68
**     clear that the modified work is not originating from Golden Code Development
69
**     Corporation or FWD.  All modified versions must contain the notices of
70
**     attribution required in this license.
71
*/
72

  
73
package com.goldencode.p2j.persist.id;
74

  
75
import com.goldencode.p2j.persist.*;
76
import java.util.*;
77
import com.goldencode.p2j.persist.dialect.*;
78
import com.goldencode.p2j.persist.orm.*;
79
//import com.goldencode.p2j.persist.type.*;
80

  
81
/**
82
 * Provides a service for retrieving available primary keys from database using SQL queries.
83
 * 
84
 * @deprecated Remove this class ASAP; this whole concept has turned out to be unsafe.
85
 */
86
public class JdbcKeyRetriever
87
implements KeyRetriever
88
{
89
   /** Query which returns the number of busy keys in the given range. */
90
   private String[] predictionQueries;
91
   
92
   /** Query which retrieves all busy keys in the given range. */
93
   private String[] retrievalQueries;
94
   
95
   /** The number of tables queried at once (in a single SQL statement). */
96
   private int bucketSize; 
97
   
98
   /**
99
    * Initialize key retriever for the given database.
100
    * Because the number of tables from a database may be too big (at least SQL Server has a
101
    * limitation of 2100 parameters in a query) the keys for the tables are retrieved in buckets.
102
    *
103
    * @param   database
104
    *          Database for which will be scanned for available keys.
105
    */
106
   @Override
107
   public void initialize(Database database)
108
   {
109
      /*
110
      // Get all table names.
111
      List<String> tableNames = DatabaseManager.getDatabaseTables(database);
112
      final int tableCount = tableNames.size();
113
      
114
      // Obtain the is the maximum number of tables that are scanned at in a single SQL query.
115
      Dialect dialect = DatabaseManager.getDialect(database);
116
      // There are 2 parameter for each table
117
      final int bucketSize = dialect.getMaxParameterCount() / 3; 
118
      
119
      // compute the necessary number of buckets to hold all tables
120
      int bucketCount;
121
      if (bucketSize <= 0)
122
      {
123
         // disable bucket-ing, all at once
124
         bucketCount = 1;
125
         this.bucketSize = tableCount;
126
      }
127
      else
128
      {
129
         if ((tableCount % bucketSize) == 0)
130
         {
131
            // no remainder / leftovers 
132
            bucketCount = tableCount / bucketSize;
133
         }
134
         else
135
         {
136
            // the remainder of tables go to extra bucket
137
            bucketCount = tableCount / bucketSize + 1;
138
         }
139
         this.bucketSize = bucketSize;
140
      }
141
      // debug only:
142
      // System.out.println("JdbcKeyRetriever is using bucketSize=" + this.bucketSize + 
143
      //   ", the queries (" + tableCount + ") will be split in " + bucketCount + " queries");
144
      
145
      predictionQueries = new String[bucketCount];
146
      retrievalQueries = new String[bucketCount];
147
      
148
      // Compose prediction queries which look like
149
      // 'select(
150
      //  (select count(id) from table1 where id >= :minId and id <= :maxId) +
151
      //  (select count(id) from table2 where id >= :minId and id <= :maxId) +
152
      //  ...) as cnt'
153
      // in the final step the subqueries intermediary result will be summed to a grand total
154
      int bucket = 0;
155
      StringBuilder buf = new StringBuilder("select (");
156
      for (int i = 0; i < tableCount; i++)
157
      {
158
         assert buf != null;
159
         buf.append("(select count(id) from ");
160
         buf.append(tableNames.get(i));
161
         buf.append(" where id >= :minId and id <= :maxId)");
162
         
163
         if (isLastInBucket(i, tableCount))
164
         {
165
            // bucket full, next bucket
166
            buf.append(") as cnt");
167
            predictionQueries[bucket] = buf.toString();
168
            ++bucket;
169
            
170
            // prepare for next bucket
171
            buf = (bucket != bucketCount) ? new StringBuilder("select (") : null;
172
         }
173
         else
174
         {
175
            // there are more items in this bucket
176
            buf.append(" + ");
177
         }
178
      }
179
      
180
      // Compose id retrieval query which looks like
181
      // 'select id from table1 where id >= :minId and id <= :maxId UNION
182
      //  select id from table2 where id >= :minId and id <= :maxId UNION
183
      //  ....  ORDER BY id asc'
184
      bucket = 0;
185
      buf = new StringBuilder();
186
      for (int i = 0; i < tableCount; i++)
187
      {
188
         assert buf != null;
189
         buf.append("select id from ");
190
         buf.append(tableNames.get(i));
191
         buf.append(" where id >= :minId and id <= :maxId");
192
         
193
         if (isLastInBucket(i, tableCount))
194
         {
195
            buf.append(" ORDER BY id asc");
196
            retrievalQueries[bucket] = buf.toString();
197
            ++bucket;
198
            buf = (bucket != bucketCount) ? new StringBuilder() : null;
199
         }
200
         else
201
         {
202
           // combine with other items from the current bucket
203
            buf.append(" UNION ");
204
         }
205
      }
206
      */
207
   }
208
   
209
   /**
210
    * Get available keys.
211
    * Each bucket is queried independently and the  the results are put back together.
212
    *
213
    * @param   minKey
214
    *          Lower bound of a range of identifiers on which search will be made.
215
    * @param   maxKey
216
    *          Upper bound of a range of identifiers on which search will be made.
217
    * @param   session
218
    *          Hibernate session which will be used to perform queries.
219
    *          
220
    * @return  a list of ranges of available keys
221
    */
222
   @Override
223
   public List<Range> retrieveFreeKeys(Long minKey, Long maxKey, Session session)
224
   {
225
      /*
226
      long rangeSize = maxKey - minKey + 1;
227
      
228
      long count = 0;
229
      for (String pQuery : predictionQueries)
230
      {
231
         // Execute prediction queries.
232
         SQLQuery query = session.createSQLQuery(pQuery);
233
         query.addScalar("cnt", StandardBasicTypes.LONG);
234
         query.setLong("minId", minKey);
235
         query.setLong("maxId", maxKey);
236
         
237
         // sum up the bucket subtotals
238
         count += (Long) query.uniqueResult();
239
      }
240
      
241
      if (count == 0L)
242
      {
243
         // All ids in the given range are free.
244
         List<Range> res = new ArrayList<>();
245
         res.add(new Range(minKey, maxKey));
246
         return res;
247
      }
248
      else if (count == rangeSize)
249
      {
250
         // No ids available.
251
         return null;
252
      }
253
      
254
      SortedSet<Long> busyKeys = new TreeSet<>();
255
      for (String rQuery : retrievalQueries)
256
      {
257
         // Execute the query which will return all busy ids in the given range.
258
         SQLQuery query = session.createSQLQuery(rQuery);
259
         query.addScalar("id", StandardBasicTypes.LONG);
260
         query.setLong("minId", minKey);
261
         query.setLong("maxId", maxKey);
262
         
263
         busyKeys.addAll((List<Long>) query.list());
264
      }
265
      
266
      return new Range(minKey, maxKey).splitRange(busyKeys);
267
      */
268
      
269
      return null;
270
   }
271
   
272
   /**
273
    * Checks if <code>i</code> is the last item in the bucket. Useful for combining items in a
274
    * bucket; the last item is usually handled differently.
275
    * 
276
    * @param   i
277
    *          The current item, related to global item array.
278
    * @param   size
279
    *          The global item array size.
280
    *          
281
    * @return  <code>true</code> if i is the last item in his bucket
282
    */
283
   private boolean isLastInBucket(int i, int size)
284
   {
285
      if (i == size - 1) 
286
      {
287
         // since this is the last item globally, it is also the last item in the last bucket
288
         return true;
289
      }
290
      
291
      // compute the position in the bucket
292
      int bucketPosition = i % this.bucketSize;
293
      return bucketPosition == this.bucketSize - 1;
294
   }
295
}
new/src/com/goldencode/p2j/persist/id/KeyRetriever.java 1970-01-01 00:00:00 +0000
1
/*
2
** Module   : KeyRetriever.java
3
** Abstract : Interface for objects which retrieve available primary keys
4
**            from database.
5
**
6
** Copyright (c) 2005-2017, Golden Code Development Corporation.
7
**
8
** -#- -I- --Date-- --JPRM-- ---------------------------------Description----------------------------------
9
** 001 SVL 20080827   @39780 Created initial version. Defines interface
10
**                           to be used by objects which retrieve
11
**                           available primary keys from database.
12
** 002 ECF 20200906          New ORM implementation.
13
*/
14
/*
15
** This program is free software: you can redistribute it and/or modify
16
** it under the terms of the GNU Affero General Public License as
17
** published by the Free Software Foundation, either version 3 of the
18
** License, or (at your option) any later version.
19
**
20
** This program is distributed in the hope that it will be useful,
21
** but WITHOUT ANY WARRANTY; without even the implied warranty of
22
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
** GNU Affero General Public License for more details.
24
**
25
** You may find a copy of the GNU Affero GPL version 3 at the following
26
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
27
** 
28
** Additional terms under GNU Affero GPL version 3 section 7:
29
** 
30
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
31
**   terms apply to the works covered under the License.  These additional terms
32
**   are non-permissive additional terms allowed under Section 7 of the GNU
33
**   Affero GPL version 3 and may not be removed by you.
34
** 
35
**   0. Attribution Requirement.
36
** 
37
**     You must preserve all legal notices or author attributions in the covered
38
**     work or Appropriate Legal Notices displayed by works containing the covered
39
**     work.  You may not remove from the covered work any author or developer
40
**     credit already included within the covered work.
41
** 
42
**   1. No License To Use Trademarks.
43
** 
44
**     This license does not grant any license or rights to use the trademarks
45
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
46
**     of Golden Code Development Corporation. You are not authorized to use the
47
**     name Golden Code, FWD, or the names of any author or contributor, for
48
**     publicity purposes without written authorization.
49
** 
50
**   2. No Misrepresentation of Affiliation.
51
** 
52
**     You may not represent yourself as Golden Code Development Corporation or FWD.
53
** 
54
**     You may not represent yourself for publicity purposes as associated with
55
**     Golden Code Development Corporation, FWD, or any author or contributor to
56
**     the covered work, without written authorization.
57
** 
58
**   3. No Misrepresentation of Source or Origin.
59
** 
60
**     You may not represent the covered work as solely your work.  All modified
61
**     versions of the covered work must be marked in a reasonable way to make it
62
**     clear that the modified work is not originating from Golden Code Development
63
**     Corporation or FWD.  All modified versions must contain the notices of
64
**     attribution required in this license.
65
*/
66

  
67
package com.goldencode.p2j.persist.id;
68

  
69
import com.goldencode.p2j.persist.*;
70
import com.goldencode.p2j.persist.orm.*;
71
import java.util.*;
72

  
73
/**
74
 * Interface which must be implemented by classes which provide service for
75
 * retrieving available primary keys from database.
76
 */
77
public interface KeyRetriever
78
{
79
   /**
80
    * Initialize key retriever for the given database.
81
    *
82
    * @param database
83
    *        Database for which will be scanned for available keys.
84
    */
85
   public void initialize(Database database);
86
   
87
   /**
88
    * Get available keys.
89
    *
90
    * @param  minKey
91
    *         Lower bound of a range of identifiers on which search will be
92
    *         made.
93
    * @param  maxKey
94
    *         Upper bound of a range of identifiers on which search will be
95
    *         made.
96
    * @param  session
97
    *         Hibernate session which will be used to perform queries.
98
    * 
99
    * @return A list of ranges of available keys
100
    */
101
   public List<Range> retrieveFreeKeys(Long minKey, Long maxKey, Session session);
102
}
new/src/com/goldencode/p2j/persist/id/StoredProcKeyRetriever.java 1970-01-01 00:00:00 +0000
1
/*
2
** Module   : StoredProcKeyRetriever.java
3
** Abstract : KeyRetriever implementation which retrieves keys using stored
4
**            procedure.
5
**
6
** Copyright (c) 2005-2020, Golden Code Development Corporation.
7
**
8
** -#- -I- --Date-- --JPRM-- ---------------------------------Description----------------------------------
9
** 001 SVL 20080827   @39782 Created initial version. Retrieves free keys
10
**                           using a stored procedure.
11
** 002 SVL 20120331          Upgraded to Hibernate 4.
12
** 003 ECF 20200906          Deprecated this class.
13
**                           TODO: eliminate any dependencies and remove this class.
14
*/
15

  
16
/*
17
** This program is free software: you can redistribute it and/or modify
18
** it under the terms of the GNU Affero General Public License as
19
** published by the Free Software Foundation, either version 3 of the
20
** License, or (at your option) any later version.
21
**
22
** This program is distributed in the hope that it will be useful,
23
** but WITHOUT ANY WARRANTY; without even the implied warranty of
24
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
** GNU Affero General Public License for more details.
26
**
27
** You may find a copy of the GNU Affero GPL version 3 at the following
28
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
29
** 
30
** Additional terms under GNU Affero GPL version 3 section 7:
31
** 
32
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
33
**   terms apply to the works covered under the License.  These additional terms
34
**   are non-permissive additional terms allowed under Section 7 of the GNU
35
**   Affero GPL version 3 and may not be removed by you.
36
** 
37
**   0. Attribution Requirement.
38
** 
39
**     You must preserve all legal notices or author attributions in the covered
40
**     work or Appropriate Legal Notices displayed by works containing the covered
41
**     work.  You may not remove from the covered work any author or developer
42
**     credit already included within the covered work.
43
** 
44
**   1. No License To Use Trademarks.
45
** 
46
**     This license does not grant any license or rights to use the trademarks
47
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
48
**     of Golden Code Development Corporation. You are not authorized to use the
49
**     name Golden Code, FWD, or the names of any author or contributor, for
50
**     publicity purposes without written authorization.
51
** 
52
**   2. No Misrepresentation of Affiliation.
53
** 
54
**     You may not represent yourself as Golden Code Development Corporation or FWD.
55
** 
56
**     You may not represent yourself for publicity purposes as associated with
57
**     Golden Code Development Corporation, FWD, or any author or contributor to
58
**     the covered work, without written authorization.
59
** 
60
**   3. No Misrepresentation of Source or Origin.
61
** 
62
**     You may not represent the covered work as solely your work.  All modified
63
**     versions of the covered work must be marked in a reasonable way to make it
64
**     clear that the modified work is not originating from Golden Code Development
65
**     Corporation or FWD.  All modified versions must contain the notices of
66
**     attribution required in this license.
67
*/
68

  
69
package com.goldencode.p2j.persist.id;
70

  
71
import com.goldencode.p2j.persist.*;
72
import com.goldencode.p2j.persist.orm.*;
73
import java.util.*;
74

  
75
/**
76
 * Provides a service for retrieving available primary keys from database
77
 * by calling stored procedure.
78
 *
79
 * @deprecated
80
 */
81
public class StoredProcKeyRetriever
82
implements KeyRetriever
83
{
84
   /** Query which is used for stored procedure call. */
85
   private String retrieveQuery;
86
   
87
   /**
88
    * Name of the stored procedure used for id retrieval.
89
    * Procedure should be declared as 'FUNCTION procedure_name(min_id bigint, 
90
    * max_id bigint) RETURNS SETOF range_type'
91
    */
92
   private static String STORED_PROCEDURE_NAME = "get_free_ids";
93
   
94
   /**
95
    * Initialize key retriever for the given database.
96
    *
97
    * @param database
98
    *        Database for which will be scanned for available keys.
99
    */
100
   public void initialize(Database database)
101
   {
102
      StringBuilder buf = new StringBuilder();
103
      buf.append("select lower_bound, upper_bound from ");
104
      buf.append(STORED_PROCEDURE_NAME);
105
      buf.append("(:minId, :maxId)");
106
      
107
      retrieveQuery = buf.toString();
108
   }
109
   
110
   /**
111
    * Get available keys.
112
    *
113
    * @param  minKey
114
    *         Lower bound of a range of identifiers on which search will be
115
    *         made.
116
    * @param  maxKey
117
    *         Upper bound of a range of identifiers on which search will be
118
    *         made.
119
    * @param  session
120
    *         Hibernate session which will be used to perform queries.
121
    * @return A list of ranges of available keys
122
    */
123
   public List<Range> retrieveFreeKeys(Long minKey, Long maxKey, Session session)
124
   {
125
      // TODO: remove this and related classes; this concept has been shown to be unsafe
126
      /*
127
      // Execute the query which will return all ranges of free ids in the
128
      // given global range. 
129
      SQLQuery query = session.createSQLQuery(retrieveQuery);
130
      query.addScalar("lower_bound", StandardBasicTypes.LONG);
131
      query.addScalar("upper_bound", StandardBasicTypes.LONG);
132
      query.setLong("minId", minKey);
133
      query.setLong("maxId", maxKey);
134
      
135
      List<Range> res = new ArrayList<Range>();
136
      List<Object[]> bounds = (List<Object[]>) query.list();
137
      for (Object[] bound : bounds)
138
      {
139
         res.add(new Range((Long)bound[0], (Long)bound[1]));
140
      }
141
      
142
      return res;
143
      */
144
      
145
      return null;
146
   }
147
}
new/src/com/goldencode/p2j/persist/orm/QueryStatistics.java 2022-05-02 09:56:32 +0000
1 1
package com.goldencode.p2j.persist.orm;
2
/*
3
 * 
4
** Module   : DatabaseStatistics.java
5
** Abstract : Stubbed, temporary class for transition to new ORM implementation.
6
**
7
** Copyright (c) 2015-2022, Golden Code Development Corporation.
8
**
9
** -#- -I- --Date-- ---------------------------------Description---------------------------------
10
**     TJD 20220331 Removed deprecation from class,
11
**                  as Hibernate is no longer in use it needs to be reimplemented
12
*/
2 13

  
3
/**
4
 * Stubbed, temporary class for transition to new ORM implementation.
5
 * 
6
 * @deprecated Only used by deprecated, Hibernate-based, database statistics collector.
7
 */
14
/*
15
** This program is free software: you can redistribute it and/or modify
16
** it under the terms of the GNU Affero General Public License as
17
** published by the Free Software Foundation, either version 3 of the
18
** License, or (at your option) any later version.
19
**
20
** This program is distributed in the hope that it will be useful,
21
** but WITHOUT ANY WARRANTY; without even the implied warranty of
22
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
** GNU Affero General Public License for more details.
24
**
25
** You may find a copy of the GNU Affero GPL version 3 at the following
26
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
27
** 
28
** Additional terms under GNU Affero GPL version 3 section 7:
29
** 
30
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
31
**   terms apply to the works covered under the License.  These additional terms
32
**   are non-permissive additional terms allowed under Section 7 of the GNU
33
**   Affero GPL version 3 and may not be removed by you.
34
** 
35
**   0. Attribution Requirement.
36
** 
37
**     You must preserve all legal notices or author attributions in the covered
38
**     work or Appropriate Legal Notices displayed by works containing the covered
39
**     work.  You may not remove from the covered work any author or developer
40
**     credit already included within the covered work.
41
** 
42
**   1. No License To Use Trademarks.
43
** 
44
**     This license does not grant any license or rights to use the trademarks
45
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
46
**     of Golden Code Development Corporation. You are not authorized to use the
47
**     name Golden Code, FWD, or the names of any author or contributor, for
48
**     publicity purposes without written authorization.
49
** 
50
**   2. No Misrepresentation of Affiliation.
51
** 
52
**     You may not represent yourself as Golden Code Development Corporation or FWD.
53
** 
54
**     You may not represent yourself for publicity purposes as associated with
55
**     Golden Code Development Corporation, FWD, or any author or contributor to
56
**     the covered work, without written authorization.
57
** 
58
**   3. No Misrepresentation of Source or Origin.
59
** 
60
**     You may not represent the covered work as solely your work.  All modified
61
**     versions of the covered work must be marked in a reasonable way to make it
62
**     clear that the modified work is not originating from Golden Code Development
63
**     Corporation or FWD.  All modified versions must contain the notices of
64
**     attribution required in this license.
65
*/
8 66
public class QueryStatistics
9 67
{
10 68
   public long getExecutionMaxTime()
new/src/com/goldencode/p2j/persist/orm/SecondLevelCacheStatistics.java 2022-05-02 09:56:32 +0000
1 1
package com.goldencode.p2j.persist.orm;
2

  
3
/**
4
 * Stubbed, temporary class for transition to new ORM implementation.
2
/*
5 3
 * 
6
 * @deprecated Only used by deprecated, Hibernate-based, database statistics collector.
7
 */
4
** Module   : SecondLevelCacheStatistics.java
5
** Abstract : Stubbed, temporary class for transition to new ORM implementation.
6
**
7
** Copyright (c) 2015-2022, Golden Code Development Corporation.
8
**
9
** -#- -I- --Date-- ---------------------------------Description---------------------------------
10
**     TJD 20220331 Removed deprecation from class,
11
**                  as Hibernate is no longer in use it needs to be reimplemented
12
*/
13

  
14
/*
15
** This program is free software: you can redistribute it and/or modify
16
** it under the terms of the GNU Affero General Public License as
17
** published by the Free Software Foundation, either version 3 of the
18
** License, or (at your option) any later version.
19
**
20
** This program is distributed in the hope that it will be useful,
21
** but WITHOUT ANY WARRANTY; without even the implied warranty of
22
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
** GNU Affero General Public License for more details.
24
**
25
** You may find a copy of the GNU Affero GPL version 3 at the following
26
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
27
** 
28
** Additional terms under GNU Affero GPL version 3 section 7:
29
** 
30
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
31
**   terms apply to the works covered under the License.  These additional terms
32
**   are non-permissive additional terms allowed under Section 7 of the GNU
33
**   Affero GPL version 3 and may not be removed by you.
34
** 
35
**   0. Attribution Requirement.
36
** 
37
**     You must preserve all legal notices or author attributions in the covered
38
**     work or Appropriate Legal Notices displayed by works containing the covered
39
**     work.  You may not remove from the covered work any author or developer
40
**     credit already included within the covered work.
41
** 
42
**   1. No License To Use Trademarks.
43
** 
44
**     This license does not grant any license or rights to use the trademarks
45
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
46
**     of Golden Code Development Corporation. You are not authorized to use the
47
**     name Golden Code, FWD, or the names of any author or contributor, for
48
**     publicity purposes without written authorization.
49
** 
50
**   2. No Misrepresentation of Affiliation.
51
** 
52
**     You may not represent yourself as Golden Code Development Corporation or FWD.
53
** 
54
**     You may not represent yourself for publicity purposes as associated with
55
**     Golden Code Development Corporation, FWD, or any author or contributor to
56
**     the covered work, without written authorization.
57
** 
58
**   3. No Misrepresentation of Source or Origin.
59
** 
60
**     You may not represent the covered work as solely your work.  All modified
61
**     versions of the covered work must be marked in a reasonable way to make it
62
**     clear that the modified work is not originating from Golden Code Development
63
**     Corporation or FWD.  All modified versions must contain the notices of
64
**     attribution required in this license.
65
*/
66

  
8 67
public class SecondLevelCacheStatistics
9 68
{
10 69
   public long getElementCountInMemory()
new/src/com/goldencode/p2j/persist/orm/Statistics.java 2022-05-02 09:56:32 +0000
1 1
package com.goldencode.p2j.persist.orm;
2 2

  
3
/**
4
 * Stubbed, temporary class for transition to new ORM implementation.
3
/*
5 4
 * 
6
 * @deprecated Only used by deprecated, Hibernate-based, database statistics collector.
7
 */
5
** Module   : Statistics.java
6
** Abstract : Stubbed, temporary class for transition to new ORM implementation.
7
**
8
** Copyright (c) 2015-2022, Golden Code Development Corporation.
9
**
10
** -#- -I- --Date-- ---------------------------------Description---------------------------------
11
**     TJD 20220331 Removed deprecation from class,
12
**                  as Hibernate is no longer in use it needs to be reimplemented
13
*/
14

  
15
/*
16
** This program is free software: you can redistribute it and/or modify
17
** it under the terms of the GNU Affero General Public License as
18
** published by the Free Software Foundation, either version 3 of the
19
** License, or (at your option) any later version.
20
**
21
** This program is distributed in the hope that it will be useful,
22
** but WITHOUT ANY WARRANTY; without even the implied warranty of
23
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
** GNU Affero General Public License for more details.
25
**
26
** You may find a copy of the GNU Affero GPL version 3 at the following
27
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
28
** 
29
** Additional terms under GNU Affero GPL version 3 section 7:
30
** 
31
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
32
**   terms apply to the works covered under the License.  These additional terms
33
**   are non-permissive additional terms allowed under Section 7 of the GNU
34
**   Affero GPL version 3 and may not be removed by you.
35
** 
36
**   0. Attribution Requirement.
37
** 
38
**     You must preserve all legal notices or author attributions in the covered
39
**     work or Appropriate Legal Notices displayed by works containing the covered
40
**     work.  You may not remove from the covered work any author or developer
41
**     credit already included within the covered work.
42
** 
43
**   1. No License To Use Trademarks.
44
** 
45
**     This license does not grant any license or rights to use the trademarks
46
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
47
**     of Golden Code Development Corporation. You are not authorized to use the
48
**     name Golden Code, FWD, or the names of any author or contributor, for
49
**     publicity purposes without written authorization.
50
** 
51
**   2. No Misrepresentation of Affiliation.
52
** 
53
**     You may not represent yourself as Golden Code Development Corporation or FWD.
54
** 
55
**     You may not represent yourself for publicity purposes as associated with
56
**     Golden Code Development Corporation, FWD, or any author or contributor to
57
**     the covered work, without written authorization.
58
** 
59
**   3. No Misrepresentation of Source or Origin.
60
** 
61
**     You may not represent the covered work as solely your work.  All modified
62
**     versions of the covered work must be marked in a reasonable way to make it
63
**     clear that the modified work is not originating from Golden Code Development
64
**     Corporation or FWD.  All modified versions must contain the notices of
65
**     attribution required in this license.
66
*/
8 67
public class Statistics
9 68
{
10 69
   public String[] getQueries()
new/src/com/goldencode/p2j/persist/orm/UnclosablePreparedStatement.java 2022-05-02 09:56:32 +0000
8 8
** 001 AIL 20201020 Created initial version.
9 9
**     OM  20220228 Added toString() implementation to allow the statements to be correctly displayed with
10 10
**                  SQLStatementLogger. Javadoc fixes.
11
**     TJD 20220331 Removed deprecation from setUnicodeStream as it   is a proxy class
11 12
*/
12 13

  
13 14
/*
......
308 309
      this.target.setTimestamp(parameterIndex, x); }
309 310
   public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { 
310 311
      this.target.setAsciiStream(parameterIndex, x, length); }
312
   @SuppressWarnings("deprecation")
311 313
   public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
312 314
      this.target.setUnicodeStream(parameterIndex, x, length);}
313 315
   public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { 
new/src/com/goldencode/p2j/security/AcmeClient.java 2022-05-02 09:56:32 +0000
2 2
** Module   : AcmeClient.java
3 3
** Abstract : Implements ACME client to get certificates signed by well-known trusted authority.
4 4
**
5
** Copyright (c) 2017-2021, Golden Code Development Corporation.
5
** Copyright (c) 2017-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ---------------------------------Description----------------------------------
8 8
** 001 SBI 20171030 First version.
9 9
** 002 SBI 20171110 Fixed a NPE in askCertificates.
10 10
** 003 SBI 20171116 Added CertificateSuite usage.
11
**     VVT 20210917 Javadoc fixed. 
11
**     VVT 20210917 Javadoc fixed.
12
**     TJD 20220331 Disabled ACME client as tlsSniChallenge is no longer supported
12 13
*/
13 14
/*
14 15
** This program is free software: you can redistribute it and/or modify
......
167 168
    */
168 169
   public AcmeClient(String acmeServerUri, String host, int port)
169 170
   {
170
      this.acmeServerUri = acmeServerUri;
171
      this.host          = host;
172
      this.port          = port;
171
      throw new RuntimeException("AcmeClient is non-functional, cant be used");
172
//      this.acmeServerUri = acmeServerUri;
173
//      this.host          = host;
174
//      this.port          = port;
... This diff was truncated because it exceeds the maximum size that can be displayed.