CCM NG:
- DependencyTreeManager finished and tested
- AuditReaderProducer for producing and AuditReader which can be injected via CDI
- Added some of the old com.arsdigita classes to the excludes for PMD
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3570 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
parent
5580d94608
commit
03c73e42f0
|
|
@ -137,6 +137,11 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
|
|
@ -399,6 +404,7 @@
|
|||
<exclude>**/DateFormatter.java</exclude>
|
||||
<exclude>**/DateFormatterConfig.java</exclude>
|
||||
<exclude>**/DateTimeFormatter.java</exclude>
|
||||
<exclude>**/DispatcherConfig.java</exclude>
|
||||
<exclude>**/Document.java</exclude>
|
||||
<exclude>**/Element.java</exclude>
|
||||
<exclude>**/EmailParameter.java</exclude>
|
||||
|
|
@ -407,13 +413,17 @@
|
|||
<exclude>**/ExceptionUnwrapper.java</exclude>
|
||||
<exclude>**/Exceptions.java</exclude>
|
||||
<exclude>**/FileParameter.java</exclude>
|
||||
<exclude>**/FormBuilderConfig.java</exclude>
|
||||
<exclude>**/FullDateFormatter.java</exclude>
|
||||
<exclude>**/GlobalizationConfig.java</exclude>
|
||||
<exclude>**/IntegerParameter.java</exclude>
|
||||
<exclude>**/JavaPropertyReader.java</exclude>
|
||||
<exclude>**/JavaPropertyWriter.java</exclude>
|
||||
<exclude>**/KernelConfig.java</exclude>
|
||||
<exclude>**/LockableImpl.java</exclude>
|
||||
<exclude>**/MailConfig.java</exclude>
|
||||
<exclude>**/MapParameter.java</exclude>
|
||||
<exclude>**/NotificationConfig.java</exclude>
|
||||
<exclude>**/Parameter.java</exclude>
|
||||
<exclude>**/ParameterError.java</exclude>
|
||||
<exclude>**/ParameterException.java</exclude>
|
||||
|
|
@ -425,8 +435,11 @@
|
|||
<exclude>**/SpecificClassParameter.java</exclude>
|
||||
<exclude>**/StringParameter.java</exclude>
|
||||
<exclude>**/TimeFormatter.java</exclude>
|
||||
<exclude>**/UIConfig.java</exclude>
|
||||
<exclude>**/UncheckedWrapperException.java</exclude>
|
||||
<exclude>**/WorkflowConfig.java</exclude>
|
||||
<exclude>**/XML.java</exclude>
|
||||
<exclude>**/XMLConfig.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ package org.libreccm.auditing;
|
|||
import org.hibernate.envers.DefaultRevisionEntity;
|
||||
import org.hibernate.envers.RevisionEntity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
|
@ -51,4 +53,31 @@ public class CcmRevision extends DefaultRevisionEntity {
|
|||
this.userName = userName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
|
||||
hash = 17 * hash + Objects.hashCode(this.userName);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object object) {
|
||||
if(!super.equals(object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(object instanceof CcmRevision)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CcmRevision other = (CcmRevision) object;
|
||||
return userName.equals(other.getUserName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.jpa;
|
||||
|
||||
import org.hibernate.envers.AuditReader;
|
||||
import org.hibernate.envers.AuditReaderFactory;
|
||||
|
||||
import javax.enterprise.inject.Produces;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class AuditReaderProducer {
|
||||
|
||||
@Inject
|
||||
private transient EntityManager entityManager;
|
||||
|
||||
@Produces
|
||||
public AuditReader auditReader() {
|
||||
return AuditReaderFactory.get(entityManager);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
package org.libreccm.jpa;
|
||||
|
||||
import org.hibernate.envers.AuditReader;
|
||||
import org.hibernate.envers.AuditReaderFactory;
|
||||
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
import javax.persistence.EntityManager;
|
||||
|
|
@ -20,7 +17,4 @@ public class EntityManagerProducer {
|
|||
@PersistenceContext(name = "LibreCCM")
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Produces
|
||||
private AuditReader auditReader = AuditReaderFactory.get(entityManager);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class Bar implements Module {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class Example implements Module {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules;
|
||||
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(name = "org.libreccm.foo.Foo",
|
||||
version = "1.0.0-beta.1",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = Bar.class, version = "1.0.0"),
|
||||
@RequiredModule(module= Example.class, version = "6.6.7")})
|
||||
public class Foo implements Module {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ package org.libreccm.modules;
|
|||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public interface Module {
|
||||
public interface ModuleDescriptor {
|
||||
|
||||
/**
|
||||
* Called by the {@link ModuleManager} after the database tables for the
|
||||
|
|
@ -30,7 +30,7 @@ import javax.inject.Inject;
|
|||
public class ModuleManager {
|
||||
|
||||
@Inject
|
||||
private transient Instance<Module> modules;
|
||||
private transient Instance<ModuleDescriptor> modules;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,23 +18,22 @@
|
|||
*/
|
||||
package org.libreccm.modules;
|
||||
|
||||
import org.libreccm.modules.annotations.Module;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ModuleUtil {
|
||||
public final class ModuleUtil {
|
||||
|
||||
private ModuleUtil() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
private static org.libreccm.modules.annotations.Module getModuleAnnotation(
|
||||
final Module module) {
|
||||
final org.libreccm.modules.annotations.Module annotation = module
|
||||
.getClass().getAnnotation(
|
||||
org.libreccm.modules.annotations.Module.class);
|
||||
private static Module getModuleAnnotation(
|
||||
final ModuleDescriptor module) {
|
||||
final Module annotation = module.getClass().getAnnotation(Module.class);
|
||||
|
||||
if (annotation == null) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
|
|
@ -47,21 +46,22 @@ public class ModuleUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getModuleName(final Module module) {
|
||||
public static String getModuleName(final ModuleDescriptor module) {
|
||||
return getModuleAnnotation(module).name();
|
||||
}
|
||||
|
||||
public static String getVersion(final Module module) {
|
||||
public static String getVersion(final ModuleDescriptor module) {
|
||||
return getModuleAnnotation(module).version();
|
||||
}
|
||||
|
||||
public static RequiredModule[] getRequiredModules(final Module module) {
|
||||
public static RequiredModule[] getRequiredModules(final ModuleDescriptor module) {
|
||||
return getModuleAnnotation(module).requiredModules();
|
||||
}
|
||||
|
||||
public static String getModuleName(Class<? extends Module> module) {
|
||||
final org.libreccm.modules.annotations.Module annotation = module
|
||||
.getAnnotation(org.libreccm.modules.annotations.Module.class);
|
||||
public static String getModuleName(
|
||||
final Class<? extends ModuleDescriptor> module) {
|
||||
|
||||
final Module annotation = module.getAnnotation(Module.class);
|
||||
|
||||
if (annotation == null) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.modules.annotations;
|
||||
|
||||
import org.jboss.as.server.moduleservice.ModuleDefinition;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ import javax.enterprise.util.Nonbinding;
|
|||
import javax.inject.Qualifier;
|
||||
|
||||
/**
|
||||
* Annotate an implementation of the {@link ModuleDefinition} interface with
|
||||
* Annotate an implementation of the {@link ModuleDescriptor} interface with
|
||||
* this annotation to use it as a module.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@ package org.libreccm.modules.annotations;
|
|||
*/
|
||||
public @interface RequiredModule {
|
||||
|
||||
Class<? extends org.libreccm.modules.Module> module();
|
||||
Class<? extends org.libreccm.modules.ModuleDescriptor> module();
|
||||
|
||||
String version() default "";
|
||||
String minVersion() default "";
|
||||
|
||||
String maxVersion() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ package org.libreccm.modules.dependencytree;
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.modules.Module;
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.ModuleUtil;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
|
|
@ -32,6 +33,18 @@ import java.util.Map;
|
|||
import javax.enterprise.inject.Instance;
|
||||
|
||||
/**
|
||||
* This class implements topological sorting to determine the order in which the
|
||||
* modules are loaded and initialised.
|
||||
*
|
||||
* The class is used by creating an instance with the parameterless constructor.
|
||||
* To create the tree/graph call the
|
||||
* {@link #generateTree(javax.enterprise.inject.Instance)} method. With the
|
||||
* returned list of nodes call the the {@link #orderModules(java.util.List)}
|
||||
* method. The list returned by {@link #orderModules(java.util.List)} contains
|
||||
* all modules in order.
|
||||
*
|
||||
* More information about topological sorting:
|
||||
* <a href="https://en.wikipedia.org/wiki/Topological_sorting">https://en.wikipedia.org/wiki/Topological_sorting</a>
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
|
|
@ -40,23 +53,23 @@ public class DependencyTreeManager {
|
|||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
DependencyTreeManager.class);
|
||||
|
||||
public List<TreeNode> generateTree(final Instance<Module> modules) throws
|
||||
DependencyException {
|
||||
public List<TreeNode> generateTree(final Instance<ModuleDescriptor> modules)
|
||||
throws DependencyException {
|
||||
|
||||
LOGGER.info("Starting to generate dependency tree...");
|
||||
|
||||
final Map<String, TreeNode> nodes = new HashMap<>();
|
||||
|
||||
for (final Module module : modules) {
|
||||
for (final ModuleDescriptor module : modules) {
|
||||
createTreeNode(module, nodes);
|
||||
}
|
||||
|
||||
for (final Module module : modules) {
|
||||
for (final ModuleDescriptor module : modules) {
|
||||
addDependencyRelations(module, nodes);
|
||||
}
|
||||
|
||||
final List<TreeNode> nodeList = new ArrayList<>();
|
||||
for (Map.Entry<String, TreeNode> entry : nodes.entrySet()) {
|
||||
for (final Map.Entry<String, TreeNode> entry : nodes.entrySet()) {
|
||||
nodeList.add(entry.getValue());
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +129,7 @@ public class DependencyTreeManager {
|
|||
}
|
||||
}
|
||||
|
||||
private void createTreeNode(final Module module,
|
||||
private void createTreeNode(final ModuleDescriptor module,
|
||||
final Map<String, TreeNode> nodes) {
|
||||
final TreeNode node = new TreeNode(module);
|
||||
|
||||
|
|
@ -125,7 +138,7 @@ public class DependencyTreeManager {
|
|||
nodes.put(ModuleUtil.getModuleName(module), node);
|
||||
}
|
||||
|
||||
private void addDependencyRelations(final Module module,
|
||||
private void addDependencyRelations(final ModuleDescriptor module,
|
||||
final Map<String, TreeNode> nodes)
|
||||
throws DependencyException {
|
||||
|
||||
|
|
@ -147,8 +160,9 @@ public class DependencyTreeManager {
|
|||
final TreeNode node = nodes.get(moduleName);
|
||||
LOGGER.info("Processing required modules for module \"{}\"...",
|
||||
ModuleUtil.getModuleName(module));
|
||||
for (RequiredModule requiredModule : ModuleUtil.getRequiredModules(
|
||||
module)) {
|
||||
for (final RequiredModule requiredModule : ModuleUtil
|
||||
.getRequiredModules(
|
||||
module)) {
|
||||
|
||||
LOGGER.info("\tModule \"{}\" requires module \"{}\".",
|
||||
ModuleUtil.getModuleName(module),
|
||||
|
|
@ -171,9 +185,84 @@ public class DependencyTreeManager {
|
|||
final TreeNode dependencyNode = nodes.get(ModuleUtil.getModuleName(
|
||||
requiredModule.module()));
|
||||
|
||||
node.addDependsOn(node);
|
||||
//Check version
|
||||
if (!validateVersion(ModuleUtil.getVersion(dependencyNode
|
||||
.getModule()),
|
||||
requiredModule.minVersion(),
|
||||
requiredModule.maxVersion())) {
|
||||
throw new DependencyException(String.format(
|
||||
"The required module is avialable but in the correct "
|
||||
+ "version. "
|
||||
+ "Available version: \"%s\"; "
|
||||
+ "minimal required version: \"%s\"; "
|
||||
+ "maximum required version: \"%s\"",
|
||||
ModuleUtil.getVersion(dependencyNode.getModule()),
|
||||
requiredModule.minVersion(),
|
||||
requiredModule.maxVersion()));
|
||||
}
|
||||
|
||||
node.addDependsOn(dependencyNode);
|
||||
dependencyNode.addDependentModule(node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for checking if an dependency is available in the required
|
||||
* version.
|
||||
*
|
||||
* @param availableVersion The available version. Can't be {@code null} or
|
||||
* empty.
|
||||
* @param minRequiredVersion The minimal version required. Can be
|
||||
* {@code null} or empty.
|
||||
* @param maxRequiredVersion The maximum version required. Can be
|
||||
* {@code null} or empty.
|
||||
*
|
||||
* @return {@code true} if the available version is in the required range,
|
||||
* {@code false} if not.
|
||||
*/
|
||||
//The names are fine. Shorter names would be less readable. Also removing
|
||||
//the parentheses in the ifs would make the conditions less readable.
|
||||
@SuppressWarnings({"PMD.LongVariable",
|
||||
"PMD.UselessParentheses",
|
||||
"PMD.CyclomaticComplexity"})
|
||||
private boolean validateVersion(final String availableVersion,
|
||||
final String minRequiredVersion,
|
||||
final String maxRequiredVersion) {
|
||||
if (availableVersion == null || availableVersion.isEmpty()) {
|
||||
throw new IllegalArgumentException("No available version specified.");
|
||||
}
|
||||
|
||||
if ((minRequiredVersion == null || minRequiredVersion.isEmpty())
|
||||
&& (maxRequiredVersion == null || maxRequiredVersion.isEmpty())) {
|
||||
return true;
|
||||
} else if ((minRequiredVersion != null && !minRequiredVersion.isEmpty())
|
||||
&& (maxRequiredVersion == null || maxRequiredVersion
|
||||
.isEmpty())) {
|
||||
final ComparableVersion minVersion = new ComparableVersion(
|
||||
minRequiredVersion);
|
||||
final ComparableVersion version = new ComparableVersion(
|
||||
availableVersion);
|
||||
|
||||
return minVersion.compareTo(version) <= 0;
|
||||
} else if ((minRequiredVersion == null || minRequiredVersion.isEmpty())
|
||||
&& (maxRequiredVersion != null && !maxRequiredVersion
|
||||
.isEmpty())) {
|
||||
final ComparableVersion maxVersion = new ComparableVersion(
|
||||
maxRequiredVersion);
|
||||
final ComparableVersion version = new ComparableVersion(
|
||||
availableVersion);
|
||||
|
||||
return version.compareTo(maxVersion) <= 0;
|
||||
} else {
|
||||
final ComparableVersion minVersion = new ComparableVersion(
|
||||
minRequiredVersion);
|
||||
final ComparableVersion maxVersion = new ComparableVersion(
|
||||
(maxRequiredVersion));
|
||||
final ComparableVersion version = new ComparableVersion(
|
||||
availableVersion);
|
||||
return minVersion.compareTo(version) <= 0 && version.compareTo(
|
||||
maxVersion) <= 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.ModuleUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -27,12 +27,15 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents a node in the dependency tree.
|
||||
*
|
||||
* @see DependencyTreeManager
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public final class TreeNode {
|
||||
|
||||
private Module module;
|
||||
private ModuleDescriptor module;
|
||||
private List<TreeNode> dependentModules;
|
||||
private List<TreeNode> dependsOn;
|
||||
|
||||
|
|
@ -40,20 +43,20 @@ public final class TreeNode {
|
|||
super();
|
||||
|
||||
dependentModules = new ArrayList<>();
|
||||
dependentModules = new ArrayList<>();
|
||||
dependsOn = new ArrayList<>();
|
||||
}
|
||||
|
||||
public TreeNode(final Module module) {
|
||||
public TreeNode(final ModuleDescriptor module) {
|
||||
this();
|
||||
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public Module getModule() {
|
||||
public ModuleDescriptor getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(final Module module) {
|
||||
public void setModule(final ModuleDescriptor module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
|
|
@ -61,15 +64,15 @@ public final class TreeNode {
|
|||
return Collections.unmodifiableList(dependentModules);
|
||||
}
|
||||
|
||||
protected void setDependentModules(final List<TreeNode> dependentModules) {
|
||||
void setDependentModules(final List<TreeNode> dependentModules) {
|
||||
this.dependentModules = dependentModules;
|
||||
}
|
||||
|
||||
protected void addDependentModule(final TreeNode node) {
|
||||
void addDependentModule(final TreeNode node) {
|
||||
dependentModules.add(node);
|
||||
}
|
||||
|
||||
protected void removeDependentModule(final TreeNode node) {
|
||||
void removeDependentModule(final TreeNode node) {
|
||||
dependentModules.remove(node);
|
||||
}
|
||||
|
||||
|
|
@ -77,15 +80,15 @@ public final class TreeNode {
|
|||
return Collections.unmodifiableList(dependsOn);
|
||||
}
|
||||
|
||||
protected void setDependsOn(final List<TreeNode> dependsOn) {
|
||||
void setDependsOn(final List<TreeNode> dependsOn) {
|
||||
this.dependsOn = dependsOn;
|
||||
}
|
||||
|
||||
protected void addDependsOn(final TreeNode node) {
|
||||
void addDependsOn(final TreeNode node) {
|
||||
dependsOn.add(node);
|
||||
}
|
||||
|
||||
protected void removeDependsOn(final TreeNode node) {
|
||||
void removeDependsOn(final TreeNode node) {
|
||||
dependsOn.remove(node);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.libreccm.tests.categories.UnitTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Category(UnitTest.class)
|
||||
public class ComparableVersionTest {
|
||||
|
||||
public ComparableVersionTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareVersions() {
|
||||
final ComparableVersion version001 = new ComparableVersion("0.0.1");
|
||||
final ComparableVersion version010 = new ComparableVersion("0.1.0");
|
||||
final ComparableVersion version015 = new ComparableVersion("0.1.5");
|
||||
final ComparableVersion version100alpha1 = new ComparableVersion(
|
||||
"1.0.0-alpha.1");
|
||||
final ComparableVersion version100alpha2 = new ComparableVersion(
|
||||
"1.0.0-alpha.2");
|
||||
final ComparableVersion version100beta1 = new ComparableVersion(
|
||||
"1.0.0-beta.1");
|
||||
final ComparableVersion version100beta2 = new ComparableVersion(
|
||||
"1.0.0-beta.2");
|
||||
final ComparableVersion version100 = new ComparableVersion("1.0.0");
|
||||
final ComparableVersion version100final = new ComparableVersion("1.0.0");
|
||||
final ComparableVersion version100ga = new ComparableVersion("1.0.0-ga");
|
||||
final ComparableVersion version157 = new ComparableVersion("1.5.7");
|
||||
final ComparableVersion version273beta3 = new ComparableVersion(
|
||||
"2.7.3-beta.3");
|
||||
final ComparableVersion emptyVersion = new ComparableVersion("");
|
||||
|
||||
final List<ComparableVersion> versions = new ArrayList<>();
|
||||
versions.add(version001);
|
||||
versions.add(version157);
|
||||
versions.add(version100alpha2);
|
||||
versions.add(version100beta2);
|
||||
versions.add(version100alpha1);
|
||||
versions.add(version273beta3);
|
||||
versions.add(version100);
|
||||
versions.add(version010);
|
||||
versions.add(version015);
|
||||
versions.add(version100beta1);
|
||||
versions.add(version100ga);
|
||||
versions.add(version100final);
|
||||
versions.add(emptyVersion);
|
||||
|
||||
Collections.sort(versions);
|
||||
|
||||
assertThat(versions.size(), is(13));
|
||||
|
||||
assertThat(versions,
|
||||
contains(emptyVersion,
|
||||
version001,
|
||||
version010,
|
||||
version015,
|
||||
version100alpha1,
|
||||
version100alpha2,
|
||||
version100beta1,
|
||||
version100beta2,
|
||||
version100final,
|
||||
version100ga,
|
||||
version100,
|
||||
version157,
|
||||
version273beta3));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
||||
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.Module;
|
||||
import org.libreccm.modules.dependencytree.test.cycle.TestModuleA;
|
||||
import org.libreccm.modules.dependencytree.test.cycle.TestModuleB;
|
||||
import org.libreccm.modules.dependencytree.test.cycle.TestModuleC;
|
||||
import org.libreccm.modules.dependencytree.test.cycle.TestModuleRoot;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.enterprise.inject.Instance;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Category(IntegrationTest.class)
|
||||
@RunWith(Arquillian.class)
|
||||
public class DependencyTreeManagerCycleTest {
|
||||
|
||||
@Inject
|
||||
@Module
|
||||
private transient Instance<ModuleDescriptor> modules;
|
||||
|
||||
public DependencyTreeManagerCycleTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
@Deployment
|
||||
public static WebArchive createDeployment() {
|
||||
final PomEquippedResolveStage pom = Maven
|
||||
.resolver()
|
||||
.loadPomFromFile("pom.xml");
|
||||
final PomEquippedResolveStage dependencies = pom
|
||||
.importCompileAndRuntimeDependencies();
|
||||
final File[] libs = dependencies.resolve().withTransitivity().asFile();
|
||||
|
||||
for (File lib : libs) {
|
||||
System.err.printf("Adding file '%s' to test archive...%n",
|
||||
lib.getName());
|
||||
}
|
||||
|
||||
return ShrinkWrap
|
||||
.create(WebArchive.class,
|
||||
"LibreCCM-org.libreccm.modules.dependencytree.DependencyTreeManager.war")
|
||||
.addPackage(DependencyTreeManager.class.getPackage())
|
||||
.addPackage(Module.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||
.getPackage())
|
||||
.addPackage(
|
||||
org.libreccm.modules.dependencytree.test.cycle.TestModuleRoot.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.modules.ModuleDescriptor.class)
|
||||
.addClass(org.libreccm.modules.ModuleUtil.class)
|
||||
.addAsLibraries(libs)
|
||||
.addAsWebInfResource("test-web.xml", "web.xml")
|
||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void allModulesInjected() {
|
||||
final List<Class<ModuleDescriptor>> moduleList = new ArrayList<>();
|
||||
for (final ModuleDescriptor module : modules) {
|
||||
moduleList.add((Class<ModuleDescriptor>) module.getClass());
|
||||
}
|
||||
|
||||
assertThat(moduleList.size(), is(4));
|
||||
assertThat(moduleList, containsInAnyOrder(TestModuleRoot.class,
|
||||
TestModuleA.class,
|
||||
TestModuleB.class,
|
||||
TestModuleC.class));
|
||||
}
|
||||
|
||||
@Test(expected = DependencyException.class)
|
||||
@ShouldThrowException(DependencyException.class)
|
||||
public void verifyModuleOrder() throws DependencyException {
|
||||
final DependencyTreeManager treeManager = new DependencyTreeManager();
|
||||
|
||||
final List<TreeNode> tree = treeManager.generateTree(modules);
|
||||
treeManager.orderModules(tree);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,11 @@
|
|||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
|
||||
import org.libreccm.modules.dependencytree.test.valid.TestModuleB;
|
||||
import org.libreccm.modules.dependencytree.test.valid.TestModuleC;
|
||||
import org.libreccm.modules.dependencytree.test.valid.TestModuleA;
|
||||
import org.libreccm.modules.dependencytree.test.valid.TestModuleRoot;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
|
|
@ -37,7 +42,9 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.ModuleUtil;
|
||||
import org.libreccm.modules.annotations.Module;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -56,8 +63,8 @@ import javax.inject.Inject;
|
|||
public class DependencyTreeManagerTest {
|
||||
|
||||
@Inject
|
||||
@org.libreccm.modules.annotations.Module
|
||||
private transient Instance<Module> modules;
|
||||
@Module
|
||||
private transient Instance<ModuleDescriptor> modules;
|
||||
|
||||
public DependencyTreeManagerTest() {
|
||||
}
|
||||
|
|
@ -96,12 +103,16 @@ public class DependencyTreeManagerTest {
|
|||
.create(WebArchive.class,
|
||||
"LibreCCM-org.libreccm.modules.dependencytree.DependencyTreeManager.war")
|
||||
.addPackage(DependencyTreeManager.class.getPackage())
|
||||
.addPackage(org.libreccm.modules.annotations.Module.class
|
||||
.addPackage(Module.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.modules.Module.class)
|
||||
.addPackage(
|
||||
org.libreccm.modules.dependencytree.test.valid.TestModuleRoot.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.modules.ModuleDescriptor.class)
|
||||
.addClass(org.libreccm.modules.ModuleUtil.class)
|
||||
.addAsLibraries(libs)
|
||||
.addAsWebInfResource("test-web.xml", "web.xml")
|
||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||
}
|
||||
|
|
@ -109,10 +120,9 @@ public class DependencyTreeManagerTest {
|
|||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void allModulesInjected() {
|
||||
|
||||
final List<Class<Module>> moduleList = new ArrayList<>();
|
||||
for (final Module module : modules) {
|
||||
moduleList.add((Class<Module>) module.getClass());
|
||||
final List<Class<ModuleDescriptor>> moduleList = new ArrayList<>();
|
||||
for (final ModuleDescriptor module : modules) {
|
||||
moduleList.add((Class<ModuleDescriptor>) module.getClass());
|
||||
}
|
||||
|
||||
assertThat(moduleList.size(), is(4));
|
||||
|
|
@ -120,7 +130,25 @@ public class DependencyTreeManagerTest {
|
|||
TestModuleA.class,
|
||||
TestModuleB.class,
|
||||
TestModuleC.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyModuleOrder() throws DependencyException {
|
||||
final DependencyTreeManager treeManager = new DependencyTreeManager();
|
||||
|
||||
final List<TreeNode> tree = treeManager.generateTree(modules);
|
||||
final List<TreeNode> ordered = treeManager.orderModules(tree);
|
||||
|
||||
final List<String> modulesInOrder = new ArrayList<>();
|
||||
for (final TreeNode node : ordered) {
|
||||
modulesInOrder.add(ModuleUtil.getModuleName(node.getModule()));
|
||||
}
|
||||
|
||||
assertThat(modulesInOrder,
|
||||
contains("org.libreccm.core.ccm-testmodule-root",
|
||||
"org.libreccm.core.ccm-testmodule-a",
|
||||
"org.libreccm.core.ccm-testmodule-b",
|
||||
"org.libreccm.core.ccm-testmodule-c"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
package org.libreccm.modules.dependencytree.test.cycle;
|
||||
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.dependencytree.test.valid.*;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +30,7 @@ import org.libreccm.modules.annotations.RequiredModule;
|
|||
name = "org.libreccm.core.ccm-testmodule-a", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class)})
|
||||
public class TestModuleA implements Module {
|
||||
public class TestModuleA implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
|
|
@ -16,9 +16,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
package org.libreccm.modules.dependencytree.test.cycle;
|
||||
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.dependencytree.test.valid.*;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
|
|
@ -26,10 +27,10 @@ import org.libreccm.modules.annotations.RequiredModule;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-a", version = "1.0.0",
|
||||
name = "org.libreccm.core.ccm-testmodule-b", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class)})
|
||||
public class TestModuleB implements Module {
|
||||
public class TestModuleB implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree.test.cycle;
|
||||
|
||||
import org.libreccm.modules.dependencytree.test.valid.*;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-c", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class),
|
||||
@RequiredModule(module = TestModuleA.class)})
|
||||
public class TestModuleC implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree.test.cycle;
|
||||
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-root",
|
||||
version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleB.class)})
|
||||
public class TestModuleRoot implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
package org.libreccm.modules.dependencytree.test.valid;
|
||||
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
|
|
@ -28,9 +28,8 @@ import org.libreccm.modules.annotations.RequiredModule;
|
|||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-a", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class),
|
||||
@RequiredModule(module = TestModuleA.class)})
|
||||
public class TestModuleC implements Module {
|
||||
@RequiredModule(module = TestModuleRoot.class, minVersion = "1.0.0")})
|
||||
public class TestModuleA implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree.test.valid;
|
||||
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-b", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class, minVersion = "1.0.0")})
|
||||
public class TestModuleB implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree.test.valid;
|
||||
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
import org.libreccm.modules.annotations.RequiredModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-c", version = "1.0.0",
|
||||
requiredModules = {
|
||||
@RequiredModule(module = TestModuleRoot.class, minVersion = "1.0.0"),
|
||||
@RequiredModule(module = TestModuleA.class, minVersion = "1.0.0")})
|
||||
public class TestModuleC implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,17 +16,17 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.modules.dependencytree;
|
||||
package org.libreccm.modules.dependencytree.test.valid;
|
||||
|
||||
import org.libreccm.modules.Module;
|
||||
import org.libreccm.modules.ModuleDescriptor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@org.libreccm.modules.annotations.Module(
|
||||
name = "org.libreccm.core.ccm-testmodule-a", version = "1.0.0")
|
||||
public class TestModuleRoot implements Module {
|
||||
name = "org.libreccm.core.ccm-testmodule-root", version = "1.0.0")
|
||||
public class TestModuleRoot implements ModuleDescriptor {
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
7
pom.xml
7
pom.xml
|
|
@ -369,7 +369,6 @@
|
|||
<version>1.46</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.imgscalr</groupId>
|
||||
<artifactId>imgscalr-lib</artifactId>
|
||||
|
|
@ -382,6 +381,12 @@
|
|||
<version>1.8.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>oro</groupId>
|
||||
<artifactId>oro</artifactId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue