ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/3] ignite git commit: ignite-2435 Fixed naming conventions.
Date Wed, 04 May 2016 11:08:43 GMT
ignite-2435 Fixed naming conventions.


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

Branch: refs/heads/ignite-2435
Commit: a149a6a2413f9bca04244b44f0ba080ae10e55a7
Parents: 77cdc5f
Author: sboikov <sboikov@gridgain.com>
Authored: Wed May 4 14:08:31 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed May 4 14:08:31 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/mesos/ClusterProperties.java  | 72 ++++++++++----------
 .../apache/ignite/mesos/IgniteFramework.java    | 14 ++--
 .../ignite/mesos/resource/ResourceProvider.java | 16 ++---
 3 files changed, 52 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a149a6a2/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
index 53eac83..6942d88 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/ClusterProperties.java
@@ -68,7 +68,7 @@ public class ClusterProperties {
     public static final String IGNITE_HTTP_SERVER_HOST = "IGNITE_HTTP_SERVER_HOST";
 
     /** Http server host. */
-    private String httpServerHost = null;
+    private String httpSrvHost = null;
 
     /** */
     public static final String IGNITE_HTTP_SERVER_PORT = "IGNITE_HTTP_SERVER_PORT";
@@ -77,7 +77,7 @@ public class ClusterProperties {
     public static final String DEFAULT_HTTP_SERVER_PORT = "48610";
 
     /** Http server host. */
-    private int httpServerPort = Integer.valueOf(DEFAULT_HTTP_SERVER_PORT);
+    private int httpSrvPort = Integer.valueOf(DEFAULT_HTTP_SERVER_PORT);
 
     /** */
     public static final String IGNITE_TOTAL_CPU = "IGNITE_TOTAL_CPU";
@@ -152,13 +152,13 @@ public class ClusterProperties {
     public static final String IGNITE_PACKAGE_URL = "IGNITE_PACKAGE_URL";
 
     /** Ignite package url. */
-    private String ignitePackageUrl = null;
+    private String ignitePkgUrl;
 
     /** */
     public static final String IGNITE_PACKAGE_PATH = "IGNITE_PACKAGE_PATH";
 
     /** Ignite package path. */
-    private String ignitePackagePath = null;
+    private String ignitePkgPath;
 
     /** */
     public static final String IGNITE_WORK_DIR = "IGNITE_WORK_DIR";
@@ -324,10 +324,10 @@ public class ClusterProperties {
     /**
      * Sets hostname constraint.
      *
-     * @param pattern Hostname pattern.
+     * @param ptrn Hostname pattern.
      */
-    public void hostnameConstraint(Pattern pattern) {
-        this.hostnameConstraint = pattern;
+    public void hostnameConstraint(Pattern ptrn) {
+        this.hostnameConstraint = ptrn;
     }
 
     /**
@@ -385,28 +385,28 @@ public class ClusterProperties {
      * @return Http server host.
      */
     public String httpServerHost() {
-        return httpServerHost;
+        return httpSrvHost;
     }
 
     /**
      * @return Http server port.
      */
     public int httpServerPort() {
-        return httpServerPort;
+        return httpSrvPort;
     }
 
     /**
      * @return Url to ignite package.
      */
     public String ignitePackageUrl() {
-        return ignitePackageUrl;
+        return ignitePkgUrl;
     }
 
     /**
      * @return Url to ignite package.
      */
     public String ignitePackagePath() {
-        return ignitePackagePath;
+        return ignitePkgPath;
     }
 
     /**
@@ -438,38 +438,38 @@ public class ClusterProperties {
     }
 
     /**
-     * @param config path to config file.
+     * @param cfg path to config file.
      * @return Cluster configuration.
      */
-    public static ClusterProperties from(String config) {
+    public static ClusterProperties from(String cfg) {
         try {
             Properties props = null;
 
-            if (config != null) {
+            if (cfg != null) {
                 props = new Properties();
 
-                props.load(new FileInputStream(config));
+                props.load(new FileInputStream(cfg));
             }
 
             ClusterProperties prop = new ClusterProperties();
 
             prop.mesosUrl = getStringProperty(MESOS_MASTER_URL, props, DEFAULT_MESOS_MASTER_URL);
 
-            prop.httpServerHost = getStringProperty(IGNITE_HTTP_SERVER_HOST, props, getNonLoopbackAddress());
+            prop.httpSrvHost = getStringProperty(IGNITE_HTTP_SERVER_HOST, props, getNonLoopbackAddress());
 
             String port = System.getProperty("PORT0");
 
             if (port != null && !port.isEmpty())
-                prop.httpServerPort = Integer.valueOf(port);
+                prop.httpSrvPort = Integer.valueOf(port);
             else
-                prop.httpServerPort = Integer.valueOf(getStringProperty(IGNITE_HTTP_SERVER_PORT,
props,
+                prop.httpSrvPort = Integer.valueOf(getStringProperty(IGNITE_HTTP_SERVER_PORT,
props,
                     DEFAULT_HTTP_SERVER_PORT));
 
             prop.clusterName = getStringProperty(IGNITE_CLUSTER_NAME, props, DEFAULT_CLUSTER_NAME);
 
             prop.userLibsUrl = getStringProperty(IGNITE_USERS_LIBS_URL, props, null);
-            prop.ignitePackageUrl = getStringProperty(IGNITE_PACKAGE_URL, props, null);
-            prop.ignitePackagePath = getStringProperty(IGNITE_PACKAGE_PATH, props, null);
+            prop.ignitePkgUrl = getStringProperty(IGNITE_PACKAGE_URL, props, null);
+            prop.ignitePkgPath = getStringProperty(IGNITE_PACKAGE_PATH, props, null);
             prop.licenceUrl = getStringProperty(LICENCE_URL, props, null);
             prop.igniteCfgUrl = getStringProperty(IGNITE_CONFIG_XML_URL, props, null);
 
@@ -490,11 +490,11 @@ public class ClusterProperties {
             prop.igniteCfg = getStringProperty(IGNITE_CONFIG_XML, props, null);
             prop.userLibs = getStringProperty(IGNITE_USERS_LIBS, props, null);
 
-            String pattern = getStringProperty(IGNITE_HOSTNAME_CONSTRAINT, props, null);
+            String ptrn = getStringProperty(IGNITE_HOSTNAME_CONSTRAINT, props, null);
 
-            if (pattern != null) {
+            if (ptrn != null) {
                 try {
-                    prop.hostnameConstraint = Pattern.compile(pattern);
+                    prop.hostnameConstraint = Pattern.compile(ptrn);
                 }
                 catch (PatternSyntaxException e) {
                     log.log(Level.WARNING, "IGNITE_HOSTNAME_CONSTRAINT has invalid pattern.
It will be ignore.", e);
@@ -513,16 +513,16 @@ public class ClusterProperties {
      * @param fileProps Property file.
      * @return Property value.
      */
-    private static double getDoubleProperty(String name, Properties fileProps, Double defaultVal)
{
+    private static double getDoubleProperty(String name, Properties fileProps, Double dfltVal)
{
         if (fileProps != null && fileProps.containsKey(name))
             return Double.valueOf(fileProps.getProperty(name));
 
-        String property = System.getProperty(name);
+        String prop = System.getProperty(name);
 
-        if (property == null)
-            property = System.getenv(name);
+        if (prop == null)
+            prop = System.getenv(name);
 
-        return property == null ? defaultVal : Double.valueOf(property);
+        return prop == null ? dfltVal : Double.valueOf(prop);
     }
 
     /**
@@ -530,16 +530,16 @@ public class ClusterProperties {
      * @param fileProps Property file.
      * @return Property value.
      */
-    private static String getStringProperty(String name, Properties fileProps, String defaultVal)
{
+    private static String getStringProperty(String name, Properties fileProps, String dfltVal)
{
         if (fileProps != null && fileProps.containsKey(name))
             return fileProps.getProperty(name);
 
-        String property = System.getProperty(name);
+        String prop = System.getProperty(name);
 
-        if (property == null)
-            property = System.getenv(name);
+        if (prop == null)
+            prop = System.getenv(name);
 
-        return property == null ? defaultVal : property;
+        return prop == null ? dfltVal : prop;
     }
 
     /**
@@ -554,10 +554,10 @@ public class ClusterProperties {
         while (ifaces.hasMoreElements()) {
             NetworkInterface iface = ifaces.nextElement();
 
-            Enumeration<InetAddress> addresses = iface.getInetAddresses();
+            Enumeration<InetAddress> addrs = iface.getInetAddresses();
 
-            while (addresses.hasMoreElements()) {
-                InetAddress addr = addresses.nextElement();
+            while (addrs.hasMoreElements()) {
+                InetAddress addr = addrs.nextElement();
 
                 if (addr instanceof Inet4Address && !addr.isLoopbackAddress())
                     return addr.getHostAddress();

http://git-wip-us.apache.org/repos/asf/ignite/blob/a149a6a2/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
index 9f33f9a..60418ec 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/IgniteFramework.java
@@ -43,6 +43,7 @@ public class IgniteFramework {
      * Main methods has only one optional parameter - path to properties files.
      *
      * @param args Args.
+     * @throws Exception If failed.
      */
     public static void main(String[] args) throws Exception {
         final int frameworkFailoverTimeout = 0;
@@ -63,9 +64,9 @@ public class IgniteFramework {
 
         String baseUrl = String.format("http://%s:%d", clusterProps.httpServerHost(), clusterProps.httpServerPort());
 
-        JettyServer httpServer = new JettyServer();
+        JettyServer httpSrv = new JettyServer();
 
-        httpServer.start(
+        httpSrv.start(
             new InetSocketAddress(clusterProps.httpServerHost(), clusterProps.httpServerPort()),
             new ResourceHandler(clusterProps.userLibs(), clusterProps.igniteCfg(), clusterProps.igniteWorkDir())
         );
@@ -79,8 +80,9 @@ public class IgniteFramework {
         // Create the scheduler.
         Scheduler scheduler = new IgniteScheduler(clusterProps, provider);
 
-        // create the driver
+        // Create the driver.
         MesosSchedulerDriver driver;
+
         if (System.getenv("MESOS_AUTHENTICATE") != null) {
             log.info("Enabling authentication for the framework");
 
@@ -96,7 +98,7 @@ public class IgniteFramework {
                 System.exit(1);
             }
 
-            Protos.Credential credential = Protos.Credential.newBuilder()
+            Protos.Credential cred = Protos.Credential.newBuilder()
                 .setPrincipal(System.getenv("DEFAULT_PRINCIPAL"))
                 .setSecret(ByteString.copyFrom(System.getenv("DEFAULT_SECRET").getBytes()))
                 .build();
@@ -104,7 +106,7 @@ public class IgniteFramework {
             frameworkBuilder.setPrincipal(System.getenv("DEFAULT_PRINCIPAL"));
 
             driver = new MesosSchedulerDriver(scheduler, frameworkBuilder.build(), clusterProps.masterUrl(),
-                credential);
+                cred);
         }
         else {
             frameworkBuilder.setPrincipal("ignite-framework-java");
@@ -114,7 +116,7 @@ public class IgniteFramework {
 
         int status = driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1;
 
-        httpServer.stop();
+        httpSrv.stop();
 
         // Ensure that the driver process terminates.
         driver.stop();

http://git-wip-us.apache.org/repos/asf/ignite/blob/a149a6a2/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java
b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java
index 07bd63b..7baf7ca 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java
@@ -44,10 +44,10 @@ public class ResourceProvider {
     private Collection<String> libsUris;
 
     /** Url config. */
-    private String configUrl;
+    private String cfgUrl;
 
     /** Config name. */
-    private String configName;
+    private String cfgName;
 
     /**
      * @param props Cluster properties.
@@ -102,15 +102,15 @@ public class ResourceProvider {
             File cfg = new File(props.igniteCfg());
 
             if (cfg.isFile() && cfg.canRead()) {
-                configUrl = baseUrl + CONFIG_PREFIX + cfg.getName();
+                cfgUrl = baseUrl + CONFIG_PREFIX + cfg.getName();
 
-                configName = cfg.getName();
+                cfgName = cfg.getName();
             }
         }
         else {
-            configName = "ignite-default-config.xml";
+            cfgName = "ignite-default-config.xml";
 
-            configUrl = baseUrl + DEFAULT_CONFIG + configName;
+            cfgUrl = baseUrl + DEFAULT_CONFIG + cfgName;
         }
     }
 
@@ -118,7 +118,7 @@ public class ResourceProvider {
      * @return Config name.
      */
     public String configName() {
-        return configName;
+        return cfgName;
     }
 
     /**
@@ -139,6 +139,6 @@ public class ResourceProvider {
      * @return Url to config file.
      */
     public String igniteConfigUrl() {
-        return configUrl;
+        return cfgUrl;
     }
 }
\ No newline at end of file


Mime
View raw message