-
Notifications
You must be signed in to change notification settings - Fork 48
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
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 e5a5f9f
Add partial implementation of getFile for in-memory backend
zhangzai123 cbad8ea
Implements File support for Submodelrepository MongoDB
mdanish98 5f5f222
Add In-Memory backend und unit Test.
zhangzai123 371573f
Add new Exception for mqtt
zhangzai123 32d6eed
Fixes the File upload issue with HTTP
mdanish98 ab9280c
Add new Exception for mqtt
zhangzai123 d7992a8
Add http unit test for get- set- delete files
zhangzai123 85ca439
In SubmodelRepositoryApiHTTPController, Change Http status code to "p…
zhangzai123 206d04d
Merge branch 'file-upload-download' into HEAD
zhangzai123 240fa1a
move unit tests for file upload and download to SubmodelRepositorySub…
zhangzai123 c3aa7e1
Change expected value of the assertion for the setFileValue unit test.
zhangzai123 d8dac1d
Adjust assertion in unit test getDefaultSubmodelRepositoryName()
zhangzai123 37e2e75
Add new cosntructor in MongoDBSubmodelRepositoryFactory which uses th…
zhangzai123 4cc720b
Put the private mathod after the unit tests.
zhangzai123 073e938
Delete unnecessary exception throw
zhangzai123 008bffe
add @autowire=false to the constructor
zhangzai123 1bf4134
Handles correct closing of input streams
mdanish98 b6a21e2
Merge remote-tracking branch 'upstream/main'
mdanish98 fd010e0
Refactors code
mdanish98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...src/main/java/org/eclipse/digitaltwin/basyx/core/exceptions/ElementNotAFileException.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,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"; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...in/java/org/eclipse/digitaltwin/basyx/core/exceptions/FeatureNotImplementedException.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,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"; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...rc/main/java/org/eclipse/digitaltwin/basyx/core/exceptions/FileDoesNotExistException.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,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"; | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
...re/src/main/java/org/eclipse/digitaltwin/basyx/core/exceptions/FileHandlingException.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,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; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -45,5 +45,13 @@ | |
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tika</groupId> | ||
<artifactId>tika-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?