org.geotools.factory.GeoTools.getInitialContext()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.geotools.factory.GeoTools.getInitialContext()方法的一些代码示例,展示了GeoTools.getInitialContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoTools.getInitialContext()方法的具体详情如下:
包路径:org.geotools.factory.GeoTools
类名称:GeoTools
方法名:getInitialContext

GeoTools.getInitialContext介绍

[英]Returns the default initial context.
[中]返回默认的初始上下文。

代码示例

代码示例来源:origin: org.geotools/gt-jdbc

/**
 * Make sure a JNDI context is available
 */
public boolean isAvailable() {
  try {
    GeoTools.getInitialContext(GeoTools.getDefaultHints());
    return true;
  } catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: org.geotools/gt2-jdbc

/**
 * Make sure a JNDI context is available
 */
public boolean isAvailable() {
  try {
    GeoTools.getInitialContext(GeoTools.getDefaultHints());
    return true;
  } catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: org.geotools/gt-jdbc

/**
 * Determines if the datastore is available.
 * <p>
 * Check in an Initial Context is available, that is all what can be done
 * Checking for the right jdbc jars in the classpath is not possible here 
 * </p>
 */
public boolean isAvailable() {
  try {
    GeoTools.getInitialContext(GeoTools.getDefaultHints());
    return true;
  } catch (NamingException e) {
    return false;
  }
}

代码示例来源:origin: org.geotools/gt-arcsde

ctx = GeoTools.getInitialContext(GeoTools.getDefaultHints());
} catch (NamingException e) {
  throw new RuntimeException(e);

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Implementation of {@code fixName} method. If the context is {@code null}, then
 * the {@linkplain #getInitialContext GeoTools initial context} will be fetch only
 * when first needed.
 */
private static String fixName(Context context, final String name, final Hints hints) {
  String fixed = null;
  if (name != null) {
    final StringTokenizer tokens = new StringTokenizer(name, ":/");
    while (tokens.hasMoreTokens()) {
      final String part = tokens.nextToken();
      if (fixed == null) {
        fixed = part;
      } else try {
        if (context == null) {
          context = getInitialContext(hints);
        }
        fixed = context.composeName(fixed, part);
      } catch (NamingException e) {
        Logging.unexpectedException(GeoTools.class, "fixName", e);
        return name;
      }
    }
  }
  return fixed;
}

代码示例来源:origin: org.geotools/gt-jdbc

public DataSource createNewDataSource(Map params) throws IOException {
  String refName = (String) JNDI_REFNAME.lookUp(params);
  try {
    return (DataSource) GeoTools.getInitialContext(GeoTools.getDefaultHints()).lookup(refName);
  } catch (Exception e) {
    throw new DataSourceException("Could not find the specified data source in JNDI", e);
  }
}

代码示例来源:origin: org.geotools/gt-jdbc

ctx = GeoTools.getInitialContext(GeoTools.getDefaultHints());
} catch (NamingException e) {
  throw new RuntimeException(e);

代码示例来源:origin: org.geotools/gt2-jdbc

public DataSource createNewDataSource(Map params) throws IOException {
  String refName = (String) JNDI_REFNAME.lookUp(params);
  try {
    return (DataSource) GeoTools.getInitialContext(GeoTools.getDefaultHints()).lookup(refName);
  } catch (Exception e) {
    throw new DataSourceException("Could not find the specified data source in JNDI", e);
  }
}

代码示例来源:origin: org.geotools/gt-arcsde

/**
 * Determines if the datastore is available.
 * <p>
 * Check in an Initial Context is available, that is all what can be done Checking for the right
 * jdbc jars in the classpath is not possible here
 * </p>
 * 
 * @see org.geotools.data.DataAccessFactory#isAvailable()
 */
public boolean isAvailable() {
  try {
    GeoTools.getInitialContext(GeoTools.getDefaultHints());
  } catch (NamingException e) {
    return false;
  }
  return delegateFactory.isAvailable();
}

相关文章