svn commit: r1817744 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container: ComponentContainer.java Container.java ContainerLoader.java NamingServiceContainer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1817744 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container: ComponentContainer.java Container.java ContainerLoader.java NamingServiceContainer.java

mbrohl
Author: mbrohl
Date: Mon Dec 11 06:41:08 2017
New Revision: 1817744

URL: http://svn.apache.org/viewvc?rev=1817744&view=rev
Log:
Improved: General refactoring and code improvements, package
org.apache.ofbiz.base.util.collections.
(OFBIZ-9861)

Thanks Dennis Balkir for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java?rev=1817744&r1=1817743&r2=1817744&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java Mon Dec 11 06:41:08 2017
@@ -173,7 +173,7 @@ public class ComponentContainer implemen
     }
 
     /**
-     * Load all components in a directory because it does not contain
+     * Load all components in a directory because it does not contain
      * a load-components.xml file. The components are sorted alphabetically
      * for loading purposes
      *
@@ -194,7 +194,7 @@ public class ComponentContainer implemen
 
             if (componentPath.isDirectory() && !componentName.startsWith(".") && configFile.exists()) {
                 ComponentConfig config = retrieveComponentConfig(null, componentLocation);
-                if (config != null) {
+                if (config != null) {
                     loadComponent(config);
                 }
             }
@@ -260,7 +260,7 @@ public class ComponentContainer implemen
             }
 
             location = location.startsWith("/") ? location.substring(1) : location;
-            String dirLoc = location.endsWith("/*") ? location.substring(0, location.length() - 2) : location;
+            String dirLoc = location.endsWith("/*") ? location.substring(0, location.length() - 2) : location;
             File path = FileUtil.getFile(configRoot + dirLoc);
 
             if (path.exists()) {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java?rev=1817744&r1=1817743&r2=1817744&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java Mon Dec 11 06:41:08 2017
@@ -24,7 +24,7 @@ import org.apache.ofbiz.base.start.Start
 
 /**
  * An OFBiz container. A container can be thought of as a background process.
- *
+ *
  * <p>
  * When OFBiz starts, the main thread will create the <code>Container</code> instance and
  * then call the container's <code>init</code> method. If the method returns without
@@ -35,7 +35,7 @@ import org.apache.ofbiz.base.start.Start
  * Implementations should anticipate asynchronous calls to the methods by different
  * threads.
  * </p>
- *
+ *
  * <p>Containers might be loaded more than once (have more than one instance).<p>
  */
 public interface Container {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java?rev=1817744&r1=1817743&r2=1817744&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java Mon Dec 11 06:41:08 2017
@@ -36,7 +36,7 @@ import edu.emory.mathcs.backport.java.ut
 
 /**
  * An object that loads containers (background processes).
- *
+ *
  * <p>Normally, instances of this class are created by OFBiz startup code, and
  * client code should not create instances of this class. Client code is
  * responsible for making sure containers are shut down properly. </p>
@@ -46,7 +46,7 @@ public class ContainerLoader implements
 
     public static final String module = ContainerLoader.class.getName();
 
-    private final List<Container> loadedContainers = new LinkedList<Container>();
+    private final List<Container> loadedContainers = new LinkedList<>();
 
     /**
      * @see org.apache.ofbiz.base.start.StartupLoader#load(Config, List)
@@ -78,11 +78,11 @@ public class ContainerLoader implements
             return ContainerConfig.getConfigurations(configFile);
         } catch (ContainerException e) {
             throw new StartupException(e);
-        }        
+        }
     }
 
     private List<ContainerConfig.Configuration> filterContainersHavingMatchingLoaders(List<String> loaders,
-            Collection<ContainerConfig.Configuration> containerConfigs) throws StartupException {
+            Collection<ContainerConfig.Configuration> containerConfigs) {
         return containerConfigs.stream()
                 .filter(containerCfg ->
                     UtilValidate.isEmpty(containerCfg.loaders) &&
@@ -94,7 +94,7 @@ public class ContainerLoader implements
     private List<Container> loadContainersFromConfigurations(List<ContainerConfig.Configuration> containerConfigs,
             Config config, List<StartupCommand> ofbizCommands) throws StartupException {
 
-        List<Container> loadContainers = new ArrayList<Container>();
+        List<Container> loadContainers = new ArrayList<>();
         for (ContainerConfig.Configuration containerCfg : containerConfigs) {
             Debug.logInfo("Loading container: " + containerCfg.name, module);
             Container tmpContainer = loadContainer(config.containerConfig, containerCfg, ofbizCommands);
@@ -104,7 +104,7 @@ public class ContainerLoader implements
         return loadContainers;
     }
 
-    private Container loadContainer(String configFile,
+    private Container loadContainer(String configFile,
             ContainerConfig.Configuration containerCfg,
             List<StartupCommand> ofbizCommands) throws StartupException {
         // load the container class
@@ -160,7 +160,7 @@ public class ContainerLoader implements
     public synchronized void unload() throws StartupException {
         Debug.logInfo("Shutting down containers", module);
 
-        List<Container> reversedContainerList = new ArrayList<Container>(loadedContainers);
+        List<Container> reversedContainerList = new ArrayList<>(loadedContainers);
         Collections.reverse(reversedContainerList);
 
         for(Container loadedContainer : reversedContainerList) {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java?rev=1817744&r1=1817743&r2=1817744&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java Mon Dec 11 06:41:08 2017
@@ -56,7 +56,7 @@ public class NamingServiceContainer impl
         ContainerConfig.Configuration cfg = ContainerConfig.getConfiguration(name, configFileLocation);
 
         // get the naming (JNDI) port
-        
+
         ContainerConfig.Configuration.Property port = cfg.getProperty("port");
         if (port.value != null) {
             try {