Skip to content

Commit

Permalink
Merge branch 'master' into add-data-source-support
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/aem/install/src/main/java/com/cognifide/apm/install/launchers/ApmInstallService.java
  • Loading branch information
dprzybyl committed Oct 21, 2023
2 parents f789da3 + cb12bc8 commit 7a23614
Show file tree
Hide file tree
Showing 61 changed files with 977 additions and 313 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Below is short list of things that will help us maintaining APM quality and acce
- update [documentation](https://github.com/wttech/apm/tree/master/documentation) and include changes in the same pull request which modifies the code,
- when committing an improvement, try to show it in local demo example,
- when logging use proper levels: `INFO` and `WARNING` should log only very important messages.
- to generate getters and setters use [Lombok](https://projectlombok.org/). Plugins available both on Eclipse & Intellij IDE

## Mailing List
To get notification about build changes add your email to .travis.yml in email section. More configuration for notification available in [documentation](https://docs.travis-ci.com/user/notifications#Email-notifications)
3 changes: 0 additions & 3 deletions app/aem/actions.main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ aem {

dependencies {
implementation(project(":app:aem:api"))

compileOnly("org.projectlombok:lombok:1.18.8")
annotationProcessor("org.projectlombok:lombok:1.18.8")
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@

import java.math.BigInteger;
import java.security.SecureRandom;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class RandomPasswordGenerator {

private static final int MAX_BITS = 130;
Expand All @@ -33,6 +30,10 @@ public final class RandomPasswordGenerator {

private static final SecureRandom random = new SecureRandom();

private RandomPasswordGenerator() {
// intentionally empty
}

public static String getRandomPassword() {
return new BigInteger(MAX_BITS, random).toString(RADIX);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@
import javax.jcr.Value;
import javax.jcr.ValueFactory;
import javax.jcr.ValueFormatException;
import lombok.Getter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

@Getter
@ToString
public class Restrictions {

private static final String STRICT = "STRICT";
Expand Down Expand Up @@ -82,7 +78,6 @@ public Map<String, Value> getSingleValueRestrictions(ValueFactory valueFactory)
for (Map.Entry<String, Object> entry : customRestrictions.entrySet()) {
if (!isMultivalue(entry)) {
String value;

if (entry.getValue() instanceof String) {
value = (String) entry.getValue();
} else {
Expand Down Expand Up @@ -154,4 +149,20 @@ private boolean isMultivalue(Map.Entry<String, Object> entry) {
}
return result;
}

public String getGlob() {
return glob;
}

public List<String> getNtNames() {
return ntNames;
}

public List<String> getItemNames() {
return itemNames;
}

public Map<String, Object> getCustomRestrictions() {
return customRestrictions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
*/
package com.cognifide.apm.main.utils;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class PathUtils {

private PathUtils() {
// intentionally empty
}

public static boolean isAppsOrLibsPath(String path) {
return path.startsWith("/apps") || path.startsWith("/libs");
}
Expand Down
1 change: 0 additions & 1 deletion app/aem/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.cognifide.gradle.aem.bundle.tasks.bundle
import org.gradle.jvm.tasks.Jar

plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public enum LaunchMode {
*/
ON_SCHEDULE,

/**
* Executed on CRON expression
*/
ON_CRON_EXPRESSION,

/**
* Executed always on bundle start
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public interface Script {
*/
Date getLaunchSchedule();

/**
* Get CRON expression
*/
String getCronExpression();

/**
* Get last execution date
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public Date getLaunchSchedule() {
return null;
}

@Override
public String getCronExpression() {
return null;
}

@Override
public Date getLastExecuted() {
return null;
Expand Down
3 changes: 0 additions & 3 deletions app/aem/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ dependencies {

antlr("org.antlr:antlr4:4.7.2")

compileOnly("org.projectlombok:lombok:1.18.8")
annotationProcessor("org.projectlombok:lombok:1.18.8")

compileOnly(kotlin("stdlib-jdk8"))
compileOnly(kotlin("reflect"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,28 @@

import com.cognifide.apm.api.actions.Action;
import com.cognifide.apm.core.grammar.argument.Arguments;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public final class ActionDescriptor {

private final String command;
private final Action action;
private final Arguments arguments;

public ActionDescriptor(String command, Action action, Arguments arguments) {
this.command = command;
this.action = action;
this.arguments = arguments;
}

public String getCommand() {
return command;
}

public Action getAction() {
return action;
}

public Arguments getArguments() {
return arguments;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

public class ActionResultImpl implements ActionResult {

@Getter
private String authorizable;

@Getter
private List<Message> messages;

@Getter
private Status status;

public ActionResultImpl(String authorizable) {
Expand Down Expand Up @@ -127,11 +123,23 @@ private static String checkCommonAuthorizable(List<ActionResult> actionResults)
for (ActionResult actionResult : actionResults) {
String current = actionResult.getAuthorizable();
if (current != null && !StringUtils.equals(current, pattern)) {
String error = format("Cannot create CompositeActionResult, mismatch of authorizables. Found: {} Expected: {}",
String error = format("Cannot create CompositeActionResult, mismatch of authorizables. Found: %s Expected: %s",
actionResult.getAuthorizable(), pattern);
throw new IllegalArgumentException(error);
}
}
return pattern;
}

public String getAuthorizable() {
return authorizable;
}

public List<Message> getMessages() {
return messages;
}

public Status getStatus() {
return status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,27 @@

package com.cognifide.apm.core.actions;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class ArgumentDescription {

private final String name;
private final String type;
private final String description;

public ArgumentDescription(String name, String type, String description) {
this.name = name;
this.type = type;
this.description = description;
}

public String getName() {
return name;
}

public String getType() {
return type;
}

public String getDescription() {
return description;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
package com.cognifide.apm.core.actions;

import java.util.List;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class CommandDescription {

private final String name;
Expand All @@ -34,4 +30,31 @@ public class CommandDescription {
private final String description;
private final List<ArgumentDescription> arguments;

public CommandDescription(String name, String group, List<String> examples, String description, List<ArgumentDescription> arguments) {
this.name = name;
this.group = group;
this.examples = examples;
this.description = description;
this.arguments = arguments;
}

public String getName() {
return name;
}

public String getGroup() {
return group;
}

public List<String> getExamples() {
return examples;
}

public String getDescription() {
return description;
}

public List<ArgumentDescription> getArguments() {
return arguments;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import com.cognifide.apm.core.Property;
import com.cognifide.apm.core.crypto.DecryptionService;
import lombok.Getter;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

Expand All @@ -33,10 +32,12 @@
Property.VENDOR
}
)
@Getter
public class MapperContext {

@Reference
private DecryptionService decryptionService;

public DecryptionService getDecryptionService() {
return decryptionService;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@
import com.cognifide.apm.api.actions.Action;
import com.cognifide.apm.core.grammar.argument.Arguments;
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class MapperDescriptor {

private final Object mapper;
private final String name;
private final String group;
private final List<MappingDescriptor> mappingDescriptors;

MapperDescriptor(Object mapper, String name, String group, List<MappingDescriptor> mappingDescriptors) {
this.mapper = mapper;
this.name = name;
this.group = group;
this.mappingDescriptors = mappingDescriptors;
}

public boolean handles(Arguments arguments) {
return mappingDescriptors.stream().anyMatch(it -> it.handles(arguments));
}
Expand All @@ -46,4 +48,20 @@ public Action handle(Arguments arguments, MapperContext mapperContext) {
.orElseThrow(() -> new RuntimeException("Cannot find matching mapping method"))
.handle(mapper, arguments, mapperContext);
}

public Object getMapper() {
return mapper;
}

public String getName() {
return name;
}

public String getGroup() {
return group;
}

public List<MappingDescriptor> getMappingDescriptors() {
return mappingDescriptors;
}
}
Loading

0 comments on commit 7a23614

Please sign in to comment.