brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Active partial rebind allowing ca...
Date Mon, 09 Feb 2015 10:59:11 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/506#discussion_r24320820
  
    --- Diff: core/src/main/java/brooklyn/BrooklynVersion.java ---
    @@ -19,80 +19,215 @@
     package brooklyn;
     
     import static com.google.common.base.Preconditions.checkNotNull;
    -import static java.lang.String.format;
     
     import java.io.IOException;
     import java.io.InputStream;
    +import java.net.URL;
    +import java.util.Enumeration;
     import java.util.Properties;
    +import java.util.concurrent.atomic.AtomicReference;
    +import java.util.jar.Attributes;
    +
    +import javax.annotation.Nullable;
     
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    +import brooklyn.util.exceptions.Exceptions;
    +import brooklyn.util.osgi.Osgis;
    +import brooklyn.util.osgi.Osgis.ManifestHelper;
    +import brooklyn.util.text.Strings;
    +
    +/**
    + * Wraps the version of Brooklyn.
    + * <p>
    + * Also retrieves the SHA-1 from any OSGi bundle, and checks that the maven and osgi
versions match.
    + */
     public class BrooklynVersion {
     
       private static final Logger log = LoggerFactory.getLogger(BrooklynVersion.class);
       
    -  private static final String VERSION_RESOURCE_FILE = "META-INF/maven/io.brooklyn/brooklyn-core/pom.properties";
    -  private static final String VERSION_PROPERTY_NAME = "version";
    +  private static final String MVN_VERSION_RESOURCE_FILE = "META-INF/maven/org.apache.brooklyn/brooklyn-core/pom.properties";
    +  private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF";
    +  private static final String BROOKLYN_CORE_SYMBOLIC_NAME = "org.apache.brooklyn.core";
    +  
    +  private static final String MVN_VERSION_PROPERTY_NAME = "version";
    +  private static final String OSGI_VERSION_PROPERTY_NAME = Attributes.Name.IMPLEMENTATION_VERSION.toString();
    +  private static final String OSGI_SHA1_PROPERTY_NAME = "Implementation-SHA-1";
    +
     
    +  private final static String VERSION_FROM_STATIC = "0.7.0-SNAPSHOT"; // BROOKLYN_VERSION
    +  private static final AtomicReference<Boolean> IS_DEV_ENV = new AtomicReference<Boolean>();
    +  
       public static final BrooklynVersion INSTANCE = new BrooklynVersion();
    +  
    +  private final Properties versionProperties = new Properties();
    +  
    +  public BrooklynVersion() {
    +      // we read the maven pom metadata and osgi metadata and make sure it's sensible
    +      // everything is put into a single map for now (good enough, but should be cleaned
up)
    +      readPropertiesFromMavenResource(BrooklynVersion.class.getClassLoader());
    +      readPropertiesFromOsgiResource(BrooklynVersion.class.getClassLoader(), "org.apache.brooklyn.core");
    --- End diff --
    
    Use constant `BROOKLYN_CORE_SYMBOLIC_NAME`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message