Пример #1
0
 /**
  * Release geometry type
  *
  * @param connection Active h2 connection with DROP DOMAIN and DROP ALIAS rights
  */
 public static void unRegisterGeometryType(Connection connection) throws SQLException {
   Statement st = connection.createStatement();
   DomainInfo[] domainInfos = getBuiltInsType();
   for (DomainInfo domainInfo : domainInfos) {
     st.execute("DROP DOMAIN IF EXISTS " + domainInfo.getDomainName());
   }
 }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(DomainInfo domainInfo, StructuredJsonGenerator jsonGenerator) {

    if (domainInfo == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonGenerator.writeStartObject();

      if (domainInfo.getDomainName() != null) {
        jsonGenerator.writeFieldName("DomainName").writeValue(domainInfo.getDomainName());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
Пример #3
0
 /**
  * Register geometry type in an OSGi environment
  *
  * @param connection Active H2 connection
  * @throws SQLException
  */
 public static void registerGeometryType(Connection connection) throws SQLException {
   Statement st = connection.createStatement();
   for (DomainInfo domainInfo : getBuiltInsType()) {
     // Check for byte array first, to not throw an enigmatic error CastException
     st.execute(
         "CREATE DOMAIN IF NOT EXISTS "
             + domainInfo.getDomainName()
             + " AS "
             + GEOMETRY_BASE_TYPE
             + " CHECK (ST_GeometryTypeCode(VALUE) = "
             + domainInfo.getGeometryTypeCode()
             + ");");
   }
 }