├── docs ├── ALAMonoComponents.png ├── ALAMonoContainers.png ├── ALAMonoDeployment.png ├── ALAClusterDeployment.png ├── ALAClusterWebAppComponents.png ├── ALAClusterWebAppContainers.png ├── ALAClusterLinguisticsComponents.png ├── ALAClusterLinguisticsContainers.png ├── ALAClusterTranscriptionComponents.png └── ALAClusterTranscriptionContainers.png ├── k8-web-app ├── src │ └── main │ │ ├── java │ │ └── config │ │ │ └── package-info.java │ │ ├── docker │ │ ├── Dockerfile │ │ └── logback.xml │ │ ├── resources │ │ └── OSGI-INF │ │ │ └── configurator │ │ │ └── configuration.json │ │ └── k8 │ │ └── k8-web-app.yaml ├── logback.xml ├── debug.bndrun ├── k8-web-app.bndrun └── pom.xml ├── mono-app ├── src │ └── main │ │ ├── java │ │ └── config │ │ │ └── package-info.java │ │ └── resources │ │ └── OSGI-INF │ │ └── configurator │ │ └── configuration.json ├── logback.xml ├── debug.bndrun ├── pom.xml └── mono-app.bndrun ├── service-linguistics-impl ├── lib │ ├── core-6.14.2.jar │ ├── gson-2.8.0.jar │ ├── okio-1.14.0.jar │ ├── okhttp-3.11.0.jar │ ├── commons-io-2.6.jar │ ├── commons-lang3-3.5.jar │ ├── jersey-jsr166e-2.25.1.jar │ ├── tone-analyzer-6.14.2.jar │ ├── logging-interceptor-3.11.0.jar │ └── okhttp-urlconnection-3.11.0.jar ├── bnd.bnd └── pom.xml ├── k8-linguistics-app ├── src │ └── main │ │ ├── java │ │ └── config │ │ │ └── package-info.java │ │ ├── docker │ │ ├── Dockerfile │ │ └── logback.xml │ │ ├── resources │ │ └── OSGI-INF │ │ │ └── configurator │ │ │ └── configuration.json │ │ └── k8 │ │ └── k8-linguistics-app.yaml ├── logback.xml ├── debug.bndrun ├── k8-linguistics-app.bndrun └── pom.xml ├── k8-transcription-app ├── src │ └── main │ │ ├── java │ │ └── config │ │ │ └── package-info.java │ │ ├── docker │ │ ├── Dockerfile │ │ └── logback.xml │ │ ├── resources │ │ └── OSGI-INF │ │ │ └── configurator │ │ │ └── configuration.json │ │ └── k8 │ │ └── k8-transcription-app.yaml ├── logback.xml ├── debug.bndrun ├── k8-transcription-app.bndrun └── pom.xml ├── service-transcription-impl ├── lib │ ├── core-6.14.2.jar │ ├── gson-2.8.0.jar │ ├── okio-1.14.0.jar │ ├── commons-io-2.6.jar │ ├── okhttp-3.11.0.jar │ ├── commons-lang3-3.5.jar │ ├── jersey-jsr166e-2.25.1.jar │ ├── speech-to-text-6.14.2.jar │ ├── logging-interceptor-3.11.0.jar │ └── okhttp-urlconnection-3.11.0.jar ├── bnd.bnd └── pom.xml ├── dao-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── dao │ │ ├── package-info.java │ │ ├── dto │ │ ├── package-info.java │ │ ├── AnalysisDTO.java │ │ ├── TranscriptDTO.java │ │ ├── FileDTO.java │ │ ├── FileFormat.java │ │ └── FileProcessingStatus.java │ │ ├── AnalysisDao.java │ │ ├── TranscriptDao.java │ │ └── FileDao.java └── pom.xml ├── rest-common ├── src │ └── main │ │ ├── resources │ │ └── static │ │ │ ├── fonts │ │ │ ├── Lato-Bold.woff │ │ │ ├── Lato-Bold.woff2 │ │ │ ├── Lato-Regular.woff │ │ │ └── Lato-Regular.woff2 │ │ │ ├── icons │ │ │ ├── icon_no-tone_minus.svg │ │ │ ├── icon_upload.svg │ │ │ ├── icon_tone-anger.svg │ │ │ ├── icon_tone-fear.svg │ │ │ ├── icon_tone-joy.svg │ │ │ ├── icon_tone-analytical.svg │ │ │ ├── icon_tone-confident.svg │ │ │ ├── icon_tone-sadness.svg │ │ │ ├── icon_tone-tentative.svg │ │ │ └── icon_no-tone_xmark.svg │ │ │ └── index.html │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── rest │ │ └── common │ │ ├── SinglePageApp.java │ │ └── JsonConverter.java └── pom.xml ├── service-status-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── status │ │ ├── package-info.java │ │ └── StatusUpdatesService.java └── pom.xml ├── service-messaging-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── messaging │ │ ├── package-info.java │ │ └── MessagingService.java └── pom.xml ├── service-linguistics-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── linguistics │ │ ├── package-info.java │ │ └── LinguisticsService.java └── pom.xml ├── service-messaging-dto ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── messaging │ │ └── dto │ │ ├── package-info.java │ │ ├── MessageDTO.java │ │ ├── AnalysisMessageDTO.java │ │ ├── TranscriptMessageDTO.java │ │ └── FileMessageDTO.java └── pom.xml ├── service-transcription-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── transcription │ │ ├── package-info.java │ │ └── TranscriptionService.java └── pom.xml ├── service-voiceanalysis-api ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── voiceanalysis │ │ ├── package-info.java │ │ └── VoiceAnalysisService.java └── pom.xml ├── dao-impl-jpa ├── bnd.bnd ├── src │ └── main │ │ ├── java │ │ └── software │ │ │ └── into │ │ │ └── ala │ │ │ └── dao │ │ │ └── impl │ │ │ └── jpa │ │ │ ├── entities │ │ │ ├── package-info.java │ │ │ ├── AnalysisEntity.java │ │ │ ├── TranscriptEntity.java │ │ │ └── FileEntity.java │ │ │ ├── converters │ │ │ └── TimestampLocalDateTimeConverter.java │ │ │ ├── FileDaoImpl.java │ │ │ ├── AnalysisDaoImpl.java │ │ │ └── TranscriptDaoImpl.java │ │ └── resources │ │ └── META-INF │ │ ├── persistence.xml │ │ └── tables.sql └── pom.xml ├── k8-infra ├── src │ └── main │ │ └── k8 │ │ ├── infra-rabbitmq-service.yaml │ │ ├── infra-rabbitmq-controller.yaml │ │ ├── infra-cockroachdb-cluster-init.yaml │ │ ├── infra-cockroachdb-client-secure.yaml │ │ ├── infra-cockroachdb-cluster-init-secure.yaml │ │ ├── infra-rabbitmq-statefulset.yaml │ │ └── infra-cockroachdb-statefulset.yaml └── pom.xml ├── service-messaging-impl ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── service │ │ └── messaging │ │ └── impl │ │ ├── internal │ │ └── SimpleRoute.java │ │ └── MessagingBootstrapService.java └── pom.xml ├── k8-common ├── src │ └── main │ │ └── java │ │ └── software │ │ └── into │ │ └── ala │ │ └── k8 │ │ └── common │ │ ├── LivenessProbe.java │ │ └── ReadinessProbe.java └── pom.xml ├── rest-status ├── pom.xml └── src │ └── main │ └── java │ └── software │ └── into │ └── ala │ └── rest │ └── status │ └── StatusUpdatesRestController.java ├── service-voiceanalysis-impl └── pom.xml ├── rest-voiceanalysis ├── pom.xml └── src │ └── main │ └── java │ └── software │ └── into │ └── ala │ └── rest │ └── voiceanalysis │ └── VoiceAnalysisRestController.java └── service-status-impl ├── pom.xml └── src └── main └── java └── software └── into └── ala └── service └── status └── impl └── StatusUpdatesServiceImpl.java /docs/ALAMonoComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAMonoComponents.png -------------------------------------------------------------------------------- /docs/ALAMonoContainers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAMonoContainers.png -------------------------------------------------------------------------------- /docs/ALAMonoDeployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAMonoDeployment.png -------------------------------------------------------------------------------- /docs/ALAClusterDeployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterDeployment.png -------------------------------------------------------------------------------- /docs/ALAClusterWebAppComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterWebAppComponents.png -------------------------------------------------------------------------------- /docs/ALAClusterWebAppContainers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterWebAppContainers.png -------------------------------------------------------------------------------- /docs/ALAClusterLinguisticsComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterLinguisticsComponents.png -------------------------------------------------------------------------------- /docs/ALAClusterLinguisticsContainers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterLinguisticsContainers.png -------------------------------------------------------------------------------- /k8-web-app/src/main/java/config/package-info.java: -------------------------------------------------------------------------------- 1 | @RequireConfigurator 2 | package config; 3 | 4 | import org.osgi.service.configurator.annotations.RequireConfigurator; -------------------------------------------------------------------------------- /mono-app/src/main/java/config/package-info.java: -------------------------------------------------------------------------------- 1 | @RequireConfigurator 2 | package config; 3 | 4 | import org.osgi.service.configurator.annotations.RequireConfigurator; -------------------------------------------------------------------------------- /docs/ALAClusterTranscriptionComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterTranscriptionComponents.png -------------------------------------------------------------------------------- /docs/ALAClusterTranscriptionContainers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/docs/ALAClusterTranscriptionContainers.png -------------------------------------------------------------------------------- /service-linguistics-impl/lib/core-6.14.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/core-6.14.2.jar -------------------------------------------------------------------------------- /service-linguistics-impl/lib/gson-2.8.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/gson-2.8.0.jar -------------------------------------------------------------------------------- /service-linguistics-impl/lib/okio-1.14.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/okio-1.14.0.jar -------------------------------------------------------------------------------- /k8-linguistics-app/src/main/java/config/package-info.java: -------------------------------------------------------------------------------- 1 | @RequireConfigurator 2 | package config; 3 | 4 | import org.osgi.service.configurator.annotations.RequireConfigurator; -------------------------------------------------------------------------------- /k8-transcription-app/src/main/java/config/package-info.java: -------------------------------------------------------------------------------- 1 | @RequireConfigurator 2 | package config; 3 | 4 | import org.osgi.service.configurator.annotations.RequireConfigurator; -------------------------------------------------------------------------------- /service-linguistics-impl/lib/okhttp-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/okhttp-3.11.0.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/core-6.14.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/core-6.14.2.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/gson-2.8.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/gson-2.8.0.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/okio-1.14.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/okio-1.14.0.jar -------------------------------------------------------------------------------- /service-linguistics-impl/lib/commons-io-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/commons-io-2.6.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/commons-io-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/commons-io-2.6.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/okhttp-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/okhttp-3.11.0.jar -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.dao; 4 | -------------------------------------------------------------------------------- /service-linguistics-impl/lib/commons-lang3-3.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/commons-lang3-3.5.jar -------------------------------------------------------------------------------- /service-linguistics-impl/lib/jersey-jsr166e-2.25.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/jersey-jsr166e-2.25.1.jar -------------------------------------------------------------------------------- /service-linguistics-impl/lib/tone-analyzer-6.14.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/tone-analyzer-6.14.2.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/commons-lang3-3.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/commons-lang3-3.5.jar -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.dao.dto; 4 | -------------------------------------------------------------------------------- /service-transcription-impl/lib/jersey-jsr166e-2.25.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/jersey-jsr166e-2.25.1.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/speech-to-text-6.14.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/speech-to-text-6.14.2.jar -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/fonts/Lato-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/rest-common/src/main/resources/static/fonts/Lato-Bold.woff -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/fonts/Lato-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/rest-common/src/main/resources/static/fonts/Lato-Bold.woff2 -------------------------------------------------------------------------------- /service-linguistics-impl/lib/logging-interceptor-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/logging-interceptor-3.11.0.jar -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/fonts/Lato-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/rest-common/src/main/resources/static/fonts/Lato-Regular.woff -------------------------------------------------------------------------------- /service-linguistics-impl/lib/okhttp-urlconnection-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-linguistics-impl/lib/okhttp-urlconnection-3.11.0.jar -------------------------------------------------------------------------------- /service-transcription-impl/lib/logging-interceptor-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/logging-interceptor-3.11.0.jar -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/fonts/Lato-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/rest-common/src/main/resources/static/fonts/Lato-Regular.woff2 -------------------------------------------------------------------------------- /service-transcription-impl/lib/okhttp-urlconnection-3.11.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideas-into-software/automated-linguistic-analysis/HEAD/service-transcription-impl/lib/okhttp-urlconnection-3.11.0.jar -------------------------------------------------------------------------------- /service-status-api/src/main/java/software/into/ala/service/status/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.status; 4 | -------------------------------------------------------------------------------- /service-messaging-api/src/main/java/software/into/ala/service/messaging/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.messaging; 4 | -------------------------------------------------------------------------------- /service-linguistics-api/src/main/java/software/into/ala/service/linguistics/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.linguistics; 4 | -------------------------------------------------------------------------------- /service-messaging-dto/src/main/java/software/into/ala/service/messaging/dto/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.messaging.dto; 4 | -------------------------------------------------------------------------------- /service-transcription-api/src/main/java/software/into/ala/service/transcription/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.transcription; 4 | -------------------------------------------------------------------------------- /service-voiceanalysis-api/src/main/java/software/into/ala/service/voiceanalysis/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Export 2 | @org.osgi.annotation.versioning.Version("1.0.0") 3 | package software.into.ala.service.voiceanalysis; 4 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_no-tone_minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/AnalysisDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class AnalysisDTO extends DTO { 6 | public long analysisId; 7 | public String content; 8 | public String fileId; 9 | } 10 | -------------------------------------------------------------------------------- /dao-impl-jpa/bnd.bnd: -------------------------------------------------------------------------------- 1 | # Due to a long standing bug in Hibernate's entity enhancement these packages must 2 | # be imported when Hibernate is used (https://hibernate.atlassian.net/browse/HHH-10742) 3 | 4 | Import-Package: \ 5 | org.hibernate.proxy,\ 6 | javassist.util.proxy,\ 7 | * -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/TranscriptDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class TranscriptDTO extends DTO { 6 | public long transcriptId; 7 | public String content; 8 | public String fileId; 9 | } 10 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_upload.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/entities/package-info.java: -------------------------------------------------------------------------------- 1 | @org.osgi.annotation.bundle.Requirement(namespace="osgi.extender", name="osgi.jpa", version="1.1.0") 2 | @org.osgi.annotation.bundle.Header(name="Meta-Persistence", value="META-INF/persistence.xml") 3 | package software.into.ala.dao.impl.jpa.entities; -------------------------------------------------------------------------------- /k8-web-app/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanblanchard/java:8 2 | MAINTAINER MHS, mhs@into.software 3 | COPY @project.artifactId@.jar /app/ala-@project.artifactId@.jar 4 | #COPY debug.jar /app/ala-@project.artifactId@.jar 5 | COPY logback.xml /app 6 | WORKDIR /app 7 | ENTRYPOINT ["java","-jar","/app/ala-@project.artifactId@.jar"] 8 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-anger.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-fear.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-joy.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /service-messaging-dto/src/main/java/software/into/ala/service/messaging/dto/MessageDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.dto; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.osgi.annotation.versioning.ProviderType; 6 | 7 | @ProviderType 8 | public interface MessageDTO extends Serializable { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /k8-linguistics-app/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanblanchard/java:8 2 | MAINTAINER MHS, mhs@into.software 3 | COPY @project.artifactId@.jar /app/ala-@project.artifactId@.jar 4 | #COPY debug.jar /app/ala-@project.artifactId@.jar 5 | COPY logback.xml /app 6 | WORKDIR /app 7 | ENTRYPOINT ["java","-jar","/app/ala-@project.artifactId@.jar"] 8 | -------------------------------------------------------------------------------- /k8-transcription-app/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanblanchard/java:8 2 | MAINTAINER MHS, mhs@into.software 3 | COPY @project.artifactId@.jar /app/ala-@project.artifactId@.jar 4 | #COPY debug.jar /app/ala-@project.artifactId@.jar 5 | COPY logback.xml /app 6 | WORKDIR /app 7 | ENTRYPOINT ["java","-jar","/app/ala-@project.artifactId@.jar"] 8 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-analytical.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-confident.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-sadness.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_tone-tentative.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-rabbitmq-service.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/kubernetes/kubernetes/tree/release-1.3/examples/celery-rabbitmq 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | labels: 6 | component: rabbitmq 7 | name: rabbitmq-public 8 | spec: 9 | ports: 10 | - port: 5672 11 | selector: 12 | app: rabbitmq 13 | component: rabbitmq 14 | -------------------------------------------------------------------------------- /service-linguistics-api/src/main/java/software/into/ala/service/linguistics/LinguisticsService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.linguistics; 2 | 3 | import org.osgi.annotation.versioning.ProviderType; 4 | 5 | import software.into.ala.service.messaging.dto.FileMessageDTO; 6 | 7 | @ProviderType 8 | public interface LinguisticsService { 9 | 10 | void analyse(FileMessageDTO message); 11 | } 12 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/icons/icon_no-tone_xmark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /service-transcription-api/src/main/java/software/into/ala/service/transcription/TranscriptionService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.transcription; 2 | 3 | import org.osgi.annotation.versioning.ProviderType; 4 | 5 | import software.into.ala.service.messaging.dto.FileMessageDTO; 6 | 7 | @ProviderType 8 | public interface TranscriptionService { 9 | 10 | void transcribe(FileMessageDTO message); 11 | } 12 | -------------------------------------------------------------------------------- /service-messaging-dto/src/main/java/software/into/ala/service/messaging/dto/AnalysisMessageDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class AnalysisMessageDTO extends DTO implements MessageDTO { 6 | private static final long serialVersionUID = 1100542778771948011L; 7 | 8 | public long analysisId; 9 | public String content; 10 | public String fileId; 11 | } 12 | -------------------------------------------------------------------------------- /service-messaging-dto/src/main/java/software/into/ala/service/messaging/dto/TranscriptMessageDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class TranscriptMessageDTO extends DTO implements MessageDTO { 6 | private static final long serialVersionUID = -561264373745770520L; 7 | 8 | public long transcriptId; 9 | public String content; 10 | public String fileId; 11 | } 12 | -------------------------------------------------------------------------------- /service-status-api/src/main/java/software/into/ala/service/status/StatusUpdatesService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.status; 2 | 3 | import org.osgi.annotation.versioning.ProviderType; 4 | import org.osgi.util.pushstream.PushStream; 5 | 6 | @ProviderType 7 | public interface StatusUpdatesService { 8 | 9 | boolean hasStatusUpdates(String fileId); 10 | 11 | PushStream getStatusUpdates(String fileId); 12 | } 13 | -------------------------------------------------------------------------------- /rest-common/src/main/java/software/into/ala/rest/common/SinglePageApp.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.rest.common; 2 | 3 | import org.osgi.service.component.annotations.Component; 4 | import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardResource; 5 | 6 | @Component(service = SinglePageApp.class, immediate = true) 7 | @HttpWhiteboardResource(pattern = "/spa/*", prefix = "static") 8 | public class SinglePageApp { 9 | } 10 | -------------------------------------------------------------------------------- /service-linguistics-impl/bnd.bnd: -------------------------------------------------------------------------------- 1 | Include-Resource: lib 2 | Bundle-ClassPath: ., core-6.14.2.jar, commons-io-2.6.jar, commons-lang3-3.5.jar, gson-2.8.0.jar, logging-interceptor-3.11.0.jar, okhttp-3.11.0.jar, okhttp-urlconnection-3.11.0.jar, okio-1.14.0.jar, jersey-jsr166e-2.25.1.jar, tone-analyzer-6.14.2.jar 3 | Import-Package: \ 4 | android.*;resolution:=optional,\ 5 | org.conscrypt.*;resolution:=optional,\ 6 | sun.misc.*;resolution:=optional,\ 7 | * -------------------------------------------------------------------------------- /service-transcription-impl/bnd.bnd: -------------------------------------------------------------------------------- 1 | Include-Resource: lib 2 | Bundle-ClassPath: ., core-6.14.2.jar, commons-io-2.6.jar, commons-lang3-3.5.jar, gson-2.8.0.jar, logging-interceptor-3.11.0.jar, okhttp-3.11.0.jar, okhttp-urlconnection-3.11.0.jar, okio-1.14.0.jar, jersey-jsr166e-2.25.1.jar, speech-to-text-6.14.2.jar 3 | Import-Package: \ 4 | android.*;resolution:=optional,\ 5 | org.conscrypt.*;resolution:=optional,\ 6 | sun.misc.*;resolution:=optional,\ 7 | * -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/FileDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class FileDTO extends DTO { 6 | public String fileId; 7 | public String fileName; 8 | public String fileDir; 9 | public FileFormat fileFormat; 10 | public String language; 11 | public String description; 12 | public FileProcessingStatus status; 13 | public String created; 14 | public TranscriptDTO transcript; 15 | public AnalysisDTO analysis; 16 | } 17 | -------------------------------------------------------------------------------- /k8-web-app/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mono-app/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/AnalysisDao.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao; 2 | 3 | import org.osgi.annotation.versioning.ProviderType; 4 | 5 | import software.into.ala.dao.dto.AnalysisDTO; 6 | 7 | @ProviderType 8 | public interface AnalysisDao { 9 | 10 | AnalysisDTO select(String fileId); 11 | 12 | void save(String fileId, AnalysisDTO data); 13 | 14 | void update(String fileId, AnalysisDTO data); 15 | 16 | void delete(String fileId); 17 | 18 | boolean hasAnalysis(String fileId); 19 | } 20 | -------------------------------------------------------------------------------- /k8-linguistics-app/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /k8-transcription-app/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/TranscriptDao.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao; 2 | 3 | import org.osgi.annotation.versioning.ProviderType; 4 | 5 | import software.into.ala.dao.dto.TranscriptDTO; 6 | 7 | @ProviderType 8 | public interface TranscriptDao { 9 | 10 | TranscriptDTO select(String fileId); 11 | 12 | void save(String fileId, TranscriptDTO data); 13 | 14 | void update(String fileId, TranscriptDTO data); 15 | 16 | void delete(String fileId); 17 | 18 | boolean hasTranscript(String fileId); 19 | } -------------------------------------------------------------------------------- /k8-web-app/src/main/docker/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /k8-linguistics-app/src/main/docker/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /k8-transcription-app/src/main/docker/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | %d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /service-messaging-impl/src/main/java/software/into/ala/service/messaging/impl/internal/SimpleRoute.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.impl.internal; 2 | 3 | import org.apache.camel.builder.RouteBuilder; 4 | 5 | public class SimpleRoute extends RouteBuilder { 6 | private String fromUri; 7 | private String toUri; 8 | 9 | public SimpleRoute(String fromUri, String toUri) { 10 | this.fromUri = fromUri; 11 | this.toUri = toUri; 12 | } 13 | 14 | @Override 15 | public void configure() throws Exception { 16 | from(this.fromUri).to(this.toUri); 17 | } 18 | } -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-rabbitmq-controller.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/kubernetes/kubernetes/tree/release-1.3/examples/celery-rabbitmq 2 | apiVersion: v1 3 | kind: ReplicationController 4 | metadata: 5 | labels: 6 | component: rabbitmq 7 | name: rabbitmq-controller 8 | spec: 9 | replicas: 1 10 | template: 11 | metadata: 12 | labels: 13 | app: rabbitmq 14 | component: rabbitmq 15 | spec: 16 | containers: 17 | - image: rabbitmq 18 | name: rabbitmq 19 | ports: 20 | - containerPort: 5672 21 | resources: 22 | limits: 23 | cpu: 100m 24 | -------------------------------------------------------------------------------- /service-messaging-dto/src/main/java/software/into/ala/service/messaging/dto/FileMessageDTO.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.dto; 2 | 3 | import org.osgi.dto.DTO; 4 | 5 | public class FileMessageDTO extends DTO implements MessageDTO { 6 | private static final long serialVersionUID = -165456219042742647L; 7 | 8 | public String fileId; 9 | public String fileName; 10 | public String fileDir; 11 | public String fileFormat; 12 | public String language; 13 | public String description; 14 | public String status; 15 | public String created; 16 | public TranscriptMessageDTO transcript; 17 | public AnalysisMessageDTO analysis; 18 | } 19 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/FileDao.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao; 2 | 3 | import java.util.List; 4 | 5 | import org.osgi.annotation.versioning.ProviderType; 6 | 7 | import software.into.ala.dao.dto.FileDTO; 8 | import software.into.ala.dao.dto.FileProcessingStatus; 9 | 10 | @ProviderType 11 | public interface FileDao { 12 | 13 | List findAll(); 14 | 15 | FileDTO findById(String fileId); 16 | 17 | String save(FileDTO data); 18 | 19 | void update(FileDTO data); 20 | 21 | void delete(String fileId); 22 | 23 | boolean exists(String fileId); 24 | 25 | FileDTO updateStatus(String fileId, FileProcessingStatus status); 26 | } 27 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/converters/TimestampLocalDateTimeConverter.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa.converters; 2 | 3 | import java.sql.Timestamp; 4 | import java.time.LocalDateTime; 5 | import java.util.Objects; 6 | 7 | import javax.persistence.AttributeConverter; 8 | 9 | public class TimestampLocalDateTimeConverter implements AttributeConverter { 10 | 11 | @Override 12 | public Timestamp convertToDatabaseColumn(LocalDateTime ldt) { 13 | return (Objects.nonNull(ldt)) ? Timestamp.valueOf(ldt) : null; 14 | } 15 | 16 | @Override 17 | public LocalDateTime convertToEntityAttribute(Timestamp t) { 18 | return (Objects.nonNull(t)) ? t.toLocalDateTime() : null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /service-voiceanalysis-api/src/main/java/software/into/ala/service/voiceanalysis/VoiceAnalysisService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.voiceanalysis; 2 | 3 | import org.apache.commons.fileupload.FileItemIterator; 4 | import org.osgi.annotation.versioning.ProviderType; 5 | 6 | import software.into.ala.dao.dto.AnalysisDTO; 7 | import software.into.ala.dao.dto.FileDTO; 8 | import software.into.ala.dao.dto.TranscriptDTO; 9 | 10 | @ProviderType 11 | public interface VoiceAnalysisService { 12 | 13 | FileDTO handleSubmitForAnalysis(String fileStorageLocation, FileItemIterator fileItemsIter) throws Exception; 14 | 15 | FileDTO handleRetrieveFile(String fileId); 16 | 17 | TranscriptDTO handleRetrieveTranscript(String fileId); 18 | 19 | AnalysisDTO handleRetrieveAnalysis(String fileId); 20 | } 21 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/FileFormat.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.dto; 2 | 3 | public enum FileFormat { 4 | flac("audio/flac"), mp3("audio/mp3"), ogg("audio/ogg"); 5 | 6 | private String mime; 7 | 8 | private FileFormat(String mime) { 9 | this.mime = mime; 10 | } 11 | 12 | public String getMime() { 13 | return mime; 14 | } 15 | 16 | public static FileFormat valueOfMimeType(String mime) { 17 | for (FileFormat format : FileFormat.values()) { 18 | if ((format.getMime()).equalsIgnoreCase(mime)) { 19 | return format; 20 | } 21 | } 22 | return null; 23 | } 24 | 25 | public static boolean hasMimeType(String mime) { 26 | for (FileFormat format : FileFormat.values()) { 27 | if ((format.getMime()).equalsIgnoreCase(mime)) { 28 | return true; 29 | } 30 | } 31 | return false; 32 | } 33 | } -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Automated Linguistic Analysis (ALA) Persistence Unit 7 | 8 | 11 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dao-api/src/main/java/software/into/ala/dao/dto/FileProcessingStatus.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.dto; 2 | 3 | public enum FileProcessingStatus { 4 | transcript_requested("transcription.transcript.requested", "Transcript was requested"), 5 | transcript_pending("transcription.transcript.pending", "Transcript is pending"), 6 | transcript_ready("transcription.transcript.ready", "Transcript is ready!"), 7 | transcript_failed("transcription.transcript.failed", "Transcript failed!"), 8 | analysis_requested("linguistics.analysis.requested", "Analysis was requested"), 9 | analysis_pending("linguistics.analysis.pending", "Analysis is pending"), 10 | analysis_ready("linguistics.analysis.ready", "Analysis is ready!"), 11 | analysis_failed("linguistics.analysis.failed", "Analysis failed!"); 12 | 13 | private String key; 14 | private String label; 15 | 16 | private FileProcessingStatus(String key, String label) { 17 | this.key = key; 18 | this.label = label; 19 | } 20 | 21 | public String getKey() { 22 | return key; 23 | } 24 | 25 | public String getLabel() { 26 | return label; 27 | } 28 | } -------------------------------------------------------------------------------- /k8-common/src/main/java/software/into/ala/k8/common/LivenessProbe.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.k8.common; 2 | 3 | import javax.servlet.Servlet; 4 | import javax.servlet.http.HttpServlet; 5 | 6 | import org.apache.felix.systemready.CheckStatus; 7 | import org.apache.felix.systemready.CheckStatus.State; 8 | import org.apache.felix.systemready.StateType; 9 | import org.apache.felix.systemready.SystemReadyCheck; 10 | import org.osgi.service.component.annotations.Component; 11 | import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern; 12 | 13 | @SuppressWarnings("serial") 14 | @Component 15 | @HttpWhiteboardServletPattern("/probe/liveness") 16 | public class LivenessProbe extends HttpServlet implements SystemReadyCheck, Servlet { 17 | private static final String NAME = "Test Liveness Probe"; 18 | private CheckStatus.State state = State.GREEN; 19 | 20 | @Override 21 | public String getName() { 22 | return NAME; 23 | } 24 | 25 | @Override 26 | public CheckStatus getStatus() { 27 | return new CheckStatus(getName(), StateType.ALIVE, state, "This is a test liveness probe"); 28 | } 29 | } -------------------------------------------------------------------------------- /k8-common/src/main/java/software/into/ala/k8/common/ReadinessProbe.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.k8.common; 2 | 3 | import javax.servlet.Servlet; 4 | import javax.servlet.http.HttpServlet; 5 | 6 | import org.apache.felix.systemready.CheckStatus; 7 | import org.apache.felix.systemready.CheckStatus.State; 8 | import org.apache.felix.systemready.StateType; 9 | import org.apache.felix.systemready.SystemReadyCheck; 10 | import org.osgi.service.component.annotations.Component; 11 | import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern; 12 | 13 | @SuppressWarnings("serial") 14 | @Component 15 | @HttpWhiteboardServletPattern("/probe/readiness") 16 | public class ReadinessProbe extends HttpServlet implements SystemReadyCheck, Servlet { 17 | private static final String NAME = "Test Readiness Probe"; 18 | private CheckStatus.State state = State.GREEN; 19 | 20 | @Override 21 | public String getName() { 22 | return NAME; 23 | } 24 | 25 | @Override 26 | public CheckStatus getStatus() { 27 | return new CheckStatus(getName(), StateType.READY, state, "This is a test readiness probe"); 28 | } 29 | } -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/resources/META-INF/tables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS files (id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR(255) NOT NULL, dir VARCHAR(50) UNIQUE NOT NULL, format VARCHAR(10) NOT NULL, language VARCHAR(5) NOT NULL, description TEXT, status VARCHAR(20) NOT NULL CHECK (status IN ('transcript_requested', 'transcript_pending', 'transcript_ready', 'transcript_failed', 'analysis_requested', 'analysis_pending', 'analysis_ready', 'analysis_failed')) DEFAULT 'transcript_requested', created TIMESTAMPTZ DEFAULT now()) 2 | 3 | CREATE TABLE IF NOT EXISTS transcripts (id SERIAL PRIMARY KEY, content TEXT NOT NULL, file_id UUID) 4 | 5 | CREATE INDEX ON transcripts (file_id) 6 | 7 | ALTER TABLE transcripts DROP CONSTRAINT IF EXISTS file 8 | ALTER TABLE transcripts ADD CONSTRAINT file FOREIGN KEY (file_id) REFERENCES files (id) ON DELETE CASCADE 9 | 10 | CREATE TABLE IF NOT EXISTS analyses (id SERIAL PRIMARY KEY, content TEXT NOT NULL, file_id UUID) 11 | 12 | CREATE INDEX ON analyses (file_id) 13 | 14 | ALTER TABLE analyses DROP CONSTRAINT IF EXISTS file 15 | ALTER TABLE analyses ADD CONSTRAINT file FOREIGN KEY (file_id) REFERENCES files (id) ON DELETE CASCADE 16 | -------------------------------------------------------------------------------- /dao-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | dao-api 14 | 15 | Automated Linguistic Analysis (ALA) - Data access API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | biz.aQute.bnd 31 | bnd-maven-plugin 32 | 33 | 34 | biz.aQute.bnd 35 | bnd-baseline-maven-plugin 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /service-messaging-impl/src/main/java/software/into/ala/service/messaging/impl/MessagingBootstrapService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging.impl; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.apache.camel.RoutesBuilder; 7 | import org.apache.camel.scr.AbstractCamelRunner; 8 | import org.osgi.framework.BundleContext; 9 | import org.osgi.service.component.annotations.Component; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | @Component(immediate = true, property = { "camelContextId=alaCamelContext", "active=true" }) 14 | public class MessagingBootstrapService extends AbstractCamelRunner { 15 | private static final Logger LOG = LoggerFactory.getLogger(MessagingBootstrapService.class); 16 | 17 | @Override 18 | protected void setupCamelContext(BundleContext bundleContext, String camelContextId) throws Exception { 19 | LOG.debug("Setting up Camel Context ID: " + camelContextId); 20 | 21 | super.setupCamelContext(bundleContext, camelContextId); 22 | 23 | // Use MDC logging 24 | getContext().setUseMDCLogging(true); 25 | 26 | // Use breadcrumb logging 27 | getContext().setUseBreadcrumb(true); 28 | 29 | // Auto-startup 30 | getContext().setAutoStartup(true); 31 | } 32 | 33 | @Override 34 | protected List getRouteBuilders() throws Exception { 35 | return Collections.emptyList(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-cockroachdb-cluster-init.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/cockroachdb/cockroach/tree/fcc1637698fd0ec91c181bd096f963d35a16e4e8/cloud/kubernetes 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | name: cluster-init 6 | labels: 7 | app: cockroachdb 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: cluster-init 13 | image: cockroachdb/cockroach:v2.1.6 14 | imagePullPolicy: IfNotPresent 15 | env: 16 | - name: DB_NAME 17 | value: autoanal 18 | - name: DB_USER_NAME 19 | value: ala 20 | command: 21 | - /bin/sh 22 | - -c 23 | - | 24 | { 25 | while ! /cockroach/cockroach init --insecure --host=cockroachdb-0.cockroachdb 2>&1 >/dev/null | grep AlreadyExists; do sleep 1; done; 26 | } && { 27 | echo "Creating user $DB_USER_NAME)" 28 | /cockroach/cockroach sql --insecure --user=root --host=cockroachdb-0.cockroachdb --execute=" 29 | CREATE USER IF NOT EXISTS $DB_USER_NAME; 30 | " 31 | 32 | echo "Creating database $DB_NAME" 33 | /cockroach/cockroach sql --insecure --user=root --host=cockroachdb-0.cockroachdb --execute=" 34 | CREATE DATABASE IF NOT EXISTS $DB_NAME; 35 | GRANT ALL ON DATABASE $DB_NAME TO $DB_USER_NAME; 36 | " 37 | } 38 | restartPolicy: OnFailure 39 | -------------------------------------------------------------------------------- /k8-linguistics-app/src/main/resources/OSGI-INF/configurator/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | // Global Settings 3 | ":configurator:resource-version" : 1, 4 | ":configurator:symbolic-name" : "software.into.ala.k8-linguistics-app.config", 5 | ":configurator:version" : "0.0.1-SNAPSHOT", 6 | 7 | // Configure a JPA resource provider 8 | "org.apache.aries.tx.control.jpa.xa~ala": { 9 | "name": "ala.database", 10 | "osgi.jdbc.driver.class": "org.postgresql.Driver", 11 | "url": "jdbc:postgresql://cockroachdb-public:26257/autoanal?user=ala&sslmode=disable", 12 | "osgi.unit.name": "ala-dao" }, 13 | 14 | // Target the Dao impls at the provider we configured 15 | "software.into.ala.dao.impl.jpa.FileDaoImpl": { 16 | "provider.target": "(name=ala.database)" }, 17 | "software.into.ala.dao.impl.jpa.AnalysisDaoImpl": { 18 | "provider.target": "(name=ala.database)" }, 19 | "software.into.ala.dao.impl.jpa.TranscriptDaoImpl": { 20 | "provider.target": "(name=ala.database)" }, 21 | 22 | // Configure messaging service 23 | "software.into.ala.service.messaging" : { 24 | "host": "rabbitmq-public", 25 | "port": 5672 26 | }, 27 | 28 | // Configure linguistics service 29 | // TODO: remove API key before commit! 30 | "software.into.ala.service.linguistics": { 31 | "endpoint": "[ENTER ENDPOINT ADDRESS]", 32 | "apiKey": "[ENTER API KEY]", 33 | "apiVersion": "2017-09-21" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /k8-infra/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | software.into.ala 7 | main 8 | 0.0.1-SNAPSHOT 9 | ../pom.xml 10 | 11 | 12 | k8-infra 13 | pom 14 | 15 | Automated Linguistic Analysis (ALA) - K8 infra 16 | 17 | 18 | 19 | 20 | 21 | k8 22 | 23 | 24 | 25 | com.github.deanjameseverett 26 | k8-maven-plugin 27 | 28 | 29 | cluster 30 | 31 | 32 | 33 | infra-rabbitmq-statefulset.yaml 34 | 35 | infra-cockroachdb-statefulset.yaml 36 | infra-cockroachdb-cluster-init.yaml 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /k8-transcription-app/src/main/resources/OSGI-INF/configurator/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | // Global Settings 3 | ":configurator:resource-version" : 1, 4 | ":configurator:symbolic-name" : "software.into.ala.k8-transcription-app.config", 5 | ":configurator:version" : "0.0.1-SNAPSHOT", 6 | 7 | // Configure a JPA resource provider 8 | "org.apache.aries.tx.control.jpa.xa~ala": { 9 | "name": "ala.database", 10 | "osgi.jdbc.driver.class": "org.postgresql.Driver", 11 | "url": "jdbc:postgresql://cockroachdb-public:26257/autoanal?user=ala&sslmode=disable", 12 | "osgi.unit.name": "ala-dao" }, 13 | 14 | // Target the Dao impls at the provider we configured 15 | "software.into.ala.dao.impl.jpa.FileDaoImpl": { 16 | "provider.target": "(name=ala.database)" }, 17 | "software.into.ala.dao.impl.jpa.AnalysisDaoImpl": { 18 | "provider.target": "(name=ala.database)" }, 19 | "software.into.ala.dao.impl.jpa.TranscriptDaoImpl": { 20 | "provider.target": "(name=ala.database)" }, 21 | 22 | // Configure messaging service 23 | "software.into.ala.service.messaging" : { 24 | "host": "rabbitmq-public", 25 | "port": 5672 26 | }, 27 | 28 | // Configure transcription service 29 | // TODO: remove API key before commit! 30 | "software.into.ala.service.transcription": { 31 | "endpoint": "[ENTER ENDPOINT ADDRESS]", 32 | "apiKey": "[ENTER API KEY]", 33 | "fileStorageLocation": "/files" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /service-linguistics-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-linguistics-api 14 | 15 | Automated Linguistic Analysis (ALA) - Linguistics service API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | software.into.ala 25 | service-messaging-dto 26 | 0.0.1-SNAPSHOT 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | biz.aQute.bnd 36 | bnd-maven-plugin 37 | 38 | 39 | biz.aQute.bnd 40 | bnd-baseline-maven-plugin 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /service-transcription-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-transcription-api 14 | 15 | Automated Linguistic Analysis (ALA) - Transcription service API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | software.into.ala 25 | service-messaging-dto 26 | 0.0.1-SNAPSHOT 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | biz.aQute.bnd 36 | bnd-maven-plugin 37 | 38 | 39 | biz.aQute.bnd 40 | bnd-baseline-maven-plugin 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /service-messaging-dto/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-messaging-dto 14 | 15 | Automated Linguistic Analysis (ALA) - Messaging service DTO 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | biz.aQute.bnd 31 | bnd-maven-plugin 32 | 33 | 39 | 40 | 41 | 42 | biz.aQute.bnd 43 | bnd-baseline-maven-plugin 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /service-messaging-api/src/main/java/software/into/ala/service/messaging/MessagingService.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.messaging; 2 | 3 | import org.apache.camel.Endpoint; 4 | import org.osgi.annotation.versioning.ProviderType; 5 | 6 | import software.into.ala.dao.dto.AnalysisDTO; 7 | import software.into.ala.dao.dto.FileDTO; 8 | import software.into.ala.dao.dto.FileProcessingStatus; 9 | import software.into.ala.dao.dto.TranscriptDTO; 10 | import software.into.ala.service.messaging.dto.AnalysisMessageDTO; 11 | import software.into.ala.service.messaging.dto.FileMessageDTO; 12 | import software.into.ala.service.messaging.dto.TranscriptMessageDTO; 13 | 14 | @ProviderType 15 | public interface MessagingService { 16 | 17 | void transcriptRequestedEvent(FileMessageDTO message); 18 | 19 | void transcriptPendingEvent(FileMessageDTO message); 20 | 21 | void transcriptReadyEvent(FileMessageDTO message); 22 | 23 | void transcriptFailedEvent(String fileId, String error); 24 | 25 | void analysisRequestedEvent(FileMessageDTO message); 26 | 27 | void analysisPendingEvent(FileMessageDTO message); 28 | 29 | void analysisReadyEvent(FileMessageDTO message); 30 | 31 | void analysisFailedEvent(String fileId, String error); 32 | 33 | void addServiceInvocationRoute(FileProcessingStatus status, String serviceName, String methodName); 34 | 35 | Endpoint registerStatusUpdatesEndpoint(String fileId); 36 | 37 | FileMessageDTO convertToFileMessageDTO(FileDTO fileDTO); 38 | 39 | TranscriptMessageDTO convertToTranscriptMessageDTO(TranscriptDTO transcriptDTO); 40 | 41 | AnalysisMessageDTO convertToAnalysisMessageDTO(AnalysisDTO analysisDTO); 42 | } 43 | -------------------------------------------------------------------------------- /k8-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | k8-common 14 | 15 | Automated Linguistic Analysis (ALA) - K8 common 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | enterprise-api 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | test-bundles 31 | pom 32 | 33 | 34 | org.apache.felix 35 | org.apache.felix.systemready 36 | ${felix.systemready.version} 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | biz.aQute.bnd 46 | bnd-maven-plugin 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /k8-web-app/src/main/resources/OSGI-INF/configurator/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | // Global Settings 3 | ":configurator:resource-version" : 1, 4 | ":configurator:symbolic-name" : "software.into.ala.k8-web-app.config", 5 | ":configurator:version" : "0.0.1-SNAPSHOT", 6 | 7 | // Configure a JPA resource provider 8 | "org.apache.aries.tx.control.jpa.xa~ala": { 9 | "name": "ala.database", 10 | "osgi.jdbc.driver.class": "org.postgresql.Driver", 11 | "url": "jdbc:postgresql://cockroachdb-public:26257/autoanal?user=ala&sslmode=disable", 12 | "osgi.unit.name": "ala-dao" }, 13 | 14 | // Target the Dao impls at the provider we configured 15 | "software.into.ala.dao.impl.jpa.FileDaoImpl": { 16 | "provider.target": "(name=ala.database)" }, 17 | "software.into.ala.dao.impl.jpa.AnalysisDaoImpl": { 18 | "provider.target": "(name=ala.database)" }, 19 | "software.into.ala.dao.impl.jpa.TranscriptDaoImpl": { 20 | "provider.target": "(name=ala.database)" }, 21 | 22 | // Configure messaging service 23 | "software.into.ala.service.messaging" : { 24 | "host": "rabbitmq-public", 25 | "port": 5672 26 | }, 27 | 28 | // Configure multipart request processing 29 | "org.apache.aries.jax.rs.whiteboard.default": { 30 | "osgi.http.whiteboard.servlet.multipart.enabled" : true, 31 | "osgi.http.whiteboard.servlet.multipart.location" : "/files", 32 | "osgi.http.whiteboard.servlet.multipart.fileSizeThreshold" : 1000000, 33 | "osgi.http.whiteboard.servlet.multipart.maxFileSize" : 20000000, 34 | "osgi.http.whiteboard.servlet.multipart.maxRequestSize" : 20000000 35 | } 36 | } -------------------------------------------------------------------------------- /service-status-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-status-api 14 | 15 | Automated Linguistic Analysis (ALA) - Status updates service API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | software.into.ala 25 | dao-api 26 | 0.0.1-SNAPSHOT 27 | 28 | 29 | software.into.ala 30 | service-messaging-dto 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | biz.aQute.bnd 41 | bnd-maven-plugin 42 | 43 | 44 | biz.aQute.bnd 45 | bnd-baseline-maven-plugin 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /service-voiceanalysis-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-voiceanalysis-api 14 | 15 | Automated Linguistic Analysis (ALA) - Voice analysis service API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | software.into.ala 25 | dao-api 26 | 0.0.1-SNAPSHOT 27 | 28 | 29 | commons-fileupload 30 | commons-fileupload 31 | ${commons-fileupload.version} 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | biz.aQute.bnd 41 | bnd-maven-plugin 42 | 43 | 44 | biz.aQute.bnd 45 | bnd-baseline-maven-plugin 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /dao-impl-jpa/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | dao-impl-jpa 14 | 15 | Automated Linguistic Analysis (ALA) - Data access JPA implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | enterprise-api 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | test-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | dao-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | org.slf4j 40 | slf4j-api 41 | ${slf4j-api.version} 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | biz.aQute.bnd 51 | bnd-maven-plugin 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /rest-status/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | rest-status 14 | 15 | Automated Linguistic Analysis (ALA) - Status updates REST service 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | enterprise-api 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | test-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | service-status-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | org.slf4j 40 | slf4j-api 41 | ${slf4j-api.version} 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | biz.aQute.bnd 51 | bnd-maven-plugin 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/entities/AnalysisEntity.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa.entities; 2 | 3 | import static javax.persistence.GenerationType.IDENTITY; 4 | 5 | import java.util.Objects; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.ForeignKey; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.Id; 12 | import javax.persistence.JoinColumn; 13 | import javax.persistence.OneToOne; 14 | import javax.persistence.Table; 15 | 16 | import software.into.ala.dao.dto.AnalysisDTO; 17 | 18 | @Entity 19 | @Table(name = "analyses") 20 | public class AnalysisEntity { 21 | 22 | @OneToOne 23 | @JoinColumn(name = "file_id", foreignKey = @ForeignKey(name = "file")) 24 | private FileEntity file; 25 | 26 | @Id 27 | @Column(name = "id") 28 | @GeneratedValue(strategy = IDENTITY) 29 | private Long analysisId; 30 | 31 | @Column(name = "content") 32 | private String content; 33 | 34 | public AnalysisDTO toDTO() { 35 | AnalysisDTO dto = new AnalysisDTO(); 36 | dto.fileId = file.getFileId(); 37 | dto.analysisId = analysisId; 38 | dto.content = content; 39 | 40 | return dto; 41 | } 42 | 43 | public static AnalysisEntity fromDTO(FileEntity file, AnalysisDTO dto) { 44 | Objects.requireNonNull(file, "File Entity is required!"); 45 | Objects.requireNonNull(dto, "Analysis DTO is required!"); 46 | 47 | AnalysisEntity entity = new AnalysisEntity(); 48 | entity.file = file; 49 | entity.analysisId = dto.analysisId; 50 | entity.content = dto.content; 51 | 52 | return entity; 53 | } 54 | 55 | public void setContent(String content) { 56 | Objects.requireNonNull(content, "Content is required!"); 57 | 58 | this.content = content; 59 | } 60 | 61 | public void setFile(FileEntity file) { 62 | this.file = file; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /service-messaging-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-messaging-api 14 | 15 | Automated Linguistic Analysis (ALA) - Messaging service API 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | software.into.ala 25 | service-messaging-dto 26 | 0.0.1-SNAPSHOT 27 | 28 | 29 | software.into.ala 30 | dao-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | org.apache.camel 35 | camel-core 36 | ${camel.version} 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | biz.aQute.bnd 46 | bnd-maven-plugin 47 | 48 | 49 | biz.aQute.bnd 50 | bnd-baseline-maven-plugin 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/entities/TranscriptEntity.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa.entities; 2 | 3 | import static javax.persistence.GenerationType.IDENTITY; 4 | 5 | import java.util.Objects; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.ForeignKey; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.Id; 12 | import javax.persistence.JoinColumn; 13 | import javax.persistence.OneToOne; 14 | import javax.persistence.Table; 15 | 16 | import software.into.ala.dao.dto.TranscriptDTO; 17 | 18 | @Entity 19 | @Table(name = "transcripts") 20 | public class TranscriptEntity { 21 | 22 | @OneToOne 23 | @JoinColumn(name = "file_id", foreignKey = @ForeignKey(name = "file")) 24 | private FileEntity file; 25 | 26 | @Id 27 | @Column(name = "id") 28 | @GeneratedValue(strategy = IDENTITY) 29 | private Long transcriptId; 30 | 31 | @Column(name = "content") 32 | private String content; 33 | 34 | public TranscriptDTO toDTO() { 35 | TranscriptDTO dto = new TranscriptDTO(); 36 | dto.fileId = file.getFileId(); 37 | dto.transcriptId = transcriptId; 38 | dto.content = content; 39 | 40 | return dto; 41 | } 42 | 43 | public static TranscriptEntity fromDTO(FileEntity file, TranscriptDTO dto) { 44 | Objects.requireNonNull(file, "File Entity is required!"); 45 | Objects.requireNonNull(dto, "Transcript DTO is required!"); 46 | 47 | TranscriptEntity entity = new TranscriptEntity(); 48 | entity.file = file; 49 | entity.transcriptId = dto.transcriptId; 50 | entity.content = dto.content; 51 | 52 | return entity; 53 | } 54 | 55 | public void setContent(String content) { 56 | Objects.requireNonNull(content, "Content is required!"); 57 | 58 | this.content = content; 59 | } 60 | 61 | public void setFile(FileEntity file) { 62 | this.file = file; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /service-voiceanalysis-impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-voiceanalysis-impl 14 | 15 | Automated Linguistic Analysis (ALA) - Voice analysis service implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | test-bundles 26 | pom 27 | 28 | 29 | software.into.ala 30 | service-voiceanalysis-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | software.into.ala 35 | service-messaging-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | org.slf4j 40 | slf4j-api 41 | ${slf4j-api.version} 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | biz.aQute.bnd 51 | bnd-maven-plugin 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-cockroachdb-client-secure.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/cockroachdb/cockroach/tree/fcc1637698fd0ec91c181bd096f963d35a16e4e8/cloud/kubernetes 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: cockroachdb-client-secure 6 | labels: 7 | app: cockroachdb-client 8 | spec: 9 | serviceAccountName: cockroachdb 10 | initContainers: 11 | # The init-certs container sends a certificate signing request to the 12 | # kubernetes cluster. 13 | # You can see pending requests using: kubectl get csr 14 | # CSRs can be approved using: kubectl certificate approve 15 | # 16 | # In addition to the client certificate and key, the init-certs entrypoint will symlink 17 | # the cluster CA to the certs directory. 18 | - name: init-certs 19 | image: cockroachdb/cockroach-k8s-request-cert:0.4 20 | imagePullPolicy: IfNotPresent 21 | command: 22 | - "/bin/ash" 23 | - "-ecx" 24 | - "/request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=client -user=root -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" 25 | env: 26 | - name: POD_NAMESPACE 27 | valueFrom: 28 | fieldRef: 29 | fieldPath: metadata.namespace 30 | volumeMounts: 31 | - name: client-certs 32 | mountPath: /cockroach-certs 33 | containers: 34 | - name: cockroachdb-client 35 | image: cockroachdb/cockroach:v2.1.6 36 | imagePullPolicy: IfNotPresent 37 | volumeMounts: 38 | - name: client-certs 39 | mountPath: /cockroach-certs 40 | # Keep a pod open indefinitely so kubectl exec can be used to get a shell to it 41 | # and run cockroach client commands, such as cockroach sql, cockroach node status, etc. 42 | command: 43 | - sleep 44 | - "2147483648" # 2^31 45 | # This pod isn't doing anything important, so don't bother waiting to terminate it. 46 | terminationGracePeriodSeconds: 0 47 | volumes: 48 | - name: client-certs 49 | emptyDir: {} 50 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-cockroachdb-cluster-init-secure.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/cockroachdb/cockroach/tree/fcc1637698fd0ec91c181bd096f963d35a16e4e8/cloud/kubernetes 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | name: cluster-init-secure 6 | labels: 7 | app: cockroachdb 8 | spec: 9 | template: 10 | spec: 11 | serviceAccountName: cockroachdb 12 | initContainers: 13 | # The init-certs container sends a certificate signing request to the 14 | # kubernetes cluster. 15 | # You can see pending requests using: kubectl get csr 16 | # CSRs can be approved using: kubectl certificate approve 17 | # 18 | # In addition to the client certificate and key, the init-certs entrypoint will symlink 19 | # the cluster CA to the certs directory. 20 | - name: init-certs 21 | image: cockroachdb/cockroach-k8s-request-cert:0.4 22 | imagePullPolicy: IfNotPresent 23 | command: 24 | - "/bin/ash" 25 | - "-ecx" 26 | - "/request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=client -user=root -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" 27 | env: 28 | - name: POD_NAMESPACE 29 | valueFrom: 30 | fieldRef: 31 | fieldPath: metadata.namespace 32 | volumeMounts: 33 | - name: client-certs 34 | mountPath: /cockroach-certs 35 | containers: 36 | - name: cluster-init 37 | image: cockroachdb/cockroach:v2.1.6 38 | imagePullPolicy: IfNotPresent 39 | volumeMounts: 40 | - name: client-certs 41 | mountPath: /cockroach-certs 42 | command: 43 | - "/cockroach/cockroach" 44 | - "init" 45 | - "--certs-dir=/cockroach-certs" 46 | - "--host=cockroachdb-0.cockroachdb" 47 | restartPolicy: OnFailure 48 | volumes: 49 | - name: client-certs 50 | emptyDir: {} 51 | -------------------------------------------------------------------------------- /rest-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | rest-common 14 | 15 | Automated Linguistic Analysis (ALA) - REST common 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | enterprise-api 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | test-bundles 31 | pom 32 | 33 | 34 | org.slf4j 35 | slf4j-api 36 | ${slf4j-api.version} 37 | 38 | 39 | org.apache.johnzon 40 | johnzon-core 41 | ${johnzon.version} 42 | test 43 | 44 | 45 | org.apache.servicemix.specs 46 | org.apache.servicemix.specs.json-api-1.1 47 | ${json-api.version} 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | biz.aQute.bnd 57 | bnd-maven-plugin 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /rest-voiceanalysis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | rest-voiceanalysis 14 | 15 | Automated Linguistic Analysis (ALA) - Voice analysis REST service 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | enterprise-api 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | test-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | service-voiceanalysis-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | dao-api 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | org.slf4j 45 | slf4j-api 46 | ${slf4j-api.version} 47 | 48 | 49 | commons-fileupload 50 | commons-fileupload 51 | ${commons-fileupload.version} 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | biz.aQute.bnd 61 | bnd-maven-plugin 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /mono-app/src/main/resources/OSGI-INF/configurator/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | // Global Settings 3 | ":configurator:resource-version" : 1, 4 | ":configurator:symbolic-name" : "software.into.ala.mono-app.config", 5 | ":configurator:version" : "0.0.1-SNAPSHOT", 6 | 7 | // Configure a JPA resource provider 8 | "org.apache.aries.tx.control.jpa.xa~ala": { 9 | "name": "ala.database", 10 | "osgi.jdbc.driver.class": "org.postgresql.Driver", 11 | "url": "jdbc:postgresql://localhost:5432/autoanal?user=[ENTER USERNAME]&password=[ENTER PASSWORD]&stringtype=unspecified", 12 | "osgi.unit.name": "ala-dao" }, 13 | 14 | // Target the Dao impls at the provider we configured 15 | "software.into.ala.dao.impl.jpa.FileDaoImpl": { 16 | "provider.target": "(name=ala.database)" }, 17 | "software.into.ala.dao.impl.jpa.AnalysisDaoImpl": { 18 | "provider.target": "(name=ala.database)" }, 19 | "software.into.ala.dao.impl.jpa.TranscriptDaoImpl": { 20 | "provider.target": "(name=ala.database)" }, 21 | 22 | // Configure messaging service 23 | "software.into.ala.service.messaging" : { 24 | "host": "localhost", 25 | "port": 5672 26 | }, 27 | 28 | // Configure multipart request processing 29 | "org.apache.aries.jax.rs.whiteboard.default": { 30 | "osgi.http.whiteboard.servlet.multipart.enabled" : true, 31 | "osgi.http.whiteboard.servlet.multipart.location" : "[ENTER FILE STORAGE LOCATION]", 32 | "osgi.http.whiteboard.servlet.multipart.fileSizeThreshold" : 1000000, 33 | "osgi.http.whiteboard.servlet.multipart.maxFileSize" : 20000000, 34 | "osgi.http.whiteboard.servlet.multipart.maxRequestSize" : 20000000 35 | }, 36 | 37 | // Configure transcription service 38 | // TODO: remove API key before commit! 39 | "software.into.ala.service.transcription": { 40 | "endpoint": "[ENTER ENDPOINT ADDRESS]", 41 | "apiKey": "[ENTER API KEY]", 42 | "fileStorageLocation": "[ENTER FILE STORAGE LOCATION]" 43 | }, 44 | 45 | // Configure linguistics service 46 | // TODO: remove API key before commit! 47 | "software.into.ala.service.linguistics": { 48 | "endpoint": "[ENTER ENDPOINT ADDRESS]", 49 | "apiKey": "[ENTER API KEY]", 50 | "apiVersion": "2017-09-21" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /k8-web-app/src/main/k8/k8-web-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: ala-@project.artifactId@ 5 | labels: 6 | app: ala 7 | tier: frontend 8 | ver: @project.version@ 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: ala 14 | tier: frontend 15 | ver: @project.version@ 16 | template: 17 | metadata: 18 | labels: 19 | app: ala 20 | tier: frontend 21 | ver: @project.version@ 22 | spec: 23 | terminationGracePeriodSeconds: 30 24 | volumes: 25 | - hostPath: 26 | path: "/mnt/ala_files" 27 | type: DirectoryOrCreate 28 | name: ala-@project.artifactId@-pv-storage 29 | containers: 30 | - image: @k8-maven.docker-registry@/ala-@project.artifactId@:@project.version@ 31 | name: ala-@project.artifactId@ 32 | imagePullPolicy: Always 33 | ports: 34 | - containerPort: 8080 35 | protocol: TCP 36 | volumeMounts: 37 | - mountPath: /files 38 | name: ala-@project.artifactId@-pv-storage 39 | readinessProbe: 40 | httpGet: 41 | path: /systemready 42 | port: 8080 43 | initialDelaySeconds: 15 44 | timeoutSeconds: 5 45 | periodSeconds: 5 46 | livenessProbe: 47 | httpGet: 48 | path: /systemalive 49 | port: 8080 50 | initialDelaySeconds: 15 51 | timeoutSeconds: 5 52 | periodSeconds: 5 53 | env: 54 | - name: rabbitmq_host 55 | value: $(RABBITMQ_PUBLIC_SERVICE_HOST) 56 | - name: rabbitmq_port 57 | value: $(RABBITMQ_PUBLIC_SERVICE_PORT) 58 | - name: cockroachdb_host 59 | value: $(COCKROACHDB_PUBLIC_SERVICE_HOST) 60 | - name: cockroachdb_port 61 | value: $(COCKROACHDB_PUBLIC_SERVICE_PORT) 62 | --- 63 | apiVersion: v1 64 | kind: Service 65 | metadata: 66 | name: ala-@project.artifactId@ 67 | labels: 68 | app: ala 69 | tier: frontend 70 | ver: @project.version@ 71 | spec: 72 | externalTrafficPolicy: Cluster 73 | ports: 74 | - port: 8080 75 | protocol: TCP 76 | targetPort: 8080 77 | selector: 78 | app: ala 79 | tier: frontend 80 | ver: @project.version@ 81 | type: NodePort 82 | -------------------------------------------------------------------------------- /k8-linguistics-app/src/main/k8/k8-linguistics-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: ala-@project.artifactId@ 5 | labels: 6 | app: ala 7 | tier: backend 8 | ver: @project.version@ 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: ala 14 | tier: backend 15 | ver: @project.version@ 16 | template: 17 | metadata: 18 | labels: 19 | app: ala 20 | tier: backend 21 | ver: @project.version@ 22 | spec: 23 | terminationGracePeriodSeconds: 30 24 | volumes: 25 | - hostPath: 26 | path: "/mnt/ala_files" 27 | type: DirectoryOrCreate 28 | name: ala-@project.artifactId@-pv-storage 29 | containers: 30 | - image: @k8-maven.docker-registry@/ala-@project.artifactId@:@project.version@ 31 | name: ala-@project.artifactId@ 32 | imagePullPolicy: Always 33 | ports: 34 | - containerPort: 8080 35 | protocol: TCP 36 | volumeMounts: 37 | - mountPath: /files 38 | name: ala-@project.artifactId@-pv-storage 39 | readinessProbe: 40 | httpGet: 41 | path: /systemready 42 | port: 8080 43 | initialDelaySeconds: 15 44 | timeoutSeconds: 5 45 | periodSeconds: 5 46 | livenessProbe: 47 | httpGet: 48 | path: /systemalive 49 | port: 8080 50 | initialDelaySeconds: 15 51 | timeoutSeconds: 5 52 | periodSeconds: 5 53 | env: 54 | - name: rabbitmq_host 55 | value: $(RABBITMQ_PUBLIC_SERVICE_HOST) 56 | - name: rabbitmq_port 57 | value: $(RABBITMQ_PUBLIC_SERVICE_PORT) 58 | - name: cockroachdb_host 59 | value: $(COCKROACHDB_PUBLIC_SERVICE_HOST) 60 | - name: cockroachdb_port 61 | value: $(COCKROACHDB_PUBLIC_SERVICE_PORT) 62 | --- 63 | apiVersion: v1 64 | kind: Service 65 | metadata: 66 | name: ala-@project.artifactId@ 67 | labels: 68 | app: ala 69 | tier: backend 70 | ver: @project.version@ 71 | spec: 72 | externalTrafficPolicy: Cluster 73 | ports: 74 | - port: 8080 75 | protocol: TCP 76 | targetPort: 8080 77 | selector: 78 | app: ala 79 | tier: backend 80 | ver: @project.version@ 81 | type: NodePort 82 | -------------------------------------------------------------------------------- /k8-transcription-app/src/main/k8/k8-transcription-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: ala-@project.artifactId@ 5 | labels: 6 | app: ala 7 | tier: backend 8 | ver: @project.version@ 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: ala 14 | tier: backend 15 | ver: @project.version@ 16 | template: 17 | metadata: 18 | labels: 19 | app: ala 20 | tier: backend 21 | ver: @project.version@ 22 | spec: 23 | terminationGracePeriodSeconds: 30 24 | volumes: 25 | - hostPath: 26 | path: "/mnt/ala_files" 27 | type: DirectoryOrCreate 28 | name: ala-@project.artifactId@-pv-storage 29 | containers: 30 | - image: @k8-maven.docker-registry@/ala-@project.artifactId@:@project.version@ 31 | name: ala-@project.artifactId@ 32 | imagePullPolicy: Always 33 | ports: 34 | - containerPort: 8080 35 | protocol: TCP 36 | volumeMounts: 37 | - mountPath: /files 38 | name: ala-@project.artifactId@-pv-storage 39 | readinessProbe: 40 | httpGet: 41 | path: /systemready 42 | port: 8080 43 | initialDelaySeconds: 15 44 | timeoutSeconds: 5 45 | periodSeconds: 5 46 | livenessProbe: 47 | httpGet: 48 | path: /systemalive 49 | port: 8080 50 | initialDelaySeconds: 15 51 | timeoutSeconds: 5 52 | periodSeconds: 5 53 | env: 54 | - name: rabbitmq_host 55 | value: $(RABBITMQ_PUBLIC_SERVICE_HOST) 56 | - name: rabbitmq_port 57 | value: $(RABBITMQ_PUBLIC_SERVICE_PORT) 58 | - name: cockroachdb_host 59 | value: $(COCKROACHDB_PUBLIC_SERVICE_HOST) 60 | - name: cockroachdb_port 61 | value: $(COCKROACHDB_PUBLIC_SERVICE_PORT) 62 | --- 63 | apiVersion: v1 64 | kind: Service 65 | metadata: 66 | name: ala-@project.artifactId@ 67 | labels: 68 | app: ala 69 | tier: backend 70 | ver: @project.version@ 71 | spec: 72 | externalTrafficPolicy: Cluster 73 | ports: 74 | - port: 8080 75 | protocol: TCP 76 | targetPort: 8080 77 | selector: 78 | app: ala 79 | tier: backend 80 | ver: @project.version@ 81 | type: NodePort 82 | -------------------------------------------------------------------------------- /service-messaging-impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-messaging-impl 14 | 15 | Automated Linguistic Analysis (ALA) - Messaging service implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | test-bundles 26 | pom 27 | 28 | 29 | software.into.ala 30 | dao-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | software.into.ala 35 | service-messaging-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | service-messaging-dto 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | org.slf4j 45 | slf4j-api 46 | ${slf4j-api.version} 47 | 48 | 49 | org.apache.camel 50 | camel-scr 51 | ${camel.version} 52 | 53 | 54 | org.apache.camel 55 | camel-rabbitmq 56 | ${camel.version} 57 | 58 | 59 | 60 | 61 | 62 | 64 | 65 | biz.aQute.bnd 66 | bnd-maven-plugin 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /service-status-impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-status-impl 14 | 15 | Automated Linguistic Analysis (ALA) - Status updates service implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | test-bundles 26 | pom 27 | 28 | 29 | software.into.ala 30 | service-status-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | software.into.ala 35 | dao-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | service-messaging-api 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | service-messaging-dto 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | org.slf4j 50 | slf4j-api 51 | ${slf4j-api.version} 52 | 53 | 54 | org.apache.camel 55 | camel-core 56 | ${camel.version} 57 | 58 | 59 | 60 | 61 | 62 | 64 | 65 | biz.aQute.bnd 66 | bnd-maven-plugin 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /service-linguistics-impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-linguistics-impl 14 | 15 | Automated Linguistic Analysis (ALA) - Linguistics service implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | test-bundles 26 | pom 27 | 28 | 29 | software.into.ala 30 | service-linguistics-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | software.into.ala 35 | dao-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | service-messaging-api 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | service-messaging-dto 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | org.slf4j 50 | slf4j-api 51 | ${slf4j-api.version} 52 | 53 | 54 | com.ibm.watson.developer_cloud 55 | core 56 | ${ibmwatson.version} 57 | 58 | 59 | com.ibm.watson.developer_cloud 60 | tone-analyzer 61 | ${ibmwatson.version} 62 | 63 | 64 | 65 | 66 | 67 | 69 | 70 | biz.aQute.bnd 71 | bnd-maven-plugin 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /service-transcription-impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | service-transcription-impl 14 | 15 | Automated Linguistic Analysis (ALA) - Transcription service implementation 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | test-bundles 26 | pom 27 | 28 | 29 | software.into.ala 30 | service-transcription-api 31 | 0.0.1-SNAPSHOT 32 | 33 | 34 | software.into.ala 35 | dao-api 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | service-messaging-api 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | service-messaging-dto 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | org.slf4j 50 | slf4j-api 51 | ${slf4j-api.version} 52 | 53 | 54 | com.ibm.watson.developer_cloud 55 | core 56 | ${ibmwatson.version} 57 | 58 | 59 | com.ibm.watson.developer_cloud 60 | speech-to-text 61 | ${ibmwatson.version} 62 | 63 | 64 | 65 | 66 | 67 | 69 | 70 | biz.aQute.bnd 71 | bnd-maven-plugin 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /rest-status/src/main/java/software/into/ala/rest/status/StatusUpdatesRestController.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.rest.status; 2 | 3 | import java.util.Objects; 4 | 5 | import javax.ws.rs.GET; 6 | import javax.ws.rs.Path; 7 | import javax.ws.rs.PathParam; 8 | import javax.ws.rs.Produces; 9 | import javax.ws.rs.core.Context; 10 | import javax.ws.rs.core.MediaType; 11 | import javax.ws.rs.sse.OutboundSseEvent; 12 | import javax.ws.rs.sse.Sse; 13 | import javax.ws.rs.sse.SseEventSink; 14 | 15 | import org.osgi.service.component.annotations.Component; 16 | import org.osgi.service.component.annotations.Reference; 17 | import org.osgi.service.component.annotations.ReferenceScope; 18 | import org.osgi.service.component.annotations.ServiceScope; 19 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JSONRequired; 20 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsResource; 21 | import org.osgi.util.pushstream.PushStream; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | import software.into.ala.service.status.StatusUpdatesService; 26 | 27 | @Component(service = StatusUpdatesRestController.class, scope = ServiceScope.PROTOTYPE) 28 | @JaxrsResource 29 | @Path("status") 30 | @JSONRequired 31 | public class StatusUpdatesRestController { 32 | private static final Logger LOG = LoggerFactory.getLogger(StatusUpdatesRestController.class); 33 | 34 | @Reference(scope = ReferenceScope.PROTOTYPE_REQUIRED) 35 | private StatusUpdatesService statusUpdateService; 36 | 37 | @Context 38 | private Sse sse; 39 | 40 | @Context 41 | private SseEventSink sink; 42 | 43 | @GET 44 | @Path("{fileId}") 45 | @Produces(MediaType.SERVER_SENT_EVENTS) 46 | public void getStatusUpdates(@Context SseEventSink sink, @PathParam("fileId") String fileId) { 47 | Objects.requireNonNull(fileId, "File ID must be specified!"); 48 | 49 | LOG.debug("Called ::getStatusUpdates with file ID: " + fileId); 50 | 51 | this.sink = sink; 52 | 53 | if (!statusUpdateService.hasStatusUpdates(fileId)) { 54 | 55 | String errorMsg = "No status updates for file ID: " + fileId + "!"; 56 | 57 | LOG.error(errorMsg); 58 | 59 | failure(new IllegalArgumentException(errorMsg)); 60 | 61 | } else { 62 | 63 | PushStream fPushStream = statusUpdateService.getStatusUpdates(fileId); 64 | fPushStream.forEach(this::deliverEvent).onFailure(this::failure).onResolve(this::resolved); 65 | } 66 | } 67 | 68 | private void deliverEvent(String eventData) { 69 | LOG.debug("Delivering: " + eventData); 70 | 71 | OutboundSseEvent event = this.sse.newEvent("status", eventData); 72 | this.sink.send(event); 73 | } 74 | 75 | private void failure(Throwable t) { 76 | LOG.debug("Error: " + t.getMessage()); 77 | 78 | OutboundSseEvent event = this.sse.newEvent("error", t.getMessage()); 79 | this.sink.send(event); 80 | } 81 | 82 | private void resolved() { 83 | LOG.debug("End of stream"); 84 | 85 | OutboundSseEvent event = this.sse.newEvent("end", "End of Stream"); 86 | this.sink.send(event); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /k8-linguistics-app/debug.bndrun: -------------------------------------------------------------------------------- 1 | -include: ~k8-linguistics-app.bndrun 2 | 3 | test-index: target/test-index.xml;name="k8-linguistics-app Test" 4 | 5 | -standalone: ${index},${test-index} 6 | 7 | -runproperties: \ 8 | osgi.console=,\ 9 | osgi.console.enable.builtin=false,\ 10 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 11 | logback.configurationFile=file:/app/logback.xml 12 | # logback.configurationFile=file:${.}/logback.xml 13 | 14 | -runrequires.debug: osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\ 15 | osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole.plugins.ds)',\ 16 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\ 17 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\ 18 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)' 19 | 20 | -runbundles: \ 21 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 22 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 23 | org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\ 24 | org.apache.felix.gogo.runtime;version='[1.0.10,1.0.11)',\ 25 | org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\ 26 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 27 | org.apache.felix.inventory;version='[1.0.4,1.0.5)',\ 28 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 29 | org.apache.felix.webconsole;version='[4.3.4,4.3.5)',\ 30 | org.apache.felix.webconsole.plugins.ds;version='[2.0.8,2.0.9)',\ 31 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 32 | software.into.ala.service-linguistics-impl;version='[0.0.1,0.0.2)',\ 33 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 34 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 35 | software.into.ala.k8-linguistics-app;version='[0.0.1,0.0.2)',\ 36 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 37 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 38 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 39 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 40 | javassist;version='[3.20.0,3.20.1)',\ 41 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 42 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 43 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 44 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 45 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 46 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 47 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 48 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 49 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 50 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 51 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 52 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 53 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 54 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 55 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 56 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 57 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 58 | osgi.cmpn;version='[4.3.1,4.3.2)',\ 59 | slf4j.api;version='[1.7.25,1.7.26)',\ 60 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 61 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 62 | software.into.ala.service-linguistics-api;version='[0.0.1,0.0.2)',\ 63 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 64 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 65 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 66 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 67 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 68 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 69 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 70 | software.into.ala.k8-common;version='[0.0.1,0.0.2)',\ 71 | org.osgi.util.promise;version='[1.1.0,1.1.1)' -------------------------------------------------------------------------------- /k8-transcription-app/debug.bndrun: -------------------------------------------------------------------------------- 1 | -include: ~k8-transcription-app.bndrun 2 | 3 | test-index: target/test-index.xml;name="k8-transcription-app Test" 4 | 5 | -standalone: ${index},${test-index} 6 | 7 | -runproperties: \ 8 | osgi.console=,\ 9 | osgi.console.enable.builtin=false,\ 10 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 11 | logback.configurationFile=file:/app/logback.xml 12 | # logback.configurationFile=file:${.}/logback.xml 13 | 14 | -runrequires.debug: osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\ 15 | osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole.plugins.ds)',\ 16 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\ 17 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\ 18 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)' 19 | 20 | -runbundles: \ 21 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 22 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 23 | org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\ 24 | org.apache.felix.gogo.runtime;version='[1.0.10,1.0.11)',\ 25 | org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\ 26 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 27 | org.apache.felix.inventory;version='[1.0.4,1.0.5)',\ 28 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 29 | org.apache.felix.webconsole;version='[4.3.4,4.3.5)',\ 30 | org.apache.felix.webconsole.plugins.ds;version='[2.0.8,2.0.9)',\ 31 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 32 | software.into.ala.service-transcription-impl;version='[0.0.1,0.0.2)',\ 33 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 34 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 35 | software.into.ala.k8-transcription-app;version='[0.0.1,0.0.2)',\ 36 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 37 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 38 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 39 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 40 | javassist;version='[3.20.0,3.20.1)',\ 41 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 42 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 43 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 44 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 45 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 46 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 47 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 48 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 49 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 50 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 51 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 52 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 53 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 54 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 55 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 56 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 57 | osgi.cmpn;version='[4.3.1,4.3.2)',\ 58 | slf4j.api;version='[1.7.25,1.7.26)',\ 59 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 60 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 61 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 62 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 63 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 64 | software.into.ala.service-transcription-api;version='[0.0.1,0.0.2)',\ 65 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 66 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 67 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 68 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 69 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 70 | software.into.ala.k8-common;version='[0.0.1,0.0.2)',\ 71 | org.osgi.util.promise;version='[1.1.0,1.1.1)' -------------------------------------------------------------------------------- /k8-linguistics-app/k8-linguistics-app.bndrun: -------------------------------------------------------------------------------- 1 | index: target/index.xml;name="k8-linguistics-app" 2 | 3 | -standalone: ${index} 4 | 5 | -resolve.effective: active 6 | 7 | # Needed because the JRE has a split package for javax.transaction and a uses 8 | # constraint between javax.sql and javax.transaction. This breaks JPA unless 9 | # the JTA API is always provided from outside the OSGi framework 10 | -runpath: org.jboss.spec.javax.transaction.jboss-transaction-api_1.2_spec;version=1.0.1.Final 11 | 12 | # Hibernate has versioned imports for JTA, and its dependency dom4j has versioned 13 | # imports for the STAX API. Both of these should come from the JRE 14 | -runsystempackages: \ 15 | javax.transaction;version=1.2.0,\ 16 | javax.transaction.xa;version=1.2.0,\ 17 | javax.xml.stream;version=1.0.0,\ 18 | javax.xml.stream.events;version=1.0.0,\ 19 | javax.xml.stream.util;version=1.0.0 20 | 21 | -runproperties: \ 22 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 23 | logback.configurationFile=file:/app/logback.xml 24 | # logback.configurationFile=file:${.}/logback.xml 25 | 26 | -runrequires: \ 27 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-messaging-impl)',\ 28 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-linguistics-impl)',\ 29 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-common)',\ 30 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-linguistics-app)',\ 31 | osgi.identity;filter:='(osgi.identity=org.postgresql.jdbc42)' 32 | 33 | -runfw: org.eclipse.osgi 34 | -runee: JavaSE-1.8 35 | 36 | -runbundles: \ 37 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 38 | software.into.ala.service-linguistics-impl;version='[0.0.1,0.0.2)',\ 39 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 40 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 41 | software.into.ala.k8-linguistics-app;version='[0.0.1,0.0.2)',\ 42 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 43 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 44 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 45 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 46 | javassist;version='[3.20.0,3.20.1)',\ 47 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 48 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 49 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 50 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 51 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 52 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 53 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 54 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 55 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 56 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 57 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 58 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 59 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 60 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 61 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 62 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 63 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 64 | slf4j.api;version='[1.7.25,1.7.26)',\ 65 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 66 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 67 | software.into.ala.service-linguistics-api;version='[0.0.1,0.0.2)',\ 68 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 69 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 70 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 71 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 72 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 73 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 74 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 75 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 76 | software.into.ala.k8-common;version='[0.0.1,0.0.2)',\ 77 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 78 | org.osgi.util.promise;version='[1.1.0,1.1.1)' -------------------------------------------------------------------------------- /k8-transcription-app/k8-transcription-app.bndrun: -------------------------------------------------------------------------------- 1 | index: target/index.xml;name="k8-transcription-app" 2 | 3 | -standalone: ${index} 4 | 5 | -resolve.effective: active 6 | 7 | # Needed because the JRE has a split package for javax.transaction and a uses 8 | # constraint between javax.sql and javax.transaction. This breaks JPA unless 9 | # the JTA API is always provided from outside the OSGi framework 10 | -runpath: org.jboss.spec.javax.transaction.jboss-transaction-api_1.2_spec;version=1.0.1.Final 11 | 12 | # Hibernate has versioned imports for JTA, and its dependency dom4j has versioned 13 | # imports for the STAX API. Both of these should come from the JRE 14 | -runsystempackages: \ 15 | javax.transaction;version=1.2.0,\ 16 | javax.transaction.xa;version=1.2.0,\ 17 | javax.xml.stream;version=1.0.0,\ 18 | javax.xml.stream.events;version=1.0.0,\ 19 | javax.xml.stream.util;version=1.0.0 20 | 21 | -runproperties: \ 22 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 23 | logback.configurationFile=file:/app/logback.xml 24 | # logback.configurationFile=file:${.}/logback.xml 25 | 26 | -runrequires: \ 27 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-messaging-impl)',\ 28 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-transcription-impl)',\ 29 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-common)',\ 30 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-transcription-app)',\ 31 | osgi.identity;filter:='(osgi.identity=org.postgresql.jdbc42)' 32 | 33 | -runfw: org.eclipse.osgi 34 | -runee: JavaSE-1.8 35 | 36 | -runbundles: \ 37 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 38 | software.into.ala.service-transcription-impl;version='[0.0.1,0.0.2)',\ 39 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 40 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 41 | software.into.ala.k8-transcription-app;version='[0.0.1,0.0.2)',\ 42 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 43 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 44 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 45 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 46 | javassist;version='[3.20.0,3.20.1)',\ 47 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 48 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 49 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 50 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 51 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 52 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 53 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 54 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 55 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 56 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 57 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 58 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 59 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 60 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 61 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 62 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 63 | slf4j.api;version='[1.7.25,1.7.26)',\ 64 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 65 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 66 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 67 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 68 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 69 | software.into.ala.service-transcription-api;version='[0.0.1,0.0.2)',\ 70 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 71 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 72 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 73 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 74 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 75 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 76 | software.into.ala.k8-common;version='[0.0.1,0.0.2)',\ 77 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 78 | org.osgi.util.promise;version='[1.1.0,1.1.1)' -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/entities/FileEntity.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa.entities; 2 | 3 | import static javax.persistence.GenerationType.IDENTITY; 4 | 5 | import java.time.LocalDateTime; 6 | import java.util.Objects; 7 | 8 | import javax.persistence.CascadeType; 9 | import javax.persistence.Column; 10 | import javax.persistence.Convert; 11 | import javax.persistence.Entity; 12 | import javax.persistence.EnumType; 13 | import javax.persistence.Enumerated; 14 | import javax.persistence.GeneratedValue; 15 | import javax.persistence.Id; 16 | import javax.persistence.OneToOne; 17 | import javax.persistence.Table; 18 | 19 | import software.into.ala.dao.dto.FileDTO; 20 | import software.into.ala.dao.dto.FileFormat; 21 | import software.into.ala.dao.dto.FileProcessingStatus; 22 | import software.into.ala.dao.impl.jpa.converters.TimestampLocalDateTimeConverter; 23 | 24 | @Entity 25 | @Table(name = "files") 26 | public class FileEntity { 27 | 28 | @Id 29 | @Column(name = "id", unique = true) 30 | @GeneratedValue(strategy = IDENTITY) 31 | private String fileId; 32 | 33 | @Column(name = "name") 34 | private String fileName; 35 | 36 | @Column(name = "dir") 37 | private String fileDir; 38 | 39 | @Enumerated(EnumType.STRING) 40 | @Column(name = "format") 41 | private FileFormat fileFormat; 42 | 43 | @Enumerated(EnumType.STRING) 44 | @Column(name = "status") 45 | private FileProcessingStatus status; 46 | 47 | @Column(name = "language") 48 | private String language; 49 | 50 | @Column(name = "description") 51 | private String description; 52 | 53 | @Column(name = "created", insertable = false) 54 | @Convert(converter = TimestampLocalDateTimeConverter.class) 55 | private LocalDateTime created; 56 | 57 | @OneToOne(mappedBy = "file", cascade = CascadeType.ALL, orphanRemoval = true) 58 | private TranscriptEntity transcript; 59 | 60 | @OneToOne(mappedBy = "file", cascade = CascadeType.ALL, orphanRemoval = true) 61 | private AnalysisEntity analysis; 62 | 63 | public String getFileId() { 64 | return fileId; 65 | } 66 | 67 | public FileDTO toDTO() { 68 | FileDTO dto = new FileDTO(); 69 | dto.fileId = fileId; 70 | dto.fileName = fileName; 71 | dto.fileDir = fileDir; 72 | dto.fileFormat = fileFormat; 73 | dto.language = language; 74 | dto.description = description; 75 | dto.status = status; 76 | dto.created = Objects.nonNull(created) ? created.toString() : null; 77 | dto.transcript = Objects.nonNull(transcript) ? transcript.toDTO() : null; 78 | dto.analysis = Objects.nonNull(analysis) ? analysis.toDTO() : null; 79 | 80 | return dto; 81 | } 82 | 83 | public static FileEntity fromDTO(FileDTO dto) { 84 | Objects.requireNonNull(dto, "File DTO is required!"); 85 | 86 | FileEntity entity = new FileEntity(); 87 | entity.fileId = Objects.nonNull(dto.fileId) ? dto.fileId : null; 88 | entity.fileName = dto.fileName; 89 | entity.fileDir = dto.fileDir; 90 | entity.fileFormat = dto.fileFormat; 91 | entity.language = dto.language; 92 | entity.description = dto.description; 93 | entity.status = dto.status; 94 | entity.created = Objects.nonNull(dto.created) ? LocalDateTime.parse(dto.created) : null; 95 | entity.transcript = Objects.nonNull(dto.transcript) ? TranscriptEntity.fromDTO(entity, dto.transcript) : null; 96 | entity.analysis = Objects.nonNull(dto.analysis) ? AnalysisEntity.fromDTO(entity, dto.analysis) : null; 97 | 98 | return entity; 99 | } 100 | 101 | public TranscriptEntity getTranscript() { 102 | return transcript; 103 | } 104 | 105 | public void setTranscript(TranscriptEntity transcript) { 106 | this.transcript = transcript; 107 | transcript.setFile(this); 108 | } 109 | 110 | public AnalysisEntity getAnalysis() { 111 | return analysis; 112 | } 113 | 114 | public void setAnalysis(AnalysisEntity analysis) { 115 | this.analysis = analysis; 116 | analysis.setFile(this); 117 | } 118 | 119 | public void setStatus(FileProcessingStatus status) { 120 | this.status = status; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /rest-common/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Automated Linguistic Analysis (ALA) 12 | 13 | 14 | 20 |
21 |
22 |
24 |

