Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 08bbab8

Browse files
committed
Merge branch dsc7upgrade in Main
1 parent 2b9b612 commit 08bbab8

File tree

989 files changed

+21765
-29254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

989 files changed

+21765
-29254
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ target/
33
!**/src/main/**
44
!**/src/test/**
55

6+
data/
67
/log/
78

89
### STS ###
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import java.util.Properties;
18+
19+
public class MavenWrapperDownloader {
20+
21+
private static final String WRAPPER_VERSION = "0.5.6";
22+
/**
23+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
24+
*/
25+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
26+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
27+
28+
/**
29+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
30+
* use instead of the default one.
31+
*/
32+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
33+
".mvn/wrapper/maven-wrapper.properties";
34+
35+
/**
36+
* Path where the maven-wrapper.jar will be saved to.
37+
*/
38+
private static final String MAVEN_WRAPPER_JAR_PATH =
39+
".mvn/wrapper/maven-wrapper.jar";
40+
41+
/**
42+
* Name of the property which should be used to override the default download url for the wrapper.
43+
*/
44+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
45+
46+
public static void main(String args[]) {
47+
System.out.println("- Downloader started");
48+
File baseDirectory = new File(args[0]);
49+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
50+
51+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
52+
// wrapperUrl parameter.
53+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
54+
String url = DEFAULT_DOWNLOAD_URL;
55+
if(mavenWrapperPropertyFile.exists()) {
56+
FileInputStream mavenWrapperPropertyFileInputStream = null;
57+
try {
58+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
59+
Properties mavenWrapperProperties = new Properties();
60+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
61+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
62+
} catch (IOException e) {
63+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
64+
} finally {
65+
try {
66+
if(mavenWrapperPropertyFileInputStream != null) {
67+
mavenWrapperPropertyFileInputStream.close();
68+
}
69+
} catch (IOException e) {
70+
// Ignore ...
71+
}
72+
}
73+
}
74+
System.out.println("- Downloading from: " + url);
75+
76+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
77+
if(!outputFile.getParentFile().exists()) {
78+
if(!outputFile.getParentFile().mkdirs()) {
79+
System.out.println(
80+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
81+
}
82+
}
83+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
84+
try {
85+
downloadFileFromURL(url, outputFile);
86+
System.out.println("Done");
87+
System.exit(0);
88+
} catch (Throwable e) {
89+
System.out.println("- Error downloading");
90+
e.printStackTrace();
91+
System.exit(1);
92+
}
93+
}
94+
95+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
96+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
97+
String username = System.getenv("MVNW_USERNAME");
98+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
99+
Authenticator.setDefault(new Authenticator() {
100+
@Override
101+
protected PasswordAuthentication getPasswordAuthentication() {
102+
return new PasswordAuthentication(username, password);
103+
}
104+
});
105+
}
106+
URL website = new URL(urlString);
107+
ReadableByteChannel rbc;
108+
rbc = Channels.newChannel(website.openStream());
109+
FileOutputStream fos = new FileOutputStream(destination);
110+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
111+
fos.close();
112+
rbc.close();
113+
}
114+
115+
}

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

