public void proxyServiceAdded(ProxyService proxy) { log.info("Proxy service : " + proxy.getName() + " was added " + "to the Synapse configuration successfully"); }
public void proxyServiceRemoved(ProxyService proxy) { log.info("Proxy service : " + proxy.getName() + " was removed " + "from the Synapse configuration successfully"); }
public void proxyServiceAdded(ProxyService proxy) { if (proxy.getArtifactContainerName() != null) { log.info("Proxy service : " + proxy.getName() + " was added " + "to the Synapse configuration successfully - " + proxy.getArtifactContainerName()); } else { log.info("Proxy service : " + proxy.getName() + " was added " + "to the Synapse configuration successfully"); } }
public void proxyServiceRemoved(ProxyService proxy) { if (proxy.getArtifactContainerName() != null) { log.info("Proxy service : " + proxy.getName() + " was removed " + "from the Synapse configuration successfully - " + proxy.getArtifactContainerName()); } else { log.info("Proxy service : " + proxy.getName() + " was removed " + "from the Synapse configuration successfully"); } }
/** * Removes all Synapse proxy services from the Axis2 configuration. * * @throws AxisFault if an error occurs undeploying proxy services */ private void undeployProxyServices() throws AxisFault { log.info("Undeploying Proxy services..."); for (ProxyService proxy : synapseConfiguration.getProxyServices()) { configurationContext.getAxisConfiguration().removeService( proxy.getName()); } }
public void proxyServiceAdded(ProxyService proxy) { tracker.get(PROXY).add(proxy.getName()); }
public void proxyServiceRemoved(ProxyService proxy) { tracker.get(PROXY).remove(proxy.getName()); }
/** * Removes all Synapse proxy services from the Axis2 configuration. * * @throws AxisFault if an error occurs undeploying proxy services */ private void undeployProxyServices() throws AxisFault { log.info("Undeploying Proxy services..."); for (ProxyService proxy : synapseConfiguration.getProxyServices()) { configurationContext.getAxisConfiguration().removeService( proxy.getName()); } }
private static void createProxyServices(SynapseConfiguration synapseConfig, String rootDirPath, Properties properties) { File proxyServicesDir = new File(rootDirPath, PROXY_SERVICES_DIR); if (proxyServicesDir.exists()) { if (log.isDebugEnabled()) { log.debug("Loading proxy services from : " + proxyServicesDir.getPath()); } Iterator proxyDefinitions = FileUtils.iterateFiles(proxyServicesDir, extensions, false); while (proxyDefinitions.hasNext()) { File file = (File) proxyDefinitions.next(); OMElement document = null; try { document = getOMElement(file); } catch (Exception e) { String msg = "Error while building Proxy service configuration from file : " + file.getName(); handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES, msg, e); } if (document != null) { ProxyService proxy = SynapseXMLConfigurationFactory.defineProxy(synapseConfig, document, properties); if (proxy != null) { proxy.setFileName(file.getName()); synapseConfig.getArtifactDeploymentStore().addArtifact( file.getAbsolutePath(), proxy.getName()); } } } } }
@Override public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Started"); } try { ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName); if (proxy != null) { if (log.isDebugEnabled()) { log.debug("Stopping the ProxyService named : " + artifactName); } proxy.stop(getSynapseConfiguration()); getSynapseConfiguration().removeProxyService(artifactName); if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Completed"); } log.info("ProxyService named '" + proxy.getName() + "' has been undeployed"); } else if (log.isDebugEnabled()) { log.debug("Proxy service " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "ProxyService Undeployement of proxy named : " + artifactName + " : Failed", e); } }
public static ProxyService defineProxy(SynapseConfiguration config, OMElement elem, Properties properties) { ProxyService proxy = null; try { proxy = ProxyServiceFactory.createProxy(elem, properties); if (proxy != null) { config.addProxyService(proxy.getName(), proxy); } } catch (Exception e) { String msg = "Proxy Service configuration: " + elem.getAttributeValue(( new QName(XMLConfigConstants.NULL_NAMESPACE, "name"))) + " cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES, msg, e); } return proxy; }
public static ProxyService defineProxy(SynapseConfiguration config, OMElement elem, Properties properties) { ProxyService proxy = null; try { proxy = ProxyServiceFactory.createProxy(elem, properties); if (proxy != null) { config.addProxyService(proxy.getName(), proxy); } } catch (Exception | NoClassDefFoundError e) { String msg = "Proxy Service configuration: " + elem.getAttributeValue(( new QName(XMLConfigConstants.NULL_NAMESPACE, "name"))) + " cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES, msg, e); } return proxy; }
public OMElement serializeProxy(ProxyService service, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File proxyDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR); OMElement proxyElem = ProxyServiceSerializer.serializeProxy(null, service); String fileName = service.getFileName(); if (fileName != null) { if (currentDirectory == rootDirectory) { handleDeployment(proxyDir, fileName, service.getName(), synapseConfig.getArtifactDeploymentStore()); } File proxyFile = new File(proxyDir, fileName); writeToFile(proxyElem, proxyFile); } else if (parent != null) { parent.addChild(proxyElem); } return proxyElem; }
public OMElement serializeProxy(ProxyService service, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File proxyDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR); OMElement proxyElem = ProxyServiceSerializer.serializeProxy(null, service); String fileName = service.getFileName(); if (fileName != null) { if (currentDirectory == rootDirectory) { handleDeployment(proxyDir, fileName, service.getName(), synapseConfig.getArtifactDeploymentStore()); } File proxyFile = new File(proxyDir, fileName); writeToFile(proxyElem, proxyFile); } else if (parent != null) { parent.addChild(proxyElem); } return proxyElem; }
@Override public void proxyServiceAdded(ProxyService proxy) { ArtifactHolder holder = new ArtifactHolder(); holder.setParent(proxy.getName()); proxy.setComponentStatisticsId(holder); proxy.getAspectConfiguration().setHashCode(holder.getHashCodeAsString()); StatisticIdentityGenerator.conclude(holder); }
/** * Stop the proxy service * @param synCfg the synapse configuration */ public void stop(SynapseConfiguration synCfg) { AxisConfiguration axisConfig = synCfg.getAxisConfiguration(); if (axisConfig != null) { AxisService as = axisConfig.getServiceForActivation(this.getName()); //If an active AxisService is found if (as != null) { if (as.isActive()) { as.setActive(false); } axisConfig.notifyObservers(new AxisEvent(AxisEvent.SERVICE_STOP, as), as); } this.setRunning(false); auditInfo("Stopped the proxy service : " + name); } else { auditWarn("Unable to stop proxy service : " + name + ". Couldn't access Axis configuration"); } }
/** * Test serializeConfigurationMethod with proxyServices added for SynapseConfiguration and assert OMElement returned */ @Test public void testSerializeConfiguration4() { SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer(); SynapseConfiguration synapseConfiguration = new SynapseConfiguration(); ProxyService proxyService = new ProxyService("testProxyService"); synapseConfiguration.addProxyService(proxyService.getName(), proxyService); OMElement element = serializer.serializeConfiguration(synapseConfiguration); Assert.assertNotNull("OMElement is not returned", element); Assert.assertEquals("definitions", element.getLocalName()); Assert.assertTrue("ProxyService added is not serialized.", element.getChildren().next(). toString().contains("name=\"testProxyService\"")); }
/** * Test serializeSynapseXML method with proxyServices added for SynapseConfiguration and * assert synapse.xml is created. */ @Test public void testSerializeSynapseXML3() throws Exception { MultiXMLConfigurationSerializer serializer = new MultiXMLConfigurationSerializer(TEST_DIRECTORY_NAME); SynapseConfiguration configuration = new SynapseConfiguration(); configuration.setTaskManager(new QuartzTaskManager()); ProxyService proxyService = new ProxyService("testProxyService"); configuration.addProxyService(proxyService.getName(), proxyService); serializer.serializeSynapseXML(configuration); Assert.assertTrue("Error in serializing Synapse configuration.", new File(TEST_DIRECTORY_NAME + File.separator + SYNAPSE_XML).exists()); removeTestFolder(TEST_DIRECTORY_NAME); }
public void testDebugManagerProcessCommandSetSkipProxyInSequence() throws Exception { ProxyService ps = new ProxyService("test_proxy_5"); TestMediator in1 = new TestMediator(); TestMediator in2 = new TestMediator(); TestMediator in3 = new TestMediator(); SequenceMediator inSeq = new SequenceMediator(); inSeq.addChild(in1); inSeq.addChild(in2); inSeq.addChild(in3); TestMediator out1 = new TestMediator(); TestMediator out2 = new TestMediator(); TestMediator out3 = new TestMediator(); SequenceMediator outSeq = new SequenceMediator(); outSeq.addChild(out1); outSeq.addChild(out2); outSeq.addChild(out3); ps.setTargetInLineInSequence(inSeq); ps.setTargetInLineOutSequence(inSeq); synConfig.addProxyService(ps.getName(), ps); String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_5\",\"sequence-type\":\"proxy_inseq\"," + "\"mediator-position\":\"0\"}}}"; dm.processDebugCommand(debug_command); assertTrue(((AbstractMediator) ps.getTargetInLineInSequence().getChild(0)).isSkipEnabled()); }
public void testDebugManagerProcessCommandSetSkipProxyOutSequence() throws Exception { ProxyService ps = new ProxyService("test_proxy_6"); TestMediator in1 = new TestMediator(); TestMediator in2 = new TestMediator(); TestMediator in3 = new TestMediator(); SequenceMediator inSeq = new SequenceMediator(); inSeq.addChild(in1); inSeq.addChild(in2); inSeq.addChild(in3); TestMediator out1 = new TestMediator(); TestMediator out2 = new TestMediator(); TestMediator out3 = new TestMediator(); SequenceMediator outSeq = new SequenceMediator(); outSeq.addChild(out1); outSeq.addChild(out2); outSeq.addChild(out3); ps.setTargetInLineInSequence(inSeq); ps.setTargetInLineOutSequence(inSeq); synConfig.addProxyService(ps.getName(), ps); String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_6\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}"; dm.processDebugCommand(debug_command); assertTrue(((AbstractMediator) ps.getTargetInLineOutSequence().getChild(0)).isSkipEnabled()); }