if (other.getAbstract() != null) return false; } else if (!abstrct.equals(other.getAbstract())) return false; if (accessConstraints == null) { if (other.getAccessConstraints() != null) return false; } else if (!accessConstraints.equals(other.getAccessConstraints())) return false; if (citeCompliant != other.isCiteCompliant()) return false; if (enabled != other.isEnabled()) return false; if (exceptionFormats == null) { if (other.getExceptionFormats() != null) return false; } else if (!exceptionFormats.equals(other.getExceptionFormats())) return false; if (fees == null) { if (other.getFees() != null) return false; } else if (!fees.equals(other.getFees())) return false; if (id == null) { if (other.getId() != null) return false; } else if (!id.equals(other.getId())) return false; if (keywords == null) { if (other.getKeywords() != null) return false; } else if (!keywords.equals(other.getKeywords())) return false; if (maintainer == null) { if (other.getMaintainer() != null) return false; } else if (!maintainer.equals(other.getMaintainer())) return false; if (metadataLink == null) { if (other.getMetadataLink() != null) return false; } else if (!metadataLink.equals(other.getMetadataLink())) return false; if (name == null) { if (other.getName() != null) return false; } else if (!name.equals(other.getName())) return false; if (onlineResource == null) {
public void add(ServiceInfo service) { // may be adding a proxy, need to unwrap service = unwrap(service); setId(service); service.setGeoServer(geoServer); services.add(service); }
throws Exception { service.setEnabled((Boolean) properties.get("enabled")); service.setName((String) properties.get("name")); service.setTitle((String) properties.get("title")); service.setAbstract((String) properties.get("abstract")); ml.setMetadataType((String) metadataLink.get("metadataType")); ml.setType((String) metadataLink.get("type")); service.setMetadataLink(ml); service.getKeywords().addAll(keywords); service.setOnlineResource((String) properties.get("onlineResource")); service.setFees((String) properties.get("fees")); service.setAccessConstraints((String) properties.get("accessConstraints")); service.setCiteCompliant((Boolean) properties.get("citeConformanceHacks")); service.setMaintainer((String) properties.get("maintainer")); service.setSchemaBaseURL((String) properties.get("SchemaBaseUrl"));
<T extends ServiceInfo> T findByName( String name, WorkspaceInfo workspace, Class<T> clazz, List<ServiceInfo> services) { for (ServiceInfo si : services) { if (name.equals(si.getName()) && wsEquals(workspace, si.getWorkspace())) { return ModificationProxy.create((T) si, clazz); } } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine( "Could not locate service of type " + clazz + " in workspace " + workspace + " and name '" + name + "', available services were " + services); } return null; }
public void add(ServiceInfo service) { if (service.getId() != null && facade.getService(service.getId(), ServiceInfo.class) != null) { throw new IllegalArgumentException( "service with id '" + service.getId() + "' already exists"); } resolve(service); WorkspaceInfo workspace = service.getWorkspace(); if (workspace != null) { if (facade.getServiceByName(service.getName(), workspace, ServiceInfo.class) != null) { throw new IllegalArgumentException( "service with name '" + service.getName() + "' already exists in workspace '" + workspace.getName() + "'"); } } facade.add(service); // fire post modification event firePostServiceModified(service); }
assertThat(modifyEvent, notNullValue()); ServiceInfo modifiedService = serviceEvents.get(0).getSource(); assertThat(modifiedService.getName(), is(serviceInfo.getName())); assertThat(modifiedService.getId(), is(serviceInfo.getId())); assertThat(modifiedService.getAbstract(), is(newAbstract)); assertThat(postModifyEvent, notNullValue()); ServiceInfo postModifiedService = serviceEvents.get(0).getSource(); assertThat(postModifiedService.getName(), is(serviceInfo.getName())); assertThat(postModifiedService.getId(), is(serviceInfo.getId())); assertThat(postModifiedService.getAbstract(), is(newAbstract));
public List filter(List<ServiceInfo> services, WorkspaceInfo workspace) { List<ServiceInfo> list = new ArrayList(); for (ServiceInfo si : services) { if (wsEquals(workspace, si.getWorkspace())) { list.add(si); } } return list; }
try { ServiceInfo s = l.load(geoServer, directory); if (!global && s.getWorkspace() == null) continue; + s.getId() + "', " + (s.isEnabled() ? "enabled" : "disabled")); } catch (Throwable t) { if (Resources.exists(directory)) {
public <T extends ServiceInfo> T getService(String id, Class<T> clazz) { for (ServiceInfo si : services) { if (id.equals(si.getId())) { return ModificationProxy.create((T) si, clazz); } } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine( "Could not locate service of type " + clazz + " and id '" + id + "', available services were " + services); } return null; }
private List<String> servicesList() { return geoServer .getServices() .stream() .map(si -> si.getName()) .collect(Collectors.toList()); }
} else { created.setWorkspace(ws); geoServer.add(created);
newService1.setWorkspace(ws1); newService1.setName("SERVICE-1-WS-1"); newService1.setTitle("Service for WS1"); geoServer.add(newService1); globalService.setName("SERVICE-2-GLOBAL"); globalService.setTitle("Global Service"); geoServer.add(globalService); newService2.setWorkspace(ws2); newService2.setName("SERVICE-3-WS-2"); newService2.setTitle("Service for WS2"); geoServer.add(newService2);
@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()); }
@Test public void testAddService() throws Exception { ServiceInfo service = geoServer.getFactory().createService(); service.setName("foo"); geoServer.add(service); ServiceInfo s2 = geoServer.getFactory().createService(); ((ServiceInfoImpl) s2).setId(service.getId()); try { geoServer.add(s2); fail("adding service with duplicate id should throw exception"); } catch (Exception e) { } ServiceInfo s = geoServer.getServiceByName("foo", ServiceInfo.class); assertTrue(s != service); assertEquals(service, s); }
/** * * @see org.geoserver.web.CapabilitiesHomePageLinkProvider#getCapabilitiesComponent */ public Component getCapabilitiesComponent(final String id) { List<CapsInfo> serviceInfoLinks = new ArrayList<CapabilitiesHomePagePanel.CapsInfo>(); GeoServerApplication app = GeoServerApplication.get(); for (ServiceInfo si : app.getGeoServer().getServices()) { for (Version v : si.getVersions()) { String serviceId = si.getId(); String capsLink = "../ows?service=" + serviceId + "&version=" + v.toString() + "&request=GetCapabilities"; CapsInfo ci = new CapsInfo(serviceId, v, capsLink); serviceInfoLinks.add(ci); } } return new CapabilitiesHomePagePanel(id, serviceInfoLinks); } }
@Test public void testModifyService() throws Exception { ServiceInfo service = geoServer.getFactory().createService(); ((ServiceInfoImpl) service).setId("id"); service.setName("foo"); service.setTitle("bar"); geoServer.add(service); ServiceInfo s1 = geoServer.getServiceByName("foo", ServiceInfo.class); s1.setTitle("changed"); ServiceInfo s2 = geoServer.getServiceByName("foo", ServiceInfo.class); assertEquals("bar", s2.getTitle()); geoServer.save(s1); s2 = geoServer.getServiceByName("foo", ServiceInfo.class); assertEquals("changed", s2.getTitle()); }
private JMSServiceModifyEvent createModifyServiceEvent( String serviceName, String newServiceAbstract, String workspaceName) { // service information ServiceInfo serviceInfo = findService(serviceName, workspaceName); String oldServiceAbstract = serviceInfo.getAbstract(); serviceInfo.setAbstract(newServiceAbstract); // create jms service modify event return new JMSServiceModifyEvent( serviceInfo, Collections.singletonList("abstract"), Collections.singletonList(oldServiceAbstract), Collections.singletonList(newServiceAbstract), JMSEventType.MODIFIED); }
private void checkServiceExists( String serviceName, String serviceAbstract, String workspaceName) { ServiceInfo serviceInfo = findService(serviceName, workspaceName); assertThat(serviceInfo, notNullValue()); assertThat(serviceInfo.getAbstract(), is(serviceAbstract)); }
wmsService.setAbstract(randomString()); geoServer.save(wmsService);