Giter VIP home page Giter VIP logo

Comments (3)

tfr42 avatar tfr42 commented on August 12, 2024

relates to #1401

from deegree3.

tfr42 avatar tfr42 commented on August 12, 2024

The @Tool annotation is used in the following CLIs documented in #1386

from deegree3.

stephanr avatar stephanr commented on August 12, 2024

The org.reflections:reflections from OGCFrontController is related to the extraction of maven build information.

  • ConfigurationBuilder builder = new ConfigurationBuilder();
    builder = builder.setUrls(classpathURL);
    builder = builder.setScanners(new ResourcesScanner());
    Reflections r = new Reflections(builder);
    Set<String> resources = r.getResources(Pattern.compile("(MANIFEST\\.MF)"));
    if (!resources.isEmpty()) {
    URLClassLoader classLoader = new URLClassLoader(new URL[] { classpathURL }, null);
    String resourcePath = resources.iterator().next();
    InputStream buildInfoStream = null;
    try {
    Properties props = new Properties();
    buildInfoStream = classLoader.getResourceAsStream(resourcePath);
    props.load(buildInfoStream);
    String buildArtifactId = props.getProperty("deegree-build-artifactId",
    props.getProperty("build.artifactId"));
    if (buildArtifactId == null) {
    // skipping because this jar is not from deegree
    return null;
    }
    String buildBy = props.getProperty("deegree-build-by", props.getProperty("build.by"));
    String buildDate = props.getProperty("deegree-build-date", props.getProperty("build.date"));
    String buildRev = props.getProperty("deegree-build-rev", props.getProperty("build.svnrev"));
    String version = retrieveVersion(props, r, classLoader, buildArtifactId, classpathURL);
    return new ModuleInfo(buildArtifactId, version, buildRev, buildDate, buildBy);
    }
    finally {
    closeQuietly(buildInfoStream);
    }
    }
    return null;

In general, I would suggest removing the dependency on org.reflections:reflections.
The question remains whether we want to continue to retrieve build information from the deegree modules (jar) or not.

If we decide to keep these build information, an alternative could be to use java ServiceLoader:

  • Add a centralized Helper class using ServiceLoader to load all known subclasses
  • Define an abstract class containing the loading capabilities that require a class/class loader reference
  • Inject a dummy class in each module/jar implementing the abstract class which provides a local class/class loader reference
  • Define a service in each module/jar to this implementation (META-INF/services/xxxx)

from deegree3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.