Add @Override to the inherited methods. Remove redundant casts. Remove redundant inheritance of interfaces. Remove redundant if/else clause.
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/Activator.java b/framework/src/main/java/org/eclipse/gemini/naming/Activator.java
index 1efdc77..ebe5ce9 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/Activator.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/Activator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2012 Oracle.
+ * Copyright (c) 2010, 2015 Oracle.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * and Apache License v2.0 which accompanies this distribution. 
@@ -67,6 +67,7 @@
 	 * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
 	 * )
 	 */
+	@Override
 	public void start(BundleContext context) throws Exception {
 		logger.info("Initializing Gemini Naming Factory Manager Bundle");
 		
@@ -102,6 +103,7 @@
 	 * @see
 	 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
 	 */
+	@Override
 	public void stop(BundleContext context) throws Exception {
 		logger.info("Shutting down Gemini Naming Factory Manager Bundle");
 		
@@ -114,8 +116,7 @@
 		// unregister all the JNDI services registered by this Activator
 		Iterator<ServiceRegistration> iterator = m_listOfServiceRegistrations.iterator();
 		while(iterator.hasNext()) {
-			ServiceRegistration serviceRegistration = 
-				(ServiceRegistration)iterator.next();
+			ServiceRegistration serviceRegistration = iterator.next();
 			serviceRegistration.unregister();
 		}
 		
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java b/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java
index 3808dbf..34804c4 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010, 2013 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -111,6 +111,7 @@
 	 *

 	 */

 	private static class EnvironmentPropertyStrategyImpl implements GetBundleContextStrategy {

+		@Override

 		public BundleContext getBundleContext(Hashtable environment, String namingClassType) {

 			if((environment != null) && (environment.containsKey(JNDIConstants.BUNDLE_CONTEXT))) {

 				Object result = 

@@ -131,11 +132,13 @@
 	 *

 	 */

 	private static class ThreadContextStrategyImpl implements GetBundleContextStrategy {

+		@Override

 		public BundleContext getBundleContext(Hashtable environment, String namingClassType) {

 			ClassLoader threadContextClassloader = null;

 			try {

 				// this code must run in a doPrivileged() block

 				threadContextClassloader = (ClassLoader)SecurityUtils.invokePrivilegedAction(new PrivilegedExceptionAction() {

+						@Override

 						public Object run() throws Exception {

 							return Thread.currentThread().getContextClassLoader();

 						}

@@ -163,6 +166,7 @@
 	 * 

 	 */

 	private static class CallStackStrategyImpl implements GetBundleContextStrategy {

+		@Override

 		public BundleContext getBundleContext(Hashtable environment, String namingClassType) {

 			Class[] callStack = null;

 			try {

@@ -170,6 +174,7 @@
 				// since JNDI clients should not have to include this permission in 

 				// order to use JNDI services.  

 				callStack = (Class[])SecurityUtils.invokePrivilegedAction(new PrivilegedExceptionAction() {

+						@Override

 						public Object run() throws Exception {

 							return new CallStackSecurityManager().getClientCallStack();

 						}

@@ -197,6 +202,7 @@
 					try {

 						clientClassLoader =

 							(ClassLoader)SecurityUtils.invokePrivilegedAction(new PrivilegedExceptionAction() {

+								@Override

 								public Object run() throws Exception {

 									return clientClass.getClassLoader();

 								}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerImpl.java
index 1ead4be..3d4a06b 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -50,6 +50,7 @@
 	}

 

 

+	@Override

 	public Context newInitialContext() throws NamingException {

 		synchronized (m_builder) {

 			final Context initialContext = createNewInitialContext(new Hashtable());

@@ -58,6 +59,7 @@
 		}

 	}

 

+	@Override

 	public Context newInitialContext(Map environment)

 			throws NamingException {

 		synchronized (m_builder) {

@@ -67,6 +69,7 @@
 		}

 	}

 

+	@Override

 	public DirContext newInitialDirContext() throws NamingException {

 		synchronized (m_builder) {

 			Context contextToReturn = createNewInitialContext(new Hashtable());

@@ -79,6 +82,7 @@
 		throw new NoInitialContextException("DirContext could not be created.  The matching InitialContextFactory did not create a matching type."); 

 	}

 

+	@Override

 	public DirContext newInitialDirContext(Map environment) throws NamingException {

 		synchronized (m_builder) {

 			Context context = createNewInitialContext(environment);

@@ -95,6 +99,7 @@
 	 * Closes all the known context implementations that have 

 	 * been provided by this service.  

 	 */

+	@Override

 	public void close() {

 		// close known Context implementations

 		synchronized (m_listOfContexts) {

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerServiceFactoryImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerServiceFactoryImpl.java
index 443679e..fb0bc92 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerServiceFactoryImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ContextManagerServiceFactoryImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -40,6 +40,7 @@
 		m_implBundleContext = implBundleContext;

 	}

 	

+	@Override

 	public Object getService(Bundle bundle, ServiceRegistration registration) {

 		CloseableContextManager contextManager = 

 			createContextManager(bundle, m_implBundleContext);

@@ -50,6 +51,7 @@
 

 	

 

+	@Override

 	public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {

 		closeContextManager(bundle);

 	}

@@ -79,6 +81,7 @@
 	

 	

 	private class ContextManagerBundleListener implements SynchronousBundleListener {

+		@Override

 		public void bundleChanged(BundleEvent event) {

 			if(event.getType() == BundleEvent.STOPPED) {

 				if(m_mapOfManagers.containsKey(event.getBundle())) {

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ContextWrapperImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/ContextWrapperImpl.java
index 2af7d76..0ef4094 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ContextWrapperImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ContextWrapperImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2012 Oracle.
+ * Copyright (c) 2010, 2015 Oracle.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * and Apache License v2.0 which accompanies this distribution. 
@@ -41,120 +41,149 @@
 	}
 
 
+	@Override
 	public Object lookup(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).lookup(name);
 	}
 
+	@Override
 	public Object lookup(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).lookup(name);
 	}
 
+	@Override
 	public void bind(Name name, Object obj) throws NamingException {
 		getURLContextOrDefaultContext(name.toString()).bind(name, obj);
 	}
 
+	@Override
 	public void bind(String name, Object obj) throws NamingException {
 		getURLContextOrDefaultContext(name).bind(name, obj);
 	}
 
+	@Override
 	public void rebind(Name name, Object obj) throws NamingException {
 		getURLContextOrDefaultContext(name.toString()).rebind(name, obj);
 	}
 
+	@Override
 	public void rebind(String name, Object obj) throws NamingException {
 		getURLContextOrDefaultContext(name).rebind(name, obj);
 	}
 
+	@Override
 	public void unbind(Name name) throws NamingException {
 		getURLContextOrDefaultContext(name.toString()).unbind(name);
 	}
 
+	@Override
 	public void unbind(String name) throws NamingException {
 		getURLContextOrDefaultContext(name).unbind(name);
 	}
 
+	@Override
 	public void rename(Name oldName, Name newName) throws NamingException {
 		getURLContextOrDefaultContext(oldName.toString()).rename(oldName, newName);
 	}
 
+	@Override
 	public void rename(String oldName, String newName) throws NamingException {
 		getURLContextOrDefaultContext(oldName).rename(oldName, newName);
 	}
 
+	@Override
 	public NamingEnumeration list(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).list(name);
 	}
 
+	@Override
 	public NamingEnumeration list(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).list(name);
 	}
 
+	@Override
 	public NamingEnumeration listBindings(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).listBindings(name);
 	}
 
+	@Override
 	public NamingEnumeration listBindings(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).listBindings(name);
 	}
 
+	@Override
 	public void destroySubcontext(Name name) throws NamingException {
 		getURLContextOrDefaultContext(name.toString()).destroySubcontext(name);
 	}
 
+	@Override
 	public void destroySubcontext(String name) throws NamingException {
 		getURLContextOrDefaultContext(name).destroySubcontext(name);
 	}
 
+	@Override
 	public Context createSubcontext(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).createSubcontext(name);
 	}
 
+	@Override
 	public Context createSubcontext(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).createSubcontext(name);
 	}
 
+	@Override
 	public Object lookupLink(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).lookupLink(name);
 	}
 
+	@Override
 	public Object lookupLink(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).lookupLink(name);
 	}
 
+	@Override
 	public NameParser getNameParser(Name name) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).getNameParser(name);
 	}
 
+	@Override
 	public NameParser getNameParser(String name) throws NamingException {
 		return getURLContextOrDefaultContext(name).getNameParser(name);
 	}
 
+	@Override
 	public Name composeName(Name name, Name prefix) throws NamingException {
 		return getURLContextOrDefaultContext(name.toString()).composeName(name, prefix);
 	}
 
+	@Override
 	public String composeName(String name, String prefix)
 			throws NamingException {
 		return getURLContextOrDefaultContext(name).composeName(name, prefix);
 	}
 
+	@Override
 	public Object addToEnvironment(String propName, Object propVal)
 			throws NamingException {
 		return m_context.addToEnvironment(propName, propVal);
 	}
 
+	@Override
 	public Object removeFromEnvironment(String propName) throws NamingException {
 		return m_context.removeFromEnvironment(propName);
 	}
 
+	@Override
 	public Hashtable getEnvironment() throws NamingException {
 		return m_context.getEnvironment();
 	}
 
+	@Override
 	public void close() throws NamingException {
 		m_context.close();
 	}
 
+	@Override
 	public String getNameInNamespace() throws NamingException {
 		return m_context.getNameInNamespace();
 	}
@@ -235,6 +264,7 @@
 			m_name = name;
 		}
 
+		@Override
 		public Object run() throws Exception {
 			return obtainObjectFactory(m_name);
 		}
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/DefaultInitialContextFactory.java b/framework/src/main/java/org/eclipse/gemini/naming/DefaultInitialContextFactory.java
index 47ff735..af1bcd5 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/DefaultInitialContextFactory.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/DefaultInitialContextFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -36,6 +36,7 @@
  */

 class DefaultInitialContextFactory implements InitialContextFactory {

 

+	@Override

 	public Context getInitialContext(Hashtable environment) throws NamingException {

 		return (Context) Proxy.newProxyInstance(this.getClass().getClassLoader(),

 				                                new Class[] {Context.class}, 

@@ -52,6 +53,7 @@
 	 */

 	private static class DefaultContextInvocationHandler implements InvocationHandler {

 

+		@Override

 		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

 			// special case for close() invocation

 			if(method.getName().equals("close")) {

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/DefaultRuntimeInitialContextFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/DefaultRuntimeInitialContextFactoryBuilder.java
index 1c385a8..6790f31 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/DefaultRuntimeInitialContextFactoryBuilder.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/DefaultRuntimeInitialContextFactoryBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -40,6 +40,7 @@
 	private static final Logger	logger	= 

 		Logger.getLogger(DefaultRuntimeInitialContextFactoryBuilder.class.getName());

 

+	@Override

 	public InitialContextFactory createInitialContextFactory(Hashtable environment) throws NamingException {

 		if ((environment != null) && 

 				(environment.get(Context.INITIAL_CONTEXT_FACTORY) != null)) {

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/DirContextWrapperImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/DirContextWrapperImpl.java
index 1c124e3..14165b8 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/DirContextWrapperImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/DirContextWrapperImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -32,125 +32,151 @@
 		m_dirContext = dirContext;

 	}

 	

+	@Override

 	public void bind(String name, Object obj, Attributes attributes)

 			throws NamingException {

 		m_dirContext.bind(name, obj, attributes);

 

 	}

 

+	@Override

 	public void bind(Name name, Object obj, Attributes attributes)

 			throws NamingException {

 		m_dirContext.bind(name, obj, attributes);

 	}

 

+	@Override

 	public DirContext createSubcontext(String name, Attributes attributes)

 			throws NamingException {

 		return m_dirContext.createSubcontext(name, attributes);

 	}

 

+	@Override

 	public DirContext createSubcontext(Name name, Attributes attributes)

 			throws NamingException {

 		return m_dirContext.createSubcontext(name, attributes);

 	}

 

+	@Override

 	public Attributes getAttributes(String name) throws NamingException {

 		return m_dirContext.getAttributes(name);

 	}

 

+	@Override

 	public Attributes getAttributes(Name name) throws NamingException {

 		return m_dirContext.getAttributes(name);

 	}

 

+	@Override

 	public Attributes getAttributes(String name, String[] values)

 			throws NamingException {

 		return m_dirContext.getAttributes(name, values);

 	}

 

+	@Override

 	public Attributes getAttributes(Name name, String[] values)

 			throws NamingException {

 		return m_dirContext.getAttributes(name, values);

 	}

 

+	@Override

 	public DirContext getSchema(String name) throws NamingException {

 		return m_dirContext.getSchema(name);

 	}

 

+	@Override

 	public DirContext getSchema(Name name) throws NamingException {

 		return m_dirContext.getSchema(name);

 	}

 

+	@Override

 	public DirContext getSchemaClassDefinition(String name)

 			throws NamingException {

 		return m_dirContext.getSchemaClassDefinition(name);

 	}

 

+	@Override

 	public DirContext getSchemaClassDefinition(Name name)

 			throws NamingException {

 		return m_dirContext.getSchemaClassDefinition(name);

 	}

 

+	@Override

 	public void modifyAttributes(String name, ModificationItem[] values)

 			throws NamingException {

 		m_dirContext.modifyAttributes(name, values);

 	}

 

+	@Override

 	public void modifyAttributes(Name name, ModificationItem[] values)

 			throws NamingException {

 		m_dirContext.modifyAttributes(name, values);

 	}

 

+	@Override

 	public void modifyAttributes(String name, int index, Attributes attributes)

 			throws NamingException {

 		m_dirContext.modifyAttributes(name, index, attributes);

 	}

 

+	@Override

 	public void modifyAttributes(Name name, int index, Attributes attributes)

 			throws NamingException {

 		m_dirContext.modifyAttributes(name, index, attributes);

 	}

 

+	@Override

 	public void rebind(String name, Object obj, Attributes attributes)

 			throws NamingException {

 		m_dirContext.rebind(name, obj, attributes);

 	}

 

+	@Override

 	public void rebind(Name name, Object obj, Attributes attributes)

 			throws NamingException {

 		m_dirContext.rebind(name, obj, attributes);

 	}

 

+	@Override

 	public NamingEnumeration search(String name, Attributes attributes)

 			throws NamingException {

 		return m_dirContext.search(name, attributes);

 	}

 

+	@Override

 	public NamingEnumeration search(Name name, Attributes attributes)

 			throws NamingException {

 		return m_dirContext.search(name, attributes);

 	}

 

+	@Override

 	public NamingEnumeration search(String name, String filter, SearchControls searchControls) throws NamingException {

 		return m_dirContext.search(name, filter, searchControls);

 	}

 

+	@Override

 	public NamingEnumeration search(String name, Attributes attributes, String[] attributesToReturn)

 			throws NamingException {

 		return m_dirContext.search(name, attributes, attributesToReturn);

 	}

 

+	@Override

 	public NamingEnumeration search(Name name, String filter, SearchControls searchControls)

 			throws NamingException {

 		return m_dirContext.search(name, filter, searchControls);

 	}

 

+	@Override

 	public NamingEnumeration search(Name name, Attributes attributes, String[] attributesToReturn) throws NamingException {

 		return m_dirContext.search(name, attributes, attributesToReturn);

 	}

 

+	@Override

 	public NamingEnumeration search(String name, String filter, Object[] filterArgs, SearchControls searchControls) throws NamingException {

 		return m_dirContext.search(name, filter, filterArgs, searchControls);

 	}

 

+	@Override

 	public NamingEnumeration search(Name name, String filter, Object[] filterArgs, SearchControls searchControls) throws NamingException {

 		return m_dirContext.search(name, filter, filterArgs, searchControls);

 	}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/InitialContextFactoryWrapper.java b/framework/src/main/java/org/eclipse/gemini/naming/InitialContextFactoryWrapper.java
index f14b62f..f035370 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/InitialContextFactoryWrapper.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/InitialContextFactoryWrapper.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010, 2013 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -36,6 +36,7 @@
 		m_factoryManager = factoryManager;

 	}

 

+	@Override

 	public Context getInitialContext(Hashtable environment) throws NamingException {

 		final Context contextToReturn = 

 			m_initialContextFactory.getInitialContext(environment);

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/LdapContextWrapperImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/LdapContextWrapperImpl.java
index 5581df9..dcd8f8e 100755
--- a/framework/src/main/java/org/eclipse/gemini/naming/LdapContextWrapperImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/LdapContextWrapperImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2013 SAP AG.

+ * Copyright (c) 2013, 2015 SAP AG.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution.

@@ -29,33 +29,40 @@
 		m_ldapContext = ldapContext;

 	}

 

+	@Override

 	public ExtendedResponse extendedOperation(ExtendedRequest request)

 			throws NamingException {

 		return m_ldapContext.extendedOperation(request);

 	}

 

+	@Override

 	public LdapContext newInstance(Control[] requestControls)

 			throws NamingException {

 		return m_ldapContext.newInstance(requestControls);

 	}

 

+	@Override

 	public void reconnect(Control[] connCtls) throws NamingException {

 		m_ldapContext.reconnect(connCtls);

 	}

 

+	@Override

 	public Control[] getConnectControls() throws NamingException {

 		return m_ldapContext.getConnectControls();

 	}

 

+	@Override

 	public void setRequestControls(Control[] requestControls)

 			throws NamingException {

 		m_ldapContext.setRequestControls(requestControls);

 	}

 

+	@Override

 	public Control[] getRequestControls() throws NamingException {

 		return m_ldapContext.getRequestControls();

 	}

 

+	@Override

 	public Control[] getResponseControls() throws NamingException {

 		return m_ldapContext.getResponseControls();

 	}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/NotSupportedContext.java b/framework/src/main/java/org/eclipse/gemini/naming/NotSupportedContext.java
index 8543c89..15b7ff3 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/NotSupportedContext.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/NotSupportedContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -42,136 +42,165 @@
 		m_exceptionMessage = exceptionMessage;

 	}

 	

+	@Override

 	public Object addToEnvironment(String var0, Object var1) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public void bind(String var0, Object var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void bind(Name var0, Object var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void close() throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public String composeName(String var0, String var1) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Name composeName(Name var0, Name var1) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Context createSubcontext(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Context createSubcontext(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public void destroySubcontext(String var0) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void destroySubcontext(Name var0) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public Hashtable getEnvironment() throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public String getNameInNamespace() throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NameParser getNameParser(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NameParser getNameParser(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NamingEnumeration list(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NamingEnumeration list(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NamingEnumeration listBindings(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public NamingEnumeration listBindings(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Object lookup(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Object lookup(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Object lookupLink(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public Object lookupLink(Name var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public void rebind(String var0, Object var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void rebind(Name var0, Object var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public Object removeFromEnvironment(String var0) throws NamingException {

 		operationNotSupported();

 		return null;

 	}

 

+	@Override

 	public void rename(String var0, String var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void rename(Name var0, Name var1) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void unbind(String var0) throws NamingException {

 		operationNotSupported();

 	}

 

+	@Override

 	public void unbind(Name var0) throws NamingException {

 		operationNotSupported();

 	}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java
index 3c8e553..3632bff 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010, 2013 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -65,8 +65,7 @@
  * request. The builder uses the OSGi service registry to locate JNDI providers.

  * 

  */

-class OSGiInitialContextFactoryBuilder implements

-		InitialContextFactoryBuilder, ObjectFactoryBuilder, FactoryManager {

+class OSGiInitialContextFactoryBuilder implements ObjectFactoryBuilder, FactoryManager {

 

 	private static Logger logger = 

 		Logger.getLogger(OSGiInitialContextFactoryBuilder.class.getName());

@@ -107,6 +106,7 @@
 			// since this code is the only interaction with a BundleContext

 			// context not covered by the security-aware wrapper interfaces

 			SecurityUtils.invokePrivilegedActionNoReturn(new PrivilegedExceptionAction() {

+				@Override

 				public Object run() throws Exception {

 					createServiceTrackers(m_implBundleContext);

 					return null;

@@ -123,6 +123,7 @@
 	 * This builder implementation uses the OSGi service registry to find

 	 * matching JNDI service providers.

 	 */

+	@Override

 	public InitialContextFactory createInitialContextFactory(Hashtable environment) throws NamingException {

 		// check for valid tracker setup

 		if (m_contextFactoryServiceTracker == null) {

@@ -190,6 +191,7 @@
 	 * matching JNDI service providers for resolving references.

 	 * 

 	 */

+	@Override

 	public ObjectFactory createObjectFactory(Object obj, Hashtable environment) throws NamingException {

 		if (m_objectFactoryServiceTracker == null) {

 			throw new NoInitialContextException("No Object factories available");

@@ -217,6 +219,7 @@
 	 * @return a javax.naming.spi.ObjectFactory instance that supports the

 	 *         requested URL scheme, or null if no matching factory was found

 	 */

+	@Override

 	public ObjectFactory getURLContextFactory(String urlScheme) {

 		if (m_urlContextFactoryServiceTracker.getServiceReferences() != null) {

 			ServiceReference[] serviceReferences = ServiceUtils.sortServiceReferences(m_urlContextFactoryServiceTracker);

@@ -230,10 +233,10 @@
 		return null;

 	}

 	

+	@Override

 	public void associateFactoryService(Object factory, Context createdContext) {

 		if(m_mapOfServicesToContexts.containsKey(factory)) {

-			WeakHashMap<Context, Object> listOfContexts =

-				(WeakHashMap<Context, Object>) m_mapOfServicesToContexts.get(factory);

+			WeakHashMap<Context, Object> listOfContexts = m_mapOfServicesToContexts.get(factory);

 			listOfContexts.put(createdContext, null);

 			m_mapOfServicesToContexts.put(factory, listOfContexts);

 		} else {

@@ -244,6 +247,7 @@
 		

 	}

 

+	@Override

 	public boolean isFactoryServiceActive(Object factory) {

 		return m_mapOfServicesToContexts.containsKey(factory);

 	}

@@ -726,6 +730,7 @@
 			super(context, clazz, null);

 		}

 

+		@Override

 		public Object addingService(ServiceReference serviceReference) {

 			if (serviceReference.getProperty(JNDIConstants.JNDI_URLSCHEME) != null) {

 				return super.addingService(serviceReference);

@@ -742,6 +747,7 @@
 			super(context, clazz, null);

 		}

 

+		@Override

 		public Object addingService(ServiceReference serviceReference) {

 			if (serviceReference.getProperty(JNDIConstants.JNDI_URLSCHEME) == null) {

 				return super.addingService(serviceReference);

@@ -758,10 +764,12 @@
 			super(context, clazz, null);

 		}

 

+		@Override

 		public void removedService(ServiceReference reference, Object service) {

 			handleRemovedService(reference, service);

 		}

 

+		@Override

 		public Object addingService(ServiceReference reference) {

 			return handleAddingService(reference);

 		}

@@ -799,6 +807,7 @@
 			m_objectFactory = objectFactory;

 		}

 		

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name,

 				Context context, Hashtable environment) throws Exception {

 

@@ -841,6 +850,7 @@
 		}

 		

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, 

 				                        Context context, Hashtable environment, Attributes attributes) throws Exception {

 			if (m_dirObjectFactory != null) {

@@ -876,6 +886,7 @@
 	 */

 	private final class NoFactoryNameSpecifiedObjectFactory implements ObjectFactory {

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			if(refInfo == null) {

 				return null;

@@ -911,6 +922,7 @@
 	

 	private final class NoFactoryNameSpecifiedDirObjectFactory implements DirObjectFactory {

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment, Attributes attributes) throws Exception {

 			if(refInfo == null) {

 				return null;

@@ -940,6 +952,7 @@
 			return null;

 		}

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			// no-op for this DirObjectFactory

 			return null;

@@ -964,6 +977,7 @@
 	 */

 	private final class FactoryNameSpecifiedObjectFactory implements ObjectFactory {

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			Object objectToResolve = getObjectToResolve(refInfo);

 			if(objectToResolve instanceof Reference) {

@@ -992,6 +1006,7 @@
 	

 	private final class FactoryNameSpecifiedDirObjectFactory implements DirObjectFactory {

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment, Attributes attributes) throws Exception {

 			Object objectToResolve = getObjectToResolve(refInfo);

 			if(objectToResolve instanceof Reference) {

@@ -1016,6 +1031,7 @@
 			return null;

 		}

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			// always return null, since this DirObjectFactory is a wrapper type

 			return null;

@@ -1025,6 +1041,7 @@
 	

 	

 	private class NoReferenceObjectFactory implements ObjectFactory {

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			// first query all known ObjectFactoryBuilder services to resolve this reference

 			Object resultFromBuilders = 

@@ -1049,6 +1066,7 @@
 	

 	private class NoReferenceDirObjectFactory implements DirObjectFactory {

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment, Attributes attributes) throws Exception {

 			final Object resultFromBuilders = resolveDirObjectUsingBuilders(refInfo, name, context, environment, attributes);

 			if(resultFromBuilders != null) {

@@ -1064,6 +1082,7 @@
 			return null;

 		}

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			// no-op for this DirObjectFactory

 			return null;

@@ -1081,10 +1100,12 @@
 			m_builder = builder;

 		}

 

+		@Override

 		public InitialContextFactoryBuilder getBuilder() {

 			return m_builder;

 		}

 

+		@Override

 		public Context getInitialContext(Hashtable environment) throws NamingException {

 			return m_factory.getInitialContext(environment);

 		}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/OSGiServiceListContext.java b/framework/src/main/java/org/eclipse/gemini/naming/OSGiServiceListContext.java
index 325ecd4..d880718 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/OSGiServiceListContext.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/OSGiServiceListContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -58,11 +58,13 @@
 	}

 	

 

+	@Override

 	public void close() throws NamingException {

 		// this operation is a no-op

 	}

 

 

+	@Override

 	public NamingEnumeration list(String name) throws NamingException {

 		if(name.equals("")) {

 			return new ListNamingEnumeration(m_bundleContext, 

@@ -73,6 +75,7 @@
 	}

 

 

+	@Override

 	public NamingEnumeration listBindings(String name) throws NamingException {

 		if(name.equals("")) {

 			return new ListBindingsNamingEnumeration(m_bundleContext, 

@@ -84,27 +87,24 @@
 	}

 

 

+	@Override

 	public Object lookup(String name) throws NamingException {

 		Long serviceId = new Long(name);

-		if(serviceId == null) {

-			throw new NameNotFoundException("Service with the name = " + name + " does not exist in this context");

-		} else {

-			if(m_mapOfServices.containsKey(serviceId)) {

-				ServiceReference serviceReference = (ServiceReference)m_mapOfServices.get(serviceId);

-				// create a proxy for this service, and return the proxy to handle

-				// service dynamics

-				ServiceProxyInfo proxyInfo = 

-					createNoRetryProxiedService(m_bundleContext, m_urlParser, serviceReference);

-				

-				if(!proxyInfo.isProxied()) {

-					logger.log(Level.WARNING, 

-							   "The service returned could not be proxied, OSGi lifecycle maintenance will not be handled by the Context Manager service");

-				}

+		if(m_mapOfServices.containsKey(serviceId)) {

+			ServiceReference serviceReference = (ServiceReference)m_mapOfServices.get(serviceId);

+			// create a proxy for this service, and return the proxy to handle

+			// service dynamics

+			ServiceProxyInfo proxyInfo =

+				createNoRetryProxiedService(m_bundleContext, m_urlParser, serviceReference);

 

-				return proxyInfo.getService();

-			} else {

-				throw new NameNotFoundException("Service with the name = " + name + " does not exist in this context");

+			if(!proxyInfo.isProxied()) {

+				logger.log(Level.WARNING,

+						   "The service returned could not be proxied, OSGi lifecycle maintenance will not be handled by the Context Manager service");

 			}

+

+			return proxyInfo.getService();

+		} else {

+			throw new NameNotFoundException("Service with the name = " + name + " does not exist in this context");

 		}

 	}

 	

@@ -198,6 +198,7 @@
 			}

 		}

 

+		@Override

 		public void close() throws NamingException {

 			super.close();

 			

@@ -221,6 +222,7 @@
 		}

 

 

+		@Override

 		protected boolean obtainService() {

 			m_serviceTracker.close();

 			// always return false, since servicelist proxies must not rebind to a service

@@ -229,6 +231,7 @@
 	}

 	

 	private static class NoRetryInvocationHandlerFactory implements InvocationHandlerFactory {

+		@Override

 		public InvocationHandler create(BundleContext bundleContext, ServiceReference serviceReference, OSGiURLParser urlParser, Object osgiService) {

 			return new NoRetryServiceInvocationHandler(bundleContext, serviceReference, urlParser, osgiService);

 		}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactory.java b/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactory.java
index ba21493..c325e1b 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactory.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -49,6 +49,7 @@
 		m_bundleContext = bundleContext;

 	}

 

+	@Override

 	public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {

 		return new OSGiURLContext(m_bundleContext);

 	}

@@ -70,6 +71,7 @@
 		}

 		

 

+		@Override

 		public Object lookup(String name) throws NamingException {

 			String osgiURL = name;

 			try {

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactoryServiceFactory.java b/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactoryServiceFactory.java
index 6e49f0c..098c2f4 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactoryServiceFactory.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/OSGiURLContextFactoryServiceFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -21,10 +21,12 @@
 

 class OSGiURLContextFactoryServiceFactory implements ServiceFactory {

 

+	@Override

 	public Object getService(Bundle bundle, ServiceRegistration registration) {

 		return new OSGiURLContextFactory(bundle.getBundleContext());

 	}

 

+	@Override

 	public void ungetService(Bundle bundle, ServiceRegistration registration,

 			Object service) {

 	}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ProviderAdminImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/ProviderAdminImpl.java
index 64c1f55..15414d0 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ProviderAdminImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ProviderAdminImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -36,6 +36,7 @@
 			new OSGiInitialContextFactoryBuilder(bundleContext, bundleContext);

 	}

 

+	@Override

 	public Object getObjectInstance(Object refInfo, Name name, Context context, Map environment) throws NamingException {

 		synchronized (m_objectFactoryBuilder) {

 			Hashtable jndiEnvironment = new Hashtable();

@@ -56,6 +57,7 @@
 		}

 	}

 

+	@Override

 	public Object getObjectInstance(Object refInfo, Name name, Context context, Map environment, Attributes attributes) throws NamingException {

 		synchronized (m_objectFactoryBuilder) {

 			Hashtable jndiEnvironment = new Hashtable();

@@ -77,6 +79,7 @@
 		}

 	}

 	

+	@Override

 	public void close() {

 		synchronized (m_objectFactoryBuilder) {

 			m_objectFactoryBuilder.close();

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ReflectionUtils.java b/framework/src/main/java/org/eclipse/gemini/naming/ReflectionUtils.java
index a56c2ec..3bb8560 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ReflectionUtils.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ReflectionUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -119,6 +119,7 @@
 		ClassLoader tempLoader = null;

 		try {

 			tempLoader = (ClassLoader)SecurityUtils.invokePrivilegedAction(new PrivilegedExceptionAction() {

+				@Override

 				public Object run() throws Exception {

 					return requestedService.getClass().getClassLoader();

 				}

@@ -215,6 +216,7 @@
 	}

 	

 	private static class RetryInvocationHandlerFactory implements InvocationHandlerFactory {

+		@Override

 		public InvocationHandler create(BundleContext bundleContext, ServiceReference serviceReference, OSGiURLParser urlParser, Object osgiService) {

 			return new ServiceInvocationHandler(bundleContext, 

 					                            serviceReference, 

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ReflectiveInvokeAction.java b/framework/src/main/java/org/eclipse/gemini/naming/ReflectiveInvokeAction.java
index 328ffb5..fd21355 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ReflectiveInvokeAction.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ReflectiveInvokeAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -37,6 +37,7 @@
 		m_args = args;

 	}

 	

+	@Override

 	public Object run() throws Exception {

 		try {

 			return invokeMethod(m_method, m_args);

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareContextManagerImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareContextManagerImpl.java
index c4539f5..ac4e49b 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareContextManagerImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareContextManagerImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -44,25 +44,30 @@
 	}

 	

 	

+	@Override

 	public Context newInitialContext() throws NamingException {

 		return (Context)invokePrivilegedAction(new NewInitialContextAction());

 	}

 	

 

+	@Override

 	public Context newInitialContext(Map environment) throws NamingException {

 		return (Context)invokePrivilegedAction(new NewInitialContextWithEnvironmentAction(environment));

 	}

 

 	

+	@Override

 	public DirContext newInitialDirContext() throws NamingException {

 		return (DirContext)invokePrivilegedAction(new NewInitialDirContextAction());

 	}

 

 	

+	@Override

 	public DirContext newInitialDirContext(Map environment) throws NamingException {

 		return (DirContext)invokePrivilegedAction(new NewInitialDirContextWithEnvironmentAction(environment));

 	}

 	

+	@Override

 	public void close() {

 		invokePrivilegedActionWithoutReturn(new CloseContextManagerAction());

 	}

@@ -105,6 +110,7 @@
 	

 	// actions for each of the operations supported by the JNDIContextManager service

 	private class NewInitialContextAction implements PrivilegedExceptionAction {

+		@Override

 		public Object run() throws Exception {

 			return m_contextManager.newInitialContext();

 		}

@@ -118,6 +124,7 @@
 			m_environment = environment;

 		}

 		

+		@Override

 		public Object run() throws Exception {

 			return m_contextManager.newInitialContext(m_environment);

 		}

@@ -125,6 +132,7 @@
 	

 	

 	private class NewInitialDirContextAction implements PrivilegedExceptionAction {

+		@Override

 		public Object run() throws Exception {

 			return m_contextManager.newInitialDirContext();

 		}

@@ -137,12 +145,14 @@
 			m_environment = environment;

 		}

 		

+		@Override

 		public Object run() throws Exception {

 			return m_contextManager.newInitialDirContext(m_environment);

 		}

 	}

 	

 	private class CloseContextManagerAction implements PrivilegedExceptionAction {

+		@Override

 		public Object run() throws Exception {

 			m_contextManager.close();

 			return null;

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareProviderAdminImpl.java b/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareProviderAdminImpl.java
index 53b4519..9b13cfb 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareProviderAdminImpl.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/SecurityAwareProviderAdminImpl.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -43,18 +43,21 @@
 		m_closeableProviderAdmin = closeableProviderAdmin;

 	}

 		

+	@Override

 	public Object getObjectInstance(Object refInfo, Name name, Context context, Map environment) throws Exception {

 		PrivilegedExceptionAction action = 

 			new GetObjectInstanceAction(refInfo, name, context, environment);

 		return invokePrivilegedAction(action);

 	}

 

+	@Override

 	public Object getObjectInstance(Object refInfo, Name name, Context context, Map environment, Attributes attributes) throws Exception {

 		PrivilegedExceptionAction action = 

 			new GetObjectInstanceActionWithAttributes(refInfo, name, context, environment, attributes);

 		return invokePrivilegedAction(action);

 	}

 	

+	@Override

 	public void close() {

 		try {

 			SecurityUtils.invokePrivilegedActionNoReturn(new CloseAction());

@@ -84,6 +87,7 @@
 			m_environment = environment;

 		}

 		

+		@Override

 		public Object run() throws Exception {

 			return m_closeableProviderAdmin.getObjectInstance(m_refInfo, 

 					                                     m_name, 

@@ -102,6 +106,7 @@
 		}

 		

 		

+		@Override

 		public Object run() throws Exception {

 			return m_closeableProviderAdmin.getObjectInstance(m_refInfo, 

 					                                     m_name, 

@@ -114,6 +119,7 @@
 	

 	

 	private class CloseAction implements PrivilegedExceptionAction {

+		@Override

 		public Object run() throws Exception {

 			m_closeableProviderAdmin.close();

 			return null;

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ServiceAwareContextFactory.java b/framework/src/main/java/org/eclipse/gemini/naming/ServiceAwareContextFactory.java
index a911351..d20e017 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ServiceAwareContextFactory.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ServiceAwareContextFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010, 2013 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -69,6 +69,7 @@
 			m_isOpen = true;

 		}

 		

+		@Override

 		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

 			synchronized (this) {

 				synchronized (m_manager) {

@@ -173,6 +174,7 @@
 				m_args = args;

 			}

 			

+			@Override

 			public Object run() throws Exception {

 				try {

 					return obtainNewFactoryAndInvoke(m_method, m_args);

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ServiceBasedNamingEnumeration.java b/framework/src/main/java/org/eclipse/gemini/naming/ServiceBasedNamingEnumeration.java
index b0de740..d052d7b 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ServiceBasedNamingEnumeration.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ServiceBasedNamingEnumeration.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -57,20 +57,24 @@
 		}

 	}

 

+	@Override

 	public void close() throws NamingException {

 		m_isOpen = false;

 	}

 

+	@Override

 	public boolean hasMore() throws NamingException {

 		checkIsOpen();

 		return (isIndexValid());

 	}

 

+	@Override

 	public Object next() throws NamingException {

 		checkIsOpen();

 		return internalNextElement();

 	}

 

+	@Override

 	public boolean hasMoreElements() {

 		if(!m_isOpen) {

 			return false;

@@ -80,6 +84,7 @@
 		

 	}

 

+	@Override

 	public Object nextElement() {

 		return internalNextElement();

 	}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ServiceInvocationHandler.java b/framework/src/main/java/org/eclipse/gemini/naming/ServiceInvocationHandler.java
index 765991b..41ba530 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ServiceInvocationHandler.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ServiceInvocationHandler.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -59,6 +59,7 @@
 	}

 	

 	

+	@Override

 	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

 		return SecurityUtils.invokePrivilegedAction(new ServiceInvokeAction(method, args));

 	}

@@ -103,6 +104,7 @@
 	

 	

 	

+	@Override

 	protected void finalize() throws Throwable {

 		close();

 	}

@@ -168,6 +170,7 @@
 			super(method, args);

 		}

 

+		@Override

 		public Object invokeMethod(Method method, Object[] args) throws Throwable {

 			return handleMethodInvocation(method, args);

 		}

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/ServiceUtils.java b/framework/src/main/java/org/eclipse/gemini/naming/ServiceUtils.java
index 855324b..96d55f3 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/ServiceUtils.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/ServiceUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -72,6 +72,7 @@
 	static ServiceReference[] sortServiceReferences(

 			final ServiceReference[] serviceReferences) {

 		Arrays.sort(serviceReferences, new Comparator() {

+			@Override

 			public int compare(Object objectOne, Object objectTwo) {

 				ServiceReference serviceReferenceOne = (ServiceReference) objectOne;

 				ServiceReference serviceReferenceTwo = (ServiceReference) objectTwo;

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalInitialContextFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalInitialContextFactoryBuilder.java
index a14932a..95dcb00 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalInitialContextFactoryBuilder.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalInitialContextFactoryBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010, 2013 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -48,6 +48,7 @@
 	public TraditionalInitialContextFactoryBuilder() {

 	}

 	

+	@Override

 	public InitialContextFactory createInitialContextFactory(Hashtable environment) throws NamingException {

 		return new TraditionalInitialContextFactory();

 	}

@@ -66,6 +67,7 @@
 	 */

 	private static class TraditionalInitialContextFactory implements InitialContextFactory {

 

+		@Override

 		public Context getInitialContext(Hashtable environment) throws NamingException {

 			// try to find BundleContext, assuming a call to the InitialContext constructor

 			BundleContext clientBundleContext = 

@@ -133,6 +135,7 @@
 			

 		}

 		

+		@Override

 		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

 			if(method.getName().equals("close")) {

 				// clean up reference to JNDIContextManager

diff --git a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java
index f84d261..c17b69e 100644
--- a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java
+++ b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Oracle.

+ * Copyright (c) 2010, 2015 Oracle.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * and Apache License v2.0 which accompanies this distribution. 

@@ -46,6 +46,7 @@
 	public TraditionalObjectFactoryBuilder() {

 	}

 	

+	@Override

 	public ObjectFactory createObjectFactory(Object obj, Hashtable environment) throws NamingException {

 		// if the call came from NamingManager

 		BundleContext clientBundleContext = 

@@ -68,6 +69,7 @@
 			m_clientBundleContext = clientBundleContext;

 		}

 		

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment) throws Exception {

 			ProviderAdminAction providerAdminAction = 

 				new NamingManagerAction(refInfo, name, context, environment);

@@ -75,6 +77,7 @@
 		}

 		

 

+		@Override

 		public Object getObjectInstance(Object refInfo, Name name, Context context, Hashtable environment, Attributes attributes) throws Exception {

 			ProviderAdminAction providerAdminAction = 

 				new DirectoryManagerAction(refInfo, name, context, environment, attributes);

@@ -144,6 +147,7 @@
 			m_environment = environment;

 		}

 		

+		@Override

 		public Object runProviderAdminAction(JNDIProviderAdmin providerAdmin) throws Exception {

 			return providerAdmin.getObjectInstance(m_refInfo, m_name, m_context, m_environment);

 		}

@@ -163,6 +167,7 @@
 			m_attributes = attributes;

 		}

 

+		@Override

 		public Object runProviderAdminAction(JNDIProviderAdmin providerAdmin) throws Exception {

 			return providerAdmin.getObjectInstance(m_refInfo, m_name, m_context, m_environment, m_attributes);

 		}