org.geoserver.config.GeoServer.getGlobal()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(138)

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

GeoServer.getGlobal介绍

[英]The global geoserver configuration.
[中]全局地理服务器配置。

代码示例

代码示例来源:origin: geoserver/geoserver

public EntityResolver getEntityResolver() {
    if (geoServer != null) {
      Boolean externalEntitiesEnabled = geoServer.getGlobal().isXmlExternalEntitiesEnabled();
      if (externalEntitiesEnabled != null && externalEntitiesEnabled) {
        // XML parser will try to resolve entities
        return null;
      }
    }

    return entityResolver;
  }
}

代码示例来源:origin: geoserver/geoserver

/**
 * Generate the default geoserver administrator user. The administrator will be added directly
 * to the in-memory storage of the user details, rather than returned by this method.
 */
private void createDefaultUser() {
  String name = (geoServer == null ? "admin" : geoServer.getGlobal().getAdminUsername());
  String passwd =
      (geoServer == null ? "geoserver" : geoServer.getGlobal().getAdminPassword());
  Collection<GrantedAuthority> auths = new ArrayList<GrantedAuthority>();
  auths.add(new SimpleGrantedAuthority("ROLE_ADMINISTRATOR"));
  myDetailStorage.put(name, new User(name, passwd, true, true, true, true, auths));
}

代码示例来源:origin: geoserver/geoserver

synchronized void incrementSequence() {
  // prevent infinite loop on configuration update
  if (updating) return;
  try {
    updating = true;
    GeoServerInfo gsInfo = geoServer.getGlobal();
    gsInfo.setUpdateSequence(gsInfo.getUpdateSequence() + 1);
    geoServer.save(gsInfo);
  } finally {
    updating = false;
  }
}

代码示例来源:origin: geoserver/geoserver

@Override
public void initialize(GeoServer geoServer) throws Exception {
  // Consider moving earlier to make use of the requested LockProvider during initial
  // configuration
  String lockProviderName = geoServer.getGlobal().getLockProviderName();
  setLockProvider(lockProviderName);
  geoServer.addListener(listener);
}

代码示例来源:origin: geoserver/geoserver

public void initialize(GeoServer geoServer) throws Exception {
  initJAI(geoServer.getGlobal().getJAI());
  geoServer.addListener(
      new ConfigurationListenerAdapter() {
        public void handleGlobalChange(
            GeoServerInfo global,
            List<String> propertyNames,
            List<Object> oldValues,
            List<Object> newValues) {
          if (propertyNames.contains(
              "jAI")) { // TODO: check why the propertyname is reported as jAI
            // instead of JAI
            // Make sure to proceed with JAI init
            // only in case the global change involved that section
            initJAI(global.getJAI());
          }
        }
      });
}

代码示例来源:origin: geoserver/geoserver

