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

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

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

GeoServer.getFactory介绍

[英]The factory used to create configuration object.
[中]用于创建配置对象的工厂。

代码示例

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

public DefaultGeoServerFacade(GeoServer geoServer) {
  this.geoServer = geoServer;
  this.global = geoServer.getFactory().createGlobal();
  this.logging = geoServer.getFactory().createLogging();
}

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

GeoServerFactory factory = geoServer.getFactory();

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

@Test
public void testAddWorkspaceLocalService() throws Exception {
  File dataDirRoot = getTestData().getDataDirectoryRoot();
  WorkspaceInfo ws = getCatalog().getDefaultWorkspace();
  ServiceInfo s = geoServer.getFactory().createService();
  s.setName("foo");
  s.setWorkspace(ws);
  File f = new File(dataDirRoot, "workspaces" + "/" + ws.getName() + "/service.xml");
  assertFalse(f.exists());
  geoServer.add(s);
  assertTrue(f.exists());
}

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

SettingsInfo settings = gs.getFactory().createSettings();
settings.setLocalWorkspaceIncludesPrefix(true);
settings.setWorkspace(workspace);

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

@Test
public void testReloadWithLocalServices() throws Exception {
  // setup a non default workspace
  WorkspaceInfo ws = getCatalog().getFactory().createWorkspace();
  ws.setName("nonDefault");
  NamespaceInfo ni = getCatalog().getFactory().createNamespace();
  ni.setPrefix("nonDefault");
  ni.setURI("http://www.geoserver.org/nonDefault");
  getCatalog().add(ws);
  getCatalog().add(ni);
  // create a ws specific setting
  SettingsInfo s = geoServer.getFactory().createSettings();
  s.setWorkspace(ws);
  geoServer.add(s);
  getGeoServer().reload();
}

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

@Test
public void testAddSettings() throws Exception {
  testAddWorkspace();
  WorkspaceInfo ws = catalog.getWorkspaceByName("acme");
  SettingsInfo settings = getGeoServer().getFactory().createSettings();
  settings.setTitle("ACME");
  settings.setWorkspace(ws);
  File f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
  assertNull(f);
  getGeoServer().add(settings);
  f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
  assertNotNull(f);
  Document dom = dom(f);
  assertXpathEvaluatesTo("ACME", "/settings/title", dom);
}

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

SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings();
if (settings == null) {
  settings = geoServer.getFactory().createSettings();

代码示例来源:origin: org.geoserver.web/gs-web-core

ServiceInfo create() {
    // create it
    GeoServer gs = GeoServerApplication.get().getGeoServer();
    ServiceInfo newService = gs.getFactory().create(serviceClass);
    // initialize from global service
    ServiceInfo global = gs.getService(serviceClass);
    OwsUtils.copy(global, newService, serviceClass);
    newService.setWorkspace(wsModel.getObject());
    // hack, but need id to be null so its considered unattached
    ((ServiceInfoImpl) newService).setId(null);
    return newService;
  }
}

代码示例来源:origin: org.geoserver.web/web-core

ServiceInfo create() {
    //create it
    GeoServer gs = GeoServerApplication.get().getGeoServer();
    
    ServiceInfo newService = gs.getFactory().create(serviceClass);
    //initialize from global service
    ServiceInfo global = gs.getService(serviceClass);
    OwsUtils.copy(global,newService, serviceClass);
    newService.setWorkspace(wsModel.getObject());
    //hack, but need id to be null so its considered unattached
    ((ServiceInfoImpl)newService).setId(null);
    
    return newService;
  }
}

代码示例来源:origin: org.geoserver.web/gs-web-core

@Override
  public SettingsInfo getObject() {
    if (info == null) {
      GeoServer gs = GeoServerApplication.get().getGeoServer();
      info = gs.getFactory().createSettings();
      // initialize from global settings
      SettingsInfo global = gs.getGlobal().getSettings();
      // hack, we need to copy out composite objects separately to get around proxying
      // madness
      ContactInfo contact = gs.getFactory().createContact();
      OwsUtils.copy(global.getContact(), contact, ContactInfo.class);
      OwsUtils.copy(global, info, SettingsInfo.class);
      info.setContact(contact);
      info.setWorkspace(wsModel.getObject());
    }
    return info;
  }
}

代码示例来源:origin: org.geoserver.web/web-core

@Override
  public SettingsInfo getObject() {
    if (info == null) {
      GeoServer gs = GeoServerApplication.get().getGeoServer();
      info = gs.getFactory().createSettings();
      
      //initialize from global settings
      SettingsInfo global = gs.getGlobal().getSettings();
      //hack, we need to copy out composite objects separately to get around proxying
      // madness
      ContactInfo contact = gs.getFactory().createContact();
      OwsUtils.copy(global.getContact(), contact, ContactInfo.class);
      OwsUtils.copy(global, info, SettingsInfo.class);
      info.setContact(contact);
      info.setWorkspace(wsModel.getObject());
    }
    return info;
  }
}

代码示例来源:origin: org.geoserver/gs-restconfig-wms

@Before
public void initLocalWMS() throws Exception {
  GeoServer geoServer = getGeoServer();
  WorkspaceInfo ws = geoServer.getCatalog().getWorkspaceByName("sf");
  WMSInfo wmsInfo = geoServer.getService(ws, WMSInfo.class);
  if (wmsInfo != null) {
    geoServer.remove(wmsInfo);
  }
  wmsInfo = geoServer.getFactory().create(WMSInfo.class);
  wmsInfo.setName("WMS");
  wmsInfo.setWorkspace(ws);
  geoServer.add(wmsInfo);
}

相关文章