Skip to content

Commit 9cea72f

Browse files
committed
Version v0.1.1 updates
1 parent 0f0cba8 commit 9cea72f

File tree

17 files changed

+348
-48
lines changed

17 files changed

+348
-48
lines changed

.github/workflows/pages.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Generate Documentation and Publish to Pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
pages:
8+
name: Generate Documentation and Publish to Pages
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out repository
12+
uses: actions/checkout@v2
13+
- uses: actions/setup-python@v3
14+
with:
15+
python-version: '3.9'
16+
- name: Install Sphinx Python Dependencies
17+
run: pip install -r requirements.txt
18+
working-directory: Documentation
19+
- name: Build Documentation
20+
run: make html
21+
working-directory: Documentation
22+
- name: Deploy Documentation to Pages
23+
uses: peaceiris/actions-gh-pages@v3
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./Documentation/_build/html

Documentation/Deployment.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# MATLAB Compiler (SDK) Deployment
2+
3+
When compiling MATLAB™ code, in general, [MATLAB Compiler™](https://www.mathworks.com/products/compiler.html) will do a dependency analysis of the code and automatically include all the necessary files. However in the case of this package, because Java components are used [which need to be loaded on the static Java class path](Installation.md#configuring-the-matlab-java-class-path), additional steps are required.
4+
5+
Three options are discussed below for making the correct JAR-files available to the deployed component.
6+
7+
* The [first option](#option-one-compile-the-jar-file-into-the-standalone-component) is the easiest but will add the JAR-file to the *end* of the static class path; see the [installation documentation](Installation.md#configuring-the-matlab-java-class-path) to learn more about what limitations this may introduce depending on the platform.
8+
9+
* The [second option](#option-two-modified-javaclasspathtxt-and-distribute-jar-file-next-to-component) can add the JAR-file to the *front* of the static Java class path but is more involved.
10+
11+
* The [last option](#option-three-make-jar-file-available-in-matlab-runtime) adds the JAR-file to the MATLAB Runtime installation rather than include it with the component, making it available to all standalone components using that MATLAB Runtime installation.
12+
13+
```{hint}
14+
Contact us at [[email protected]](mailto:[email protected]) if you require additional advice on your specific use-case of deploying MATLAB Code which makes use of the "MATLAB Interface *for Azure Services*".
15+
```
16+
17+
## Option One: Compile the JAR-file *into* the standalone component
18+
19+
Any JAR-file which is compiled into a MATLAB Compiler (SDK) standalone component will automatically be added to the Java static<sup>[1](#option-three-make-jar-file-available-in-matlab-runtime)</sup> class path at runtime of the component. This will add the JAR-file to the *end* of the Java class path though, which on Windows should not be a problem but may introduce [limitations on Linux](Installation.md#configuring-the-matlab-java-class-path).
20+
21+
To compile the JAR-files into the component, in the Application- or Library Compiler App under "Files required for your application to run" (or when working with `mcc`, using the `-a` argument), explicitly add the following files to the component, they will not be added by automatic dependency analysis:
22+
23+
- `matlab-azure-services/Software/MATLAB/lib/jar/azure-common-sdk-0.2.0.jar`
24+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j.properties`
25+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j2.xml`
26+
- `$MATLABROOT/java/jarext/slf4j/slf4j-api.jar`
27+
- `$MATLABROOT/java/jarext/slf4j/slf4j-log4j12.jar`
28+
29+
Where `$MATLABROOT` stands for the MATLAB installation directory as returned by running the `matlabroot` function in the MATLAB Command Window.
30+
31+
## Option Two: Modified `javaclasspath.txt` and distribute JAR-file *next to* component
32+
33+
During the [installation](Installation.md) of the package, a [`javaclasspath.txt` will have been created](Installation.md#configuring-the-matlab-java-class-path) in the MATLAB preferences directory, with the following content:
34+
35+
```xml
36+
<before>
37+
/myfiles/matlab-azure-services/Software/MATLAB/lib/jar/azure-common-sdk-0.2.0.jar
38+
```
39+
40+
This `javaclasspath.txt` from the preferences directory *can* be included in MATLAB Compiler (SDK) standalone components and *will* then actually be used at runtime of the component. The problem however is that this typically refers to an absolute path which exists on the development machine but which will likely *not* exist on target machines to which the standalone component is deployed.
41+
42+
However, the `javaclasspath.txt` file can be updated to the following before compiling the standalone component:
43+
44+
```{code-block} xml
45+
---
46+
emphasize-lines: 3
47+
---
48+
<before>
49+
/myfiles/matlab-azure-services/Software/MATLAB/lib/jar/azure-common-sdk-0.2.0.jar
50+
./azure-common-sdk-0.2.0.jar
51+
```
52+
53+
Where the line which added at the bottom basically says: load `azure-common-sdk-0.2.0.jar` from `./` which stands for "the current directory".
54+
55+
Now when compiling a standalone component with this updated `javaclasspath.txt`, that component can load the JAR-file from either the specified absolute location *or* "the current directory at runtime of the standalone component". Where "the current directory at runtime" is typically quite simply equal to the directory where the main executable is located.
56+
57+
Further, for this workflow, in the Application- or Library Compiler App under "Files required for your application to run" (or when working with `mcc`, using the `-a` argument), explicitly add the following files to the component:
58+
59+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j.properties`
60+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j2.xml`
61+
- `$MATLABROOT/java/jarext/slf4j/slf4j-api.jar`
62+
- `$MATLABROOT/java/jarext/slf4j/slf4j-log4j12.jar`
63+
- `$PREFDIR/javaclasspath.txt`
64+
65+
Where `$PREFDIR` stands for the MATLAB preferences directory as returned by running the `prefdir` function in the MATLAB Command Windows. Depending on the exact MATLAB Compiler version, *some* versions may already include `$PREFDIR/javaclasspath.txt` *automatically*; by adding it *explicitly* though, this approach should work in *all* supported releases.
66+
67+
And then, if working with [MATLAB Compiler (SDK) packaged installers](https://www.mathworks.com/help/compiler/files-generated-after-packaging-application-compiler.html), under "Files installed for your end user", add:
68+
69+
- `matlab-azure-services/Software/MATLAB/lib/jar/azure-common-sdk-0.2.0.jar`
70+
71+
The packaged installer will then place the JAR-file next to the standalone component during installation. Alternatively, if not working with the packaged installers, simply manually distribute `azure-common-sdk-0.2.0.jar` next to the standalone component itself, in the same directory.
72+
73+
## Option Three: Make JAR-file available in MATLAB Runtime
74+
75+
JAR-files can only be added to the *static* class path upon initialization of the MATLAB Runtime. In use cases where multiple standalone components are used in a single application, there will be only *one* MATLAB Runtime instance which is instantiated upon first interaction with the first component. If a component is loaded after initial initialization of the MATLAB Runtime, its JAR-files are added to the *dynamic* class path rather than the static class path. Unfortunately `azure-common-sdk-0.2.0.jar` *must* be loaded on the *static* class path though.
76+
77+
In some situation, for example when working with multiple MATLAB Compiler Java/.NET/Python modules in a single Java/.NET/Python application, this is simply something to "keep in mind" and it may be possible to ensure that the right component is loaded first. However, this can not always be *guaranteed*, especially in [MATLAB Production Server](https://www.mathworks.com/products/matlab-production-server.html) workflows, where it is not possible to predict which component will be called first inside which worker process. In such situations an option could be to add the JAR-file to the MATLAB Runtime such that it is *always* loaded, regardless of which exact component instantiated this runtime first.
78+
79+
First, at compile time, again add the following two files to the "Files required for your application to run" (or using `mcc`'s `-a` flag):
80+
81+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j.properties`
82+
- `matlab-azure-services/Software/MATLAB/lib/jar/log4j2.xml`
83+
84+
Then, manually copy the following three files to the target machine onto which the component will be deployed:
85+
86+
- `matlab-azure-services/Software/MATLAB/lib/jar/azure-common-sdk-0.2.0.jar`
87+
- `$MATLABROOT/java/jarext/slf4j/slf4j-api.jar`
88+
- `$MATLABROOT/java/jarext/slf4j/slf4j-log4j12.jar`
89+
90+
The files can basically be placed anywhere on this machine as long as they are accessible by the runtime. Lastly, also on the target machine where the MATLAB Runtime has been installed, open `$MCRROOT/toolbox/local/classpath.txt` (where `$MCRROOT` stands for the installation directory of the MATLAB Runtime) in a text editor and add the full absolute locations of the three files to the *front* of the list of JAR-files and directories in the text file.
91+
92+
````{note}
93+
The `toolbox/local/classpath.txt` file contains a notification:
94+
95+
```
96+
#DO NOT MODIFY THIS FILE. IT IS AN AUTOGENERATED FILE.
97+
```
98+
99+
For this particular use-case, this can partly be ignored, the file *may* be edited but do indeed keep in mind that it may be changed or overwritten when reinstalling the MATLAB Runtime or installing an Update to the runtime. The modification may have to be reapplied afterwards.
100+
````
101+
102+
[//]: # (Copyright 2022 The MathWorks, Inc.)

Documentation/Installation.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ the static java class path if `SharedTokenCacheCredential` and
3535
`TokenCachePersistenceOptions` are used, if not, the jar file can be in any
3636
position on the static java class path.
3737

38-
> **_NOTE:_** when making use of MathWorks features which can automatically add
39-
> jar files to the static class path, these typically add them to then *end* of
40-
> the static class path. For example when working with a [packaged custom
41-
> toolbox](https://www.mathworks.com/help/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html)
42-
> the included jar file is added to the *end* of the static path in the end user
43-
> MATLAB installation. Or if working with MATLAB Compiler (SDK) standalone
44-
> components the jar file which was packaged into the component are
45-
> automatically added to the *end* of the static class path at runtime. However
46-
> there may be situations in which this is not possible and then these features
47-
> may add the jar file to the dynamic class path.
38+
```{note}
39+
When making use of MathWorks features which can automatically add
40+
jar files to the static class path, these typically add them to then *end* of
41+
the static class path. For example when working with a [packaged custom
42+
toolbox](https://www.mathworks.com/help/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html)
43+
the included jar file is added to the *end* of the static path in the end user
44+
MATLAB installation. Or if working with MATLAB Compiler (SDK) standalone
45+
components the jar file which was packaged into the component are
46+
automatically added to the *end* of the static class path at runtime. However
47+
there may be situations in which this is not possible and then these features
48+
may add the jar file to the dynamic class path.
49+
```
4850

4951
In general the recommended approach to add the jar file to the static java class
5052
path in a local MATLAB installation is to add an entry to the

Documentation/README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
# MATLAB Interface *for Azure Services*
2-
3-
## Contents
4-
5-
* [Overview](../README.md)
6-
* [Installation](Installation.md)
7-
* [Configuration](Configuration.md)
8-
* [Authentication](Authentication.md)
9-
* Service specific documentation
10-
* [Azure Data Lake Storage Gen2](DataLakeStorageGen2.md)
11-
* [Azure Key Vault](KeyVault.md)
12-
* [Full API Reference](APIReference.md)
13-
* [FAQ](FAQ.md)
14-
* [References](References.md)
15-
16-
[//]: # (Copyright 2021-2022 The MathWorks, Inc.)
1+
# MATLAB Interface *for Azure Services*
2+
3+
**Refer to the HTML documentation for the latest version of this help information with enhanced navigation, discoverability, and readability.**
4+
5+
**<https://mathworks-ref-arch.github.io/matlab-azure-services>**
6+
7+
## Contents
8+
9+
* [Overview](../README.md)
10+
* [Installation](Installation.md)
11+
* [Configuration](Configuration.md)
12+
* [Authentication](Authentication.md)
13+
* Service specific documentation
14+
* [Azure Data Lake Storage Gen2](DataLakeStorageGen2.md)
15+
* [Azure Key Vault](KeyVault.md)
16+
* [MATLAB Compiler (SDK) Deployment](Deployment.md)
17+
* [Full API Reference](APIReference.md)
18+
* [FAQ](FAQ.md)
19+
* [References](References.md)
20+
21+
[//]: # (Copyright 2021-2022 The MathWorks, Inc.)

Documentation/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@
9898
#
9999
# html_theme_options = {}
100100

101+
html_context = {
102+
'display_github': True,
103+
'github_user': 'mathworks-ref-arch',
104+
'github_repo': 'matlab-azure-services',
105+
'github_version': 'main',
106+
'conf_py_path': '/Documentation/'
107+
}
108+
101109
# Add any paths that contain custom static files (such as style sheets) here,
102110
# relative to this directory. They are copied after the builtin static files,
103111
# so a file named "default.css" will overwrite the builtin "default.css".

Documentation/index.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,34 @@ MATLAB Interface *for Azure Services*
66

77
.. toctree::
88
:maxdepth: 2
9-
:caption: Contents
10-
:name: README
11-
:numbered:
9+
:caption: Overview
1210

1311
Overview
1412

13+
.. toctree::
14+
:maxdepth: 2
15+
:caption: Installation & Configuration
16+
1517
Installation
1618
Configuration
19+
20+
.. toctree::
21+
:maxdepth: 2
22+
:caption: Usage
23+
1724
Authentication
1825

1926
Services
2027

2128
APIReference
22-
29+
30+
.. toctree::
31+
:maxdepth: 2
32+
:caption: Advanced Topics
33+
34+
Deployment
2335
Testing
2436
FAQ
2537

2638
References
39+

Documentation/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
myst-parser==0.17.0
2+
Sphinx==4.4.0
3+
sphinx-markdown-tables==0.0.15
4+
sphinx-rtd-theme==1.0.0
5+
attrs==21.4.0

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Introduction
44

5-
This package offers MATLAB interfaces that connect to various Microsoft Azure®
5+
This package offers MATLAB interfaces that connect to various Microsoft Azure®
66
Services it currently supports:
77

8-
* [Azure Data Lake Storage Gen2](Documentation/DataLakeStorageGen2.md)
9-
* [Azure Key Vault](Documentation/KeyVault.md)
8+
* [Azure Data Lake Storage Gen2](https://mathworks-ref-arch.github.io/matlab-azure-services/DataLakeStorageGen2.html)
9+
* [Azure Key Vault](https://mathworks-ref-arch.github.io/matlab-azure-services/KeyVault.html)
1010

1111
> Note, very many of MATLAB's IO operations support Blob Storage via builtin functions.
1212
> For example ```dir``` supports accessing remote data:
@@ -30,9 +30,15 @@ Services it currently supports:
3030

3131
This package is primarily tested using Ubuntu™ 20.04 and Windows® 10.
3232

33+
## Documentation
34+
35+
The main documentation for this package is available at:
36+
37+
<https://mathworks-ref-arch.github.io/matlab-azure-services>
38+
3339
## Usage
3440

35-
Once [installed](Documentation/Installation.md) the interface is added to the MATLAB path
41+
Once [installed](https://mathworks-ref-arch.github.io/matlab-azure-services/Installation.html) the interface is added to the MATLAB path
3642
by running `startup.m` from the `Software/MATLAB` directory.
3743

3844
### Azure Data Lake Storage Gen2
@@ -70,7 +76,7 @@ dataLakeFileClient = createStorageClient('FileSystemName','myFileSystem',...
7076
tf = dataLakeFileClient.exists();
7177
```
7278

73-
For further details see: [Azure Data Lake Storage Gen2](Documentation/DataLakeStorageGen2.md)
79+
For further details see: [Azure Data Lake Storage Gen2](https://mathworks-ref-arch.github.io/matlab-azure-services/DataLakeStorageGen2.html)
7480

7581
### Azure Key Vault
7682

@@ -95,22 +101,22 @@ properties = keyClient.listPropertiesOfKeys();
95101
name = propList(1).getName();
96102
```
97103

98-
For further details see: [Azure Key Vault](Documentation/KeyVault.md)
104+
For further details see: [Azure Key Vault](https://mathworks-ref-arch.github.io/matlab-azure-services/KeyVault.html)
99105

100106
### Configuration
101107

102108
The package offers a `loadConfigurationSettings` function which allows reading
103109
configuration settings from a short JSON format file. This offers a convenient
104110
way for you to configure various settings (like endpoint URLs) as well as
105111
authentication configurations without having to hardcode these into your MATLAB
106-
code. For more details see: [Documentation/Configuration.md](Documentation/Configuration.md)
112+
code. For more details see: [Configuration](https://mathworks-ref-arch.github.io/matlab-azure-services/Configuration.html)
107113

108114
### Authentication
109115

110116
Virtually all interactions with Azure will require some form of authentication.
111117
The authentication workflows are common to all services. The package offers
112118
various Builder classes as well as a higher-level function `configureCredentials`
113-
to aid performing the authentication. For more details see: [Documentation/Authentication.md](Documentation/Authentication.md)
119+
to aid performing the authentication. For more details see: [Authentication](https://mathworks-ref-arch.github.io/matlab-azure-services/Authentication.html)
114120

115121
## License
116122

RELEASENOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Release Notes
44

5+
## Release 0.1.1 September 7th 2022
6+
7+
* Published documentation to GitHub pages.
8+
* Fixed relative path issues with `uploadFromFile` and `downloadToFile`.
9+
* Documented deployment workflows.
10+
511
## Release 0.1.0 May 18th 2022
612

713
* Initial release to GitHub.com

Software/Java/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>com.azure</groupId>
2424
<artifactId>azure-sdk-bom</artifactId>
25-
<version>1.2.0</version>
25+
<version>1.2.5</version>
2626
<type>pom</type>
2727
<scope>import</scope>
2828
</dependency>
@@ -133,6 +133,10 @@
133133
<pattern>com.fasterxml.woodstox</pattern>
134134
<shadedPattern>shaded.com.fasterxml.woodstox</shadedPattern>
135135
</relocation>
136+
<relocation>
137+
<pattern>com.ctc.wstx</pattern>
138+
<shadedPattern>shaded.com.ctc.wstx</shadedPattern>
139+
</relocation>
136140
<relocation>
137141
<pattern>io.netty</pattern>
138142
<shadedPattern>shaded.io.netty</shadedPattern>

0 commit comments

Comments
 (0)