/** * Returns the format version for the specified mime type. * * <p>This method should only be overriden by formats that support multiple versions. The * default implementation just returns 1.0.0. */ public Version versionForMimeType(String mimeType) { return new Version("1.0.0"); }
/** * Determines the version of the format/language of the specified style resource. * * <p>This method should only be overriden by formats that support multiple versions. The * default implementation just returns 1.0.0. * * @param input The style input, see {@link #toReader(Object)} for accepted inputs. */ public Version version(Object input) throws IOException { return new Version("1.0.0"); }
/** Supported format versions. */ public List<Version> getVersions() { return Arrays.asList(new Version("1.0.0")); }
public OWS11AcceptVersionsKvpParser() { super("AcceptVersions", AcceptVersionsType.class); setVersion(new Version("1.1.1")); }
public void setAsText(String text) throws IllegalArgumentException { setValue(new Version(text)); } }
public MessageXmlParser() { this(null, new Version("1.0.0")); }
public WCSInfo load(LegacyServicesReader reader, GeoServer gs) throws Exception { WCSInfoImpl wcs = new WCSInfoImpl(); wcs.setId("wcs"); Map<String, Object> map = reader.wcs(); readCommon(wcs, map, gs); // wcs.setGMLPrefixing((Boolean)map.get( "gmlPrefixing")); wcs.getVersions().add(new Version("1.0.0")); wcs.getVersions().add(new Version("1.1.1")); return wcs; }
@Override protected WCSInfo initialize(WCSInfo service) { super.initialize(service); if (service.getExceptionFormats() == null) { ((WCSInfoImpl) service).setExceptionFormats(new ArrayList<String>()); } if (service.getVersions().isEmpty()) { service.getVersions().add(new Version("1.0.0")); service.getVersions().add(new Version("1.1.1")); } Version v201 = new Version("2.0.1"); if (!service.getVersions().contains(v201)) { service.getVersions().add(v201); } if (service.getSRS() == null) { ((WCSInfoImpl) service).setSRS(new ArrayList<String>()); } return service; } }
private Version getSecurityVersion() throws IOException { Resource security = security(); if (security.getType() == Type.UNDEFINED) { return BASE_VERSION; } Resource properties = security.get(VERSION_PROPERTIES); if (properties.getType() == Type.UNDEFINED) { return BASE_VERSION; } Properties p = new Properties(); try (InputStream is = properties.in()) { p.load(is); } String version = p.getProperty(VERSION); if (version != null) { return new Version(version); } else { return BASE_VERSION; } }
/** * Normalize the version, handling cases like forcing "x.y" to "x.y.z". * * @param version * @return normalized version */ public static String normalizeVersion(String version) { if (version == null) { return null; } Version v = new Version(version); if (v.getMajor() == null) { return null; } if (v.getMinor() == null) { return String.format("%d.0.0", ((Number) v.getMajor()).intValue()); } if (v.getRevision() == null) { return String.format( "%d.%d.0", ((Number) v.getMajor()).intValue(), ((Number) v.getMinor()).intValue()); } // version ok return version; }
return new Object[] {new Version(version), reader};
"directCallService", serviceBean, new Version("1.0.0"), Collections.singletonList("concat")); Method method = serviceBean.getClass().getMethod("concat", String.class, String.class);
@Test public void testParsedStyle() throws IOException { File styleDir = new File(dataDir.root(), "styles"); styleDir.mkdir(); // Copy the sld to the temp style dir File styleFile = new File(styleDir, "external.sld"); Files.copy(this.getClass().getResourceAsStream("external.sld"), styleFile.toPath()); File iconFile = new File(styleDir, "icon.png"); assertFalse(iconFile.exists()); StyleInfoImpl si = new StyleInfoImpl(null); si.setName(""); si.setId(""); si.setFormat("sld"); si.setFormatVersion(new Version("1.0.0")); si.setFilename(styleFile.getName()); Style s = dataDir.parsedStyle(si); // Verify style is actually parsed correctly Symbolizer symbolizer = s.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); assertTrue(symbolizer instanceof PointSymbolizer); GraphicalSymbol graphic = ((PointSymbolizer) symbolizer).getGraphic().graphicalSymbols().get(0); assertTrue(graphic instanceof ExternalGraphic); assertEquals(((ExternalGraphic) graphic).getLocation(), iconFile.toURI().toURL()); // GEOS-7025: verify the icon file is not created if it doesn't already exist assertFalse(iconFile.exists()); }
si.setId(""); si.setFormat("sld"); si.setFormatVersion(new Version("1.0.0")); si.setFilename(styleFile.getName());
si.setId(""); si.setFormat("sld"); si.setFormatVersion(new Version("1.0.0")); si.setFilename(styleFile.getName());
protected void setUp() throws Exception { super.setUp(); HelloWorld helloWorld = new HelloWorld(); Service service = new Service( "hello", helloWorld, new Version("1.0.0"), Collections.singletonList("hello")); request = new MockHttpServletRequest() { public int getServerPort() { return 8080; } }; request.setScheme("http"); request.setServerName("localhost"); request.setContextPath("geoserver"); response = new MockHttpServletResponse(); handler = new DefaultServiceExceptionHandler(); requestInfo = new Request(); requestInfo.setHttpRequest(request); requestInfo.setHttpResponse(response); requestInfo.setService("hello"); requestInfo.setVersion("1.0.0"); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); testData.addStyle("relative", "se_relativepath.sld", ResourcePoolTest.class, getCatalog()); testData.addStyle( "relative_protocol", "se_relativepath_protocol.sld", ResourcePoolTest.class, getCatalog()); testData.addStyle(HUMANS, "humans.sld", ResourcePoolTest.class, getCatalog()); testData.addStyle(EXTERNAL_ENTITIES, "externalEntities.sld", TestData.class, getCatalog()); StyleInfo style = getCatalog().getStyleByName("relative"); style.setFormatVersion(new Version("1.1.0")); getCatalog().save(style); style = getCatalog().getStyleByName(HUMANS); style.setFormatVersion(new Version("1.1.0")); getCatalog().save(style); File images = new File(testData.getDataDirectoryRoot(), "styles/images"); assertTrue(images.mkdir()); File image = new File("./src/test/resources/org/geoserver/catalog/rockFillSymbol.png"); assertTrue(image.exists()); FileUtils.copyFileToDirectory(image, images); rockFillSymbolFile = new File(images, image.getName()).getCanonicalFile(); testData.addRasterLayer( TIMERANGES, "timeranges.zip", null, null, SystemTestData.class, getCatalog()); FileUtils.copyFileToDirectory( new File("./src/test/resources/geoserver-environment.properties"), testData.getDataDirectoryRoot()); }
style.setFormatVersion(new Version("1.1.0")); catalog.save(style); File images = new File(testData.getDataDirectoryRoot(), "styles/images");