Skip to content

Commit

Permalink
Further API compatiblity fixes
Browse files Browse the repository at this point in the history
- Servlet API related Share fixes
- Mail/Subetha related Repository fixes
- cross-compilation where necessary
  • Loading branch information
AFaust committed May 26, 2024
1 parent bcbcbef commit 884cfa1
Show file tree
Hide file tree
Showing 49 changed files with 2,656 additions and 185 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016 - 2024 Acosix GmbH
*
* 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.
*/
package de.acosix.alfresco.utility.common.function;

/**
* Instances of this interface represent simple no parameter / no return value callbacks.
*
* @author Axel Faust
*/
@FunctionalInterface
public interface Callback<T extends Throwable>
{

/**
* Execute the callback.
*/
void execute() throws T;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright 2016 - 2024 Acosix GmbH
*
* 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.
*/
package de.acosix.alfresco.utility.common.servlet;

import java.util.Enumeration;

/**
*
* @author Axel Faust
*/
public interface ServletHelperOperations
{

/**
* Returns the login of the user making this request, if the user has been authenticated, or <code>null</code> if the user has not
* been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication.
* Same as the value of the CGI variable REMOTE_USER.
*
* @return a string specifying the login of the user making this request, or {@code null} if the user login is not known
*/
String getRemoteUser();

/**
* Returns the value of the specified request header as a string. If the request did not include a header of the specified name,
* this method returns <code>null</code>. If there are multiple headers with the same name, this method returns the first head in
* the request. The header name is case insensitive. You can use this method with any request header.
*
* @param name
* a string specifying the header name
* @return a string containing the value of the requested header, or {@code null} if the current request does not have a header of
* that name
*/
String getRequestHeader(String name);

/**
* Returns all values of the specified request header as a strings. If the request did not include a header of the specified name,
* this method returns <code>null</code>. If there are multiple headers with the same name, this method returns the first head in
* the request. The header name is case insensitive. You can use this method with any request header.
*
* @param name
* a string specifying the header name
* @return an enumeration of strings containing the values of the requested header, or {@code null} if the current request does not
* have a header of that name
*/
Enumeration<String> getRequestHeaders(String name);

/**
* Returns all the header names set in the current request.
*
* @return an enumeration of all the header names sent with the current request
*/
Enumeration<String> getRequestHeaderNames();

/**
* Returns the value of an attribute with the specified name in an active session
*
* @param name
* a string specifying the name of the attribute
* @return the value of the requested attribute, or {@code null} if the active session does not have an attribute of that name
*/
Object getSessionAttribute(String name);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2016 - 2024 Acosix GmbH
*
* 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.
*/
package de.acosix.alfresco.utility.common.spring.condition;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;

/**
*
* @author Axel Faust
*/
public class ClassDefinedCondition extends BaseBeanDefinitionPostProcessorCondition
{

private String className;

/**
* @param className
* the name of the class to check if it is defined
*/
public void setClassName(final String className)
{
this.className = className;
}

/**
* {@inheritDoc}
*/
@Override
public boolean applies(final BeanFactory factory)
{
return this.applies();
}

/**
* {@inheritDoc}
*/
@Override
public boolean applies(final BeanDefinitionRegistry registry)
{
return this.applies();
}

protected boolean applies()
{
boolean applies = false;
try
{
Class.forName(this.className);
applies = !this.negate;
}
catch (final ClassNotFoundException e)
{
applies = this.negate;
}
return applies;
}
}
2 changes: 2 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<module>repository-quartz-1</module>
<module>repository-quartz-2</module>
<module>repository</module>
<module>share-javax</module>
<module>share-jakarta</module>
<module>share</module>
</modules>
</project>
2 changes: 1 addition & 1 deletion core/repository-acs6/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</dependency>

<!-- explicitly use versions found in ACS 6.1.2 -->
<!-- (best fit for backwards compatibility as these are last compiled with Java 8 -->
<!-- (best fit for backwards compatibility as these are last compiled with Java 8) -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-remote-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import org.alfresco.service.cmr.action.ActionServiceException;
import org.springframework.mail.javamail.JavaMailSender;

import de.acosix.alfresco.utility.repo.email.EmailAddress;
import de.acosix.alfresco.utility.repo.email.EmailMessage;

/**
* Instances of this interface implement API bridging helper functionality for handling the sending of emails.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.acosix.alfresco.utility.repo.action;
package de.acosix.alfresco.utility.repo.email;

/**
* Wrapper aspect to encapsulate an {@code InternetAddress} instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.acosix.alfresco.utility.repo.action;
package de.acosix.alfresco.utility.repo.email;

/**
* Wrapper aspect to encapsulate a {@code MimeMessage} instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;

import de.acosix.alfresco.utility.repo.action.EmailAddress;
import de.acosix.alfresco.utility.repo.action.EmailMessage;
import de.acosix.alfresco.utility.repo.action.SendEmailActionExecuterHelper;
import de.acosix.alfresco.utility.repo.email.EmailAddress;
import de.acosix.alfresco.utility.repo.email.EmailMessage;
import jakarta.mail.Address;
import jakarta.mail.Message.RecipientType;
import jakarta.mail.MessagingException;
Expand Down
4 changes: 4 additions & 0 deletions core/repository-javax/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<name>Acosix Alfresco Utility - Core Repository javax Library</name>

<properties>
<!-- explicitly use versions found in ACS 6.1.2 -->
<!-- (best fit for backwards compatibility as these are last compiled
with Java 8) -->
<alfresco.remote-api.version>7.35</alfresco.remote-api.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;

import de.acosix.alfresco.utility.repo.action.EmailAddress;
import de.acosix.alfresco.utility.repo.action.EmailMessage;
import de.acosix.alfresco.utility.repo.action.SendEmailActionExecuterHelper;
import de.acosix.alfresco.utility.repo.email.EmailAddress;
import de.acosix.alfresco.utility.repo.email.EmailMessage;

/**
* Instances of this class provide the API bridge for {@code javax.mail}-based email handling.
Expand Down
5 changes: 5 additions & 0 deletions core/repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@

import de.acosix.alfresco.utility.repo.action.SendEmailActionExecuterHelper.AddressHandler;
import de.acosix.alfresco.utility.repo.action.SendEmailActionExecuterHelper.AttachmentHandler;
import de.acosix.alfresco.utility.repo.email.EmailAddress;
import de.acosix.alfresco.utility.repo.email.EmailMessage;

/**
* This action implementation is an alternative to the default Alfresco {@link MailActionExecuter mail action}. Its aim is to have
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
/**
* @author Axel Faust
*/
@SuppressWarnings({ "deprecation", "removal" })
public class SubsystemWithClassLoaderState implements PropertyBackedBeanState, SubsystemConstants
{

Expand Down
Loading

0 comments on commit 884cfa1

Please sign in to comment.