EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.kernel.bo.common]

COVERAGE SUMMARY FOR SOURCE FILE [BasicKernel.java]

nameclass, %method, %block, %line, %
BasicKernel.java100% (2/2)93%  (14/15)91%  (90/99)90%  (19.8/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BasicKernel$LazyHolderTimeoutMethods100% (1/1)50%  (1/2)76%  (29/38)44%  (1.8/4)
BasicKernel$LazyHolderTimeoutMethods (): void 0%   (0/1)0%   (0/3)0%   (0/2)
<static initializer> 100% (1/1)83%  (29/35)88%  (1.8/2)
     
class BasicKernel100% (1/1)100% (13/13)100% (61/61)100% (18/18)
<static initializer> 100% (1/1)100% (19/19)100% (2/2)
BasicKernel (): void 100% (1/1)100% (3/3)100% (2/2)
getBuildId (): String 100% (1/1)100% (2/2)100% (1/1)
getBuildIdFromManifest (): String 100% (1/1)100% (17/17)100% (4/4)
getDedication (): String 100% (1/1)100% (2/2)100% (1/1)
getDescriptiveKernelVersion (): String 100% (1/1)100% (2/2)100% (1/1)
getKernelCodeName (): String 100% (1/1)100% (2/2)100% (1/1)
getKernelVersion (): String 100% (1/1)100% (2/2)100% (1/1)
getKernelVersionDirectory (): String 100% (1/1)100% (2/2)100% (1/1)
getMaximalRuleVersion (): String 100% (1/1)100% (2/2)100% (1/1)
isRuleVersionSupported (String): boolean 100% (1/1)100% (4/4)100% (1/1)
isSetConnectionTimeOutSupported (): boolean 100% (1/1)100% (2/2)100% (1/1)
isSetReadTimeoutSupported (): boolean 100% (1/1)100% (2/2)100% (1/1)

1/* This file is part of the project "Hilbert II" - http://www.qedeq.org
2 *
3 * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4 *
5 * "Hilbert II" is free software; you can redistribute
6 * it and/or modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15 
16package org.qedeq.kernel.bo.common;
17 
18import java.net.URLConnection;
19 
20import org.qedeq.base.utility.YodaUtility;
21 
22 
23/**
24 * This class provides basic informations about the kernel.
25 *
26 * @author  Michael Meyling
27 */
28public final class BasicKernel implements KernelProperties {
29 
30 
31    /** Version of this kernel. */
32    private static final String KERNEL_VERSION = "0.04.08";
33 
34    /** Version dependent directory of this kernel. */
35    private static final String KERNEL_VERSION_DIRECTORY = KERNEL_VERSION.replace('.', '_');
36 
37    /** Version code . */
38    private static final String KERNEL_CODE_NAME = "gaffsie";
39 
40    /** Kernel version dedication. */
41    private static final String KERNEL_DEDICATED
42        = "dedicated to Balsa, a spear woman and mercenary from Kanbal, the kingdom across the mountains.";
43 
44    /** Descriptive version information of this kernel. */
45    private static final String DESCRIPTIVE_KERNEL_VERSION
46        = "Hilbert II - Version " + KERNEL_VERSION + " (" + KERNEL_CODE_NAME + ") ["
47        + getBuildIdFromManifest() + "] " + KERNEL_DEDICATED;
48 
49    /** Maximal supported rule version of this kernel. */
50    private static final String MAXIMAL_RULE_VERSION = "1.01.00";
51 
52    /**
53     * Constructor.
54     */
55    public BasicKernel() {
56        // nothing to do
57    }
58 
59    /**
60     * Get build information from JAR manifest file. Is also non empty string if no manifest
61     * information is available.
62     *
63     * @return  Implementation-version.
64     */
65    private static String getBuildIdFromManifest() {
66        String build = BasicKernel.class.getPackage().getImplementationVersion();
67        if (build == null) {
68            build = "no regular build";
69        }
70        return build;
71    }
72 
73    public String getBuildId() {
74        return getBuildIdFromManifest();
75    }
76 
77    public final String getKernelVersion() {
78        return KERNEL_VERSION;
79    }
80 
81    public final String getKernelCodeName() {
82        return KERNEL_CODE_NAME;
83    }
84 
85    public final String getKernelVersionDirectory() {
86        return KERNEL_VERSION_DIRECTORY;
87    }
88 
89    public final String getDescriptiveKernelVersion() {
90        return DESCRIPTIVE_KERNEL_VERSION;
91    }
92 
93    public final String getDedication() {
94        return KERNEL_DEDICATED;
95    }
96 
97    public final String getMaximalRuleVersion() {
98        return MAXIMAL_RULE_VERSION;
99    }
100 
101    public final boolean isRuleVersionSupported(final String ruleVersion) {
102        // FIXME 20130113 m31: this must change if we really want to use it
103        return MAXIMAL_RULE_VERSION.equals(ruleVersion);
104    }
105 
106    /**
107     * This class ist just for solving the lazy loading problem thread save.
108     * see <a href="http://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom">
109     * Initialization_on_demand_holder_idiom</a>.
110     */
111    private static final class LazyHolderTimeoutMethods {
112 
113        /** Lazy initialized constant that knows about the existence of the method
114         * <code>URLConnection.setConnectTimeout</code>. This depends on the currently running
115         * JVM. */
116        private static final boolean IS_SET_CONNECTION_TIMEOUT_SUPPORTED = YodaUtility.existsMethod(
117            URLConnection.class, "setConnectTimeout",
118            new Class[] {Integer.TYPE});
119 
120        /** Lazy initialized constant that knows about the existence of the method
121         * <code>URLConnection.setReadTimeout</code>. This depends on the currently running
122         * JVM. */
123        private static final boolean IS_SET_READ_TIMEOUT_SUSPPORTED = YodaUtility.existsMethod(
124            URLConnection.class, "setReadTimeout",
125            new Class[] {Integer.TYPE});
126 
127        /**
128         * Hidden constructor.
129         */
130        private LazyHolderTimeoutMethods() {
131            // nothing to do
132        }
133 
134    }
135 
136    public boolean isSetConnectionTimeOutSupported() {
137        return LazyHolderTimeoutMethods.IS_SET_CONNECTION_TIMEOUT_SUPPORTED;
138    }
139 
140    public boolean isSetReadTimeoutSupported() {
141        return LazyHolderTimeoutMethods.IS_SET_READ_TIMEOUT_SUSPPORTED;
142    }
143 
144}

[all classes][org.qedeq.kernel.bo.common]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov