-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from camunda-community-hub/backport/feature/s…
…upport-old-and-new-operate-properties [backport] Support old and new operate properties schema
- Loading branch information
Showing
12 changed files
with
349 additions
and
95 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
10 changes: 9 additions & 1 deletion
10
...-sdk-java/java-common/src/main/java/io/camunda/common/auth/DefaultNoopAuthentication.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
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
48 changes: 48 additions & 0 deletions
48
.../java/io/camunda/zeebe/spring/client/configuration/CamundaOperateClientConfiguration.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,48 @@ | ||
package io.camunda.zeebe.spring.client.configuration; | ||
|
||
import io.camunda.common.auth.Authentication; | ||
import io.camunda.operate.CamundaOperateClient; | ||
import io.camunda.operate.CamundaOperateClientBuilder; | ||
import io.camunda.zeebe.spring.client.configuration.condition.CamundaOperateClientCondition; | ||
import io.camunda.zeebe.spring.client.properties.CamundaOperateClientConfigurationProperties; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Conditional; | ||
|
||
import java.lang.invoke.MethodHandles; | ||
|
||
/** | ||
* This will be deprecated once we move to the new schema (i.e. not prefixing with camunda.*) | ||
*/ | ||
@Deprecated | ||
@Conditional(CamundaOperateClientCondition.class) | ||
@EnableConfigurationProperties(CamundaOperateClientConfigurationProperties.class) | ||
public class CamundaOperateClientConfiguration { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
|
||
@Autowired | ||
Authentication authentication; | ||
|
||
@Bean | ||
public CamundaOperateClient camundaOperateClient(CamundaOperateClientConfigurationProperties props) { | ||
LOG.warn("Using a deprecated operate properties"); | ||
CamundaOperateClient client; | ||
try { | ||
client = new CamundaOperateClientBuilder() | ||
.authentication(authentication) | ||
.operateUrl(props.getOperateUrl()) | ||
.setup() | ||
.build(); | ||
} catch (Exception e) { | ||
LOG.warn("An attempt to connect to Operate failed: " + e); | ||
throw new RuntimeException(e); | ||
} | ||
return client; | ||
} | ||
} | ||
|
||
|
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
24 changes: 24 additions & 0 deletions
24
...io/camunda/zeebe/spring/client/configuration/condition/CamundaOperateClientCondition.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 io.camunda.zeebe.spring.client.configuration.condition; | ||
|
||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
|
||
/** | ||
* This will be deprecated once we move to the new schema (i.e. not prefixing with camunda.*) | ||
*/ | ||
@Deprecated | ||
public class CamundaOperateClientCondition extends AnyNestedCondition { | ||
public CamundaOperateClientCondition() { | ||
super(ConfigurationPhase.PARSE_CONFIGURATION); | ||
} | ||
|
||
@ConditionalOnProperty(name = "camunda.operate.client.client-id") | ||
static class ClientIdCondition { | ||
|
||
} | ||
|
||
@ConditionalOnProperty(name = "camunda.operate.client.username") | ||
static class UsernameCondition { | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...n/java/io/camunda/zeebe/spring/client/configuration/condition/OperateClientCondition.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 io.camunda.zeebe.spring.client.configuration.condition; | ||
|
||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
|
||
public class OperateClientCondition extends AnyNestedCondition { | ||
public OperateClientCondition() { | ||
super(ConfigurationPhase.PARSE_CONFIGURATION); | ||
} | ||
|
||
@ConditionalOnProperty(name = "operate.client.client-id") | ||
static class ClientIdCondition { | ||
|
||
} | ||
|
||
@ConditionalOnProperty(name = "operate.client.username") | ||
static class UsernameCondition { | ||
|
||
} | ||
} |
Oops, something went wrong.