Skip to content

Commit

Permalink
FORGE-988: AddonManager refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jul 11, 2013
1 parent 7dd63da commit 5a24c23
Show file tree
Hide file tree
Showing 87 changed files with 2,366 additions and 979 deletions.
3 changes: 2 additions & 1 deletion addon-manager/addon/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.forge.addon</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.jboss.forge.addon.manager;

import java.io.File;
import java.util.Set;

import org.jboss.forge.addon.dependencies.DependencyNode;
import org.jboss.forge.furnace.addons.AddonId;

/**
* Information about an addon
*
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
*
*/
public interface AddonInfo
{
/**
* @return Returns the addon that this object is all about
*/
public AddonId getAddon();

/**
* @return Returns list of required addons from {@link AddonInfo#getAddon()}
*/
public Set<AddonInfo> getRequiredAddons();

/**
* @return Returns list of optional addons from {@link AddonInfo#getAddon()}
*/
public Set<AddonInfo> getOptionalAddons();

/**
* @return the {@link File} resources associated with this addon (Additional dependencies)
*/
public Set<File> getResources();

/**
* Returns the {@link DependencyNode} for this Addon
*
* @return
*/
public DependencyNode getDependencyNode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

package org.jboss.forge.addon.manager;

import org.jboss.forge.addon.manager.request.DeployRequest;
import org.jboss.forge.addon.manager.request.DisableRequest;
import org.jboss.forge.addon.manager.request.EnableRequest;
import org.jboss.forge.addon.manager.request.InstallRequest;
import org.jboss.forge.addon.manager.request.RemoveRequest;
import org.jboss.forge.furnace.addons.AddonId;
import org.jboss.forge.furnace.repositories.AddonRepository;
import org.jboss.forge.furnace.services.Exported;
Expand All @@ -20,18 +25,92 @@
@Exported
public interface AddonManager
{
/**
* @param id the addon to be informed
* @return information about the {@link AddonId}, like required and optional addons that this addon depends on.
*/
AddonInfo info(AddonId addonId);

/**
* Create a new {@link InstallRequest} for the given {@link AddonId}.
*
* @param id the addon to be installed
* @return the request for installation
*/
public abstract InstallRequest install(AddonId id);
InstallRequest install(AddonId id);

/**
* Create a new {@link InstallRequest} for the given {@link AddonId} and {@link AddonRepository}.
*
* @param id the addon to be installed
* @param addonRepository the {@link AddonRepository} to be used
* @return the request for installation
*/
InstallRequest install(AddonId id, AddonRepository addonRepository);

/**
* Create a new {@link DeployRequest} for the given {@link AddonId}.
*
* @param id the addon to be installed
* @return the request for installation
*/
DeployRequest deploy(AddonId id);

/**
* Create a new {@link DeployRequest} for the given {@link AddonId} and {@link AddonRepository}.
*
* @param id the addon to be deployed
* @param addonRepository the {@link AddonRepository} to be used
* @return the request for installation
*/
DeployRequest deploy(AddonId id, AddonRepository addonRepository);

/**
* Create a new {@link RemoveRequest} for the given {@link AddonId}.
*
* @param id the addon to be removed
* @return the request for removal
*/
public abstract RemoveRequest remove(AddonId id);
RemoveRequest remove(AddonId id);

/**
* Create a new {@link RemoveRequest} for the given {@link AddonId} and {@link AddonRepository}.
*
* @param id the addon to be removed
* @return the request for removal
*/
RemoveRequest remove(AddonId id, AddonRepository addonRepository);

/**
* Create a new {@link EnableRequest} for the given {@link AddonId}.
*
* @param id the addon to be enabled
* @return the request for activation
*/
EnableRequest enable(AddonId id);

/**
* Create a new {@link EnableRequest} for the given {@link AddonId} and {@link AddonRepository}.
*
* @param id the addon to be enabled
* @return the request for activation
*/
EnableRequest enable(AddonId id, AddonRepository addonRepository);

/**
* Create a new {@link DisableRequest} for the given {@link AddonId}.
*
* @param id the addon to be disabled
* @return the request for deactivation
*/
DisableRequest disable(AddonId id);

/**
* Create a new {@link DisableRequest} for the given {@link AddonId} and {@link AddonRepository}.
*
* @param id the addon to be enabled
* @return the request for activation
*/
public abstract DisableRequest disable(AddonId id);
DisableRequest disable(AddonId id, AddonRepository addonRepository);

}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.jboss.forge.addon.manager.request;

import org.jboss.forge.addon.manager.AddonInfo;

/**
* Super interface for actions targeted at a specific addon
*
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
*
*/
public interface AddonActionRequest
{
/**
* Target Addon
*/
AddonInfo getRequestedAddonInfo();

/**
* Execute the desired request
*/
void perform();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.jboss.forge.addon.manager.request;

/**
* When an addon is installed, another addons could be required. This object returns the necessary information for the
* installation of an addon to succeed, like required addons and dependencies
*
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
*
*/
public interface DeployRequest extends AddonActionRequest
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.jboss.forge.addon.manager.request;

import org.jboss.forge.furnace.addons.AddonId;

/**
* This object is responsible for disabling an {@link AddonId}.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface DisableRequest extends AddonActionRequest
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2013 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.jboss.forge.addon.manager.request;

import org.jboss.forge.furnace.addons.AddonId;

/**
* This object is responsible for enabling an {@link AddonId}.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface EnableRequest extends AddonActionRequest
{

}

0 comments on commit 5a24c23

Please sign in to comment.