Your browser is not supported! Please choose a modern browser with full support for latest HTML5 features and JavaScript enabled!

25 |

26 |

27 | 29 | 31 | 35 |
36 |
37 |

38 |

39 | 49 |

50 |

51 |
52 | 54 |

55 |

56 | 57 |

58 |

59 |

60 | Try again! 61 |

62 |

Accepted file formats: FLAC (audio/flac), MP3 (audio/mp3) and OGG (audio/ogg)

63 |
64 |
65 |

66 |
67 |
68 | 71 |
72 |
73 |
    74 |
  • Anger
  • 75 |
  • Fear
  • 76 |
  • Joy
  • 77 |
  • Sadness
  • 78 |
  • Analytical
  • 79 |
  • Confident
  • 80 |
  • Tentative
  • 81 |
82 |
83 |
84 |
85 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /k8-web-app/debug.bndrun: -------------------------------------------------------------------------------- 1 | -include: ~k8-web-app.bndrun 2 | 3 | test-index: target/test-index.xml;name="k8-web-app Test" 4 | 5 | -standalone: ${index},${test-index} 6 | 7 | -runproperties: \ 8 | osgi.console=,\ 9 | osgi.console.enable.builtin=false,\ 10 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 11 | logback.configurationFile=file:/app/logback.xml 12 | # logback.configurationFile=file:${.}/logback.xml 13 | 14 | -runrequires.debug: osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\ 15 | osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole.plugins.ds)',\ 16 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\ 17 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\ 18 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)' 19 | 20 | -runbundles: \ 21 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 22 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 23 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 24 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 25 | javassist;version='[3.20.0,3.20.1)',\ 26 | org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\ 27 | org.apache.aries.jax.rs.whiteboard;version='[1.0.1,1.0.2)',\ 28 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 29 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 30 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 31 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 32 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 33 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 34 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 35 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 36 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 37 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 38 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 39 | org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\ 40 | org.apache.felix.gogo.runtime;version='[1.0.10,1.0.11)',\ 41 | org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\ 42 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 43 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 44 | org.apache.felix.inventory;version='[1.0.4,1.0.5)',\ 45 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 46 | org.apache.felix.webconsole;version='[4.3.4,4.3.5)',\ 47 | org.apache.felix.webconsole.plugins.ds;version='[2.0.8,2.0.9)',\ 48 | org.apache.johnzon.core;version='[1.1.0,1.1.1)',\ 49 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 50 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 51 | org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\ 52 | org.apache.servicemix.specs.json-api-1.1;version='[2.9.0,2.9.1)',\ 53 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 54 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 55 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 56 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 57 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 58 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 59 | org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\ 60 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 61 | org.osgi.util.converter;version='[1.0.0,1.0.1)',\ 62 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 63 | org.osgi.util.promise;version='[1.1.0,1.1.1)',\ 64 | org.osgi.util.pushstream;version='[1.0.0,1.0.1)',\ 65 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 66 | osgi.cmpn;version='[4.3.1,4.3.2)',\ 67 | slf4j.api;version='[1.7.25,1.7.26)',\ 68 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 69 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 70 | software.into.ala.k8-web-app;version='[0.0.1,0.0.2)',\ 71 | software.into.ala.rest-voiceanalysis;version='[0.0.1,0.0.2)',\ 72 | software.into.ala.rest-common;version='[0.0.1,0.0.2)',\ 73 | software.into.ala.rest-status;version='[0.0.1,0.0.2)',\ 74 | software.into.ala.service-voiceanalysis-impl;version='[0.0.1,0.0.2)',\ 75 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 76 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 77 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 78 | software.into.ala.service-status-api;version='[0.0.1,0.0.2)',\ 79 | software.into.ala.service-status-impl;version='[0.0.1,0.0.2)',\ 80 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 81 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 82 | software.into.ala.service-voiceanalysis-api;version='[0.0.1,0.0.2)',\ 83 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 84 | software.into.ala.k8-common;version='[0.0.1,0.0.2)' -------------------------------------------------------------------------------- /mono-app/debug.bndrun: -------------------------------------------------------------------------------- 1 | -include: ~mono-app.bndrun 2 | 3 | test-index: target/test-index.xml;name="mono-app Test" 4 | 5 | -standalone: ${index},${test-index} 6 | 7 | -runproperties: \ 8 | osgi.console=,\ 9 | osgi.console.enable.builtin=false,\ 10 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 11 | logback.configurationFile=file:${.}/logback.xml 12 | 13 | -runrequires.debug: osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\ 14 | osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole.plugins.ds)',\ 15 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\ 16 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\ 17 | osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)' 18 | 19 | -runbundles: \ 20 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 21 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 22 | org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\ 23 | org.apache.aries.jax.rs.whiteboard;version='[1.0.1,1.0.2)',\ 24 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 25 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 26 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 27 | org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\ 28 | org.apache.felix.gogo.runtime;version='[1.0.10,1.0.11)',\ 29 | org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\ 30 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 31 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 32 | org.apache.felix.inventory;version='[1.0.4,1.0.5)',\ 33 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 34 | org.apache.felix.webconsole;version='[4.3.4,4.3.5)',\ 35 | org.apache.felix.webconsole.plugins.ds;version='[2.0.8,2.0.9)',\ 36 | org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\ 37 | org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\ 38 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 39 | org.osgi.util.promise;version='[1.1.0,1.1.1)',\ 40 | slf4j.api;version='[1.7.25,1.7.26)',\ 41 | software.into.ala.rest-voiceanalysis;version='[0.0.1,0.0.2)',\ 42 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 43 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 44 | javassist;version='[3.20.0,3.20.1)',\ 45 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 46 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 47 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 48 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 49 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 50 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 51 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 52 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 53 | org.apache.johnzon.core;version='[1.1.0,1.1.1)',\ 54 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 55 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 56 | org.apache.servicemix.specs.json-api-1.1;version='[2.9.0,2.9.1)',\ 57 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 58 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 59 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 60 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 61 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 62 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 63 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 64 | org.osgi.util.converter;version='[1.0.0,1.0.1)',\ 65 | org.osgi.util.pushstream;version='[1.0.0,1.0.1)',\ 66 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 67 | osgi.cmpn;version='[4.3.1,4.3.2)',\ 68 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 69 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 70 | software.into.ala.mono-app;version='[0.0.1,0.0.2)',\ 71 | software.into.ala.rest-common;version='[0.0.1,0.0.2)',\ 72 | software.into.ala.rest-status;version='[0.0.1,0.0.2)',\ 73 | software.into.ala.service-voiceanalysis-impl;version='[0.0.1,0.0.2)',\ 74 | software.into.ala.service-linguistics-impl;version='[0.0.1,0.0.2)',\ 75 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 76 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 77 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 78 | software.into.ala.service-status-api;version='[0.0.1,0.0.2)',\ 79 | software.into.ala.service-status-impl;version='[0.0.1,0.0.2)',\ 80 | software.into.ala.service-transcription-impl;version='[0.0.1,0.0.2)',\ 81 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 82 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 83 | software.into.ala.service-linguistics-api;version='[0.0.1,0.0.2)',\ 84 | software.into.ala.service-transcription-api;version='[0.0.1,0.0.2)',\ 85 | software.into.ala.service-voiceanalysis-api;version='[0.0.1,0.0.2)' -------------------------------------------------------------------------------- /k8-linguistics-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | k8-linguistics-app 14 | 15 | Automated Linguistic Analysis (ALA) - K8 Linguistic Analysis application 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | impl-index 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | debug-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | service-linguistics-impl 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | dao-impl-jpa 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | service-messaging-impl 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | software.into.ala 50 | k8-common 51 | 0.0.1-SNAPSHOT 52 | 53 | 54 | org.postgresql 55 | postgresql 56 | ${postgresql.version} 57 | runtime 58 | 59 | 60 | org.hibernate 61 | hibernate-osgi 62 | ${hibernate.version} 63 | 64 | 66 | 67 | org.apache.servicemix.bundles 68 | org.apache.servicemix.bundles.antlr 69 | ${hibernate.antlr.version} 70 | 71 | 72 | org.apache.servicemix.bundles 73 | org.apache.servicemix.bundles.dom4j 74 | ${hibernate.dom4j.version} 75 | 76 | 77 | org.apache.camel 78 | camel-scr 79 | ${camel.version} 80 | 81 | 82 | org.apache.camel 83 | camel-rabbitmq 84 | ${camel.version} 85 | 86 | 87 | 88 | 89 | 90 | 91 | biz.aQute.bnd 92 | bnd-maven-plugin 93 | 94 | 95 | biz.aQute.bnd 96 | bnd-indexer-maven-plugin 97 | 98 | true 99 | 100 | 101 | 102 | biz.aQute.bnd 103 | bnd-export-maven-plugin 104 | 105 | 106 | k8-linguistics-app.bndrun 107 | 108 | 109 | 110 | 111 | 112 | biz.aQute.bnd 113 | bnd-resolver-maven-plugin 114 | 115 | 116 | k8-linguistics-app.bndrun 117 | debug.bndrun 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | k8 130 | 131 | 132 | 133 | com.github.deanjameseverett 134 | k8-maven-plugin 135 | 136 | 137 | cluster 138 | 139 | 140 | k8-linguistics-app.yaml 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /k8-transcription-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | k8-transcription-app 14 | 15 | Automated Linguistic Analysis (ALA) - K8 Transcription application 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | impl-index 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | debug-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | service-transcription-impl 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | dao-impl-jpa 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | service-messaging-impl 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | software.into.ala 50 | k8-common 51 | 0.0.1-SNAPSHOT 52 | 53 | 54 | org.postgresql 55 | postgresql 56 | ${postgresql.version} 57 | runtime 58 | 59 | 60 | org.hibernate 61 | hibernate-osgi 62 | ${hibernate.version} 63 | 64 | 66 | 67 | org.apache.servicemix.bundles 68 | org.apache.servicemix.bundles.antlr 69 | ${hibernate.antlr.version} 70 | 71 | 72 | org.apache.servicemix.bundles 73 | org.apache.servicemix.bundles.dom4j 74 | ${hibernate.dom4j.version} 75 | 76 | 77 | org.apache.camel 78 | camel-scr 79 | ${camel.version} 80 | 81 | 82 | org.apache.camel 83 | camel-rabbitmq 84 | ${camel.version} 85 | 86 | 87 | 88 | 89 | 90 | 91 | biz.aQute.bnd 92 | bnd-maven-plugin 93 | 94 | 95 | biz.aQute.bnd 96 | bnd-indexer-maven-plugin 97 | 98 | true 99 | 100 | 101 | 102 | biz.aQute.bnd 103 | bnd-export-maven-plugin 104 | 105 | 106 | k8-transcription-app.bndrun 107 | 108 | 109 | 110 | 111 | 112 | biz.aQute.bnd 113 | bnd-resolver-maven-plugin 114 | 115 | 116 | k8-transcription-app.bndrun 117 | debug.bndrun 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | k8 130 | 131 | 132 | 133 | com.github.deanjameseverett 134 | k8-maven-plugin 135 | 136 | 137 | cluster 138 | 139 | 140 | k8-transcription-app.yaml 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-rabbitmq-statefulset.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/tree/master/examples/k8s_statefulsets 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: rabbitmq 6 | --- 7 | kind: Role 8 | apiVersion: rbac.authorization.k8s.io/v1beta1 9 | metadata: 10 | name: rabbitmq-endpoint-reader 11 | rules: 12 | - apiGroups: [""] 13 | resources: ["endpoints"] 14 | verbs: ["get"] 15 | --- 16 | kind: RoleBinding 17 | apiVersion: rbac.authorization.k8s.io/v1beta1 18 | metadata: 19 | name: rabbitmq-endpoint-reader 20 | subjects: 21 | - kind: ServiceAccount 22 | name: rabbitmq 23 | roleRef: 24 | apiGroup: rbac.authorization.k8s.io 25 | kind: Role 26 | name: rabbitmq-endpoint-reader 27 | --- 28 | kind: Service 29 | apiVersion: v1 30 | metadata: 31 | name: rabbitmq-public 32 | labels: 33 | app: rabbitmq 34 | type: LoadBalancer 35 | spec: 36 | type: NodePort 37 | ports: 38 | - name: http 39 | protocol: TCP 40 | port: 15672 41 | targetPort: 15672 42 | nodePort: 31672 43 | - name: amqp 44 | protocol: TCP 45 | port: 5672 46 | targetPort: 5672 47 | nodePort: 30672 48 | selector: 49 | app: rabbitmq 50 | --- 51 | apiVersion: v1 52 | kind: ConfigMap 53 | metadata: 54 | name: rabbitmq-config 55 | data: 56 | enabled_plugins: | 57 | [rabbitmq_management,rabbitmq_peer_discovery_k8s]. 58 | 59 | rabbitmq.conf: | 60 | ## Cluster formation. See http://www.rabbitmq.com/cluster-formation.html to learn more. 61 | cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s 62 | cluster_formation.k8s.host = kubernetes.default.svc.cluster.local 63 | ## Should RabbitMQ node name be computed from the pod's hostname or IP address? 64 | ## IP addresses are not stable, so using [stable] hostnames is recommended when possible. 65 | ## Set to "hostname" to use pod hostnames. 66 | ## When this value is changed, so should the variable used to set the RABBITMQ_NODENAME 67 | ## environment variable. 68 | cluster_formation.k8s.address_type = ip 69 | ## How often should node cleanup checks run? 70 | cluster_formation.node_cleanup.interval = 30 71 | ## Set to false if automatic removal of unknown/absent nodes 72 | ## is desired. This can be dangerous, see 73 | ## * http://www.rabbitmq.com/cluster-formation.html#node-health-checks-and-cleanup 74 | ## * https://groups.google.com/forum/#!msg/rabbitmq-users/wuOfzEywHXo/k8z_HWIkBgAJ 75 | cluster_formation.node_cleanup.only_log_warning = true 76 | cluster_partition_handling = autoheal 77 | ## See http://www.rabbitmq.com/ha.html#master-migration-data-locality 78 | queue_master_locator=min-masters 79 | ## See http://www.rabbitmq.com/access-control.html#loopback-users 80 | loopback_users.guest = false 81 | 82 | --- 83 | apiVersion: apps/v1beta1 84 | kind: StatefulSet 85 | metadata: 86 | name: rabbitmq 87 | spec: 88 | serviceName: rabbitmq-public 89 | replicas: 2 90 | template: 91 | metadata: 92 | labels: 93 | app: rabbitmq 94 | spec: 95 | serviceAccountName: rabbitmq 96 | terminationGracePeriodSeconds: 10 97 | containers: 98 | - name: rabbitmq-k8s 99 | image: rabbitmq:3.7 100 | volumeMounts: 101 | - name: config-volume 102 | mountPath: /etc/rabbitmq 103 | ports: 104 | - name: http 105 | protocol: TCP 106 | containerPort: 15672 107 | - name: amqp 108 | protocol: TCP 109 | containerPort: 5672 110 | livenessProbe: 111 | exec: 112 | command: ["rabbitmqctl", "status"] 113 | initialDelaySeconds: 60 114 | # See https://www.rabbitmq.com/monitoring.html for monitoring frequency recommendations. 115 | periodSeconds: 60 116 | timeoutSeconds: 15 117 | readinessProbe: 118 | exec: 119 | command: ["rabbitmqctl", "status"] 120 | initialDelaySeconds: 20 121 | periodSeconds: 60 122 | timeoutSeconds: 10 123 | imagePullPolicy: Always 124 | env: 125 | - name: MY_POD_IP 126 | valueFrom: 127 | fieldRef: 128 | fieldPath: status.podIP 129 | - name: RABBITMQ_USE_LONGNAME 130 | value: "true" 131 | # See a note on cluster_formation.k8s.address_type in the config file section 132 | - name: RABBITMQ_NODENAME 133 | value: "rabbit@$(MY_POD_IP)" 134 | - name: K8S_SERVICE_NAME 135 | value: "rabbitmq-public" 136 | - name: RABBITMQ_ERLANG_COOKIE 137 | value: "mycookie" 138 | volumes: 139 | - name: config-volume 140 | configMap: 141 | name: rabbitmq-config 142 | items: 143 | - key: rabbitmq.conf 144 | path: rabbitmq.conf 145 | - key: enabled_plugins 146 | path: enabled_plugins 147 | 148 | -------------------------------------------------------------------------------- /mono-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | mono-app 14 | 15 | Automated Linguistic Analysis (ALA) - ALA mono application 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | impl-index 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | debug-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | rest-common 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | rest-voiceanalysis 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | rest-status 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | software.into.ala 50 | dao-impl-jpa 51 | 0.0.1-SNAPSHOT 52 | 53 | 54 | software.into.ala 55 | service-messaging-impl 56 | 0.0.1-SNAPSHOT 57 | 58 | 59 | software.into.ala 60 | service-transcription-impl 61 | 0.0.1-SNAPSHOT 62 | 63 | 64 | software.into.ala 65 | service-linguistics-impl 66 | 0.0.1-SNAPSHOT 67 | 68 | 69 | software.into.ala 70 | service-voiceanalysis-impl 71 | 0.0.1-SNAPSHOT 72 | 73 | 74 | software.into.ala 75 | service-status-impl 76 | 0.0.1-SNAPSHOT 77 | 78 | 79 | org.apache.johnzon 80 | johnzon-core 81 | ${johnzon.version} 82 | 83 | 84 | org.postgresql 85 | postgresql 86 | ${postgresql.version} 87 | runtime 88 | 89 | 90 | org.hibernate 91 | hibernate-osgi 92 | ${hibernate.version} 93 | 94 | 96 | 97 | org.apache.servicemix.bundles 98 | org.apache.servicemix.bundles.antlr 99 | ${hibernate.antlr.version} 100 | 101 | 102 | org.apache.servicemix.bundles 103 | org.apache.servicemix.bundles.dom4j 104 | ${hibernate.dom4j.version} 105 | 106 | 107 | org.apache.camel 108 | camel-scr 109 | ${camel.version} 110 | 111 | 112 | org.apache.camel 113 | camel-rabbitmq 114 | ${camel.version} 115 | 116 | 117 | 118 | 119 | 120 | 121 | biz.aQute.bnd 122 | bnd-maven-plugin 123 | 124 | 125 | biz.aQute.bnd 126 | bnd-indexer-maven-plugin 127 | 128 | true 129 | 130 | 131 | 132 | biz.aQute.bnd 133 | bnd-export-maven-plugin 134 | 135 | 136 | mono-app.bndrun 137 | 138 | 139 | 140 | 141 | 142 | biz.aQute.bnd 143 | bnd-resolver-maven-plugin 144 | 145 | 146 | mono-app.bndrun 147 | debug.bndrun 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /k8-web-app/k8-web-app.bndrun: -------------------------------------------------------------------------------- 1 | index: target/index.xml;name="k8-web-app" 2 | 3 | -standalone: ${index} 4 | 5 | -resolve.effective: active 6 | 7 | # Needed because the JRE has a split package for javax.transaction and a uses 8 | # constraint between javax.sql and javax.transaction. This breaks JPA unless 9 | # the JTA API is always provided from outside the OSGi framework 10 | -runpath: org.jboss.spec.javax.transaction.jboss-transaction-api_1.2_spec;version=1.0.1.Final 11 | 12 | # Hibernate has versioned imports for JTA, and its dependency dom4j has versioned 13 | # imports for the STAX API. Both of these should come from the JRE 14 | -runsystempackages: \ 15 | javax.transaction;version=1.2.0,\ 16 | javax.transaction.xa;version=1.2.0,\ 17 | javax.xml.stream;version=1.0.0,\ 18 | javax.xml.stream.events;version=1.0.0,\ 19 | javax.xml.stream.util;version=1.0.0 20 | 21 | -runproperties: \ 22 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 23 | logback.configurationFile=file:/app/logback.xml 24 | # logback.configurationFile=file:${.}/logback.xml 25 | 26 | -runrequires: \ 27 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-messaging-impl)',\ 28 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-voiceanalysis-impl)',\ 29 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-status-impl)',\ 30 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-common)',\ 31 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-common)',\ 32 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-voiceanalysis)',\ 33 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-status)',\ 34 | osgi.identity;filter:='(osgi.identity=software.into.ala.k8-web-app)',\ 35 | osgi.identity;filter:='(osgi.identity=org.apache.johnzon.core)',\ 36 | osgi.identity;filter:='(osgi.identity=org.postgresql.jdbc42)' 37 | 38 | -runfw: org.eclipse.osgi 39 | -runee: JavaSE-1.8 40 | 41 | -runbundles: \ 42 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 43 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 44 | org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\ 45 | org.apache.aries.jax.rs.whiteboard;version='[1.0.1,1.0.2)',\ 46 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 47 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 48 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 49 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 50 | org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\ 51 | org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\ 52 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 53 | org.osgi.util.promise;version='[1.1.0,1.1.1)',\ 54 | slf4j.api;version='[1.7.25,1.7.26)',\ 55 | software.into.ala.rest-voiceanalysis;version='[0.0.1,0.0.2)',\ 56 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 57 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 58 | javassist;version='[3.20.0,3.20.1)',\ 59 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 60 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 61 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 62 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 63 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 64 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 65 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 66 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 67 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 68 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 69 | org.apache.johnzon.core;version='[1.1.0,1.1.1)',\ 70 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 71 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 72 | org.apache.servicemix.specs.json-api-1.1;version='[2.9.0,2.9.1)',\ 73 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 74 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 75 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 76 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 77 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 78 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 79 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 80 | org.osgi.util.converter;version='[1.0.0,1.0.1)',\ 81 | org.osgi.util.pushstream;version='[1.0.0,1.0.1)',\ 82 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 83 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 84 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 85 | software.into.ala.k8-web-app;version='[0.0.1,0.0.2)',\ 86 | software.into.ala.rest-common;version='[0.0.1,0.0.2)',\ 87 | software.into.ala.rest-status;version='[0.0.1,0.0.2)',\ 88 | software.into.ala.service-voiceanalysis-impl;version='[0.0.1,0.0.2)',\ 89 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 90 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 91 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 92 | software.into.ala.service-status-api;version='[0.0.1,0.0.2)',\ 93 | software.into.ala.service-status-impl;version='[0.0.1,0.0.2)',\ 94 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 95 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 96 | software.into.ala.service-voiceanalysis-api;version='[0.0.1,0.0.2)',\ 97 | org.apache.felix.systemready;version='[0.4.0,0.4.1)',\ 98 | software.into.ala.k8-common;version='[0.0.1,0.0.2)' -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/FileDaoImpl.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa; 2 | 3 | import static java.util.stream.Collectors.toList; 4 | 5 | import java.sql.SQLException; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Objects; 9 | 10 | import javax.persistence.EntityManager; 11 | import javax.persistence.criteria.CriteriaBuilder; 12 | import javax.persistence.criteria.CriteriaDelete; 13 | import javax.persistence.criteria.CriteriaQuery; 14 | import javax.persistence.criteria.Root; 15 | 16 | import org.osgi.service.component.annotations.Activate; 17 | import org.osgi.service.component.annotations.Component; 18 | import org.osgi.service.component.annotations.Reference; 19 | import org.osgi.service.transaction.control.TransactionControl; 20 | import org.osgi.service.transaction.control.jpa.JPAEntityManagerProvider; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | import software.into.ala.dao.FileDao; 25 | import software.into.ala.dao.dto.FileDTO; 26 | import software.into.ala.dao.dto.FileProcessingStatus; 27 | import software.into.ala.dao.impl.jpa.entities.FileEntity; 28 | 29 | @Component 30 | public class FileDaoImpl implements FileDao { 31 | private static final Logger LOG = LoggerFactory.getLogger(FileDaoImpl.class); 32 | 33 | @Reference 34 | TransactionControl transactionControl; 35 | 36 | @Reference(name = "provider") 37 | JPAEntityManagerProvider jpaEntityManagerProvider; 38 | 39 | EntityManager entityManager; 40 | 41 | @Activate 42 | void activate(Map props) throws SQLException { 43 | entityManager = jpaEntityManagerProvider.getResource(transactionControl); 44 | } 45 | 46 | @Override 47 | public List findAll() { 48 | return transactionControl.notSupported(() -> { 49 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 50 | 51 | CriteriaQuery query = builder.createQuery(FileEntity.class); 52 | 53 | query.from(FileEntity.class); 54 | 55 | return entityManager.createQuery(query).getResultList().stream().map(FileEntity::toDTO).collect(toList()); 56 | }); 57 | } 58 | 59 | @Override 60 | public FileDTO findById(String fileId) { 61 | Objects.requireNonNull(fileId, "File ID is required!"); 62 | 63 | return transactionControl.supports(() -> { 64 | FileEntity file = entityManager.find(FileEntity.class, fileId); 65 | 66 | return Objects.nonNull(file) ? file.toDTO() : null; 67 | }); 68 | } 69 | 70 | @Override 71 | public String save(FileDTO data) { 72 | Objects.requireNonNull(data, "File DTO is required!"); 73 | 74 | return transactionControl.required(() -> { 75 | FileEntity entity = FileEntity.fromDTO(data); 76 | 77 | if (Objects.isNull(entity.getFileId())) { 78 | entityManager.persist(entity); 79 | } else { 80 | entityManager.merge(entity); 81 | } 82 | 83 | LOG.debug("Saved File with ID : {}", entity.getFileId()); 84 | 85 | return entity.getFileId(); 86 | }); 87 | } 88 | 89 | @Override 90 | public void update(FileDTO data) { 91 | Objects.requireNonNull(data, "File DTO is required!"); 92 | 93 | transactionControl.required(() -> { 94 | FileEntity entity = FileEntity.fromDTO(data); 95 | 96 | Objects.requireNonNull(entity.getFileId(), "File ID is required!"); 97 | 98 | entityManager.merge(entity); 99 | 100 | LOG.debug("Updated File : {}", data); 101 | 102 | return null; 103 | }); 104 | } 105 | 106 | @Override 107 | public void delete(String fileId) { 108 | Objects.requireNonNull(fileId, "File ID is required!"); 109 | 110 | transactionControl.required(() -> { 111 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 112 | 113 | CriteriaDelete query = builder.createCriteriaDelete(FileEntity.class); 114 | 115 | Root from = query.from(FileEntity.class); 116 | 117 | query.where(builder.equal(from.get("fileId"), fileId)); 118 | 119 | entityManager.createQuery(query).executeUpdate(); 120 | 121 | LOG.debug("Deleted File with ID : {}", fileId); 122 | 123 | return null; 124 | }); 125 | } 126 | 127 | @Override 128 | public FileDTO updateStatus(String fileId, FileProcessingStatus status) { 129 | Objects.requireNonNull(fileId, "File ID is required!"); 130 | Objects.requireNonNull(status, "File processing status is required!"); 131 | 132 | return transactionControl.required(() -> { 133 | FileEntity file = entityManager.find(FileEntity.class, fileId); 134 | 135 | Objects.requireNonNull(file, "There is no file with id " + fileId); 136 | 137 | file.setStatus(status); 138 | 139 | return entityManager.merge(file).toDTO(); 140 | }); 141 | } 142 | 143 | @Override 144 | public boolean exists(String fileId) { 145 | Objects.requireNonNull(fileId, "File ID is required!"); 146 | 147 | return transactionControl.notSupported(() -> { 148 | 149 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 150 | 151 | CriteriaQuery query = builder.createQuery(Long.class); 152 | 153 | Root from = query.from(FileEntity.class); 154 | 155 | query.select(builder.count(from)); 156 | 157 | query.where(builder.equal(from.get("fileId"), fileId)); 158 | 159 | return (entityManager.createQuery(query).getSingleResult() > 0) ? true : false; 160 | }); 161 | 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/AnalysisDaoImpl.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa; 2 | 3 | import java.sql.SQLException; 4 | import java.util.Map; 5 | import java.util.Objects; 6 | 7 | import javax.persistence.EntityManager; 8 | import javax.persistence.criteria.CriteriaBuilder; 9 | import javax.persistence.criteria.CriteriaDelete; 10 | import javax.persistence.criteria.CriteriaQuery; 11 | import javax.persistence.criteria.Root; 12 | 13 | import org.osgi.service.component.annotations.Activate; 14 | import org.osgi.service.component.annotations.Component; 15 | import org.osgi.service.component.annotations.Reference; 16 | import org.osgi.service.transaction.control.TransactionControl; 17 | import org.osgi.service.transaction.control.jpa.JPAEntityManagerProvider; 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | import software.into.ala.dao.AnalysisDao; 22 | import software.into.ala.dao.dto.AnalysisDTO; 23 | import software.into.ala.dao.impl.jpa.entities.AnalysisEntity; 24 | import software.into.ala.dao.impl.jpa.entities.FileEntity; 25 | 26 | @Component 27 | public class AnalysisDaoImpl implements AnalysisDao { 28 | private static final Logger LOG = LoggerFactory.getLogger(AnalysisDaoImpl.class); 29 | 30 | @Reference 31 | TransactionControl transactionControl; 32 | 33 | @Reference(name = "provider") 34 | JPAEntityManagerProvider jpaEntityManagerProvider; 35 | 36 | EntityManager entityManager; 37 | 38 | @Activate 39 | void activate(Map props) throws SQLException { 40 | entityManager = jpaEntityManagerProvider.getResource(transactionControl); 41 | } 42 | 43 | @Override 44 | public AnalysisDTO select(String fileId) { 45 | Objects.requireNonNull(fileId, "File ID is required!"); 46 | 47 | return transactionControl.notSupported(() -> { 48 | 49 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 50 | 51 | CriteriaQuery query = builder.createQuery(AnalysisEntity.class); 52 | 53 | Root from = query.from(AnalysisEntity.class); 54 | 55 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 56 | 57 | AnalysisEntity aEntity = entityManager.createQuery(query).getSingleResult(); 58 | 59 | return Objects.nonNull(aEntity) ? aEntity.toDTO() : null; 60 | }); 61 | } 62 | 63 | @Override 64 | public void save(String fileId, AnalysisDTO data) { 65 | Objects.requireNonNull(fileId, "File ID is required!"); 66 | Objects.requireNonNull(data, "Analysis DTO is required!"); 67 | 68 | if (!hasAnalysis(fileId)) { 69 | 70 | transactionControl.required(() -> { 71 | FileEntity file = entityManager.find(FileEntity.class, fileId); 72 | 73 | Objects.requireNonNull(file, "There is no file with id " + fileId); 74 | 75 | entityManager.merge(AnalysisEntity.fromDTO(file, data)); 76 | 77 | LOG.debug("Saved file analysis : {}", data); 78 | 79 | return null; 80 | }); 81 | 82 | } else { 83 | 84 | update(fileId, data); 85 | } 86 | } 87 | 88 | @Override 89 | public void update(String fileId, AnalysisDTO data) { 90 | Objects.requireNonNull(fileId, "File ID is required!"); 91 | Objects.requireNonNull(data, "Analysis DTO is required!"); 92 | 93 | transactionControl.required(() -> { 94 | 95 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 96 | 97 | CriteriaQuery query = builder.createQuery(AnalysisEntity.class); 98 | 99 | Root from = query.from(AnalysisEntity.class); 100 | 101 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 102 | 103 | AnalysisEntity analysis = entityManager.createQuery(query).getSingleResult(); 104 | 105 | Objects.requireNonNull(analysis, "There is no analysis for file id " + fileId); 106 | 107 | analysis.setContent(data.content); 108 | 109 | entityManager.merge(analysis); 110 | 111 | LOG.debug("Updated file transcript : {}", data); 112 | 113 | return null; 114 | }); 115 | } 116 | 117 | @Override 118 | public void delete(String fileId) { 119 | Objects.requireNonNull(fileId, "File ID is required!"); 120 | 121 | transactionControl.required(() -> { 122 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 123 | 124 | CriteriaDelete query = builder.createCriteriaDelete(AnalysisEntity.class); 125 | 126 | Root from = query.from(AnalysisEntity.class); 127 | 128 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 129 | 130 | entityManager.createQuery(query).executeUpdate(); 131 | 132 | LOG.debug("Deleted File Analysis : {}", fileId); 133 | 134 | return null; 135 | }); 136 | } 137 | 138 | @Override 139 | public boolean hasAnalysis(String fileId) { 140 | Objects.requireNonNull(fileId, "File ID is required!"); 141 | 142 | return transactionControl.notSupported(() -> { 143 | 144 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 145 | 146 | CriteriaQuery query = builder.createQuery(Long.class); 147 | 148 | Root from = query.from(AnalysisEntity.class); 149 | 150 | query.select(builder.count(from)); 151 | 152 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 153 | 154 | return (entityManager.createQuery(query).getSingleResult() > 0) ? true : false; 155 | }); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /dao-impl-jpa/src/main/java/software/into/ala/dao/impl/jpa/TranscriptDaoImpl.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.dao.impl.jpa; 2 | 3 | import java.sql.SQLException; 4 | import java.util.Map; 5 | import java.util.Objects; 6 | 7 | import javax.persistence.EntityManager; 8 | import javax.persistence.criteria.CriteriaBuilder; 9 | import javax.persistence.criteria.CriteriaDelete; 10 | import javax.persistence.criteria.CriteriaQuery; 11 | import javax.persistence.criteria.Root; 12 | 13 | import org.osgi.service.component.annotations.Activate; 14 | import org.osgi.service.component.annotations.Component; 15 | import org.osgi.service.component.annotations.Reference; 16 | import org.osgi.service.transaction.control.TransactionControl; 17 | import org.osgi.service.transaction.control.jpa.JPAEntityManagerProvider; 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | import software.into.ala.dao.TranscriptDao; 22 | import software.into.ala.dao.dto.TranscriptDTO; 23 | import software.into.ala.dao.impl.jpa.entities.FileEntity; 24 | import software.into.ala.dao.impl.jpa.entities.TranscriptEntity; 25 | 26 | @Component 27 | public class TranscriptDaoImpl implements TranscriptDao { 28 | private static final Logger LOG = LoggerFactory.getLogger(TranscriptDaoImpl.class); 29 | 30 | @Reference 31 | TransactionControl transactionControl; 32 | 33 | @Reference(name = "provider") 34 | JPAEntityManagerProvider jpaEntityManagerProvider; 35 | 36 | EntityManager entityManager; 37 | 38 | @Activate 39 | void activate(Map props) throws SQLException { 40 | entityManager = jpaEntityManagerProvider.getResource(transactionControl); 41 | } 42 | 43 | @Override 44 | public TranscriptDTO select(String fileId) { 45 | Objects.requireNonNull(fileId, "File ID is required!"); 46 | 47 | return transactionControl.notSupported(() -> { 48 | 49 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 50 | 51 | CriteriaQuery query = builder.createQuery(TranscriptEntity.class); 52 | 53 | Root from = query.from(TranscriptEntity.class); 54 | 55 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 56 | 57 | TranscriptEntity tEntity = entityManager.createQuery(query).getSingleResult(); 58 | 59 | return Objects.nonNull(tEntity) ? tEntity.toDTO() : null; 60 | }); 61 | } 62 | 63 | @Override 64 | public void save(String fileId, TranscriptDTO data) { 65 | Objects.requireNonNull(fileId, "File ID is required!"); 66 | Objects.requireNonNull(data, "Transcript DTO is required!"); 67 | 68 | if (!hasTranscript(fileId)) { 69 | 70 | transactionControl.required(() -> { 71 | FileEntity file = entityManager.find(FileEntity.class, fileId); 72 | 73 | Objects.requireNonNull(file, "There is no file with id " + fileId); 74 | 75 | entityManager.merge(TranscriptEntity.fromDTO(file, data)); 76 | 77 | LOG.debug("Saved file transcript : {}", data); 78 | 79 | return null; 80 | }); 81 | 82 | } else { 83 | 84 | update(fileId, data); 85 | } 86 | } 87 | 88 | @Override 89 | public void update(String fileId, TranscriptDTO data) { 90 | Objects.requireNonNull(fileId, "File ID is required!"); 91 | Objects.requireNonNull(data, "Transcript DTO is required!"); 92 | 93 | transactionControl.required(() -> { 94 | 95 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 96 | 97 | CriteriaQuery query = builder.createQuery(TranscriptEntity.class); 98 | 99 | Root from = query.from(TranscriptEntity.class); 100 | 101 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 102 | 103 | TranscriptEntity transcript = entityManager.createQuery(query).getSingleResult(); 104 | 105 | Objects.requireNonNull(transcript, "There is no transcript for file id " + fileId); 106 | 107 | transcript.setContent(data.content); 108 | 109 | entityManager.merge(transcript); 110 | 111 | LOG.debug("Updated file transcript : {}", data); 112 | 113 | return null; 114 | }); 115 | } 116 | 117 | @Override 118 | public void delete(String fileId) { 119 | Objects.requireNonNull(fileId, "File ID is required!"); 120 | 121 | transactionControl.required(() -> { 122 | 123 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 124 | 125 | CriteriaDelete query = builder.createCriteriaDelete(TranscriptEntity.class); 126 | 127 | Root from = query.from(TranscriptEntity.class); 128 | 129 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 130 | 131 | entityManager.createQuery(query).executeUpdate(); 132 | 133 | LOG.debug("Deleted file transcript : {}", fileId); 134 | 135 | return null; 136 | }); 137 | } 138 | 139 | @Override 140 | public boolean hasTranscript(String fileId) { 141 | Objects.requireNonNull(fileId, "File ID is required!"); 142 | 143 | return transactionControl.notSupported(() -> { 144 | 145 | CriteriaBuilder builder = entityManager.getCriteriaBuilder(); 146 | 147 | CriteriaQuery query = builder.createQuery(Long.class); 148 | 149 | Root from = query.from(TranscriptEntity.class); 150 | 151 | query.select(builder.count(from)); 152 | 153 | query.where(builder.equal(from.get("file").get("fileId"), fileId)); 154 | 155 | return (entityManager.createQuery(query).getSingleResult() > 0) ? true : false; 156 | }); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /k8-infra/src/main/k8/infra-cockroachdb-statefulset.yaml: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/cockroachdb/cockroach/tree/fcc1637698fd0ec91c181bd096f963d35a16e4e8/cloud/kubernetes 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | # This service is meant to be used by clients of the database. It exposes a ClusterIP that will 6 | # automatically load balance connections to the different database pods. 7 | name: cockroachdb-public 8 | labels: 9 | app: cockroachdb 10 | spec: 11 | ports: 12 | # The main port, served by gRPC, serves Postgres-flavor SQL, internode 13 | # traffic and the cli. 14 | - port: 26257 15 | targetPort: 26257 16 | name: grpc 17 | # The secondary port serves the UI as well as health and debug endpoints. 18 | - port: 8080 19 | targetPort: 8080 20 | name: http 21 | selector: 22 | app: cockroachdb 23 | --- 24 | apiVersion: v1 25 | kind: Service 26 | metadata: 27 | # This service only exists to create DNS entries for each pod in the stateful 28 | # set such that they can resolve each other's IP addresses. It does not 29 | # create a load-balanced ClusterIP and should not be used directly by clients 30 | # in most circumstances. 31 | name: cockroachdb 32 | labels: 33 | app: cockroachdb 34 | annotations: 35 | # Use this annotation in addition to the actual publishNotReadyAddresses 36 | # field below because the annotation will stop being respected soon but the 37 | # field is broken in some versions of Kubernetes: 38 | # https://github.com/kubernetes/kubernetes/issues/58662 39 | service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" 40 | # Enable automatic monitoring of all instances when Prometheus is running in the cluster. 41 | prometheus.io/scrape: "true" 42 | prometheus.io/path: "_status/vars" 43 | prometheus.io/port: "8080" 44 | spec: 45 | ports: 46 | - port: 26257 47 | targetPort: 26257 48 | name: grpc 49 | - port: 8080 50 | targetPort: 8080 51 | name: http 52 | # We want all pods in the StatefulSet to have their addresses published for 53 | # the sake of the other CockroachDB pods even before they're ready, since they 54 | # have to be able to talk to each other in order to become ready. 55 | publishNotReadyAddresses: true 56 | clusterIP: None 57 | selector: 58 | app: cockroachdb 59 | --- 60 | apiVersion: policy/v1beta1 61 | kind: PodDisruptionBudget 62 | metadata: 63 | name: cockroachdb-budget 64 | labels: 65 | app: cockroachdb 66 | spec: 67 | selector: 68 | matchLabels: 69 | app: cockroachdb 70 | maxUnavailable: 1 71 | --- 72 | apiVersion: apps/v1beta1 73 | kind: StatefulSet 74 | metadata: 75 | name: cockroachdb 76 | spec: 77 | serviceName: "cockroachdb" 78 | # Following changed from '3' to '2' 79 | replicas: 2 80 | template: 81 | metadata: 82 | labels: 83 | app: cockroachdb 84 | spec: 85 | affinity: 86 | podAntiAffinity: 87 | preferredDuringSchedulingIgnoredDuringExecution: 88 | - weight: 100 89 | podAffinityTerm: 90 | labelSelector: 91 | matchExpressions: 92 | - key: app 93 | operator: In 94 | values: 95 | - cockroachdb 96 | topologyKey: kubernetes.io/hostname 97 | containers: 98 | - name: cockroachdb 99 | image: cockroachdb/cockroach:v2.1.6 100 | imagePullPolicy: IfNotPresent 101 | ports: 102 | - containerPort: 26257 103 | name: grpc 104 | - containerPort: 8080 105 | name: http 106 | livenessProbe: 107 | httpGet: 108 | path: "/health" 109 | port: http 110 | initialDelaySeconds: 30 111 | periodSeconds: 5 112 | readinessProbe: 113 | httpGet: 114 | path: "/health?ready=1" 115 | port: http 116 | initialDelaySeconds: 10 117 | periodSeconds: 5 118 | failureThreshold: 2 119 | volumeMounts: 120 | - name: datadir 121 | mountPath: /cockroach/cockroach-data 122 | env: 123 | - name: COCKROACH_CHANNEL 124 | value: kubernetes-insecure 125 | command: 126 | - "/bin/bash" 127 | - "-ecx" 128 | # The use of qualified `hostname -f` is crucial: 129 | # Other nodes aren't able to look up the unqualified hostname. 130 | # - "exec /cockroach/cockroach start --logtostderr --insecure --advertise-host $(hostname -f) --http-host 0.0.0.0 --join cockroachdb-0.cockroachdb,cockroachdb-1.cockroachdb,cockroachdb-2.cockroachdb --cache 25% --max-sql-memory 25%" 131 | - "exec /cockroach/cockroach start --logtostderr --insecure --advertise-host $(hostname -f) --http-host 0.0.0.0 --join cockroachdb-0.cockroachdb,cockroachdb-1.cockroachdb --cache 25% --max-sql-memory 25%" 132 | # No pre-stop hook is required, a SIGTERM plus some time is all that's 133 | # needed for graceful shutdown of a node. 134 | terminationGracePeriodSeconds: 60 135 | volumes: 136 | - name: datadir 137 | persistentVolumeClaim: 138 | claimName: datadir 139 | podManagementPolicy: Parallel 140 | updateStrategy: 141 | type: RollingUpdate 142 | volumeClaimTemplates: 143 | - metadata: 144 | name: datadir 145 | spec: 146 | accessModes: 147 | - "ReadWriteOnce" 148 | resources: 149 | requests: 150 | storage: 1Gi 151 | -------------------------------------------------------------------------------- /mono-app/mono-app.bndrun: -------------------------------------------------------------------------------- 1 | index: target/index.xml;name="mono-app" 2 | 3 | -standalone: ${index} 4 | 5 | -resolve.effective: active 6 | 7 | # Needed because the JRE has a split package for javax.transaction and a uses 8 | # constraint between javax.sql and javax.transaction. This breaks JPA unless 9 | # the JTA API is always provided from outside the OSGi framework 10 | -runpath: org.jboss.spec.javax.transaction.jboss-transaction-api_1.2_spec;version=1.0.1.Final 11 | 12 | # Hibernate has versioned imports for JTA, and its dependency dom4j has versioned 13 | # imports for the STAX API. Both of these should come from the JRE 14 | -runsystempackages: \ 15 | javax.transaction;version=1.2.0,\ 16 | javax.transaction.xa;version=1.2.0,\ 17 | javax.xml.stream;version=1.0.0,\ 18 | javax.xml.stream.events;version=1.0.0,\ 19 | javax.xml.stream.util;version=1.0.0 20 | 21 | -runproperties: \ 22 | org.osgi.framework.bootdelegation=sun.*,com.sun.*,\ 23 | logback.configurationFile=file:${.}/logback.xml 24 | 25 | -runrequires: \ 26 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-messaging-impl)',\ 27 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-transcription-impl)',\ 28 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-linguistics-impl)',\ 29 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-voiceanalysis-impl)',\ 30 | osgi.identity;filter:='(osgi.identity=software.into.ala.service-status-impl)',\ 31 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-common)',\ 32 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-voiceanalysis)',\ 33 | osgi.identity;filter:='(osgi.identity=software.into.ala.rest-status)',\ 34 | osgi.identity;filter:='(osgi.identity=software.into.ala.mono-app)',\ 35 | osgi.identity;filter:='(osgi.identity=org.apache.johnzon.core)',\ 36 | osgi.identity;filter:='(osgi.identity=org.postgresql.jdbc42)' 37 | 38 | -runfw: org.eclipse.osgi 39 | 40 | -runee: JavaSE-1.8 41 | 42 | -runbundles: \ 43 | ch.qos.logback.classic;version='[1.2.3,1.2.4)',\ 44 | ch.qos.logback.core;version='[1.2.3,1.2.4)',\ 45 | org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\ 46 | org.apache.aries.jax.rs.whiteboard;version='[1.0.1,1.0.2)',\ 47 | org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ 48 | org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\ 49 | org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ 50 | org.apache.felix.scr;version='[2.1.10,2.1.11)',\ 51 | org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\ 52 | org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\ 53 | org.osgi.util.function;version='[1.1.0,1.1.1)',\ 54 | org.osgi.util.promise;version='[1.1.0,1.1.1)',\ 55 | slf4j.api;version='[1.7.25,1.7.26)',\ 56 | software.into.ala.rest-voiceanalysis;version='[0.0.1,0.0.2)',\ 57 | com.fasterxml.classmate;version='[1.3.0,1.3.1)',\ 58 | com.rabbitmq.client;version='[5.5.0,5.5.1)',\ 59 | javassist;version='[3.20.0,3.20.1)',\ 60 | org.apache.aries.jpa.container;version='[2.7.0,2.7.1)',\ 61 | org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\ 62 | org.apache.camel.camel-core;version='[2.23.1,2.23.2)',\ 63 | org.apache.camel.camel-core-osgi;version='[2.23.1,2.23.2)',\ 64 | org.apache.camel.camel-rabbitmq;version='[2.23.1,2.23.2)',\ 65 | org.apache.camel.camel-scr;version='[2.23.1,2.23.2)',\ 66 | org.apache.commons.fileupload;version='[1.3.3,1.3.4)',\ 67 | org.apache.commons.io;version='[2.6.0,2.6.1)',\ 68 | org.apache.commons.pool;version='[1.6.0,1.6.1)',\ 69 | org.apache.felix.configurator;version='[1.0.6,1.0.7)',\ 70 | org.apache.johnzon.core;version='[1.1.0,1.1.1)',\ 71 | org.apache.servicemix.bundles.antlr;version='[2.7.7,2.7.8)',\ 72 | org.apache.servicemix.bundles.dom4j;version='[1.6.1,1.6.2)',\ 73 | org.apache.servicemix.specs.json-api-1.1;version='[2.9.0,2.9.1)',\ 74 | org.hibernate.common.hibernate-commons-annotations;version='[5.0.1,5.0.2)',\ 75 | org.hibernate.core;version='[5.2.12,5.2.13)',\ 76 | org.hibernate.osgi;version='[5.2.12,5.2.13)',\ 77 | org.jboss.jandex;version='[2.0.3,2.0.4)',\ 78 | org.jboss.logging.jboss-logging;version='[3.3.0,3.3.1)',\ 79 | org.osgi.service.event;version='[1.4.0,1.4.1)',\ 80 | org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\ 81 | org.osgi.util.converter;version='[1.0.0,1.0.1)',\ 82 | org.osgi.util.pushstream;version='[1.0.0,1.0.1)',\ 83 | org.postgresql.jdbc42;version='[42.2.5,42.2.6)',\ 84 | software.into.ala.dao-api;version='[0.0.1,0.0.2)',\ 85 | software.into.ala.dao-impl-jpa;version='[0.0.1,0.0.2)',\ 86 | software.into.ala.mono-app;version='[0.0.1,0.0.2)',\ 87 | software.into.ala.rest-common;version='[0.0.1,0.0.2)',\ 88 | software.into.ala.rest-status;version='[0.0.1,0.0.2)',\ 89 | software.into.ala.service-voiceanalysis-impl;version='[0.0.1,0.0.2)',\ 90 | software.into.ala.service-linguistics-impl;version='[0.0.1,0.0.2)',\ 91 | software.into.ala.service-messaging-api;version='[0.0.1,0.0.2)',\ 92 | software.into.ala.service-messaging-dto;version='[0.0.1,0.0.2)',\ 93 | software.into.ala.service-messaging-impl;version='[0.0.1,0.0.2)',\ 94 | software.into.ala.service-status-api;version='[0.0.1,0.0.2)',\ 95 | software.into.ala.service-status-impl;version='[0.0.1,0.0.2)',\ 96 | software.into.ala.service-transcription-impl;version='[0.0.1,0.0.2)',\ 97 | tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)',\ 98 | tx-control-service-xa;version='[1.0.0,1.0.1)',\ 99 | software.into.ala.service-linguistics-api;version='[0.0.1,0.0.2)',\ 100 | software.into.ala.service-transcription-api;version='[0.0.1,0.0.2)',\ 101 | software.into.ala.service-voiceanalysis-api;version='[0.0.1,0.0.2)' -------------------------------------------------------------------------------- /k8-web-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | main 8 | software.into.ala 9 | 0.0.1-SNAPSHOT 10 | ../pom.xml 11 | 12 | 13 | k8-web-app 14 | 15 | Automated Linguistic Analysis (ALA) - K8 web application 16 | 17 | 18 | 19 | org.osgi.enroute 20 | osgi-api 21 | pom 22 | 23 | 24 | org.osgi.enroute 25 | impl-index 26 | pom 27 | 28 | 29 | org.osgi.enroute 30 | debug-bundles 31 | pom 32 | 33 | 34 | software.into.ala 35 | rest-common 36 | 0.0.1-SNAPSHOT 37 | 38 | 39 | software.into.ala 40 | rest-voiceanalysis 41 | 0.0.1-SNAPSHOT 42 | 43 | 44 | software.into.ala 45 | rest-status 46 | 0.0.1-SNAPSHOT 47 | 48 | 49 | software.into.ala 50 | dao-impl-jpa 51 | 0.0.1-SNAPSHOT 52 | 53 | 54 | software.into.ala 55 | service-messaging-impl 56 | 0.0.1-SNAPSHOT 57 | 58 | 59 | software.into.ala 60 | service-voiceanalysis-impl 61 | 0.0.1-SNAPSHOT 62 | 63 | 64 | software.into.ala 65 | service-status-impl 66 | 0.0.1-SNAPSHOT 67 | 68 | 69 | software.into.ala 70 | k8-common 71 | 0.0.1-SNAPSHOT 72 | 73 | 74 | org.apache.johnzon 75 | johnzon-core 76 | ${johnzon.version} 77 | 78 | 79 | org.postgresql 80 | postgresql 81 | ${postgresql.version} 82 | runtime 83 | 84 | 85 | org.hibernate 86 | hibernate-osgi 87 | ${hibernate.version} 88 | 89 | 91 | 92 | org.apache.servicemix.bundles 93 | org.apache.servicemix.bundles.antlr 94 | ${hibernate.antlr.version} 95 | 96 | 97 | org.apache.servicemix.bundles 98 | org.apache.servicemix.bundles.dom4j 99 | ${hibernate.dom4j.version} 100 | 101 | 102 | org.apache.camel 103 | camel-scr 104 | ${camel.version} 105 | 106 | 107 | org.apache.camel 108 | camel-rabbitmq 109 | ${camel.version} 110 | 111 | 112 | 113 | 114 | 115 | 116 | biz.aQute.bnd 117 | bnd-maven-plugin 118 | 119 | 120 | biz.aQute.bnd 121 | bnd-indexer-maven-plugin 122 | 123 | true 124 | 125 | 126 | 127 | biz.aQute.bnd 128 | bnd-export-maven-plugin 129 | 130 | 131 | k8-web-app.bndrun 132 | 133 | 134 | 135 | 136 | 137 | biz.aQute.bnd 138 | bnd-resolver-maven-plugin 139 | 140 | 141 | k8-web-app.bndrun 142 | debug.bndrun 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | k8 155 | 156 | 157 | 158 | com.github.deanjameseverett 159 | k8-maven-plugin 160 | 161 | 162 | cluster 163 | 164 | 165 | k8-web-app.yaml 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /rest-common/src/main/java/software/into/ala/rest/common/JsonConverter.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.rest.common; 2 | 3 | import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 4 | import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE; 5 | import static org.osgi.service.component.annotations.ServiceScope.PROTOTYPE; 6 | import static org.osgi.util.converter.ConverterFunction.CANNOT_HANDLE; 7 | 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | import java.io.OutputStream; 11 | import java.lang.annotation.Annotation; 12 | import java.lang.reflect.Type; 13 | import java.math.BigDecimal; 14 | import java.math.BigInteger; 15 | import java.util.Collection; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | import javax.json.Json; 20 | import javax.json.JsonArray; 21 | import javax.json.JsonArrayBuilder; 22 | import javax.json.JsonNumber; 23 | import javax.json.JsonObject; 24 | import javax.json.JsonObjectBuilder; 25 | import javax.json.JsonReader; 26 | import javax.json.JsonString; 27 | import javax.json.JsonStructure; 28 | import javax.json.JsonValue; 29 | import javax.json.JsonValue.ValueType; 30 | import javax.json.JsonWriter; 31 | import javax.ws.rs.WebApplicationException; 32 | import javax.ws.rs.core.MediaType; 33 | import javax.ws.rs.core.MultivaluedMap; 34 | import javax.ws.rs.ext.MessageBodyReader; 35 | import javax.ws.rs.ext.MessageBodyWriter; 36 | 37 | import org.osgi.service.component.annotations.Component; 38 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsExtension; 39 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsMediaType; 40 | import org.osgi.util.converter.Converter; 41 | import org.osgi.util.converter.Converters; 42 | import org.osgi.util.converter.TypeReference; 43 | 44 | @Component(scope = PROTOTYPE) 45 | @JaxrsExtension 46 | @JaxrsMediaType(APPLICATION_JSON) 47 | public class JsonConverter implements MessageBodyReader, MessageBodyWriter { 48 | private final Converter converter = Converters.newConverterBuilder().rule(JsonValue.class, this::toJsonValue) 49 | .rule(this::toScalar).build(); 50 | 51 | private JsonValue toJsonValue(Object value, Type targetType) { 52 | if (value == null) { 53 | return JsonValue.NULL; 54 | } else if (value instanceof String) { 55 | return Json.createValue(value.toString()); 56 | } else if (value instanceof Enum) { 57 | return Json.createValue(((Enum) value).name().toString()); 58 | } else if (value instanceof Boolean) { 59 | return ((Boolean) value) ? JsonValue.TRUE : JsonValue.FALSE; 60 | } else if (value instanceof Number) { 61 | Number n = (Number) value; 62 | if (value instanceof Float || value instanceof Double) { 63 | return Json.createValue(n.doubleValue()); 64 | } else if (value instanceof BigDecimal) { 65 | return Json.createValue((BigDecimal) value); 66 | } else if (value instanceof BigInteger) { 67 | return Json.createValue((BigInteger) value); 68 | } else { 69 | return Json.createValue(n.longValue()); 70 | } 71 | } else if (value instanceof Collection || value.getClass().isArray()) { 72 | return toJsonArray(value); 73 | } else { 74 | return toJsonObject(value); 75 | } 76 | } 77 | 78 | private JsonArray toJsonArray(Object o) { 79 | List l = converter.convert(o).to(List.class); 80 | 81 | JsonArrayBuilder builder = Json.createArrayBuilder(); 82 | l.forEach(v -> builder.add(toJsonValue(v, JsonValue.class))); 83 | return builder.build(); 84 | } 85 | 86 | private JsonObject toJsonObject(Object o) { 87 | 88 | Map m = converter.convert(o).to(new TypeReference>() { 89 | }); 90 | 91 | JsonObjectBuilder jsonBuilder = Json.createObjectBuilder(); 92 | m.entrySet().stream().forEach(e -> jsonBuilder.add(e.getKey(), toJsonValue(e.getValue(), JsonValue.class))); 93 | return jsonBuilder.build(); 94 | } 95 | 96 | private Object toScalar(Object o, Type t) { 97 | 98 | if (o instanceof JsonNumber) { 99 | JsonNumber jn = (JsonNumber) o; 100 | return converter.convert(jn.bigDecimalValue()).to(t); 101 | } else if (o instanceof JsonString) { 102 | JsonString js = (JsonString) o; 103 | return converter.convert(js.getString()).to(t); 104 | } else if (o instanceof JsonValue) { 105 | JsonValue jv = (JsonValue) o; 106 | if (jv.getValueType() == ValueType.NULL) { 107 | return null; 108 | } else if (jv.getValueType() == ValueType.TRUE) { 109 | return converter.convert(Boolean.TRUE).to(t); 110 | } else if (jv.getValueType() == ValueType.FALSE) { 111 | return converter.convert(Boolean.FALSE).to(t); 112 | } 113 | } 114 | return CANNOT_HANDLE; 115 | } 116 | 117 | @Override 118 | public boolean isWriteable(Class c, Type t, Annotation[] a, MediaType mediaType) { 119 | return APPLICATION_JSON_TYPE.isCompatible(mediaType) || mediaType.getSubtype().endsWith("+json"); 120 | } 121 | 122 | @Override 123 | public boolean isReadable(Class c, Type t, Annotation[] a, MediaType mediaType) { 124 | return APPLICATION_JSON_TYPE.isCompatible(mediaType) || mediaType.getSubtype().endsWith("+json"); 125 | } 126 | 127 | @Override 128 | public void writeTo(T o, Class arg1, Type arg2, Annotation[] arg3, MediaType arg4, 129 | MultivaluedMap arg5, OutputStream out) 130 | throws IOException, WebApplicationException { 131 | 132 | JsonValue jv = converter.convert(o).to(JsonValue.class); 133 | 134 | try (JsonWriter jw = Json.createWriter(out)) { 135 | jw.write(jv); 136 | } 137 | } 138 | 139 | @SuppressWarnings("unchecked") 140 | @Override 141 | public T readFrom(Class arg0, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap arg4, 142 | InputStream in) throws IOException, WebApplicationException { 143 | 144 | try (JsonReader jr = Json.createReader(in)) { 145 | JsonStructure read = jr.read(); 146 | return (T) converter.convert(read).to(arg1); 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /service-status-impl/src/main/java/software/into/ala/service/status/impl/StatusUpdatesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.service.status.impl; 2 | 3 | import java.util.Objects; 4 | import java.util.concurrent.ExecutorService; 5 | import java.util.concurrent.Executors; 6 | 7 | import org.apache.camel.CamelContext; 8 | import org.apache.camel.ConsumerTemplate; 9 | import org.apache.camel.Endpoint; 10 | import org.osgi.service.component.annotations.Activate; 11 | import org.osgi.service.component.annotations.Component; 12 | import org.osgi.service.component.annotations.Deactivate; 13 | import org.osgi.service.component.annotations.Reference; 14 | import org.osgi.service.component.annotations.ReferenceCardinality; 15 | import org.osgi.service.component.annotations.ReferencePolicy; 16 | import org.osgi.service.component.annotations.ServiceScope; 17 | import org.osgi.util.pushstream.PushStream; 18 | import org.osgi.util.pushstream.PushStreamProvider; 19 | import org.osgi.util.pushstream.SimplePushEventSource; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | import software.into.ala.dao.FileDao; 24 | import software.into.ala.dao.dto.FileDTO; 25 | import software.into.ala.dao.dto.FileProcessingStatus; 26 | import software.into.ala.service.messaging.MessagingService; 27 | import software.into.ala.service.messaging.dto.FileMessageDTO; 28 | import software.into.ala.service.status.StatusUpdatesService; 29 | 30 | @Component(scope = ServiceScope.PROTOTYPE) 31 | public class StatusUpdatesServiceImpl implements StatusUpdatesService { 32 | private static final Logger LOG = LoggerFactory.getLogger(StatusUpdatesServiceImpl.class); 33 | 34 | private PushStreamProvider pushStreamProvider; 35 | private SimplePushEventSource simplePushEventSource; 36 | private ExecutorService fileProcessingStatusConsumerExec; 37 | 38 | @Reference 39 | private MessagingService messagingService; 40 | 41 | @Reference 42 | private FileDao fileDao; 43 | 44 | @Reference(name = "camelContext", service = CamelContext.class, cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, bind = "setCamelContext", unbind = "unsetCamelContext") 45 | private CamelContext camelContext; 46 | 47 | @Activate 48 | protected void activate() { 49 | this.pushStreamProvider = new PushStreamProvider(); 50 | this.simplePushEventSource = pushStreamProvider.createSimpleEventSource(FileMessageDTO.class); 51 | this.fileProcessingStatusConsumerExec = Executors.newSingleThreadExecutor(); 52 | } 53 | 54 | @Deactivate 55 | protected void deactivate() { 56 | this.simplePushEventSource.close(); 57 | if (!fileProcessingStatusConsumerExec.isShutdown()) { 58 | this.fileProcessingStatusConsumerExec.shutdown(); 59 | } 60 | } 61 | 62 | @Override 63 | public PushStream getStatusUpdates(String fileId) { 64 | Objects.requireNonNull(fileId, "File ID must be specified!"); 65 | 66 | LOG.debug("Starting processing status consumer for file ID: " + fileId); 67 | fileProcessingStatusConsumerExec.execute(new StatusUpdatesConsumer(fileId)); 68 | 69 | LOG.debug("Creating processing status stream for file ID: " + fileId); 70 | return pushStreamProvider.createStream(simplePushEventSource).map(fmDTO -> fmDTO.status); 71 | } 72 | 73 | @Override 74 | public boolean hasStatusUpdates(String fileId) { 75 | Objects.requireNonNull(fileId, "File ID must be specified!"); 76 | 77 | if (fileDao.exists(fileId)) { 78 | return !isProcessingFinished(fileDao.findById(fileId)); 79 | } 80 | 81 | return false; 82 | } 83 | 84 | private class StatusUpdatesConsumer implements Runnable { 85 | private String fileId; 86 | 87 | public StatusUpdatesConsumer(String fileId) { 88 | Objects.requireNonNull(fileId, "File ID must be specified!"); 89 | 90 | LOG.debug("Creating new instance for file ID: " + fileId); 91 | 92 | this.fileId = fileId; 93 | } 94 | 95 | @Override 96 | public void run() { 97 | 98 | try { 99 | 100 | ConsumerTemplate consumerTemplate = getCamelContext().createConsumerTemplate(); 101 | 102 | Endpoint endpoint = messagingService.registerStatusUpdatesEndpoint(fileId); 103 | 104 | FileMessageDTO fmDTO = consumerTemplate.receiveBody(endpoint, FileMessageDTO.class); 105 | LOG.debug("Received message: " + fmDTO); 106 | 107 | while (fmDTO != null) { 108 | 109 | LOG.debug("Publishing message: " + fmDTO); 110 | 111 | simplePushEventSource.publish(fmDTO); 112 | 113 | if (isProcessingFinished(fmDTO)) { 114 | LOG.debug("Processing is finished!"); 115 | break; 116 | } 117 | 118 | LOG.debug("Awaiting new message..."); 119 | 120 | fmDTO = consumerTemplate.receiveBody(endpoint, FileMessageDTO.class); 121 | 122 | LOG.debug("Received new message: " + fmDTO); 123 | } 124 | 125 | LOG.debug("Cleaning up.."); 126 | consumerTemplate.cleanUp(); 127 | 128 | LOG.debug("Closing stream.."); 129 | simplePushEventSource.endOfStream(); 130 | 131 | } catch (Exception e) { 132 | LOG.error(e.getMessage()); 133 | simplePushEventSource.error(e); 134 | } 135 | } 136 | } 137 | 138 | private boolean isProcessingFinished(FileMessageDTO fmDTO) { 139 | Objects.requireNonNull(fmDTO, "File must be specified!"); 140 | 141 | boolean isProcessingFinished = Objects.nonNull(fmDTO.status) 142 | ? (FileProcessingStatus.analysis_ready == FileProcessingStatus.valueOf(fmDTO.status) 143 | || FileProcessingStatus.analysis_failed == FileProcessingStatus.valueOf(fmDTO.status)) 144 | : false; 145 | 146 | return isProcessingFinished; 147 | } 148 | 149 | private boolean isProcessingFinished(FileDTO fDTO) { 150 | Objects.requireNonNull(fDTO, "File must be specified!"); 151 | 152 | boolean isProcessingFinished = Objects.nonNull(fDTO.status) 153 | ? (FileProcessingStatus.analysis_ready == fDTO.status 154 | || FileProcessingStatus.analysis_failed == fDTO.status) 155 | : false; 156 | 157 | return isProcessingFinished; 158 | } 159 | 160 | void setCamelContext(CamelContext camelContext) { 161 | this.camelContext = camelContext; 162 | } 163 | 164 | void unsetCamelContext(CamelContext camelContext) { 165 | this.camelContext = null; 166 | } 167 | 168 | private CamelContext getCamelContext() { 169 | return camelContext; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /rest-voiceanalysis/src/main/java/software/into/ala/rest/voiceanalysis/VoiceAnalysisRestController.java: -------------------------------------------------------------------------------- 1 | package software.into.ala.rest.voiceanalysis; 2 | 3 | import java.util.Map; 4 | import java.util.Objects; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.ws.rs.Consumes; 8 | import javax.ws.rs.GET; 9 | import javax.ws.rs.POST; 10 | import javax.ws.rs.Path; 11 | import javax.ws.rs.PathParam; 12 | import javax.ws.rs.Produces; 13 | import javax.ws.rs.core.Context; 14 | import javax.ws.rs.core.MediaType; 15 | import javax.ws.rs.core.Response; 16 | 17 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 18 | import org.osgi.service.component.annotations.Activate; 19 | import org.osgi.service.component.annotations.Component; 20 | import org.osgi.service.component.annotations.ConfigurationPolicy; 21 | import org.osgi.service.component.annotations.Reference; 22 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JSONRequired; 23 | import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsResource; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import software.into.ala.dao.dto.AnalysisDTO; 28 | import software.into.ala.dao.dto.FileDTO; 29 | import software.into.ala.dao.dto.TranscriptDTO; 30 | import software.into.ala.service.voiceanalysis.VoiceAnalysisService; 31 | 32 | @Component(service = VoiceAnalysisRestController.class, configurationPid = { 33 | "org.apache.aries.jax.rs.whiteboard.default" }, configurationPolicy = ConfigurationPolicy.REQUIRE) 34 | @JaxrsResource 35 | @Path("voiceanalysis") 36 | @Produces(MediaType.APPLICATION_JSON) 37 | @JSONRequired 38 | public class VoiceAnalysisRestController { 39 | private static final Logger LOG = LoggerFactory.getLogger(VoiceAnalysisRestController.class); 40 | 41 | @Reference 42 | private VoiceAnalysisService analysisService; 43 | 44 | private Map configuration; 45 | 46 | @Activate 47 | protected void activate(Map configuration) { 48 | this.configuration = configuration; 49 | } 50 | 51 | @POST 52 | @Consumes(MediaType.MULTIPART_FORM_DATA) 53 | public Response submitForAnalysis(@Context HttpServletRequest request) { 54 | LOG.debug("Called ::submitForAnalysis"); 55 | 56 | String fileStorageLocation = getFileStorageLocation(); 57 | if (Objects.isNull(fileStorageLocation)) { 58 | return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); 59 | } 60 | 61 | if (!isRequestMultipart(request)) { 62 | return Response.status(Response.Status.BAD_REQUEST).build(); 63 | } 64 | 65 | if (!isRequestSizeValid(request)) { 66 | return Response.status(Response.Status.REQUEST_ENTITY_TOO_LARGE).build(); 67 | } 68 | 69 | FileDTO fileDTO = new FileDTO(); 70 | 71 | try { 72 | 73 | ServletFileUpload fileUpload = new ServletFileUpload(); 74 | 75 | fileDTO = analysisService.handleSubmitForAnalysis(fileStorageLocation, fileUpload.getItemIterator(request)); 76 | 77 | return Response.status(Response.Status.CREATED).entity(fileDTO).build(); 78 | 79 | } catch (Throwable t) { 80 | LOG.error(t.getMessage()); 81 | 82 | if (t instanceof IllegalStateException) { 83 | return Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).entity(t.getMessage()).build(); 84 | } else if (t instanceof NullPointerException) { 85 | return Response.status(Response.Status.BAD_REQUEST).entity(t.getMessage()).build(); 86 | } else { 87 | return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(t.getMessage()).build(); 88 | } 89 | } 90 | } 91 | 92 | @GET 93 | @Path("{fileId}") 94 | public Response retrieveFile(@PathParam("fileId") String fileId) { 95 | Objects.requireNonNull(fileId, "File ID must be specified!"); 96 | 97 | LOG.debug("Called ::retrieveFile with fileId: " + fileId); 98 | 99 | FileDTO file = analysisService.handleRetrieveFile(fileId); 100 | if (file != null) { 101 | LOG.info("Found file with ID: " + file); 102 | 103 | return Response.status(Response.Status.OK).entity(file).build(); 104 | 105 | } else { 106 | LOG.info("Could not find analysis with ID: " + fileId); 107 | 108 | return Response.status(Response.Status.NOT_FOUND).build(); 109 | } 110 | } 111 | 112 | @GET 113 | @Path("{fileId}/transcript") 114 | public Response retrieveTranscript(@PathParam("fileId") String fileId) { 115 | Objects.requireNonNull(fileId, "File ID must be specified!"); 116 | 117 | LOG.debug("Called ::retrieveTranscript with fileId: " + fileId); 118 | 119 | TranscriptDTO transcript = analysisService.handleRetrieveTranscript(fileId); 120 | if (transcript != null) { 121 | LOG.info("Found transcript for file ID: " + fileId); 122 | 123 | return Response.status(Response.Status.OK).entity(transcript).build(); 124 | 125 | } else { 126 | LOG.info("Could not find transcript for file ID: " + fileId); 127 | 128 | return Response.status(Response.Status.NOT_FOUND).build(); 129 | } 130 | } 131 | 132 | @GET 133 | @Path("{fileId}/analysis") 134 | public Response retrieveAnalysis(@PathParam("fileId") String fileId) { 135 | Objects.requireNonNull(fileId, "File ID must be specified!"); 136 | 137 | LOG.debug("Called ::retrieveAnalysis with fileId: " + fileId); 138 | 139 | AnalysisDTO analysis = analysisService.handleRetrieveAnalysis(fileId); 140 | if (analysis != null) { 141 | LOG.info("Found analysis for file ID: " + fileId); 142 | 143 | return Response.status(Response.Status.OK).entity(analysis).build(); 144 | 145 | } else { 146 | LOG.info("Could not find analysis for file ID: " + fileId); 147 | 148 | return Response.status(Response.Status.NOT_FOUND).build(); 149 | } 150 | } 151 | 152 | private boolean isRequestSizeValid(@Context HttpServletRequest request) { 153 | boolean isRequestSizeValid = false; 154 | 155 | long rContentLength = request.getContentLengthLong(); 156 | LOG.debug("Request content type length is: " + rContentLength); 157 | 158 | long maxRequestSize = getMaxRequestSize(); 159 | LOG.debug("Max request size is: " + maxRequestSize); 160 | 161 | if (rContentLength <= maxRequestSize) { 162 | isRequestSizeValid = true; 163 | } 164 | 165 | return isRequestSizeValid; 166 | } 167 | 168 | private boolean isRequestMultipart(@Context HttpServletRequest request) { 169 | return ServletFileUpload.isMultipartContent(request); 170 | } 171 | 172 | private String getFileStorageLocation() { 173 | return (String) configuration.get("osgi.http.whiteboard.servlet.multipart.location"); 174 | } 175 | 176 | private long getMaxRequestSize() { 177 | return ((Long) configuration.get("osgi.http.whiteboard.servlet.multipart.maxRequestSize")).longValue(); 178 | } 179 | } 180 | --------------------------------------------------------------------------------