home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / Applications / Layouts / JDPEntityTemplate.java < prev    next >
Encoding:
Java Source  |  1999-04-09  |  1.6 KB  |  72 lines

  1. import java.io.*;
  2. import java.net.*;
  3. import java.util.*;
  4.  
  5.  
  6. /**
  7.  * Class to represent a job running on the server that stays running to
  8.  * handle requests from clients or other running jobs.
  9.  */
  10. public class JDPEntityTemplate {
  11.  
  12.     /*
  13.      * Jagg instance for database access.
  14.      */
  15.     JDPJagg jaggSQL;
  16.     /*
  17.      * Handle to the subsystem manager of the server.
  18.      */
  19.     JDPSubsystemMgr manager;
  20.     /*
  21.      * Handle to the job that this class is running in.
  22.      */
  23.     JDPJob thisJob;
  24.     /*
  25.      * Handle to the utilities class.
  26.      */
  27.     JDPUtils utils;
  28.  
  29.     /**
  30.      * Creates a new module that runs on the server and can be accessed 
  31.      * by other modules or by remote clients.
  32.      * @param manager the handle to the subsystem manager.
  33.      * @param thisJob the handle to the job in which this class runs.
  34.      */
  35.     public JDPEntityTemplate (JDPSubsystemMgr manager, JDPJob thisJob) {
  36.  
  37.         this.manager = manager;
  38.         this.thisJob = thisJob;
  39.         thisJob.setInstance(this);
  40.         jaggSQL = new JDPJagg(manager.JDPJaggPath);
  41.         utils = new JDPUtils(null);
  42.         utils.jaggSQL = jaggSQL;
  43.  
  44.         thisJob.appendJobLog("Job started on " + (new Date()).toString());
  45.         
  46.         //
  47.         //  Stay running while the server remains running or until
  48.         //  manually terminated.
  49.         //  
  50.         while (!manager.shutdownRequested) {
  51.             try {
  52.                 //
  53.                 // Insert repetitive processing here if required
  54.                 //
  55.                 
  56.                 //
  57.                 //  Wait 10 seconds until the next repetitive processing
  58.                 //  needs to be done
  59.                 //
  60.                 Thread.sleep(10000);
  61.             } catch (Exception e) {
  62.                 thisJob.logException(e);
  63.                 thisJob.setJobStatus(JDPJob.INCOMPLETE);
  64.             }
  65.         }
  66.         
  67.         thisJob.appendJobLog("Job completed on " + (new Date()).toString());
  68.  
  69.     }
  70.  
  71. }
  72.