Java Code Examples for org.apache.synapse.config.SynapseConfiguration#getStartup()

The following examples show how to use org.apache.synapse.config.SynapseConfiguration#getStartup() . 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: StartupUtils.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
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 2
Source File: StartupUtils.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public static void deleteStartup(String name, SynapseConfiguration synapseConfiguration) {
	Startup st = synapseConfiguration.getStartup(name);
	if (st != null) {
		st.destroy();
		String fileName = null;
		if (st instanceof AbstractStartup) {
			fileName = st.getFileName();
		}
		synapseConfiguration.removeStartup(name);
		if(!Boolean.parseBoolean(System.getProperty("NonRegistryMode"))) {
			MediationPersistenceManager pm =
					ServiceBusUtils.getMediationPersistenceManager(synapseConfiguration.getAxisConfiguration());
			pm.deleteItem(name, fileName, ServiceBusConstants.ITEM_TYPE_TASK);
		}

	} else {
		log.warn("Cannot delete the startup named " + name + ", it doesn't exists in the SynapseConfiguration");
	}

	if (log.isDebugEnabled()) {
		log.debug("Deleted Startup : " + name + " from the configuration");
	}
}
 
Example 3
Source File: TaskResource.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private void populateTaskData(MessageContext messageContext, String taskName) {

        org.apache.axis2.context.MessageContext axis2MessageContext =
                ((Axis2MessageContext) messageContext).getAxis2MessageContext();

        SynapseConfiguration configuration = messageContext.getConfiguration();
        Startup task = configuration.getStartup(taskName);
        SynapseEnvironment synapseEnvironment =
                getSynapseEnvironment(axis2MessageContext.getConfigurationContext().getAxisConfiguration());
        TaskDescription description =
                synapseEnvironment.getTaskManager().getTaskDescriptionRepository().getTaskDescription(task.getName());
        JSONObject jsonBody = getTaskAsJson(description);


        if (Objects.nonNull(jsonBody)) {
            Utils.setJsonPayLoad(axis2MessageContext, jsonBody);
        } else {
            axis2MessageContext.setProperty(Constants.HTTP_STATUS_CODE, Constants.NOT_FOUND);
        }
    }
 
Example 4
Source File: StartupStore.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
protected Startup getObjectToPersist(String name, SynapseConfiguration config) {
    return config.getStartup(name);
}