DSC_ADAPTATION.md

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
# List of Changes/Extensions to DSC Code
2+
3+
Changes in DSC code are marked with the comment
4+
`/* AppStore Extension */`
5+
6+
## io.dsc.controller.MainController
7+
8+
needs to be deleted, replace by MainController in de.fraunhofer.fit.appstore
9+
10+
Test io.dataspaceconnector.controller.resource.view.ViewEqualsTest refers to MainController, needs also to be deleted
11+
12+
## io.dsc.common.ids.mapping.RdfConverter
13+
14+
* Added 3 implementations of toRdf method:
15+
* for AppStore
16+
* for DataApp
17+
* for Endpoint
18+
TODO: check whether toRdf(BaseConnector) needs to be deleted
19+
20+
TODO: can we move additional methods to separate class?
21+
22+
## io.dsc.common.ids.mapping.ToIdsObjectMapper
23+
24+
* Added 3 methods
25+
--Ahmad yes, used in different locations
26+
* getAppEndpointType (currently not used, do we need it? Mapping of EndpointType to AppEndpointType not easy, why do we need it?)
27+
* getUsagePolicyClass
28+
* getListOfUsagePolicyClasses
29+
30+
TODO: can we move additional methods to separate class? --> should be possible, but requires change in caller's code
31+
32+
TODO: requires also change of io.dsc.model.endpoint.EndpointType, which side effects?
33+
==============================================
34+
35+
## io.dsc.common.ids.ConnectorService
36+
37+
* Added 2 methods
38+
* getAppStoreWithAppResources
39+
* getAppStoreWithoutResources
40+
* Changed method updateConfigModel
41+
* replace line:
42+
```
43+
final var connector = getConnectorWithOfferedResources();
44+
```
45+
with
46+
```
47+
final var connector = getAppStoreWithAppResources();
48+
```
49+
50+
TODO: can we move additional methods to separate class? --> should be possible, but requires change in caller's code
51+
52+
TODO: do we need to delete getConnectorWithOfferedResources and getConnectorWithoutResource?
53+
54+
## io.dsc.common.net.SelfLinkHelper
55+
TODO: probably needs adaptation for App, Endpoint, GenericEndpoint, ConnectorEndpoint, Route
56+
57+
58+
## io.dsc.controller.resource.relation
59+
60+
Added Classes:
61+
* AppsToRepresentationsController
62+
* RepresentationsToAppsController
63+
--Ahmad yes that is needed and also we link them using the python script
64+
TODO: really required?
65+
66+
## io.dsc.controller.resource.view.representation.RepresentationView
67+
68+
Added two members:
69+
* private String runtimeEnvironment
70+
* private URI distributionService
71+
72+
73+
## io.dsc.controller.resource.view.representation.RepresentationViewAssembler
74+
75+
Added at the end of toModel():
76+
```
77+
final var appLink = linkTo(methodOn(RepresentationsToAppsController.class)
78+
.getResource(representation.getId(), null, null))
79+
.withRel(BaseType.APPS);
80+
view.add(appLink);
81+
```
82+
83+
## io.dsc.model.resource.Resource
84+
Add annotation `@Indexed` to enable Hibernate Full Text Search
85+
86+
--Ahmad Maybe we need to do the above for the io.dsc.model.resource.offeredResource
87+
88+
89+
## io.dsc.model.app.App
90+
91+
Added property `representations`
92+
93+
Add annotation `@Indexed` to enable Hibernate Full Text Search
94+
95+
Added properties for SecurityScan and Registry
96+
97+
## io.dsc.model.app.AppDesc
98+
99+
similar as before
100+
101+
## io.dsc.model.endpoint
102+
--Ahmed TOCheck
103+
Do we need to add mediaType, port, protocol, type?
104+
If yes, then Endpoint, EndpointDesc, EndpointFactory have to be updated.
105+
106+
## io.dataspaceconnector.model.representation.Representation
107+
108+
Added properties:
109+
* runtimeEnvironment
110+
* distributionService
111+
* dataApps
112+
113+
## io.dataspaceconnector.model.representation.RepresentationDesc
114+
115+
Added properties:
116+
* runtimeEnvironment
117+
* distributionService
118+
119+
## io.dataspaceconnector.model.representation.RepresentationFactory
120+
121+
Added two members:
122+
* DEFAULT_ENVIRONMENT="docker"
123+
* defaultDistributionService
124+
125+
Added to initializeEntity before return:
126+
* `representation.setDataApps(new ArrayList<>());`
127+
128+
Added/modified in updateInternal:
129+
```
130+
final var hasUpdatedRuntimeEnvironment = this.updateRuntimeEnvironment(representation,
131+
desc.getRuntimeEnvironment());
132+
final var hasUpdatedDistributionService = this.updateDistributionService(representation,
133+
desc.getDistributionService());
134+
135+
return hasUpdatedRemoteId || hasUpdatedLanguage || hasUpdatedMediaType
136+
|| hasUpdatedStandard || hasUpdatedRuntimeEnvironment
137+
|| hasUpdatedDistributionService;
138+
```
139+
140+
Added methods:
141+
* updateRuntimeEnvironment
142+
* updateDistributionService
143+
144+
145+
## io.dsc.service.message.builder.ConnectorUnavailableMessageBuilder
146+
147+
In method processInternal, replace
148+
```
149+
final var connector = connectorService.getConnectorWithoutResources();
150+
```
151+
with
152+
```
153+
final var connector = connectorService.getAppStoreWithoutResources();
154+
```
155+
156+
## io.dsc.service.message.builder.ConnectorUpdateMessageBuilder
157+
158+
Same as before
159+
160+
## io.dsc.service.message.builder.QueryMessageBuilder
161+
162+
Same as before
163+
164+
TOOD: Do we need to do same somewhere else (in this package)?
165+
166+
## io.dsc.service.message.handler.processor.SelfDescriptionProcessor
167+
168+
Similar as before, but now **with** resources, i.e., replace
169+
```
170+
final var connector = connectorService.getConnectorWithOfferedResources();
171+
```
172+
with
173+
```
174+
final var connector = connectorService.getAppStoreWithAppResources();
175+
```
176+
177+
## io.dsc.service.message.handler.processor.DataRequestProcessor
178+
179+
Added code in processInternal to contact RegistryService
180+
181+
## io.dsc.service.resource.ids.builder.IdsCatalogBuilder
182+
183+
```
184+
final var resources = create(resourceBuilder,
185+
catalog.getOfferedResources(), currentDepth, maxDepth);
186+
```
187+
188+
```
189+
final var appResources = create(resourceBuilder,
190+
catalog.getOfferedResources(), currentDepth, maxDepth);
191+
192+
Optional<List<OfferedResource>> resources = Optional.empty();
193+
if (appResources.isPresent()) {
194+
resources = Optional.of(List.copyOf(appResources.get()));
195+
}
196+
```
197+
198+
## io.dsc.service.resource.relation.RepresentationAppLinker
199+
200+
Added class
201+
202+
# TODO
203+
## io.dsc.service.resource.ids.builder.IdsEndpointBuilder
204+
205+
TODO: Probably needs also updates...
206+
207+
## io.dsc.service.resource.ids.builder.IdsRepresentationBuilder
208+
209+
## io.dsc.service.resource.ids.builder.IdsResourceBuilder
210+
211+
## io.dsc.service.resource.type.EndpointService
212+
213+
## io.dsc.service.EntityResolver
214+
215+
216+
## io.dsc.ConnectorApplication
217+
218+
Add `"de.fraunhofer.fit.appstore.*"` to ComponentScan
219+
220+
##Ahmad changes
221+
(1)
222+
comment parts to allow post /api/apps
223+
io.dataspaceconnector.controller.resource.type.AppController
224+
225+
(2)
226+
io.dataspaceconnector.controller.resource.relation.AppsToEndpointsController
227+
Change BaseResourceChildRestrictedController to BaseResourceChildController to allow link the apps with endpoints
228+
229+
(3)
230+
comment parts to allow post /api/apps
231+
io.dataspaceconnector.controller.resource.type.EndpointController
232+
233+
(4)
234+
add some lines to find a solution when download an app and the endpoint language is Null
235+
the lines are titled with the comment "TOTest a solution for endpoint language =Null"
236+
237+
## io.dataspaceconnector.model.endpoint.EndpointFactory
238+
Added:
239+
public static final String DEFAULT_LANGUAGE = "EN";
240+
241+
and
242+
protected final boolean updateLanguage(final Endpoint endpoint, final String language) {
243+
final var newLanguage =
244+
FactoryUtils.updateString(endpoint.getLanguage(), language, DEFAULT_LANGUAGE);
245+
newLanguage.ifPresent(endpoint::setLanguage);
246+
return newLanguage.isPresent();
247+
}
248+
249+
250+
## io.dataspaceconnector.model.app.AppFactory
251+
252+
Added:
253+
app.setRepresentations(new ArrayList<>());
254+
255+
## io.dataspaceconnector.model.endpoint.Endpoint
256+
Added:
257+
private String language;
258+
259+
260+
261+
(5)
262+
Update the python script to work with the new appstore version
263+
api/resources to api/offers also adding new properties of api/apps
264+
the current python is found under scripts/tests/
265+
266+
TODO:
267+
#de.fraunhofer.fit.appstore.controller.ui.UiController
268+
# to replace component scan the assigned URLs of the VM servers.

0 commit comments

Comments
 (0)