[jboss-cvs] JBossAS SVN: r99830 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice/bootstrap and 26 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 22 13:31:24 EST 2010
Author: emuckenhuber
Date: 2010-01-22 13:31:21 -0500 (Fri, 22 Jan 2010)
New Revision: 99830
Added:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ManagementDomain.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ServerConfiguration.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackActions.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPlugin.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerLifeCycleCallback.java
projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/classloader.xml
projects/profileservice/trunk/core/src/test/resources/system/static/deployment/
projects/profileservice/trunk/core/src/test/resources/system/static/deployment/hd-scanner-jboss-beans.xml
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirementResolverPlugin.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileFeatureMetaData.java
Removed:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/ProfileServiceDomainBootstrap.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileKernelControllerContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java
Modified:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/AbstractHDScannerFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScanner.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/ScannerConfiguration.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ScanPeriod.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNode.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml
projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml
projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml
projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/DependencyMode.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryFactory.java
Log:
reuse a simple beanmetadata and kernel context, instead of handling the lifecycle separate
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,11 +21,9 @@
*/
package org.jboss.profileservice;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -36,11 +34,6 @@
import org.jboss.dependency.spi.DependencyItem;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
-import org.jboss.profileservice.dependency.ProfileControllerContext;
-import org.jboss.profileservice.dependency.ProfileDependencyContext;
import org.jboss.profileservice.dependency.ProfileServiceController;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
@@ -58,95 +51,116 @@
public class AbstractProfileService implements ProfileService
{
- /** The logger. */
- private static final Logger log = Logger.getLogger(AbstractProfileService.class);
+ /** The management view. */
+ private ManagementView mgtView;
+
+ /** The deployment manager. */
+ private DeploymentManager deploymentMgr;
/** The controller. */
private final ProfileServiceController controller;
- /** The local profile registry. */
- private ProfileMetaDataRegistry domain;
-
- /** The deployment manager plugin. */
- private DeploymentManager deploymentMgr;
-
- /** The management view plugin. */
- private ManagementView mgtView;
-
- public AbstractProfileService(Kernel kernel) throws Exception
+ public AbstractProfileService(ProfileServiceController controller)
{
- if(kernel == null)
+ if(controller == null)
{
- throw new IllegalArgumentException("null kernel");
+ throw new IllegalArgumentException("null controller");
}
- // Create a scoped controller
- this.controller = new ProfileServiceController(kernel);
+ this.controller = controller;
}
+ /**
+ * {@inheritDoc}
+ */
public DeploymentManager getDeploymentManager()
{
return this.deploymentMgr;
}
+ /**
+ * Set the deployment manager.
+ *
+ * @param deploymentMgr the deployment manager
+ */
public void setDeploymentManager(DeploymentManager deploymentMgr)
{
+ if(deploymentMgr == null)
+ {
+ throw new IllegalArgumentException("null deployment manager");
+ }
this.deploymentMgr = deploymentMgr;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public ManagementView getViewManager()
{
return this.mgtView;
}
+ /**
+ * Set the management view.
+ *
+ * @param mgtView the management view
+ */
public void setViewManager(ManagementView mgtView)
{
this.mgtView = mgtView;
}
-
- public ProfileMetaDataRegistry getDomain()
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<ProfileKey> getProfileKeys()
{
- return domain;
+ return controller.getRegisteredProfiles();
}
- public void setDomain(ProfileMetaDataRegistry domain)
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<ProfileKey> getActiveProfileKeys()
{
- this.domain = domain;
+ return controller.getActiveProfiles();
}
- public void create()
+ /**
+ * {@inheritDoc}
+ */
+ public Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException
{
- if(domain == null)
+ if(key == null)
{
- throw new IllegalStateException("null domain injected");
+ throw new IllegalArgumentException("null profile key");
}
+ return controller.getInstalledContext(key).getProfile();
}
- @Override
- public String getDomainName()
+ /**
+ * {@inheritDoc}
+ */
+ public ProfileKey registerProfile(ProfileMetaData metaData) throws Exception
{
- return this.domain.getDomainName();
+ return registerProfile(metaData, null);
}
- @Override
- public String getServerName()
+ /**
+ * {@inheritDoc}
+ */
+ public ProfileKey registerProfile(ProfileMetaData metaData, Profile profile) throws Exception
{
- return this.domain.getServerName();
- }
-
- public void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception
- {
- if(key == null)
+ if(metaData == null)
{
- throw new IllegalArgumentException("null profile key");
+ throw new IllegalArgumentException("null profile meta data");
}
- ControllerContext ctx = controller.getContext(key, null);
- if(ctx == null)
+ if(controller.isRegistered(metaData))
{
- throw new NoSuchProfileException("No such registered profile" + key);
+ return controller.resolveProfileKey(metaData);
}
try
{
- controller.change(ctx, ControllerState.INSTALLED);
+ return controller.registerAndInstallContext(metaData, profile);
}
catch(Exception e)
{
@@ -154,165 +168,84 @@
}
catch(Throwable t)
{
- throw new RuntimeException("failed to install profile " + key, t);
+ throw new RuntimeException(t);
}
}
- public void deactivateProfile(ProfileKey key) throws NoSuchProfileException
+ /**
+ * {@inheritDoc}
+ */
+ public void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception
{
if(key == null)
{
throw new IllegalArgumentException("null profile key");
}
- ControllerContext ctx = controller.getInstalledContext(key);
- if(ctx == null)
+ try
{
- throw new NoSuchProfileException("No such registered profile" + key);
+ controller.activate(key);
}
- try
+ catch(Exception e)
{
- controller.change(ctx, ControllerState.NOT_INSTALLED);
+ throw e;
}
catch(Throwable t)
{
- throw new RuntimeException("failed to uninstall profile " + key, t);
- }
- }
-
- public Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException
- {
- if(key == null)
- {
- throw new IllegalArgumentException("null profile key");
+ throw new RuntimeException(t);
}
- ControllerContext ctx = controller.getInstalledContext(key);
- if(ctx instanceof ProfileControllerContext)
- {
- return ((ProfileControllerContext)ctx).getProfile();
- }
- throw new NoSuchProfileException("No active profile " + key);
}
-
- public Collection<ProfileKey> getActiveProfileKeys()
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deactivateProfile(ProfileKey key) throws NoSuchProfileException
{
- List<ProfileKey> profiles = new ArrayList<ProfileKey>();
- for(ControllerContext ctx : controller.getContextsByState(ControllerState.INSTALLED))
- {
- if(ctx instanceof ProfileControllerContext)
- {
- ProfileControllerContext profileCtx = (ProfileControllerContext) ctx;
- profiles.add((ProfileKey) profileCtx.getName());
- }
- }
- return profiles;
- }
-
- public Collection<ProfileKey> getProfileKeys()
- {
- List<ProfileKey> profiles = new ArrayList<ProfileKey>();
- for(ControllerContext ctx : controller.getAllContexts())
- {
- if(ctx instanceof ProfileControllerContext)
- {
- ProfileControllerContext profileCtx = (ProfileControllerContext) ctx;
- profiles.add((ProfileKey) profileCtx.getName());
- }
- }
- return profiles;
- }
-
- public ProfileMetaData getProfileMetaData(ProfileKey key) throws NoSuchProfileException
- {
if(key == null)
{
throw new IllegalArgumentException("null profile key");
}
- ControllerContext ctx = controller.getContext(key, null);
- if(ctx instanceof ProfileControllerContext)
+ if(controller.isInstalled(key) == false)
{
- return ((ProfileControllerContext)ctx).getProfileMetaData();
+ return;
}
- throw new NoSuchProfileException("No such registered profile " + key);
- }
-
- public ProfileKey registerProfile(ProfileMetaData metaData) throws Exception
- {
- if(metaData == null)
- {
- throw new IllegalArgumentException("null profile meta data");
- }
- return registerProfile(metaData, null);
- }
-
- public ProfileKey registerProfile(ProfileMetaData metaData, Profile profile) throws Exception
- {
- if(metaData == null)
- {
- throw new IllegalArgumentException("null profile meta data");
- }
- // Create the profile key
- ProfileKey key = new ProfileKey(getDomainName(), getServerName(), metaData.getName());
- if(domain.getProfile(key) != null)
- {
- return key;
- }
- // Register
- // TODO this should be plugable?
- ProfileDependencyContext dependency = new ProfileDependencyContext(key, metaData, domain);
- domain.addProfile(dependency);
-
- ProfileControllerContext ctx = new ProfileControllerContext(dependency, profile);
- if(ctx == null)
- {
- throw new IllegalStateException("created null profile context");
- }
try
{
- controller.install(ctx);
- log.debug("registering " + ctx);
+ controller.deactivate(key);
}
- catch(Exception e)
- {
- throw e;
- }
catch(Throwable t)
{
- throw new RuntimeException("failed to install profile context" + metaData.getName(), t);
+ throw new RuntimeException(t);
}
- return key;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public void unregisterProfile(ProfileKey key) throws NoSuchProfileException
{
if(key == null)
{
throw new IllegalArgumentException("null profile key");
}
- ControllerContext ctx = controller.getContext(key, null);
- if(ctx == null)
+ if(controller.isInstalled(key))
{
- throw new NoSuchProfileException("No such registered profile");
+ throw new RuntimeException("cannot unregister a installed profile");
}
- //
- domain.removeProfile(key);
- //
- controller.uninstall(key);
+ controller.unInstallAndUnregisterContext(key);
}
+ /**
+ * {@inheritDoc}
+ */
public void validateProfile(ProfileKey key) throws Exception
{
if(key == null)
{
throw new IllegalArgumentException("null profile key");
}
- ControllerContext ctx = controller.getContext(key, null);
- if(ctx == null)
- {
- throw new NoSuchProfileException("No such profile registered " + key);
- }
- validate(ctx);
+ validate(controller.getRegisteredContext(key));
}
-
+
/**
* Check if all dependencies are satisfied and the profile was installed successfully.
*
@@ -373,7 +306,7 @@
{
if (iDependOn != null)
{
- other = controller.getContext(iDependOn, null);
+ other = controller.getContext(iDependOn);
if (other != null)
otherState = other.getState();
}
@@ -457,6 +390,5 @@
// Fail
throw new IllegalStateException(buffer.toString());
}
-
-}
-
+
+}
\ No newline at end of file
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,83 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This 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 software 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 software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.profileservice;
-
-/**
- * The management domain information.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ManagementDomain
-{
-
- /** The domain name. */
- private String name;
-
- public ManagementDomain(String name)
- {
- if(name == null)
- {
- throw new IllegalArgumentException("null domain name");
- }
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- @Override
- public int hashCode()
- {
- return getName().hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if(obj == this)
- return true;
- if(obj == null || obj instanceof ManagementDomain == false)
- return false;
- return getName().equals(((ManagementDomain)obj).getName());
- }
-
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(getClass().getSimpleName());
- builder.append('{');
- builder.append("domainName=").append(getName());
- toString(builder);
- builder.append('}');
- return builder.toString();
- }
-
- protected void toString(StringBuilder builder)
- {
- //
- }
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.profileservice.spi.ProfileDeployment;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public interface ProfileDeployerPlugin
-{
-
- /**
- * Add a deployment.
- *
- * @param deployment the profile deployment.
- * @throws Exception
- */
- void addDeployment(ProfileDeployment deployment) throws Exception;
-
- /**
- * Remove a deployment.
- *
- * @param deployment the profile deployment
- * @throws Exception
- */
- void removeDeployment(ProfileDeployment deployment) throws Exception;
-
- /**
- * Process ...
- */
- void process();
-
- /**
- * Check complete.
- *
- * @param names the deployment names
- * @throws Excetion
- */
- void checkComplete(String... names) throws Exception;
-
- /**
- * Check complete.
- *
- * @throws Exception
- */
- void checkComplete() throws Exception;
-
- /**
- * Flag indicating if redeployment is supported.
- *
- * @return true if deployments can be re-added, false otherwise
- */
- boolean isSupportRedeployment();
-
- /**
- * Get a managed deployment.
- *
- * @param deployment the profile deployment
- * @return the managed deployment
- * @throws Exception if the deployment don't exist
- */
- ManagedDeployment getManagedDeployment(ProfileDeployment deployment) throws Exception;
-
- /**
- * Tell the deployer we are about to shutdown
- */
- void prepareShutdown();
-
- /**
- * Shutdown. Removes all the deployments.
- */
- void shutdown();
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-
-/**
- * A deployer registry to swap the used deployer. Normally either a
- * BasicXmlDeployer or the MainDeployer.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileDeployerPluginRegistry
-{
- /** The instance. */
- private static final ProfileDeployerPluginRegistry INSTANCE = new ProfileDeployerPluginRegistry();
-
- /** The default. */
- private static final String DEFAULT = "___default___";
-
- /** The registered deployers. */
- private Map<String, ProfileDeployerPlugin> map = new ConcurrentHashMap<String, ProfileDeployerPlugin>();
-
- public static ProfileDeployerPluginRegistry getInstance()
- {
- return INSTANCE;
- }
-
- protected ProfileDeployerPluginRegistry()
- {
-
- }
-
-
- public ProfileDeployerPlugin getDeployer(ProfileMetaData metaData)
- {
- String type = metaData.getClass().getName();
- ProfileDeployerPlugin plugin = map.get(type);
- if(plugin == null)
- plugin = map.get(DEFAULT);
-
- return plugin;
- }
-
- public void setDefaultPlugin(ProfileDeployerPlugin plugin)
- {
- if(plugin == null)
- throw new IllegalArgumentException("null deployer plugin");
-
- map.put(DEFAULT, plugin);
- }
-
- public void removedefaultPlugin()
- {
- map.remove(DEFAULT);
- }
-
- public void addPlugin(String type, ProfileDeployerPlugin plugin)
- {
- if(type == null)
- throw new IllegalArgumentException("null plugin type");
- if(plugin == null)
- throw new IllegalArgumentException("null deployer plugin");
-
- map.put(type, plugin);
- }
-
- public void removePlugin(String type)
- {
- if(type == null)
- throw new IllegalArgumentException("null plugin type");
- this.map.remove(type);
- }
-
- /**
- * Tell the deployers we are about to shutdown
- */
- void prepareShutdown()
- {
- for(ProfileDeployerPlugin deployer : map.values())
- {
- deployer.prepareShutdown();
- }
- }
-
- /**
- * Shutdown. Removes all the deployments.
- */
- void shutdown()
- {
- for(ProfileDeployerPlugin deployer : map.values())
- {
- deployer.shutdown();
- }
- }
-
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,6 +24,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
import org.jboss.profileservice.profile.NoopProfile;
import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
import org.jboss.profileservice.spi.Profile;
@@ -38,12 +40,15 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class TypedProfileFactory implements ProfileFactory<ProfileMetaData, Profile>
+public class TypedProfileFactory implements ProfileFactory<ProfileMetaData, Profile>, KernelControllerContextAware
{
/** The type we create locally. */
private static final String typeName = EmptyProfileMetaData.class.getName();
+ /** The bean name. */
+ private Object name;
+
/** The profile factories. */
private Map<String, ProfileFactory<ProfileMetaData, Profile>> factories = new ConcurrentHashMap<String, ProfileFactory<ProfileMetaData, Profile>>();
@@ -52,6 +57,11 @@
super();
}
+ public Object getName()
+ {
+ return this.name;
+ }
+
public String[] getTypes()
{
return new String[] { typeName };
@@ -183,5 +193,17 @@
this.factories.remove(type);
}
+ @Override
+ public void setKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+ this.name = context.getName();
+ }
+
+ @Override
+ public void unsetKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+
+ }
+
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,12 +24,11 @@
import java.util.Collection;
import org.jboss.kernel.Kernel;
+import org.jboss.profileservice.config.ProfileServiceConfig;
import org.jboss.profileservice.domain.AbstractDomainMetaData;
import org.jboss.profileservice.domain.spi.DomainFeatureNode;
import org.jboss.profileservice.spi.ProfileService;
-
-
/**
* The abstract profile service bootstrap.
*
@@ -45,9 +44,9 @@
/** The profile service. */
private ProfileService profileService;
- public AbstractProfileServiceBootstrap(Kernel kernel)
+ public AbstractProfileServiceBootstrap(Kernel kernel, ProfileServiceConfig config)
{
- super(kernel);
+ super(config);
this.kernel = kernel;
}
@@ -58,8 +57,7 @@
protected ProfileService createProfileService(AbstractDomainMetaData domainMetaData) throws Throwable
{
- this.profileService = super.initialize(domainMetaData);
- return this.profileService;
+ return super.initialize(domainMetaData);
}
protected void start(AbstractDomainMetaData domainMetaData) throws Throwable
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceInitializer.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -27,45 +27,92 @@
import org.jboss.kernel.spi.config.KernelConfig;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.profileservice.AbstractProfileService;
-import org.jboss.profileservice.ManagementDomain;
-import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.config.ManagementDomain;
+import org.jboss.profileservice.config.ProfileServiceConfig;
import org.jboss.profileservice.config.ProfileServiceConstants;
+import org.jboss.profileservice.config.ServerConfiguration;
import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
+import org.jboss.profileservice.dependency.ProfileServiceController;
import org.jboss.profileservice.domain.AbstractDomainMetaData;
import org.jboss.profileservice.domain.ManagementDomainMetaData;
import org.jboss.profileservice.domain.ServerMetaData;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
/**
+ * Helper to create the required services based on the ProfileServiceConfig
+ * and the DomainMetaData.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
abstract class AbstractProfileServiceInitializer
{
protected abstract Kernel getKernel();
- protected abstract ProfileDeployerPluginRegistry getDeployerRegistry();
- protected abstract ProfileFactory<ProfileMetaData, Profile> getProfileFactory();
- public AbstractProfileServiceInitializer(Kernel kernel)
+ /** The profileservice config. */
+ private final ProfileServiceConfig config;
+
+ public AbstractProfileServiceInitializer(ProfileServiceConfig config)
{
-
+ if(config == null)
+ {
+ throw new IllegalArgumentException("null profile service config.");
+ }
+ this.config = config;
}
+ /**
+ * Initialize
+ *
+ * @param domainMetaData the domain meta data
+ * @return the profile service
+ * @throws Throwable for any error
+ */
public ProfileService initialize(AbstractDomainMetaData domainMetaData) throws Throwable
{
- ProfileMetaDataRegistry domain = createLocalDomain(domainMetaData);
- AbstractProfileService ps = new AbstractProfileService(getKernel());
- ps.setDomain(domain);
- register(getKernel(), ProfileServiceConstants.PROFILESERVICE_NAME, ps);
+ // initialize the config
+ config.setManagementDomain(createManagementDomain(domainMetaData));
+ config.setServerConfiguration(createServerConfiguration(domainMetaData));
+
+ return createprofileService();
+ }
+
+ /**
+ * Create the profile service.
+ *
+ * @return the profile service
+ * @throws Throwable
+ */
+ public ProfileService createprofileService() throws Throwable
+ {
+ ProfileMetaDataRegistry registry = createProfileMetaDataRegistry();
+ ProfileServiceController controller = new ProfileServiceController(getKernel().getController(), registry, config);
+ AbstractProfileService ps = new AbstractProfileService(controller);
+ register(ProfileServiceConstants.PROFILESERVICE_NAME, ps);
return ps;
}
- protected ProfileMetaDataRegistry createLocalDomain(AbstractDomainMetaData domainMetaData) throws Throwable
+ /**
+ * Create the profile meta data registry.
+ *
+ * @return the meta data registry
+ * @throws Throwable
+ */
+ protected ProfileMetaDataRegistry createProfileMetaDataRegistry() throws Throwable
{
+ ProfileMetaDataRegistry localDomain = new ProfileMetaDataRegistry(config);
+ register(ProfileServiceConstants.METADATA_REGISTRY_NAME, localDomain);
+ return localDomain;
+ }
+
+ /**
+ * Create the management domain.
+ *
+ * @param domainMetaData the domain meta data
+ * @return the management domain
+ */
+ protected ManagementDomain createManagementDomain(AbstractDomainMetaData domainMetaData)
+ {
ManagementDomainMetaData domain = domainMetaData.getDomain();
if(domain == null)
{
@@ -81,7 +128,18 @@
if(domainName.length() == 0)
{
throw new IllegalArgumentException("empty domain name");
- }
+ }
+ return new ManagementDomain(domainName);
+ }
+
+ /**
+ * Create the server configuration.
+ *
+ * @param domainMetaData the domain meta data
+ * @return the server configuration
+ */
+ protected ServerConfiguration createServerConfiguration(AbstractDomainMetaData domainMetaData)
+ {
ServerMetaData serverMetaData = domainMetaData.getServer();
if(serverMetaData == null)
{
@@ -98,18 +156,24 @@
{
throw new IllegalArgumentException("empty server name");
}
- // The management domain
- ManagementDomain mgtDomain = new ManagementDomain(domainName);
- ProfileMetaDataRegistry localDomain = new ProfileMetaDataRegistry(mgtDomain, serverName);
- localDomain.setProfileDeployers(getDeployerRegistry());
- localDomain.setProfileFactory(getProfileFactory());
- register(getKernel(), ProfileServiceConstants.METADATA_REGISTRY_NAME, localDomain);
- return localDomain;
+ return new ServerConfiguration(serverName);
}
/**
* Register an object
*
+ * @param name the name
+ * @param object the object
+ * @throws Throwable for any error
+ */
+ protected void register(Object name, Object object) throws Throwable
+ {
+ register(getKernel(), name, object);
+ }
+
+ /**
+ * Register an object
+ *
* @param kernel the kernel
* @param name the name
* @param object the object
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/ProfileServiceDomainBootstrap.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/ProfileServiceDomainBootstrap.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/ProfileServiceDomainBootstrap.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,70 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This 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 software 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 software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.profileservice.bootstrap;
-
-import org.jboss.kernel.Kernel;
-import org.jboss.profileservice.ProfileDeployerPluginRegistry;
-import org.jboss.profileservice.domain.spi.DomainMetaDataRepository;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileServiceDomainBootstrap extends AbstractProfileServiceBootstrap
-{
-
- private ProfileDeployerPluginRegistry registry;
- private ProfileFactory<ProfileMetaData, Profile> profileFactory;
- private DomainMetaDataRepository domainMetaDataRepository;
-
- public ProfileServiceDomainBootstrap(Kernel kernel)
- {
- super(kernel);
- }
-
- @Override
- public ProfileDeployerPluginRegistry getDeployerRegistry()
- {
- return this.registry;
- }
-
- public void setDeployerRegistry(ProfileDeployerPluginRegistry registry)
- {
- this.registry = registry;
- }
-
- @Override
- public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
- {
- return this.profileFactory;
- }
-
- public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> profileFactory)
- {
- this.profileFactory = profileFactory;
- }
-
-}
-
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ManagementDomain.java (from rev 99447, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ManagementDomain.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ManagementDomain.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ManagementDomain.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,84 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.config;
+
+/**
+ * The management domain information. This should come from the domain
+ * model and is current only used to build the profile keys.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagementDomain
+{
+
+ /** The domain name. */
+ private String name;
+
+ public ManagementDomain(String name)
+ {
+ if(name == null)
+ {
+ throw new IllegalArgumentException("null domain name");
+ }
+ this.name = name;
+ }
+
+ public String getDomainName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getDomainName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if(obj == this)
+ return true;
+ if(obj == null || obj instanceof ManagementDomain == false)
+ return false;
+ return getDomainName().equals(((ManagementDomain)obj).getDomainName());
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append('{');
+ builder.append("domainName=").append(getDomainName());
+ toString(builder);
+ builder.append('}');
+ return builder.toString();
+ }
+
+ protected void toString(StringBuilder builder)
+ {
+ //
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ProfileServiceConfig.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,40 +21,98 @@
*/
package org.jboss.profileservice.config;
-import org.jboss.kernel.Kernel;
-import org.jboss.profileservice.domain.spi.DomainMetaDataRepository;
+import org.jboss.profileservice.dependency.plugin.ProfileLifeCycleCallbackActions;
+import org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileFactory;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
* Configuration helper to initialize ProfileService.
+ *
+ * TODO differentiate between domain and server specific configuration
+ * TODO create interfaces
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ProfileServiceConfig
+public class ProfileServiceConfig
{
- /**
- * Get the MC Kernel.
- *
- * @return the kernel.
- */
- Kernel getKernel();
+ /** The management domain information. */
+ private ManagementDomain managementDomain;
- /**
- * Create the domain meta data repository.
- *
- * @return the repository
- */
- DomainMetaDataRepository createDomainMetaDataRepository();
+ /** The server configuration. */
+ private ServerConfiguration serverConfiguration;
+
+ /** The LifecycleActions. */
+ private ProfileLifeCycleCallbackActions lifeCycleActions;
- /**
- * Create the profile factory.
- *
- * @return the profile factory
- */
- ProfileFactory<ProfileMetaData, Profile> createProfileFactory();
+ /** The profile factory. */
+ private ProfileFactory<ProfileMetaData, Profile> profileFactory;
+
+ /** The deployer registry. */
+ private ProfileDeployerPluginRegistry deployerRegistry;
+
+ public ProfileServiceConfig()
+ {
+
+ }
+
+ public ProfileServiceConfig(ManagementDomain managementDomain, ServerConfiguration serverConfiguration)
+ {
+ this.managementDomain = managementDomain;
+ this.serverConfiguration = serverConfiguration;
+ }
+
+ public ManagementDomain getManagementDomain()
+ {
+ return managementDomain;
+ }
+
+ public void setManagementDomain(ManagementDomain managementDomain)
+ {
+ this.managementDomain = managementDomain;
+ }
+
+ public ServerConfiguration getServerConfiguration()
+ {
+ return serverConfiguration;
+ }
+
+ public void setServerConfiguration(ServerConfiguration serverConfiguration)
+ {
+ this.serverConfiguration = serverConfiguration;
+ }
+
+ public ProfileLifeCycleCallbackActions getLifeCycleActions()
+ {
+ return lifeCycleActions;
+ }
+
+ public void setLifeCycleActions(ProfileLifeCycleCallbackActions lifeCycleActions)
+ {
+ this.lifeCycleActions = lifeCycleActions;
+ }
+
+ public ProfileDeployerPluginRegistry getDeployerRegistry()
+ {
+ return deployerRegistry;
+ }
+
+ public void setDeployerRegistry(ProfileDeployerPluginRegistry deployerRegistry)
+ {
+ this.deployerRegistry = deployerRegistry;
+ }
+
+ public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
+ {
+ return profileFactory;
+ }
+
+ public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> profileFactory)
+ {
+ this.profileFactory = profileFactory;
+ }
}
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ServerConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ServerConfiguration.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/config/ServerConfiguration.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.config;
+
+/**
+ * The local server configuration which is not management by the domain
+ * model - like the server name. Currently this only used to create the
+ * profile key.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ServerConfiguration
+{
+
+ /** The server name. */
+ private final String name;
+
+ public ServerConfiguration(String name)
+ {
+ if(name == null)
+ {
+ throw new IllegalArgumentException("null server name");
+ }
+ this.name = name;
+ }
+
+ public String getServerName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getServerName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if(obj == this)
+ return true;
+ if(obj == null || obj instanceof ServerConfiguration == false)
+ return false;
+ return getServerName().equals(((ServerConfiguration)obj).getServerName());
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append('{');
+ builder.append("serverName=").append(getServerName());
+ toString(builder);
+ builder.append('}');
+ return builder.toString();
+ }
+
+ protected void toString(StringBuilder builder)
+ {
+ //
+ }
+
+}
+
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-import org.jboss.dependency.plugins.action.ControllerContextAction;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.Profile;
-
-/**
- * A abstract profile install/uninstall action.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileAction implements ControllerContextAction
-{
- /** The logger. */
- protected final Logger log = Logger.getLogger(getClass());
-
- public void install(Profile profile) throws Exception
- {
- //
- }
-
- public void uninstall(Profile profile)
- {
- //
- }
-
- @Override
- public void install(ControllerContext context) throws Throwable
- {
- if(context instanceof ProfileControllerContext)
- {
- Profile profile = ((ProfileControllerContext)context).getProfile();
- if(profile == null)
- return;
-
- // Install
- install(profile);
- }
- }
-
- @Override
- public void uninstall(ControllerContext context)
- {
- if(context instanceof ProfileControllerContext)
- {
- Profile profile = ((ProfileControllerContext)context).getProfile();
- if(profile == null)
- return;
-
- // Uninstall
- uninstall(profile);
- }
- }
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.jboss.profileservice.spi.Profile;
-
-/**
- * A abstract profile lifecycle action.
- * TODO use jboss-reflect for this.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileLifeCycleAction extends AbstractProfileAction
-{
- private static final Class<?>[] parameterTypes = new Class[0];
- private static final Object[] args = new Object[0];
-
- protected abstract String getInstallMethod();
- protected abstract String getUninstallMethod();
-
- @Override
- public void install(Profile profile) throws Exception
- {
- invoke(profile, getInstallMethod());
- }
-
- @Override
- public void uninstall(Profile profile)
- {
- try
- {
- invoke(profile, getUninstallMethod());
- }
- catch(Exception e)
- {
- log.warn("Error invoking uninstall method '" + getUninstallMethod()
- + "' on profile: " + profile.getKey());
- }
- }
-
- protected static void invoke(Profile profile, String method) throws IllegalAccessException, InvocationTargetException
- {
- Method m = null;
- try
- {
- m = profile.getClass().getMethod(method, parameterTypes);
- }
- catch(NoSuchMethodException ignore)
- {
- return;
- }
- invoke(profile, m);
- }
-
- private static void invoke(Profile profile, final Method method) throws IllegalAccessException, InvocationTargetException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- method.setAccessible(true);
- }
- else
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- method.setAccessible(true);
- return null;
- }
- });
- }
- // invoke
- method.invoke(profile, args);
- }
-
-}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,8 +21,10 @@
*/
package org.jboss.profileservice.dependency;
-import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
@@ -33,57 +35,33 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ProfileControllerContext extends AbstractControllerContext
+public class ProfileControllerContext extends AbstractKernelControllerContext
{
- /** The profile assembly context. */
- private ProfileDependencyContext ctx;
+ /** Some addtional meta data information. */
+ private ProfileDependencyContext metaDataContext;
- protected static ProfileKey getKey(ProfileDependencyContext ctx)
+ protected ProfileControllerContext(BeanMetaData metaData, Object target)
{
- if(ctx == null)
- {
- throw new IllegalArgumentException("null ctx");
- }
- if(ctx.getKey() == null)
- {
- throw new IllegalArgumentException("null profile key");
- }
- return ctx.getKey();
+ super(null, metaData, target != null ? ProfileControllerContextActions.getNoInstantiate() : ProfileControllerContextActions.getInstance() , target);
}
-
- protected ProfileControllerContext(ProfileDependencyContext ctx)
+
+ @Override
+ public void setController(Controller controller)
{
- this(ctx, null);
+ ProfileControllerContextActions.initializeController(controller);
+ super.setController(controller);
}
- public ProfileControllerContext(ProfileDependencyContext ctx, Profile profile)
+ public Profile getProfile()
{
- super(getKey(ctx), profile != null ? ProfileControllerContextActions.instantiatedActions : ProfileControllerContextActions.defaultActions);
- if(ctx == null)
- {
- throw new IllegalArgumentException("null profile dependency context");
- }
-
- this.ctx = ctx;
- if(profile != null)
- {
- // Set the target
- setTarget(profile);
- }
- // Make all contexts manual
- if(ctx.isOnDemandEnabled())
- {
- setMode(ControllerMode.ON_DEMAND);
- }
- else
- {
- // Maybe automatic ?
- setMode(ControllerMode.MANUAL);
- }
- // Build the dependencies
- getDependencyContext().describe(this);
+ return Profile.class.cast(super.getTarget());
}
+
+ public ProfileKey getProfileKey()
+ {
+ return getDependencyContext().getKey();
+ }
public ProfileMetaData getProfileMetaData()
{
@@ -92,24 +70,12 @@
public ProfileDependencyContext getDependencyContext()
{
- return ctx;
+ return metaDataContext;
}
- public ProfileKey getProfileKey()
+ void setDependencyContext(ProfileDependencyContext ctx)
{
- return (ProfileKey) this.getName();
+ this.metaDataContext = ctx;
}
-
- public Profile getProfile()
- {
- return getTarget();
- }
-
- @Override
- public Profile getTarget()
- {
- return (Profile) super.getTarget();
- }
-
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,46 +24,94 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.dependency.plugins.AbstractControllerContextActions;
import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.dependency.AutowireAction;
+import org.jboss.kernel.plugins.dependency.ConfigureAction;
+import org.jboss.kernel.plugins.dependency.CreateDestroyLifecycleAction;
+import org.jboss.kernel.plugins.dependency.DescribeAction;
+import org.jboss.kernel.plugins.dependency.InstallAction;
+import org.jboss.kernel.plugins.dependency.InstantiateAction;
+import org.jboss.kernel.plugins.dependency.KernelControllerContextActions;
+import org.jboss.kernel.plugins.dependency.PreInstallAction;
+import org.jboss.kernel.plugins.dependency.StartStopLifecycleAction;
/**
+ * The profile controller context actions.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-class ProfileControllerContextActions
+class ProfileControllerContextActions extends KernelControllerContextActions
{
- /** The default actions. */
- public static final AbstractControllerContextActions defaultActions;
+ /** The single instance */
+ private static volatile ProfileControllerContextActions instance;
+
+ /** Actions without instantiate */
+ private static volatile ProfileControllerContextActions noInstantiate;
- /** The instantiated actions. */
- public static final AbstractControllerContextActions instantiatedActions;
+ static void initializeController(Controller controller)
+ {
+ // Initialize the deploy state
+ controller.addState(ProfileDeployAction.DEPLOY_STATE, ControllerState.INSTALLED);
+ }
- static
+ /**
+ * Get the instance
+ *
+ * @return the actions
+ */
+ public static ProfileControllerContextActions getInstance()
{
- Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
- actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstance());
- actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
- actions.put(ControllerState.START, ProfileStartAction.getInstance());
- actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
- actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
- defaultActions = new AbstractControllerContextActions(actions);
-
- actions = new HashMap<ControllerState, ControllerContextAction>();
- actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
- actions.put(ControllerState.START, ProfileStartAction.getInstance());
- actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
- actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
- instantiatedActions = new AbstractControllerContextActions(actions);
-
+ if (instance == null)
+ {
+ Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+ actions.put(ControllerState.PRE_INSTALL, new PreInstallAction());
+ actions.put(ControllerState.DESCRIBED, new DescribeAction());
+ actions.put(ControllerState.INSTANTIATED, new InstantiateAction());
+ actions.put(ControllerState.CONFIGURED, new ConfigureAction());
+ actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction());
+ actions.put(ControllerState.START, new StartStopLifecycleAction());
+ actions.put(ProfileDeployAction.DEPLOY_STATE, new ProfileDeployAction());
+ actions.put(ControllerState.INSTALLED, new InstallAction());
+ instance = new ProfileControllerContextActions(actions);
+ }
+ return instance;
}
- protected ProfileControllerContextActions()
+ /**
+ * Get no instantiate actions
+ *
+ * @return the actions
+ */
+ public static ProfileControllerContextActions getNoInstantiate()
{
- //
+ if (noInstantiate == null)
+ {
+ Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+ actions.put(ControllerState.PRE_INSTALL, new PreInstallAction());
+ actions.put(ControllerState.DESCRIBED, new DescribeAction());
+ actions.put(ControllerState.INSTANTIATED, new AutowireAction());
+ actions.put(ControllerState.CONFIGURED, new ConfigureAction());
+ actions.put(ControllerState.CREATE, new CreateDestroyLifecycleAction());
+ actions.put(ControllerState.START, new StartStopLifecycleAction());
+ actions.put(ProfileDeployAction.DEPLOY_STATE, new ProfileDeployAction());
+ actions.put(ControllerState.INSTALLED, new InstallAction());
+ noInstantiate = new ProfileControllerContextActions(actions);
+ }
+ return noInstantiate;
}
+ /**
+ * Create a new KernelControllerContextActions.
+ *
+ * @param actions the actions
+ */
+ protected ProfileControllerContextActions(Map<ControllerState, ControllerContextAction> actions)
+ {
+ super(actions);
+ }
}
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-
-/**
- * Basic profile create/destroy action.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileCreateAction extends AbstractProfileLifeCycleAction
-{
- /** The instance. */
- private static final ProfileCreateAction INSTANCE = new ProfileCreateAction();
-
- public static ProfileCreateAction getInstance()
- {
- return INSTANCE;
- }
-
- @Override
- protected String getInstallMethod()
- {
- return "create";
- }
-
- @Override
- protected String getUninstallMethod()
- {
- return "destroy";
- }
-
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -25,21 +25,25 @@
import java.util.Collection;
import java.util.List;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
import org.jboss.profileservice.metadata.helpers.AbstractProfileKeyCapability;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.dependency.ProfileCapability;
import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
/**
- * The dependency context.
+ * A internal profile meta data dependency context. This represents the processed
+ * profile meta data, which is then used to create the actual {@link ControllerContext}
+ * since features might depend on other profiles to be installed/deployed
+ * first before they can be processed.
*
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
@@ -66,6 +70,9 @@
/** The requirements. */
private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
+
+ /** The profile features. */
+ private List<ProfileFeatureMetaData> features = new ArrayList<ProfileFeatureMetaData>();
public ProfileDependencyContext(ProfileKey key, ProfileMetaData metaData, ProfileMetaDataRegistry domain)
{
@@ -101,9 +108,9 @@
return this.domain.getProfileDeployers().getDeployer(getProfileMetaData());
}
- public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
+ public List<ProfileKey> getAliases()
{
- return this.domain.getProfileFactory();
+ return aliases;
}
@Override
@@ -137,6 +144,17 @@
{
return this.requirements;
}
+
+ @Override
+ public void addFeature(ProfileFeatureMetaData feature)
+ {
+ this.features.add(feature);
+ }
+
+ public List<ProfileFeatureMetaData> getFeatures()
+ {
+ return features;
+ }
public boolean isOnDemandEnabled()
{
@@ -161,7 +179,7 @@
return domain.resolve(this, requirement.getRequirement());
}
- protected void describe(ProfileControllerContext context)
+ protected void describe(ControllerContext context)
{
// Create the dependencies
Collection<ProfileRequirement> requirements = getRequirements();
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -23,10 +23,12 @@
import java.util.Collection;
-import org.jboss.dependency.plugins.action.ControllerContextAction;
import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.dependency.InstallsAwareAction;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.logging.Logger;
-import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileDeployment;
@@ -38,58 +40,71 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ProfileDeployAction implements ControllerContextAction
+public class ProfileDeployAction extends InstallsAwareAction
{
- /** The instance. */
- protected static final ProfileDeployAction instance = new ProfileDeployAction();
+ /** The deploy state. */
+ public static final ControllerState DEPLOY_STATE = ControllerState.newState("Deploy");
/** The logger. */
private static final Logger log = Logger.getLogger(ProfileDeployAction.class);
- public static ProfileDeployAction getInstance()
+ @Override
+ protected ControllerState getState()
{
- return instance;
+ return DEPLOY_STATE;
}
+ protected boolean validateContext(ControllerContext context)
+ {
+ return (context instanceof ProfileControllerContext);
+ }
+
+ protected ProfileControllerContext contextCast(ControllerContext context)
+ {
+ return ProfileControllerContext.class.cast(context);
+ }
+
@Override
- public void install(ControllerContext context) throws Exception
+ protected void installActionInternal(KernelControllerContext ctx) throws Throwable
{
- if(context instanceof ProfileControllerContext == false) return;
- ProfileControllerContext ctx = (ProfileControllerContext) context;
-
- Profile profile = ctx.getProfile();
+ super.installActionInternal(ctx);
+ ProfileControllerContext context = ProfileControllerContext.class.cast(ctx);
+ Profile profile = context.getProfile();
if(profile == null)
- throw new NoSuchProfileException("null profile " + ctx.getProfileKey());
+ {
+ throw new NoSuchProfileException("null profile " + context.getProfileKey());
+ }
if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
{
// Get the deployer plugin
- ProfileDeployerPlugin deployer = ctx.getDependencyContext().getDeployer();
+ ProfileDeployerPlugin deployer = context.getDependencyContext().getDeployer();
if(deployer == null)
+ {
throw new IllegalStateException("null deployer for profile " + profile.getKey());
-
+ }
// Deploy
deploy(profile, deployer);
}
}
-
+
@Override
- public void uninstall(ControllerContext context)
+ protected void uninstallActionInternal(KernelControllerContext ctx)
{
- if(context instanceof ProfileControllerContext == false) return;
- ProfileControllerContext ctx = (ProfileControllerContext) context;
-
- Profile profile = ctx.getProfile();
+ ProfileControllerContext context = ProfileControllerContext.class.cast(ctx);
+ Profile profile = context.getProfile();
if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
{
// Get the deployer plugin
- ProfileDeployerPlugin deployer = ctx.getDependencyContext().getDeployer();
+ ProfileDeployerPlugin deployer = context.getDependencyContext().getDeployer();
if(deployer == null)
+ {
throw new IllegalStateException("null deployer for profile " + profile.getKey());
-
+ }
// Undeploy
undeploy(profile, deployer);
}
+ super.uninstallActionInternal(ctx);
}
protected void deploy(Profile profile, ProfileDeployerPlugin deployer) throws Exception
@@ -137,5 +152,5 @@
deployer.process();
}
}
-
+
}
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.Profile;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileInstallAction extends AbstractProfileAction
-{
-
- /** The instance. */
- private static final ProfileInstallAction instance = new ProfileInstallAction();
-
- /** The logger. */
- private static final Logger log = Logger.getLogger(ProfileInstallAction.class);
-
- public static ProfileInstallAction getInstance()
- {
- return instance;
- }
-
- @Override
- public void install(ControllerContext context) throws Throwable
- {
- if(context instanceof ProfileControllerContext)
- {
- Profile profile = ((ProfileControllerContext)context).getProfile();
- if(profile == null)
- return;
-
- // Install
- log.debug("installing profile " + profile);
- }
- }
-
- @Override
- public void uninstall(ControllerContext context)
- {
- if(context instanceof ProfileControllerContext)
- {
- Profile profile = ((ProfileControllerContext)context).getProfile();
- if(profile == null)
- return;
-
- // Uninstall
- if(log.isTraceEnabled())
- log.trace("uninstalling profile " + profile);
- }
- }
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-import org.jboss.dependency.plugins.action.ControllerContextAction;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileInstantiateAction implements ControllerContextAction
-{
-
- /** The instance. */
- protected final static ProfileInstantiateAction instace = new ProfileInstantiateAction();
-
- public static ProfileInstantiateAction getInstance()
- {
- return instace;
- }
-
- @Override
- public void install(ControllerContext context) throws Throwable
- {
- if(context instanceof ProfileControllerContext == false) return;
- ProfileControllerContext ctx = (ProfileControllerContext) context;
-
- ProfileDependencyContext profileCtx = ctx.getDependencyContext();
-
- ProfileFactory<ProfileMetaData, Profile> factory = profileCtx.getProfileFactory();
- Profile profile = factory.createProfile(ctx.getProfileKey(), ctx.getProfileMetaData());
- if(profile == null)
- {
- throw new IllegalStateException("created null profile");
- }
- ctx.setTarget(profile);
- }
-
- @Override
- public void uninstall(ControllerContext context)
- {
- if(context instanceof ProfileControllerContext == false) return;
- ProfileControllerContext ctx = (ProfileControllerContext) context;
- ctx.setTarget(null);
- }
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileKernelControllerContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileKernelControllerContext.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileKernelControllerContext.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,49 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This 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 software 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 software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.profileservice.dependency;
-
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileKernelControllerContext extends AbstractKernelControllerContext
-{
-
- public ProfileKernelControllerContext(BeanInfo info, BeanMetaData metaData, Object target)
- {
- // FIXME ProfileKernelControllerContext constructor
- super(info, metaData, target);
- }
-
- @Override
- public void setController(Controller controller)
- {
- // FIXME setController
- super.setController(controller);
- }
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileMetaDataRegistry.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,6 +21,7 @@
*/
package org.jboss.profileservice.dependency;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -28,8 +29,9 @@
import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.logging.Logger;
-import org.jboss.profileservice.ManagementDomain;
-import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.config.ManagementDomain;
+import org.jboss.profileservice.config.ProfileServiceConfig;
+import org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileFactory;
import org.jboss.profileservice.spi.ProfileKey;
@@ -38,7 +40,7 @@
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
- * The local profile service domain.
+ * The profile meta data registry.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -49,61 +51,39 @@
/** The logger. */
private static final Logger log = Logger.getLogger(ProfileMetaDataRegistry.class);
- /** The management domain information. */
- private final ManagementDomain domain;
+ /** The profile service config. */
+ private final ProfileServiceConfig config;
- /** The server name. */
- private final String server;
-
- /** The profile deployers registry. */
- private ProfileDeployerPluginRegistry deployers;
-
- /** The profile factory. */
- private ProfileFactory<ProfileMetaData, Profile> profileFactory;
-
/** The profiles. */
private List<ProfileDependencyContext> profiles = new CopyOnWriteArrayList<ProfileDependencyContext>();
/** The profiles by name. */
- private Map<String, ProfileDependencyContext> profilesByKey = new ConcurrentHashMap<String, ProfileDependencyContext>();
+ private Map<String, ProfileDependencyContext> profilesByName = new ConcurrentHashMap<String, ProfileDependencyContext>();
+ private List<ProfileKey> registeredProfiles = new ArrayList<ProfileKey>();
+
/** Check consistency. */
private boolean checkConsistency = true;
- public ProfileMetaDataRegistry(ManagementDomain domain, String server)
+ public ProfileMetaDataRegistry(ProfileServiceConfig config)
{
- if(domain == null)
+ if(config == null)
{
- throw new IllegalArgumentException("null management domain");
+ throw new IllegalArgumentException("null profile service config");
}
- if(server == null)
- {
- throw new IllegalArgumentException("null server name");
- }
- this.domain = domain;
- this.server = server;
+ this.config = config;
}
public ProfileDeployerPluginRegistry getProfileDeployers()
{
- return deployers;
+ return config.getDeployerRegistry();
}
- public void setProfileDeployers(ProfileDeployerPluginRegistry deployers)
- {
- this.deployers = deployers;
- }
-
public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
{
- return profileFactory;
+ return config.getProfileFactory();
}
- public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> profileFactory)
- {
- this.profileFactory = profileFactory;
- }
-
public String getDomainName()
{
return domainName();
@@ -111,25 +91,31 @@
public ManagementDomain getDomain()
{
- return this.domain;
+ return config.getManagementDomain();
}
public String getServerName()
{
- return this.server;
+ return config.getServerConfiguration().getServerName();
}
- public void addProfile(ProfileDependencyContext ctx)
+ public List<ProfileKey> getRegisteredProfiles()
{
- if(ctx == null)
+ return this.registeredProfiles;
+ }
+
+ public ProfileKey registerProfileMetaData(ProfileMetaData metaData)
+ {
+ return internalRegister(metaData, true);
+ }
+
+ ProfileKey internalRegister(ProfileMetaData metaData, boolean failOnDuplicates)
+ {
+ if(metaData == null)
{
- throw new IllegalArgumentException("null context");
+ throw new IllegalArgumentException("null profile meta data");
}
- if(ctx.getKey() == null)
- {
- throw new IllegalArgumentException("null profile key");
- }
- String profileName = ctx.getKey().getName();
+ String profileName = metaData.getName();
if(profileName == null)
{
throw new IllegalArgumentException("null profile name");
@@ -139,23 +125,43 @@
{
throw new IllegalArgumentException("empty profile name");
}
+ ProfileKey profileKey = createProfileKey(profileName);
+ if(this.registeredProfiles.contains(profileKey))
+ {
+ if(failOnDuplicates)
+ {
+ throw new IllegalStateException("duplicate profile " + profileKey);
+ }
+ return profileKey;
+ }
+ ProfileDependencyContext context = new ProfileDependencyContext(profileKey, metaData, this);
+ addContext(context);
+ return profileKey;
+ }
+
+ public void addContext(ProfileDependencyContext context)
+ {
+ if(context == null)
+ {
+ throw new IllegalArgumentException("null context");
+ }
if(checkConsistency)
{
// Check if all new capabilities are consistent
- checkConsistent(ctx);
+ checkConsistent(context);
}
-
- this.profiles.add(ctx);
- this.profilesByKey.put(profileName, ctx);
+ this.profiles.add(context);
+ this.registeredProfiles.add(context.getKey());
+ this.profilesByName.put(context.getName(), context);
}
- public ProfileDependencyContext getProfile(String name)
+ public ProfileDependencyContext getContext(String name)
{
if(name == null)
{
throw new IllegalArgumentException("null profile name");
}
- return this.profilesByKey.get(name);
+ return this.profilesByName.get(name);
}
public ProfileDependencyContext getProfile(ProfileKey key)
@@ -169,7 +175,7 @@
{
throw new IllegalArgumentException("null profile name");
}
- return getProfile(profileName);
+ return getContext(profileName);
}
public void removeProfile(ProfileDependencyContext ctx)
@@ -196,7 +202,7 @@
{
throw new IllegalArgumentException("null profle name");
}
- ProfileDependencyContext ctx = this.profilesByKey.remove(profileName);
+ ProfileDependencyContext ctx = this.profilesByName.remove(profileName);
if(ctx != null)
{
this.profiles.remove(ctx);
@@ -205,7 +211,7 @@
protected String domainName()
{
- final String domainName = domain.getName();
+ final String domainName = getDomain().getDomainName();
if(domainName == null)
{
throw new IllegalStateException("null domain name");
@@ -265,5 +271,10 @@
}
}
+ protected ProfileKey createProfileKey(String profileName)
+ {
+ return new ProfileKey(domainName(), getServerName(), profileName);
+ }
+
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -40,10 +40,10 @@
{
/** The profile controller context. */
- private ProfileDependencyContext context;
+ private final ProfileDependencyContext context;
/** The profile requirement to resolve. */
- private ProfileRequirement requirement;
+ private final ProfileRequirement requirement;
public ProfileRequirementDependencyItem(ProfileDependencyContext context, ProfileRequirement requirement, ControllerState state)
{
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,60 +21,212 @@
*/
package org.jboss.profileservice.dependency;
-import org.jboss.dependency.plugins.AbstractController;
-import org.jboss.dependency.plugins.ScopedController;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.beans.metadata.api.model.AutowireType;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.Kernel;
+import org.jboss.dependency.spi.ControllerStateModel;
+import org.jboss.dependency.spi.LifecycleCallbackItem;
+import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.metadata.spi.scope.CommonLevels;
-import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.profileservice.config.ProfileServiceConfig;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
- * A scoped controller for the profile controller context.
+ * Internal controller, handling the interaction between ProfileMetaData
+ * and MC.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ProfileServiceController extends ScopedController
+public class ProfileServiceController
{
+
+ /** The kernel controller. */
+ private final KernelController controller;
+
+ /** The profile service config. */
+ private final ProfileServiceConfig config;
- /** The deploy state. */
- public static final ControllerState DEPLOY_STATE = ControllerState.newState("Deploy");
+ /** The meta data registry. */
+ private final ProfileMetaDataRegistry metaDataRegistry;
+
+ /** The active profiles. */
+ private List<ProfileKey> activeProfiles = new ArrayList<ProfileKey>();
+
+ public ProfileServiceController(final KernelController controller,
+ final ProfileMetaDataRegistry registry, ProfileServiceConfig config)
+ {
+ this.controller = controller;
+ this.metaDataRegistry = registry;
+ this.config = config;
+ }
+
+ public ProfileKey resolveProfileKey(ProfileMetaData metaData)
+ {
+ return metaDataRegistry.createProfileKey(metaData.getName());
+ }
- public ProfileServiceController(Kernel kernel) throws Exception
+ public List<ProfileKey> getRegisteredProfiles()
{
- super();
- setScopeKey(new ScopeKey(CommonLevels.SERVER, "ProfileService"));
- if (kernel.getController() instanceof AbstractController == false)
- throw new IllegalArgumentException("Underlying controller does not extend AbstractController.");
- setParentController((AbstractController) kernel.getController());
- // setUnderlyingController(this);
- getParentController().addController(this);
- addState(DEPLOY_STATE, ControllerState.INSTALLED);
+ return metaDataRegistry.getRegisteredProfiles();
}
+
+ public List<ProfileKey> getActiveProfiles()
+ {
+ return activeProfiles;
+ }
+
+ public boolean isRegistered(ProfileMetaData metaData)
+ {
+ final ProfileKey key = resolveProfileKey(metaData);
+ return isRegistered(key);
+ }
+
+ public boolean isRegistered(ProfileKey key)
+ {
+ return controller.getContext(key, null) != null;
+ }
+
+ public boolean isInstalled(ProfileKey key)
+ {
+ return controller.getContext(key, ControllerState.INSTALLED) != null;
+ }
+
+ public ControllerContext getContext(Object name)
+ {
+ return controller.getContext(name, null);
+ }
+
+ public ControllerStateModel getStates()
+ {
+ return controller.getStates();
+ }
+
+ public ProfileControllerContext getRegisteredContext(ProfileKey key) throws NoSuchProfileException
+ {
+ ControllerContext context = controller.getContext(key, null);
+ if(context instanceof ProfileControllerContext)
+ {
+ return ProfileControllerContext.class.cast(context);
+ }
+ throw new NoSuchProfileException("no such profile registered " + key);
+ }
+
+ public ProfileControllerContext getInstalledContext(ProfileKey key) throws NoSuchProfileException
+ {
+ ControllerContext context = controller.getContext(key, ControllerState.INSTALLED);
+ if(context instanceof ProfileControllerContext)
+ {
+ return ProfileControllerContext.class.cast(context);
+ }
+ throw new NoSuchProfileException("no such profile registered " + key);
+ }
- // Scoped helper methods
+ public ProfileKey registerProfile(ProfileMetaData metaData) throws Throwable
+ {
+ ProfileDependencyContext metaDataContext = internalRegisterProfile(metaData, false);
+ return metaDataContext.getKey();
+ }
- void addScopedControllerContext(ControllerContext context)
+ ProfileDependencyContext internalRegisterProfile(ProfileMetaData metaData, boolean failOnDuplicates)
{
- super.addControllerContext(context);
+ ProfileKey key = metaDataRegistry.internalRegister(metaData, failOnDuplicates);
+ return metaDataRegistry.getContext(key.getName());
}
+
+ public ProfileKey registerAndInstallContext(ProfileMetaData metaData, Profile profile) throws Throwable
+ {
+ ProfileDependencyContext context = internalRegisterProfile(metaData, false);
+ install(context, profile);
+ return context.getKey();
+ }
- void removeScopedControllerContext(ControllerContext context)
+ public void activate(ProfileKey key) throws NoSuchProfileException, Throwable
{
- super.removeControllerContext(context);
+ ProfileControllerContext context = getRegisteredContext(key);
+ controller.change(context, ControllerState.INSTALLED);
+ this.activeProfiles.add(context.getProfileKey());
}
+
+ public void deactivate(ProfileKey key) throws NoSuchProfileException, Throwable
+ {
+ ProfileControllerContext context = getInstalledContext(key);
+ controller.change(context, ControllerState.NOT_INSTALLED);
+ this.activeProfiles.remove(context.getProfileKey());
+ }
+
+ public void unInstallAndUnregisterContext(ProfileKey key) throws NoSuchProfileException
+ {
+ getRegisteredContext(key); // check if it exists
+ unInstallContext(key);
+ metaDataRegistry.removeProfile(key);
+ }
+
+ void install(ProfileDependencyContext context, Profile profile) throws Throwable
+ {
+ ProfileControllerContext pCCtx = createControllerContext(context, profile);
+ controller.install(pCCtx);
+ }
- /**
- * Perform release of resources.
- */
- void release()
+ void unInstallContext(ProfileKey key)
{
- getParentController().removeController(this);
- setUnderlyingController(null);
- setParentController(null);
+ controller.uninstall(key);
}
+
+ ProfileControllerContext createControllerContext(final ProfileDependencyContext context, Profile profile)
+ {
+ final ProfileKey key = context.getKey();
+ final BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(key.toString(), null);
+ // Aliases
+ final Collection<ProfileKey> aliases = context.getAliases();
+ if(aliases != null && aliases.isEmpty() == false)
+ {
+ for(final ProfileKey alias : context.getAliases())
+ {
+ builder.addAlias(alias);
+ }
+ }
+ // Constructor
+ builder.setFactory(metaDataRegistry.getProfileFactory());
+ builder.setFactoryMethod("createProfile");
+ builder.addConstructorParameter(ProfileKey.class.getName(), context.getKey());
+ builder.addConstructorParameter(ProfileMetaData.class.getName(), context.getProfileMetaData());
+ // No autowire
+ builder.setAutowireType(AutowireType.NONE);
+
+ // Create the ControllerContext
+ final ProfileControllerContext kCtx = new ProfileControllerContext(builder.getBeanMetaData(), profile);
+ // Set the correct context name, since BMDB just accepts a string
+ kCtx.setName(context.getKey());
+ // We control the lifecycle
+ kCtx.setMode(ControllerMode.MANUAL);
+ // Describe the the controller context
+ context.describe(kCtx);
+ // Set the meta data context
+ kCtx.setDependencyContext(context);
+
+ // Add the lifecycle callback
+ LifecycleCallbackItem callbackItem = config.getLifeCycleActions();
+ if(callbackItem != null)
+ {
+ kCtx.getDependencyInfo().addLifecycleCallback(callbackItem);
+ }
-
+ // Update scope info
+ kCtx.getScopeInfo().getScope().addScope(CommonLevels.SERVER, key);
+ kCtx.getScopeInfo().getMutableScope().addScope(CommonLevels.SERVER, key);
+
+ // We are done here
+ return kCtx;
+ }
+
}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profileservice.dependency;
-
-/**
- * Basic profile start/stop action.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileStartAction extends AbstractProfileLifeCycleAction
-{
-
- /** The instance. */
- private static final AbstractProfileLifeCycleAction INSTANCE = new ProfileStartAction();
-
- public static AbstractProfileLifeCycleAction getInstance()
- {
- return INSTANCE;
- }
-
- @Override
- protected String getInstallMethod()
- {
- return "start";
- }
-
- @Override
- protected String getUninstallMethod()
- {
- return "stop";
- }
-
-}
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackAction.java (from rev 99746, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackAction.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackAction.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.dependency.plugin;
+
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
+
+/**
+ * A profile lifecycle callback. This will get invoked before the Profile is
+ * getting installed, after create/start and deploy actions were completed
+ * successfully. There is no ordering in which different lifecycle callbacks
+ * are getting called.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileLifeCycleCallbackAction<T extends ProfileFeatureMetaData>
+{
+
+ /**
+ * Get the feature type, when this callback
+ * should be called.
+ *
+ * @return the feature class
+ */
+ Class<T> getFeatureType();
+
+ /**
+ * Install the profile.
+ *
+ * @param profile the profile
+ * @param metaData the profile feature meta data
+ */
+ void install(Profile profile, T metaData);
+
+ /**
+ * Uninstall the profile.
+ *
+ * @param profile the profile
+ * @param metaData the profile feature meta data
+ */
+ void uninstall(Profile profile, T metaData);
+
+}
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackActions.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackActions.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/plugin/ProfileLifeCycleCallbackActions.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,160 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.dependency.plugin;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.LifecycleCallbackItem;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+import org.jboss.profileservice.dependency.ProfileControllerContext;
+import org.jboss.profileservice.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
+import org.jboss.util.collection.ConcurrentReferenceHashMap;
+
+/**
+ * Bridge between a profile feature callback action and the actual
+ * implementation using a MC LifecycleCallbackItem.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileLifeCycleCallbackActions implements LifecycleCallbackItem, KernelControllerContextAware
+{
+
+ /** The value. */
+ private static final Object value = new Object();
+
+ /** My name. */
+ private Object beanName;
+
+ /** The actions. */
+ private Map<ProfileLifeCycleCallbackAction<ProfileFeatureMetaData>, Object> actions = new ConcurrentReferenceHashMap<ProfileLifeCycleCallbackAction<ProfileFeatureMetaData>, Object>();
+
+ public void addCallback(ProfileLifeCycleCallbackAction<ProfileFeatureMetaData> callback)
+ {
+ actions.put(callback, value);
+ }
+
+ public void removeCallback(ProfileLifeCycleCallbackAction<ProfileFeatureMetaData> callback)
+ {
+ actions.remove(callback);
+ }
+
+ void processCallbacks(Profile profile, ProfileDependencyContext context, boolean isInstall)
+ {
+ Collection<ProfileFeatureMetaData> features = context.getFeatures();
+ if(features != null && features.isEmpty() == false)
+ {
+ Collection<ProfileLifeCycleCallbackAction<ProfileFeatureMetaData>> actions = this.actions.keySet();
+ if(actions != null && actions.isEmpty() == false)
+ {
+ for(ProfileFeatureMetaData feature : context.getFeatures())
+ {
+ for(ProfileLifeCycleCallbackAction<ProfileFeatureMetaData> callback : actions)
+ {
+ Class<?> featureClass = callback.getFeatureType();
+ if(featureClass.isAssignableFrom(feature.getClass()))
+ {
+ if(isInstall)
+ {
+ callback.install(profile, feature);
+ }
+ else
+ {
+ callback.uninstall(profile, feature);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // LifecycleCallbackItem
+
+ @Override
+ public Object getBean()
+ {
+ return this.beanName;
+ }
+
+ @Override
+ public ControllerState getDependentState()
+ {
+ return ControllerState.INSTALLED;
+ }
+
+ @Override
+ public ControllerState getWhenRequired()
+ {
+ return ControllerState.INSTALLED;
+ }
+
+ @Override
+ public void install(ControllerContext ctx) throws Exception
+ {
+ if(ctx instanceof ProfileControllerContext)
+ {
+ ProfileControllerContext context = ProfileControllerContext.class.cast(ctx);
+ Profile profile = context.getProfile();
+ ProfileDependencyContext metaDataCtx = context.getDependencyContext();
+ if(profile != null && metaDataCtx != null)
+ {
+ processCallbacks(profile, metaDataCtx, true);
+ }
+ }
+ }
+
+ @Override
+ public void uninstall(ControllerContext ctx)
+ {
+ if(ctx instanceof ProfileControllerContext)
+ {
+ ProfileControllerContext context = ProfileControllerContext.class.cast(ctx);
+ Profile profile = context.getProfile();
+ ProfileDependencyContext metaDataCtx = context.getDependencyContext();
+ if(profile != null && metaDataCtx != null)
+ {
+ processCallbacks(profile, metaDataCtx, false);
+ }
+ }
+ }
+
+ @Override
+ public void setKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+ this.beanName = context.getName();
+ }
+
+ @Override
+ public void unsetKernelControllerContext(KernelControllerContext context) throws Exception
+ {
+ //
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/MainDeployerPlugin.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,8 +24,8 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.profileservice.ProfileDeployerPlugin;
-import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.spi.ProfileDeployment;
/**
@@ -41,23 +41,27 @@
/** The main deployer. */
private final MainDeployer deployer;
- public MainDeployerPlugin(MainDeployer deployer)
+ /** The deployer registry. */
+ private final ProfileDeployerPluginRegistry registry;
+
+ public MainDeployerPlugin(MainDeployer deployer, ProfileDeployerPluginRegistry registry)
{
if(deployer == null)
{
throw new IllegalArgumentException("null deployer");
}
this.deployer = deployer;
+ this.registry = registry;
}
public void start()
{
- ProfileDeployerPluginRegistry.getInstance().setDefaultPlugin(this);
+ registry.setDefaultPlugin(this);
}
public void stop()
{
- ProfileDeployerPluginRegistry.getInstance().removedefaultPlugin();
+ registry.removedefaultPlugin();
}
@Override
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPlugin.java (from rev 99661, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPlugin.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPlugin.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.deployment;
+
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDeployerPlugin
+{
+
+ /**
+ * Add a deployment.
+ *
+ * @param deployment the profile deployment.
+ * @throws Exception
+ */
+ void addDeployment(ProfileDeployment deployment) throws Exception;
+
+ /**
+ * Remove a deployment.
+ *
+ * @param deployment the profile deployment
+ * @throws Exception
+ */
+ void removeDeployment(ProfileDeployment deployment) throws Exception;
+
+ /**
+ * Process ...
+ */
+ void process();
+
+ /**
+ * Check complete.
+ *
+ * @param names the deployment names
+ * @throws Excetion
+ */
+ void checkComplete(String... names) throws Exception;
+
+ /**
+ * Check complete.
+ *
+ * @throws Exception
+ */
+ void checkComplete() throws Exception;
+
+ /**
+ * Flag indicating if redeployment is supported.
+ *
+ * @return true if deployments can be re-added, false otherwise
+ */
+ boolean isSupportRedeployment();
+
+ /**
+ * Get a managed deployment.
+ *
+ * @param deployment the profile deployment
+ * @return the managed deployment
+ * @throws Exception if the deployment don't exist
+ */
+ ManagedDeployment getManagedDeployment(ProfileDeployment deployment) throws Exception;
+
+ /**
+ * Tell the deployer we are about to shutdown
+ */
+ void prepareShutdown();
+
+ /**
+ * Shutdown. Removes all the deployments.
+ */
+ void shutdown();
+
+}
+
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java (from rev 99661, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployment/ProfileDeployerPluginRegistry.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.deployment;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.profileservice.profile.bootstrap.BootstrapDeployerPlugin;
+import org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+
+/**
+ * A deployer registry to swap the used deployer. Normally either a
+ * BasicXmlDeployer or the MainDeployer.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDeployerPluginRegistry
+{
+
+ /** The default. */
+ private static final String DEFAULT = "___default___";
+
+ /** The registered deployers. */
+ private Map<String, ProfileDeployerPlugin> map = new ConcurrentHashMap<String, ProfileDeployerPlugin>();
+
+ public ProfileDeployerPluginRegistry(Kernel kernel)
+ {
+ ProfileDeployerPlugin kernelDeployer = new BootstrapDeployerPlugin(kernel);
+ this.map.put(BootstrapProfileMetaData.class.getName(), kernelDeployer);
+ }
+
+ public ProfileDeployerPlugin getDeployer(ProfileMetaData metaData)
+ {
+ String type = metaData.getClass().getName();
+ ProfileDeployerPlugin plugin = map.get(type);
+ if(plugin == null)
+ plugin = map.get(DEFAULT);
+
+ return plugin;
+ }
+
+ public void setDefaultPlugin(ProfileDeployerPlugin plugin)
+ {
+ if(plugin == null)
+ throw new IllegalArgumentException("null deployer plugin");
+
+ map.put(DEFAULT, plugin);
+ }
+
+ public void removedefaultPlugin()
+ {
+ map.remove(DEFAULT);
+ }
+
+ public void addPlugin(String type, ProfileDeployerPlugin plugin)
+ {
+ if(type == null)
+ throw new IllegalArgumentException("null plugin type");
+ if(plugin == null)
+ throw new IllegalArgumentException("null deployer plugin");
+
+ map.put(type, plugin);
+ }
+
+ public void removePlugin(String type)
+ {
+ if(type == null)
+ throw new IllegalArgumentException("null plugin type");
+ this.map.remove(type);
+ }
+
+ /**
+ * Tell the deployers we are about to shutdown
+ */
+ void prepareShutdown()
+ {
+ for(ProfileDeployerPlugin deployer : map.values())
+ {
+ deployer.prepareShutdown();
+ }
+ }
+
+ /**
+ * Shutdown. Removes all the deployments.
+ */
+ void shutdown()
+ {
+ for(ProfileDeployerPlugin deployer : map.values())
+ {
+ deployer.shutdown();
+ }
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/AbstractHDScannerFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/AbstractHDScannerFactory.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/AbstractHDScannerFactory.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -37,7 +37,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public abstract class AbstractHDScannerFactory implements HDScannerFactory
+abstract class AbstractHDScannerFactory implements HDScannerFactory
{
/** The logger. */
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScanner.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScanner.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScanner.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -26,7 +26,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.logging.Logger;
-import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
import org.jboss.profileservice.spi.ModificationInfo;
import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.ProfileDeployment;
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerLifeCycleCallback.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerLifeCycleCallback.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerLifeCycleCallback.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.hotdeploy;
+
+import org.jboss.profileservice.dependency.plugin.ProfileLifeCycleCallbackAction;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * Lifecycle callback registering a HDScanner, for mutable
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class HDScannerLifeCycleCallback implements ProfileLifeCycleCallbackAction<ScannerConfiguration>
+{
+
+ /** The scanner configuration. */
+ private static final Class<ScannerConfiguration> namespace = ScannerConfiguration.class;
+
+ /** The HDScanner factory. */
+ private final HDScannerFactory hdScannerFactory;
+
+ public HDScannerLifeCycleCallback(HDScannerFactory hdScannerFactory)
+ {
+ if(hdScannerFactory == null)
+ {
+ throw new IllegalArgumentException("null HDScanner factory");
+ }
+ this.hdScannerFactory = hdScannerFactory;
+ }
+
+ @Override
+ public Class<ScannerConfiguration> getFeatureType()
+ {
+ return namespace;
+ }
+
+ @Override
+ public void install(Profile profile, ScannerConfiguration configuration)
+ {
+ if(profile.isMutable() && profile instanceof MutableProfile)
+ {
+ MutableProfile mutable = MutableProfile.class.cast(profile);
+ Scanner scanner = hdScannerFactory.registerScanner(mutable, configuration);
+ }
+ }
+
+ @Override
+ public void uninstall(Profile profile, ScannerConfiguration configuration)
+ {
+ if(profile.isMutable() && profile instanceof MutableProfile)
+ {
+ hdScannerFactory.unregisterScanner(profile.getKey());
+ }
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/ScannerConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/ScannerConfiguration.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/ScannerConfiguration.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -23,13 +23,15 @@
import java.util.concurrent.TimeUnit;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
+
/**
* The hot deployment scanner configuration.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ScannerConfiguration
+public interface ScannerConfiguration extends ProfileFeatureMetaData
{
/**
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -28,7 +28,7 @@
import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
import org.jboss.profileservice.spi.ProfileDeployment;
/**
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ScanPeriod.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ScanPeriod.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ScanPeriod.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -30,6 +30,7 @@
import org.jboss.profileservice.hotdeploy.ScannerConfiguration;
import org.jboss.profileservice.profile.metadata.FeatureRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
@@ -39,7 +40,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ScanPeriod implements ScannerConfiguration, ProfileMetaDataVisitorNode
+public class ScanPeriod implements ScannerConfiguration, ProfileFeatureMetaData, ProfileMetaDataVisitorNode
{
/** Requires hot deployment scanner. */
@@ -99,6 +100,8 @@
{
// require hot deployment profile
visitor.addRequirement(requirement);
+ // Add the hot deployment feature
+ visitor.addFeature(this);
}
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -45,7 +45,7 @@
private ArtifactRepositoryId identifier;
/** The repository configuration. */
- private final ArtifactRepositoryConfiguration configuration;
+ private final ArtifactRepositoryConfiguration<T> configuration;
/** The repository root. */
private final VirtualFile repositoryRoot;
@@ -87,7 +87,7 @@
}
@Override
- public ArtifactRepositoryConfiguration getConfiguration()
+ public ArtifactRepositoryConfiguration<T> getConfiguration()
{
return this.configuration;
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/ArtifactRepositoryManager.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -72,7 +72,7 @@
*/
@Override
public ArtifactRepository<ArtifactId> createArtifactRepository(ArtifactRepositoryId repositoryId,
- ArtifactRepositoryConfiguration configuration) throws IOException
+ ArtifactRepositoryConfiguration<ArtifactId> configuration) throws IOException
{
if(repositoryId == null)
{
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -25,8 +25,6 @@
import org.jboss.profileservice.profile.metadata.plugin.FarmingProfileMetaData;
import org.jboss.profileservice.profile.metadata.plugin.HotDeploymentProfileMetaData;
import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileMetaData;
-import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileSourceMetaData;
-import org.jboss.profileservice.spi.DeploymentRepository;
import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileFactory;
@@ -72,12 +70,12 @@
{
throw new IllegalArgumentException("null profile meta data");
}
- PropertyProfileSourceMetaData source = metaData.getSource();
- DeploymentRepository repository = repositoryFactory.createDeploymentRepository(key, source);
- if(repository == null)
- {
- throw new IllegalStateException("repositoryFactory created null deployment repository");
- }
+// PropertyProfileSourceMetaData source = metaData.getSource();
+// DeploymentRepository repository = repositoryFactory.createDeploymentRepository(key, source);
+// if(repository == null)
+// {
+// throw new IllegalStateException("repositoryFactory created null deployment repository");
+// }
// The delegate profile
// return new DelegateProfile(repository, key);
return new NoopProfile(key);
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/AbstractRequirementResolver.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -77,6 +77,11 @@
this.registry = registry;
}
+ /**
+ * Resolve a context based on it's meta data dependencies.
+ *
+ * @param context
+ */
public void resolve(final ProfileDependencyContext context)
{
if(context == null)
@@ -86,6 +91,12 @@
resolve(context, false);
}
+ /**
+ * Try to resolve a context based on it's meta data dependencies.
+ *
+ * @param context the context
+ * @param fromActivationCallback is recursively called from an activation callback
+ */
void resolve(final ProfileDependencyContext context, final boolean fromActivationCallback)
{
final boolean trace = log.isTraceEnabled();
@@ -110,7 +121,7 @@
}
else
{
- // Store callbacks, we need to process them afterwards
+ // Don't include callbacks we need to process them afterwards
callbacks.add(currentNode);
}
final Collection<ProfileRequirement> requirements = context.getRequirements();
@@ -152,7 +163,7 @@
// If the dependency is already included we can mark it as non-optional
boolean dependencyIncluded = included(depenencyNode);
boolean optional = requirement.isOptional() && dependencyIncluded == false;
- ProfileNodeDependency dependency = new ProfileNodeDependency(currentKey, dependencyKey, optional);
+ final ProfileNodeDependency dependency = new ProfileNodeDependency(requirement, currentKey, dependencyKey, optional);
// Add dependency information
currentNode.addIDependOn(dependency);
@@ -256,6 +267,10 @@
final boolean trace = log.isTraceEnabled();
List<ProfileKey> sorted = new ArrayList<ProfileKey>();
List<ProfileNode> roots = getRoots();
+ if(trace)
+ {
+ log.trace("roots: " + roots);
+ }
while(roots.isEmpty() == false)
{
final ProfileNode node = roots.remove(0);
@@ -293,7 +308,7 @@
}
if(included.size() > 0)
{
- throw new IllegalStateException("failed to resolve dependencies " + included);
+ throw new IllegalStateException(debug());
}
return sorted;
}
@@ -314,12 +329,28 @@
{
roots.add(node);
i.remove();
- log.debug("resolved " + node);
}
}
return roots;
}
}
+ protected String debug()
+ {
+ StringBuilder builder = new StringBuilder("failed to resolve dependencies: \n");
+ for(ProfileNode node : included)
+ {
+ builder.append(node.getKey().getName()).append("\n");
+ for(ProfileNodeDependency dependency : node.getiDependOn())
+ {
+ if(dependency.isResolved() == false)
+ {
+ builder.append(dependency).append("\n");
+ }
+ }
+ }
+ return builder.toString();
+ }
+
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNode.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNode.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNode.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -27,6 +27,8 @@
import org.jboss.profileservice.spi.ProfileKey;
/**
+ * The profile node.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
@@ -52,11 +54,6 @@
return key;
}
- public String getName()
- {
- return key.getName();
- }
-
void addIDependOn(ProfileNodeDependency dependency)
{
this.iDependOn.add(dependency);
@@ -147,7 +144,7 @@
@Override
public String toString()
{
- return getName();
+ return key.getName();
}
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/resolver/ProfileNodeDependency.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -22,29 +22,48 @@
package org.jboss.profileservice.resolver;
import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
/**
+ * A dependency between two profile nodes.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
public class ProfileNodeDependency
{
+ /** The from node. */
private final ProfileKey from;
+
+ /** The to node. */
private final ProfileKey to;
+
+ /** Is optional from -> to. */
+ private boolean optional;
- private boolean optional;
+ /** Is optional from <- to. */
private boolean optionalDependsOnTo;
- private boolean resolved;
+ /** Is marked as resolved. */
+ private boolean resolved = false;
- ProfileNodeDependency(final ProfileKey from, final ProfileKey to, final boolean optional)
+ /** The requirement, for reporting. */
+ private final ProfileRequirement requirement;
+
+ ProfileNodeDependency(final ProfileRequirement requirement, final ProfileKey from, final ProfileKey to, final boolean optional)
{
+ this.requirement = requirement;
this.from = from;
this.to = to;
this.optional = optional;
}
+ public ProfileRequirement getRequirement()
+ {
+ return requirement;
+ }
+
ProfileKey getFrom()
{
return from;
@@ -98,7 +117,7 @@
builder.append(", optional=").append(isOptional());
if(isOptionalDependsOnTo())
{
- builder.append(", optionalDependsTo=").append(isOptionalDependsOnTo());
+ builder.append(", optionalDependsOnTo=true");
}
builder.append("}");
return builder.toString();
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,13 +21,16 @@
*/
package org.jboss.profileservice.virtual.deployment;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The class path location meta data.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
+ at XmlType(propOrder = { "path", "includes", "excludes" })
public class ClassPathLocationMetaData extends AbstractVirtualFileArtifact
{
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -22,6 +22,7 @@
package org.jboss.profileservice.virtual.deployment;
import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
import org.jboss.profileservice.virtual.assembly.BasicVirtualAssemblyContext;
@@ -32,6 +33,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
+ at XmlType(propOrder = { "path", "includes", "excludes" })
public class MetaDataLocationMetaData extends AbstractVirtualFileArtifact implements VirtualArtifactMetaData
{
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -25,14 +25,16 @@
import java.util.Stack;
import org.jboss.logging.Logger;
+import org.jboss.profileservice.dependency.ProfileDependencyContext;
import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
-import org.jboss.profileservice.dependency.ProfileDependencyContext;
import org.jboss.profileservice.domain.spi.DomainFeatureNode;
import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
+import org.jboss.profileservice.profile.metadata.domain.RequiredProfiles.ResolveRequirement;
import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.dependency.ProfileCapability;
import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileFeatureMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
@@ -49,12 +51,15 @@
private final ProfileDependencyContext ctx;
+ private ProfileMetaDataRegistry registry;
+
/** The namespace stack. */
private Stack<String> stack = new Stack<String>();
public AbstractDomainMetaDataVisitor(ProfileMetaDataRegistry domain)
{
this.ctx = new ProfileDependencyContext(new ProfileKey("test"), new EmptyProfileMetaData(), domain);
+ this.registry = domain;
}
public ProfileDependencyContext getCtx()
@@ -70,6 +75,11 @@
@Override
public void addProfileMetaData(ProfileMetaData metaData)
{
+ if(metaData.getName() != null && metaData.getName().equals("test") == false)
+ {
+ addRequirement(new ResolveRequirement(metaData.getName()));
+ registry.registerProfileMetaData(metaData);
+ }
visit(metaData);
log.debug(stack.peek() + " " + metaData.getName());
}
@@ -93,6 +103,13 @@
}
@Override
+ public void addFeature(ProfileFeatureMetaData feature)
+ {
+ // FIXME addFeature
+
+ }
+
+ @Override
public void enableOnDemand(boolean onDemand)
{
// nothing
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/resolver/test/AbstractResolverTest.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -25,7 +25,9 @@
import java.util.Collection;
import java.util.List;
-import org.jboss.profileservice.ManagementDomain;
+import org.jboss.profileservice.config.ManagementDomain;
+import org.jboss.profileservice.config.ProfileServiceConfig;
+import org.jboss.profileservice.config.ServerConfiguration;
import org.jboss.profileservice.dependency.ProfileDependencyContext;
import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
import org.jboss.profileservice.profile.metadata.domain.RequiredProfiles.ResolveRequirement;
@@ -57,9 +59,16 @@
return "test-profile";
}
+ protected ProfileServiceConfig createConfig()
+ {
+ ManagementDomain domain = new ManagementDomain("default");
+ ServerConfiguration server = new ServerConfiguration("default");
+ return new ProfileServiceConfig(domain, server);
+ }
+
protected void parse(String file) throws Exception
{
- registry = new ProfileMetaDataRegistry(new ManagementDomain("default"), "default");
+ registry = new ProfileMetaDataRegistry(createConfig());
resolver = new AbstractRequirementResolver(registry);
TestProfilesMetaData profiles = unmarshal(file, TestProfilesMetaData.class);
for(ProfileMetaData profile : profiles.getProfiles())
@@ -71,7 +80,7 @@
void addProfile(ProfileMetaData metaData)
{
ProfileDependencyContext context = new ProfileDependencyContext(new ProfileKey(metaData.getName()), metaData, registry);
- registry.addProfile(context);
+ registry.addContext(context);
}
List<String> resolve(String xml, String... requirements) throws Exception
@@ -88,7 +97,7 @@
{
context.addRequirement(new ResolveRequirement(requirement));
}
- registry.addProfile(context);
+ registry.addContext(context);
resolver.resolve(context);
return getNames(resolver.sort());
}
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -22,14 +22,11 @@
package org.jboss.test.profileservice.support;
import org.jboss.kernel.Kernel;
-import org.jboss.profileservice.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
+import org.jboss.profileservice.config.ProfileServiceConfig;
import org.jboss.profileservice.domain.AbstractDomainMetaData;
import org.jboss.profileservice.domain.ManagementDomainMetaData;
import org.jboss.profileservice.domain.ServerMetaData;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
@@ -37,37 +34,12 @@
*/
public class ProfileServiceBootstrap extends AbstractProfileServiceBootstrap
{
-
- private ProfileDeployerPluginRegistry registry;
- private ProfileFactory<ProfileMetaData, Profile> profileFactory;
- public ProfileServiceBootstrap(Kernel kernel)
+ public ProfileServiceBootstrap(Kernel kernel, ProfileServiceConfig config)
{
- super(kernel);
+ super(kernel, config);
}
- @Override
- public ProfileDeployerPluginRegistry getDeployerRegistry()
- {
- return this.registry;
- }
-
- public void setDeployerRegistry(ProfileDeployerPluginRegistry registry)
- {
- this.registry = registry;
- }
-
- @Override
- public ProfileFactory<ProfileMetaData, Profile> getProfileFactory()
- {
- return this.profileFactory;
- }
-
- public void setProfileFactory(ProfileFactory<ProfileMetaData, Profile> profileFactory)
- {
- this.profileFactory = profileFactory;
- }
-
public void start() throws Throwable
{
AbstractDomainMetaData domain = new AbstractDomainMetaData();
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -22,14 +22,17 @@
package org.jboss.test.profileservice.test;
import java.net.URL;
+import java.util.Collections;
import java.util.List;
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.profileservice.config.ProfileServiceConstants;
+import org.jboss.profileservice.dependency.ProfileDependencyContext;
import org.jboss.profileservice.dependency.ProfileMetaDataRegistry;
import org.jboss.profileservice.deployers.MainDeployerPlugin;
import org.jboss.profileservice.domain.spi.DomainFeatureNode;
import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.profileservice.hotdeploy.HDScannerFactory;
import org.jboss.profileservice.metadata.ProfileMetaDataFactory;
import org.jboss.profileservice.resolver.AbstractRequirementResolver;
import org.jboss.profileservice.spi.ProfileKey;
@@ -51,7 +54,7 @@
super(name);
}
- public void test() throws Exception
+ public void test() throws Throwable
{
// ((AbstractController)getController()).setExecutor(executor);
// Bootstrap ProfileService
@@ -75,7 +78,7 @@
long millis = System.currentTimeMillis();
for(ProfileMetaData md : metaDataFactory.getProfiles().values())
{
- ps.registerProfile(md);
+ domain.registerProfileMetaData(md);
}
AbstractDomainMetaDataVisitor visitor = new AbstractDomainMetaDataVisitor(domain);
for(DomainFeatureNode node : metaData.getFeatures())
@@ -90,11 +93,22 @@
getLog().debug("processing took " + (System.currentTimeMillis() - millis));
getLog().debug(list);
+ for(ProfileKey key : list)
+ {
+ if(key.getName().equals("test") == false)
+ {
+ ProfileDependencyContext ctx = domain.getProfile(key);
+ ps.registerProfile(ctx.getProfileMetaData());
+ }
+ }
+
for(ProfileKey profile : list)
{
if(profile.getName().equals("test") == false)
{
ps.activateProfile(profile);
+ ps.validateProfile(profile);
+ getLog().debug("activated " + profile.getName());
}
}
@@ -102,7 +116,9 @@
assertNotNull(getBean("MainDeployer", MainDeployer.class));
// Check the profile deployer plugin for MainDeployer
assertNotNull(getBean("MainDeployerPlugin", MainDeployerPlugin.class));
-
+ // Check HDScannerFactory
+ assertNotNull(getBean("HDScannerFactory", HDScannerFactory.class));
+
for(ProfileKey key : ps.getActiveProfileKeys())
{
getLog().debug("active " + key);
@@ -111,9 +127,25 @@
{
if(profile.getName().equals("test") == false)
{
- ps.validateProfile(profile);
+ assertNotNull(profile.toString(), getController().getInstalledContext(profile));
}
}
+ // reverse
+ Collections.reverse(list);
+ for(ProfileKey key : list)
+ {
+ if(key.getName().equals("test") == false)
+ {
+ ps.deactivateProfile(key);
+ }
+ }
+ for(ProfileKey key : list)
+ {
+ if(key.getName().equals("test") == false)
+ {
+ ps.unregisterProfile(key);
+ }
+ }
}
public void testWait() throws Exception
Modified: projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -12,18 +12,16 @@
<requires name="jboss:profile=web" />
<requires name="jboss:profile=clustering" />
<requires name="jboss:profile=stack" />
- <!--
-
- -->
</required-profiles>
<!--
The library classpath configuration.
- -->
+
<classpath name="jboss:profile=classpath"
xmlns="urn:jboss:profileservice:profile:classpath:1.0">
<source path="${jboss.server.lib.url}" archives="*"/>
<source path="${jboss.common.lib.url}" archives="*"/>
</classpath>
+ -->
<!--
Common jboss-deployments.
-->
Modified: projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -4,18 +4,24 @@
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!-- The profile service configuration -->
+ <bean name="ProfileServiceConfig" class="org.jboss.profileservice.config.ProfileServiceConfig">
+ <property name="deployerRegistry"><inject bean="ProfileDeployerPluginRegistry" /></property>
+ <property name="profileFactory"><inject bean="TypedProfileFactory" /></property>
+ <property name="lifeCycleActions"><inject bean="ProfileLifeCycleCallbackActions" /></property>
+ </bean>
+
<!-- The Profile Service -->
<bean name="ProfileServiceBootstrap" class="org.jboss.test.profileservice.support.ProfileServiceBootstrap">
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
+ <parameter><inject bean="ProfileServiceConfig" /></parameter>
</constructor>
- <property name="deployerRegistry"><inject bean="ProfileDeployerPluginRegistry" /></property>
- <property name="profileFactory"><inject bean="TypedProfileFactory" /></property>
</bean>
<!-- A deployerPlugin registry - used when we have to swap the deployer -->
- <bean name="ProfileDeployerPluginRegistry" class="org.jboss.profileservice.ProfileDeployerPluginRegistry">
- <constructor factoryClass="org.jboss.profileservice.ProfileDeployerPluginRegistry" factoryMethod="getInstance"/>
+ <bean name="ProfileDeployerPluginRegistry" class="org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry">
+ <constructor><parameter><inject bean="jboss.kernel:service=Kernel" /></parameter></constructor>
</bean>
<!-- The bootstrap profile factory -->
@@ -23,15 +29,6 @@
<property name="repositoryManager"><inject bean="ArtifactRepositoryManager" /></property>
</bean>
- <!-- A BasicXMlDeployer plugin -->
- <bean name="BasicDeployerPlugin" class="org.jboss.profileservice.profile.bootstrap.BootstrapDeployerPlugin">
- <constructor><parameter><inject bean="jboss.kernel:service=Kernel" /></parameter></constructor>
- <install bean="ProfileDeployerPluginRegistry" method="addPlugin">
- <parameter class="java.lang.String">org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData</parameter>
- <parameter><this/></parameter>
- </install>
- </bean>
-
<!-- The virtual deployment repository -->
<bean name="ArtifactRepositoryManager" class="org.jboss.profileservice.repository.artifact.ArtifactRepositoryManager">
<incallback method="addRepository" />
@@ -46,6 +43,12 @@
<uncallback method="removeProfileFactory" />
</bean>
+ <!-- The lifecycle callback action registry -->
+ <bean name="ProfileLifeCycleCallbackActions" class="org.jboss.profileservice.dependency.plugin.ProfileLifeCycleCallbackActions">
+ <incallback method="addCallback" />
+ <uncallback method="removeCallback" />
+ </bean>
+
<bean name="FileArtifactRepositoryFactory" class="org.jboss.profileservice.repository.artifact.file.FileArtifactRepositoryFactory">
<constructor>
<parameter class="java.net.URI">${jboss.file.repository.url}</parameter>
@@ -59,4 +62,5 @@
<parameter class="java.net.URI">${jboss.artifact.repository.url}</parameter>
</constructor>
</bean>
+
</deployment>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/classloader.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/classloader.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/classloader.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The core classloading system
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader><inject bean="bootstrap-classloader:0.0.0"/></classloader>
+
+ <!--
+ The classloader implementation
+ -->
+ <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+ <classloader><null/></classloader>
+ <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
+ </bean>
+
+ <!--
+ ClassLoader management and resolution
+ -->
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <classloader><null/></classloader>
+ <incallback method="addModule" state="Configured"/>
+ <uncallback method="removeModule" state="Configured"/>
+ </bean>
+
+ <classloader name="bootstrap-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true" />
+
+</deployment>
Modified: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/deployers.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -129,4 +129,26 @@
<constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
</bean>
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ <property name="buildManagedObject">true</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
+ </property>
+ </bean>
+ <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ <property name="system"><inject bean="ClassLoaderSystem"/></property>
+ </bean>
+
</deployment>
Modified: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
-<!--
- <bean name="NoopDeployerPlugin" class="org.jboss.profileservice.NoopProfileDeployerPlugin">
- <install bean="ProfileDeployerPluginRegistry" method="addDefaultPlugin">
- <parameter><this/></parameter>
- </install>
- </bean>
- -->
<bean name="MainDeployerPlugin" class="org.jboss.profileservice.deployers.MainDeployerPlugin">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <constructor>
+ <parameter><inject bean="MainDeployer" /></parameter>
+ <parameter><inject bean="ProfileDeployerPluginRegistry" /></parameter>
+ </constructor>
</bean>
<bean name="Basic Profile Factory" class="org.jboss.profileservice.profile.BasicProfileFactory">
Added: projects/profileservice/trunk/core/src/test/resources/system/static/deployment/hd-scanner-jboss-beans.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/deployment/hd-scanner-jboss-beans.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/deployment/hd-scanner-jboss-beans.xml 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="HDScannerFactory" class="org.jboss.profileservice.hotdeploy.DefaultHDScannerFactory" />
+ <bean name="HDScannerCallbackAction" class="org.jboss.profileservice.hotdeploy.HDScannerLifeCycleCallback">
+ <constructor><parameter><inject bean="HDScannerFactory" /></parameter></constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileView.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,7 +24,7 @@
import java.util.Collection;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.deployment.ProfileDeployerPlugin;
import org.jboss.profileservice.plugins.spi.ProfileView;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileDeployment;
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -38,18 +38,18 @@
{
/**
- * Get the management domain name.
+ * Obtain the ManagementView plugin.
*
- * @return the domain name
+ * @return the ManagementView plugin if supported
*/
- String getDomainName();
-
+ ManagementView getViewManager();
+
/**
- * Get the local server name.
+ * Obtain the DeploymentManager plugin.
*
- * @return the server name
+ * @return the DeploymentManager plugin if supported
*/
- String getServerName();
+ DeploymentManager getDeploymentManager();
/**
* Get the keys for all registered profiles.
@@ -59,15 +59,6 @@
Collection<ProfileKey> getProfileKeys();
/**
- * Obtain the registered profile for the key.
- *
- * @param key - the key for the profile
- * @return the matching profile meta data
- * @throws NoSuchProfileException
- */
- ProfileMetaData getProfileMetaData(ProfileKey key) throws NoSuchProfileException;
-
- /**
* Get the keys for all active profiles.
*
* @return keys for all active profiles
@@ -75,28 +66,6 @@
Collection<ProfileKey> getActiveProfileKeys();
/**
- * Obtain a activated profile for the key.
- *
- * @param key - the key for the profile
- * @return the active profile
- * @throws NoSuchProfileException thrown if there is no
- * active profile
- */
- Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException;
-
- /**
- * Obtain the ManagementView plugin.
- * @return the ManagementView plugin if supported
- */
- ManagementView getViewManager();
-
- /**
- * Obtain the DeploymentManager plugin.
- * @return the DeploymentManager plugin if supported
- */
- DeploymentManager getDeploymentManager();
-
- /**
* Register a Profile.
*
* @param profile the profile meta data
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/DependencyMode.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/DependencyMode.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/DependencyMode.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -24,7 +24,8 @@
import javax.xml.bind.annotation.XmlEnumValue;
/**
- * The dependency mode.
+ * The dependency mode, used to resolve which profiles we have to
+ * include when processing user/server requirements.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -45,8 +46,7 @@
/** Callback activation if the dependencies of the dependent profile are satisfied. */
@XmlEnumValue("activation-callback")
ACTIVATION_CALLBACK;
-
-
+
public static DependencyMode getDefault()
{
return EXPLICIT;
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -21,7 +21,6 @@
*/
package org.jboss.profileservice.spi.dependency;
-
/**
* The profile capability.
*
Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirementResolverPlugin.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirementResolverPlugin.java (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirementResolverPlugin.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.spi.dependency;
+
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * A plugin to resolve specific profile requirements.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileRequirementResolverPlugin<T extends ProfileRequirement>
+{
+
+ /**
+ * The class the resolver plugin handles.
+ *
+ * @return the requirement class
+ */
+ Class<T> getRequirementClass();
+
+ /**
+ * Try to resolve a requirement. This will return the
+ * profile key satisfying this requirement, null if this
+ * resolver cannot resolve the requirement.
+ *
+ * @param requirement the profile requirement
+ * @return the profileKey, null if not resolved
+ */
+ ProfileKey resolve(ProfileRequirement requirement);
+
+}
+
Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileFeatureMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileFeatureMetaData.java (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileFeatureMetaData.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This 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 software 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 software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.spi.metadata;
+
+/**
+ * Common interface to classify a profile feature. This is used to add
+ * additional feature when creating the runtime profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileFeatureMetaData
+{
+
+}
+
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -53,6 +53,13 @@
* @param requirement the profile requirement
*/
void addRequirement(ProfileRequirement requirement);
+
+ /**
+ * Add a profile feature.
+ *
+ * @param feature the feature
+ */
+ void addFeature(ProfileFeatureMetaData feature);
/**
* Enable on demand.
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryFactory.java 2010-01-22 17:06:16 UTC (rev 99829)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryFactory.java 2010-01-22 18:31:21 UTC (rev 99830)
@@ -49,7 +49,7 @@
* @throws IOException
*/
ArtifactRepository<T> createArtifactRepository(ArtifactRepositoryId repositoryId,
- ArtifactRepositoryConfiguration configuration) throws IOException;
+ ArtifactRepositoryConfiguration<T> configuration) throws IOException;
}
More information about the jboss-cvs-commits
mailing list