Refine search
/** * 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"); }
provided.add(new Version(v)); if (acceptedList == null || acceptedList.isEmpty()) return provided.last().toString(); checkVersionNumber(v, null); accepted.add(new Version(v)); if (!accepted.isEmpty()) { version = ((Version) accepted.last()).toString(); } else { for (String v : acceptedList) { accepted.add(new Version(v)); if ((accepted.last()).compareTo(provided.first()) < 0) { version = (provided.first()).toString(); if ((accepted.first()).compareTo(provided.last()) > 0) { version = (provided.last()).toString(); Version current = v.next(); if (current.compareTo(accepted.last()) > 0) { break; version = last.toString();
/** * 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; }
/** * Makes sure this triggers only * </p> */ public boolean canHandle(Operation operation) { // is this a wcs 1.1.1 or 1.1.0 one? return "GetCapabilities".equalsIgnoreCase(operation.getId()) && operation.getService().getId().equals("wcs") && (operation.getService().getVersion().toString().equals("1.1.0") || operation.getService().getVersion().toString().equals("1.1.1")); }
Service findService(String id, String ver, String namespace) throws ServiceException { Version version = (ver != null) ? new Version(ver) : null; Collection services = loadServices(); Service sBean = (Service) itr.next(); if (sBean.getId().equalsIgnoreCase(id)) { matches.add(sBean); Service s = (Service) itr.next(); if (version.equals(s.getVersion())) { continue; for (Iterator itr = nmatches.iterator(); itr.hasNext(); ) { Service s = (Service) itr.next(); if (s.getNamespace() != null && !s.getNamespace().equals(namespace)) {
private void writeCurrentVersion() throws IOException { Resource security = security(); security.dir(); Resource properties = security.get(VERSION_PROPERTIES); Properties p = new Properties(); p.put(VERSION, CURR_VERSION.toString()); try (OutputStream os = properties.out()) { p.store( os, "Current version of the security directory. Do not remove or alter this file"); } }
Object serviceBean = serviceDescriptor.getService(); Method operation = OwsUtils.method(serviceBean.getClass(), req.getRequest()); Version version = new Version(req.getVersion()); if (version.equals(service.getVersion())) { found = true;
public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { TransactionResponseType response = (TransactionResponseType) value; if (new Version("1.0.0").equals(operation.getService().getVersion())) { v_1_0(response, output, operation); } else { v_1_1(response, output, operation); } }
/** @see org.geoserver.web.CapabilitiesHomePageLinkProvider#getCapabilitiesComponent */ public Component getCapabilitiesComponent(final String id) { List<CapsInfo> serviceInfoLinks = new ArrayList<CapabilitiesHomePagePanel.CapsInfo>(); List<Service> extensions = GeoServerExtensions.extensions(Service.class); for (Service si : extensions) { if (si.getCustomCapabilitiesLink() != null) { String serviceId = si.getId(); String capsLink = si.getCustomCapabilitiesLink(); CapsInfo ci = new CapsInfo(serviceId, si.getVersion(), capsLink); serviceInfoLinks.add(ci); } else if (si.getOperations().contains("GetCapabilities")) { String serviceId = si.getId(); String capsLink = "../ows?service=" + serviceId + "&version=" + si.getVersion().toString() + "&request=GetCapabilities"; CapsInfo ci = new CapsInfo(serviceId, si.getVersion(), capsLink); serviceInfoLinks.add(ci); } } return new CapabilitiesHomePagePanel(id, serviceInfoLinks); } }
@Override public void encode( StyledLayerDescriptor sld, Version version, boolean pretty, OutputStream output) throws IOException { if (version != null && VERSION_11.compareTo(version) == 0) { encode11(sld, pretty, output); } else { encode10(sld, pretty, output); } }
/** * Compares this value with a given version as string * * @param version * @return */ public int compareTo(String version) { if (version == null) { return (this == latest()) ? 0 : -1; } return this.version.compareTo(new org.geotools.util.Version(version)); }
@Override public String mimeType(Version version) { if (version != null && version.equals(VERSION_11)) { return MIMETYPE_11; } return MIMETYPE_10; }
@Override protected EObject createDescribeFeatureTypeRequestPost(DescribeFeatureTypeRequest request) { final Wfs20Factory factory = Wfs20Factory.eINSTANCE; DescribeFeatureTypeType dft = factory.createDescribeFeatureTypeType(); Version version = getServiceVersion(); dft.setService("WFS"); dft.setVersion(version.toString()); dft.setHandle(request.getHandle()); if (Versions.v1_0_0.equals(version)) { dft.setOutputFormat(null); } QName typeName = request.getTypeName(); @SuppressWarnings("unchecked") List<QName> typeNames = dft.getTypeName(); typeNames.add(typeName); return dft; }
String version = null; if (useServiceVersion && request.getServiceDescriptor() != null) { version = request.getServiceDescriptor().getVersion().toString();
public int compare(Object o1, Object o2) { Service s1 = (Service) o1; Service s2 = (Service) o2; return s1.getVersion().compareTo(s2.getVersion()); } };
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"); }
/** Makes sure this triggers only */ public boolean canHandle(Operation operation) { // is this a wcs 1.1.1 or 1.1.0 one? return "GetCapabilities".equalsIgnoreCase(operation.getId()) && operation.getService().getId().equals("wcs") && (operation.getService().getVersion().toString().equals("1.1.0") || operation.getService().getVersion().toString().equals("1.1.1")); }