FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
Re:javac : cannot find symbol , PrincipalAdapter (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:javac : cannot find symbol , PrincipalAdapter
#897
skowit (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
javac : cannot find symbol , PrincipalAdapter 3 Months, 4 Weeks ago Karma: 1  
Hello.
Now I used OpenKM login with LDAP ,I need to use User&group List (Full LDAP Integration).
I tried to create a new java file,It's implements PrincipalAdapter class.
My new java file , In getUsers and getRoles functions connect TO LDAP instead from file.
when i compiled java file. found the error this message :

UsersRolesPrincipalAdapterPKG.java:14: cannot find symbol
symbol: class PrincipalAdapter
public class UsersRolesPrincipalAdapterPKG implements PrincipalAdapter

How to debug this error,
thank you for the help

Ps, I'am not good at english
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#898
pavila (Admin)
Admin
Posts: 304
graph
User Offline Click here to see the profile of this user
Gender: Male OpenKM
Re:javac : cannot find symbol , PrincipalAdapter 3 Months, 3 Weeks ago Karma: 7  
Post the source code so I can help you.
 
Report to moderator   Logged Logged  
 
Be open, my friend!
  The administrator has disabled public write access.
#903
skowit (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:javac : cannot find symbol , PrincipalAdapter 3 Months, 3 Weeks ago Karma: 1  
My Source code..

Code:

package es.git.openkm.core; import java.io.*; import java.util.*; import javax.naming.*; import javax.naming.Context; import javax.naming.directory.*; import javax.naming.NamingException; import java.util.Collection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class UsersRolesPrincipalAdapterPKG implements PrincipalAdapter { private static Logger log = LoggerFactory.getLogger(UsersRolesPrincipalAdapterPKG.class); public Collection getUsers() throws PrincipalAdapterException { log.debug("getUsers()"); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://xxx.xxx.xxx.xxx:389"); env.put(Context.SECURITY_PRINCIPAL, "cn=Manager,dc=example,dc=com"); env.put(Context.SECURITY_CREDENTIALS, "mypassword"); DirContext ctx; try { ctx = new InitialDirContext(env); } catch (NamingException e) { throw new RuntimeException(e); } LinkedList list = new LinkedList(); NamingEnumeration results = null; try { SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE); results = ctx.search( "ou=employee,dc=example,dc=com", "(objectclass=person)", controls); while (results.hasMore()) { SearchResult searchResult = (SearchResult) results.next(); Attributes attributes = searchResult.getAttributes(); Attribute attr = attributes.get("uid"); String uid = (String) attr.get(); list.add(uid); } } catch (NameNotFoundException e) { // The base context was not found. // Just clean up and exit. } catch (NamingException e) { throw new RuntimeException(e); } finally { if (results != null) { try { results.close(); } catch (Exception e) { // Never mind this. } } if (ctx != null) { try { ctx.close(); } catch (Exception e) { // Never mind this. } } } log.debug("getUsers: "+list); return list; } public Collection getRoles() throws PrincipalAdapterException { log.debug("getRoles()"); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://xxx.xxx.xxx.xxx:389"); env.put(Context.SECURITY_PRINCIPAL, "cn=Manager,dc=example,dc=com"); env.put(Context.SECURITY_CREDENTIALS, "mypassword"); DirContext ctx; try { ctx = new InitialDirContext(env); } catch (NamingException e) { throw new RuntimeException(e); } LinkedList list = new LinkedList(); NamingEnumeration results = null; try { SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE); results = ctx.search( "ou=roles,dc=example,dc=com", "(objectclass=group)", controls); while (results.hasMore()) { SearchResult searchResult = (SearchResult) results.next(); Attributes attributes = searchResult.getAttributes(); Attribute attr = attributes.get("cn"); String cn = (String) attr.get(); list.add(cn); } } catch (NameNotFoundException e) { // The base context was not found. // Just clean up and exit. } catch (NamingException e) { throw new RuntimeException(e); } finally { if (results != null) { try { results.close(); } catch (Exception e) { // Never mind this. } } if (ctx != null) { try { ctx.close(); } catch (Exception e) { // Never mind this. } } } log.debug("getRoles: "+list); return list; } }
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/07/29 08:01 By pavila.
  The administrator has disabled public write access.
#905
pavila (Admin)
Admin
Posts: 304
graph
User Offline Click here to see the profile of this user
Gender: Male OpenKM
Re:javac : cannot find symbol , PrincipalAdapter 3 Months, 3 Weeks ago Karma: 7  
Which IDE do you use for java develop?
 
Report to moderator   Logged Logged  
 
Be open, my friend!
  The administrator has disabled public write access.
#911
jllort (Admin)
Admin
Posts: 291
graphgraph
User Offline Click here to see the profile of this user
Re:javac : cannot find symbol , PrincipalAdapter 3 Months, 3 Weeks ago Karma: 4  
You've missed some imports ?

Because if your class is on package es.git.openkm.core; ( file writen ) then you need some imports

import es.git.openkm.core.principal.PrincipalAdapter;
import es.git.openkm.core.principal.PrincipalAdapterException;

and you must implement the method getMails

public Collection<String> getMails(Collection<String> users)
throws PrincipalAdapterException {
// TODO Auto-generated method stub
return null;
}

Without it your code can compile correctly.

Have you take a look about actual developer guide, if not look it please, because I think it's not possible jboss-ide ( eclipse ) don't detects problems.
 
Report to moderator   Logged Logged  
 
Be open my friend
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop