| 
     
      
      
      From: <das...@us...> - 2008-10-29 19:56:47
      
     
   | 
Revision: 1180
          http://vlab.svn.sourceforge.net/vlab/?rev=1180&view=rev
Author:   dasil014
Date:     2008-10-29 19:56:44 +0000 (Wed, 29 Oct 2008)
Log Message:
-----------
This class has many method migrated from the ProjectExecutor.java. It contents the rules and sequence of execution for every project.
Added Paths:
-----------
    trunk/vlab/services/project-executor/src/main/java/org/vlab/services/ExecuteProject.java
Added: trunk/vlab/services/project-executor/src/main/java/org/vlab/services/ExecuteProject.java
===================================================================
--- trunk/vlab/services/project-executor/src/main/java/org/vlab/services/ExecuteProject.java	                        (rev 0)
+++ trunk/vlab/services/project-executor/src/main/java/org/vlab/services/ExecuteProject.java	2008-10-29 19:56:44 UTC (rev 1180)
@@ -0,0 +1,312 @@
+package org.vlab.services;
+
+import java.util.*;
+
+public class ExecuteProject {
+	
+	private PhaseProject 	SingleCalculation;
+	private PhaseProject	FastRefineCalculation;
+	private PhaseProject	LongRefineCalculation;
+	private	PhaseProject	CijCalculation;
+	private	PhaseProject	HiPTthermo;
+	
+	public static List ListTaskReceipt;
+	
+	public void prepare_project(){
+		
+		SingleCalculation 		= new PhaseProject();
+		FastRefineCalculation 	= new PhaseProject();
+		LongRefineCalculation	= new PhaseProject();
+		CijCalculation			= new PhaseProject();
+		HiPTthermo				= new PhaseProject();
+		
+	}
+	
+	public void executeSingleCalc(String ProjectType, Boolean phaseOption){
+		
+		try{
+			ListTaskReceipt = new Vector();	
+			
+			/* This is Single Calculation */
+			System.out.println("\nHere I start the Single Calculation");					
+			System.out.println("\nReturn from UncompressExecutionPackage: "+ OutRunnings.UnCompressExecutionPackage(ProjectType, phaseOption));
+		
+			SingleCalculation.phasename = "Single Calculation";
+				
+			/* Start the Project Receipt*/
+			Receipt projectReceipt = ReceiptManagement.setProjectReceipt();
+				
+			/* Start the Phase Receipt */
+			Receipt phaseReceipt = ReceiptManagement.setPhaseReceipt(ProjectType, phaseOption);
+		        
+		    SingleCalculation.setvariable 		= true;
+		    SingleCalculation.packagegeneration = true;
+	
+		    SingleCalculation.Status = "Packages created";
+		        
+		    /*This method do a send of package to Task Executor, selected by Task Dispacther*/
+		    projectReceipt = DispatcherSetting.setDispSetting(projectReceipt, phaseReceipt, ProjectType, phaseOption);
+		    phaseReceipt = ReceiptManagement.setClosePhaseReceiptSingle(phaseReceipt);
+			
+			projectReceipt = ReceiptManagement.setCloseProjectReceipt(phaseReceipt);
+			
+			SingleCalculation.distributor = true;
+	
+			SingleCalculation.Status = "Packages Submitted";
+				
+			/*It call the method below to fill up all the path package into the phase receipt*/
+			phaseReceipt = ReceiptManagement.AddPckPathSingleCalc(phaseReceipt, ProjectType, phaseOption);
+				
+			phaseReceipt = ReceiptManagement.AddStatusPhase("Running", phaseReceipt, ProjectType, phaseOption);
+				
+			SingleCalculation.taskexecution = true;
+				
+			SingleCalculation.Status = "Running";
+				
+			//setClosePhaseReceipt();
+			projectReceipt = ProjectExecutor.Poll(projectReceipt, phaseReceipt, "Single", ProjectType, phaseOption);
+				
+			phaseReceipt = ReceiptManagement.AddStatusPhase("Completed", phaseReceipt, ProjectType, phaseOption);
+				
+			PostProcessing.getOutPutTask(phaseReceipt,ProjectType, phaseOption);			
+			SingleCalculation.datarecollection 	= true;
+			SingleCalculation.completed 		= true;
+				
+			System.out.println("\nHere I finish the Single Calculation\n");
+		} catch(Exception ae){
+			System.err.println("[executeSingleCalc] => " + ae.getMessage());
+			ae.printStackTrace();
+		}
+	
+	}
+
+	public Receipt executeFastRefine(String ProjectType, Boolean phaseOption){
+			/* This is Fast Refine */	
+			
+		Receipt projectReceipt 	= null;
+		Receipt phaseReceipt	= null;
+		
+		try{
+			projectReceipt 			= ReceiptManagement.setProjectReceipt();
+			phaseReceipt   			= ReceiptManagement.setPhaseReceipt(ProjectType, phaseOption);
+			
+			ListTaskReceipt = new Vector();
+			
+			if (ProjectType.equals("2") && phaseOption.booleanValue()==true){ 
+				
+				/* This is Fast Refine */
+				FastRefineCalculation.phasename = "Fast Refine";
+				
+				System.out.println("Here I uncompress the " + ProjectExecutor.zipFileName + " with " + OutRunnings.UnCompressComplexCalc());
+				System.out.println("Start the Spliiter right here for Fast Refine");
+	
+				//SendPackageESG();
+				//Instead of running in a service, I will do it locally
+				
+				FastRefineCalculation.setvariable = true;
+				
+				OutRunnings.RunPackageESG(phaseOption);
+				
+				FastRefineCalculation.packagegeneration = true;
+			
+				System.out.println("\nHere I finish the splitter");
+				System.out.println("\nHere I start uncompress the TarBallFromWS.zip");
+				//System.out.println("\nReturn from uncompressTarBallfromWS: "+ UnCompressTarBallFromWS());  	   	
+				System.out.println("\nReturn from UncompressExecutionPackage: " + OutRunnings.UnCompressExecutionPackage(ProjectType, phaseOption));
+							
+				 /* Start the Phase Receipt */
+		        //setPhaseReceipt();
+				
+				projectReceipt = DispatcherSetting.setDispSetting(projectReceipt, phaseReceipt, ProjectType, phaseOption);
+				
+				FastRefineCalculation.distributor = true;
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptFastRefine("Finish Submission", projectReceipt, phaseReceipt);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				/*It call the method below to fill up all the path package into the phase receipt of Fast Refine*/
+				phaseReceipt = ReceiptManagement.AddPckPathFastRefine(phaseReceipt, ProjectType, phaseOption);
+	
+				FastRefineCalculation.taskexecution = true;
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Running", phaseReceipt, ProjectType, phaseOption);
+				
+				projectReceipt = ProjectExecutor.Poll(projectReceipt, phaseReceipt, "Fast Refine", ProjectType, phaseOption);
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Completed", phaseReceipt, ProjectType, phaseOption);					
+				
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptFastRefine("Finish Execution", projectReceipt, phaseReceipt);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				PostProcessing.getOutPutTask(phaseReceipt,ProjectType, phaseOption);			
+				
+				FastRefineCalculation.datarecollection = true;
+				
+				OutRunnings.setFastRefineFitting();
+			
+				ProjectExecutor.ReadFastRefineFitting();	
+			}
+		}catch (Exception ae){
+				System.err.println("[executeFastRefine] => " + ae.getMessage() );
+				ae.printStackTrace();
+			}
+		
+		return projectReceipt; 
+	}
+	
+	public Receipt executeLongRefine(Receipt projectReceipt, String projectType, Boolean phaseOption){
+		
+		try{
+			
+			Receipt phaseReceipt   = ReceiptManagement.setPhaseReceipt(projectType, phaseOption);
+			
+			ListTaskReceipt = new Vector();
+			
+			/*This Long Refine*/
+			if (projectType.equals("2") && phaseOption.booleanValue()==false){	
+				
+				OutRunnings.CreatePackage();
+				
+				System.out.println("Here I uncompress the "+ ProjectExecutor.zipFileName + " with " + OutRunnings.UnCompressComplexCalc());
+				
+				System.out.println("Start the Spliter right here Long Refine");
+				
+				OutRunnings.setTheNewPackage();
+				//SendPackageESG();
+				//Instead of running in a service, I will do it locally
+				OutRunnings.RunPackageESG(phaseOption);
+			
+				System.out.println("\nHere I finish the splitter");
+				//System.out.println("\nHere I start uncompress the TarBallFromWS.zip");
+				//System.out.println("\nReturn from uncompressTarBallfromWS: "+ UnCompressTarBallFromWS());  	   	
+				System.out.println("\nReturn from UncompressExecutionPackage: " + OutRunnings.UnCompressExecutionPackage(projectType, phaseOption));						
+				
+				 /* Start the Phase Receipt */
+		        //setPhaseReceipt();
+				projectReceipt = DispatcherSetting.setDispSetting(projectReceipt, phaseReceipt, projectType, phaseOption);	
+				
+				/*It call the method below to fill up all the path package into the phase receipt of Long Refine*/
+				phaseReceipt = ReceiptManagement.AddPckPathLongRefine(phaseReceipt, projectType, phaseOption);
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptLongRefine("Finish Execution", projectReceipt, phaseReceipt, phaseOption);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				
+				
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Running", phaseReceipt, projectType, phaseOption);
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptLongRefine("Finish Execution", projectReceipt, phaseReceipt, phaseOption);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				
+				projectReceipt = ProjectExecutor.Poll(projectReceipt, phaseReceipt, "Long Refine", projectType, phaseOption);				
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Completed", phaseReceipt, projectType, phaseOption);
+				
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptLongRefine("Finish Execution", projectReceipt, phaseReceipt, phaseOption);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				PostProcessing.getOutPutTask(phaseReceipt, projectType, phaseOption);
+				
+				OutRunnings.setLongRefineFitting();
+				
+				//projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				ProjectExecutor.ReadLongRefineFitting();				
+				
+				System.out.println("\nHere I finish the sequence of Long Refine\n");
+	
+			
+			}
+		} catch(Exception ae){
+			System.err.println("[executeLongRefine] => " + ae.getMessage());
+			ae.printStackTrace();
+		}
+		
+		return projectReceipt;
+	}
+
+		public void executeCij(Receipt projectReceipt, String projectType, Boolean phaseOption){
+			
+			/* This Cij */
+			//Confirm the execution of Fast Refne and Long Refine soh later on goes to CIj
+			
+			try{
+				Receipt phaseReceipt   = ReceiptManagement.setPhaseReceipt(projectType, phaseOption);
+				
+				ListTaskReceipt = new Vector();
+				
+				OutRunnings.RunIntermediate34();				
+			   	
+				projectReceipt = DispatcherSetting.setDispSettingCij(projectReceipt, phaseReceipt, projectType, phaseOption);
+				
+				/*It call the method below to fill up all the path package into the phase receipt of Cij*/
+				phaseReceipt = ReceiptManagement.AddPckPathCijPhase(phaseReceipt, projectType, phaseOption);				
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Running", phaseReceipt, projectType, phaseOption);
+	
+				System.out.println("Terminei de criar o arquivo aqui and my ListPhase size is: "+ projectReceipt.getAttachamments().size() +" and ListTaskSize is: " + phaseReceipt.getAttachamments().size());
+								
+				projectReceipt = ProjectExecutor.Poll(projectReceipt, phaseReceipt, "Cij", projectType, phaseOption);
+	
+				System.out.println("Terminei de criar o arquivo aqui and my ListPhase size is: " + projectReceipt.getAttachamments().size() + " and ListTaskSize is: " + phaseReceipt.getAttachamments().size());
+								
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Completed", phaseReceipt, projectType, phaseOption);
+								
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptCij("Finish Execution", projectReceipt, phaseReceipt, phaseOption);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				PostProcessing.getOutPutTaskCij(phaseReceipt, projectType, phaseOption);		
+				
+				// These methods will be called from Project Manager
+				//CijGentab();				
+				//ReadCijGentab();			
+				//insertCijtoDB();				
+				System.out.println("\nHere I finish the sequence of Cij\n");
+			} catch(Exception ae){
+				System.err.println("[executeCij] => " + ae.getMessage() );
+				ae.printStackTrace();
+			}
+		}
+		
+		public void executeHiPTThermo(Receipt projectReceipt, String projectType, Boolean phaseOption){
+			
+			
+			try{
+				
+				projectType = "4";
+				
+				Receipt phaseReceipt    = ReceiptManagement.setPhaseReceipt(projectType, phaseOption);
+				
+				ListTaskReceipt = new Vector();
+				
+				OutRunnings.createQPointFile();
+				
+				OutRunnings.ScriptCreatePhononPackages();
+				
+				projectReceipt = DispatcherSetting.setDispSettingHighTPThermo(projectReceipt, phaseReceipt, projectType, phaseOption);
+				
+				/*It call the method below to fill up all the path package into the phase receipt of Cij*/
+				phaseReceipt = ReceiptManagement.AddPckPathHighTPThermoPhase(phaseReceipt, projectType, phaseOption);				
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Running", phaseReceipt, projectType, phaseOption);
+	
+				System.out.println("Terminei de criar o arquivo aqui and my ListPhase size is: " + projectReceipt.getAttachamments().size() +" and ListTaskSize is: " + phaseReceipt.getAttachamments().size() );
+				
+				ProjectExecutor.Poll(projectReceipt, phaseReceipt, "HighTP Thermo", projectType, phaseOption);
+	
+				System.out.println("Terminei de criar o arquivo aqui and my ListPhase size is: " + projectReceipt.getAttachamments().size() + " and ListTaskSize is: " + phaseReceipt.getAttachamments().size() );
+				
+				phaseReceipt = ReceiptManagement.AddStatusPhase("Completed", phaseReceipt, projectType, phaseOption);
+				
+				projectReceipt = ReceiptManagement.setClosePhaseReceiptHighTPTHermo("Finish Execution", projectReceipt, phaseReceipt, phaseOption);	
+				projectReceipt = ReceiptManagement.setCloseProjectReceipt(projectReceipt);
+				
+				PostProcessing.getOutPutTaskHighTempThermo(phaseReceipt, projectType, phaseOption);		
+						
+				System.out.println("\nHere I finish the sequence of High PT Thermo\n");
+			} catch (Exception ae){
+				System.err.println("[executeHiPTThermo] => " + ae.getMessage());
+				ae.printStackTrace();
+			}
+		}
+	
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |