[55de6a9] | 1 | import edu.isi.www.fedd_types.*; |
---|
| 2 | import edu.isi.www.fedd_wsdl.*; |
---|
| 3 | import java.net.URL; |
---|
| 4 | import net.deterlab.isi.XTrustProvider; |
---|
| 5 | import net.deterlab.isi.Fedid; |
---|
| 6 | |
---|
| 7 | class FeddCommand { |
---|
| 8 | |
---|
| 9 | static class ExperimentLabels { |
---|
| 10 | protected String fedid; |
---|
| 11 | protected String localname; |
---|
| 12 | |
---|
| 13 | public ExperimentLabels(IDType[] experimentID) { |
---|
| 14 | fedid = null; |
---|
| 15 | localname = null; |
---|
| 16 | |
---|
| 17 | for (IDType id: experimentID) { |
---|
| 18 | if (id.getLocalname() != null) localname = id.getLocalname(); |
---|
| 19 | if (id.getFedid() != null) { |
---|
| 20 | byte[] rawFedid = id.getFedid(); |
---|
| 21 | |
---|
| 22 | if (rawFedid != null) { |
---|
| 23 | Fedid f = new Fedid(rawFedid); |
---|
| 24 | |
---|
| 25 | if ( f != null) fedid = f.toString().substring(6); |
---|
| 26 | } |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | String getFedid() { return fedid; } |
---|
| 31 | String getLocalname() { return localname; } |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | public static void setUpSecurity() { |
---|
| 35 | /* This magic turns off certificate chain checking. */ |
---|
| 36 | XTrustProvider.install(); |
---|
| 37 | |
---|
| 38 | /* This tells the SSL system where to find client certificate |
---|
| 39 | * information. */ |
---|
| 40 | String keyStore = "./keystore"; |
---|
| 41 | String keyStorePassword = "importkey"; |
---|
| 42 | |
---|
| 43 | System.setProperty("javax.net.ssl.keyStore", keyStore); |
---|
| 44 | System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public static FeddPortType getPort(String server) throws |
---|
| 48 | javax.xml.rpc.ServiceException, java.net.MalformedURLException { |
---|
| 49 | /* |
---|
| 50 | * Boilerplate web services access stuff. |
---|
| 51 | */ |
---|
| 52 | FeddServiceLocator service = new FeddServiceLocator(); |
---|
| 53 | FeddPortType port = service.getfeddPort(new URL(server)); |
---|
| 54 | |
---|
| 55 | return port; |
---|
| 56 | } |
---|
| 57 | } |
---|