GeoServerInfo global = GeoServerExtensions.bean(GeoServer.class).getGlobal();
if ((global != null)
    && (global.getAdminUsername() != null)

代码示例来源:origin: geoserver/geoserver

void createAppContext(String proxyBaseUrl) {
  SettingsInfo settings = createNiceMock(SettingsInfo.class);
  expect(settings.getProxyBaseUrl()).andReturn(proxyBaseUrl).anyTimes();
  replay(settings);
  GeoServer geoServer = createNiceMock(GeoServer.class);
  expect(geoServer.getGlobal()).andReturn(new GeoServerInfoImpl());
  expect(geoServer.getSettings()).andReturn(settings).anyTimes();
  replay(geoServer);
  ProxifyingURLMangler mangler = new ProxifyingURLMangler(geoServer);
  ApplicationContext appContext = createNiceMock(ApplicationContext.class);
  expect(appContext.getBeanNamesForType(URLMangler.class))
      .andReturn(new String[] {"mangler"});
  expect(appContext.getBean("mangler")).andReturn(mangler).anyTimes();
  replay(appContext);
  GeoServerExtensionsHelper.init(appContext);
}

代码示例来源:origin: geoserver/geoserver

public void initialize(GeoServer geoServer) throws Exception {
  this.gs = geoServer;
  final GeoServerInfo geoserverInfo = geoServer.getGlobal();
  CoverageAccessInfo coverageAccess = geoserverInfo.getCoverageAccess();
  if (coverageAccess == null) {
    coverageAccess = new CoverageAccessInfoImpl();
    geoserverInfo.setCoverageAccess(coverageAccess);
  }
  initCoverage(coverageAccess);
  geoServer.addListener(
      new ConfigurationListenerAdapter() {
        public void handleGlobalChange(
            GeoServerInfo global,
            List<String> propertyNames,
            List<Object> oldValues,
            List<Object> newValues) {
          if (propertyNames.contains("coverageAccess")) {
            // Make sure to proceed with coverageAccess init
            // only in case the global change involved that section
            initCoverage(global.getCoverageAccess());
          }
        }
        @Override
        public void handlePostGlobalChange(GeoServerInfo global) {
          // No need to handle that change too
        }
      });
}

代码示例来源:origin: geoserver/geoserver

public void mangleURL(
    StringBuilder baseURL, StringBuilder path, Map<String, String> kvp, URLType type) {
  // first check the system property, then fall back to configuration
  String proxyBase =
      (GeoServerExtensions.getProperty(Requests.PROXY_PARAM) != null)
          ? GeoServerExtensions.getProperty(Requests.PROXY_PARAM)
          : this.geoServer.getSettings().getProxyBaseUrl();
  // Mangles the URL base in different ways based on a flag
  // (for two reasons: a) speed; b) to make the admin aware of
  // possible security liabilities)
  baseURL =
      (this.geoServer.getGlobal().isUseHeadersProxyURL() == true && proxyBase != null)
          ? this.mangleURLHeaders(baseURL, proxyBase)
          : this.mangleURLFixedURL(baseURL, proxyBase);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testCatalogUpdates() {
  long updateSequence = getGeoServer().getGlobal().getUpdateSequence();
  // remove one layer
  getCatalog().remove(getCatalog().getLayers().get(0));
  long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence();
  assertTrue(newUpdateSequence > updateSequence);
}

代码示例来源:origin: geoserver/geoserver

@Test
  public void testServiceUpdates() {
    GeoServerInfo global = getGeoServer().getGlobal();
    long updateSequence = global.getUpdateSequence();

    // change a flag in the config
    global.setVerbose(true);
    getGeoServer().save(global);

    long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence();
    assertTrue(newUpdateSequence > updateSequence);
  }
}

代码示例来源:origin: geoserver/geoserver

expect(geoServer.getGlobal())
    .andReturn(
        new GeoServerInfoImpl() {

代码示例来源:origin: geoserver/geoserver

public void initialize(GeoServer geoServer) throws Exception {
  this.gs = geoServer;
  final GeoServerInfo global = geoServer.getGlobal();
  final int cacheSize = global.getFeatureTypeCacheSize();
  if (cacheSize > 0) {

代码示例来源:origin: geoserver/geoserver

@Before
public void setup() {
  GeoServerInfo gi = getGeoServer().getGlobal();
  gi.getSettings().setProxyBaseUrl(null);
  getGeoServer().save(gi);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testModifyGlobal() throws Exception {
  GeoServerInfo global = getGeoServer().getGlobal();
  global.setAdminUsername("roadRunner");
  global.setTitle("ACME");
  getGeoServer().save(global);
  File f = new File(testData.getDataDirectoryRoot(), "global.xml");
  Document dom = dom(f);
  assertXpathEvaluatesTo("roadRunner", "/global/adminUsername", dom);
  assertXpathEvaluatesTo("ACME", "/global/settings/title", dom);
}

代码示例来源:origin: geoserver/geoserver

@Test
  public void testProxyBase() {
    GeoServerInfo gi = getGeoServer().getGlobal();
    gi.getSettings().setProxyBaseUrl("http://geoserver.org/");
    getGeoServer().save(gi);

    String url = buildURL(BASEURL, "test", null, URLType.SERVICE);
    assertEquals("http://geoserver.org/test", url);
  }
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testConfigureFeatureTypeCacheSize() {
  GeoServer gs = getGeoServer();
  GeoServerInfo global = gs.getGlobal();
  global.setFeatureTypeCacheSize(200);
  gs.save(global);
  Catalog catalog = getCatalog();
  // we actually keep two versions of the feature type in the cache, so we need it
  // twice as big
  assertEquals(
      400,
      ((SoftValueHashMap) catalog.getResourcePool().getFeatureTypeCache())
          .getHardReferencesCount());
}

代码示例来源:origin: geoserver/geoserver

@Override
protected void onSetUp(SystemTestData testData) throws Exception {
  super.onSetUp(testData);
  GeoServer geoserver = getGeoServer();
  GeoServerInfo global = geoserver.getGlobal();
  global.setGlobalServices(false);
  geoserver.save(global);
  Catalog catalog = getCatalog();
  LayerInfo layer = catalog.getLayerByName(new NameImpl(CiteTestData.BASIC_POLYGONS));
  StyleInfo style = catalog.getStyleByName(CiteTestData.DEFAULT_VECTOR_STYLE);
  CatalogFactory factory = catalog.getFactory();
  LayerGroupInfo lg1 = factory.createLayerGroup();
  lg1.setName("LayerGroup1");
  lg1.getLayers().add(layer);
  lg1.getStyles().add(style);
  catalog.add(lg1);
  LayerGroupInfo lg2 = factory.createLayerGroup();
  lg2.setName("LayerGroup2");
  lg2.setWorkspace(catalog.getWorkspaceByName(CiteTestData.CITE_PREFIX));
  lg2.getLayers().add(layer);
  lg2.getStyles().add(style);
  catalog.add(lg2);
}

代码示例来源:origin: geoserver/geoserver

@Test
  public void testGlobal() throws Exception {
    GeoServerInfo info = importer.getConfiguration().getGlobal();
    assertNotNull(info);

    LoggingInfo logging = importer.getConfiguration().getLogging();
    assertNotNull(logging);

    assertEquals("DEFAULT_LOGGING.properties", logging.getLevel());
    assertTrue(logging.isStdOutLogging());
    assertEquals("logs/geoserver.log", logging.getLocation());
    assertFalse(info.isVerbose());
    assertFalse(info.isVerboseExceptions());
    assertEquals(8, info.getNumDecimals());
    assertEquals("UTF-8", info.getCharset());
    assertEquals(3, info.getUpdateSequence());
  }
}

代码示例来源:origin: geoserver/geoserver

workspace != null ? geoServer.getCatalog().getWorkspaceByName(workspace) : null;
GeoServerInfo global = geoServer.getGlobal();
SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings();
if (settings == null) {

相关文章