import edu.isi.www.fedd_types.*; import edu.isi.www.fedd_wsdl.*; import java.net.*; import java.util.*; import net.deterlab.isi.XTrustProvider; import net.deterlab.isi.Fedid; import javax.net.ssl.*; public class FeddCommand { static { setUpSecurity(); } static class ExperimentLabels { protected String fedid; protected String localname; public ExperimentLabels(IDType[] experimentID) { fedid = null; localname = null; for (IDType id: experimentID) { if (id.getLocalname() != null) localname = id.getLocalname(); if (id.getFedid() != null) { byte[] rawFedid = id.getFedid(); if (rawFedid != null) { Fedid f = new Fedid(rawFedid); if ( f != null) fedid = f.toString().substring(6); } } } } String getFedid() { return fedid; } String getLocalname() { return localname; } } public static void setUpSecurity() { /* This magic turns off certificate chain checking. */ XTrustProvider.install(); /* This tells the SSL system where to find client certificate * information. */ String keyStore = "./keystore"; String keyStorePassword = "importkey"; System.setProperty("javax.net.ssl.keyStore", keyStore); System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword); } static public void clearSSLSessionCache() { try { SSLContext sctxt = SSLContext.getDefault(); SSLSessionContext ssctxt = sctxt.getClientSessionContext(); Enumeration e = ssctxt.getIds(); while (e.hasMoreElements()) { SSLSession s = ssctxt.getSession(e.nextElement()); s.invalidate(); System.err.println("invalidated " + s); } } catch (Exception e) { System.err.println(e); } } public static FeddPortType getPort(String server) throws javax.xml.rpc.ServiceException, java.net.MalformedURLException { /* * Boilerplate web services access stuff. */ clearSSLSessionCache(); FeddServiceLocator service = new FeddServiceLocator(); FeddPortType port = service.getfeddPort(new URL(server)); return port; } }