Author: keith Date: Mon Jul 28 23:24:29 2008 New Revision: 20068 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20068
Log: cleanup configurationContext usage in login and lkogout function Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java?rev=20068&r1=20067&r2=20068&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java (original) +++ branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java Mon Jul 28 23:24:29 2008 @@ -108,7 +108,6 @@ import java.io.InputStreamReader; import java.io.ByteArrayInputStream; import java.io.BufferedInputStream; -import java.io.OutputStream; import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; @@ -536,8 +535,6 @@ public static void login(String username, String password, String cookieString, String contextPath) throws MashupFault { - Parameter parameter = null; - AxisConfiguration configuration = null; try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; @@ -571,14 +568,6 @@ throw new MashupFault(e); } catch (Exception e) { throw new MashupFault(e); - } finally { - if (parameter != null) { - try { - configuration.addParameter(parameter); - } catch (AxisFault axisFault) { - throw new MashupFault(axisFault); - } - } } } @@ -592,8 +581,6 @@ */ public static String login(String identifier, String cookieString, String contextPath) throws MashupFault { - Parameter parameter = null; - AxisConfiguration configuration = null; try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; @@ -631,34 +618,20 @@ throw new MashupFault(e); } catch (Exception e) { throw new MashupFault(e); - } finally { - if (parameter != null) { - try { - configuration.addParameter(parameter); - } catch (AxisFault axisFault) { - throw new MashupFault(axisFault); - } - } } } public static void logout(String cookieString) throws MashupFault { - Parameter parameter = null; - AxisConfiguration configuration = null; try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; - ConfigurationContext defaultConfigurationContext = - ConfigurationContextFactory.createDefaultConfigurationContext(); - configuration = context.getAxisConfiguration(); - parameter = configuration.getParameter("Proxy"); - // The axis2.xml could have details of a proxy, and in that case that can cause problems for login hence - // we temparorily take it off before login and reinsert it later on - if (parameter != null) { - configuration.removeParameter(parameter); - } - defaultConfigurationContext.setAxisConfiguration(configuration); - ServiceClient client = new ServiceClient(defaultConfigurationContext, null); + String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); + ConfigurationContext configurationContext = + ConfigurationContextFactory.createConfigurationContextFromFileSystem( + wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + + File.separator + MashupConstants.REPO_DIRECTORY + File.separator + + MashupConstants.REPO_DIRECTORY, null); + ServiceClient client = new ServiceClient(configurationContext, null); Options options = client.getOptions(); options.setAction("urn:logout"); options.setTo(new EndpointReference("http://localhost:" + serverManager.getHttpPort() + @@ -670,18 +643,8 @@ client.sendRobust(null); } catch (AxisFault axisFault) { throw new MashupFault(axisFault); - } catch (XMLStreamException e) { - throw new MashupFault(e); } catch (Exception e) { throw new MashupFault(e); - } finally { - if (parameter != null) { - try { - configuration.addParameter(parameter); - } catch (AxisFault axisFault) { - throw new MashupFault(axisFault); - } - } } } @@ -1209,9 +1172,8 @@ } public static KeyStore getUserKeyStore(String userName) throws MashupFault { - FileInputStream ksIn = null; - BufferedInputStream ksbufin = null; - OutputStream os = null; + FileInputStream ksIn; + BufferedInputStream ksbufin; String keyStoreName = userName + MashupConstants.KEY_STORE_SUFFIX; try { PersistenceManager pm = new PersistenceManager(); _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
