You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/27 10:01:19 UTC

[03/20] tomee git commit: JavaDoc added

JavaDoc added


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5af81aa4
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5af81aa4
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5af81aa4

Branch: refs/heads/master
Commit: 5af81aa473c441fedd0aa0fee2d7e53264f33852
Parents: 0d70b3c
Author: Hayri Cicek <ha...@kodnito.com>
Authored: Fri Dec 7 22:00:37 2018 +0100
Committer: Hayri Cicek <ha...@kodnito.com>
Committed: Fri Dec 7 22:00:37 2018 +0100

----------------------------------------------------------------------
 .../apache/openejb/loader/ProvisioningUtil.java |  10 ++
 .../apache/openejb/loader/SystemClassPath.java  |   4 +
 .../apache/openejb/loader/SystemInstance.java   | 103 ++++++++++++++++---
 .../apache/openejb/loader/TomcatClassPath.java  |  19 +++-
 .../apache/openejb/loader/WebAppClassPath.java  |   5 +
 .../java/org/apache/openejb/loader/Zips.java    |  21 ++++
 6 files changed, 146 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
index f7540ca..b1d20aa 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
@@ -43,6 +43,11 @@ public final class ProvisioningUtil {
         // no-op
     }
 
+    /**
+     *
+     * @return
+     * @throws IOException
+     */
     public static Collection<File> addAdditionalLibraries() throws IOException {
         final File conf = SystemInstance.get().getConf(ADDITIONAL_LIB_CONFIG);
         if (conf == null || !conf.exists()) {
@@ -143,6 +148,11 @@ public final class ProvisioningUtil {
         return libs;
     }
 
+    /**
+     *
+     * @param location String
+     * @return
+     */
     public static Set<String> realLocation(final String location) {
         final boolean initialized = SystemInstance.isInitialized();
         if (!initialized) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
index 16f14ef..2491afc 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
@@ -51,6 +51,10 @@ public class SystemClassPath extends BasicURLClassPath {
         }
     }
 
+    /**
+     *
+     * @return ClassLoader
+     */
     @Override
     public ClassLoader getClassLoader() {
         try {

http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
index 1474c43..1b8725a 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
@@ -29,8 +29,8 @@ import java.util.Properties;
 import java.util.concurrent.atomic.AtomicReference;
 
 /**
- * This class aims to be the one and only static in the entire system
- * A static, singleton, instance of this class can be created with the {@link #init(Properties)} method
+ * This class aims to be the one and only static in the entire SYSTEM
+ A static, singleton, instance of this class can be created with the {@link #init(Properties)} method
  * <p/>
  * It is assumed that only one singleton per classloader is possible in any given VM
  * Thus loading this instance in a classloader will mean there can only be one OpenEJB
@@ -60,9 +60,9 @@ public final class SystemInstance {
     private final ObserverManager observerManager = new ObserverManager();
 
     private SystemInstance(final Properties properties) {
-        this.components = new HashMap<Class, Object>();
+        this.components = new HashMap<>();
 
-        // import JVM system property config (if a resource/container/... is set through this way)
+        // import JVM SYSTEM property config (if a resource/container/... is set through this way)
         for (final String key : System.getProperties().stringPropertyNames()) {
             if (key.startsWith("sun.")) {
                 continue;
@@ -130,35 +130,74 @@ public final class SystemInstance {
         System.setProperty("derby.system.home", System.getProperty("derby.system.home", baseDirCanonicalPath));
     }
 
+    /**
+     *
+     * @param <E>
+     * @param event
+     * @return
+     */
     public <E> E fireEvent(final E event) {
         return observerManager.fireEvent(event);
     }
 
+    /**
+     *
+     * @param observer Object
+     * @return boolean
+     */
     public boolean addObserver(final Object observer) {
         return observerManager.addObserver(observer);
     }
 
+    /**
+     *
+     * @param observer Object
+     * @return boolean
+     */
     public boolean removeObserver(final Object observer) {
         return observerManager.removeObserver(observer);
     }
 
+    /**
+     *
+     * @return long
+     */
     @SuppressWarnings("unused")
     public long getStartTime() {
         return startTime;
     }
 
+    /**
+     *
+     * @return Options
+     */
     public Options getOptions() {
         return options;
     }
 
+    /**
+     *
+     * @return Properties
+     */
     public Properties getProperties() {
         return internalProperties;
     }
 
+    /**
+     *
+     * @param key String
+     * @return String
+     */
     public String getProperty(final String key) {
         return internalProperties.getProperty(key);
     }
 
+    /**
+     *
+     * @param key String
+     * @param defaultValue String
+     * @return String
+     */
     public String getProperty(final String key, final String defaultValue) {
         return internalProperties.getProperty(key, defaultValue);
     }
@@ -180,6 +219,10 @@ public final class SystemInstance {
         return internalProperties.setProperty(key, value);
     }
 
+    /**
+     *
+     * @return FileUtils
+     */
     public FileUtils getHome() {
         if (!isInitialized()) {
             return new FileUtils("openejb.home", "user.dir", System.getProperties());
@@ -187,6 +230,10 @@ public final class SystemInstance {
         return home;
     }
 
+    /**
+     *
+     * @return FileUtils
+     */
     public FileUtils getBase() {
         if (!isInitialized()) {
             return new FileUtils("openejb.base", "openejb.home", System.getProperties());
@@ -194,10 +241,18 @@ public final class SystemInstance {
         return base;
     }
 
+    /**
+     *
+     * @return ClassPath
+     */
     public ClassPath getClassPath() {
         return classPath;
     }
 
+    /**
+     *
+     * @return ClassLoader
+     */
     public ClassLoader getClassLoader() {
         return classLoader;
     }
@@ -263,7 +318,7 @@ public final class SystemInstance {
         return removed;
     }
 
-    private static final AtomicReference<SystemInstance> system = new AtomicReference<SystemInstance>();
+    private static final AtomicReference<SystemInstance> SYSTEM = new AtomicReference<SystemInstance>();
 
     static {
         reset();
@@ -278,18 +333,23 @@ public final class SystemInstance {
     public static synchronized void reset() {
         try {
             System.clearProperty("openejb.loader");
-            system.set(new SystemInstance(new Properties())); // don't put system properties here, it is already done
+            SYSTEM.set(new SystemInstance(new Properties())); // don't put SYSTEM properties here, it is already done
             initialized = false;
         } catch (final Exception e) {
             throw new LoaderRuntimeException("Failed to create default instance of SystemInstance", e);
         }
     }
 
+    /**
+     *
+     * @param properties Properties
+     * @throws Exception
+     */
     public static synchronized void init(final Properties properties) throws Exception {
         if (initialized) {
             return;
         }
-        system.set(new SystemInstance(properties));
+        SYSTEM.set(new SystemInstance(properties));
         // WARNING: reverse order since we don't overwrite existing entries
         readSystemProperties(get().currentProfile());
         readSystemProperties();
@@ -297,7 +357,7 @@ public final class SystemInstance {
 
 
         // if the user read System.getProperties() instead of our properties, used in bval-tomee tck for instance
-        System.getProperties().putAll(system.get().getProperties());
+        System.getProperties().putAll(SYSTEM.get().getProperties());
 
         initialized = true;
         get().setProperty("openejb.profile.custom", Boolean.toString(!get().isDefaultProfile()));
@@ -306,7 +366,7 @@ public final class SystemInstance {
     }
 
     private static void initDefaultComponents() {
-        system.get().components.put(ProvisioningResolver.class, new ProvisioningResolver());
+        SYSTEM.get().components.put(ProvisioningResolver.class, new ProvisioningResolver());
     }
 
     private static void readUserSystemProperties() {
@@ -314,10 +374,15 @@ public final class SystemInstance {
         addSystemProperties(file);
     }
 
+    /**
+     *
+     * @param subPath String
+     * @return File
+     */
     public File getConf(final String subPath) {
 
         File conf = null;
-        final FileUtils base = system.get().getBase();
+        final FileUtils base = SYSTEM.get().getBase();
 
         try {
             conf = base.getDirectory("conf");
@@ -351,7 +416,7 @@ public final class SystemInstance {
         }
 
         // Read in and apply the conf/system.properties
-        final File conf = system.get().getConf(completePrefix + "system.properties");
+        final File conf = SYSTEM.get().getConf(completePrefix + "system.properties");
         if (conf != null && conf.exists()) {
             addSystemProperties(conf);
         }
@@ -374,23 +439,31 @@ public final class SystemInstance {
         }
 
         for (final String key : systemProperties.stringPropertyNames()) {
-            final SystemInstance systemInstance = system.get();
+            final SystemInstance systemInstance = SYSTEM.get();
             if (systemInstance.getProperty(key) == null) {
                 systemInstance.setProperty(key, systemProperties.getProperty(key));
             }
         }
-        // don't override system props
-        // system.getProperties().putAll(systemProperties);
+        // don't override SYSTEM props
+        // SYSTEM.getProperties().putAll(systemProperties);
     }
 
     public static SystemInstance get() {
-        return system.get();
+        return SYSTEM.get();
     }
 
+    /**
+     *
+     * @return String
+     */
     public String currentProfile() {
         return getProperty(PROFILE_PROP, DEFAULT_PROFILE);
     }
 
+    /**
+     *
+     * @return boolean
+     */
     public boolean isDefaultProfile() {
         return DEFAULT_PROFILE.equals(currentProfile());
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/TomcatClassPath.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/TomcatClassPath.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/TomcatClassPath.java
index a092485..c5df72f 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/TomcatClassPath.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/TomcatClassPath.java
@@ -48,6 +48,10 @@ public class TomcatClassPath extends BasicURLClassPath {
         this(getCommonLoader(getContextClassLoader()));
     }
 
+    /**
+     *
+     * @param classLoader ClassLoader
+     */
     public TomcatClassPath(final ClassLoader classLoader) {
         this.commonLoader = classLoader;
 
@@ -89,12 +93,20 @@ public class TomcatClassPath extends BasicURLClassPath {
         }
     }
 
+    /**
+     *
+     * @return ClassLoader
+     */
     @Override
     public ClassLoader getClassLoader() {
         return (serverLoader != null) ? serverLoader : commonLoader;
         //        return commonLoader;
     }
 
+    /**
+     *
+     * @return ClassLoader
+     */
     @SuppressWarnings("UnusedDeclaration")
     public ClassLoader getCommonLoader() {
         return commonLoader;
@@ -125,6 +137,11 @@ public class TomcatClassPath extends BasicURLClassPath {
         rebuild();
     }
 
+    /**
+     *
+     * @param jar URL
+     * @throws Exception
+     */
     public void _addJarToPath(final URL jar) throws Exception {
         ClassLoader classLoader = commonLoader;
 
@@ -218,7 +235,7 @@ public class TomcatClassPath extends BasicURLClassPath {
                             }
                             return method;
                         } catch (final Exception e2) {
-                            throw (IllegalStateException) new IllegalStateException("Unable to find or access the addRepository method in StandardClassLoader").initCause(e2);
+                            throw new IllegalStateException("Unable to find or access the addRepository method in StandardClassLoader", e2);
                         }
                     }
                 });

http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/WebAppClassPath.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/WebAppClassPath.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/WebAppClassPath.java
index c0ac8a0..1b45361 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/WebAppClassPath.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/WebAppClassPath.java
@@ -22,10 +22,15 @@ public class WebAppClassPath extends TomcatClassPath {
         this(getContextClassLoader());
     }
 
+    /**
+     *
+     * @param classLoader ClassLoader
+     */
     public WebAppClassPath(final ClassLoader classLoader) {
         super(classLoader);
     }
 
+    @Override
     protected void rebuild() {
     }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/5af81aa4/container/openejb-loader/src/main/java/org/apache/openejb/loader/Zips.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Zips.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Zips.java
index cdfd67a..6b52322 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Zips.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Zips.java
@@ -26,10 +26,24 @@ import java.util.zip.ZipInputStream;
  * @version $Rev$ $Date$
  */
 public class Zips {
+
+    /**
+     *
+     * @param zipFile File
+     * @param destination File
+     * @throws IOException
+     */
     public static void unzip(final File zipFile, final File destination) throws IOException {
         unzip(zipFile, destination, false);
     }
 
+    /**
+     *
+     * @param zipFile File
+     * @param destination File
+     * @param noparent boolean
+     * @throws IOException
+     */
     public static void unzip(final File zipFile, final File destination, final boolean noparent) throws IOException {
 
         Files.dir(destination);
@@ -46,6 +60,13 @@ public class Zips {
         }
     }
 
+    /**
+     *
+     * @param read InputStream
+     * @param destination File
+     * @param noparent boolean
+     * @throws IOException
+     */
     public static void unzip(final InputStream read, final File destination, final boolean noparent) throws IOException {
         try {
             // Open the ZIP file