OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 182
Line 28... Line 28...
28
public class ProductInfo {
28
public class ProductInfo {
29
 
29
 
30
    public static final String PROPERTIES_NAME = "/product.properties";
30
    public static final String PROPERTIES_NAME = "/product.properties";
31
    public static final String ORGANIZATION_NAME = "ORGANIZATION_NAME";
31
    public static final String ORGANIZATION_NAME = "ORGANIZATION_NAME";
32
    public static final String ORGANIZATION_ID = "ORGANIZATION_ID";
32
    public static final String ORGANIZATION_ID = "ORGANIZATION_ID";
-
 
33
    // e.g. LibreOffice
33
    public static final String NAME = "NAME";
34
    public static final String NAME = "NAME";
34
    public static final String ID = "ID";
35
    public static final String ID = "ID";
35
    public static final String VERSION = "VERSION";
36
    public static final String VERSION = "VERSION";
-
 
37
    // Allow multiple end-user applications (e.g. icons) to share a product name, e.g. Writer
-
 
38
    public static final String LAUNCHER = "LAUNCHER";
36
 
39
 
37
    private static ProductInfo INSTANCE;
40
    private static ProductInfo INSTANCE;
38
 
41
 
39
    /**
42
    /**
40
     * If {@link #setInstance(ProductInfo)} was called with a non-null value, return that ;
43
     * If {@link #setInstance(ProductInfo)} was called with a non-null value, return that ;
Line 154... Line 157...
154
    public final String getFullID() {
157
    public final String getFullID() {
155
        final String orgID = this.getOrganizationID();
158
        final String orgID = this.getOrganizationID();
156
        return orgID == null ? null : orgID + '.' + this.getID();
159
        return orgID == null ? null : orgID + '.' + this.getID();
157
    }
160
    }
158
 
161
 
-
 
162
    public final String getLauncher() {
-
 
163
        return this.getProperty(LAUNCHER);
-
 
164
    }
-
 
165
 
-
 
166
    public final String getFullLauncherID() {
-
 
167
        final String launcher = this.getLauncher();
-
 
168
        final String fullID = this.getFullID();
-
 
169
        if (launcher == null || fullID == null)
-
 
170
            return fullID;
-
 
171
        return fullID + '-' + sanitizeDomainPart(launcher);
-
 
172
    }
-
 
173
 
159
    public final String getVersion() {
174
    public final String getVersion() {
160
        return this.getProperty(VERSION);
175
        return this.getProperty(VERSION);
161
    }
176
    }
162
 
177
 
163
    public final void store(final Path p) throws IOException {
178
    public final void store(final Path p) throws IOException {
164
        try (final OutputStream out = Files.newOutputStream(p)) {
179
        try (final OutputStream out = Files.newOutputStream(p)) {
165
            this.getProps().store(out, this.getClass().getName());
180
            store(out);
-
 
181
        }
166
        }
182
    }
-
 
183
 
-
 
184
    public final void store(final OutputStream out) throws IOException {
-
 
185
        this.getProps().store(out, this.getClass().getName());
167
    }
186
    }
168
 
187
 
169
    @Override
188
    @Override
170
    public String toString() {
189
    public String toString() {
171
        return this.getClass().getSimpleName() + " for " + getName() + " " + getVersion();
190
        return this.getClass().getSimpleName() + " for " + getName() + " " + getVersion();