Skip to content

Commit

Permalink
Remove deprecated functionality (2.x) (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert authored Dec 20, 2023
1 parent 164ccc2 commit 876812f
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 570 deletions.
9 changes: 9 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="2.0.0" date="not released">
<action type="remove" dev="sseifert" issue="7">
Remove deprecated functionality.
</action>
<action type="update" dev="sseifert">
Switch to AEM 6.5.17 as minimum version.
</action>
</release>

<release version="1.10.4" date="2023-12-18">
<action type="update" dev="sseifert">
LinkNameConstants: Mark properties PN_LINK_WINDOW_WIDTH, PN_LINK_WINDOW_HEIGHT, PN_LINK_WINDOW_FEATURES as deprecated - they are not used.
Expand Down
40 changes: 11 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.parent_toplevel</artifactId>
<version>2.2.8</version>
<version>2.3.0-SNAPSHOT</version>
<relativePath/>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.link</artifactId>
<version>1.10.5-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Link Handler</name>
Expand Down Expand Up @@ -63,19 +63,19 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.commons</artifactId>
<version>1.4.4</version>
<version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.url</artifactId>
<version>1.10.0</version>
<version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.media</artifactId>
<version>1.13.2</version>
<version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

Expand All @@ -88,36 +88,21 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.wcm.commons</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.sling.commons</artifactId>
<version>1.4.0</version>
<version>1.6.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.wcm.ui.granite</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.adobe.cq.wcm</groupId>
<artifactId>com.adobe.aem.wcm.seo</artifactId>
<version>1.0.6</version>
<version>1.10.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.sitemap</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.sling</groupId>
Expand Down Expand Up @@ -152,7 +137,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>5.4.2</version>
<version>5.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -164,7 +149,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>
<version>1.4.0</version>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -182,7 +167,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.wcm-io-mock.caconfig</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -218,9 +203,6 @@
sling=http://sling.apache.org/jcr/sling/1.0

Import-Package: \
<!-- Make SEO Sitemap-related dependencies optional, only available in latest AEM versions -->\
com.adobe.aem.wcm.seo.sitemap.externalizer;resolution:=optional,\
org.apache.sling.sitemap.spi.common;resolution:=optional,\
<!-- For build compatibility with Java 11 -->\
javax.annotation;version="[0.0,2)",\
*
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/io/wcm/handler/link/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ public Map<String, String> getAnchorAttributes() {
return attributes;
}

/**
* @param anchor Anchor element
* @deprecated Use {@link #setAnchorBuilder(Function)} to build anchor on-demand
*/
@Deprecated
public void setAnchor(Anchor anchor) {
this.anchor = anchor;
}

/**
* @param anchorBuilder Function that builds an anchor representation on demand
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,6 @@ public LinkComponentPropertyResolver(@NotNull Resource resource,
.componentPropertiesResolution(ComponentPropertyResolution.RESOLVE_INHERIT);
}

/**
* @param resource Resource containing link properties
* @deprecated Please use {@link #LinkComponentPropertyResolver(Resource, ComponentPropertyResolverFactory)}
*/
@Deprecated
@SuppressWarnings("resource")
public LinkComponentPropertyResolver(@NotNull Resource resource) {
// resolve media component properties 1. from policies and 2. from component definition
resolver = new ComponentPropertyResolver(resource, true)
.contentPolicyResolution(ComponentPropertyResolution.RESOLVE)
.componentPropertiesResolution(ComponentPropertyResolution.RESOLVE_INHERIT);
}

/**
* @return Link target URL fallback property name
*/
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/io/wcm/handler/link/LinkNameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,6 @@ private LinkNameConstants() {
*/
public static final @NotNull String PN_LINK_WINDOW_TARGET = "linkWindowTarget";

/**
* Window width (px)
* @deprecated This property is no longer supported.
*/
@Deprecated(forRemoval = true)
public static final @NotNull String PN_LINK_WINDOW_WIDTH = "linkWindowWidth";

/**
* Window height (px)
* @deprecated This property is no longer supported.
*/
@Deprecated(forRemoval = true)
public static final @NotNull String PN_LINK_WINDOW_HEIGHT = "linkWindowHeight";

/**
* Window features
* @deprecated This property is no longer supported.
*/
@Deprecated(forRemoval = true)
public static final @NotNull String PN_LINK_WINDOW_FEATURES = "linkWindowFeatures";

/**
* Open media library item with download dialog
*/
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/io/wcm/handler/link/SyntheticLinkResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
public final class SyntheticLinkResource extends SyntheticResource {

private static final String RESOURCE_TYPE = "wcm-io/handler/link/synthetic/resource";
private static final String LEGACY_DEFAULT_PATH = "/apps/wcm-io/handler/link/synthetic/resource";

private final ValueMap properties;

Expand Down Expand Up @@ -67,27 +66,6 @@ public SyntheticLinkResource(@NotNull ResourceResolver resourceResolver,
this.properties = new ValueMapDecorator(properties);
}

/**
* Instantiate resource with static path/resource type
* @param resourceResolver Resource resolver
* @deprecated Please use {@link #SyntheticLinkResource(ResourceResolver, String)}
*/
@Deprecated
public SyntheticLinkResource(@NotNull ResourceResolver resourceResolver) {
this(resourceResolver, LEGACY_DEFAULT_PATH);
}

/**
* Instantiate resource with static path/resource type
* @param resourceResolver Resource resolver
* @param properties Properties for resource
* @deprecated Please use {@link #SyntheticLinkResource(ResourceResolver, String, Map)}
*/
@Deprecated
public SyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull Map<String, Object> properties) {
this(resourceResolver, LEGACY_DEFAULT_PATH, properties);
}

@Override
@SuppressWarnings({ "unchecked", "null" })
public <Type> Type adaptTo(Class<Type> type) {
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/io/wcm/handler/link/impl/LinkBuilderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final class LinkBuilderImpl implements LinkBuilder {
private static final Logger log = LoggerFactory.getLogger(LinkBuilderImpl.class);

LinkBuilderImpl(@Nullable Resource resource, @NotNull LinkHandlerImpl linkHandler,
@Nullable ComponentPropertyResolverFactory componentPropertyResolverFactory) {
@NotNull ComponentPropertyResolverFactory componentPropertyResolverFactory) {
this.resource = resource;
this.page = null;
this.reference = null;
Expand All @@ -64,7 +64,7 @@ final class LinkBuilderImpl implements LinkBuilder {
}

LinkBuilderImpl(@NotNull LinkRequest linkRequest, @NotNull LinkHandlerImpl linkHandler,
@Nullable ComponentPropertyResolverFactory componentPropertyResolverFactory) {
@NotNull ComponentPropertyResolverFactory componentPropertyResolverFactory) {
this.resource = linkRequest.getResource();
this.page = linkRequest.getPage();
this.reference = linkRequest.getReference();
Expand All @@ -88,13 +88,13 @@ final class LinkBuilderImpl implements LinkBuilder {
this.linkHandler = linkHandler;
}

private void resolveWindowTargetAndFallbackProperties(@Nullable ComponentPropertyResolverFactory componentPropertyResolverFactory) {
private void resolveWindowTargetAndFallbackProperties(@NotNull ComponentPropertyResolverFactory componentPropertyResolverFactory) {
if (resource == null) {
return;
}

// resolve default settings from content policies and component properties
try (LinkComponentPropertyResolver resolver = getLinkComponentPropertyResolver(resource, componentPropertyResolverFactory)) {
try (LinkComponentPropertyResolver resolver = new LinkComponentPropertyResolver(resource, componentPropertyResolverFactory)) {
linkArgs.linkTargetUrlFallbackProperty(resolver.getLinkTargetUrlFallbackProperty());
linkArgs.linkTargetWindowTargetFallbackProperty(resolver.getLinkTargetWindowTargetFallbackProperty());
}
Expand All @@ -106,18 +106,6 @@ private void resolveWindowTargetAndFallbackProperties(@Nullable ComponentPropert
linkArgs.windowTarget(getWindowTargetFromResource(resource, linkArgs));
}

@SuppressWarnings("deprecation")
private static LinkComponentPropertyResolver getLinkComponentPropertyResolver(@NotNull Resource resource,
@Nullable ComponentPropertyResolverFactory componentPropertyResolverFactory) {
if (componentPropertyResolverFactory != null) {
return new LinkComponentPropertyResolver(resource, componentPropertyResolverFactory);
}
else {
// fallback mode if ComponentPropertyResolverFactory is not available
return new LinkComponentPropertyResolver(resource);
}
}

private static String getWindowTargetFromResource(@NotNull Resource resource, @NotNull LinkArgs linkArgs) {
ValueMap props = resource.getValueMap();
String windowTarget = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class LinkHandlerImpl implements LinkHandler {
private LinkHandlerConfig linkHandlerConfig;
@AemObject(injectionStrategy = InjectionStrategy.OPTIONAL)
private Page currentPage;
@OSGiService(injectionStrategy = InjectionStrategy.OPTIONAL)
@OSGiService
private ComponentPropertyResolverFactory componentPropertyResolverFactory;

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/wcm/handler/link/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
/**
* Link Handler API.
*/
@org.osgi.annotation.versioning.Version("1.7.0")
@org.osgi.annotation.versioning.Version("2.0.0")
package io.wcm.handler.link;
15 changes: 0 additions & 15 deletions src/main/java/io/wcm/handler/link/type/ExternalLinkType.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,6 @@ public boolean accepts(@NotNull String linkRef) {
return new SyntheticLinkResource(resourceResolver, path, map);
}

/**
* Get synthetic link resource for this link type.
* @param resourceResolver Resource resolver
* @param url Link URL
* @return Synthetic link resource
* @deprecated Please use {@link #getSyntheticLinkResource(ResourceResolver, String, String)}
*/
@Deprecated
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String url) {
Map<String, Object> map = new HashMap<>();
map.put(LinkNameConstants.PN_LINK_TYPE, ID);
map.put(LinkNameConstants.PN_LINK_EXTERNAL_REF, url);
return new SyntheticLinkResource(resourceResolver, map);
}

@Override
public String toString() {
return ID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,6 @@ public boolean accepts(@NotNull LinkRequest linkRequest) {
return new SyntheticLinkResource(resourceResolver, path, map);
}

/**
* Get synthetic link resource for this link type.
* @param resourceResolver Resource resolver
* @param pageRef Path to target page
* @return Synthetic link resource
* @deprecated Please use {@link #getSyntheticLinkResource(ResourceResolver, String, String)}
*/
@Deprecated
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String pageRef) {
Map<String, Object> map = new HashMap<>();
map.put(LinkNameConstants.PN_LINK_TYPE, ID);
map.put(LinkNameConstants.PN_LINK_CROSSCONTEXT_CONTENT_REF, pageRef);
return new SyntheticLinkResource(resourceResolver, map);
}

@Override
public String toString() {
return ID;
Expand Down
Loading

0 comments on commit 876812f

Please sign in to comment.