Author: keith Date: Thu Jul 31 11:45:58 2008 New Revision: 20281 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20281
Log: Fixing Mashup-1042 Modified: branches/mashup/java/1.5/java/modules/core/conf/axis2.xml branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/MashupConstants.java 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/JSStubGeneratorService/src/org/wso2/mashup/JSStubGenerator.java branches/mashup/java/1.5/java/modules/coreservices/scraperservice/src/org/wso2/mashup/coreservices/scraperservice/ScraperService.java branches/mashup/java/1.5/java/modules/distribution/create-distro-build.xml 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/conf/axis2.xml URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/conf/axis2.xml?rev=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/conf/axis2.xml (original) +++ branches/mashup/java/1.5/java/modules/core/conf/axis2.xml Thu Jul 31 11:45:58 2008 @@ -35,28 +35,6 @@ org.wso2.wsas.util.TraceFilterImpl </parameter> - <!-- Please uncomment the following the following if you are running the WSO2 Mashup Server in a coperate proxy--> - <!-- - <parameter name="Proxy"> - <Configuration> - <ProxyHost>proxy.wso2.org</ProxyHost> - <ProxyPort>5678</ProxyPort> - <ProxyUser>EXAMPLE\keith</ProxyUser> - <ProxyPassword>keithsPassword</ProxyPassword> - </Configuration> - </parameter> - --> - - <!-- The http.nonProxyHosts can be set to specify the hosts which should be connected to directly (not through the proxy server). - The value of the http.nonProxyHosts property can be a list of hosts, each separated by a |; it can also take a regular expression for matches; - for example: *.sfbay.sun.com would match any fully qualified hostname in the sfbay domain. - - For more information refer to : http://java.sun.com/features/2002/11/hilevel_network.html - Note : Please add localhost to the list cause localhost calls need not go through the proxy--> - <!-- - <parameter name="http.nonProxyHosts">localhost</parameter> - --> - <!-- This parameter decides where the traced messages from the Tracer is persisted. Modified: branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/MashupConstants.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/MashupConstants.java?rev=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/MashupConstants.java (original) +++ branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/MashupConstants.java Thu Jul 31 11:45:58 2008 @@ -309,4 +309,8 @@ public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts"; public static final String PROXY = "Proxy"; + + public static final String AXIS2_CLIENT_XML = "axis2-client.xml"; + + public static final String CONFIGURATION_DIR = "conf"; } 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=20281&r1=20280&r2=20281&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 Thu Jul 31 11:45:58 2008 @@ -219,7 +219,7 @@ } // We use the RPCClient to call the sharing service RPCServiceClient serviceClient = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), null); Options options = serviceClient.getOptions(); EndpointReference sharingServiceEPR; // Check whether used has given the HostAdress with or without the @@ -293,7 +293,7 @@ } // We use the RPCClient to call the sharing service RPCServiceClient serviceClient = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), null); Options options = serviceClient.getOptions(); EndpointReference sharingServiceEPR; // Check whether used has given the HostAdress with or without the @@ -420,7 +420,7 @@ throws AxisFault { // We use the RPCClient to call the download service RPCServiceClient serviceClient = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), 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=20281&r1=20280&r2=20281&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 Thu Jul 31 11:45:58 2008 @@ -35,7 +35,6 @@ import org.apache.axis2.description.AxisService; import org.apache.axis2.description.Parameter; import org.apache.axis2.description.TransportInDescription; -import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.rpc.client.RPCServiceClient; import org.apache.axis2.transport.http.HTTPConstants; @@ -142,8 +141,7 @@ public class MashupUtils { private static final Log log = LogFactory.getLog(MashupUtils.class); - private static ConfigurationContext configurationContextWithRepo = null; - private static ConfigurationContext configurationContextWithoutRepo = null; + private static ConfigurationContext configurationContext = null; /** * Given a object obtained from javascript this method can be used to figure out whether the value if true or false. @@ -552,7 +550,7 @@ ConfigurationContext context = serverManager.configContext; String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); ServiceClient client = - new ServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), null); + new ServiceClient(MashupUtils.getClientConfigurationContext(), null); client.engageModule(MashupConstants.RAMPART); client.engageModule(MashupConstants.ADDRESSING); Options options = client.getOptions(); @@ -566,8 +564,8 @@ options.setManageSession(true); client.setOptions(options); Policy stsPolicy = loadPolicy(wso2wsasHome + File.separator + - "conf" + File.separator + MashupConstants.RAMPART + File.separator + - "scenario7-policy.xml"); + MashupConstants.CONFIGURATION_DIR + File.separator + MashupConstants.RAMPART + + File.separator + "scenario7-policy.xml"); client.getServiceContext() .setProperty(RampartMessageData.KEY_RAMPART_POLICY, stsPolicy); client.sendReceive(null); @@ -595,7 +593,7 @@ ConfigurationContext context = serverManager.configContext; String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); RPCServiceClient client = - new RPCServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), null); client.engageModule(MashupConstants.RAMPART); client.engageModule(MashupConstants.ADDRESSING); Options options = client.getOptions(); @@ -606,7 +604,8 @@ options.setManageSession(true); client.setOptions(options); Policy stsPolicy = loadPolicy(wso2wsasHome + File.separator + - "conf" + File.separator + "rampart" + File.separator + "scenario5-policy.xml"); + MashupConstants.CONFIGURATION_DIR + File.separator + MashupConstants.RAMPART + + File.separator + "scenario5-policy.xml"); client.getServiceContext() .setProperty(RampartMessageData.KEY_RAMPART_POLICY, stsPolicy); QName opAddEntry = new QName("http://service.admin.mashup.wso2.org/xsd", "login"); @@ -631,7 +630,7 @@ try { ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; - ServiceClient client = new ServiceClient(MashupUtils.createNewConfigurationContext(), + ServiceClient client = new ServiceClient(MashupUtils.getClientConfigurationContext(), null); Options options = client.getOptions(); options.setAction("urn:logout"); @@ -1381,8 +1380,9 @@ config.setHost(targetURL.getHost(), port, targetProtocol); } - ServerManager serverManager = ServerManager.getInstance(); - ConfigurationContext configurationContext = serverManager.configContext; + MashupUtils.getClientConfigurationContext(); + ConfigurationContext configurationContext = + MashupUtils.getClientConfigurationContext(); if (configurationContext != null) { Parameter parameter = configurationContext.getAxisConfiguration().getParameter(MashupConstants.PROXY); // The axis2.xml could have details of a proxy, If its present we should set those details @@ -1453,7 +1453,7 @@ String contextPath) throws MashupFault { try { RPCServiceClient serviceClient = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), null); ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; Options options = serviceClient.getOptions(); @@ -1565,83 +1565,23 @@ } /** - * Cretes a new ConfigurationContext with an empty repository - * - * @return A new ConfigurationContext - * @throws AxisFault Thrown in case an exception occurs - */ - public static ConfigurationContext createNewConfigurationContext() throws AxisFault { - String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); - if (configurationContextWithoutRepo == null) { - configurationContextWithoutRepo = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(wso2wsasHome + File.separator + - MashupConstants.WORK_DIRECTORY + File.separator + MashupConstants - .REPO_DIRECTORY + File.separator + MashupConstants.REPO_DIRECTORY, - null); - ServerManager serverManager = ServerManager.getInstance(); - ConfigurationContext configurationContext = serverManager.configContext; - if (configurationContext != null) { - Parameter param = configurationContext.getAxisConfiguration() - .getParameter(MashupConstants.PROXY); - if (param != null) { - configurationContextWithoutRepo.getAxisConfiguration().addParameter(param); - } - } - } - return configurationContextWithoutRepo; - } - - /** * Cretes a new ConfigurationContext with the repository as Mashup_Home/.work/repo. - * This repo will have addressing and rampart as mosules. + * This repo will have addressing and rampart as modules. * * @return A new ConfigurationContext * @throws AxisFault Thrown in case an exception occurs */ - public static ConfigurationContext createNewConfigurationContextWithRepo() throws AxisFault { + public static ConfigurationContext getClientConfigurationContext() throws AxisFault { String wso2wsasHome = System.getProperty(MashupConstants.WSO2WSAS_HOME); - if (configurationContextWithRepo == null) { - configurationContextWithRepo = ConfigurationContextFactory + if (configurationContext == null) { + configurationContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + File.separator + MashupConstants - .REPO_DIRECTORY, null); - ServerManager serverManager = ServerManager.getInstance(); - ConfigurationContext configurationContext = serverManager.configContext; - if (configurationContext != null) { - AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration(); - Parameter param = axisConfiguration.getParameter(MashupConstants.PROXY); - if (param != null) { - configurationContextWithRepo.getAxisConfiguration().addParameter(param); - } - AxisConfiguration newAxisConfiguration = - configurationContextWithRepo.getAxisConfiguration(); - - // Copying over the in transports from the servers configuration to the client - HashMap inTransports = axisConfiguration.getTransportsIn(); - Iterator iterator = inTransports.keySet().iterator(); - while (iterator.hasNext()) { - String transportName = (String) iterator.next(); - if (!ServerConstants.HTTP_TRANSPORT.equalsIgnoreCase(transportName)) { - newAxisConfiguration - .addTransportIn( - (TransportInDescription) inTransports.get(transportName)); - } - } - - // Copying over the out transports from the servers configuration to the client - HashMap outTransports = axisConfiguration.getTransportsOut(); - iterator = outTransports.keySet().iterator(); - while (iterator.hasNext()) { - String transportName = (String) iterator.next(); - if (!ServerConstants.HTTP_TRANSPORT.equalsIgnoreCase(transportName)) { - newAxisConfiguration - .addTransportOut( - (TransportOutDescription) outTransports.get(transportName)); - } - } - } + .REPO_DIRECTORY, wso2wsasHome + File.separator + + MashupConstants.CONFIGURATION_DIR + File.separator + + MashupConstants.AXIS2_CLIENT_XML); } - return configurationContextWithRepo; + return configurationContext; } public static void updateKeyStore(KeyStoreDO keyStoreDO) { 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=20281&r1=20280&r2=20281&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 Thu Jul 31 11:45:58 2008 @@ -230,7 +230,7 @@ ServerManager serverManager = ServerManager.getInstance(); ConfigurationContext context = serverManager.configContext; RPCServiceClient client = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), 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/JSStubGeneratorService/src/org/wso2/mashup/JSStubGenerator.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/coreservices/JSStubGeneratorService/src/org/wso2/mashup/JSStubGenerator.java?rev=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/coreservices/JSStubGeneratorService/src/org/wso2/mashup/JSStubGenerator.java (original) +++ branches/mashup/java/1.5/java/modules/coreservices/JSStubGeneratorService/src/org/wso2/mashup/JSStubGenerator.java Thu Jul 31 11:45:58 2008 @@ -40,7 +40,7 @@ import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.wsas.ServerManager; +import org.wso2.mashup.utils.MashupUtils; import javax.activation.DataHandler; import javax.xml.stream.XMLStreamException; @@ -105,8 +105,7 @@ method.setURI(wsdlURL); method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES); - ServerManager serverManager = ServerManager.getInstance(); - ConfigurationContext configurationContext = serverManager.configContext; + ConfigurationContext configurationContext = MashupUtils.getClientConfigurationContext(); if (configurationContext != null) { Parameter parameter = configurationContext.getAxisConfiguration().getParameter("Proxy"); Modified: branches/mashup/java/1.5/java/modules/coreservices/scraperservice/src/org/wso2/mashup/coreservices/scraperservice/ScraperService.java URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/coreservices/scraperservice/src/org/wso2/mashup/coreservices/scraperservice/ScraperService.java?rev=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/coreservices/scraperservice/src/org/wso2/mashup/coreservices/scraperservice/ScraperService.java (original) +++ branches/mashup/java/1.5/java/modules/coreservices/scraperservice/src/org/wso2/mashup/coreservices/scraperservice/ScraperService.java Thu Jul 31 11:45:58 2008 @@ -30,6 +30,7 @@ import org.webharvest.runtime.variables.Variable; import org.wso2.mashup.MashupFault; import org.wso2.mashup.MashupConstants; +import org.wso2.mashup.utils.MashupUtils; import org.xml.sax.InputSource; import javax.xml.stream.XMLStreamConstants; @@ -63,7 +64,7 @@ Scraper scraper = new Scraper(scraperConfiguration, resourcesFolderPath); AxisConfiguration configuration = - context.getConfigurationContext().getAxisConfiguration(); + MashupUtils.getClientConfigurationContext().getAxisConfiguration(); Parameter parameter = configuration.getParameter(MashupConstants.PROXY); // The axis2.xml could have details of a proxy, If its present we should set those details // on the scraper too Modified: branches/mashup/java/1.5/java/modules/distribution/create-distro-build.xml URL: http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/distribution/create-distro-build.xml?rev=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/distribution/create-distro-build.xml (original) +++ branches/mashup/java/1.5/java/modules/distribution/create-distro-build.xml Thu Jul 31 11:45:58 2008 @@ -223,6 +223,7 @@ <copy todir="${dist.dir}/conf" filtering="on"> <fileset dir="../core/conf"> <include name="axis2.xml"/> + <include name="axis2-client.xml"/> <include name="server.xml"/> <include name="wrapper.conf"/> <include name="log4j.properties"/> 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=20281&r1=20280&r2=20281&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 Thu Jul 31 11:45:58 2008 @@ -134,7 +134,7 @@ configContext.getServicePath() + "/ScraperService/scrape"; try { RPCServiceClient serviceClient = - new RPCServiceClient(MashupUtils.createNewConfigurationContext(), null); + new RPCServiceClient(MashupUtils.getClientConfigurationContext(), 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=20281&r1=20280&r2=20281&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 Thu Jul 31 11:45:58 2008 @@ -69,7 +69,6 @@ import org.wso2.mashup.MashupFault; import org.wso2.mashup.utils.MashupUtils; import org.wso2.wsas.ServerConstants; -import org.wso2.wsas.ServerManager; import org.wso2.utils.ServerConfiguration; import javax.wsdl.Definition; @@ -342,7 +341,7 @@ } try { wsRequest.sender = - new ServiceClient(MashupUtils.createNewConfigurationContextWithRepo(), null); + new ServiceClient(MashupUtils.getClientConfigurationContext(), null); } catch (AxisFault axisFault) { throw new MashupFault(axisFault); } @@ -543,8 +542,8 @@ .createConfigurationContextFromFileSystem(wso2wsasHome + File.separator + MashupConstants.WORK_DIRECTORY + File.separator + MashupConstants .REPO_DIRECTORY, null); - ServerManager serverManager = ServerManager.getInstance(); - Parameter param = serverManager.configContext.getAxisConfiguration() + ConfigurationContext serverConfigContext = MashupUtils.getClientConfigurationContext(); + Parameter param = serverConfigContext.getAxisConfiguration() .getParameter(MashupConstants.PROXY); if (param != null) { configurationContext.getAxisConfiguration().addParameter(param); 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=20281&r1=20280&r2=20281&view=diff ============================================================================== --- branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp (original) +++ branches/mashup/java/1.5/java/modules/www/WSRequestXSSproxy.jsp Thu Jul 31 11:45:58 2008 @@ -163,7 +163,7 @@ } //creating service client - ServiceClient sc = new ServiceClient(MashupUtils.createNewConfigurationContext(), null); + ServiceClient sc = new ServiceClient(MashupUtils.getClientConfigurationContext(), null); sc.setOptions(opts); if (opts.getProperty(AddressingConstants.WS_ADDRESSING_VERSION) != null) sc.engageModule(Constants.MODULE_ADDRESSING); _______________________________________________ Mashup-dev mailing list [email protected] http://mailman.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
