diff --git a/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/dist/assembly-bin-descriptor.xml b/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/dist/assembly-bin-descriptor.xml index c0c01a84de9..5d86a82577f 100644 --- a/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/dist/assembly-bin-descriptor.xml +++ b/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/dist/assembly-bin-descriptor.xml @@ -26,15 +26,6 @@ lib - - - samples/client_repo/modules - - org.apache.axis2:addressing:mar - org.apache.rampart:rampart:mar - org.apache.sandesha2:sandesha2:mar - - diff --git a/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/pom.xml b/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/pom.xml index f2410d16c86..ecee5cb7cd9 100644 --- a/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/pom.xml +++ b/components/business-adaptors/hl7/org.wso2.carbon.business.messaging.hl7.samples/pom.xml @@ -94,21 +94,6 @@ mar - - org.apache.rampart - rampart - - - org.apache.woden - woden-api - - - org.slf4j - log4j-over-slf4j - - - mar - diff --git a/components/mediation-admin/org.wso2.carbon.proxyadmin.common/pom.xml b/components/mediation-admin/org.wso2.carbon.proxyadmin.common/pom.xml index c4360386722..ee6112fa79c 100644 --- a/components/mediation-admin/org.wso2.carbon.proxyadmin.common/pom.xml +++ b/components/mediation-admin/org.wso2.carbon.proxyadmin.common/pom.xml @@ -48,16 +48,6 @@ - - org.apache.rampart.wso2 - rampart-core - - - org.slf4j - log4j-over-slf4j - - - org.wso2.org.ops4j.pax.logging pax-logging-api diff --git a/components/mediation-admin/org.wso2.carbon.proxyadmin/pom.xml b/components/mediation-admin/org.wso2.carbon.proxyadmin/pom.xml index bdf98d759d6..8fb2d91e2e8 100644 --- a/components/mediation-admin/org.wso2.carbon.proxyadmin/pom.xml +++ b/components/mediation-admin/org.wso2.carbon.proxyadmin/pom.xml @@ -52,16 +52,6 @@ org.wso2.carbon.deployment org.wso2.carbon.service.mgt - - org.apache.rampart.wso2 - rampart-core - - - org.slf4j - log4j-over-slf4j - - - org.wso2.org.ops4j.pax.logging pax-logging-api diff --git a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/ProxyAdminServiceComponent.java b/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/ProxyAdminServiceComponent.java index 157a5e9b5f7..50723b7af5b 100644 --- a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/ProxyAdminServiceComponent.java +++ b/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/ProxyAdminServiceComponent.java @@ -32,12 +32,10 @@ import org.wso2.carbon.mediation.initializer.ServiceBusUtils; import org.wso2.carbon.mediation.initializer.services.SynapseEnvironmentService; import org.wso2.carbon.mediation.initializer.services.SynapseRegistrationsService; -import org.wso2.carbon.proxyadmin.observer.ProxyObserver; import org.wso2.carbon.proxyadmin.observer.ProxyServiceParameterObserver; import org.wso2.carbon.proxyadmin.service.ProxyDeployerService; import org.wso2.carbon.proxyadmin.service.ProxyDeployerServiceImpl; import org.wso2.carbon.proxyadmin.util.ConfigHolder; -import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.service.mgt.ServiceAdmin; import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver; @@ -86,14 +84,6 @@ protected void activate(ComponentContext context) { if (synEnvService != null) { AxisConfiguration axisConf = synEnvService.getConfigurationContext().getAxisConfiguration(); try { - if (!Boolean.parseBoolean(System.getProperty("NonRegistryMode"))) { - ProxyObserver proxyObserver = new ProxyObserver(synEnvService, ConfigHolder.getInstance() - .getRegistryService().getConfigSystemRegistry()); - ConfigHolder.getInstance().addProxyObserver(MultitenantConstants.SUPER_TENANT_ID, - proxyObserver); - axisConf.addObservers(proxyObserver); - proxyObserver.setSynapseEnvironmentService(synEnvService); - } registerDeployer(synEnvService.getConfigurationContext().getAxisConfiguration(), synEnvService .getSynapseEnvironment()); bindProxyParameterObserver(axisConf); @@ -179,24 +169,12 @@ protected void setSynapseEnvironmentService(SynapseEnvironmentService synapseEnv int tenantId = synapseEnvironmentService.getTenantId(); AxisConfiguration axisConfiguration = synapseEnvironmentService.getConfigurationContext() .getAxisConfiguration(); - ProxyObserver observer; if (!alreadyCreated) { try { registerDeployer(synapseEnvironmentService.getConfigurationContext().getAxisConfiguration(), synapseEnvironmentService.getSynapseEnvironment()); - observer = new ProxyObserver(synapseEnvironmentService, ConfigHolder.getInstance() - .getRegistryService().getConfigSystemRegistry(tenantId)); - axisConfiguration.addObservers(observer); - ConfigHolder.getInstance().addProxyObserver(tenantId, observer); } catch (ProxyAdminException e) { log.error("Error while initializing the proxy admin.", e); - } catch (RegistryException e) { - log.error("Error while initializing the proxy admin.", e); - } - } else { - observer = ConfigHolder.getInstance().getProxyObsever(tenantId); - if (observer != null) { - observer.setSynapseEnvironmentService(synapseEnvironmentService); } } } @@ -303,12 +281,7 @@ public void createdConfigurationContext(ConfigurationContext configContext) { SynapseEnvironmentService synEnvService = ConfigHolder.getInstance().getSynapseEnvironmentService (tenantId); if (synEnvService != null) { - ProxyObserver proxyObserver = new ProxyObserver(synEnvService, ConfigHolder.getInstance() - .getRegistryService().getConfigSystemRegistry(tenantId)); - ConfigHolder.getInstance().addProxyObserver(tenantId, proxyObserver); - axisConfig.addObservers(proxyObserver); registerDeployer(axisConfig, synEnvService.getSynapseEnvironment()); - proxyObserver.setSynapseEnvironmentService(synEnvService); } } else { log.error("Error while initialzing AxisConfiguration", null); diff --git a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/observer/ProxyObserver.java b/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/observer/ProxyObserver.java deleted file mode 100644 index e796e2cf8aa..00000000000 --- a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/observer/ProxyObserver.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.carbon.proxyadmin.observer; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.impl.builder.StAXOMBuilder; -import org.apache.axis2.AxisFault; -import org.apache.axis2.description.*; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.engine.AxisEvent; -import org.apache.axis2.engine.AxisObserver; -import org.apache.axis2.util.JavaUtils; -import org.apache.axis2.util.PolicyUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.neethi.Policy; -import org.apache.neethi.PolicyEngine; -import org.apache.rampart.Rampart; -import org.apache.synapse.SynapseConstants; -import org.apache.synapse.config.SynapseConfigUtils; -import org.apache.synapse.config.SynapseConfiguration; -import org.apache.synapse.core.axis2.ProxyService; -import org.apache.synapse.util.PolicyInfo; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.RegistryResources; -import org.wso2.carbon.mediation.initializer.ServiceBusConstants; -import org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager; -import org.wso2.carbon.mediation.initializer.services.SynapseEnvironmentService; -import org.wso2.carbon.proxyadmin.ProxyAdminException; -import org.wso2.carbon.registry.core.Collection; -import org.wso2.carbon.registry.core.Registry; -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.wso2.carbon.security.SecurityConstants; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -/** - * Proxy observer observe the Proxy service in runtime and update the synapse Configuration - */ -public class ProxyObserver implements AxisObserver { - - private SynapseEnvironmentService synapseEnvironmentService; - - private Registry configSystemRegistry; - - private static final Log log = LogFactory.getLog(ProxyObserver.class); - - private static final String[] DEFAULT_MODULES = new String[] { - "addressing", "ServerAdminModule", "wso2statistics", "POXSecurityModule", "pagination" ,"wso2tracer" - }; - - /** - * Constructs a new ProxyObserver using the given SynapseEnvironmentService. This - * constructor ensures that all the created proxy observer instances have a - * non-null SynapseConfiguration. Attempting to create a proxy observer with - * a null SynapseConfiguration would result in an exception. - * TODO: because of a bug in current equinox framework version, we no longer get events when new - * TODO: synapse environment created. So changed proxy observer config to take reference of - * TODO: synapseEnvService and obtaing synapse config from it See : ESBJAVA-1029 - * @param synapseEnvironmentService the Synapse - * @param configRegistry the registry - * @throws ProxyAdminException if the SynapseConfiguration is null - */ - public ProxyObserver(SynapseEnvironmentService synapseEnvironmentService, Registry configRegistry) - throws ProxyAdminException { - if (synapseEnvironmentService.getSynapseEnvironment().getSynapseConfiguration() == null) { - String msg = "Unable to initialize a ProxyObserver with a null SynapseConfiguration"; - log.error(msg); - throw new ProxyAdminException(msg); - } - this.synapseEnvironmentService = synapseEnvironmentService; - this.configSystemRegistry = configRegistry; - } - - public void init(AxisConfiguration axisConfiguration) { - } - - public void serviceUpdate(AxisEvent event, AxisService axisService) { - - Parameter serviceTypeParam = axisService.getParameter( - SynapseConstants.SERVICE_TYPE_PARAM_NAME); - if (serviceTypeParam == null || !SynapseConstants.PROXY_SERVICE_TYPE.equals( - serviceTypeParam.getValue().toString())) { - // We are only interested about the proxy services - return; - } - - if (getSynapseConfiguration() == null) { - // Somehow the underlying SynapseConfiguration has become null after - // creating the proxy observer. May be the user is manipulating bundles - // through the OSGi console or the system is shutting down. - if (log.isDebugEnabled()) { - log.debug("SynapseConfiguration in ProxyObserver is null. The service" + - " update event will not be processed further."); - } - return; - } - - if (CarbonConstants.POLICY_ADDED == event.getEventType()) { - updateProxyServicePolicies(axisService, getSynapseConfiguration()); - } - - if (CarbonConstants.AxisEvent.TRANSPORT_BINDING_ADDED == event.getEventType()) { - ProxyService proxy = getSynapseConfiguration().getProxyService(axisService.getName()); - if (proxy != null && proxy.getTransports() != null) { - List transports = axisService.getExposedTransports(); - for (String trp : transports) { - if (!proxy.getTransports().contains(trp)) { - proxy.getTransports().add(trp); - } - } - } - } - - ProxyService proxy = getSynapseConfiguration().getProxyService(axisService.getName()); - if (proxy != null && proxy.getTransports() != null) { - proxy.setRunning(axisService.isActive()); - } - - if (AxisEvent.SERVICE_REMOVE == event.getEventType()) { - - Parameter keepServiceHistoryParam = axisService.getParameter( - CarbonConstants.KEEP_SERVICE_HISTORY_PARAM); - Parameter originator = axisService.getParameter("originator"); - boolean keepHistory = keepServiceHistoryParam != null - && JavaUtils.isTrue(keepServiceHistoryParam.getValue()); - //Only remove proxy config from storage if service remove request coming from - // Service listing UI. This check will prevent proxy xml deleting from file system - //during hot update - if (originator != null && "ServiceAdmin".equals(originator.getValue().toString())) { - if (!keepHistory) { - ProxyService proxySvc = getSynapseConfiguration().getProxyService(axisService.getName()); - if (proxySvc != null) { - getSynapseConfiguration().removeProxyService(axisService.getName()); - if(!Boolean.parseBoolean(System.getProperty("NonRegistryMode"))) { - MediationPersistenceManager pm = getMediationPersistenceManager(); - pm.deleteItem(proxySvc.getName(), proxySvc.getFileName(), - ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE); - } - log.info("Deleted the proxy service : " + proxySvc.getName()); - - } else if (log.isDebugEnabled()) { - log.debug("Proxy Service representing the service " + axisService.getName() - + " of type proxy is not found in the SynapseConfiguration"); - } - } - } - } - } - - public void moduleUpdate(AxisEvent event, AxisModule axisModule) { - - if (event != null && (event.getAxisDescription() instanceof AxisService || - event.getAxisDescription() instanceof AxisOperation)) { - - AxisService axisService; - if (event.getAxisDescription() instanceof AxisService) { - axisService = (AxisService) event.getAxisDescription(); - } else { - axisService = ((AxisOperation) event.getAxisDescription()).getAxisService(); - } - - Parameter serviceTypeParam = axisService.getParameter( - SynapseConstants.SERVICE_TYPE_PARAM_NAME); - if (serviceTypeParam == null || !SynapseConstants.PROXY_SERVICE_TYPE.equals( - serviceTypeParam.getValue().toString())) { - // We are only interested about the proxy services - return; - } - - if (getSynapseConfiguration() == null) { - if (log.isDebugEnabled()) { - log.debug("SynapseConfiguration in ProxyObserver is null. The module" + - " update event will not be processed further."); - } - return; - } - - if (CarbonConstants.POLICY_ADDED == event.getEventType()) { - updateProxyServicePolicies(axisService, getSynapseConfiguration()); - } - if (AxisEvent.MODULE_ENGAGED == event.getEventType() && !isDefaultModule(axisModule)) { - onEngageModule(axisService, axisModule, getSynapseConfiguration()); - updateProxyServicePolicies(axisService, getSynapseConfiguration()); - } - if (AxisEvent.MODULE_DISENGAGED == event.getEventType() && !isDefaultModule(axisModule)) { - onDisEngageModule(axisService, axisModule, getSynapseConfiguration()); - updateProxyServicePolicies(axisService, getSynapseConfiguration()); - } - } - } - - private boolean isDefaultModule(AxisModule module) { - String name = module.getName(); - for (String defaultModule : DEFAULT_MODULES) { - if (defaultModule.equals(name)) { - return true; - } - } - return false; - } - - public void serviceGroupUpdate(AxisEvent event, AxisServiceGroup axisServiceGroup) {} - public void addParameter(Parameter parameter) throws AxisFault {} - public void removeParameter(Parameter parameter) throws AxisFault {} - public void deserializeParameters(OMElement omElement) throws AxisFault {} - public Parameter getParameter(String s) { return null; } - public ArrayList getParameters() { return null; } - public boolean isParameterLocked(String s) { return false; } - - private void onEngageModule(AxisService service, AxisModule module, - SynapseConfiguration config) { - if (config.getProxyService(service.getName()) != null) { - ProxyService proxy = config.getProxyService(service.getName()); - if (module.getModule() instanceof Rampart) { - proxy.setWsSecEnabled(true); - } - } - } - - private void onDisEngageModule(AxisService service, AxisModule module, - SynapseConfiguration config) { - if (config.getProxyService(service.getName()) != null) { - ProxyService proxy = config.getProxyService(service.getName()); - if (module.getModule() instanceof Rampart) { - proxy.setWsSecEnabled(false); - proxy.getParameterMap().remove(SecurityConstants.SECURITY_POLICY_PATH); - proxy.getParameterMap().remove("disableREST"); - } - } - } - - private void updateProxyServicePolicies(AxisService axisService, SynapseConfiguration config) { - - if (config.getProxyService(axisService.getName()) == null) { - if (log.isDebugEnabled()) { - log.debug("Couldn't retrieve the proxy service with name " + axisService.getName() + - " to update policies"); - } - return; - } - - ProxyService proxyService = config.getProxyService(axisService.getName()); - try { - Registry registry = this.configSystemRegistry; - String servicePath = RegistryResources.ROOT + "axis2" + - RegistryConstants.PATH_SEPARATOR + "service-groups" + - RegistryConstants.PATH_SEPARATOR + - axisService.getAxisServiceGroup().getServiceGroupName() + - RegistryConstants.PATH_SEPARATOR + "services" + - RegistryConstants.PATH_SEPARATOR + axisService.getName(); - - String servicePoliciesPath = servicePath - + RegistryConstants.PATH_SEPARATOR + "policies"; - - List remainingPolicies = new ArrayList(); - for (PolicyInfo info : proxyService.getPolicies()) { - if (!info.getPolicyKey().startsWith("conf:" + servicePoliciesPath)) { - remainingPolicies.add(info); - } - } - proxyService.setPolicies(remainingPolicies); - - if (registry.resourceExists(servicePoliciesPath)) { - // there are service level policies - Resource servicePoliciesResource = registry.get(servicePoliciesPath); - if (servicePoliciesResource instanceof Collection) { - Collection servicePoliciesCollection = (Collection) servicePoliciesResource; - for (String servicePolicyResourcePath : - servicePoliciesCollection.getChildren()) { - PolicyInfo pi = handlePolicy(config, - proxyService, servicePolicyResourcePath, (UserRegistry) registry); - if (pi != null) { - pi.setPolicyKey("conf:" + pi.getPolicyKey()); - proxyService.addPolicyInfo(pi); - } - } - } - } - - // Update exposed transports - if (axisService.getExposedTransports() != null && - !axisService.getExposedTransports().isEmpty()) { - proxyService.setTransports( - new ArrayList(axisService.getExposedTransports())); - } else { - proxyService.setTransports(new ArrayList()); - } - - persistChanges(axisService.getName(), axisService.getAxisConfiguration()); - } catch (RegistryException e) { - log.error("Error checking the policies from the registry", e); - } - } - - private PolicyInfo handlePolicy(SynapseConfiguration config, ProxyService proxy, - String policyPath, UserRegistry registry) - throws RegistryException { - - if (!registry.resourceExists(policyPath)) { - return null; - } - - Resource policyResource = registry.get(policyPath); - byte[] content = (byte[]) policyResource.getContent(); - if (content == null || content.length == 0) { - return null; - } - policyResource.discard(); - - ByteArrayInputStream in = new ByteArrayInputStream(content); - Policy policy = getPolicy(in); - if (policy != null && !policy.isEmpty()) { - for (PolicyInfo pi : proxy.getPolicies()) { - if (pi.isServicePolicy()) { - config.getEntryDefinition(pi.getPolicyKey()); - Policy proxyPolicy = PolicyEngine.getPolicy(SynapseConfigUtils.getStreamSource( - config.getEntry(pi.getPolicyKey())).getInputStream()); - if (proxyPolicy.equal(policy.normalize(false))) { - return null; - } - } - } - return new PolicyInfo(policyPath); - } - return null; - } - - private Policy getPolicy(InputStream is) { - BufferedInputStream inputStream = new BufferedInputStream(is); - try { - XMLStreamReader parser = XMLInputFactory.newInstance(). - createXMLStreamReader(inputStream); - StAXOMBuilder builder = new StAXOMBuilder(parser); - OMElement elem = builder.getDocumentElement(); - return PolicyUtil.getPolicyFromOMElement(elem); - } catch (XMLStreamException e) { - return null; - } finally { - try { inputStream.close(); } catch (IOException ignored) {} - } - } - - private void persistChanges(String proxyName, AxisConfiguration axisConfiguration) { - Parameter param = axisConfiguration.getParameter(ServiceBusConstants.SUSPEND_PERSISTENCE); - if (param != null && Boolean.parseBoolean((String) param.getValue())) { - return; - } - if(!Boolean.parseBoolean(System.getProperty("NonRegistryMode"))) { - MediationPersistenceManager mpm = getMediationPersistenceManager(); - if (mpm != null) { - mpm.saveItem(proxyName, ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE); - } - } - } - - private MediationPersistenceManager getMediationPersistenceManager() { - Parameter p = getSynapseConfiguration().getAxisConfiguration().getParameter( - ServiceBusConstants.PERSISTENCE_MANAGER); - if (p != null) { - return (MediationPersistenceManager) p.getValue(); - } - - return null; - } - - public void setSynapseEnvironmentService(SynapseEnvironmentService synapseEnvironmentService) { - this.synapseEnvironmentService = synapseEnvironmentService; - } - - private SynapseConfiguration getSynapseConfiguration() { - return this.synapseEnvironmentService.getSynapseEnvironment().getSynapseConfiguration(); - } -} diff --git a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/util/ConfigHolder.java b/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/util/ConfigHolder.java index 1bf359381e4..e8112fdb480 100644 --- a/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/util/ConfigHolder.java +++ b/components/mediation-admin/org.wso2.carbon.proxyadmin/src/main/java/org/wso2/carbon/proxyadmin/util/ConfigHolder.java @@ -19,7 +19,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.proxyadmin.ProxyAdminException; -import org.wso2.carbon.proxyadmin.observer.ProxyObserver; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.mediation.initializer.services.SynapseEnvironmentService; @@ -33,8 +32,6 @@ public class ConfigHolder { private RegistryService registryService; - private Map proxyObservers = new HashMap(); - private Map synapseEnvironmentServices = new HashMap(); @@ -64,18 +61,6 @@ private void assertNull(String name, Object object) throws ProxyAdminException { } } - public ProxyObserver getProxyObsever(int id) { - return proxyObservers.get(id); - } - - public void addProxyObserver(int id, ProxyObserver observer) { - proxyObservers.put(id, observer); - } - - public void removeProxyObserver(int id) { - proxyObservers.remove(id); - } - public SynapseEnvironmentService getSynapseEnvironmentService(int id) { return synapseEnvironmentServices.get(id); } @@ -93,8 +78,5 @@ public Map getSynapseEnvironmentServices() { return synapseEnvironmentServices; } - public Map getProxyObservers() { - return proxyObservers; - } } diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/pom.xml b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/pom.xml index df4399c5df8..6eeb616a683 100755 --- a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/pom.xml +++ b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/pom.xml @@ -87,10 +87,6 @@ org.wso2.carbon.mediation org.wso2.carbon.inbound.endpoint.persistence - - org.apache.ws.security.wso2 - wss4j - org.apache.felix org.apache.felix.scr.ds-annotations diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java index 7cc765e8a04..f1be87683ce 100644 --- a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java +++ b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java @@ -60,7 +60,6 @@ import org.wso2.carbon.mediation.dependency.mgt.services.ConfigurationTrackingService; import org.wso2.carbon.mediation.initializer.configurations.ConfigurationManager; import org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler; -import org.wso2.carbon.mediation.initializer.handler.SynapseExternalPropertyConfigurator; import org.wso2.carbon.mediation.initializer.multitenancy.TenantServiceBusInitializer; import org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager; import org.wso2.carbon.mediation.initializer.services.SynapseConfigurationService; @@ -199,7 +198,6 @@ protected void activate(ComponentContext ctxt) { SynapseEnvironmentService synEnvSvc = new SynapseEnvironmentServiceImpl(synapseEnvironment, MultitenantConstants.SUPER_TENANT_ID, configCtxSvc.getServerConfigContext()); synEnvRegistration = bndCtx.registerService(SynapseEnvironmentService.class.getName(), synEnvSvc, null); - synapseEnvironment.registerSynapseHandler(new SynapseExternalPropertyConfigurator()); synapseEnvironment.registerSynapseHandler(new ProxyLogHandler()); if (log.isDebugEnabled()) { log.debug("SynapseEnvironmentService Registered"); diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java deleted file mode 100644 index f7edac2f116..00000000000 --- a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.mediation.initializer.handler; - -import org.apache.synapse.AbstractSynapseHandler; -import org.apache.synapse.MessageContext; -import org.apache.synapse.core.axis2.Axis2MessageContext; -import org.apache.ws.security.kerberos.KrbSession; -import org.apache.ws.security.kerberos.KrbSessionCache; - -/** - * Handler to set external properties to the synapse message context - */ -public class SynapseExternalPropertyConfigurator extends AbstractSynapseHandler { - - private final String KRB_SESSION = "__WS_SEC_KRB_SESSION"; - private final String SEC_MODULE = "rampart"; - - @Override - public boolean handleRequestInFlow(MessageContext synCtx) { - - - //For WS-Security Kerberos Scenario - if (((Axis2MessageContext) synCtx).getAxis2MessageContext().isEngaged(SEC_MODULE)) { - // We need to get the session from thread local context and assign it the message context. - // In the response path we need to do the vise-versa. - // This has to be done because in synapse two threads are used in request and response flows - KrbSessionCache sessionCache = KrbSessionCache.getInstance(); - if (sessionCache != null) { - KrbSession krbSession = sessionCache.getCurrentSession(); - if (krbSession != null) { - synCtx.setProperty(KRB_SESSION, krbSession); - } - } - } - return true; - } - - @Override - public boolean handleRequestOutFlow(MessageContext synCtx) { - return true; - } - - @Override - public boolean handleResponseInFlow(MessageContext synCtx) { - return true; - } - - @Override - public boolean handleResponseOutFlow(MessageContext synCtx) { - - //For WS-Security Kerberos Scenario - if (((Axis2MessageContext) synCtx).getAxis2MessageContext().isEngaged(SEC_MODULE)) { - Object obj = synCtx.getProperty(KRB_SESSION); - if (obj != null && obj instanceof KrbSession) { - KrbSessionCache.getInstance().setCurrentSession((KrbSession) obj); - } - } - return true; - } -} diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/multitenancy/TenantServiceBusInitializer.java b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/multitenancy/TenantServiceBusInitializer.java index fd6fb023291..fa4c774376e 100644 --- a/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/multitenancy/TenantServiceBusInitializer.java +++ b/components/mediation-initializer/org.wso2.carbon.mediation.initializer/src/main/java/org/wso2/carbon/mediation/initializer/multitenancy/TenantServiceBusInitializer.java @@ -31,7 +31,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.synapse.Mediator; import org.apache.synapse.ServerConfigurationInformation; import org.apache.synapse.ServerConfigurationInformationFactory; import org.apache.synapse.ServerContextInformation; @@ -57,8 +56,6 @@ import org.apache.synapse.task.TaskDescriptionRepository; import org.apache.synapse.task.TaskManager; import org.apache.synapse.task.TaskScheduler; -import org.apache.synapse.util.AXIOMUtils; -import org.jetbrains.annotations.Nullable; import org.osgi.framework.ServiceRegistration; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -70,7 +67,6 @@ import org.wso2.carbon.mediation.initializer.ServiceBusInitializer; import org.wso2.carbon.mediation.initializer.ServiceBusUtils; import org.wso2.carbon.mediation.initializer.configurations.ConfigurationManager; -import org.wso2.carbon.mediation.initializer.handler.SynapseExternalPropertyConfigurator; import org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager; import org.wso2.carbon.mediation.initializer.services.SynapseConfigurationService; import org.wso2.carbon.mediation.initializer.services.SynapseConfigurationServiceImpl; @@ -85,12 +81,10 @@ import org.wso2.carbon.registry.core.session.UserRegistry; import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver; import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ServerConstants; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; @@ -220,7 +214,6 @@ public void createdConfigurationContext(ConfigurationContext configurationContex ServiceRegistration envRegistration = ConfigurationHolder.getInstance().getBundleContext().registerService( SynapseEnvironmentService.class.getName(), synEnvSvc, null); - synapseEnvironment.registerSynapseHandler(new SynapseExternalPropertyConfigurator()); try { if (envRegistration != null) { diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/pom.xml b/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/pom.xml index 72006b9bd53..50c412dad91 100755 --- a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/pom.xml +++ b/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/pom.xml @@ -92,10 +92,6 @@ org.wso2.carbon.mediation org.wso2.carbon.inbound.endpoint.persistence - - org.apache.ws.security.wso2 - wss4j - org.apache.felix org.apache.felix.scr.ds-annotations diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java b/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java index 975f5bc8066..d9351eb3370 100644 --- a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java +++ b/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/ServiceBusInitializer.java @@ -57,7 +57,6 @@ import org.wso2.carbon.inbound.endpoint.persistence.service.InboundEndpointPersistenceService; import org.wso2.carbon.mediation.initializer.configurations.ConfigurationManager; import org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler; -import org.wso2.carbon.mediation.initializer.handler.SynapseExternalPropertyConfigurator; import org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager; import org.wso2.carbon.mediation.initializer.services.SynapseConfigurationService; import org.wso2.carbon.mediation.initializer.services.SynapseConfigurationServiceImpl; @@ -182,7 +181,6 @@ protected void activate(ComponentContext ctxt) { SynapseEnvironmentService synEnvSvc = new SynapseEnvironmentServiceImpl(synapseEnvironment, MultitenantConstants.SUPER_TENANT_ID, configCtxSvc.getServerConfigContext()); synEnvRegistration = bndCtx.registerService(SynapseEnvironmentService.class.getName(), synEnvSvc, null); - synapseEnvironment.registerSynapseHandler(new SynapseExternalPropertyConfigurator()); synapseEnvironment.registerSynapseHandler(new ProxyLogHandler()); if (log.isDebugEnabled()) { log.debug("SynapseEnvironmentService Registered"); diff --git a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java b/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java deleted file mode 100644 index f7edac2f116..00000000000 --- a/components/mediation-initializer/org.wso2.carbon.mediation.light.initializer/src/main/java/org/wso2/carbon/mediation/initializer/handler/SynapseExternalPropertyConfigurator.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.mediation.initializer.handler; - -import org.apache.synapse.AbstractSynapseHandler; -import org.apache.synapse.MessageContext; -import org.apache.synapse.core.axis2.Axis2MessageContext; -import org.apache.ws.security.kerberos.KrbSession; -import org.apache.ws.security.kerberos.KrbSessionCache; - -/** - * Handler to set external properties to the synapse message context - */ -public class SynapseExternalPropertyConfigurator extends AbstractSynapseHandler { - - private final String KRB_SESSION = "__WS_SEC_KRB_SESSION"; - private final String SEC_MODULE = "rampart"; - - @Override - public boolean handleRequestInFlow(MessageContext synCtx) { - - - //For WS-Security Kerberos Scenario - if (((Axis2MessageContext) synCtx).getAxis2MessageContext().isEngaged(SEC_MODULE)) { - // We need to get the session from thread local context and assign it the message context. - // In the response path we need to do the vise-versa. - // This has to be done because in synapse two threads are used in request and response flows - KrbSessionCache sessionCache = KrbSessionCache.getInstance(); - if (sessionCache != null) { - KrbSession krbSession = sessionCache.getCurrentSession(); - if (krbSession != null) { - synCtx.setProperty(KRB_SESSION, krbSession); - } - } - } - return true; - } - - @Override - public boolean handleRequestOutFlow(MessageContext synCtx) { - return true; - } - - @Override - public boolean handleResponseInFlow(MessageContext synCtx) { - return true; - } - - @Override - public boolean handleResponseOutFlow(MessageContext synCtx) { - - //For WS-Security Kerberos Scenario - if (((Axis2MessageContext) synCtx).getAxis2MessageContext().isEngaged(SEC_MODULE)) { - Object obj = synCtx.getProperty(KRB_SESSION); - if (obj != null && obj instanceof KrbSession) { - KrbSessionCache.getInstance().setCurrentSession((KrbSession) obj); - } - } - return true; - } -} diff --git a/pom.xml b/pom.xml index 40e66119400..3954ca5433b 100644 --- a/pom.xml +++ b/pom.xml @@ -367,17 +367,6 @@ commons-lang ${commons.lang.wso2.version} - - org.apache.rampart.wso2 - rampart-core - ${rampart.wso2.version} - - - org.slf4j - log4j-over-slf4j - - - org.apache.bsf.wso2 bsf-all @@ -470,23 +459,7 @@ geronimo-jta_1.1_spec ${geronimo-jta.version} - - org.apache.rampart - rampart - ${rampart.version} - - - org.apache.rampart - rampart - ${rampart.mar.version} - - - org.apache.woden - woden-api - - - mar - + org.wso2.carbon @@ -2229,11 +2202,7 @@ xercesImpl ${xercesImpl.version} - - org.apache.ws.security.wso2 - wss4j - ${wss4j.version} - + org.wso2.orbit.org.apache.cxf cxf-bundle @@ -2554,11 +2523,8 @@ ${axiom.version} [1.2.11, 1.3.0) - 1.6.1-wso2v41 - ${rampart.version} 3.0.2 2.0.4.wso2v4 - 1.6.0-wso2v2 1.4.7.wso2v2 2.6.0.wso2v1 ${rampart.version}