September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,59 +1,14 @@
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.directory.api.ldap.model.exception.LdapException;
|
||||
import org.apache.directory.ldap.client.api.LdapConnection;
|
||||
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
|
||||
import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
|
||||
import org.apache.directory.shared.ldap.model.entry.Entry;
|
||||
import org.apache.directory.shared.ldap.model.exception.LdapException;
|
||||
import org.apache.directory.shared.ldap.model.message.SearchScope;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RDirectoryLDAP {
|
||||
public class LdapConnectionDemo {
|
||||
|
||||
static final Logger log_;
|
||||
private static final String ldapHostName;
|
||||
private static final int ldapPort;
|
||||
private static LdapConnection connection;
|
||||
|
||||
static {
|
||||
log_ = LoggerFactory.getLogger(RDirectoryLDAP.class);
|
||||
connection = null;
|
||||
ldapHostName = "localhost";
|
||||
ldapPort = 10389;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
if (log_.isInfoEnabled()) { log_.info("LDAP Connection to " + ldapHostName + " on port " + ldapPort); }
|
||||
connection = new LdapNetworkConnection(ldapHostName, ldapPort);
|
||||
|
||||
try {
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP bind"); }
|
||||
connection.bind();
|
||||
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP unbind"); }
|
||||
connection.unBind();
|
||||
}
|
||||
catch (LdapException lex) {
|
||||
log_.error("LDAP Error", lex);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log_.error("I/O Error", ex);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (log_.isTraceEnabled()) { log_.trace("LDAP close connection"); }
|
||||
try {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
public static void main(String[] args) throws LdapException, IOException {
|
||||
try (LdapConnection connection = new LdapNetworkConnection("localhost", 10389)) {
|
||||
connection.bind();
|
||||
connection.unBind();
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
log_.error("I/O Error on connection.close()", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,32 @@
|
|||
package directory
|
||||
|
||||
import kotlin.properties.get
|
||||
|
||||
import org.apache.directory.api.ldap.model.exception.LdapException
|
||||
import org.apache.directory.ldap.client.api.LdapNetworkConnection
|
||||
import java.io.IOException
|
||||
import java.util.logging.Level
|
||||
import java.util.logging.Logger
|
||||
|
||||
import org.apache.directory.api.ldap.model.exception.LdapException
|
||||
import org.apache.directory.ldap.client.api.LdapNetworkConnection
|
||||
|
||||
class LDAP(val map: Map<String, String>) {
|
||||
class LDAP(map: Map<String, String>) {
|
||||
fun run() {
|
||||
var connection: LdapNetworkConnection? = null
|
||||
try {
|
||||
if (info)
|
||||
log.info("LDAP Connection to $hostname on port $port")
|
||||
if (info) log.info("LDAP Connection to $hostname on port $port")
|
||||
connection = LdapNetworkConnection(hostname, port.toInt())
|
||||
|
||||
try {
|
||||
if (info)
|
||||
log.info("LDAP bind")
|
||||
if (info) log.info("LDAP bind")
|
||||
connection.bind()
|
||||
} catch (e: LdapException) {
|
||||
log.severe(e.toString())
|
||||
}
|
||||
|
||||
try {
|
||||
if (info)
|
||||
log.info("LDAP unbind")
|
||||
if (info) log.info("LDAP unbind")
|
||||
connection.unBind()
|
||||
} catch (e: LdapException) {
|
||||
log.severe(e.toString())
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (info)
|
||||
log.info("LDAP close connection")
|
||||
if (info) log.info("LDAP close connection")
|
||||
connection!!.close()
|
||||
} catch (e: IOException) {
|
||||
log.severe(e.toString())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
PRINT "Current directory: ";CURRENT_DIR$()
|
||||
PRINT
|
||||
PRINT "Folders:"
|
||||
PRINT
|
||||
DIR "/" LIST DIRS a$,c
|
||||
FOR n = 0 TO c-1
|
||||
PRINT ,a$(n)
|
||||
NEXT n
|
||||
PRINT
|
||||
PRINT "Files:"
|
||||
PRINT
|
||||
DIR "/" LIST FILES a$,c
|
||||
FOR n = 0 TO c-1
|
||||
PRINT ,a$(n)
|
||||
NEXT n
|
||||
Loading…
Add table
Add a link
Reference in a new issue