org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.acimport
Class LdapImportSource

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.acimport.ImportSource
      extended by org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.acimport.LdapImportSource
All Implemented Interfaces:
org.eclipse.jface.viewers.IContentProvider, org.eclipse.jface.viewers.IStructuredContentProvider, org.eclipse.jface.viewers.ITreeContentProvider

public class LdapImportSource
extends ImportSource

Author:
deser

Field Summary
static String LDAP_BASE
          A constant for setting the LDAP base property.
 
Constructor Summary
LdapImportSource()
          Simple class for a LDAP-connection to import users and groups.
 
Method Summary
 void connect()
          Initializes the connection to the LDAP server, using the properties field.
 void dispose()
          Disposes any created resources.
 Object[] getChildren(Object arg0)
          Returns the children of a given object (which is of the type ImportItemWrapper in this case).
 Object[] getElements(Object arg0)
           
 String getLabel()
           
 String getMessage()
           
 boolean init(org.eclipse.swt.widgets.Shell shell)
           
 void inputChanged(org.eclipse.jface.viewers.Viewer arg0, Object arg1, Object arg2)
          Called when the input changes.
 ArrayList<NameClassPair> namingEnumerationToArrayList(NamingEnumeration<NameClassPair> list)
           
 void setProperties(Properties serverProperties)
           
 
Methods inherited from class org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.acimport.ImportSource
getParent, hasChildren, setOptions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LDAP_BASE

public static final String LDAP_BASE
A constant for setting the LDAP base property.

See Also:
Constant Field Values
Constructor Detail

LdapImportSource

public LdapImportSource()
Simple class for a LDAP-connection to import users and groups.

Method Detail

init

public boolean init(org.eclipse.swt.widgets.Shell shell)
Specified by:
init in class ImportSource
Parameters:
shell - the shell
Returns:
whether the initialization was successful or not (e.g. pressing cancel on choosing the source)
See Also:
ImportSource.init(org.eclipse.swt.widgets.Shell)

getLabel

public String getLabel()
Specified by:
getLabel in class ImportSource
Returns:
a small label which indicates that this is an import from an LDAP server.
See Also:
ImportSource.getLabel()

getChildren

public Object[] getChildren(Object arg0)
Returns the children of a given object (which is of the type ImportItemWrapper in this case). One special thing about this method is, that it does not only return the children objects, but also sets the correct reference (the children) of the given object. This is important as otherwise displaying the items on a TreeViewer correctly would fail, as the getParent()-method wouldn't return the right result.

Specified by:
getChildren in interface org.eclipse.jface.viewers.ITreeContentProvider
Specified by:
getChildren in class ImportSource
Parameters:
arg0 - the object to get the children from.
Returns:
the children, which have the correct references to their parent (the given object).
See Also:
ImportSource.getChildren(java.lang.Object)

getElements

public Object[] getElements(Object arg0)
Specified by:
getElements in interface org.eclipse.jface.viewers.IStructuredContentProvider
Specified by:
getElements in interface org.eclipse.jface.viewers.ITreeContentProvider
Specified by:
getElements in class ImportSource
Parameters:
arg0 - object to get the basic elements from.
Returns:
the root elements.
See Also:
ImportSource.getElements(java.lang.Object)

namingEnumerationToArrayList

public ArrayList<NameClassPair> namingEnumerationToArrayList(NamingEnumeration<NameClassPair> list)
                                                      throws NamingException
Parameters:
list - a NamingEnumeration, that should be converted into an ArrayList
Returns:
an ArrayList of the given NamingEnumeration
Throws:
NamingException - throws an exception

setProperties

public void setProperties(Properties serverProperties)
Parameters:
serverProperties - The properties of the LDAP server.

connect

public void connect()
             throws CorruptedSourceException
Initializes the connection to the LDAP server, using the properties field.

Throws:
CorruptedSourceException - if no connection could be established to the given server.

getMessage

public String getMessage()
Specified by:
getMessage in class ImportSource
Returns:
a small description of the LDAP import source (server, base)
See Also:
ImportSource.getMessage()

dispose

public void dispose()
Disposes any created resources.


inputChanged

public void inputChanged(org.eclipse.jface.viewers.Viewer arg0,
                         Object arg1,
                         Object arg2)
Called when the input changes.

Parameters:
arg0 - the viewer
arg1 - the old input
arg2 - the new input


Copyright © 2015. All Rights Reserved.