Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSubmodelElement Endpoints #93

Merged
merged 20 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2ee815b
first parts to implement file upload feature
M-Damm Aug 11, 2023
e5a5f9f
Add partial implementation of getFile for in-memory backend
zhangzai123 Sep 12, 2023
cbad8ea
Implements File support for Submodelrepository MongoDB
mdanish98 Sep 13, 2023
5f5f222
Add In-Memory backend und unit Test.
zhangzai123 Sep 22, 2023
371573f
Add new Exception for mqtt
zhangzai123 Sep 22, 2023
32d6eed
Fixes the File upload issue with HTTP
mdanish98 Sep 22, 2023
ab9280c
Add new Exception for mqtt
zhangzai123 Sep 22, 2023
d7992a8
Add http unit test for get- set- delete files
zhangzai123 Sep 22, 2023
85ca439
In SubmodelRepositoryApiHTTPController, Change Http status code to "p…
zhangzai123 Sep 25, 2023
206d04d
Merge branch 'file-upload-download' into HEAD
zhangzai123 Sep 25, 2023
240fa1a
move unit tests for file upload and download to SubmodelRepositorySub…
zhangzai123 Sep 25, 2023
c3aa7e1
Change expected value of the assertion for the setFileValue unit test.
zhangzai123 Sep 25, 2023
d8dac1d
Adjust assertion in unit test getDefaultSubmodelRepositoryName()
zhangzai123 Sep 26, 2023
37e2e75
Add new cosntructor in MongoDBSubmodelRepositoryFactory which uses th…
zhangzai123 Sep 28, 2023
4cc720b
Put the private mathod after the unit tests.
zhangzai123 Sep 29, 2023
073e938
Delete unnecessary exception throw
zhangzai123 Oct 6, 2023
008bffe
add @autowire=false to the constructor
zhangzai123 Oct 9, 2023
1bf4134
Handles correct closing of input streams
mdanish98 Oct 9, 2023
b6a21e2
Merge remote-tracking branch 'upstream/main'
mdanish98 Oct 9, 2023
fd010e0
Refactors code
mdanish98 Oct 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (C) 2023 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.core.exceptions;

/**
* Indicates that the requested submodel element is not a File SubmodelElement
*
* @author danish
*
*/
@SuppressWarnings("serial")
public class ElementNotAFileException extends RuntimeException {
public ElementNotAFileException() {
}

public ElementNotAFileException(String elementId) {
super(getMsg(elementId));
}

private static String getMsg(String elementId) {
return "SubmodelElement with Id " + elementId + " is not a File";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (C) 2023 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.core.exceptions;

/**
* This exception is used for features where certain functionalities are not implemented yet.
*
* @author zhangzai
*
*/
@SuppressWarnings("serial")
public class FeatureNotImplementedException extends RuntimeException {

public FeatureNotImplementedException() {
super();
}

public FeatureNotImplementedException(String featureName) {
super(getMessage(featureName));
}

private static String getMessage(String featureName) {
return "Feature " + featureName + " is not implemented yet";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2023 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.core.exceptions;

/**
* Indicates that the requested file does not exist
*
* @author danish
*
*/
@SuppressWarnings("serial")
public class FileDoesNotExistException extends RuntimeException {
public FileDoesNotExistException() {
}

public FileDoesNotExistException(String elementId) {
super(getMsg(elementId));
}

private static String getMsg(String elementId) {
return "Requested File inside File SubmodelElement with ID : " + elementId + " does not exist";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (C) 2023 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.core.exceptions;

/**
* Indicates that the provided file could not be handled
*
* @author zhangzai
*
*/
@SuppressWarnings("serial")
public class FileHandlingException extends RuntimeException {

public FileHandlingException() {
super();
}

public FileHandlingException(String fileName) {
super(getMessage(fileName));
}

private static String getMessage(String fileName) {
return "Exception occurred while handling the file: " + fileName;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How might the use of Apache Tika (Apache License 2.0) affect us here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also use tika in java 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FrankSchnicke Is this ok to use this dependency for handling file and directory?

<artifactId>tika-core</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question regarding also the licensing.

<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
</project>
Loading