Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-17153 : Initial implem. of IPropertiesProvider #257

Closed
wants to merge 1 commit into from
Closed

JBIDE-17153 : Initial implem. of IPropertiesProvider #257

wants to merge 1 commit into from

Conversation

fbricon
Copy link
Member

@fbricon fbricon commented Apr 22, 2014

New IPropertiesProvider and its implementation
(VersionPropertiesProvider) reading IDE -wide properties from remote
resource bundle.

Provides properties depending on the context (project/product) it's
invoked in and the version of the context. Context and version are defined
by the current VersionPropertiesProvider instance.

Competing implementations can be found in the extension registry
(com.jboss.devstudio.core.central provides one implementation). The
provider with the highest priority will take precedence globally.

Consumers are expected to use :

org.jboss.tools.foundation.core.properties.PropertiesHelper.getPropertiesProvider()

Key/Value pairs are expected to be stored using the
key|context|version=value format.

If an exact matching version is not found for the requested key, the
properties provider will try to fall back to parent versions.

The version is provided by a locally Maven-filtered file
(currentversion.properties)

So, for instance, if the key 'foo' is requested in a VersionPropertiesProvider
provided by JBDS 8.0.0.Beta2-123456-65432 then :

It will return bar if foo|devstudio|8.0.0.Beta2=bar is set.

  • If no matching key/version is defined, then foo|devstudio|8.0.0 would be
    queried,
  • then foo|devstudio|8.0,
  • then foo|devstudio|8,
  • then foo|devstudio,
  • then foo.

Properties are retrieved from a URI
(http://download.jboss.org/jbosstools/configuration/ide-config.properties
by default). This URI can be overridden using the
org.jboss.tools.foundation.core.config.properties.url VM argument. For
instance, to test a local properties file, the following argument needs to
be added to the JVM

-Dorg.jboss.tools.foundation.core.config.properties.url=file://path/to/resource.properties

Additionally, the org.jboss.tools.foundation.core.test plugin was turned into a
fragment, so we can test package visible methods.

Signed-off-by: Fred Bricon fbricon@gmail.com

try {
priority = Integer.valueOf(element.getAttribute("priority"));
} catch (NumberFormatException nfe) {
//log nfe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that you missed that logging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup thanks

New IPropertiesProvider and its implementation
(VersionPropertiesProvider) reading IDE -wide properties from remote
resource bundle.

Provides properties depending on the context (project/product) it's
invoked in and the version of the context. Context and version are defined
by the current VersionPropertiesProvider instance.

Competing implementations can be found in the extension registry
(com.jboss.devstudio.core.central provides one implementation). The
provider with the highest priority will take precedence globally.

Consumers are expected to use :

   org.jboss.tools.foundation.core.properties.PropertiesHelper.getPropertiesProvider()

Key/Value pairs are expected to be stored using the
key|context|version=value format.

If an exact matching version is not found for the requested key, the
properties provider will try to fall back to parent versions.

The version is provided by a locally Maven-filtered file
(currentversion.properties)

So, for instance, if the key 'foo' is requested in a VersionPropertiesProvider
provided by JBDS 8.0.0.Beta2-123456-65432 then :

It will return bar if foo|devstudio|8.0.0.Beta2=bar is set.

* If no matching key/version is defined, then foo|devstudio|8.0.0 would be
queried,
* then foo|devstudio|8.0,
* then foo|devstudio|8,
* then foo|devstudio,
* then foo.

Properties are retrieved from a URI
(http://download.jboss.org/jbosstools/configuration/ide-config.properties
by default). This URI can be overridden using the
org.jboss.tools.foundation.core.config.properties.url VM argument. For
instance, to test a local properties file, the following argument needs to
be added to the JVM

In case the remote URI can not be accessed, the properties provider falls
back on a copy of that remote file embedded in the foundation core plugin.

-Dorg.jboss.tools.foundation.core.config.properties.url=file://path/to/resource.properties

Additionally, the org.jboss.tools.foundation.core.test plugin was turned into a
fragment, so we can test package visible methods.

Signed-off-by: Fred Bricon <fbricon@gmail.com>
@fbricon
Copy link
Member Author

fbricon commented May 15, 2014

Updated PR with :

  • simpler API (no CoreException, monitors)
  • highest priority means highest priority
  • falls back on a default embedded properties in case the remote URL can't be accessed

@fbricon
Copy link
Member Author

fbricon commented May 16, 2014

Applied in master

@fbricon fbricon closed this May 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants