blob: 1e4073cb3a18288ff0ce9036f8a5ada0021f6b6c [file] [log] [blame]
/*******************************************************************************
* Copyright (C) 2007-2010 The University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
*/
package net.sf.taverna.t2.workbench.ui.credentialmanager.startup;
import org.apache.log4j.Logger;
import net.sf.taverna.t2.security.credentialmanager.CMException;
import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
import net.sf.taverna.t2.workbench.StartupSPI;
/**
*
* Startup hook to initialise SSL socket factory used by Taverna for creating
* HTTPS connections.
*
* @author Alex Nenadic
* @author Stian Soiland-Reyes
*/
public class InitialiseSSLStartupHook implements StartupSPI {
private static final Logger logger = Logger
.getLogger(InitialiseSSLStartupHook.class);
private CredentialManager credManager;
@Override
public int positionHint() {
return 25;
}
@Override
public boolean startup() {
logger.info("Initialising SSL socket factory for SSL connections from Taverna.");
try {
credManager.initializeSSL();
} catch (CMException e) {
logger.error(
"Could not initialise the SSL socket factory (for creating SSL connections)"
+ " using Taverna's keystores.", e);
}
return true;
}
public void setCredentialManager(CredentialManager credManager) {
this.credManager = credManager;
}
}