Skip to content

Commit

Permalink
Merge branch 'master' into defect/ccvar/same-attr-not-updating
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgonzalez authored Aug 14, 2024
2 parents 09e82b9 + de543af commit 0c74c01
Show file tree
Hide file tree
Showing 183 changed files with 1,005 additions and 687 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)

## Unreleased ([details][unreleased changes details])


### Fixed

- #3380 - Remove forced red theme from system notification text body
- #3398 - CreateRedirectConfigurationServlet throws PersistenceException when ancestor node types are different than expected
- #3275 - CCVAR: Fixed Same Attribute not updating correctly.

### Changed

- #3376 - Redirect Manager: refactor code to not require service user
- #3408 - Reduce usage of Apache Commons Lang 2
- #3401 - Move SyslogAppender into separate bundle for onprem only. SyslogAppender does not work in Cloud Service.
- #3390 - Remove usage of commons collections 3


### Fixed

- #3398 - CreateRedirectConfigurationServlet throws PersistenceException when ancestor node types are different than expected
- #3402 - EnsureOakIndexManagerImpl does not pick up changes in EnsureOakIndex configurations.


## 6.6.2 - 2024-06-25
Expand Down
9 changes: 8 additions & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
<filter>true</filter>
<isAllVersionsFilter>true</isAllVersionsFilter>
</embedded>
<embedded>
<groupId>${project.groupId}</groupId>
<artifactId>acs-aem-commons-bundle-onprem</artifactId>
<target>/apps/acs-commons/install</target>
<filter>true</filter>
<isAllVersionsFilter>true</isAllVersionsFilter>
</embedded>
<embedded>
<groupId>${project.groupId}</groupId>
<artifactId>acs-aem-commons-ui.apps</artifactId>
Expand Down Expand Up @@ -312,7 +319,7 @@
<plugin>
<groupId>com.adobe.aem</groupId>
<artifactId>aemanalyser-maven-plugin</artifactId>
<version>1.5.8</version>
<version>1.6.4</version>
<executions>
<execution>
<id>aem-analyser</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ set ACL for everyone
allow jcr:read on /etc/acs-commons/redirect-maps
end

# Not supported in 6.4.8
#set properties on /conf/global/settings/redirects
# set sling:resourceType{String} to acs-commons/components/utilities/manage-redirects/redirects
#end

# user to invalidate cached redirects on change
create service user acs-commons-manage-redirects-service with path system/acs-commons
set ACL for acs-commons-manage-redirects-service
allow jcr:read on /
allow jcr:read on /conf
end

# Marketo config service needs to be able to read /conf and /content
create service user acs-commons-marketo-conf-service with path system/acs-commons
set ACL for acs-commons-marketo-conf-service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ user.mapping=[ \
"com.adobe.acs.acs-aem-commons-bundle:automatic-package-replicator\=[acs-commons-automatic-package-replicator-service]", \
"com.adobe.acs.acs-aem-commons-bundle:on-deploy-scripts\=[acs-commons-on-deploy-scripts-service]", \
"com.adobe.acs.acs-aem-commons-bundle:workflowpackagemanager-service\=[acs-commons-workflowpackagemanager-service]", \
"com.adobe.acs.acs-aem-commons-bundle:redirect-manager\=[acs-commons-manage-redirects-service]", \
"com.adobe.acs.acs-aem-commons-bundle:marketo-conf\=[acs-commons-marketo-conf-service]", \
"com.adobe.acs.acs-aem-commons-bundle:package-garbage-collection\=[acs-commons-package-garbage-collection-service]" \
]
4 changes: 4 additions & 0 deletions bundle-onprem/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/nb-configuration.xml
*.factorypath
/dependency-reduced-pom.xml
/nbactions-autoInstallBundle.xml
170 changes: 170 additions & 0 deletions bundle-onprem/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ ACS AEM Commons
~
~ Copyright (C) 2013 - 2024 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<modelVersion>4.0.0</modelVersion>
<!-- ====================================================================== -->
<!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<parent>
<groupId>com.adobe.acs</groupId>
<artifactId>acs-aem-commons</artifactId>
<version>6.6.3-SNAPSHOT</version>
</parent>

<!-- ====================================================================== -->
<!-- P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->

