[Bug 352133] fix warning related to 1.5
This commit is contained in:
parent
dc3445cea2
commit
40e75f6068
|
@ -21,8 +21,6 @@ import javax.naming.InitialContext;
|
|||
import javax.naming.NamingException;
|
||||
|
||||
import org.eclipse.jetty.util.IntrospectionUtil;
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ public class InjectionCollection
|
|||
|
||||
|
||||
|
||||
public Injection getInjection (String jndiName, Class clazz, Field field)
|
||||
public Injection getInjection (String jndiName, Class<?> clazz, Field field)
|
||||
{
|
||||
if (field == null || clazz == null)
|
||||
return null;
|
||||
|
@ -82,8 +82,8 @@ public class InjectionCollection
|
|||
|
||||
return injection;
|
||||
}
|
||||
|
||||
public Injection getInjection (String jndiName, Class clazz, Method method, Class paramClass)
|
||||
|
||||
public Injection getInjection (String jndiName, Class<?> clazz, Method method, Class<?> paramClass)
|
||||
{
|
||||
if (clazz == null || method == null || paramClass == null)
|
||||
return null;
|
||||
|
|
|
@ -31,7 +31,7 @@ public abstract class LifeCycleCallback
|
|||
{
|
||||
public static final Object[] __EMPTY_ARGS = new Object[] {};
|
||||
private Method _target;
|
||||
private Class _targetClass;
|
||||
private Class<?> _targetClass;
|
||||
private String _className;
|
||||
private String _methodName;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public abstract class LifeCycleCallback
|
|||
/**
|
||||
* @return the _targetClass
|
||||
*/
|
||||
public Class getTargetClass()
|
||||
public Class<?> getTargetClass()
|
||||
{
|
||||
return _targetClass;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public abstract class LifeCycleCallback
|
|||
_methodName = methodName;
|
||||
}
|
||||
|
||||
public void setTarget (Class clazz, String methodName)
|
||||
public void setTarget (Class<?> clazz, String methodName)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ public abstract class LifeCycleCallback
|
|||
* @param checkInheritance false on first entry, true if a superclass is being introspected
|
||||
* @return the method
|
||||
*/
|
||||
public Method findMethod (Package pack, Class clazz, String methodName, boolean checkInheritance)
|
||||
public Method findMethod (Package pack, Class<?> clazz, String methodName, boolean checkInheritance)
|
||||
{
|
||||
if (clazz == null)
|
||||
return null;
|
||||
|
@ -175,5 +175,5 @@ public abstract class LifeCycleCallback
|
|||
return true;
|
||||
}
|
||||
|
||||
public abstract void validate (Class clazz, Method m);
|
||||
public abstract void validate (Class<?> clazz, Method m);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class LifeCycleCallbackCollection
|
|||
if (o == null)
|
||||
return null;
|
||||
|
||||
Class clazz = o.getClass();
|
||||
Class<? extends Object> clazz = o.getClass();
|
||||
return preDestroyCallbacksMap.get(clazz.getName());
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class LifeCycleCallbackCollection
|
|||
if (o == null)
|
||||
return null;
|
||||
|
||||
Class clazz = o.getClass();
|
||||
Class<? extends Object> clazz = o.getClass();
|
||||
return postConstructCallbacksMap.get(clazz.getName());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class LifeCycleCallbackCollection
|
|||
if (o == null)
|
||||
return;
|
||||
|
||||
Class clazz = o.getClass();
|
||||
Class<? extends Object> clazz = o.getClass();
|
||||
List<LifeCycleCallback> callbacks = postConstructCallbacksMap.get(clazz.getName());
|
||||
|
||||
if (callbacks == null)
|
||||
|
@ -120,7 +120,7 @@ public class LifeCycleCallbackCollection
|
|||
if (o == null)
|
||||
return;
|
||||
|
||||
Class clazz = o.getClass();
|
||||
Class<? extends Object> clazz = o.getClass();
|
||||
List<LifeCycleCallback> callbacks = preDestroyCallbacksMap.get(clazz.getName());
|
||||
if (callbacks == null)
|
||||
return;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class PostConstructCallback extends LifeCycleCallback
|
|||
* - cannot be static
|
||||
* @see org.eclipse.jetty.plus.annotation.LifeCycleCallback#validate(java.lang.Class, java.lang.reflect.Method)
|
||||
*/
|
||||
public void validate(Class clazz, Method method)
|
||||
public void validate(Class<?> clazz, Method method)
|
||||
{
|
||||
if (method.getExceptionTypes().length > 0)
|
||||
throw new IllegalArgumentException(clazz.getName()+"."+method.getName()+ " cannot not throw a checked exception");
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PreDestroyCallback extends LifeCycleCallback
|
|||
* - not static
|
||||
* @see org.eclipse.jetty.plus.annotation.LifeCycleCallback#validate(java.lang.Class, java.lang.reflect.Method)
|
||||
*/
|
||||
public void validate(Class clazz, Method method)
|
||||
public void validate(Class<?> clazz, Method method)
|
||||
{
|
||||
|
||||
if (method.getExceptionTypes().length > 0)
|
||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.jetty.plus.annotation;
|
|||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.eclipse.jetty.security.SecurityHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,10 +17,8 @@ import java.util.HashMap;
|
|||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.eclipse.jetty.security.SecurityHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -31,7 +29,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
public class RunAsCollection
|
||||
{
|
||||
public static final String RUNAS_COLLECTION = "org.eclipse.jetty.runAsCollection";
|
||||
private HashMap _runAsMap = new HashMap();//map of classname to run-as
|
||||
private HashMap<String, RunAs> _runAsMap = new HashMap<String, RunAs>();//map of classname to run-as
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,14 +25,14 @@ public class JAASGroup implements Group
|
|||
public static final String ROLES = "__roles__";
|
||||
|
||||
private String _name = null;
|
||||
private HashSet _members = null;
|
||||
private HashSet<Principal> _members = null;
|
||||
|
||||
|
||||
|
||||
public JAASGroup(String n)
|
||||
{
|
||||
this._name = n;
|
||||
this._members = new HashSet();
|
||||
this._members = new HashSet<Principal>();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -72,14 +72,14 @@ public class JAASGroup implements Group
|
|||
*
|
||||
* @return <description>
|
||||
*/
|
||||
public Enumeration members()
|
||||
public Enumeration<? extends Principal> members()
|
||||
{
|
||||
|
||||
class MembersEnumeration implements Enumeration
|
||||
class MembersEnumeration implements Enumeration<Principal>
|
||||
{
|
||||
private Iterator itor;
|
||||
private Iterator<? extends Principal> itor;
|
||||
|
||||
public MembersEnumeration (Iterator itor)
|
||||
public MembersEnumeration (Iterator<? extends Principal> itor)
|
||||
{
|
||||
this.itor = itor;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class JAASGroup implements Group
|
|||
}
|
||||
|
||||
|
||||
public Object nextElement ()
|
||||
public Principal nextElement ()
|
||||
{
|
||||
return this.itor.next();
|
||||
}
|
||||
|
|
|
@ -255,6 +255,7 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService
|
|||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private String[] getGroups (Subject subject)
|
||||
{
|
||||
//get all the roles of the various types
|
||||
|
|
|
@ -37,6 +37,11 @@ import java.security.Principal;
|
|||
*/
|
||||
public class JAASPrincipal implements Principal, Serializable
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5538962177019315479L;
|
||||
|
||||
private String _name = null;
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ package org.eclipse.jetty.plus.jaas;
|
|||
public class JAASRole extends JAASPrincipal
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3465114254970134526L;
|
||||
|
||||
public JAASRole(String name)
|
||||
{
|
||||
super (name);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class StrictRoleCheckPolicy implements RoleCheckPolicy
|
|||
{
|
||||
if (roles == null)
|
||||
return false;
|
||||
Enumeration rolesEnum = roles.members();
|
||||
Enumeration<? extends Principal> rolesEnum = roles.members();
|
||||
boolean found = false;
|
||||
while (rolesEnum.hasMoreElements() && !found)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ import javax.security.auth.callback.Callback;
|
|||
public class RequestParameterCallback implements Callback
|
||||
{
|
||||
private String _paramName;
|
||||
private List _paramValues;
|
||||
private List<?> _paramValues;
|
||||
|
||||
public void setParameterName (String name)
|
||||
{
|
||||
|
@ -44,12 +44,12 @@ public class RequestParameterCallback implements Callback
|
|||
return _paramName;
|
||||
}
|
||||
|
||||
public void setParameterValues (List values)
|
||||
public void setParameterValues (List<?> values)
|
||||
{
|
||||
_paramValues = values;
|
||||
}
|
||||
|
||||
public List getParameterValues ()
|
||||
public List<?> getParameterValues ()
|
||||
{
|
||||
return _paramValues;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public abstract class AbstractDatabaseLoginModule extends AbstractLoginModule
|
|||
statement = connection.prepareStatement (rolesQuery);
|
||||
statement.setString (1, userName);
|
||||
results = statement.executeQuery();
|
||||
List roles = new ArrayList();
|
||||
List<String> roles = new ArrayList<String>();
|
||||
|
||||
while (results.next())
|
||||
{
|
||||
|
@ -110,8 +110,8 @@ public abstract class AbstractDatabaseLoginModule extends AbstractLoginModule
|
|||
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map sharedState,
|
||||
Map options)
|
||||
Map<String,?> sharedState,
|
||||
Map<String,?> options)
|
||||
{
|
||||
super.initialize(subject, callbackHandler, sharedState, options);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class AbstractLoginModule implements LoginModule
|
|||
{
|
||||
private UserInfo user;
|
||||
private Principal principal;
|
||||
private List roles;
|
||||
private List<JAASRole> roles;
|
||||
|
||||
public JAASUserInfo (UserInfo u)
|
||||
{
|
||||
|
@ -73,10 +73,10 @@ public abstract class AbstractLoginModule implements LoginModule
|
|||
{
|
||||
this.user = u;
|
||||
this.principal = new JAASPrincipal(u.getUserName());
|
||||
this.roles = new ArrayList();
|
||||
this.roles = new ArrayList<JAASRole>();
|
||||
if (u.getRoleNames() != null)
|
||||
{
|
||||
Iterator itor = u.getRoleNames().iterator();
|
||||
Iterator<String> itor = u.getRoleNames().iterator();
|
||||
while (itor.hasNext())
|
||||
this.roles.add(new JAASRole((String)itor.next()));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public abstract class AbstractLoginModule implements LoginModule
|
|||
* @param options
|
||||
*/
|
||||
public void initialize(Subject subject, CallbackHandler callbackHandler,
|
||||
Map sharedState, Map options)
|
||||
Map<String,?> sharedState, Map<String,?> options)
|
||||
{
|
||||
this.callbackHandler = callbackHandler;
|
||||
this.subject = subject;
|
||||
|
|
|
@ -45,8 +45,8 @@ public class DataSourceLoginModule extends AbstractDatabaseLoginModule
|
|||
*/
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map sharedState,
|
||||
Map options)
|
||||
Map<String,?> sharedState,
|
||||
Map<String,?> options)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -81,8 +81,8 @@ public class JDBCLoginModule extends AbstractDatabaseLoginModule
|
|||
*/
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map sharedState,
|
||||
Map options)
|
||||
Map<String,?> sharedState,
|
||||
Map<String,?> options)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -196,7 +196,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
|
||||
pwdCredential = convertCredentialLdapToJetty(pwdCredential);
|
||||
Credential credential = Credential.getCredential(pwdCredential);
|
||||
List roles = getUserRoles(_rootContext, username);
|
||||
List<String> roles = getUserRoles(_rootContext, username);
|
||||
|
||||
return new UserInfo(username, credential, roles);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
try
|
||||
{
|
||||
Object[] filterArguments = {_userObjectClass, _userIdAttribute, username};
|
||||
NamingEnumeration results = _rootContext.search(_userBaseDn, filter, filterArguments, ctls);
|
||||
NamingEnumeration<SearchResult> results = _rootContext.search(_userBaseDn, filter, filterArguments, ctls);
|
||||
|
||||
Log.debug("Found user?: " + results.hasMoreElements());
|
||||
|
||||
|
@ -305,16 +305,16 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
* @return
|
||||
* @throws LoginException
|
||||
*/
|
||||
private List getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException
|
||||
private List<String> getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException
|
||||
{
|
||||
String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn;
|
||||
|
||||
return getUserRolesByDn(dirContext, userDn);
|
||||
}
|
||||
|
||||
private List getUserRolesByDn(DirContext dirContext, String userDn) throws LoginException, NamingException
|
||||
private List<String> getUserRolesByDn(DirContext dirContext, String userDn) throws LoginException, NamingException
|
||||
{
|
||||
ArrayList roleList = new ArrayList();
|
||||
List<String> roleList = new ArrayList<String>();
|
||||
|
||||
if (dirContext == null || _roleBaseDn == null || _roleMemberAttribute == null || _roleObjectClass == null)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
|
||||
String filter = "(&(objectClass={0})({1}={2}))";
|
||||
Object[] filterArguments = {_roleObjectClass, _roleMemberAttribute, userDn};
|
||||
NamingEnumeration results = dirContext.search(_roleBaseDn, filter, filterArguments, ctls);
|
||||
NamingEnumeration<SearchResult> results = dirContext.search(_roleBaseDn, filter, filterArguments, ctls);
|
||||
|
||||
Log.debug("Found user roles?: " + results.hasMoreElements());
|
||||
|
||||
|
@ -349,10 +349,10 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
continue;
|
||||
}
|
||||
|
||||
NamingEnumeration roles = roleAttribute.getAll();
|
||||
NamingEnumeration<?> roles = roleAttribute.getAll();
|
||||
while (roles.hasMore())
|
||||
{
|
||||
roleList.add(roles.next());
|
||||
roleList.add(roles.next().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,12 +468,12 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
|
||||
Log.info("Attempting authentication: " + userDn);
|
||||
|
||||
Hashtable environment = getEnvironment();
|
||||
Hashtable<Object,Object> environment = getEnvironment();
|
||||
environment.put(Context.SECURITY_PRINCIPAL, userDn);
|
||||
environment.put(Context.SECURITY_CREDENTIALS, password);
|
||||
|
||||
DirContext dirContext = new InitialDirContext(environment);
|
||||
List roles = getUserRolesByDn(dirContext, userDn);
|
||||
List<String> roles = getUserRolesByDn(dirContext, userDn);
|
||||
|
||||
UserInfo userInfo = new UserInfo(username, null, roles);
|
||||
setCurrentUser(new JAASUserInfo(userInfo));
|
||||
|
@ -498,7 +498,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
_userIdAttribute,
|
||||
username
|
||||
};
|
||||
NamingEnumeration results = _rootContext.search(_userBaseDn, filter, filterArguments, ctls);
|
||||
NamingEnumeration<SearchResult> results = _rootContext.search(_userBaseDn, filter, filterArguments, ctls);
|
||||
|
||||
Log.info("Found user?: " + results.hasMoreElements());
|
||||
|
||||
|
@ -522,8 +522,8 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
*/
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map sharedState,
|
||||
Map options)
|
||||
Map<String,?> sharedState,
|
||||
Map<String,?> options)
|
||||
{
|
||||
super.initialize(subject, callbackHandler, sharedState, options);
|
||||
|
||||
|
@ -595,7 +595,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
return super.abort();
|
||||
}
|
||||
|
||||
private String getOption(Map options, String key, String defaultValue)
|
||||
private String getOption(Map<String,?> options, String key, String defaultValue)
|
||||
{
|
||||
Object value = options.get(key);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.jetty.util.log.Log;
|
|||
public class PropertyFileLoginModule extends AbstractLoginModule
|
||||
{
|
||||
public static final String DEFAULT_FILENAME = "realm.properties";
|
||||
public static final Map fileMap = new HashMap();
|
||||
public static final Map<String, Map<String, UserInfo>> fileMap = new HashMap<String, Map<String, UserInfo>>();
|
||||
|
||||
private String propertyFileName;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class PropertyFileLoginModule extends AbstractLoginModule
|
|||
* @param options
|
||||
*/
|
||||
public void initialize(Subject subject, CallbackHandler callbackHandler,
|
||||
Map sharedState, Map options)
|
||||
Map<String,?> sharedState, Map<String,?> options)
|
||||
{
|
||||
super.initialize(subject, callbackHandler, sharedState, options);
|
||||
loadProperties((String)options.get("file"));
|
||||
|
@ -95,14 +95,14 @@ public class PropertyFileLoginModule extends AbstractLoginModule
|
|||
return;
|
||||
}
|
||||
|
||||
Map userInfoMap = new HashMap();
|
||||
Map<String, UserInfo> userInfoMap = new HashMap<String, UserInfo>();
|
||||
Properties props = new Properties();
|
||||
props.load(new FileInputStream(propsFile));
|
||||
Iterator iter = props.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object,Object>> iter = props.entrySet().iterator();
|
||||
while(iter.hasNext())
|
||||
{
|
||||
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Map.Entry<Object,Object> entry = iter.next();
|
||||
String username=entry.getKey().toString().trim();
|
||||
String credentials=entry.getValue().toString().trim();
|
||||
String roles=null;
|
||||
|
@ -116,7 +116,7 @@ public class PropertyFileLoginModule extends AbstractLoginModule
|
|||
if (username!=null && username.length()>0 &&
|
||||
credentials!=null && credentials.length()>0)
|
||||
{
|
||||
ArrayList roleList = new ArrayList();
|
||||
ArrayList<String> roleList = new ArrayList<String>();
|
||||
if(roles!=null && roles.length()>0)
|
||||
{
|
||||
StringTokenizer tok = new StringTokenizer(roles,", ");
|
||||
|
@ -146,7 +146,7 @@ public class PropertyFileLoginModule extends AbstractLoginModule
|
|||
*/
|
||||
public UserInfo getUserInfo (String username) throws Exception
|
||||
{
|
||||
Map userInfoMap = (Map)fileMap.get(propertyFileName);
|
||||
Map<?, ?> userInfoMap = (Map<?, ?>)fileMap.get(propertyFileName);
|
||||
if (userInfoMap == null)
|
||||
return null;
|
||||
return (UserInfo)userInfoMap.get(username);
|
||||
|
|
|
@ -29,38 +29,40 @@ import org.eclipse.jetty.http.security.Credential;
|
|||
public class UserInfo
|
||||
{
|
||||
|
||||
private String userName;
|
||||
private Credential credential;
|
||||
private List roleNames;
|
||||
private String _userName;
|
||||
private Credential _credential;
|
||||
private List<String> _roleNames;
|
||||
|
||||
|
||||
public UserInfo (String userName, Credential credential, List roleNames)
|
||||
public UserInfo (String userName, Credential credential, List<String> roleNames)
|
||||
{
|
||||
this.userName = userName;
|
||||
this.credential = credential;
|
||||
this.roleNames = new ArrayList();
|
||||
_userName = userName;
|
||||
_credential = credential;
|
||||
_roleNames = new ArrayList<String>();
|
||||
if (roleNames != null)
|
||||
this.roleNames.addAll(roleNames);
|
||||
{
|
||||
_roleNames.addAll(roleNames);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return this.userName;
|
||||
return this._userName;
|
||||
}
|
||||
|
||||
public List getRoleNames ()
|
||||
public List<String> getRoleNames ()
|
||||
{
|
||||
return new ArrayList(this.roleNames);
|
||||
return new ArrayList<String>(_roleNames);
|
||||
}
|
||||
|
||||
public boolean checkCredential (Object suppliedCredential)
|
||||
{
|
||||
return this.credential.check(suppliedCredential);
|
||||
return _credential.check(suppliedCredential);
|
||||
}
|
||||
|
||||
protected Credential getCredential ()
|
||||
{
|
||||
return this.credential;
|
||||
return _credential;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,20 +96,15 @@ public class NamingEntryUtil
|
|||
return entry;
|
||||
}
|
||||
|
||||
|
||||
public static Object lookup (Object scope, String jndiName)
|
||||
throws NamingException
|
||||
public static Object lookup(Object scope, String jndiName) throws NamingException
|
||||
{
|
||||
Object o = null;
|
||||
|
||||
Name scopeName = getNameForScope(scope);
|
||||
InitialContext ic = new InitialContext();
|
||||
NameParser parser = ic.getNameParser("");
|
||||
scopeName.addAll(parser.parse(jndiName));
|
||||
return ic.lookup(scopeName);
|
||||
Name scopeName = getNameForScope(scope);
|
||||
InitialContext ic = new InitialContext();
|
||||
NameParser parser = ic.getNameParser("");
|
||||
scopeName.addAll(parser.parse(jndiName));
|
||||
return ic.lookup(scopeName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all NameEntries of a certain type in the given naming
|
||||
* environment scope (server-wide names or context-specific names)
|
||||
|
@ -119,20 +114,20 @@ public class NamingEntryUtil
|
|||
* @return all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)
|
||||
* @throws NamingException
|
||||
*/
|
||||
public static List lookupNamingEntries (Object scope, Class clazz)
|
||||
public static List<Object> lookupNamingEntries (Object scope, Class<?> clazz)
|
||||
throws NamingException
|
||||
{
|
||||
try
|
||||
{
|
||||
Context scopeContext = getContextForScope(scope);
|
||||
Context namingEntriesContext = (Context)scopeContext.lookup(NamingEntry.__contextName);
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList<Object> list = new ArrayList<Object>();
|
||||
lookupNamingEntries(list, namingEntriesContext, clazz);
|
||||
return list;
|
||||
}
|
||||
catch (NameNotFoundException e)
|
||||
{
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,15 +206,15 @@ public class NamingEntryUtil
|
|||
* @return
|
||||
* @throws NamingException
|
||||
*/
|
||||
private static List lookupNamingEntries (List list, Context context, Class clazz)
|
||||
private static List<Object> lookupNamingEntries (List<Object> list, Context context, Class<?> clazz)
|
||||
throws NamingException
|
||||
{
|
||||
try
|
||||
{
|
||||
NamingEnumeration nenum = context.listBindings("");
|
||||
NamingEnumeration<Binding> nenum = context.listBindings("");
|
||||
while (nenum.hasMoreElements())
|
||||
{
|
||||
Binding binding = (Binding)nenum.next();
|
||||
Binding binding = nenum.next();
|
||||
if (binding.getObject() instanceof Context)
|
||||
lookupNamingEntries (list, (Context)binding.getObject(), clazz);
|
||||
else if (clazz.isInstance(binding.getObject()))
|
||||
|
|
|
@ -60,7 +60,6 @@ public class DataSourceLoginService extends MappedLoginService
|
|||
private String _userRoleTableUserKey = "user_id";
|
||||
private String _userRoleTableRoleKey = "role_id";
|
||||
private int _cacheMs = 30000;
|
||||
private long _lastHashPurge = 0;
|
||||
private String _userSql;
|
||||
private String _roleSql;
|
||||
private boolean _createTables = false;
|
||||
|
@ -350,6 +349,7 @@ public class DataSourceLoginService extends MappedLoginService
|
|||
if (_datasource != null)
|
||||
return;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
InitialContext ic = new InitialContext();
|
||||
|
||||
//TODO webapp scope?
|
||||
|
|
|
@ -28,10 +28,8 @@ import javax.naming.NamingException;
|
|||
|
||||
import org.eclipse.jetty.jndi.NamingContext;
|
||||
import org.eclipse.jetty.jndi.NamingUtil;
|
||||
import org.eclipse.jetty.jndi.java.javaRootURLContext;
|
||||
import org.eclipse.jetty.jndi.local.localContextRoot;
|
||||
import org.eclipse.jetty.plus.jndi.EnvEntry;
|
||||
import org.eclipse.jetty.plus.jndi.NamingEntry;
|
||||
import org.eclipse.jetty.plus.jndi.NamingEntryUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.AbstractConfiguration;
|
||||
|
@ -148,6 +146,7 @@ public class EnvConfiguration extends AbstractConfiguration
|
|||
compCtx.destroySubcontext("env");
|
||||
|
||||
//unbind any NamingEntries that were configured in this webapp's name space
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Bound> bindings = (List<Bound>)context.getAttribute(JETTY_ENV_BINDINGS);
|
||||
context.setAttribute(JETTY_ENV_BINDINGS,null);
|
||||
if (bindings!=null)
|
||||
|
@ -203,8 +202,8 @@ public class EnvConfiguration extends AbstractConfiguration
|
|||
InitialContext ic = new InitialContext();
|
||||
Context envCtx = (Context)ic.lookup("java:comp/env");
|
||||
Object scope = null;
|
||||
List list = NamingEntryUtil.lookupNamingEntries(scope, EnvEntry.class);
|
||||
Iterator itor = list.iterator();
|
||||
List<Object> list = NamingEntryUtil.lookupNamingEntries(scope, EnvEntry.class);
|
||||
Iterator<Object> itor = list.iterator();
|
||||
while (itor.hasNext())
|
||||
{
|
||||
EnvEntry ee = (EnvEntry)itor.next();
|
||||
|
|
|
@ -21,7 +21,6 @@ import javax.naming.NameNotFoundException;
|
|||
|
||||
import org.eclipse.jetty.plus.annotation.InjectionCollection;
|
||||
import org.eclipse.jetty.plus.annotation.LifeCycleCallbackCollection;
|
||||
import org.eclipse.jetty.plus.annotation.RunAsCollection;
|
||||
import org.eclipse.jetty.plus.jndi.Transaction;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.AbstractConfiguration;
|
||||
|
|
|
@ -22,10 +22,9 @@ import javax.servlet.ServletException;
|
|||
import org.eclipse.jetty.plus.annotation.InjectionCollection;
|
||||
import org.eclipse.jetty.plus.annotation.LifeCycleCallbackCollection;
|
||||
import org.eclipse.jetty.plus.annotation.RunAsCollection;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler.Decorator;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
{
|
||||
Descriptor otherFragment = context.getMetaData().getOriginDescriptor("resource-ref."+jndiName);
|
||||
XmlParser.Node otherFragmentRoot = otherFragment.getRoot();
|
||||
Iterator iter = otherFragmentRoot.iterator();
|
||||
Iterator<Object> iter = otherFragmentRoot.iterator();
|
||||
XmlParser.Node otherNode = null;
|
||||
while (iter.hasNext() && otherNode == null)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
{
|
||||
Descriptor otherFragment = context.getMetaData().getOriginDescriptor("resource-env-ref."+jndiName);
|
||||
XmlParser.Node otherFragmentRoot = otherFragment.getRoot();
|
||||
Iterator iter = otherFragmentRoot.iterator();
|
||||
Iterator<Object> iter = otherFragmentRoot.iterator();
|
||||
XmlParser.Node otherNode = null;
|
||||
while (iter.hasNext() && otherNode == null)
|
||||
{
|
||||
|
@ -491,7 +491,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
{
|
||||
Descriptor otherFragment = context.getMetaData().getOriginDescriptor("message-destination-ref."+jndiName);
|
||||
XmlParser.Node otherFragmentRoot = otherFragment.getRoot();
|
||||
Iterator iter = otherFragmentRoot.iterator();
|
||||
Iterator<Object> iter = otherFragmentRoot.iterator();
|
||||
XmlParser.Node otherNode = null;
|
||||
while (iter.hasNext() && otherNode == null)
|
||||
{
|
||||
|
@ -706,11 +706,11 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
*/
|
||||
public void addInjections (WebAppContext context, Descriptor descriptor, XmlParser.Node node, String jndiName, Class<?> valueClass)
|
||||
{
|
||||
Iterator itor = node.iterator("injection-target");
|
||||
Iterator<XmlParser.Node> itor = node.iterator("injection-target");
|
||||
|
||||
while(itor.hasNext())
|
||||
{
|
||||
XmlParser.Node injectionNode = (XmlParser.Node)itor.next();
|
||||
XmlParser.Node injectionNode = itor.next();
|
||||
String targetClassName = injectionNode.getString("injection-target-class", false, true);
|
||||
String targetName = injectionNode.getString("injection-target-name", false, true);
|
||||
if ((targetClassName==null) || targetClassName.equals(""))
|
||||
|
@ -852,7 +852,6 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
{
|
||||
//if we found a mapping, get out name it is mapped to in the environment
|
||||
nameInEnvironment = ((Link)ne).getLink();
|
||||
Link l = (Link)ne;
|
||||
}
|
||||
|
||||
//try finding that mapped name in the webapp's environment first
|
||||
|
|
Loading…
Reference in New Issue