Commit e9f53ab5 authored by Brian Long's avatar Brian Long
Browse files

initial commit

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+9 −0
Original line number Diff line number Diff line
# Eclipse
.project
.classpath
.settings

# Maven
target
pom.xml.versionsBackup

pom.xml

0 → 100644
+103 −0
Original line number Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>com.inteligr8.alfresco</groupId>
    <artifactId>pdfmeta-tengine</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    
    <name>pdfmeta Alfresco T-Engine</name>

    <properties>
    	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	<maven.compiler.source>8</maven.compiler.source>
    	<maven.compiler.target>8</maven.compiler.target>
    	
    	<ats.version>2.3.6</ats.version>
    	<spring-boot.version>2.3.5.RELEASE</spring-boot.version>
    	
        <docker.image.registry>docker.inteligr8.com</docker.image.registry>
        <docker.image.name>inteligr8/${project.artifactId}</docker.image.name>
        <docker.image.tag>${project.version}</docker.image.tag>
        <ate.app.className>com.inteligr8.alfresco.pdfmeta.Application</ate.app.className>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.inteligr8.ootbee</groupId>
            <artifactId>beedk-ate-springboot</artifactId>
            <version>[1.0.0,2.0.0)</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-transform-tika</artifactId>
            <version>${ats.version}</version>
        </dependency>
        <dependency>
            <groupId>com.inteligr8.ootbee</groupId>
            <artifactId>beedk-ate-springboot-test</artifactId>
            <version>[1.0.0,2.0.0)</version>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.13.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
		<plugins>
			<plugin>
				<groupId>io.repaint.maven</groupId>
				<artifactId>tiles-maven-plugin</artifactId>
				<version>2.26</version>
				<extensions>true</extensions>
				<configuration>
					<tiles>
                        <!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-ate-springboot-tile -->
						<tile>com.inteligr8.ootbee:beedk-ate-springboot-tile:[1.0.0,2.0.0)</tile>
                        <!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-ate-docker-tile -->
						<tile>com.inteligr8.ootbee:beedk-ate-docker-tile:[1.0.0,2.0.0)</tile>
						
						<!-- Enables rapid application development support -->
						<tile>com.inteligr8.ootbee:beedk-ate-self-rad-tile:[1.0.0,2.0.0)</tile>
					</tiles>
				</configuration>
			</plugin>
		</plugins>
    </build>
    
    <repositories>
        <repository>
            <id>inteligr8-releases</id>
            <url>http://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
            <snapshots>
            	<enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>inteligr8-snapshots</id>
            <url>http://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
            <releases>
            	<enabled>false</enabled>
            </releases>
        </repository>
        <repository>
            <id>alfresco-public</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>inteligr8-releases</id>
            <url>http://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
        </pluginRepository>
    </pluginRepositories>
</project>
+28 −0
Original line number Diff line number Diff line

FROM docker.inteligr8.com/inteligr8/ubuntu-jdk:20.04-11

# Set default user information
ARG JAR_FILE
ARG APPGROUPNAME=alfresco
ARG APPGROUPID=1000
ARG APPUSERNAME=atengine
ARG APPUSERID=33001

ENV JAVA_OPTS="-Xmx128m"
ENV JAR_PATH=/usr/local/bin/${project.artifactId}.jar

COPY ${JAR_FILE} ${JAR_PATH}

# Install your engine's dependencies here
#RUN apt update && \
#	apt -y install {dependency names in APT repository}

RUN groupadd -g ${APPGROUPID} ${APPGROUPNAME} && \
    useradd -u ${APPUSERID} -G ${APPGROUPNAME} ${APPUSERNAME} && \
    chown ${APPUSERNAME}:${APPGROUPNAME} ${JAR_PATH}

EXPOSE 8090

USER ${APPUSERNAME}

ENTRYPOINT java ${JAVA_OPTS} -jar ${JAR_PATH}
+67 −0
Original line number Diff line number Diff line
/*
 * #%L
 * Alfresco Transform Core
 * %%
 * Copyright (C) 2005 - 2020 Alfresco Software Limited
 * %%
 * This file is part of the Alfresco software.
 * -
 * If the software was purchased under a paid Alfresco license, the terms of
 * the paid license agreement will prevail.  Otherwise, the software is
 * provided under the following open source license terms:
 * -
 * Alfresco is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * -
 * Alfresco is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * -
 * You should have received a copy of the GNU Lesser General Public License
 * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
 * #L%
 */
package com.inteligr8.alfresco.pdfmeta;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.event.EventListener;

import io.micrometer.core.instrument.MeterRegistry;

@SpringBootApplication
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
@ImportResource({"classpath*:application-context.xml"})
public class Application {
	
	private final Logger logger = LoggerFactory.getLogger(Application.class);

	@Value("${container.name}")
	private String containerName;

	@Bean
	public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
		return registry -> registry.config().commonTags("containerName", this.containerName);
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	@EventListener(ApplicationReadyEvent.class)
	public void startup() {
		this.logger.info("Starting application components... Done");
	}
}
+37 −0
Original line number Diff line number Diff line
package com.inteligr8.alfresco.pdfmeta;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.inteligr8.alfresco.pdfmeta.util.DynamicDiscoveryMap;

public class AutoPropertyMappingWrapper extends DynamicDiscoveryMap<String, Set<String>> {
	
	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	public AutoPropertyMappingWrapper(Map<String, Set<String>> map) {
		super(map);
	}
	
	@Override
	protected void discoverExtraEntry(String key) {
		this.logger.trace("Looking up key as ACS property: {}", key);
		
		int colon = key != null ? key.indexOf(':') : -1;
		if (colon < 0) {
			// key is not formatted like an ACS property
			this.nullKeys.add(key);
		} else if (key.indexOf(':', colon+1) < 0) {
			logger.debug("Adding key/property to mapping: {}", key);
			this.extMap.put(key, Collections.singleton(key));
		} else {
			// 2 colons; not formatted like an ACS property
			this.nullKeys.add(key);
		}
	}

}
Loading