001 /* 002 * Proxy.java 003 * 004 * Created on June 16, 2006, 6:15 PM 005 * 006 * This file is part of the STAR Scheduler. 007 * Copyright (c) 2002-2006 STAR Collaboration - Brookhaven National Laboratory 008 * 009 * STAR Scheduler is free software; you can redistribute it and/or modify 010 * it under the terms of the GNU General Public License as published by 011 * the Free Software Foundation; either version 2 of the License, or 012 * (at your option) any later version. 013 * 014 * STAR Scheduler is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public License 020 * along with STAR Scheduler; if not, write to the Free Software 021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 022 * 023 */ 024 025 package gov.bnl.star.offline.scheduler.informationService; 026 027 /** 028 * Used to set SUMS proxy configuration. 029 * It should be setup in the SUM config file for each each site. 030 * This setting is global to in running instance of SUMS. 031 * 032 * The last known working valuse here at bnl: 033 * proxyPort = "3128" 034 * proxyHost = "192.168.1.4" 035 * service = "http://osg-cat.grid.iu.edu/services.php" 036 * useProxy = true 037 * 038 * @author Levente B. Hajdu 039 */ 040 public class Proxy { 041 042 /** Creates a new instance of Proxy */ 043 public Proxy() {} 044 045 boolean useProxy = false; 046 /** This is the equivalent of a "use proxy" checkbox on a web browser or other web app. 047 * @param useProxy this should be set to true only if a proxy is need. **/ 048 public void setUseProxy(boolean useProxy){ 049 this.useProxy = useProxy; 050 } 051 /** @return true if a proxy is needed at this site**/ 052 public boolean getUseProxy(){ return useProxy; } 053 054 String proxyHost = null; 055 public void setProxyHost(String proxyHost){ 056 this.proxyHost = proxyHost; ; 057 } 058 public String getProxyHost(){return proxyHost;} 059 060 String proxyPort = null; 061 public void setProxyPort(String proxyPort){ 062 this.proxyPort = proxyPort; 063 } 064 public String getProxyPort(){return proxyPort;} 065 066 boolean proxyInstalled = false; 067 068 /**After the seting have been initialized, this member will make the proxy setting global. 069 * Ater the setting have beem install they can not be changed wqith this member. **/ 070 public void installProxy(){ 071 if(proxyInstalled || (! useProxy) || (proxyHost == null) || (proxyPort == null)) return; 072 System.getProperties().put("proxySet","true"); 073 System.getProperties().put("proxyPort", proxyPort ); 074 System.getProperties().put("proxyHost", proxyHost ); 075 proxyInstalled = true; 076 return; 077 } 078 079 }