-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DROOLS-7066] Replacing FRI with LocalUri (#4635)
* [DROOLS-7090] Do not write IndexFile - bring it around with context. - Experimental draft - Basically focusing on OnTheFlyDrlTest test case - Unit tests in efesto and kie-drl passed (with some @disabled) - Not mind other integrations test errors at the moment * - Store GeneratedResources map in Context - RuntimeContext can get GeneratedResources from CompilationContext or scan IndexFile to populate GeneratedResources - Implement createIndexFiles in CompilationContext - Add kie-drl-tests-without-index-file for test cases without pre-existing IndexFile * [DROOLS-7066] Replacing FRI with LocalUri * [DROOLS-7090] Fix kie-maven-plugin/PMML * - Add getModelType() for CompilerService/RuntimeService so impl classes need to implement it - Context automatically detects IndexFile from classpath based on engine models in classpath - CompilationManager.processResource() return type is void - EfestoCompilationContextImpl.createIndexFiles merges the content if IndexFile already exists * [DROOLS-7066] Implementing/using ModelLocalUriID inside efesto * [DROOLS-7066] Implementing/using ModelLocalUriID inside kie-drl * [DROOLS-7066] WIP * [DROOLS-7090] Fixing PMML to work with in memory GeneratedResources * [DROOLS-7066] Fixing PMML tests/DMN integration * - Clean up legacy "getIndexFile" dependent codes * [DROOLS-7066] WIP * [DROOLS-7066] Merge DROOLS-7090 * - Version bump - Code smells * - add EfestoCompilationContext.createIndexFiles overwriting test * - test fix * [DROOLS-7090] Add KieRuntimeServiceDrlMapInput native reflection declaration needed by PMML -> DRL integration (#6) * [DROOLS-7066] Merging with DROOLS-7090 * [DROOLS-7066] Merging with main * [DROOLS-7066] Fix sonar code-smells * [DROOLS-7066] Fix as per PR request * [DROOLS-7066] Increase test code coverage * [DROOLS-7066] Fix merge conflict * [DROOLS-7066] Fix reported bugs * [DROOLS-7066] Fix code smells * [DROOLS-7066] Fix tests * [DROOLS-7066] Testing DMNKiePMMLTrustyInvocationEvaluator * [DROOLS-7066] Increase test code coverage * [DROOLS-7066] Declare DTOs inside reflective-config needed for native compilation/execution Co-authored-by: Toshiya Kobayashi <toshiyakobayashi@gmail.com>
- Loading branch information
Showing
149 changed files
with
3,304 additions
and
850 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
112 changes: 112 additions & 0 deletions
112
...festo-common-api/src/main/java/org/kie/efesto/common/api/identifiers/ModelLocalUriId.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,112 @@ | ||
/* | ||
* Copyright 2022 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.kie.efesto.common.api.identifiers; | ||
|
||
import java.io.Serializable; | ||
import java.net.URLDecoder; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Objects; | ||
import java.util.StringTokenizer; | ||
|
||
import static org.kie.efesto.common.api.identifiers.LocalUri.SLASH; | ||
|
||
public class ModelLocalUriId extends LocalUriId implements Serializable { | ||
|
||
private static final long serialVersionUID = 2473381132658366922L; | ||
private final String model; | ||
|
||
private final String basePath; | ||
|
||
private final String fullPath; | ||
|
||
|
||
public ModelLocalUriId(LocalUri path) { | ||
super(path); | ||
model = getModel(path); | ||
basePath = getBasePath(path, model); | ||
fullPath = path.path(); | ||
} | ||
|
||
public String model() { | ||
return model; | ||
} | ||
|
||
public String basePath() { | ||
return basePath; | ||
} | ||
|
||
public String fullPath() { | ||
return fullPath; | ||
} | ||
|
||
public ModelLocalUriId asModelLocalUriId() { | ||
return this.getClass().equals(ModelLocalUriId.class) ? this : new ModelLocalUriId(this.asLocalUri()); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null) { | ||
return false; | ||
} | ||
if (!(o instanceof ModelLocalUriId)) { | ||
return false; | ||
} | ||
ModelLocalUriId that = (ModelLocalUriId) o; | ||
return Objects.equals(model, that.model) && Objects.equals(basePath, that.basePath) && Objects.equals(fullPath, that.fullPath); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(model, basePath, fullPath); | ||
} | ||
static LocalUri.LocalUriPathComponent getFirstLocalUriPathComponent(LocalUri localUri) { | ||
if (localUri.parent() instanceof LocalUri.LocalUriPathComponent) { | ||
return getFirstLocalUriPathComponent(localUri.parent()); | ||
} else { | ||
return localUri instanceof LocalUri.LocalUriPathComponent ? (LocalUri.LocalUriPathComponent) localUri : null; | ||
} | ||
} | ||
|
||
static String getModel(LocalUri path) { | ||
LocalUri.LocalUriPathComponent firstLocalUriPathComponent = getFirstLocalUriPathComponent(path); | ||
return firstLocalUriPathComponent != null ? firstLocalUriPathComponent.component : null; | ||
} | ||
|
||
static String getBasePath(LocalUri path, String model) { | ||
String uriPath = path.path(); | ||
if (model == null || model.isEmpty()) { | ||
return uriPath; | ||
} else { | ||
String start = SLASH + model; | ||
return uriPath.substring(uriPath.indexOf(start) + start.length()); | ||
} | ||
} | ||
|
||
protected static LocalUri appendBasePath(LocalUri parent, String basePath) { | ||
StringTokenizer tok = new StringTokenizer(basePath, SLASH); | ||
while (tok.hasMoreTokens()) { | ||
parent = parent.append(decodeString(tok.nextToken())); | ||
} | ||
return parent; | ||
} | ||
|
||
private static String decodeString(String toDecode) { | ||
return URLDecoder.decode(toDecode, StandardCharsets.UTF_8); | ||
} | ||
} |
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
107 changes: 0 additions & 107 deletions
107
efesto/efesto-core/efesto-common-api/src/main/java/org/kie/efesto/common/api/model/FRI.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.