[jboss-cvs] JBossAS SVN: r97315 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice/metadata and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 2 14:16:02 EST 2009
Author: emuckenhuber
Date: 2009-12-02 14:16:01 -0500 (Wed, 02 Dec 2009)
New Revision: 97315
Added:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java
Removed:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifyable.java
Modified:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.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/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/ProfileServiceController.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/CommonProfileNameSpaces.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureCapability.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureRequirement.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.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/test/BasicProfileServiceUnitTestCase.java
projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml
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/helpers/AbstractProfileKeyMetaData.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java
Log:
add aliases
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -70,6 +70,9 @@
/** The deployments to profile mapping. */
private Map<String, String> deploymentsToProfile = new ConcurrentHashMap<String, String>();
+ /** The activation callback. */
+ private Map<String, ProfileDependencyContext> activationCallback = new ConcurrentHashMap<String, ProfileDependencyContext>();
+
public LocalProfileServiceDomain(ManagementDomain domain, String server)
{
if(domain == null)
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -23,7 +23,6 @@
import org.jboss.dependency.plugins.AbstractControllerContext;
import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
@@ -74,7 +73,8 @@
}
// Make all contexts ON_DEMAND
setMode(ControllerMode.ON_DEMAND);
- setRequiredState(ControllerState.DESCRIBED);
+ // Build the dependencies
+ getDependencyContext().describe(this);
}
public ProfileMetaData getProfileMetaData()
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContextActions.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -44,7 +44,6 @@
static
{
Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
- actions.put(ProfileServiceController.PRE_DESCRIBE_STATE, ProfileDescribeAction.getInstance());
actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstance());
actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
actions.put(ControllerState.START, ProfileStartAction.getInstance());
@@ -53,7 +52,6 @@
defaultActions = new AbstractControllerContextActions(actions);
actions = new HashMap<ControllerState, ControllerContextAction>();
- actions.put(ProfileServiceController.PRE_DESCRIBE_STATE, ProfileDescribeAction.getInstance());
actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
actions.put(ControllerState.START, ProfileStartAction.getInstance());
actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -23,9 +23,10 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.profileservice.ProfileDeployerPlugin;
import org.jboss.profileservice.spi.Profile;
@@ -36,6 +37,7 @@
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
/**
* The dependency context.
@@ -48,10 +50,13 @@
/** The profile key. */
private final ProfileKey key;
-
+
/** The profile meta data. */
private final ProfileMetaData profileMetaData;
+ /** The aliases. */
+ private List<ProfileKey> aliases;
+
/** The local PS domain. */
private final LocalProfileServiceDomain domain;
@@ -61,9 +66,6 @@
/** The requirements. */
private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
- /** Is described. */
- private final AtomicBoolean described = new AtomicBoolean(false);
-
public ProfileDependencyContext(ProfileKey key, ProfileMetaData metaData, LocalProfileServiceDomain domain)
{
if(key == null)
@@ -81,6 +83,14 @@
return key;
}
+ public List<ProfileKey> getAliases()
+ {
+ if(aliases != null)
+ return aliases;
+ else
+ return Collections.emptyList();
+ }
+
public ProfileMetaData getProfileMetaData()
{
return profileMetaData;
@@ -96,6 +106,17 @@
return this.domain.getProfileFactory();
}
+ @Override
+ public void addAlias(String name)
+ {
+ if(aliases == null)
+ {
+ aliases = new ArrayList<ProfileKey>();
+ }
+ // TODO rework how ProfileKey works
+ aliases.add(new ProfileKey(key.getDomain(), key.getServer(), name));
+ }
+
public void addCapability(ProfileCapability capability)
{
this.capabilites.add(capability);
@@ -120,7 +141,7 @@
{
node.visit(this);
}
-
+
protected ProfileKey resolve(ProfileRequirementDependencyItem requirement)
{
return domain.resolve(this, requirement.getRequirement());
@@ -128,18 +149,26 @@
protected void describe(ProfileControllerContext context)
{
- if(described.getAndSet(true))
- return;
-
// Create the dependencies
Collection<ProfileRequirement> requirements = getRequirements();
if(requirements != null && requirements.isEmpty() == false)
{
for(ProfileRequirement requirement : requirements)
{
- context.getDependencyInfo().addIDependOn(
- new ProfileRequirementDependencyItem(this,
- requirement, ControllerState.DESCRIBED));
+ // FIXME
+ if(requirement instanceof SubProfileMetaData)
+ {
+ String profileName = ((SubProfileMetaData)requirement).getName();
+ context.getDependencyInfo().addIDependOn(new AbstractDependencyItem(getKey(),
+ new ProfileKey(key.getDomain(), key.getServer(), profileName),
+ ControllerState.DESCRIBED, ControllerState.INSTALLED));
+ }
+ else
+ {
+ context.getDependencyInfo().addIDependOn(
+ new ProfileRequirementDependencyItem(this,
+ requirement, ControllerState.DESCRIBED));
+ }
}
}
}
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDescribeAction.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -1,51 +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.dependency;
-
-import org.jboss.dependency.spi.ControllerContext;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileDescribeAction extends AbstractProfileAction
-{
-
- /** The instance. */
- private static final ProfileDescribeAction instance = new ProfileDescribeAction();
-
- public static ProfileDescribeAction getInstance()
- {
- return instance;
- }
-
- @Override
- public void install(ControllerContext context) throws Throwable
- {
- if(context instanceof ProfileControllerContext)
- {
- ((ProfileControllerContext)context).getDependencyContext().describe((ProfileControllerContext) context);
- }
- }
-
-}
-
Modified: 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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -21,6 +21,7 @@
*/
package org.jboss.profileservice.dependency;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.logging.Logger;
import org.jboss.profileservice.spi.Profile;
@@ -43,17 +44,32 @@
}
@Override
- public void install(Profile profile) throws Exception
+ public void install(ControllerContext context) throws Throwable
{
- log.debug("installing profile " + profile);
-
+ if(context instanceof ProfileControllerContext)
+ {
+ Profile profile = ((ProfileControllerContext)context).getProfile();
+ if(profile == null)
+ return;
+
+ // Install
+ log.debug("installing profile " + profile);
+ }
}
@Override
- public void uninstall(Profile profile)
+ public void uninstall(ControllerContext context)
{
- if(log.isTraceEnabled())
- log.trace("uninstalling profile " + profile);
+ if(context instanceof ProfileControllerContext)
+ {
+ Profile profile = ((ProfileControllerContext)context).getProfile();
+ if(profile == null)
+ return;
+
+ // Uninstall
+ if(log.isTraceEnabled())
+ log.trace("uninstalling profile " + profile);
+ }
}
}
Modified: 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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -21,10 +21,14 @@
*/
package org.jboss.profileservice.dependency;
+import java.util.List;
+
import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
@@ -48,11 +52,16 @@
if(context instanceof ProfileControllerContext == false) return;
ProfileControllerContext ctx = (ProfileControllerContext) context;
- ProfileFactory<ProfileMetaData, Profile> factory = ctx.getDependencyContext().getProfileFactory();
+ ProfileDependencyContext profileCtx = ctx.getDependencyContext();
+ // FIXME Add aliases, since we install all contexts ON_DEMAND
+ addAliases(context.getController(), ctx.getProfileKey(), profileCtx.getAliases());
+
+ 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);
}
@@ -64,5 +73,23 @@
ctx.setTarget(null);
}
+ /**
+ * FIXME Add aliases.
+ *
+ * @param controller
+ * @param original
+ * @param aliases
+ * @throws Throwable
+ */
+ protected void addAliases(Controller controller, ProfileKey original, List<ProfileKey> aliases) throws Throwable
+ {
+ if(aliases != null && aliases.isEmpty() == false)
+ {
+ for(ProfileKey alias : aliases)
+ {
+ controller.addAlias(alias, original);
+ }
+ }
+ }
}
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -21,25 +21,11 @@
*/
package org.jboss.profileservice.dependency;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
import org.jboss.dependency.plugins.AbstractController;
-import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.plugins.ScopedController;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.dependency.AbstractKernelController;
-import org.jboss.kernel.plugins.dependency.InstallExistingScopeAction;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.event.KernelEvent;
-import org.jboss.kernel.spi.event.KernelEventFilter;
-import org.jboss.kernel.spi.event.KernelEventListener;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.jboss.kernel.spi.registry.KernelRegistryPlugin;
import org.jboss.metadata.spi.scope.CommonLevels;
import org.jboss.metadata.spi.scope.ScopeKey;
@@ -49,12 +35,9 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ProfileServiceController extends AbstractKernelController
+public class ProfileServiceController extends ScopedController
{
- /** The pre describe state. */
- public static final ControllerState PRE_DESCRIBE_STATE = new ControllerState("Pre_Describe");
-
/** The deploy state. */
public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy");
@@ -64,24 +47,12 @@
setScopeKey(new ScopeKey(CommonLevels.SERVER, "ProfileService"));
if (kernel.getController() instanceof AbstractController == false)
throw new IllegalArgumentException("Underlying controller does not extend AbstractController.");
- this.kernel = kernel;
setParentController((AbstractController) kernel.getController());
// setUnderlyingController(this);
getParentController().addController(this);
- addState(PRE_DESCRIBE_STATE, ControllerState.DESCRIBED);
addState(DEPLOY_STATE, ControllerState.INSTALLED);
}
- /**
- * Get parent kernel controller.
- *
- * @return kernel controller
- */
- private KernelController getParentKernelController()
- {
- return (KernelController)getParentController();
- }
-
// Scoped helper methods
void addScopedControllerContext(ControllerContext context)
@@ -104,115 +75,6 @@
setParentController(null);
}
- // Controller methods
-
- protected Map<ControllerState, ControllerContextAction> createAliasActions()
- {
- Map<ControllerState, ControllerContextAction> map = new HashMap<ControllerState, ControllerContextAction>(super.createAliasActions());
- map.put(ControllerState.PRE_INSTALL, InstallExistingScopeAction.INSTANCE);
- return map;
- }
-
- // override, since kernel's contexts are extended with registry plugin
- public ControllerContext getContextLocally(Object name, ControllerState state)
- {
- return super.getContext(name, state);
- }
-
- public ControllerContext getContext(Object name, ControllerState state)
- {
- ControllerContext context = super.getContext(name, state);
- if (context != null)
- {
- return context;
- }
- return getParentController().getContext(name, state);
- }
-
- public Set<ControllerContext> getNotInstalled()
- {
- Set<ControllerContext> uninstalled = new HashSet<ControllerContext>(getParentController().getNotInstalled());
- uninstalled.addAll(super.getNotInstalled());
- return uninstalled;
- }
-
- // KernelController methods
-
- public void fireKernelEvent(KernelEvent event)
- {
- getParentKernelController().fireKernelEvent(event);
- }
-
- public void registerListener(KernelEventListener listener, KernelEventFilter filter, Object handback) throws Throwable
- {
- getParentKernelController().registerListener(listener, filter, handback);
- }
-
- public void unregisterListener(KernelEventListener listener, KernelEventFilter filter, Object handback) throws Throwable
- {
- getParentKernelController().unregisterListener(listener, filter, handback);
- }
-
- public Set<KernelControllerContext> getInstantiatedContexts(Class<?> clazz)
- {
- lockRead();
- try
- {
- Set<KernelControllerContext> contexts = new HashSet<KernelControllerContext>();
- Set<KernelControllerContext> currentContexts = super.getInstantiatedContexts(clazz);
- if (currentContexts != null && currentContexts.size() > 0)
- {
- contexts.addAll(currentContexts);
- }
- Set<KernelControllerContext> parentContexts = getParentKernelController().getInstantiatedContexts(clazz);
- if (parentContexts != null && parentContexts.size() > 0)
- {
- contexts.addAll(parentContexts);
- }
- return contexts.size() > 0 ? contexts : null;
- }
- finally{
- unlockRead();
- }
- }
-
- public Set<KernelControllerContext> getContexts(Class<?> clazz, ControllerState state)
- {
- lockRead();
- try
- {
- Set<KernelControllerContext> contexts = new HashSet<KernelControllerContext>();
- Set<KernelControllerContext> currentContexts = super.getContexts(clazz, state);
- if (currentContexts != null && currentContexts.size() > 0)
- {
- contexts.addAll(currentContexts);
- }
- Set<KernelControllerContext> parentContexts = getParentKernelController().getContexts(clazz, state);
- if (parentContexts != null && parentContexts.size() > 0)
- {
- contexts.addAll(parentContexts);
- }
- return contexts.size() > 0 ? contexts : null;
- }
- finally{
- unlockRead();
- }
- }
-
- // org.jboss.kernel.spi.registry.KernelRegistry plugin method
-
- public KernelRegistryEntry getEntry(Object name)
- {
- KernelRegistryEntry entry = super.getEntry(name);
- if (entry != null)
- return entry;
- if (getParentController() instanceof KernelRegistryPlugin)
- {
- return ((KernelRegistryPlugin)getParentController()).getEntry(name);
- }
- return null;
- }
-
-
+
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -61,6 +61,9 @@
/** The parsed profiles. */
private final Map<String, ProfileMetaData> profiles = new HashMap<String, ProfileMetaData>();
+ /** The unmarshaller. */
+ private final Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+
static
{
resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
@@ -155,8 +158,7 @@
protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
{
- Unmarshaller un = UnmarshallerFactory.newInstance().newUnmarshaller();
- return clazz.cast(un.unmarshal(is, resolver));
+ return clazz.cast(unmarshaller.unmarshal(is, resolver));
}
static class ProfilesFilter implements VirtualFileFilter
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -1,141 +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.metadata;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
-import org.jboss.profileservice.profile.metadata.RootProfileMetaData;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfilesMetaDataFactory
-{
-
- /** The schema binding resolver. */
- private static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
-
- /** The profiles. */
- private ThreadLocal<List<ProfileMetaData>> profiles = new ThreadLocal<List<ProfileMetaData>>();
-
- static
- {
- setClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
- setClassBinding("urn:jboss:profileservice:root:profile:1.0", RootProfileMetaData.class);
- }
-
- public static void setClassBinding(String nsUri, Class<?> clazz)
- {
- resolver.addClassBinding(nsUri, clazz);
- }
-
- public List<ProfileMetaData> parse(URL rootURL) throws Exception
- {
- return parse(ProfileKey.DEFAULT_PROFILE_KEY, rootURL);
- }
-
- public List<ProfileMetaData> parse(ProfileKey key, URL rootURL) throws Exception
- {
- this.profiles.set(new ArrayList<ProfileMetaData>());
- try
- {
- RootProfileMetaData root = unmarshal(rootURL.openStream(), RootProfileMetaData.class);
- //
- if(root.getRootProfiles() != null && root.getRootProfiles().isEmpty() == false)
- {
- for(String profile : root.getRootProfiles())
- {
- URL url = new URL(profile);
- processProfiles(url);
- }
- }
- //
- if(root.getProfiles() != null && root.getProfiles().isEmpty() == false)
- {
- for(ProfileMetaData metaData : root.getProfiles())
- {
- processProfileMetaData(metaData);
- }
- }
-
- // Register the root profile
- // addProfile(root.createRootProfile());
-
- return getProfiles();
- }
- finally
- {
- this.profiles.set(null);
- }
- }
-
- protected List<ProfileMetaData> getProfiles()
- {
- return this.profiles.get();
- }
-
- protected void processProfilesMetaData(ProfilesMetaData metaData) throws Exception
- {
- if(metaData.getProfiles() != null && metaData.getProfiles().isEmpty() == false)
- {
- for(ProfileMetaData md : metaData.getProfiles())
- {
- processProfileMetaData(md);
- }
- }
- }
-
- protected void processProfileMetaData(ProfileMetaData metaData) throws Exception
- {
- addProfile(metaData);
- }
-
- protected void addProfile(ProfileMetaData metaData) throws Exception
- {
- getProfiles().add(metaData);
- }
-
- protected void processProfiles(URL url) throws Exception
- {
- InputStream is = url.openStream();
- processProfilesMetaData(unmarshal(is, ProfilesMetaData.class));
- }
-
- protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
- {
- Unmarshaller un = UnmarshallerFactory.newInstance().newUnmarshaller();
- return clazz.cast(un.unmarshal(is, resolver));
- }
-
-}
-
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -1,58 +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.metadata;
-
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-
-/**
- * A meta data factory, which automatically registers profiles.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class RegisteringProfileMetaDataFactory extends ProfilesMetaDataFactory
-{
-
- /** The profile service. */
- private final ProfileService ps;
-
- public RegisteringProfileMetaDataFactory(ProfileService ps)
- {
- this.ps = ps;
- }
-
- public void addClassBinding(String nsUri, Class<?> clazz)
- {
- setClassBinding(nsUri, clazz);
- }
-
- @Override
- protected void addProfile(ProfileMetaData metaData) throws Exception
- {
- // Register
- this.ps.registerProfile(metaData);
- super.addProfile(metaData);
- }
-
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -49,7 +49,7 @@
@JBossXmlSchema(namespace=CommonProfileNameSpaces.PROFILE_NAMESPACE,
elementFormDefault=XmlNsForm.QUALIFIED,
normalizeSpace=true,
- replacePropertyRefs=true)
+ replacePropertyRefs=false)
@XmlRootElement(name = "profile")
@XmlType(name = "profileType", propOrder = {"aliases", "source", "deployments", "features"})
public class BasicProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData, DomainFeatureNode
@@ -159,6 +159,13 @@
public void visit(ProfileMetaDataVisitor visitor)
{
super.visit(visitor);
+ if(aliases != null && aliases.isEmpty() == false)
+ {
+ for(String alias : aliases)
+ {
+ visitor.addAlias(alias);
+ }
+ }
List<ProfileDeploymentMetaData> deployments = getDeployments();
if(deployments != null && deployments.isEmpty() == false)
{
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/CommonProfileNameSpaces.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/CommonProfileNameSpaces.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/CommonProfileNameSpaces.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -22,7 +22,7 @@
package org.jboss.profileservice.profile.metadata;
/**
- * The common profile namepsaces.
+ * The common profile namespaces.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureCapability.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureCapability.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureCapability.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -29,6 +29,8 @@
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
/**
+ * Management namespace feature capability.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureRequirement.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureRequirement.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureRequirement.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -29,6 +29,8 @@
/**
+ * Management namespace feature requirement.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -1,64 +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.profile.metadata;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at XmlRootElement(name = "root-profile")
- at JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
- namespace= "urn:jboss:profileservice:root:profile:1.0",
- elementFormDefault=XmlNsForm.QUALIFIED,
- normalizeSpace=true)
- at XmlType(name = "rootProfilesType", propOrder = {"rootProfiles", "profiles"})
- at Deprecated
-public class RootProfileMetaData extends ProfilesMetaData
-{
-
- /** The root profiles. */
- private List<String> rootProfiles;
-
- @XmlElement(name = "profile-ref")
- @XmlElementWrapper(name = "profiles")
- public List<String> getRootProfiles()
- {
- return rootProfiles;
- }
-
- public void setRootProfiles(List<String> rootProfiles)
- {
- this.rootProfiles = rootProfiles;
- }
-
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -52,7 +52,7 @@
@JBossXmlSchema(namespace=CommonProfileNameSpaces.REQUIRED_PROFILE_NAMESPACE,
elementFormDefault=XmlNsForm.QUALIFIED,
normalizeSpace=true,
- replacePropertyRefs=true)
+ replacePropertyRefs=false)
@XmlRootElement(name = "profiles")
@XmlType(name = "emptyProfileType", propOrder = "features")
public class EmptyProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData, DomainFeatureNode
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -39,6 +39,9 @@
import org.jboss.xb.annotations.JBossXmlSchema;
/**
+ * The property profile meta data allowing a source reference based on
+ * replacePropertyRefs.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractLegacyDeploymentRepositoryFactory.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -0,0 +1,85 @@
+/*
+* 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.repository.legacy;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+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.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractLegacyDeploymentRepositoryFactory implements DeploymentRepositoryFactory
+{
+
+ /** The repository types. */
+ private static final String[] types;
+
+ static
+ {
+ types = new String[] {
+ PropertyProfileSourceMetaData.class.getName()
+ };
+ }
+
+ @Override
+ public DeploymentRepository createDeploymentRepository(ProfileKey key, ProfileSourceMetaData metaData)
+ throws Exception
+ {
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ if(metaData == null)
+ {
+ throw new IllegalArgumentException("null profile source meta data");
+ }
+ if(metaData instanceof PropertyProfileSourceMetaData == false)
+ {
+ throw new IllegalStateException("wrong meta data type " + metaData.getClass().getName());
+ }
+ URI[] uris = createUris((PropertyProfileSourceMetaData) metaData);
+ DeploymentRepository repository = null;
+ // FIXME We don't have access to description if it's mutable or not,
+ // so do deployment repositories still make sense ?
+ return repository;
+ }
+
+ @Override
+ public String[] getTypes()
+ {
+ return types;
+ }
+
+ protected URI[] createUris(PropertyProfileSourceMetaData metaData) throws URISyntaxException
+ {
+ return new URI[] {new URI(metaData.getPath())};
+ }
+
+}
+
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -25,6 +25,7 @@
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;
@@ -64,12 +65,19 @@
public Profile createProfile(ProfileKey key, PropertyProfileMetaData metaData) throws Exception
{
if(key == null)
+ {
throw new IllegalArgumentException("null profile key");
+ }
if(metaData == null)
+ {
throw new IllegalArgumentException("null profile meta data");
-
- // TODO
- DeploymentRepository repository = null;
+ }
+ 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/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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -63,6 +63,12 @@
}
@Override
+ public void addAlias(String name)
+ {
+ // FIXME
+ }
+
+ @Override
public void addCapability(ProfileCapability capability)
{
// we only care about requirements for the domain
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -22,7 +22,12 @@
package org.jboss.test.profileservice.test;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import org.jboss.dependency.plugins.AbstractController;
import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
import org.jboss.profileservice.dependency.LocalProfileServiceDomain;
import org.jboss.profileservice.domain.spi.DomainFeatureNode;
@@ -43,6 +48,8 @@
public class BasicProfileServiceUnitTestCase extends AbstractProfileServiceTest
{
+ private final Executor executor = Executors.newCachedThreadPool();
+
public BasicProfileServiceUnitTestCase(String name)
{
super(name);
@@ -50,6 +57,7 @@
public void test() throws Exception
{
+ // ((AbstractController)getController()).setExecutor(executor);
// Bootstrap ProfileService
deploy(getResource("system/bootstrap.xml"));
@@ -72,40 +80,32 @@
{
ps.registerProfile(md);
}
-
AbstractDomainMetaDataVisitor visitor = new AbstractDomainMetaDataVisitor();
for(DomainFeatureNode node : metaData.getFeatures())
{
visitor.visit(node);
}
+ List<ProfileKey> activated = new ArrayList<ProfileKey>();
for(ProfileRequirement requirement : visitor.getRequirements())
{
ProfileKey key = resolver.resolve(null, requirement);
ps.activateProfile(key);
+ activated.add(key);
}
- getLog().debug(ps.getActiveProfileKeys());
- //
-// for(ProfileKey key : ps.getActiveProfileKeys())
-// {
-// Profile profile = ps.getActiveProfile(key);
-// for(String deployment : profile.getDeploymentNames())
-// {
-// ProfileDependencyContext ctx = domain.getDeploymentProfile(deployment);
-// assertNotNull(ctx);
-// getLog().debug(deployment + " maps to " + ctx.getKey());
-// assertEquals(key, ctx.getKey());
-// }
-// }
+ for(ProfileKey key : ps.getActiveProfileKeys())
+ {
+ getLog().debug("active " + key);
+ }
+ for(ProfileKey check : activated)
+ {
+ ps.validateProfile(check);
+ }
}
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml 2009-12-02 19:16:01 UTC (rev 97315)
@@ -10,6 +10,9 @@
<profiles xmlns="urn:jboss:profileservice:profile:required:1.0">
<requires name="jboss:profile=minimal" />
<requires name="jboss:profile=web" />
+ <!--
+ <requires name="jboss:profile=stack1" />
+ -->
</profiles>
<!--
The library classpath configuration.
Modified: projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml 2009-12-02 19:16:01 UTC (rev 97315)
@@ -30,6 +30,7 @@
<profile name="jboss:profile=deployment,flavor=hot-deployment">
<file-repository group="deployment" />
<deployment name="hd-scanner-jboss-beans.xml" />
+ <requires name="jboss:profile=threads" />
<management namespace="urn:jboss:profileservice:profile:hot-deployment:1.0" />
</profile>
Modified: projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml 2009-12-02 19:16:01 UTC (rev 97315)
@@ -29,7 +29,7 @@
</virtual-deployment>
</profile>
- <profile name="jboss:profile=web,flavor=clustering">
+ <profile name="jboss:profile=web,type=clustering">
<file-repository group="jboss.web" />
<virtual-deployment name="jboss.web.clustering">
<meta-inf path="clustering" />
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 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -34,6 +34,13 @@
{
/**
+ * Add a alias.
+ *
+ * @param name the alias
+ */
+ void addAlias(String name);
+
+ /**
* Add a profile capability.
*
* @param capability the profile capability
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -106,11 +106,11 @@
return false;
AbstractProfileKeyMetaData other = (AbstractProfileKeyMetaData) obj;
- if(equals(getDomain(), other.getDomain()) == false)
+ if(equals(domain, other.domain) == false)
return false;
- if(equals(getServer(), other.getServer()) == false)
+ if(equals(server, other.server) == false)
return false;
- if(equals(getName(), other.getName()) == false)
+ if(equals(name, other.name) == false)
return false;
return true;
}
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -27,7 +27,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ArtifactId extends Identifyable
+public interface ArtifactId extends Identifiable
{
/**
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -32,7 +32,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ArtifactRepository<T extends ArtifactId>
+public interface ArtifactRepository<T extends ArtifactId> extends Identifiable
{
/**
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -30,7 +30,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ArtifactRepositoryConfiguration extends Serializable, Identifyable
+public interface ArtifactRepositoryConfiguration extends Serializable
{
/**
Copied: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java (from rev 97224, projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifyable.java)
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -0,0 +1,32 @@
+/*
+* 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.spi.repository;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface Identifiable
+{
+
+}
+
Deleted: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifyable.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifyable.java 2009-12-02 18:46:41 UTC (rev 97314)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifyable.java 2009-12-02 19:16:01 UTC (rev 97315)
@@ -1,32 +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.spi.repository;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public interface Identifyable
-{
-
-}
-
More information about the jboss-cvs-commits
mailing list