Search in sources :

Example 6 with TopologyBuilder

use of org.apache.knox.gateway.topology.builder.TopologyBuilder in project knox by apache.

the class DefaultTopologyService method loadTopologyAttempt.

private Topology loadTopologyAttempt(File file) throws IOException, SAXException, URISyntaxException {
    Topology topology;
    Digester digester = digesterLoader.newDigester();
    TopologyBuilder topologyBuilder = digester.parse(FileUtils.openInputStream(file));
    if (null == topologyBuilder) {
        return null;
    }
    topology = topologyBuilder.build();
    topology.setUri(file.toURI());
    topology.setName(FilenameUtils.removeExtension(file.getName()));
    topology.setTimestamp(file.lastModified());
    return topology;
}
Also used : TopologyBuilder(org.apache.knox.gateway.topology.builder.TopologyBuilder) Digester(org.apache.commons.digester3.Digester) Topology(org.apache.knox.gateway.topology.Topology)

Aggregations

Digester (org.apache.commons.digester3.Digester)6 Topology (org.apache.knox.gateway.topology.Topology)6 TopologyBuilder (org.apache.knox.gateway.topology.builder.TopologyBuilder)6 File (java.io.File)5 URL (java.net.URL)5 Test (org.junit.Test)5 Provider (org.apache.knox.gateway.topology.Provider)4 Service (org.apache.knox.gateway.topology.Service)4 Version (org.apache.knox.gateway.topology.Version)2 Application (org.apache.knox.gateway.topology.Application)1