-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2 添加了 自动创建索引功能 3 部分代码测试 4 发布0.9.18
- Loading branch information
Showing
60 changed files
with
1,012 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ore/src/main/java/com/whaleal/mars/codecs/pojo/PropertyModelEncrptySerializationImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.whaleal.mars.codecs.pojo; | ||
|
||
import com.whaleal.mars.util.AESUtil; | ||
|
||
/** | ||
* @author wh | ||
* | ||
* 针对字符串等格式 进行先关加密及解密的 实现类 | ||
* | ||
* @see com.whaleal.mars.codecs.pojo.annotations.PropEncrypt ; | ||
* | ||
*/ | ||
class PropertyModelEncrptySerializationImpl implements PropertySerialization<String> { | ||
|
||
|
||
private String sKey ; | ||
private boolean enableDecrypt ; | ||
|
||
PropertyModelEncrptySerializationImpl( String sKey ,boolean enableDecrypt) { | ||
super(); | ||
this.sKey = sKey ; | ||
this.enableDecrypt = enableDecrypt ; | ||
|
||
} | ||
|
||
@Override | ||
public boolean shouldSerialize(final String value) { | ||
return value != null; | ||
} | ||
|
||
@Override | ||
public String serialize( String value ) { | ||
try { | ||
return AESUtil.encrypt(value , sKey); | ||
}catch (Exception e){ | ||
e.printStackTrace(); | ||
return null ; | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public String deserialize( String value ) { | ||
if(enableDecrypt){ | ||
try { | ||
return AESUtil.decrypt(value,sKey); | ||
}catch (Exception e){ | ||
return null ; | ||
} | ||
}else { | ||
return value ; | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
mars-core/src/main/java/com/whaleal/mars/codecs/pojo/annotations/PropEncrypt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.whaleal.mars.codecs.pojo.annotations; | ||
|
||
/** | ||
* @author wh | ||
* | ||
* 主要用于字段级别的加密 | ||
* | ||
* 当前使用 AES 加密解密 | ||
* | ||
* | ||
* | ||
* 与 property 注解 冲突 | ||
* | ||
*/ | ||
import java.lang.annotation.*; | ||
|
||
@Target({ElementType.FIELD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Inherited | ||
@Documented | ||
public @interface PropEncrypt { | ||
|
||
/** | ||
* 加密秘钥 | ||
* @return | ||
* | ||
*/ | ||
String value() default "0123456789abcdef"; | ||
|
||
|
||
|
||
/** | ||
* 是否启用解密处理 | ||
*/ | ||
boolean enableDecrypt() default true; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.