org.deegree.commons.tom.ows.Version.parseVersion()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(101)

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

Version.parseVersion介绍

[英]Parses the string argument as a Version.

The string value shall contain one x.y.z "version" value (e.g., "2.1.3"). A version number shall contain three non-negative integers separated by decimal points, in the form "x.y.z". The integers y and z shall not exceed 99.
[中]将字符串参数解析为Version
字符串值应包含一个x.y.z“版本”值(例如,“2.1.3”)。版本号应包含三个由小数点分隔的非负整数,格式为“x.y.z”。整数y和z不得超过99。

代码示例

代码示例来源:origin: deegree/deegree3

/**
 * Returns the old-style version information (used by pre-OWS GetCapabilities requests, see section D.11 of OGC
 * 06-121r3).
 * 
 * @return old-style version information, may be <code>null</code> (if this is an OWS-style request or an pre-OWS
 *         request without version specification)
 * @throws InvalidParameterValueException
 *             if any of the versions is not syntactically correct
 */
public Version getVersionAsVersion()
            throws InvalidParameterValueException {
  return Version.parseVersion( version );
}

代码示例来源:origin: deegree/deegree3

private WFSVersion( String ogcVersion, String ns ) {
  this.ogcVersion = Version.parseVersion( ogcVersion );
  this.ns = ns;
}

代码示例来源:origin: deegree/deegree3

/**
 * Returns the acceptable versions in order of client preference (most preferred version first).
 * 
 * @see Version
 * 
 * @return the acceptable versions, in order of preference, may be empty, but not <code>null</code>
 * @throws InvalidParameterValueException
 *             if any of the versions is not syntactically correct
 */
public List<Version> getAcceptVersionsAsVersions()
            throws InvalidParameterValueException {
  List<Version> versions = new ArrayList<Version>( acceptVersions.size() );
  for ( String version : acceptVersions ) {
    versions.add( Version.parseVersion( version ) );
  }
  return versions;
}

代码示例来源:origin: deegree/deegree3

@Override
public XMLExceptionSerializer getExceptionSerializer( Version requestVersion ) {
  return new CswExceptionReportSerializer( Version.parseVersion( "1.2.0" ) );
}

代码示例来源:origin: deegree/deegree3

public Version getNodeAsVersion( OMElement context, XPath xpath, Version defaultValue )
            throws XMLParsingException {
  Version value = defaultValue;
  String s = getNodeAsString( context, xpath, null );
  if ( s != null ) {
    value = Version.parseVersion( s );
  }
  return value;
}

代码示例来源:origin: deegree/deegree3

/**
 * Returns the {@link ExceptionSerializer} for the given request version.
 * 
 * @param requestVersion
 *            version of the request, may be <code>null</code> (implies that the serializer for the highest
 *            supported version shall be returned)
 * @return suitable XML serializer, never <code>null</code>
 */
public XMLExceptionSerializer getExceptionSerializer( Version requestVersion ) {
  return new OWS110ExceptionReportSerializer( Version.parseVersion( "1.1.0" ) );
}

代码示例来源:origin: deegree/deegree3

private Version getVersion( String versionString )
            throws OWSException {
  Version version = null;
  if ( versionString != null ) {
    try {
      version = Version.parseVersion( versionString );
    } catch ( IllegalArgumentException e ) {
      throw new OWSException( "Specified request version '" + versionString
                  + "' is not a valid OGC version string.", OWSException.INVALID_PARAMETER_VALUE );
    }
  }
  return version;
}

代码示例来源:origin: deegree/deegree3

public TransactionXmlReader createReader( XMLStreamReader xmlStream ) {
    Version version = null;
    if ( WFS_NS.equals( xmlStream.getNamespaceURI() ) ) {
      String s = getAttributeValue( xmlStream, "version" );
      if ( s == null ) {
        s = "1.1.0";
      }
      version = parseVersion( s );
    } else {
      version = parseVersion( getRequiredAttributeValue( xmlStream, "version" ) );
    }
    return createReader( version );
  }
}

代码示例来源:origin: deegree/deegree3

private Version getVersion( String versionString )
            throws OWSException {
  Version version = null;
  if ( versionString != null && !"".equals( versionString ) ) {
    try {
      version = Version.parseVersion( versionString );
    } catch ( InvalidParameterValueException e ) {
      throw new OWSException( e.getMessage(), OWSException.INVALID_PARAMETER_VALUE, "version" );
    }
  }
  return version;
}

代码示例来源:origin: deegree/deegree3

private Version parseVersion( String versionString )
            throws OWSException {
  if ( versionString != null && !"".equals( versionString ) ) {
    try {
      return Version.parseVersion( versionString );
    } catch ( InvalidParameterValueException e ) {
      throw new OWSException( e.getMessage(), OWSException.INVALID_PARAMETER_VALUE, "version" );
    }
  }
  return null;
}

代码示例来源:origin: deegree/deegree3

/**
 * Parses the {@link DescribeRecord} KVP request and decides which version has to parse because of the requested
 * version.
 * 
 * @param normalizedKVPParams
 *            that are requested as key to a value.
 * @return {@link DescribeRecord}
 */
public static DescribeRecord parse( Map<String, String> normalizedKVPParams ) {
  Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) );
  return parse202( version, normalizedKVPParams );
}

