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

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

本文整理了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

  1. /**
  2. * Make sure a JNDI context is available
  3. */
  4. public boolean isAvailable() {
  5. try {
  6. GeoTools.getInitialContext(GeoTools.getDefaultHints());
  7. return true;
  8. } catch (Exception e) {
  9. return false;
  10. }
  11. }

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

  1. /**
  2. * Make sure a JNDI context is available
  3. */
  4. public boolean isAvailable() {
  5. try {
  6. GeoTools.getInitialContext(GeoTools.getDefaultHints());
  7. return true;
  8. } catch (Exception e) {
  9. return false;
  10. }
  11. }

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

  1. /**
  2. * Determines if the datastore is available.
  3. * <p>
  4. * Check in an Initial Context is available, that is all what can be done
  5. * Checking for the right jdbc jars in the classpath is not possible here
  6. * </p>
  7. */
  8. public boolean isAvailable() {
  9. try {
  10. GeoTools.getInitialContext(GeoTools.getDefaultHints());
  11. return true;
  12. } catch (NamingException e) {
  13. return false;
  14. }
  15. }

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

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

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

  1. /**
  2. * Implementation of {@code fixName} method. If the context is {@code null}, then
  3. * the {@linkplain #getInitialContext GeoTools initial context} will be fetch only
  4. * when first needed.
  5. */
  6. private static String fixName(Context context, final String name, final Hints hints) {
  7. String fixed = null;
  8. if (name != null) {
  9. final StringTokenizer tokens = new StringTokenizer(name, ":/");
  10. while (tokens.hasMoreTokens()) {
  11. final String part = tokens.nextToken();
  12. if (fixed == null) {
  13. fixed = part;
  14. } else try {
  15. if (context == null) {
  16. context = getInitialContext(hints);
  17. }
  18. fixed = context.composeName(fixed, part);
  19. } catch (NamingException e) {
  20. Logging.unexpectedException(GeoTools.class, "fixName", e);
  21. return name;
  22. }
  23. }
  24. }
  25. return fixed;
  26. }

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

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

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

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

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

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

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

  1. /**
  2. * Determines if the datastore is available.
  3. * <p>
  4. * Check in an Initial Context is available, that is all what can be done Checking for the right
  5. * jdbc jars in the classpath is not possible here
  6. * </p>
  7. *
  8. * @see org.geotools.data.DataAccessFactory#isAvailable()
  9. */
  10. public boolean isAvailable() {
  11. try {
  12. GeoTools.getInitialContext(GeoTools.getDefaultHints());
  13. } catch (NamingException e) {
  14. return false;
  15. }
  16. return delegateFactory.isAvailable();
  17. }

相关文章