Author: cziegeler
Date: Wed Dec 19 06:56:06 2007
New Revision: 605560
URL: http://svn.apache.org/viewvc?rev=605560&view=rev
Log:
Use generics.
Modified:
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/AbstractRegistrationSupport.java
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/JndiRegistrationSupport.java
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/SlingServerRepository.java
Modified:
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/AbstractRegistrationSupport.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/AbstractRegistrationSupport.java?rev=605560&r1=605559&r2=605560&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/AbstractRegistrationSupport.java
(original)
+++
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/AbstractRegistrationSupport.java
Wed Dec 19 06:56:06 2007
@@ -58,13 +58,13 @@
* The (possibly empty) map of repositories which have been bound to the
* registry before the registry has been activated.
*/
- private final Map repositoryRegistrationBacklog = new HashMap();
+ private final Map<String, ServiceReference> repositoryRegistrationBacklog
= new HashMap<String, ServiceReference>();
/**
* The map of repositories which have been bound to the registry component
* and which are actually registered with the registry.
*/
- private final Map registeredRepositories = new HashMap();
+ private final Map<String, Object> registeredRepositories = new
HashMap<String, Object>();
/**
* A lock to serialize access to the registry management in this class.
@@ -224,11 +224,11 @@
if (this.doActivate()) {
// register all repositories in the tmp map
- for (Iterator ri =
this.repositoryRegistrationBacklog.entrySet().iterator(); ri.hasNext();) {
- Map.Entry entry = (Map.Entry) ri.next();
+ for (Iterator<Map.Entry<String, ServiceReference>> ri =
this.repositoryRegistrationBacklog.entrySet().iterator(); ri.hasNext();) {
+ Map.Entry<String, ServiceReference> entry = ri.next();
- this.bindRepositoryInternal((String) entry.getKey(),
- (ServiceReference) entry.getValue());
+ this.bindRepositoryInternal(entry.getKey(),
+ entry.getValue());
ri.remove();
}
@@ -258,10 +258,10 @@
synchronized (this.registryLock) {
// unregister all repositories in the tmp map
- for (Iterator ri =
this.registeredRepositories.entrySet().iterator(); ri.hasNext();) {
- Map.Entry entry = (Map.Entry) ri.next();
+ for (Iterator<Map.Entry<String, Object>> ri =
this.registeredRepositories.entrySet().iterator(); ri.hasNext();) {
+ Map.Entry<String, Object> entry = ri.next();
- this.unbindRepository((String) entry.getKey(),
entry.getValue());
+ this.unbindRepository(entry.getKey(), entry.getValue());
ri.remove();
}
Modified:
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java?rev=605560&r1=605559&r2=605560&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java
(original)
+++
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java
Wed Dec 19 06:56:06 2007
@@ -101,7 +101,7 @@
SlingServerRepository.copyFile(context.getBundle(),
"repository.xml", configFile);
// we have no configuration, create from default settings
- Hashtable props = new Hashtable();
+ Hashtable<String, String> props = new Hashtable<String, String>();
props.put(SLING_CONTEXT, slingContext);
props.put(SlingServerRepository.REPOSITORY_CONFIG_URL,
configFile.getPath());
props.put(SlingServerRepository.REPOSITORY_HOME_DIR,
homeDir.getPath());
Modified:
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/JndiRegistrationSupport.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/JndiRegistrationSupport.java?rev=605560&r1=605559&r2=605560&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/JndiRegistrationSupport.java
(original)
+++
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/JndiRegistrationSupport.java
Wed Dec 19 06:56:06 2007
@@ -21,7 +21,6 @@
import java.security.PrivilegedExceptionAction;
import java.util.Dictionary;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Properties;
import javax.jcr.Repository;
@@ -65,10 +64,11 @@
// ---------- SCR intergration
---------------------------------------------
protected boolean doActivate() {
- Dictionary props = this.getComponentContext().getProperties();
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> props =
this.getComponentContext().getProperties();
Properties env = new Properties();
- for (Enumeration pe = props.keys(); pe.hasMoreElements();) {
- String key = (String) pe.nextElement();
+ for (Enumeration<String> pe = props.keys(); pe.hasMoreElements();) {
+ String key = pe.nextElement();
if (key.startsWith("java.naming.")) {
env.setProperty(key, (String) props.get(key));
}
@@ -106,10 +106,10 @@
}
}
- private Context createInitialContext(final Hashtable env) throws
NamingException {
+ private Context createInitialContext(final Properties env) throws
NamingException {
try {
- return (Context) AccessController.doPrivileged(new
PrivilegedExceptionAction() {
- public Object run() throws NamingException {
+ return AccessController.doPrivileged(new
PrivilegedExceptionAction<Context>() {
+ public Context run() throws NamingException {
Thread currentThread = Thread.currentThread();
ClassLoader old = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(JndiRegistrationSupport.this.getClass().getClassLoader());
Modified:
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/SlingServerRepository.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/SlingServerRepository.java?rev=605560&r1=605559&r2=605560&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/SlingServerRepository.java
(original)
+++
incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/SlingServerRepository.java
Wed Dec 19 06:56:06 2007
@@ -165,8 +165,8 @@
//---------- Repository Publication ---------------------------------------
private Repository getRepository() throws RepositoryException, IOException
{
-
- Dictionary environment = this.getComponentContext().getProperties();
+ @SuppressWarnings("unchecked")
+ Dictionary<String, Object> environment =
this.getComponentContext().getProperties();
String configURLObj = (String) environment.get(REPOSITORY_CONFIG_URL);
String home = (String) environment.get(REPOSITORY_HOME_DIR);