Author: keith Date: Tue Jul 29 00:01:32 2008 New Revision: 20073 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20073
Log: Making sure that we DO NOT use the servers configurationContext when acting as a client. Rather we create a new one Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupArchiveManupulator.java branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/webapp/userprofile/ManageUsers.java branches/mashup/java/1.5/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/scraper/ScraperHostObject.java branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupArchiveManupulator.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupArchiveManupulator.java?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupArchiveManupulator.java (original) +++ branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/utils/MashupArchiveManupulator.java Tue Jul 29 00:01:32 2008 @@ -201,16 +201,15 @@ * remote mashup server address (eg: https://mooshup.com) * @param dataHandler - * contains the archived mashup service - * @param configCtx - The configuration Context * @param serviceJsFileName - The file name of the JS service * @param mashupServiceName - The name of the mashup service * @throws AxisFault - Thrown in case an Exception Occurs */ public void uploadMashupService(String destinationServerAddress, DataHandler dataHandler, - ConfigurationContext configCtx, String serviceJsFileName, - String mashupServiceName, String username, String password, - String overwriteExisting, String localUserName, String mode, - String basicAuthUsername, String basicAuthPassword) + String serviceJsFileName, String mashupServiceName, + String username, String password, String overwriteExisting, + String localUserName, String mode, String basicAuthUsername, + String basicAuthPassword) throws IOException{ if (destinationServerAddress.startsWith("http://")) { @@ -219,7 +218,8 @@ throw new MashupFault("Cannot share via http please use Https."); } // We use the RPCClient to call the sharing service - RPCServiceClient serviceClient = new RPCServiceClient(configCtx, null); + RPCServiceClient serviceClient = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); Options options = serviceClient.getOptions(); EndpointReference sharingServiceEPR; // Check whether used has given the HostAdress with or without the @@ -280,10 +280,10 @@ } public void uploadMashupService(String destinationServerAddress, DataHandler dataHandler, - ConfigurationContext configCtx, String serviceJsFileName, - String mashupServiceName, String infoCardToken, - String overwriteExisting, String localUserName, String mode, - String basicAuthUsername, String basicAuthPassword) + String serviceJsFileName,String mashupServiceName, + String infoCardToken,String overwriteExisting, + String localUserName, String mode, String basicAuthUsername, + String basicAuthPassword) throws AxisFault { if (destinationServerAddress.startsWith("http://")) { @@ -292,7 +292,8 @@ throw new MashupFault("Cannot share via http please use Https."); } // We use the RPCClient to call the sharing service - RPCServiceClient serviceClient = new RPCServiceClient(configCtx, null); + RPCServiceClient serviceClient = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); Options options = serviceClient.getOptions(); EndpointReference sharingServiceEPR; // Check whether used has given the HostAdress with or without the @@ -411,16 +412,15 @@ * * @param remoteServer - The address of the remote Mashup Server * @param serviceName - The name of the service to be shared - * @param messageContext - The corresponding MessageContext * @param axisConfiguration - The corresponding AxisConfiguration * @throws AxisFault - Thrown in case an exception occurs */ public void downloadMashupService(String remoteServer, String serviceName, String username, - String password, MessageContext messageContext, - AxisConfiguration axisConfiguration) throws AxisFault { + String password, AxisConfiguration axisConfiguration) + throws AxisFault { // We use the RPCClient to call the download service - RPCServiceClient serviceClient = new RPCServiceClient(messageContext - .getConfigurationContext(), null); + RPCServiceClient serviceClient = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); Options options = serviceClient.getOptions(); EndpointReference remoteSharingServiceEPR; // Check whether used has given the HostAdress with or without the 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=20073&r1=20072&r2=20073&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 Tue Jul 29 00:01:32 2008 @@ -539,11 +539,8 @@ ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); - ConfigurationContext configurationContext = - ConfigurationContextFactory.createConfigurationContextFromFileSystem( - wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + - File.separator + MashupConstants.REPO_DIRECTORY, null); - ServiceClient client = new ServiceClient(configurationContext, null); + ServiceClient client = + new ServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), null); client.engageModule(MashupConstants.RAMPART); client.engageModule(MashupConstants.ADDRESSING); Options options = client.getOptions(); @@ -585,11 +582,8 @@ ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); - ConfigurationContext configurationContext = - ConfigurationContextFactory.createConfigurationContextFromFileSystem( - wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + - File.separator + MashupConstants.REPO_DIRECTORY, null); - RPCServiceClient client = new RPCServiceClient(configurationContext, null); + RPCServiceClient client = + new RPCServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), null); client.engageModule(MashupConstants.RAMPART); client.engageModule(MashupConstants.ADDRESSING); Options options = client.getOptions(); @@ -625,13 +619,8 @@ try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; - 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); + ServiceClient client = new ServiceClient(MashupUtils.createNewConfigurationContext(), + null); Options options = client.getOptions(); options.setAction("urn:logout"); options.setTo(new EndpointReference("http://localhost:" + serverManager.getHttpPort() + @@ -1413,7 +1402,8 @@ public static SecurityScenarioDO[] getSecurityScenarios(String serviceName, String cookieString, String contextPath) throws MashupFault { try { - RPCServiceClient serviceClient = new RPCServiceClient(); + RPCServiceClient serviceClient = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; Options options = serviceClient.getOptions(); @@ -1523,4 +1513,29 @@ return sourceText; } } + + /** + * Cretes a new ConfigurationContext with an empty repository + * @throws AxisFault Thrown in case an exception occurs + */ + public static ConfigurationContext createNewConfigurationContext() throws AxisFault { + String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); + return ConfigurationContextFactory.createConfigurationContextFromFileSystem( + wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + + File.separator + MashupConstants.REPO_DIRECTORY + File.separator + + MashupConstants.REPO_DIRECTORY, null); + } + + /** + * Cretes a new ConfigurationContext with the repository as Mashup_Home/.work/repo. + * This repo will have addressing and rampart as mosules. + * @return A new ConfigurationContext + * @throws AxisFault Thrown in case an exception occurs + */ + public static ConfigurationContext createNewConfigurationContextWithRepo() throws AxisFault { + String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); + return ConfigurationContextFactory.createConfigurationContextFromFileSystem( + wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + + File.separator + MashupConstants.REPO_DIRECTORY, null); + } } Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/webapp/userprofile/ManageUsers.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/webapp/userprofile/ManageUsers.java?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/webapp/userprofile/ManageUsers.java (original) +++ branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/webapp/userprofile/ManageUsers.java Tue Jul 29 00:01:32 2008 @@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.mashup.MashupConstants; import org.wso2.mashup.MashupFault; +import org.wso2.mashup.utils.MashupUtils; import org.wso2.mashup.webapp.utils.RegistryUtils; import org.wso2.registry.RegistryConstants; import org.wso2.registry.exceptions.RegistryException; @@ -228,7 +229,8 @@ try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; - RPCServiceClient client = new RPCServiceClient(); + RPCServiceClient client = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); Options options = client.getOptions(); options.setAction("urn:deleteUserServices"); options.setTo(new EndpointReference("http://localhost:" + serverManager.getHttpPort() + Modified: branches/mashup/java/1.5/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java (original) +++ branches/mashup/java/1.5/java/modules/coreservices/servicesharinghelper/src/org/wso2/mashup/coreservices/servicesharinghelper/ServiceSharingHelper.java Tue Jul 29 00:01:32 2008 @@ -91,8 +91,7 @@ String shortServiceName = serviceName.substring(serviceName.indexOf(MashupConstants.SEPARATOR_CHAR) + 1); - masshupArchiveManupulator.uploadMashupService(destinationServerAddress, dataHandler, - configContext, serviceFile.getName(), + masshupArchiveManupulator.uploadMashupService(destinationServerAddress, dataHandler, serviceFile.getName(), shortServiceName, username, password, overwriteExisting, localUser, mode, basicAuthUsername, basicAuthPassword); Modified: branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/scraper/ScraperHostObject.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/scraper/ScraperHostObject.java?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/scraper/ScraperHostObject.java (original) +++ branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/scraper/ScraperHostObject.java Tue Jul 29 00:01:32 2008 @@ -23,7 +23,6 @@ import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisService; import org.apache.axis2.rpc.client.RPCServiceClient; import org.apache.log4j.Logger; @@ -36,6 +35,7 @@ import org.wso2.javascript.xmlimpl.XML; import org.wso2.mashup.MashupFault; import org.wso2.mashup.MashupConstants; +import org.wso2.mashup.utils.MashupUtils; import org.wso2.wsas.ServerManager; import javax.xml.namespace.QName; @@ -133,13 +133,8 @@ contextPath + configContext.getServicePath() + "/ScraperService/scrape"; try { - 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); - RPCServiceClient serviceClient = new RPCServiceClient(configurationContext, null); + RPCServiceClient serviceClient = + new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); EndpointReference to = new EndpointReference(serviceEndpoint); Options options = new Options(); options.setTimeOutInMilliSeconds(2000000); Modified: branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java (original) +++ branches/mashup/java/1.5/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java Tue Jul 29 00:01:32 2008 @@ -339,10 +339,9 @@ httpContentEncoding = HTTPContentEncodingObject.toString(); } } - ServerManager serverManager = ServerManager.getInstance(); try { wsRequest.sender = - new ServiceClient(serverManager.configContext, null); + new ServiceClient(MashupUtils.createNewConfigurationContext(), null); } catch (AxisFault axisFault) { throw new MashupFault(axisFault); } @@ -538,14 +537,9 @@ } } - String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); - ConfigurationContext configurationContext = - ConfigurationContextFactory.createConfigurationContextFromFileSystem( - wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + - File.separator + MashupConstants.REPO_DIRECTORY, null); wsRequest.sender = - new ServiceClient(configurationContext, definition, serviceQName, - endpointName); + new ServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), + definition, serviceQName, endpointName); if (optionsArray != null) { Object usernameObject = optionsArray.get("username", optionsArray); Modified: branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp?rev=20073&r1=20072&r2=20073&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp (original) +++ branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp Tue Jul 29 00:01:32 2008 @@ -39,7 +39,7 @@ <%@ page import="org.apache.axiom.om.OMNamespace"%> <%@ page import="org.wso2.wsas.persistence.PersistenceManager"%> <%@ page import="org.wso2.mashup.MashupConstants"%> -<%@ page import="org.wso2.mashup.utils.CustomProtocolSocketFactory"%> +<%@ page import="org.wso2.mashup.utils.CustomProtocolSocketFactory"%><%@ page import="org.wso2.mashup.utils.MashupUtils"%> <%@ page contentType="application/javascript" language="java" %> <%! @@ -163,7 +163,7 @@ } //creating service client - ServiceClient sc = new ServiceClient(); + ServiceClient sc = new ServiceClient(MashupUtils.createNewConfigurationContext(), null); sc.setOptions(opts); if (opts.getProperty(AddressingConstants.WS_ADDRESSING_VERSION) != null) sc.engageModule(Constants.MODULE_ADDRESSING); _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
