-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use distributed configuration, add client-only modules, refactoring
- Loading branch information
Showing
86 changed files
with
878 additions
and
355 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
File renamed without changes.
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
20 changes: 20 additions & 0 deletions
20
...ospike-common/src/main/java/org/springframework/boot/autoconfigure/util/IsClientOnly.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,20 @@ | ||
package org.springframework.boot.autoconfigure.util; | ||
|
||
import org.springframework.context.annotation.Condition; | ||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
import static org.springframework.data.aerospike.config.AerospikeDataConfigurationSupport.CONFIG_PREFIX_DATA; | ||
|
||
public class IsClientOnly implements Condition { | ||
|
||
@Override | ||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { | ||
String strIsClientOnly = context.getEnvironment().getProperty("starters.aerospike.client-only"); | ||
String namespace = context.getEnvironment().getProperty(CONFIG_PREFIX_DATA + ".namespace"); | ||
boolean isClientOnly = strIsClientOnly != null && strIsClientOnly.equalsIgnoreCase("true"); | ||
boolean hasNamespace = namespace != null && !namespace.isEmpty(); | ||
// if the explicit client-only property is true, no need to check for namespace | ||
return isClientOnly || !hasNamespace; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ike-common/src/main/java/org/springframework/boot/autoconfigure/util/IsNotClientOnly.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,22 @@ | ||
package org.springframework.boot.autoconfigure.util; | ||
|
||
import org.springframework.context.annotation.Condition; | ||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
import static org.springframework.data.aerospike.config.AerospikeDataConfigurationSupport.CONFIG_PREFIX_DATA; | ||
|
||
public class IsNotClientOnly implements Condition { | ||
|
||
@Override | ||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { | ||
String strIsClientOnly = context.getEnvironment().getProperty("starters.aerospike.client-only"); | ||
String namespace = context.getEnvironment().getProperty(CONFIG_PREFIX_DATA + ".namespace"); | ||
boolean isClientOnly = strIsClientOnly != null | ||
&& !strIsClientOnly.isEmpty() | ||
&& Boolean.getBoolean(strIsClientOnly); | ||
boolean hasNamespace = namespace != null && !namespace.isEmpty(); | ||
// if the explicit client-only property is true, no need to check for namespace | ||
return !isClientOnly && hasNamespace; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...mmon/src/main/java/org/springframework/boot/autoconfigure/util/ValidateHostsProperty.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,24 @@ | ||
package org.springframework.boot.autoconfigure.util; | ||
|
||
import org.springframework.context.annotation.Condition; | ||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
import java.security.InvalidParameterException; | ||
|
||
import static org.springframework.data.aerospike.config.AerospikeDataConfigurationSupport.CONFIG_PREFIX_CONNECTION; | ||
|
||
public class ValidateHostsProperty implements Condition { | ||
|
||
@Override | ||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { | ||
String hostsProperty = CONFIG_PREFIX_CONNECTION + ".hosts"; | ||
String hosts = context.getEnvironment().getProperty(hostsProperty); | ||
boolean hasHosts = hosts != null && !hosts.isEmpty(); | ||
|
||
if (!hasHosts) { | ||
throw new InvalidParameterException("Required property '" + hostsProperty + "' is missing"); | ||
} | ||
return true; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
spring-boot-autoconfigure-aerospike-common/src/main/resources/META-INF/spring.factories
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,3 @@ | ||
# Auto Configure | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
org.springframework.boot.autoconfigure.aerospike.AerospikeAutoConfiguration,\ |
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
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 @@ | ||
org.springframework.boot.autoconfigure.aerospike.AerospikeAutoConfiguration |
File renamed without changes.
15 changes: 0 additions & 15 deletions
15
...pike/src/main/java/org/springframework/boot/autoconfigure/utils/HasNamespaceProperty.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...spike/src/main/java/org/springframework/boot/autoconfigure/utils/NoNamespaceProperty.java
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
spring-boot-autoconfigure-data-aerospike/src/main/resources/META-INF/spring.factories
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.