@@ -0,0 +1,3270 @@
+/*%0A * Copyright (C) 2000 - 2011 Silverpeas%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A *%0A * As a special exception to the terms and conditions of version 3.0 of%0A * the GPL, you may redistribute this Program in connection withWriter Free/Libre%0A * Open Source Software (%22FLOSS%22) applications as described in Silverpeas's%0A * FLOSS exception.  You should have recieved a copy of the text describing%0A * the FLOSS exception, and it is also available here:%0A * %22http://www.silverpeas.org/legal/licensing%22%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage com.silverpeas.jndi;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Hashtable;%0Aimport java.util.Map;%0Aimport javax.naming.Context;%0Aimport javax.naming.NamingException;%0Aimport javax.naming.spi.InitialContextFactory;%0A%0A/**%0A * A factory of a naming context that uses the memory as dictionary of objects.%0A * Useful to tests objets using JNDI to get dependencies.%0A */%0Apublic class SimpleMemoryContextFactory implements InitialContextFactory %7B%0A%0A  private static Map%3CString, String%3E savedSystemProperties = new HashMap%3CString, String%3E();%0A  private static SimpleMemoryContext context = new SimpleMemoryContext();%0A%0A  /**%0A   * Sets up this class as the default JNDI initial context factory.%0A   * Useful if some tests uses another JNDI intial context factory.%0A   */%0A  public static void setUpAsInitialContext() %7B%0A    savedSystemProperties.put(Context.INITIAL_CONTEXT_FACTORY, System.getProperty(%0A            Context.INITIAL_CONTEXT_FACTORY));%0A    savedSystemProperties.put(Context.URL_PKG_PREFIXES, System.getProperty(Context.URL_PKG_PREFIXES));%0A    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, SimpleMemoryContextFactory.class.getName());%0A    System.setProperty(Context.URL_PKG_PREFIXES, SimpleMemoryContextFactory.class.getPackage().%0A            getName());%0A  %7D%0A%0A  /**%0A   * Reverts to the previous JNDI initial context factory. This method has to be invoked if the%0A   * setUpAsInitialContext method was invoked previously.%0A   */%0A  public static void tearDownAsInitialContext() %7B%0A    String property = savedSystemProperties.get(Context.INITIAL_CONTEXT_FACTORY);%0A    if (property == null %7C%7C property.trim().isEmpty()) %7B%0A      System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);%0A    %7D else %7B%0A      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, property);%0A    %7D%0A    %0A    property = savedSystemProperties.get(Context.URL_PKG_PREFIXES);%0A    if (property != null) %7B%0A      System.setProperty(Context.URL_PKG_PREFIXES, property);%0A    %7D else %7B%0A      System.clearProperty(Context.URL_PKG_PREFIXES);%0A    %7D%0A  %7D%0A%0A  @Override%0A  public Context getInitialContext(final Hashtable%3C?, ?%3E environment) throws NamingException %7B%0A    return context;%0A  %7D%0A%7D%0A

Remove unused imports and fix a conflict with a rebase