Skip to content

Commit 1054237

Browse files
beckermarcsmahati
andauthored
Improvements of CAP Java 3.0 migration guide (#1119)
* Minor improvements of CAP Java 3.0 migration guide * Fix property names * Improve POJO generation examples * Make tables smaller * Update java/migration.md --------- Co-authored-by: Mahati Shankar <[email protected]>
1 parent e240d12 commit 1054237

File tree

1 file changed

+103
-53
lines changed

1 file changed

+103
-53
lines changed

java/migration.md

Lines changed: 103 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ CAP Java 3.0 increased some minimum required versions:
3131

3232
| Dependency | Minimum Version |
3333
| --- | --- |
34+
| Cloud SDK | 5.9.0 |
3435
| @sap/cds-dk | ^7 |
3536
| Maven | 3.6.3 |
36-
| Cloud SDK | 5.9.0 |
3737

3838
CAP Java 3.0 no longer supports @sap/cds-dk ^6.
3939

@@ -46,6 +46,19 @@ If you are using the root path `/` for a readiness or liveness probe in Kyma you
4646

4747
[Learn more about the Production Profile.](developing-applications/configuring#production-profile){.learn-more}
4848

49+
### Removed MTX Classic Support
50+
51+
Support for classic MTX (@sap/cds-mtx) has been removed. Using streamlined MTX (@sap/cds-mtxs) is mandatory for multitenancy.
52+
If you're still using MTX Classic refer to the [multitenancy migration guide](../guides/multitenancy/old-mtx-migration).
53+
54+
In addition, the deprecated `MtSubscriptionService` API, has been removed. It has now been superseeded by the `DeploymentService` API.
55+
As part of this change the compatibility mode for the `MtSubscriptionService` API has been removed. Besides the removal of the Java APIs this includes the following behavioural changes:
56+
57+
- During unsubscribe, the tenant's content (like HDI container) is now deleted by default when using the new `DeploymentService` API.
58+
- The HTTP-based tenant upgrade APIs provided by the CAP Java app have been removed, use the [`Deploy` main method](/java/multitenancy#deploy-main-method) instead. This includes the following endpoints:
59+
- `/mt/v1.0/subscriptions/deploy/**` (GET & POST)
60+
- `/messaging/v1.0/em/<tenant>` (PUT)
61+
4962
### Removed feature `cds-feature-xsuaa`
5063

5164
The feature `cds-feature-xsuaa` has been removed. Support for XSUAA and IAS has been unified under the umbrella of `cds-feature-identity`.
@@ -59,18 +72,13 @@ If you have customized the security configuration, you need to adapt it to the n
5972
[Learn more about the security configuration.](./security#xsuaa-ias){.learn-more}
6073
[Learn more about migration to SAP´s `spring-security` library.](https://github.com/SAP/cloud-security-services-integration-library/blob/main/spring-security/Migration_SpringXsuaaProjects.md)
6174

62-
### Removed MTX Classic Support
75+
### Proof-Of-Possession enforced for IAS-based authentication
6376

64-
Support for classic MTX (@sap/cds-mtx) has been removed. Using streamlined MTX (@sap/cds-mtxs) is mandatory for multitenancy.
65-
If you're still using MTX Classic refer to the [multitenancy migration guide](../guides/multitenancy/old-mtx-migration).
77+
In IAS scenarios, the [Proof-Of-Possession](https://github.com/SAP/cloud-security-services-integration-library/tree/main/java-security#proofofpossession-validation) is now enforced by default for incoming requests for versions starting from `3.5.1` of the [SAP BTP Spring Security Client](https://github.com/SAP/cloud-security-services-integration-library/tree/main/spring-security).
6678

67-
In addition, the deprecated `MtSubscriptionService` API, has been removed. It has now been superseeded by the `DeploymentService` API.
68-
As part of this change the compatibility mode for the `MtSubscriptionService` API has been removed. Besides the removal of the Java APIs this includes the following behavioural changes:
79+
Because of this, applications calling a CAP Java application will need to send a valid client certificate in addition to the JWT token. In particular, applications using an Approuter have to set `forwardAuthCertificates: true` on the Approuter destination pointing to your CAP backend.
6980

70-
- During unsubscribe, the tenant's content (like HDI container) is now deleted by default when using the new `DeploymentService` API.
71-
- The HTTP-based tenant upgrade APIs provided by the CAP Java app have been removed. This includes the following endpoints:
72-
- `/mt/v1.0/subscriptions/deploy/**` (GET & POST)
73-
- `/messaging/v1.0/em/<tenant>` (PUT)
81+
[Learn more about Proof-Of-Possession.](./security.md#proof-of-possession){.learn-more}
7482

7583
### Lazy Localization by default
7684

@@ -100,10 +108,60 @@ Some parameter defaults of the goal `generate` have been adjusted:
100108
| Parameter | Old Value | New Value | Explanation |
101109
| --- | --- | --- | --- |
102110
| `sharedInterfaces` | `false` | `true` | Interfaces for global arrayed types with inline anonymous type are now generated exactly once. `sharedInterfaces` ensures such types are not generated as inline interfaces again, if used in events, actions or functions. |
103-
| `uniqueEventContexts` | `false` | `true` | Determines whether the event context interfaces should be unique for bound actions and functions. |
111+
| `uniqueEventContexts` | `false` | `true` | Determines whether the event context interfaces should be unique for bound actions and functions, by prefixing the interfaces with the entity name. |
104112

105113
Both these changes result in the generation of incompatible POJOs. To get the former POJOs, the new defaults can be overwritten by setting the parameters to the old values.
106114

115+
Consider the following example:
116+
117+
```cds
118+
service MyService {
119+
entity MyEntity {
120+
key ID: UUID
121+
} actions {
122+
// bound action
123+
action doSomething(values: MyArray);
124+
}
125+
}
126+
127+
// global arrayed type
128+
type MyArray: many {
129+
value: String;
130+
}
131+
```
132+
133+
With the new defaults the generated interface for the `doSomething` action looks like this:
134+
135+
```java
136+
// uniqueEventContexts: true =>
137+
// interface is prefixed with entity name "MyEntity"
138+
public interface MyEntityDoSomethingContext extends EventContext {
139+
140+
// sharedInterfaces: true => global MyArray type is used
141+
Collection<MyArray.Item> getValues();
142+
void setValues(Collection<MyArray.Item> values);
143+
144+
}
145+
```
146+
147+
Formerly the generated interface looked like this:
148+
149+
```java
150+
// uniqueEventContexts: false =>
151+
// interface is not prefixed with entity name
152+
public interface DoSomethingContext extends EventContext {
153+
154+
// sharedInterfaces: false => global MyArray type is not used,
155+
// instead an additional interface Values is generated inline
156+
Collection<Values> getValues();
157+
void setValues(Collection<Values> values);
158+
159+
interface Values extends CdsData {
160+
// ...
161+
}
162+
}
163+
```
164+
107165
### Adjusted Property Defaults
108166

109167
Some property defaults have been adjusted:
@@ -113,7 +171,7 @@ Some property defaults have been adjusted:
113171
| `cds.remote.services.<key>.http.csrf.enabled` | `true` | `false` | Most APIs don't require CSRF tokens. |
114172
| `cds.sql.hana.optimizationMode` | `legacy` | `hex` | SQL for SAP HANA is optimized for the HEX engine. |
115173
| `cds.odataV4.lazyI18n.enabled` | `null` | `true` | Lazy localization is now enabled by default in multitenant scenarios. |
116-
| `cds.auditLog.personalData.throwOnMissingDataSubject` | `false` | `true` | Raise errors for incomplete personal data annotations by default. |
174+
| `cds.auditLog.personalData.`<br>`throwOnMissingDataSubject` | `false` | `true` | Raise errors for incomplete personal data annotations by default. |
117175
| `cds.messaging.services.<key>.structured` | `false` | `true` | [Enhanced message representation](./messaging.md#enhanced-messages-representation) is now enabled by default. |
118176

119177
### Adjusted Property Behavior
@@ -122,6 +180,38 @@ Some property defaults have been adjusted:
122180
| --- | --- |
123181
| `cds.outbox.persistent.enabled` | When set to `false`, all persistent outboxes are disabled regardless of their specific configuration. |
124182

183+
### Removed Properties
184+
185+
The following table gives an overview about the removed properties:
186+
187+
| Removed Property | Replacement / Explanation |
188+
| --- | --- |
189+
| `cds.auditlog.outbox.persistent.enabled` | `cds.auditlog.outbox.name` |
190+
| `cds.dataSource.csvFileSuffix` | `cds.dataSource.csv.fileSuffix` |
191+
| `cds.dataSource.csvInitializationMode` | `cds.dataSource.csv.initializationMode` |
192+
| `cds.dataSource.csvPaths` | `cds.dataSource.csv.paths` |
193+
| `cds.dataSource.csvSingleChangeset` | `cds.dataSource.csv.singleChangeset` |
194+
| `cds.security.identity.authConfig.enabled` | `cds.security.authentication.`<br>`authConfig.enabled` |
195+
| `cds.security.xsuaa.authConfig.enabled` | `cds.security.authentication.`<br>`authConfig.enabled` |
196+
| `cds.security.mock.users.<key>.unrestricted` | Special handling of unrestricted attributes has been removed, in favor of [explicit modelling](../guides/security/authorization#unrestricted-xsuaa-attributes). |
197+
| `cds.messaging.services.<key>.outbox.persistent.enabled` | `cds.messaging.services.<key>.outbox.name` |
198+
| `cds.multiTenancy.compatibility.enabled` | MtSubscriptionService API [has been removed](#removed-mtx-classic-support) and compatibility mode is no longer available. |
199+
| `cds.multiTenancy.healthCheck.intervalMillis` | `cds.multiTenancy.healthCheck.interval` |
200+
| `cds.multiTenancy.mtxs.enabled` | MTXS is enabled [by default](#removed-mtx-classic-support). |
201+
| `cds.multiTenancy.security.deploymentScope` | HTTP-based tenant upgrade endpoints [have been removed](#removed-mtx-classic-support). |
202+
| `cds.odataV4.apply.inCqn.enabled` | `cds.odataV4.apply.transformations.enabled` |
203+
| `cds.odataV4.serializer.enabled` | The legacy serializer has been removed. |
204+
| `cds.outbox.persistent.maxAttempts` | `cds.outbox.services.<key>.maxAttempts` |
205+
| `cds.outbox.persistent.storeLastError` | `cds.outbox.services.<key>.storeLastError` |
206+
| `cds.outbox.persistent.ordered` | `cds.outbox.services.<key>.ordered` |
207+
| `cds.remote.services.<key>.destination.headers` | `cds.remote.services.<key>.http.headers` |
208+
| `cds.remote.services.<key>.destination.queries` | `cds.remote.services.<key>.http.queries` |
209+
| `cds.remote.services.<key>.destination.service` | `cds.remote.services.<key>.http.service` |
210+
| `cds.remote.services.<key>.destination.suffix` | `cds.remote.services.<key>.http.suffix` |
211+
| `cds.remote.services.<key>.destination.type` | `cds.remote.services.<key>.type` |
212+
| `cds.sql.search.useLocalizedView` | `cds.sql.search.model` |
213+
| `cds.sql.supportedLocales` | All locales are supported by default for localized entities, as session variables can now be leveraged on all databases. |
214+
125215
### Deprecated Session Context Variables
126216

127217
| Old Variable | Replacement |
@@ -130,38 +220,6 @@ Some property defaults have been adjusted:
130220
| `$at.from` | `$valid.from` |
131221
| `$at.to` | `$valid.to` |
132222

133-
### Removed Properties
134-
135-
The following table gives an overview about the removed properties:
136-
137-
| Removed Property | Replacement | Explanation |
138-
| --- | --- | --- |
139-
| `cds.auditlog.outbox.persistent.enabled` | `cds.auditlog.outbox.name` | |
140-
| `cds.dataSource.csvFileSuffix` | `cds.dataSource.csv.fileSuffix` | |
141-
| `cds.dataSource.csvInitializationMode` | `cds.dataSource.csv.initializationMode` | |
142-
| `cds.dataSource.csvPaths` | `cds.dataSource.csv.paths` | |
143-
| `cds.dataSource.csvSingleChangeset` | `cds.dataSource.csv.singleChangeset` | |
144-
| `cds.identity.authConfig.enabled` | `cds.security.authentication.authConfig.enabled` | |
145-
| `cds.messaging.services.<key>.outbox.persistent.enabled` | `cds.messaging.services.<key>.outbox.name` | |
146-
| `cds.multiTenancy.compatibility.enabled` | | MtSubscriptionService API [has been removed](#removed-mtx-classic-support) and compatibility mode is no longer available. |
147-
| `cds.multiTenancy.healthCheck.intervalMillis` | `cds.multiTenancy.healthCheck.interval` | |
148-
| `cds.multiTenancy.mtxs.enabled` | | MTXS is enabled [by default](#removed-mtx-classic-support). |
149-
| `cds.multiTenancy.security.deploymentScope` | | HTTP-based tenant upgrade endpoints [have been removed](#removed-mtx-classic-support). |
150-
| `cds.odataV4.apply.inCqn.enabled` | `cds.odataV4.apply.transformations.enabled` | |
151-
| `cds.odataV4.serializer.enabled` | | The legacy serializer has been removed. |
152-
| `cds.outbox.persistent.maxAttempts` | `cds.outbox.services.<key>.maxAttempts` | |
153-
| `cds.outbox.persistent.storeLastError` | `cds.outbox.services.<key>.storeLastError` | |
154-
| `cds.outbox.persistent.ordered` | `cds.outbox.services.<key>.ordered` | |
155-
| `cds.remote.<key>.destination.headers` | `cds.remote.services.<key>.http.headers` | |
156-
| `cds.remote.<key>.destination.queries` | `cds.remote.services.<key>.http.queries` | |
157-
| `cds.remote.<key>.destination.service` | `cds.remote.services.<key>.http.service` | |
158-
| `cds.remote.<key>.destination.suffix` | `cds.remote.services.<key>.http.suffix` | |
159-
| `cds.remote.<key>.destination.type` | `cds.remote.services.<key>.type` | |
160-
| `cds.security.mock.users.<key>.unrestricted` | | Special handling of unrestricted attributes has been removed, in favor of [explicit modelling](../guides/security/authorization#unrestricted-xsuaa-attributes). |
161-
| `cds.sql.search.useLocalizedView` | `cds.sql.search.model` | |
162-
| `cds.sql.supportedLocales` | | All locales are supported by default for localized entities, as session variables can now be leveraged on all databases. |
163-
| `cds.xsuaa.authConfig.enabled` | `cds.security.authentication.authConfig.enabled` | |
164-
165223
### Removed Java APIs
166224

167225
- Removed deprecated classes:
@@ -197,17 +255,9 @@ The following table gives an overview about the removed properties:
197255

198256
The goal `addSample` from the `cds-maven-plugin` has been removed. Use the new goal `add` with the property `-Dfeature=TINY_SAMPLE` instead.
199257

200-
### Proof-Of-Possession enforced for IAS-based authentication
201-
202-
In IAS scenarios, the [Proof-Of-Possession](https://github.com/SAP/cloud-security-services-integration-library/tree/main/java-security#proofofpossession-validation) is now enforced by default for incoming requests for versions starting from `3.5.1` of the [SAP BTP Spring Security Client](https://github.com/SAP/cloud-security-services-integration-library/tree/main/spring-security).
203-
204-
Because of this, applications calling a CAP Java application will need to send a valid client certificate in addition to the JWT token. In particular, applications using an Approuter have to set `forwardAuthCertificates: true` on the Approuter destination pointing to your CAP backend.
205-
206-
[Learn more about Proof-Of-Possession.](./security.md#proof-of-possession){.learn-more}
207-
208258
## Cloud SDK 4 to 5 { #cloudsdk5 }
209259

210-
CAP Java `2.6.0` and higher is compatible with Cloud SDK in version 4 and 5. For reasons of backward compatibility, CAP Java assumes Cloud SDK 4 as the default. However, we highly recommend that you use at least version `5.7.0` of Cloud SDK. If you relied on the Cloud SDK integration package (`cds-integration-cloud-sdk`), you won't need to adapt any code to upgrade your CAP Java application to Cloud SDK 5. In these cases, it's sufficient to add the following maven dependency to your CAP Java application:
260+
CAP Java `2.6.0` and higher is compatible with Cloud SDK in version 4 and 5. For reasons of backward compatibility, CAP Java assumes Cloud SDK 4 as the default. However, we highly recommend that you use at least version `5.9.0` of Cloud SDK. If you relied on the Cloud SDK integration package (`cds-integration-cloud-sdk`), you won't need to adapt any code to upgrade your CAP Java application to Cloud SDK 5. In these cases, it's sufficient to add the following maven dependency to your CAP Java application:
211261

212262
```xml
213263
<dependency>

0 commit comments

Comments
 (0)