Please edit /conf/context.xml
in Tomcat home directory and add Database pool:
<Resource name="jdbc/nnmrlsDb" auth="Container" type="javax.sql.DataSource"
maxTotal="25" maxIdle="5" maxWaitMillis="5000"
username="user" password="password" driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://server:3306/schema"/>
Additionally, you will need to add that driver lib to $APACHE_HOME/lib
Next is added to catalina.sh to have tomcat running on IP V4:
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true "
right before sentence:
JAVA_OPTS="$JAVA_OPTS $JSSE_OPTS"
Also, in server.xml
connector is configured to have next attributes:
<Connector port="8080"
address="0.0.0.0"
useIPVHosts="true"/>
Currently, we are using embedded DB. It needs ncurses lib installed (maybe)
For Ubuntu@22.04.2:
sudo apt-get install libncurses5
For Fedora@38:
sudo dnf install libnsl
sudo dnf install ncurses-compat-libs
You can check html page generated by Jacoco during build. It is in /target/site/jacoco-ut/index.html
.
So mvn clean install
will give generated report.
- !!! Please pay attention !!!
The code for *CsdlEntityTypeProvider
is generated using com.olus.olingo2.nmrls.util.DdlUtil
- !!! Please pay attention !!!
Currently, all CsdlEntityType
s have properties with the same name as database columns
This is very important because all queries are generated based on those properties.
You'll need to implement mapper if you need custom mappings between CsdlEntityType and Database columns
- Add appropriate
ET_<name>_NAME
,ET_<name>_FQN
,ES_<name>_NAME
inNnmrlsEdmProvider
- Put those in
ALL_ET
,ALL_FQN
,ALL_ES
(inNnmrlsEdmProvider
) - Get DDL of your new table (just use generate SQL tool if you have just a table without its creation script)
- Use
com.olus.olingo4.nmrls.util.DdlUtil
to generate java code for all columns - Create CsdlEntityTypeProvider - refer to existing ones as example. Put generated java code inside it.
- Put call to your CsdlEntityProvider from
NnmrlsEdmProvider.getCsdlEntityType
- Update appropriate CsdlEntityTypeProvider.
Optimized in db terms too. So only specific column will be fetched on DB level
http://localhost:8080/.../OfficeData('1')/OfficeAddress1
Optimized in db terms too. So pagination will work on db side as well.
http://localhost:8080/.../OfficeData?$top=5&$skip=1
Select is optimized in db terms too. So only specific columns will be fetched on DB level.
http://localhost:8080/.../OfficeData('1')?$select=OfficeAddress1,OfficeAddress2
Next current filter operations are supported
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId eq 1
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId ne 1
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId gt 2
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId ge 2
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId le 2
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId lt 2
http://localhost:8080/.../PropertyDataLocation?$filter=-ListingId eq -1
http://localhost:8080/.../PropertyDataLocation?$filter=not (ListingId eq 42)
http://localhost:8080/.../PropertyDataLocation?$filter=contains(UnparsedAddress,'ROSECREST DRIVE')
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId add 1 eq 2
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId sub 1 eq 1
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId div 2 eq 1
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId mul 2 eq 6
http://localhost:8080/.../PropertyDataLocation?$filter=ListingId mod 2 eq 1
http://localhost:8080/.../PropertyDataLocation?$filter=UnparsedAddress eq '000 ROSECREST DRIVE 1'
Currently, oauth2 implemented (grant_type=client_credentials)
Please take a look into config.json
in /resources/
.
Cache for tokens is Guava Cache.