cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abulat...@apache.org
Subject [cayenne] branch STABLE-4.0 updated: CAY-2584 Crypto: can't use ColumnSelect with encrypted columns
Date Mon, 10 Jun 2019 09:40:27 GMT
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch STABLE-4.0
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/STABLE-4.0 by this push:
     new e4f950b  CAY-2584 Crypto: can't use ColumnSelect with encrypted columns
e4f950b is described below

commit e4f950b7a6ba5d919aee495a3cf35bfd30ca7e93
Author: Arseni Bulatski <ancarseni@gmail.com>
AuthorDate: Mon Jun 10 12:39:57 2019 +0300

    CAY-2584 Crypto: can't use ColumnSelect with encrypted columns
---
 .../org/apache/cayenne/crypto/CryptoModule.java    | 30 +++++-----------------
 .../cayenne/crypto/CryptoServerModuleProvider.java | 11 ++++----
 .../reader/CryptoRowReaderFactoryDecorator.java    | 10 +++-----
 3 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoModule.java b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoModule.java
index f12f22a..26d4382 100644
--- a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoModule.java
+++ b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoModule.java
@@ -18,6 +18,11 @@
  */
 package org.apache.cayenne.crypto;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Types;
+import java.util.Date;
+
 import org.apache.cayenne.access.jdbc.reader.RowReaderFactory;
 import org.apache.cayenne.access.translator.batch.BatchTranslatorFactory;
 import org.apache.cayenne.crypto.batch.CryptoBatchTranslatorFactoryDecorator;
@@ -33,32 +38,11 @@ import org.apache.cayenne.crypto.transformer.TransformerFactory;
 import org.apache.cayenne.crypto.transformer.bytes.BytesTransformerFactory;
 import org.apache.cayenne.crypto.transformer.bytes.DefaultBytesTransformerFactory;
 import org.apache.cayenne.crypto.transformer.bytes.LazyBytesTransformerFactory;
-import org.apache.cayenne.crypto.transformer.value.Base64StringConverter;
-import org.apache.cayenne.crypto.transformer.value.BigDecimalConverter;
-import org.apache.cayenne.crypto.transformer.value.BigIntegerConverter;
-import org.apache.cayenne.crypto.transformer.value.BooleanConverter;
-import org.apache.cayenne.crypto.transformer.value.ByteConverter;
-import org.apache.cayenne.crypto.transformer.value.BytesConverter;
-import org.apache.cayenne.crypto.transformer.value.BytesToBytesConverter;
-import org.apache.cayenne.crypto.transformer.value.DefaultValueTransformerFactory;
-import org.apache.cayenne.crypto.transformer.value.DoubleConverter;
-import org.apache.cayenne.crypto.transformer.value.FloatConverter;
-import org.apache.cayenne.crypto.transformer.value.IntegerConverter;
-import org.apache.cayenne.crypto.transformer.value.LazyValueTransformerFactory;
-import org.apache.cayenne.crypto.transformer.value.LongConverter;
-import org.apache.cayenne.crypto.transformer.value.ShortConverter;
-import org.apache.cayenne.crypto.transformer.value.Utf8StringConverter;
-import org.apache.cayenne.crypto.transformer.value.UtilDateConverter;
-import org.apache.cayenne.crypto.transformer.value.ValueTransformerFactory;
+import org.apache.cayenne.crypto.transformer.value.*;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.MapBuilder;
 import org.apache.cayenne.di.Module;
 
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Types;
-import java.util.Date;
-
 /**
  * Contains cryptography extensions for Cayenne.
  *
@@ -129,7 +113,7 @@ public class CryptoModule implements Module {
         binder.bind(ColumnMapper.class).toInstance(new PatternColumnMapper(DEFAULT_COLUMN_MAPPER_PATTERN));
 
         binder.decorate(BatchTranslatorFactory.class).before(CryptoBatchTranslatorFactoryDecorator.class);
-        binder.decorate(RowReaderFactory.class).before(CryptoRowReaderFactoryDecorator.class);
+        binder.bind(RowReaderFactory.class).to(CryptoRowReaderFactoryDecorator.class);
 
         // decorate Crypto's own services to allow Cayenne to operate over plaintext entities
even if crypto keys are
         // not available.
diff --git a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoServerModuleProvider.java
b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoServerModuleProvider.java
index 9fe8bc8..0e79c3a 100644
--- a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoServerModuleProvider.java
+++ b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/CryptoServerModuleProvider.java
@@ -18,12 +18,13 @@
  */
 package org.apache.cayenne.crypto;
 
-import org.apache.cayenne.configuration.server.CayenneServerModuleProvider;
-import org.apache.cayenne.di.Module;
-
 import java.util.Collection;
 import java.util.Collections;
 
+import org.apache.cayenne.configuration.server.CayenneServerModuleProvider;
+import org.apache.cayenne.configuration.server.ServerModule;
+import org.apache.cayenne.di.Module;
+
 /**
  * @since 4.0
  */
@@ -41,7 +42,7 @@ public class CryptoServerModuleProvider implements CayenneServerModuleProvider
{
 
     @Override
     public Collection<Class<? extends Module>> overrides() {
-        // we don't override anything, we only decorate ServerModule services...
-        return Collections.emptyList();
+        Collection modules = Collections.singletonList(ServerModule.class);
+        return modules;
     }
 }
diff --git a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/reader/CryptoRowReaderFactoryDecorator.java
b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/reader/CryptoRowReaderFactoryDecorator.java
index e60600a..2b2f764 100644
--- a/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/reader/CryptoRowReaderFactoryDecorator.java
+++ b/cayenne-crypto/src/main/java/org/apache/cayenne/crypto/reader/CryptoRowReaderFactoryDecorator.java
@@ -18,11 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.crypto.reader;
 
+import java.sql.ResultSet;
+import java.util.Map;
+
 import org.apache.cayenne.access.jdbc.ColumnDescriptor;
 import org.apache.cayenne.access.jdbc.RowDescriptor;
 import org.apache.cayenne.access.jdbc.reader.DefaultRowReaderFactory;
 import org.apache.cayenne.access.jdbc.reader.RowReader;
-import org.apache.cayenne.access.jdbc.reader.RowReaderFactory;
 import org.apache.cayenne.access.types.ExtendedType;
 import org.apache.cayenne.access.types.ExtendedTypeMap;
 import org.apache.cayenne.crypto.map.ColumnMapper;
@@ -41,9 +43,6 @@ import org.apache.cayenne.query.EntityResultSegment;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.ScalarResultSegment;
 
-import java.sql.ResultSet;
-import java.util.Map;
-
 public class CryptoRowReaderFactoryDecorator extends DefaultRowReaderFactory {
 
     private TransformerFactory transformerFactory;
@@ -51,8 +50,7 @@ public class CryptoRowReaderFactoryDecorator extends DefaultRowReaderFactory
{
     private BytesTransformerFactory bytesTransformerFactory;
     private ValueTransformerFactory valueTransformerFactory;
 
-    public CryptoRowReaderFactoryDecorator(@Inject RowReaderFactory delegate,
-                                           @Inject TransformerFactory transformerFactory,
+    public CryptoRowReaderFactoryDecorator(@Inject TransformerFactory transformerFactory,
                                            @Inject ColumnMapper columnMapper,
                                            @Inject BytesTransformerFactory bytesTransformerFactory,
                                            @Inject ValueTransformerFactory valueTransformerFactory)
{


Mime
View raw message