Skip to content

Commit

Permalink
Initial check in
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie Carpenter committed Jun 11, 2024
1 parent fd68135 commit f37e524
Show file tree
Hide file tree
Showing 141 changed files with 22,372 additions and 674 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- initial

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.settings
.project
.classpath
.metadata
*.stale

# ItelliJ
.idea/
*.iml

# Silly Mac OSX stuff
.DS_Store
**/target/
875 changes: 201 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions jpalite-core/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.log.fieldName=LOG
88 changes: 88 additions & 0 deletions jpalite-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.jpalite</groupId>
<artifactId>jpalite-parent</artifactId>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>jpalite-core</artifactId>
<name>JPALite Core library</name>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-infinispan-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-api</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-client-hotrod</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-query-dsl</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan.protostream</groupId>
<artifactId>protostream-processor</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
</project>
44 changes: 44 additions & 0 deletions jpalite-core/src/main/java/io/jpalite/Caching.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.jpalite;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({TYPE})
@Retention(RUNTIME)
public @interface Caching
{
/**
* The time units used to express the idle timeout
*
* @return The TimeUnit
*/
TimeUnit unit() default TimeUnit.DAYS;

/**
* The idle time before the record is removed from the cache. The default is 1 hour
*
* @return The idle time express in the TimeUnit
*/
long idleTime() default 1;
}
65 changes: 65 additions & 0 deletions jpalite-core/src/main/java/io/jpalite/ConverterClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.jpalite;

public interface ConverterClass
{
/**
* The name of the converter
*
* @return The name
*/
String getName();

/**
* The class of the converter
*
* @return The class
*/
Class<?> getConvertClass();

/**
* A check to see if the converter should be auto applied
*
* @return true if auto apply
*/
boolean isAutoApply();

/**
* The converter
*
* @return The converter
*/
//We need to use the raw type here as the converter is not generic
@SuppressWarnings("java:S1452")
TradeSwitchConvert<?, ?> getConverter();

/**
* The attribute type
*
* @return The attribute type
*/
Class<?> getAttributeType();

/**
* The database type
*
* @return The database type
*/
Class<?> getDbType();
}
26 changes: 26 additions & 0 deletions jpalite-core/src/main/java/io/jpalite/DataSourceProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.jpalite;


import javax.sql.DataSource;

public interface DataSourceProvider
{
DataSource getDataSource(String dataSourceName);
}
74 changes: 74 additions & 0 deletions jpalite-core/src/main/java/io/jpalite/DatabasePool.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.jpalite;

import jakarta.annotation.Nonnull;

import java.sql.Connection;
import java.sql.SQLException;

public interface DatabasePool
{
/**
* Allocated a new connection. It is the caller's responsibility to close the connection. This call is for internal
* purposes only and should not be used.
*
* @return A new connection
* @throws SQLException
*/
Connection getConnection() throws SQLException;

/**
* Create a new persistence context and allocate a connection to it. The result is thread local and only one
* connection manager will be created per thread.
* <p>
* If the properties in the persistence contains the {@link PersistenceContext#PERSISTENCE_JTA_MANAGED} property with a value of TRUE a
* new PersistenceContext will be created
*
* @param persistenceUnit The persistence unit for the context
* @return An instance of {@link PersistenceContext}
* @throws SQLException
*/
PersistenceContext getPersistenceContext(@Nonnull JPALitePersistenceUnit persistenceUnit) throws SQLException;

/**
* Instruct the database pool to close all connections own by the thread calling the method
*/
void cleanup();

/**
* The pool name
*
* @return
*/
String getPoolName();

/**
* Return the version of the database the pool is connected to
*
* @return the database version
*/
String getDbVersion();

/**
* Return product name of the database the pool is connected to
*
* @return the database name
*/
String getDbProductName();
}
Loading

0 comments on commit f37e524

Please sign in to comment.