Package speculoos.jndi.mappers

Examples of speculoos.jndi.mappers.JNDIMapper


  public synchronized Mapper create(String m, Map environment)
      throws MapperException {
    if (!bound)
      throw new IllegalStateException(
          "This source is not opened for business. Come back later");
    JNDIMapper base = (JNDIMapper) mapperMatrix.get(m);
    if (base == null)
      throw new IllegalArgumentException("Mapper named " + m
          + " is unknown");
    JNDIMapper jm = (JNDIMapper) (base).clone();
    /* sets the directory object to use for operations */
    JNDIConnection dirc;
    if (log.isDebugEnabled())
      log.info("[" + name + "] creating mapper " + m);
    try {
      dirc = connect();
      jm.setDirectory(dirc);
    } catch (NamingException e) {
      throw new MapperTechnicalException(
          "Cannot instantiate mapper " + m, e);
    }
    /* sets the environment */
    Map env = new HashMap(environment);
    env.putAll(current);
    jm.setEnvironment(env);
    if (log.isDebugEnabled())
      log.info("[" + name + "] created mapper " + m + " with env " + env);
    return jm;
  }
View Full Code Here


   * (non-Javadoc)
   *
   * @see speculoos.core.core.spi.Source#release(speculoos.core.core.Mapper)
   */
  public void release(Mapper mapper) throws MapperException {
    JNDIMapper jm = (JNDIMapper) mapper;
    if (!mapperMatrix.containsKey(jm.getName()))
      throw new MapperException("[" + name + "] unknown mapper " + jm
          + " in this source ");
    jm.getDirectory().close();
    /* clean state of object */
    jm.clearDirectory();
    /* clear environment */
    jm.getEnvironment().clear();
    if (log.isDebugEnabled())
      log.info("[" + name + "] released mapper " + mapper.getName());
  }
View Full Code Here

TOP

Related Classes of speculoos.jndi.mappers.JNDIMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.