org.apache.synapse.config.SynapseConfiguration Java Examples
The following examples show how to use
org.apache.synapse.config.SynapseConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestUtils.java From carbon-apimgt with Apache License 2.0 | 6 votes |
public static MessageContext getMessageContext(String context, String version) { SynapseConfiguration synCfg = new SynapseConfiguration(); org.apache.axis2.context.MessageContext axisMsgCtx = new org.apache.axis2.context.MessageContext(); axisMsgCtx.setIncomingTransportName("http"); axisMsgCtx.setProperty(Constants.Configuration.TRANSPORT_IN_URL, "/test/1.0.0/search.atom"); AxisConfiguration axisConfig = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig); MessageContext synCtx = new Axis2MessageContext(axisMsgCtx, synCfg, new Axis2SynapseEnvironment(cfgCtx, synCfg)); synCtx.setProperty(RESTConstants.REST_API_CONTEXT, context); synCtx.setProperty(RESTConstants.SYNAPSE_REST_API_VERSION, version); Map map = new TreeMap(); map.put(X_FORWARDED_FOR, "127.0.0.1,1.10.0.4"); ((Axis2MessageContext) synCtx).getAxis2MessageContext() .setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, map); return synCtx; }
Example #2
Source File: SecureVaultLookupHandlerImpl.java From micro-integrator with Apache License 2.0 | 6 votes |
@Override public String evaluate(String aliasPasword, SecretSrcData secretSrcData, MessageContext synCtx) { SynapseConfiguration synapseConfiguration = synCtx.getConfiguration(); Map<String, Object> decryptedCacheMap = synapseConfiguration.getDecryptedCacheMap(); if (decryptedCacheMap.containsKey(aliasPasword)) { SecureVaultCacheContext cacheContext = (SecureVaultCacheContext) decryptedCacheMap.get(aliasPasword); if (cacheContext != null) { String cacheDurable = synCtx.getConfiguration().getRegistry().getConfigurationProperties().getProperty ("cachableDuration"); long cacheTime = (cacheDurable != null && !cacheDurable.isEmpty()) ? Long.parseLong(cacheDurable) : 10000; if ((cacheContext.getDateTime().getTime() + cacheTime) >= System.currentTimeMillis()) { // which means the given value between the cachable limit return cacheContext.getDecryptedValue(); } else { decryptedCacheMap.remove(aliasPasword); return vaultLookup(aliasPasword, secretSrcData, decryptedCacheMap); } } else { return vaultLookup(aliasPasword, secretSrcData, decryptedCacheMap); } } else { return vaultLookup(aliasPasword, secretSrcData, decryptedCacheMap); } }
Example #3
Source File: APIMgtLatencyStatsHandlerTest.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@Test public void handleResponse() throws Exception { PowerMockito.mockStatic(APIUtil.class); BDDMockito.given(APIUtil.isAnalyticsEnabled()).willReturn(true); SynapseConfiguration synCfg = new SynapseConfiguration(); org.apache.axis2.context.MessageContext axisMsgCtx = new org.apache.axis2.context.MessageContext(); AxisConfiguration axisConfig = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig); MessageContext synCtx = new Axis2MessageContext(axisMsgCtx, synCfg, new Axis2SynapseEnvironment(cfgCtx, synCfg)); synCtx.setProperty(APIMgtGatewayConstants.BACKEND_REQUEST_START_TIME, "123456789"); APIMgtLatencyStatsHandler apiMgtLatencyStatsHandler = new APIMgtLatencyStatsHandler(); apiMgtLatencyStatsHandler.handleResponse(synCtx); long backeEndLatencyTime = Long.parseLong(String.valueOf(synCtx.getProperty(APIMgtGatewayConstants .BACKEND_LATENCY))); Assert.assertTrue(backeEndLatencyTime <= System.currentTimeMillis()); Assert.assertTrue(Long.valueOf((Long) synCtx.getProperty(APIMgtGatewayConstants.BACKEND_REQUEST_END_TIME)) <= System.currentTimeMillis()); }
Example #4
Source File: StartupUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
private static void addStartup(OMElement startupElement, String fileName, boolean generateFileName, SynapseConfiguration synapseConfiguration, SynapseEnvironment synapseEnvironment) { SimpleQuartzFactory factory = new SimpleQuartzFactory(); Startup startup = factory.createStartup(startupElement); if (startup == null) { handleException("Startup is null"); } else { if (startup instanceof AbstractStartup) { if (generateFileName) { fileName = ServiceBusUtils.generateFileName((startup.getName())); } startup.setFileName(fileName); } synapseConfiguration.addStartup(startup); startup.init(synapseEnvironment); persistStartup(startup, synapseConfiguration.getAxisConfiguration()); if (log.isDebugEnabled()) { log.debug("Added Startup : " + startup + " from the configuration"); } } }
Example #5
Source File: StartupUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
public static void updateStartup(String name, OMElement taskElement, SynapseConfiguration synapseConfiguration, SynapseEnvironment synapseEnvironment) { Startup st = synapseConfiguration.getStartup(name); if (st == null) { log.warn("Cannot update the startup named: " + name + ", it doesn't exists in the SynapseConfiguration"); return; } String fileName = null; if (st instanceof AbstractStartup) { fileName = st.getFileName(); } deleteStartup(st.getName(), synapseConfiguration); addStartup(taskElement, fileName, false, synapseConfiguration, synapseEnvironment); }
Example #6
Source File: LoadBalancerServiceComponent.java From attic-stratos with Apache License 2.0 | 6 votes |
/** * Registers the Endpoint deployer. * * @param axisConfig AxisConfiguration to which this deployer belongs * @param synapseEnvironment SynapseEnvironment to which this deployer belongs */ private void registerDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) throws TenantAwareLoadBalanceEndpointException { SynapseConfiguration synCfg = synapseEnvironment .getSynapseConfiguration(); DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig .getConfigurator(); SynapseArtifactDeploymentStore deploymentStore = synCfg .getArtifactDeploymentStore(); String synapseConfigPath = ServiceBusUtils .getSynapseConfigAbsPath(synapseEnvironment .getServerContextInformation()); String endpointDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.ENDPOINTS_DIR; for (Endpoint ep : synCfg.getDefinedEndpoints().values()) { if (ep.getFileName() != null) { deploymentStore.addRestoredArtifact(endpointDirPath + File.separator + ep.getFileName()); } } deploymentEngine.addDeployer(new EndpointDeployer(), endpointDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); }
Example #7
Source File: RequestCountResource.java From micro-integrator with Apache License 2.0 | 6 votes |
@Override public boolean invoke(MessageContext synCtx, org.apache.axis2.context.MessageContext axis2MessageContext, SynapseConfiguration synapseConfiguration) { String pathParam = Utils.getPathParameter(synCtx, "param"); if ("count".equalsIgnoreCase(pathParam)) { String yearParameter = Utils.getQueryParameter(synCtx, "year"); String monthParameter = Utils.getQueryParameter(synCtx, "month"); return handleTransactionCountCommand(axis2MessageContext, yearParameter, monthParameter); } else if ("report".equalsIgnoreCase(pathParam)) { String start = Utils.getQueryParameter(synCtx, "start"); String end = Utils.getQueryParameter(synCtx, "end"); return handleTransactionReportCommand(axis2MessageContext, start, end); } else { JSONObject response = Utils.createJsonError("No such resource as management/transactions/" + pathParam, axis2MessageContext, BAD_REQUEST); Utils.setJsonPayLoad(axis2MessageContext, response); return true; } }
Example #8
Source File: TemplateResource.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Creates a response json with all templates available in the synapse configuration * * @param axis2MessageContext AXIS2 message context * @param synapseConfiguration Synapse configuration object */ private void populateFullTemplateList(org.apache.axis2.context.MessageContext axis2MessageContext, SynapseConfiguration synapseConfiguration) { Map<String, Template> endpointTemplateMap = synapseConfiguration.getEndpointTemplates(); Map<String, TemplateMediator> sequenceTemplateMap = synapseConfiguration.getSequenceTemplates(); JSONObject jsonBody = new JSONObject(); JSONArray endpointTemplateList = new JSONArray(); JSONArray sequenceTemplateList = new JSONArray(); jsonBody.put(ENDPOINT_TEMPLATE_LIST, endpointTemplateList); jsonBody.put(SEQUENCE_TEMPLATE_LIST, sequenceTemplateList); endpointTemplateMap.forEach((key, value) -> addToJsonList(jsonBody.getJSONArray(ENDPOINT_TEMPLATE_LIST), value.getName())); sequenceTemplateMap.forEach((key, value) -> addToJsonList(jsonBody.getJSONArray(SEQUENCE_TEMPLATE_LIST), value.getName())); Utils.setJsonPayLoad(axis2MessageContext, jsonBody); }
Example #9
Source File: TemplateResource.java From micro-integrator with Apache License 2.0 | 6 votes |
@Override public boolean invoke(MessageContext messageContext) { org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); SynapseConfiguration synapseConfiguration = messageContext.getConfiguration(); if (Objects.isNull(axis2MessageContext) || Objects.isNull(synapseConfiguration)) { return false; } String templateTypeParam = Utils.getQueryParameter(messageContext, TEMPLATE_TYPE_PARAM); if (Objects.nonNull(templateTypeParam)) { String templateNameParam = Utils.getQueryParameter(messageContext, TEMPLATE_NAME_PARAM); if (Objects.nonNull(templateNameParam)) { populateTemplateData(messageContext, templateNameParam, templateTypeParam); } else { populateTemplateListByType(messageContext, templateTypeParam); } } else { populateFullTemplateList(axis2MessageContext, synapseConfiguration); } axis2MessageContext.removeProperty(Constants.NO_ENTITY_BODY); return true; }
Example #10
Source File: TaskResource.java From micro-integrator with Apache License 2.0 | 6 votes |
private void populateTasksList(MessageContext messageContext) { org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); SynapseConfiguration configuration = messageContext.getConfiguration(); Collection<Startup> tasks = configuration.getStartups(); JSONObject jsonBody = Utils.createJSONList(tasks.size()); for (Startup task : tasks) { JSONObject taskObject = new JSONObject(); taskObject.put(Constants.NAME, task.getName()); jsonBody.getJSONArray(Constants.LIST).put(taskObject); } Utils.setJsonPayLoad(axis2MessageContext, jsonBody); }
Example #11
Source File: DataServiceResource.java From micro-integrator with Apache License 2.0 | 6 votes |
private void populateDataServiceList(MessageContext msgCtx) throws Exception { SynapseConfiguration configuration = msgCtx.getConfiguration(); AxisConfiguration axisConfiguration = configuration.getAxisConfiguration(); String[] dataServicesNames = DBUtils.getAvailableDS(axisConfiguration); // initiate list model DataServicesList dataServicesList = new DataServicesList(dataServicesNames.length); for (String dataServiceName : dataServicesNames) { DataService dataService = getDataServiceByName(msgCtx, dataServiceName); ServiceMetaData serviceMetaData = getServiceMetaData(dataService); // initiate summary model DataServiceSummary summary = null; if (serviceMetaData != null) { summary = new DataServiceSummary(serviceMetaData.getName(), serviceMetaData.getWsdlURLs()); } dataServicesList.addServiceSummary(summary); } org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) msgCtx) .getAxis2MessageContext(); String stringPayload = new Gson().toJson(dataServicesList); Utils.setJsonPayLoad(axis2MessageContext, new JSONObject(stringPayload)); }
Example #12
Source File: AbstractStore.java From micro-integrator with Apache License 2.0 | 6 votes |
public void delete(String name, String fileName, SynapseConfiguration config) { if (fileName == null) { // This is an element declared in the top level synapse.xml file // So we need to rewrite the entire synapse.xml file try { serializer.serializeSynapseXML(config); } catch (Exception e) { handleException("Error while saving the mediation configuration to " + "the file system", e); } } else { // This is an element declared in its own file // Just delete the file deleteFile(fileName, config); } }
Example #13
Source File: LogoutResource.java From micro-integrator with Apache License 2.0 | 6 votes |
@Override public boolean invoke(MessageContext messageContext, org.apache.axis2.context.MessageContext axis2MessageContext, SynapseConfiguration synapseConfiguration) { if (!JWTConfig.getInstance().getJwtConfigDto().isJwtHandlerEngaged()) { LOG.error("/Logout is accessible only when JWT based auth handler is engaged"); handleServerError(axis2MessageContext, "Logout is accessible only when JWT based auth handler is engaged"); return true; } String authHeader = (String) SecurityUtils.getHeaders(axis2MessageContext).get(HTTPConstants.HEADER_AUTHORIZATION); String token = authHeader.substring(AuthConstants.BEARER_AUTH_HEADER_TOKEN_TYPE.length() + 1).trim(); //Revokes token when logging out. if (!JWTInMemoryTokenStore.getInstance().revokeToken(token)) { LOG.error("Log out failed"); handleServerError(axis2MessageContext, "Log out failed due to incorrect credentials"); return true; } return true; }
Example #14
Source File: EndpointResource.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Changes the endpoint state based on json payload. * * @param axis2MessageContext Axis2Message context * @param configuration Synapse configuration * @param payload Request json payload */ private void changeEndpointStatus(org.apache.axis2.context.MessageContext axis2MessageContext, SynapseConfiguration configuration, JsonObject payload) { String endpointName = payload.get(NAME).getAsString(); String status = payload.get(STATUS).getAsString(); Endpoint ep = configuration.getEndpoint(endpointName); if (ep != null) { JSONObject jsonResponse = new JSONObject(); if (INACTIVE_STATUS.equalsIgnoreCase(status)) { ep.getContext().switchOff(); jsonResponse.put(Constants.MESSAGE_JSON_ATTRIBUTE, endpointName + " is switched Off"); } else if (ACTIVE_STATUS.equalsIgnoreCase(status)) { ep.getContext().switchOn(); jsonResponse.put(Constants.MESSAGE_JSON_ATTRIBUTE, endpointName + " is switched On"); } else { jsonResponse = Utils.createJsonError("Provided state is not valid", axis2MessageContext, Constants.BAD_REQUEST); } Utils.setJsonPayLoad(axis2MessageContext, jsonResponse); } else { Utils.setJsonPayLoad(axis2MessageContext, Utils.createJsonError("Endpoint does not exist", axis2MessageContext, Constants.NOT_FOUND)); } }
Example #15
Source File: SynapseAppDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * * Undeploy the local entries deployed from the lib * * @param axisConfig AxisConfiguration of the current tenant * */ private void undeployingLocalEntries(Library library, SynapseConfiguration config, AxisConfiguration axisConfig) { if (log.isDebugEnabled()) { log.debug("Start : Removing Local registry entries from the configuration"); } for (Map.Entry<String, Object> libararyEntryMap : library.getLocalEntryArtifacts() .entrySet()) { File localEntryFileObj = (File) libararyEntryMap.getValue(); OMElement document = LocalEntryUtil.getOMElement(localEntryFileObj); deleteEntry(document.toString(), axisConfig); } if (log.isDebugEnabled()) { log.debug("End : Removing Local registry entries from the configuration"); } }
Example #16
Source File: EventSourceStore.java From micro-integrator with Apache License 2.0 | 5 votes |
@SuppressWarnings({"ResultOfMethodCallIgnored"}) protected void deleteFile(String fileName, SynapseConfiguration synapseConfiguration) { File eventsDir = new File(configPath, MultiXMLConfigurationBuilder.EVENTS_DIR); if (!eventsDir.exists()) { return; } File eventFile = new File(eventsDir, fileName); synapseConfiguration.getArtifactDeploymentStore().addBackedUpArtifact( eventFile.getAbsolutePath()); eventFile.delete(); }
Example #17
Source File: MessageProcessorStore.java From micro-integrator with Apache License 2.0 | 5 votes |
@Override protected OMElement saveToFile(MessageProcessor processor, SynapseConfiguration synapseConfig) { try { return serializer.serializeMessageProcessor(processor, synapseConfig, null); } catch (Exception e) { handleException("Error while saving the Message Processr: " + processor.getName() + " to " + "the file system", e); } return null; }
Example #18
Source File: ImportStore.java From micro-integrator with Apache License 2.0 | 5 votes |
@SuppressWarnings({"ResultOfMethodCallIgnored"}) protected void deleteFile(String fileName, SynapseConfiguration synapseConfiguration) { File importsDirectory = new File(configPath, MultiXMLConfigurationBuilder.SYNAPSE_IMPORTS_DIR); if (!importsDirectory.exists()) { return; } File importFile = new File(importsDirectory, fileName); synapseConfiguration.getArtifactDeploymentStore().addBackedUpArtifact( importFile.getAbsolutePath()); importFile.delete(); }
Example #19
Source File: ProxyServiceStore.java From micro-integrator with Apache License 2.0 | 5 votes |
protected OMElement saveToFile(ProxyService proxy, SynapseConfiguration synapseConfiguration) { try { return serializer.serializeProxy(proxy, synapseConfiguration, null); } catch (Exception e) { handleException("Error while saving the proxy service: " + proxy.getName() + " to " + "the file system", e); } return null; }
Example #20
Source File: APIManagerExtensionHandlerTest.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Test public void testHandleRequestWithGlobalInSeqWithoutFurtherMediationAndCustomInSeq() { MessageContext messageContext = Mockito.mock(Axis2MessageContext.class); SynapseConfiguration synapseConfig = Mockito.mock(SynapseConfiguration.class); org.apache.axis2.context.MessageContext axis2MsgCntxt = Mockito .mock(org.apache.axis2.context.MessageContext.class); Map localRegistry = Mockito.mock(Map.class); Mockito.when(((Axis2MessageContext) messageContext).getAxis2MessageContext()).thenReturn(axis2MsgCntxt); Mockito.when(((Axis2MessageContext) messageContext).getConfiguration()).thenReturn(synapseConfig); Mockito.when(synapseConfig.getLocalRegistry()).thenReturn(localRegistry); Mockito.when(messageContext.getProperty(RESTConstants.SYNAPSE_REST_API)).thenReturn(API_NAME); SequenceMediator inSeq = Mockito.mock(SequenceMediator.class); SequenceMediator globalInSeq = Mockito.mock(SequenceMediator.class); Mockito.when(localRegistry.get(API_NAME + "--" + DIRECTION_IN)).thenReturn(inSeq); Mockito.when(localRegistry.get(EXT_SEQUENCE_PREFIX + DIRECTION_IN)).thenReturn(globalInSeq); Mockito.when(((Mediator) inSeq).mediate(messageContext)).thenReturn(true); //Global mediation returns a false to prevent any further mediation Mockito.when(((Mediator) globalInSeq).mediate(messageContext)).thenReturn(false); APIManagerExtensionHandler handler = createAPIManagerExtensionHandler(); // both methods are executed during a full request path handler.handleRequest(messageContext); handler.handleResponse(messageContext); // check whether custom in sequnce is not executed Mockito.verify(inSeq, Mockito.never()).mediate(messageContext); // check whether global in sequnce is executed once Mockito.verify(globalInSeq, Mockito.times(1)).mediate(messageContext); }
Example #21
Source File: ImportStore.java From micro-integrator with Apache License 2.0 | 5 votes |
protected OMElement saveToFile(SynapseImport synImport, SynapseConfiguration synapseConfig) { try { return serializer.serializeImport(synImport, synapseConfig, null); } catch (Exception e) { handleException("Error while saving the API: " + synImport.getName() + " to the " + "file system", e); } return null; }
Example #22
Source File: MessageProcessorResource.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Create a JSON response with all available message processors. * * @param messageContext synapse message context */ private void populateMessageProcessorList(MessageContext messageContext) { org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); SynapseConfiguration synapseConfiguration = messageContext.getConfiguration(); Map<String, MessageProcessor> processorMap = synapseConfiguration.getMessageProcessors(); JSONObject jsonBody = Utils.createJSONList(processorMap.size()); processorMap.forEach((key, value) -> addToJSONList(value, jsonBody.getJSONArray(Constants.LIST))); Utils.setJsonPayLoad(axis2MessageContext, jsonBody); }
Example #23
Source File: SynapseConfigurationServiceImpl.java From micro-integrator with Apache License 2.0 | 5 votes |
public SynapseConfigurationServiceImpl(SynapseConfiguration synapseConfiguration, int tenantId, ConfigurationContext configurationContext) { this.synapseConfiguration = synapseConfiguration; this.tenantId = tenantId; this.configurationContext = configurationContext; }
Example #24
Source File: InboundStore.java From micro-integrator with Apache License 2.0 | 5 votes |
@SuppressWarnings({"ResultOfMethodCallIgnored"}) protected void deleteFile(String fileName, SynapseConfiguration synapseConfiguration) { File inboundDir = new File(configPath, MultiXMLConfigurationBuilder.INBOUND_ENDPOINT_DIR); if (!inboundDir.exists()) { return; } File inboundFile = new File(inboundDir, fileName); synapseConfiguration.getArtifactDeploymentStore().addBackedUpArtifact(inboundFile.getAbsolutePath()); inboundFile.delete(); }
Example #25
Source File: AbstractStore.java From micro-integrator with Apache License 2.0 | 5 votes |
public void save(String name, SynapseConfiguration config) { if (name == null) { log.warn("Name of the configuration item to be saved is not given"); return; } T obj = getObjectToPersist(name, config); if (obj == null) { log.warn("Unable to find the item: " + name + " for persistence"); return; } String fileName = getFileName(obj); if (fileName == null) { // This is an element declared in the top level synapse.xml file // So we need to rewrite the entire synapse.xml file try { serializer.serializeSynapseXML(config); } catch (Exception e) { handleException("Error while saving the mediation configuration to " + "the file system", e); } } else { // This is an element declared in its own file // Just write the content to the file saveToFile(obj, config); } }
Example #26
Source File: EndpointResource.java From micro-integrator with Apache License 2.0 | 5 votes |
private void populateEndpointList(MessageContext messageContext, SynapseConfiguration configuration) { org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); Map<String, Endpoint> namedEndpointMap = configuration.getDefinedEndpoints(); Collection<Endpoint> namedEndpointCollection = namedEndpointMap.values(); JSONObject jsonBody = Utils.createJSONList(namedEndpointCollection.size()); for (Endpoint ep : namedEndpointCollection) { JSONObject endpointObject = new JSONObject(); String epName = ep.getName(); endpointObject.put(Constants.NAME, epName); OMElement element = EndpointSerializer.getElementFromEndpoint(ep); OMElement firstElement = element.getFirstElement(); String type; // For template endpoints the endpoint type can not be retrieved from firstElement if (firstElement == null) { type = element.getAttribute(new QName("template")).getLocalName(); } else { type = firstElement.getLocalName(); } endpointObject.put(Constants.TYPE, type); endpointObject.put(IS_ACTIVE, isEndpointActive(ep)); jsonBody.getJSONArray(Constants.LIST).put(endpointObject); } Utils.setJsonPayLoad(axis2MessageContext, jsonBody); }
Example #27
Source File: EndpointTemplateStore.java From micro-integrator with Apache License 2.0 | 5 votes |
protected OMElement saveToFile(Template template, SynapseConfiguration synapseConfig) { try { return serializer.serializeTemplate(template, synapseConfig, null) ; } catch (Exception e) { handleException("Error while saving the template: " + template.getName() + " to the " + "file system", e); } return null; }
Example #28
Source File: MediationPersistenceManager.java From micro-integrator with Apache License 2.0 | 5 votes |
@SuppressWarnings({"ResultOfMethodCallIgnored"}) private void saveToFlatFile(SynapseConfiguration config) throws IOException, XMLStreamException { File outputFile = new File(configPath); if (!outputFile.exists()) { outputFile.createNewFile(); } FileOutputStream fos = new FileOutputStream(outputFile); XMLConfigurationSerializer.serializeConfiguration(config, fos); fos.flush(); fos.close(); }
Example #29
Source File: MetaDataResource.java From micro-integrator with Apache License 2.0 | 5 votes |
@Override public boolean invoke(MessageContext messageContext, org.apache.axis2.context.MessageContext axis2MessageContext, SynapseConfiguration synapseConfiguration) { populateMetaData(axis2MessageContext); axis2MessageContext.removeProperty(Constants.NO_ENTITY_BODY); return true; }
Example #30
Source File: MediationPersistenceManager.java From micro-integrator with Apache License 2.0 | 5 votes |
private void persistElement(SynapseConfiguration config, PersistenceRequest request) { if (request.subjectType == ServiceBusConstants.ITEM_TYPE_FULL_CONFIG) { saveFullConfiguration(config); } else { AbstractStore dataStore = dataStores.get(request.subjectType); dataStore.save(request.subjectId, config); } }