<artifactId>acs-aem-commons-bundle-onprem</artifactId>
<name>ACS AEM Commons - Bundle Fragment (for On Prem)</name>
<description>ACS AEM Commons Core OSGi bundle fragment containing AEM server-side logic requiring On Prem</description>
<build>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<configuration>
<bnd><![CDATA[
Fragment-Host: com.adobe.acs.acs-aem-commons-bundle
]]></bnd>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<configuration>
<skip>true</skip><!-- temporarily ignore due to empty interface being exported in 6.3.x -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>sling-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencies>
<!-- ======================== -->
<!-- START build dependencies -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.bundle</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.metatype.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.servlets.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<scope>provided</scope>
</dependency>
<!-- END build dependencies -->
<!-- ======================== -->
<!-- START runtime dependencies not contained in uber-jar -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.framework</artifactId>
<scope>provided</scope>
</dependency>
<!-- END runtime dependencies not contained in uber-jar -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<!-- End Test dependencies -->
<!-- ======================== -->
<!-- put UberJar last so that more specific artifacts take precedence -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<!-- generate empty jar, as long as no javadoc is generated -->
<execution>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.build.directory}/invalid</classesDirectory>
<classifier>javadoc</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* #%L
* ACS AEM Commons Bundle
* %%
* Copyright (C) 2013 - 2023 Adobe
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.adobe.acs.commons.logging.impl;

import java.util.Dictionary;
import java.util.Hashtable;

import ch.qos.logback.core.net.SyslogAppenderBase;
import org.apache.commons.lang3.StringUtils;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;

import ch.qos.logback.core.Appender;

@Component(configurationPolicy = ConfigurationPolicy.REQUIRE,
property = {
"webconsole.configurationFactory.nameHint=Host: {host}, for loggers [{loggers}]"
})
@Designate(ocd = SyslogAppender.Config.class, factory = true)
public final class SyslogAppender {

@ObjectClassDefinition(name = "ACS AEM Commons - Syslog Appender",
description = "Logback appender to send messages using Syslog")
public @interface Config {

@AttributeDefinition(name = "Host", description = "Host of Syslog server")
String host();

@AttributeDefinition(name = "Logger Names", description = "List of logger categories (ROOT for all)")
String[] loggers() default {"ROOT"};

@AttributeDefinition(name = "Port", description = "Port of Syslog server")
int port() default -1;

@AttributeDefinition(name = "Suffix Pattern", description = "Logback Pattern defining the message format.")
String suffix_pattern() default "[%thread] %-5level %logger{36} - %msg%n";

@AttributeDefinition(name = "Syslog Facility", description = "The Syslog Facility is meant to identify the source of a message, "
+ "separately from any context included in the Suffix Pattern. The facility option must be set to one of the strings "
+ "KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, NTP, AUDIT, ALERT, CLOCK, LOCAL0, LOCAL1, "
+ "LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. Case is not important.")
String facility() default "USER";

@AttributeDefinition(name = "Stack Trace Pattern", description = "Logback Pattern for customizing the string appearing just before each stack "
+ "trace line. The default value for this property is a single tab character.")
String stack_trace_pattern() default "";

@AttributeDefinition(name = "Exclude Throwables", description = "Set to true to cause stack trace data associated with a Throwable to be omitted. "
+ "By default, this is set to false so that stack trace data is sent to the syslog server.")
boolean throwable_excluded() default false;
}

private ch.qos.logback.classic.net.SyslogAppender appender;

private ServiceRegistration<Appender> appenderRegistration;

@Activate
@SuppressWarnings("squid:S1149")
protected void activate(final BundleContext ctx, final Config config) {
this.appender = constructAppender(config);

final Dictionary<String, Object> props = new Hashtable<>();
props.put("loggers", config.loggers());
appenderRegistration = ctx.registerService(Appender.class, appender, props);
}

static ch.qos.logback.classic.net.SyslogAppender constructAppender(final Config config) {
if (StringUtils.isEmpty(config.host()) || config.port() == -1) {
throw new IllegalArgumentException(
"Syslog Appender not configured correctly. Both host and port need to be provided.");
}

// throws a descriptive IllegalArgumentException if facility is not valid.
SyslogAppenderBase.facilityStringToint(config.facility());

final ch.qos.logback.classic.net.SyslogAppender appender = new ch.qos.logback.classic.net.SyslogAppender();

appender.setSyslogHost(config.host());
appender.setPort(config.port());

appender.setFacility(config.facility());
appender.setSuffixPattern(config.suffix_pattern());

if (StringUtils.isNotEmpty(config.stack_trace_pattern())) {
appender.setStackTracePattern(config.stack_trace_pattern());
}

appender.setThrowableExcluded(config.throwable_excluded());
return appender;
}


@Deactivate
protected void deactivate() {
if (appender != null) {
if (appender.isStarted()) {
appender.stop();
}
appender = null;
}

if (appenderRegistration != null) {
try {
appenderRegistration.unregister();
} catch (IllegalStateException e) {
// ignore
}
appenderRegistration = null;
}
}

}
Loading

0 comments on commit 0c74c01

Please sign in to comment.