Java Code Examples for org.apache.synapse.config.xml.MultiXMLConfigurationBuilder#ENDPOINTS_DIR

The following examples show how to use org.apache.synapse.config.xml.MultiXMLConfigurationBuilder#ENDPOINTS_DIR . 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: LoadBalancerServiceComponent.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
/**
 * Un-registers the Endpoint deployer.
 *
 * @param axisConfig         AxisConfiguration to which this deployer belongs
 * @param synapseEnvironment SynapseEnvironment to which this deployer belongs
 */
private void unregisterDeployer(AxisConfiguration axisConfig,
                                SynapseEnvironment synapseEnvironment)
        throws TenantAwareLoadBalanceEndpointException {
    if (axisConfig != null) {
        DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig
                .getConfigurator();
        String synapseConfigPath = ServiceBusUtils
                .getSynapseConfigAbsPath(synapseEnvironment
                        .getServerContextInformation());
        String endpointDirPath = synapseConfigPath + File.separator
                + MultiXMLConfigurationBuilder.ENDPOINTS_DIR;
        deploymentEngine.removeDeployer(endpointDirPath,
                ServiceBusConstants.ARTIFACT_EXTENSION);
    }
}
 
Example 2
Source File: LoadBalancerServiceComponent.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
/**
 * 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 3
Source File: EndpointStore.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"ResultOfMethodCallIgnored"})
protected void deleteFile(String fileName, SynapseConfiguration synapseConfiguration) {
    File endpointsDir = new File(configPath, MultiXMLConfigurationBuilder.ENDPOINTS_DIR);
    if (!endpointsDir.exists()) {
        return;
    }
    File endpointFile = new File(endpointsDir, fileName);
    synapseConfiguration.getArtifactDeploymentStore().addBackedUpArtifact(
            endpointFile.getAbsolutePath());
    endpointFile.delete();
}
 
Example 4
Source File: EndpointPersistenceTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void testEndpointPersistence() throws IOException {
    System.out.println("Starting endpoint persistence test...");

    String fileName = "epr1.xml";
    InputStream in = getClass().getClassLoader().getResourceAsStream(fileName);
    Endpoint endpoint = createEndpoint(in);
    in.close();
    endpoint.setFileName(fileName);
    synapseConfigSvc.getSynapseConfiguration().addEndpoint(endpoint.getName(), endpoint);
    getMediationPersistenceManager().saveItem(endpoint.getName(),
            ServiceBusConstants.ITEM_TYPE_ENDPOINT);
    System.out.println("Added new endpoint : " + endpoint.getName());
    checkSavedEndpoint(endpoint);

    if (endpoint instanceof AddressEndpoint) {
        ((AddressEndpoint) endpoint).getDefinition().setAddress("http://wso2.org/services/Foo");
        getMediationPersistenceManager().saveItem(endpoint.getName(),
                ServiceBusConstants.ITEM_TYPE_ENDPOINT);
        System.out.println("Updated endpoint : " + endpoint.getName());
        checkSavedEndpoint(endpoint);
    }

    synapseConfigSvc.getSynapseConfiguration().removeEndpoint(endpoint.getName());
    getMediationPersistenceManager().deleteItem(endpoint.getName(), fileName,
            ServiceBusConstants.ITEM_TYPE_ENDPOINT);
    System.out.println("Endpoint : " + endpoint.getName() + " removed");
    hold();

    File file = new File(path + File.separator +
            MultiXMLConfigurationBuilder.ENDPOINTS_DIR, fileName);
    if (file.exists()) {
        fail("The file : " + fileName + " has not been deleted");
    }
    System.out.println("Endpoint file : " + fileName + " deleted successfully");

    checkSynapseXMLPersistence();

    System.out.println("Endpoint persistence test completed successfully...");
}