Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

package com.evolveum.midpoint.integration.catalog;

import ch.qos.logback.classic.Logger;
import com.evolveum.midpoint.integration.catalog.configuration.GithubProperties;
import com.evolveum.midpoint.integration.catalog.configuration.JenkinsProperties;
import com.evolveum.midpoint.integration.catalog.repository.ApplicationRepository;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -23,9 +25,13 @@ public static void main(String[] args) {
SpringApplication.run(IntegrationCatalogApplication.class, args);
}

private static final Logger LOG
= (Logger) LoggerFactory.getLogger(IntegrationCatalogApplication.class);

//check if DB is connected - 0=fine
@Bean
CommandLineRunner pingDb(ApplicationRepository repo) {
return args -> System.out.println("✅ Applications in DB: " + repo.count());
LOG.info("Applications in DB: " + repo.count());
return args -> System.out.println("Applications in DB: " + repo.count());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package com.evolveum.midpoint.integration.catalog.service;

import ch.qos.logback.classic.Logger;
import com.evolveum.midpoint.integration.catalog.IntegrationCatalogApplication;
import com.evolveum.midpoint.integration.catalog.dto.*;
import com.evolveum.midpoint.integration.catalog.common.ItemFile;
import com.evolveum.midpoint.integration.catalog.mapper.ApplicationMapper;
Expand All @@ -23,6 +25,7 @@

import lombok.extern.slf4j.Slf4j;
import org.kohsuke.github.GHRepository;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand Down Expand Up @@ -53,6 +56,9 @@
@Service
public class ApplicationService {

private static final Logger LOG
= (Logger) LoggerFactory.getLogger(ApplicationService.class);

private static final long DOWNLOAD_OFFSET_SECONDS = 10;

@Autowired
Expand Down Expand Up @@ -601,6 +607,7 @@ public byte[] downloadConnector(UUID versionId, String ip, String userAgent) thr
version.getBundleVersion().getDownloadLink() : null;

if (downloadLink == null || downloadLink.isEmpty()) {

throw new IllegalArgumentException("No download link available for version: " + versionId);
}

Expand Down Expand Up @@ -748,6 +755,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) {

if (connectorBundle.isEmpty()) {
err = "No bundle found containing the connector Implementation version with OID " + implementationVersionId + ".";

throw new ResponseStatusException(HttpStatus.NOT_FOUND, err);
}

Expand Down Expand Up @@ -804,6 +812,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) {
} catch (Exception e) {

err = e.getLocalizedMessage();
LOG.error(err);
sourceImplementationVersion.setErrorMessage(err);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, err);
}
Expand All @@ -819,6 +828,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) {
} catch (Exception e) {

err = e.getLocalizedMessage();
LOG.error(err);
sourceImplementationVersion.setErrorMessage(err);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, err);
}
Expand Down Expand Up @@ -851,6 +861,8 @@ public void moveImplVersionAndDeleteConnectorBundle(ConnectorBundle sourceBundle
BundleVersion targetBundleVersion, ImplementationVersion sourceImplementationVersion) {

if (sourceBundle.getBundleName() != null && !sourceBundle.getBundleName().isEmpty()) {
LOG.error("Illegal state of connector bundle. Bundle already contains implementation version " +
"which is being verified");

throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Illegal state of connector" +
" bundle. Bundle already contains implementation version which is being verified");
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

_____ _ _ _ _____ _ _
|_ _| | | | | (_) / ____| | | | |
| | _ __ | |_ ___ __ _ _ __ __ _| |_ _ ___ _ __ | | __ _| |_ __ _| | ___ __ _
| | | '_ \| __/ _ \/ _` | '__/ _` | __| |/ _ \| '_ \ | | / _` | __/ _` | |/ _ \ / _` |
_| |_| | | | || __/ (_| | | | (_| | |_| | (_) | | | | | |___| (_| | || (_| | | (_) | (_| |
|_____|_| |_|\__\___|\__, |_| \__,_|\__|_|\___/|_| |_| \_____\__,_|\__\__,_|_|\___/ \__, |
__/ | __/ |
|___/ |___/ by Evolveum and partners

Licensed under the EUPL-1.2 or later.
Version: ${project.version}
Sources: https://github.com/Evolveum/integration-catalog, branch: ${git.branch}, build: ${git.describe}
Bug reporting system: ${project.issueManagement.url}
Product information: https://midpoint.evolveum.com
35 changes: 35 additions & 0 deletions src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n</Pattern>
</layout>
</appender>

<appender name="time-file-appender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>integration-catalog.log</file>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>app.%d{yyyy-MM-dd-mm}.%i.log.zip</fileNamePattern>
<maxHistory>20</maxHistory>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>10MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n</pattern>
</encoder>

</appender>


<root level="INFO">
<appender-ref ref="stdout"/>
<!-- <appender-ref ref="time-file-appender"/>-->
</root>

<logger name="com.evolveum.midpoint.integration.catalog" level="DEBUG">
<appender-ref ref="time-file-appender" />
</logger>

</configuration>