public static boolean isRunningSamplesMode() { return System.getProperty(ServiceBusConstants.ESB_SAMPLE_SYSTEM_PROPERTY) != null; }
private ServerContextInformation initESB( String configurationName, ConfigurationContext configurationContext) throws AxisFault { ServerConfigurationInformation configurationInformation = ServerConfigurationInformationFactory.createServerConfigurationInformation( configurationContext.getAxisConfiguration()); // ability to specify the SynapseServerName as a system property if (System.getProperty("SynapseServerName") != null) { configurationInformation.setServerName(System.getProperty("SynapseServerName")); } // for now we override the default configuration location with the value in registry String repoPath = configurationContext.getAxisConfiguration().getRepository().getPath(); configurationInformation.setSynapseXMLLocation( repoPath + File.separator + ServiceBusConstants.SYNAPSE_CONFIGS + File.separator + configurationName); configurationInformation.setCreateNewInstance(false); configurationInformation.setServerControllerProvider(CarbonSynapseController.class.getName()); if (isRunningSamplesMode()) { configurationInformation.setSynapseXMLLocation( "repository" + File.separator + "samples" + File.separator + "synapse_sample_" + System.getProperty(ServiceBusConstants.ESB_SAMPLE_SYSTEM_PROPERTY) + ".xml"); } ServerManager serverManager = new ServerManager(); ServerContextInformation contextInfo = new ServerContextInformation(configurationContext, configurationInformation); /*if (dataSourceInformationRepositoryService != null) { DataSourceInformationRepository repository = dataSourceInformationRepositoryService.getDataSourceInformationRepository(); contextInfo.addProperty(DataSourceConstants.DATA_SOURCE_INFORMATION_REPOSITORY, repository); }*/ TaskScheduler scheduler; if (configurationContext.getProperty(ServiceBusConstants.CARBON_TASK_SCHEDULER) == null) { scheduler = new TaskScheduler(TaskConstants.TASK_SCHEDULER); configurationContext.setProperty(ServiceBusConstants.CARBON_TASK_SCHEDULER, scheduler); } else { scheduler = (TaskScheduler) configurationContext.getProperty(ServiceBusConstants.CARBON_TASK_SCHEDULER); } contextInfo.addProperty(TaskConstants.TASK_SCHEDULER, scheduler); TaskDescriptionRepository repository; if (configurationContext.getProperty(ServiceBusConstants.CARBON_TASK_REPOSITORY) == null) { repository = new TaskDescriptionRepository(); configurationContext.setProperty(ServiceBusConstants.CARBON_TASK_REPOSITORY, repository); } else { repository = (TaskDescriptionRepository) configurationContext.getProperty(ServiceBusConstants.CARBON_TASK_REPOSITORY); } contextInfo.addProperty(TaskConstants.TASK_DESCRIPTION_REPOSITORY, repository); /* if (secretCallbackHandlerService != null) { contextInfo.addProperty(SecurityConstants.PROP_SECRET_CALLBACK_HANDLER, secretCallbackHandlerService.getSecretCallbackHandler()); }*/ AxisConfiguration axisConf = configurationContext.getAxisConfiguration(); axisConf.addParameter( new Parameter(ServiceBusConstants.SYNAPSE_CURRENT_CONFIGURATION, configurationName)); serverManager.init(configurationInformation, contextInfo); serverManager.start(); AxisServiceGroup serviceGroup = axisConf.getServiceGroup(SynapseConstants.SYNAPSE_SERVICE_NAME); serviceGroup.addParameter("hiddenService", "true"); addDeployers(configurationContext); return contextInfo; }