tn5250j/src/org/tn5250j/tools/system OperatingSystem.java,1.10,1.11

Christian Geisert <[email protected]> Fri, 09 Dec 2005 14:39:10 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14634/src/org/tn5250j/tools/system

Modified Files:
	OperatingSystem.java 
Log Message:
Support for launching customized external program function via hotspot
Submitted by: Richard Houston <rhouston -(at)- rlhc.net> 


Index: OperatingSystem.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system/OperatingSystem.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** OperatingSystem.java	15 Jun 2005 05:04:46 -0000	1.10
--- OperatingSystem.java	9 Dec 2005 14:39:08 -0000	1.11
***************
*** 22,33 ****
  import java.awt.Rectangle;
  import java.awt.Toolkit;
- import javax.swing.UIManager;
  import java.io.File;
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.util.Properties;
  
! import org.tn5250j.tools.logging.*;
! import org.tn5250j.interfaces.*;
  
  /**
--- 22,37 ----
  import java.awt.Rectangle;
  import java.awt.Toolkit;
  import java.io.File;
  import java.io.IOException;
  import java.net.MalformedURLException;
+ import java.util.Enumeration;
  import java.util.Properties;
  
! import javax.swing.UIManager;
! 
! import org.tn5250j.ExternalProgramConfig;
! import org.tn5250j.interfaces.ConfigureFactory;
! import org.tn5250j.tools.logging.TN5250jLogFactory;
! import org.tn5250j.tools.logging.TN5250jLogger;
  
  /**
***************
*** 179,187 ****
      */
     public static void displayURL(String url) {
! 
        // first let's check if we have an external protocol program defined
        String command = null;
        String protocol = "";
        java.net.URL urlUrl = null;
        try {
           urlUrl = new java.net.URL(url);
--- 183,194 ----
      */
     public static void displayURL(String url) {
!       // Check Customized External Program first
! 	  if(launchExternalProgram(url)) return;
! 	  
        // first let's check if we have an external protocol program defined
        String command = null;
        String protocol = "";
        java.net.URL urlUrl = null;
+ 	  
        try {
           urlUrl = new java.net.URL(url);
***************
*** 263,267 ****
        }
     }
! 
     public static int execute(String command) {
  
--- 270,308 ----
        }
     }
!    
! 	 /** 
! 	 * @param url
! 	 * @return true when found external program and has been launched; false when not found external program.
! 	 */
!    	private static boolean launchExternalProgram(String url){
!       // first let's check if we have an external protocol program defined
! 	  try {
! 		  	Properties properties = ExternalProgramConfig.getInstance().getEtnPgmProps();
! 			String count = properties.getProperty("etn.pgm.support.total.num");
! 			if(count != null && count.length() > 0){
! 				int total = Integer.parseInt(count);
! 				for(int i=1;i<=total;i++){
! 					String program = properties.getProperty("etn.pgm."+i+".command.name");	  					
! 					if(url.toLowerCase().startsWith(program.toLowerCase())){
! 					  String params = url.substring(program.length() + 1);
! 					  params = params.replace(',',' ');
! 					  String command;
! 					  if (isWindows()) {
! 						  command=properties.getProperty("etn.pgm."+i+".command.window")+" "+params;
! 					  }else{
! 						  command=properties.getProperty("etn.pgm."+i+".command.unix")+" "+params;
! 					  }
! 					  log.info("Execute External Program: "+command);
! 					  execute(command);
! 					  return true;
! 				    }
! 				}
! 			}
! 	  }catch(Exception exx){
! 			  log.warn("Unable to run External Program: "+ exx.getMessage());
! 	  }
! 	  return false;
!    }
!    
     public static int execute(String command) {
  
***************
*** 360,362 ****
--- 401,405 ----
  
     //}}}
+    
+    
  }



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click