代码示例来源:origin: deegree/deegree3

private void sendServiceException( OWSException ex, HttpResponseBuffer response )
            throws ServletException {
  sendException( null, getExceptionSerializer( parseVersion( "1.2.0" ) ), ex, response );
}

代码示例来源:origin: deegree/deegree3

/**
 * @param requestedVersions
 * @throws ResourceInitException
 */
protected final void validateAndSetOfferedVersions( Collection<String> requestedVersions )
            throws ResourceInitException {
  for ( String requestedVersion : requestedVersions ) {
    Version version = Version.parseVersion( requestedVersion );
    if ( !( ( (OWSProvider) metadata.getProvider() ).getImplementationMetadata().getImplementedVersions().contains( Version.parseVersion( requestedVersion ) ) ) ) {
      String msg = "Version '" + requestedVersion + "' is not supported by the service implementation.";
      throw new ResourceInitException( msg );
    }
    offeredVersions.add( version );
  }
}

代码示例来源:origin: deegree/deegree3

/**
   * @param kvp
   * @return a DescribeCoverage object with all requested coverages
   */
  public static DescribeCoverage parse( Map<String, String> kvp ) {
    List<String> coverages = KVPUtils.splitAll( kvp, "COVERAGE" );

    String version = KVPUtils.getDefault( kvp, "VERSION", "1.0.0" );
    return new DescribeCoverage( Version.parseVersion( version ), coverages );
  }
}

代码示例来源:origin: deegree/deegree3

private static Version parseVersion( Map<String, String> kvp )
              throws OWSException {
    String version = KVPUtils.getRequired( kvp, "VERSION" );
    if ( !Version.parseVersion( version ).equals( VERSION_100 ) ) {
      throw new OWSException( "Version must be: " + VERSION_100.toString(), OWSException.INVALID_PARAMETER_VALUE );
    }
    return VERSION_100;
  }
}

代码示例来源:origin: deegree/deegree3

private void sendSoapException( SOAPEnvelope soapDoc, SOAPFactory factory, HttpResponseBuffer response,
                OWSException e, ServletRequest request, SOAPVersion version )
            throws OMException, ServletException {
  XMLExceptionSerializer serializer = getExceptionSerializer( parseVersion( "1.2.0" ) );
  sendSOAPException( soapDoc.getHeader(), factory, response, e, serializer, null, null, request.getServerName(),
            request.getCharacterEncoding() );
}

代码示例来源:origin: deegree/deegree3

protected WMSCapabilitiesAdapter getCapabilitiesAdapter( OMElement root, String version )
            throws IOException {
  if ( version != null ) {
    wmsVersion = Version.parseVersion( version );
  } else {
    LOG.warn( "No version attribute in WMS capabilities document. Defaulting to 1.1.1." );
    wmsVersion = VERSION_111;
  }
  if ( VERSION_111.equals( wmsVersion ) ) {
    return new WMS111CapabilitiesAdapter( root );
  } else if ( VERSION_130.equals( wmsVersion ) ) {
    return new WMS130CapabilitiesAdapter( root );
  }
  throw new IllegalArgumentException( get( "WMSCLIENT.WRONG_VERSION_CAPABILITIES",
                       getIdentification().getServiceTypeVersion(), VERSION_111 + ", "
                                             + VERSION_130 ) );
}

代码示例来源:origin: deegree/deegree3

/**
 * Parses a <code>GetPropertyValue</code> element into a {@link GetPropertyValue} object.
 * 
 * @return parsed {@link GetPropertyValue} request, never <code>null</code>
 * @throws OWSException
 */
public GetPropertyValue parse()
            throws OWSException {
  Version version = Version.parseVersion( getNodeAsString( rootElement, new XPath( "@version", nsContext ), null ) );
  GetPropertyValue result = null;
  if ( VERSION_200.equals( version ) ) {
    result = parse200();
  } else {
    String msg = "Version '" + version
           + "' is not supported for GetPropertyValue requests. The only supported version is 2.0.0.";
    throw new OWSException( msg, VERSION_NEGOTIATION_FAILED, null );
  }
  return result;
}

代码示例来源:origin: deegree/deegree3

/**
 * Parses the {@link GetRecords} kvp request and decides which version has to parse because of the requested version
 * 
 * @param normalizedKVPParams
 *            that are requested as key to a value.
 * @return {@link GetRecords}
 */
public static GetRecords parse( Map<String, String> normalizedKVPParams, String defaultOutputFormat,
                String defaultOutputSchema ) {
  Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) );
  GetRecords result = null;
  if ( VERSION_202.equals( version ) ) {
    result = parse202( VERSION_202, normalizedKVPParams, defaultOutputFormat, defaultOutputSchema );
  } else {
    String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) );
    throw new InvalidParameterValueException( msg );
  }
  return result;
}

代码示例来源:origin: deegree/deegree3

public static GetRepositoryItem parse( Map<String, String> normalizedKVPParams ) {
  Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) );
  if ( VERSION_202.equals( version ) || VERSION_100.equals( version ) ) {
    return new GetRepositoryItem( KVPUtils.getRequired( normalizedKVPParams, "ID" ) );
  } else {
    String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 )
                                  + Version.getVersionsString( VERSION_100 ) );
    throw new InvalidParameterValueException( msg );
  }
}

相关文章