Skip to content

Commit 49bdf13

Browse files
Add topLevel validation for @MCElement annotations and update license headers. (#2491)
1 parent a42af59 commit 49bdf13

12 files changed

Lines changed: 118 additions & 3 deletions

File tree

annot/src/main/java/com/predic8/membrane/annot/SpringConfigurationXSDGeneratingAnnotationProcessor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
215215

216216
scan(main, ii);
217217

218+
if (ii.getAnnotation().component() && ii.getAnnotation().topLevel())
219+
throw new ProcessingException("@MCElement(topLevel=true) cannot be a component.", ii.getElement());
220+
218221
if (ii.getAnnotation().component())
219222
main.getComponents().put(ii.getAnnotation().name(), ii);
220223

annot/src/main/java/com/predic8/membrane/annot/generator/ComponentClassGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected String getClassImpl() {
3636
3737
import java.util.Map;
3838
39-
@MCElement(name = "components", topLevel = true)
39+
@MCElement(name = "components", topLevel = true, component=false)
4040
public class Components {
4141
4242
Map<String, Object> components;

annot/src/main/java/com/predic8/membrane/annot/generator/kubernetes/Grammar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private String assembleElementMapping(MainInfo main) {
146146
return concat(
147147
// global
148148
main.getIis().stream()
149-
.filter(ei -> ei.getAnnotation().component())
149+
.filter(ei -> ei.getAnnotation().component() || ei.getAnnotation().topLevel())
150150
.map(generateElementMappingString()),
151151
// non-global
152152
main.getIis().stream()

core/src/main/java/com/predic8/membrane/core/ExitException.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core;
216

317
/**

core/src/main/java/com/predic8/membrane/core/interceptor/lang/SetBodyInterceptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.lang;
216

317
import com.predic8.membrane.annot.*;

core/src/main/java/com/predic8/membrane/core/lang/spel/DollarTemplateParserContext.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.lang.spel;
216

317
import org.springframework.expression.common.*;

core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/APIProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* @description The api proxy extends the serviceProxy with API related functions like OpenAPI support and path parameters.
4545
* @topic 1. Proxies and Flow
4646
*/
47-
@MCElement(name = "api", topLevel = true)
47+
@MCElement(name = "api", topLevel = true, component = false)
4848
public class APIProxy extends ServiceProxy implements Polyglot, XMLSupport {
4949

5050
private static final Logger log = LoggerFactory.getLogger(APIProxy.class.getName());

core/src/main/java/com/predic8/membrane/core/router/hotdeploy/DefaultHotDeployer.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.router.hotdeploy;
216

317
import com.predic8.membrane.core.*;

core/src/main/java/com/predic8/membrane/core/router/hotdeploy/HotDeployer.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.router.hotdeploy;
216

317
import com.predic8.membrane.core.*;

core/src/main/java/com/predic8/membrane/core/router/hotdeploy/NullHotDeployer.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2025 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.router.hotdeploy;
216

317
public class NullHotDeployer implements HotDeployer {

0 commit comments

Comments
 (0)