directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1732058 - /directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java
Date Wed, 24 Feb 2016 10:37:34 GMT
Author: seelmann
Date: Wed Feb 24 10:37:33 2016
New Revision: 1732058

URL: http://svn.apache.org/viewvc?rev=1732058&view=rev
Log:
Add utility to get loopback address

Added:
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java 
 (with props)

Added: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java?rev=1732058&view=auto
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java (added)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java Wed
Feb 24 10:37:33 2016
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.api.util;
+
+
+import java.net.InetAddress;
+
+
+/**
+ * Network utils.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class Network
+{
+
+    /**
+     * Private constructor.
+     */
+    private Network()
+    {
+    }
+
+    public static final InetAddress LOOPBACK = getLoopbackAddress();
+    public static final String LOOPBACK_HOSTNAME = getLoopbackHostName();
+
+
+    private static String getLoopbackHostName()
+    {
+        InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
+        return loopbackAddress.getCanonicalHostName();
+    }
+
+
+    private static InetAddress getLoopbackAddress()
+    {
+        InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
+        return loopbackAddress;
+    }
+
+
+    public static String ldapLooopbackUrl( int port )
+    {
+        return "ldap://" + LOOPBACK_HOSTNAME + ":" + port;
+    }
+
+}

Propchange: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Network.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message