[jboss-cvs] JBossAS SVN: r97217 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice/bootstrap and 38 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 1 06:14:09 EST 2009
Author: emuckenhuber
Date: 2009-12-01 06:14:07 -0500 (Tue, 01 Dec 2009)
New Revision: 97217
Added:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/
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/HDScannerFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/Scanner.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/BasicProfileFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ActivationPolicy.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/FileRepositorySourceMetaData.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/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ClassPathProfileMetaData.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/FarmingProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/HotDeploymentProfileMetaData.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/profile/metadata/plugin/PropertyProfileSourceMetaData.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/profile/plugin/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.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/repository/virtual/AbstractVirtualProfileFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/
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/DomainMetaDataRepoSupport.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java
projects/profileservice/trunk/core/src/test/resources/metadata/domain/
projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml
projects/profileservice/trunk/core/src/test/resources/system/
projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/
projects/profileservice/trunk/core/src/test/resources/system/profiles/clustering-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/common-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/stack-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml
projects/profileservice/trunk/core/src/test/resources/system/repository/
projects/profileservice/trunk/core/src/test/resources/system/repository/artifacts.xml
projects/profileservice/trunk/core/src/test/resources/system/static/
projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/
projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureNode.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureVisitor.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java
Removed:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/emtpy/
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java
projects/profileservice/trunk/core/src/test/resources/metadata/test.xml
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.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/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/ProfileDependencyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.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/BasicSubProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.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/BasicRepositoryConfiguration.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.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/AbstractProfileServiceTest.java
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/virtual/test/AbstractVirtualAssemblyTestCase.java
projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaDataRepository.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java
projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.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/metadata/helpers/AbstractProfileMetaData.java
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/virtual/assembly/VirtualDeploymentAssemblyContext.java
Log:
[JBPROFILE-4] update profile meta data
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 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -37,6 +37,7 @@
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.LocalProfileServiceDomain;
import org.jboss.profileservice.dependency.ProfileControllerContext;
import org.jboss.profileservice.dependency.ProfileDependencyContext;
@@ -57,6 +58,9 @@
public class AbstractProfileService implements ProfileService
{
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(AbstractProfileService.class);
+
/** The controller. */
private final ProfileServiceController controller;
@@ -262,6 +266,7 @@
try
{
controller.install(ctx);
+ log.debug("registering " + ctx);
}
catch(Exception e)
{
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 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -25,7 +25,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.jboss.profileservice.profile.NoopProfile;
-import org.jboss.profileservice.profile.metadata.emtpy.EmptyProfileMetaData;
+import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileFactory;
import org.jboss.profileservice.spi.ProfileKey;
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 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -30,7 +30,7 @@
import org.jboss.profileservice.ManagementDomain;
import org.jboss.profileservice.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.dependency.LocalProfileServiceDomain;
-import org.jboss.profileservice.domain.DomainMetaData;
+import org.jboss.profileservice.domain.AbstractDomainMetaData;
import org.jboss.profileservice.domain.ManagementDomainMetaData;
import org.jboss.profileservice.domain.ServerMetaData;
import org.jboss.profileservice.spi.Profile;
@@ -57,7 +57,7 @@
protected abstract ProfileDeployerPluginRegistry getDeployerRegistry();
protected abstract ProfileFactory<ProfileMetaData, Profile> getProfileFactory();
- protected ProfileService createProfileService(DomainMetaData domainMetaData) throws Throwable
+ protected ProfileService createProfileService(AbstractDomainMetaData domainMetaData) throws Throwable
{
if(domainMetaData == null)
{
@@ -80,7 +80,7 @@
}
- protected BeanMetaData createLocalDomain(DomainMetaData domainMetaData) throws Throwable
+ protected BeanMetaData createLocalDomain(AbstractDomainMetaData domainMetaData) throws Throwable
{
ManagementDomainMetaData domain = domainMetaData.getDomain();
if(domain == null)
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/LocalProfileServiceDomain.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -231,13 +231,14 @@
return domainName;
}
- protected ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
+ // TODO this should be protected
+ public ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
{
// Resolve the requirements based on the exposed capabilities
final boolean trace = log.isTraceEnabled();
- for(ProfileDependencyContext child : profiles)
+ for(ProfileDependencyContext profile : profiles)
{
- Collection<ProfileCapability> capabilities = child.getCapabilities();
+ Collection<ProfileCapability> capabilities = profile.getCapabilities();
if(capabilities != null && capabilities.isEmpty() == false)
{
for(ProfileCapability capability : capabilities)
@@ -246,9 +247,9 @@
{
if(trace)
{
- log.trace(child.getKey() + ":" + capability + " resolved " + requirement);
+ log.trace(profile.getKey() + ":" + capability + " resolved " + requirement);
}
- return child.getKey();
+ return profile.getKey();
}
}
}
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -23,6 +23,7 @@
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;
@@ -73,6 +74,7 @@
}
// Make all contexts ON_DEMAND
setMode(ControllerMode.ON_DEMAND);
+ setRequiredState(ControllerState.DESCRIBED);
}
public ProfileMetaData getProfileMetaData()
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDependencyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -73,6 +73,7 @@
this.key = key;
this.domain = domain;
this.profileMetaData = metaData;
+ visit(profileMetaData);
}
public ProfileKey getKey()
@@ -129,9 +130,7 @@
{
if(described.getAndSet(true))
return;
-
- // Visit the profile meta data
- visit(profileMetaData);
+
// Create the dependencies
Collection<ProfileRequirement> requirements = getRequirements();
if(requirements != null && requirements.isEmpty() == false)
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/AbstractHDScannerFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,176 @@
+/*
+* 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.hotdeploy;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * The HDScannerFactory represents a HDScanner registry for profiles, having
+ * different scan configurations.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractHDScannerFactory implements HDScannerFactory
+{
+
+ /** The active scans. */
+ private Map<ProfileKey, ScannerWrapper> activeScans = new ConcurrentHashMap<ProfileKey, ScannerWrapper>();
+
+ /**
+ * Schedule a HDScanner for execution.
+ *
+ * @param <T> the expected type
+ * @param scanner the hd scanner runnable
+ * @param interval the schedule interval
+ * @param timeUnit the schedule time unit
+ * @return the scheduled future
+ */
+ abstract <T extends Runnable> ScheduledFuture<T> schedule(T scanner, int interval, TimeUnit timeUnit);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Scanner registerScanner(MutableProfile profile, ScannerConfiguration configuration)
+ {
+ if(profile == null)
+ {
+ throw new IllegalArgumentException("null profile");
+ }
+ ProfileKey key = profile.getKey();
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ if(this.activeScans.containsKey(key))
+ {
+ throw new IllegalArgumentException("scanner already registered for profile " + key);
+ }
+ HDScanner scanner = new HDScanner(profile, null, configuration);
+ ScheduledFuture<HDScanner> future = schedule(scanner, scanner.getInterval(), scanner.getTimeUnit());
+ return addScanner(key, scanner, future);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Scanner unregisterScanner(ProfileKey key)
+ {
+ return unregisterScanner(key, false);
+ }
+
+ protected Scanner unregisterScanner(ProfileKey key, boolean mayInterruptIfRunning)
+ {
+ ScannerWrapper wrapper = this.activeScans.remove(key);
+ if(wrapper != null)
+ {
+ wrapper.stop(mayInterruptIfRunning);
+ }
+ return wrapper;
+ }
+
+ protected Scanner addScanner(ProfileKey key, HDScanner scanner,
+ ScheduledFuture<HDScanner> activeScan)
+ {
+ ScannerWrapper wrapper = new ScannerWrapper(scanner, activeScan);
+ this.activeScans.put(key, wrapper);
+ return wrapper;
+ }
+
+ public void stop()
+ {
+ // Actually all scanners should be unregistered
+ // during the profile lifecycle
+ for(ProfileKey key : this.activeScans.keySet())
+ {
+ unregisterScanner(key, true);
+ }
+ }
+
+ class ScannerWrapper implements Scanner
+ {
+ /** The actual scanner. */
+ private final HDScanner scanner;
+ /** The scanner future. */
+ private ScheduledFuture<HDScanner> activeScan;
+
+ public ScannerWrapper(HDScanner scanner, ScheduledFuture<HDScanner> activeScan)
+ {
+ this.scanner = scanner;
+ this.activeScan = activeScan;
+ }
+
+ @Override
+ public synchronized void resume()
+ {
+ if(activeScan == null)
+ {
+ activeScan = schedule(scanner, scanner.getInterval(), scanner.getTimeUnit());
+ }
+ }
+
+ @Override
+ public synchronized void scan() throws Exception
+ {
+ if(activeScan != null )
+ {
+ activeScan.get().scan();
+ }
+ }
+
+ @Override
+ public synchronized void suspend()
+ {
+ if (activeScan != null)
+ {
+ activeScan.cancel(false);
+ try
+ {
+ activeScan.get();
+ }
+ catch (Exception ignored)
+ {
+ }
+ activeScan = null;
+ }
+ }
+
+ protected synchronized void stop(boolean mayInterruptIfRunning)
+ {
+ if(activeScan != null)
+ {
+ activeScan.cancel(mayInterruptIfRunning);
+ activeScan = null;
+ }
+ }
+ }
+
+}
+
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScanner.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,153 @@
+/*
+* 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.hotdeploy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.hotdeploy.HDScannerFactory.ScannerConfiguration;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.action.deployment.DeploymentAction;
+
+/**
+ * The HDScanner.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+class HDScanner implements Runnable, ScannerConfiguration
+{
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(HDScanner.class);
+
+ /** The mutable profile. */
+ private final MutableProfile profile;
+
+ /** The configuration. */
+ private final ScannerConfiguration configuration;
+
+ /** TODO we should not use the deployer here.
+ * @see DeploymentAction
+ */
+ private final ProfileDeployerPlugin deployer;
+
+ protected HDScanner(MutableProfile profile, ProfileDeployerPlugin plugin, ScannerConfiguration configuration)
+ {
+ if(configuration == null)
+ {
+ throw new IllegalArgumentException("null configuration");
+ }
+ this.profile = profile;
+ this.deployer = plugin;
+ this.configuration = configuration;
+ }
+
+ @Override
+ public int getInterval()
+ {
+ return configuration.getInterval();
+ }
+
+ @Override
+ public TimeUnit getTimeUnit()
+ {
+ return configuration.getTimeUnit();
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ scan();
+ }
+ catch (Throwable e)
+ {
+ log.warn("Scan failed", e);
+ }
+ }
+
+ protected synchronized void scan() throws Exception
+ {
+ boolean trace = log.isTraceEnabled();
+ if(trace)
+ {
+ log.trace("Begin deployment scan: " + profile.getKey());
+ }
+ boolean modified = false;
+ Collection<String> modifiedDeploymentNames = new ArrayList<String>();
+ Collection<ModificationInfo> modifiedDeployments = profile.getModifiedDeployments();
+ for (ModificationInfo info : modifiedDeployments)
+ {
+ ProfileDeployment ctx = info.getDeployment();
+ try
+ {
+ switch (info.getStatus())
+ {
+ case ADDED:
+ case MODIFIED:
+ deployer.addDeployment(ctx);
+ modifiedDeploymentNames.add(ctx.getName());
+ break;
+ case REMOVED:
+ deployer.removeDeployment(ctx);
+ modified = true;
+ break;
+ }
+ }
+ catch(DeploymentException e)
+ {
+ log.warn("Failed to add deployment: " + ctx.getName(), e);
+ }
+ }
+ if (modifiedDeployments.size() > 0)
+ {
+ modified = true;
+ }
+ // Process the changes
+ if (modified)
+ {
+ deployer.process();
+ // Only check the modified deployments to avoid duplicate errors
+ for(String name : modifiedDeploymentNames)
+ {
+ // Can be nulled by a shutdown
+ if (deployer != null)
+ {
+ deployer.checkComplete(name);
+ }
+ }
+ }
+ if(trace)
+ {
+ log.trace("End deployment scan: " + profile.getKey());
+ }
+ }
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/HDScannerFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,70 @@
+/*
+* 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.hotdeploy;
+
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface HDScannerFactory
+{
+
+ /**
+ * Register a mutable profile for HDScanning.
+ *
+ * @param profile the mutable profile
+ * @return the Scanner created
+ */
+ Scanner registerScanner(MutableProfile profile, ScannerConfiguration configuration);
+
+ /**
+ * Unregister a profile from HDScanning.
+ *
+ * @param key the profile key
+ */
+ Scanner unregisterScanner(ProfileKey key);
+
+ public interface ScannerConfiguration
+ {
+ /**
+ * Get the interval
+ *
+ * @return the interval
+ */
+ int getInterval();
+
+ /**
+ * Get the time unit
+ *
+ * @return the time unit
+ */
+ TimeUnit getTimeUnit();
+
+ }
+
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/Scanner.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/Scanner.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/hotdeploy/Scanner.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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;
+
+/**
+ * Simple scanner interface.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface Scanner
+{
+ /**
+ * Suspend scanning.
+ */
+ void suspend();
+
+ /**
+ * Resume scanning.
+ */
+ void resume();
+
+ /**
+ * Do scan.
+ *
+ * @throws Exception for any error
+ */
+ void scan() throws Exception;
+}
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfileMetaDataFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,176 @@
+/*
+* 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.metadata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+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;
+
+/**
+ * Basic profile meta data factory.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileMetaDataFactory
+{
+ /** The profiles suffix. */
+ public static final String PROFILES_SUFFIX = "-profiles.xml";
+
+ /** The instance. */
+ private static final ProfileMetaDataFactory INSTANCE = new ProfileMetaDataFactory();
+
+ /** The profiles filter. */
+ private static final VirtualFileFilter filter = new ProfilesFilter();
+
+ /** The schema resolver. */
+ private static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ /** The parsed profiles. */
+ private final Map<String, ProfileMetaData> profiles = new HashMap<String, ProfileMetaData>();
+
+ static
+ {
+ resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
+ }
+
+ public static ProfileMetaDataFactory getInstance()
+ {
+ return INSTANCE;
+ }
+
+ protected ProfileMetaDataFactory()
+ {
+ //
+ }
+
+ public void setClassBinding(String nsUri, Class<?> clazz)
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalArgumentException("null nsUri");
+ }
+ synchronized(resolver)
+ {
+ if(clazz == null)
+ {
+ resolver.removeClassBinding(nsUri);
+ }
+ else
+ {
+ resolver.addClassBinding(nsUri, clazz);
+ }
+ }
+ }
+
+ public void parse(URL rootURL) throws JBossXBException, IOException
+ {
+ VirtualFile root = VFS.getRoot(rootURL);
+ for(VirtualFile vf : root.getChildren(filter))
+ {
+ parse(vf);
+ }
+ }
+
+ public Map<String, ProfileMetaData> getProfiles()
+ {
+ return profiles;
+ }
+
+ protected void processProfilesMetaData(ProfilesMetaData metaData)
+ {
+ List<ProfileMetaData> profiles = metaData.getProfiles();
+ if(profiles != null && profiles.isEmpty() == false)
+ {
+ for(ProfileMetaData profile : profiles)
+ {
+ addProfileMetaData(profile);
+ }
+ }
+ }
+
+ protected void addProfileMetaData(ProfileMetaData metaData)
+ {
+ String profileName = metaData.getName();
+ if(profileName == null)
+ {
+ throw new IllegalStateException("null profile name");
+ }
+ profileName = profileName.trim();
+ if(profileName.isEmpty())
+ {
+ throw new IllegalStateException("empty profile name");
+ }
+ if(profiles.containsKey(profileName))
+ {
+ // TODO, ignore in case there is a profile override?
+ throw new IllegalStateException("duplicate profile name " + profileName);
+ }
+ profiles.put(profileName, metaData);
+ }
+
+ protected void parse(VirtualFile vf) throws JBossXBException, IOException
+ {
+ try
+ {
+ processProfilesMetaData(unmarshal(vf.openStream(), ProfilesMetaData.class));
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException("failed to parse : " + vf.getPathName(), e);
+ }
+ }
+
+ protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
+ {
+ Unmarshaller un = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return clazz.cast(un.unmarshal(is, resolver));
+ }
+
+ static class ProfilesFilter implements VirtualFileFilter
+ {
+ @Override
+ public boolean accepts(VirtualFile file)
+ {
+ if(file.getName().endsWith(PROFILES_SUFFIX))
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+
+}
+
Modified: 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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -89,7 +89,7 @@
}
// Register the root profile
- addProfile(root.createRootProfile());
+ // addProfile(root.createRootProfile());
return getProfiles();
}
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/BasicProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/BasicProfileFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/BasicProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,75 @@
+/*
+* 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.profile;
+
+import java.util.List;
+
+import org.jboss.profileservice.profile.metadata.BasicProfileMetaData;
+import org.jboss.profileservice.profile.metadata.FileRepositorySourceMetaData;
+import org.jboss.profileservice.repository.virtual.AbstractVirtualProfileFactory;
+import org.jboss.profileservice.repository.virtual.VirtualDeploymentProfile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileFactory extends AbstractVirtualProfileFactory
+ implements ProfileFactory<BasicProfileMetaData, VirtualDeploymentProfile>
+{
+
+ /** The repository types. */
+ private static final String[] types;
+
+ static
+ {
+ types = new String[] {
+ BasicProfileMetaData.class.getName()
+ };
+ }
+
+ @Override
+ public String[] getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public VirtualDeploymentProfile createProfile(ProfileKey key, BasicProfileMetaData metaData) throws Exception
+ {
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ if(metaData == null)
+ {
+ throw new IllegalArgumentException("null profile meta data");
+ }
+ FileRepositorySourceMetaData source = metaData.getSource();
+ List<VirtualDeployment> virtual = getVirtualDeployments(metaData);
+ return new VirtualDeploymentProfile(key, virtual, createRepository(source));
+ }
+
+}
+
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,90 +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.bootstrap;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.profileservice.profile.FilteredProfile;
-import org.jboss.profileservice.profile.metadata.BasicProfileDeploymentMetaData;
-import org.jboss.profileservice.spi.ProfileFactory;
-import org.jboss.profileservice.spi.ProfileKey;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BootstrapProfileContextFactory implements ProfileFactory<BootstrapProfileMetaData, FilteredProfile>
-{
-
- /** The types. */
- private static final String[] types = new String[] { BootstrapProfileMetaData.class.getName() };
-
- @Override
- public String[] getTypes()
- {
- return types;
- }
-
- @Override
- public FilteredProfile createProfile(ProfileKey key, BootstrapProfileMetaData metaData) throws Exception
- {
- if(key == null)
- throw new IllegalArgumentException("null profile key");
- if(metaData == null)
- throw new IllegalArgumentException("null profile meta data");
-
- return new FilteredProfile(key, getDeploymentNames(metaData), getRepositoryURIs(metaData));
- }
-
- protected URI[] getRepositoryURIs(BootstrapProfileMetaData metaData) throws URISyntaxException
- {
- if(metaData.getSource() == null)
- throw new IllegalArgumentException("null profile source");
- if(metaData.getSource().getSources() == null)
- throw new IllegalArgumentException("no sources specified");
-
- List<URI> repositoryURIs = new ArrayList<URI>();
- for(String source : metaData.getSource().getSources())
- {
- repositoryURIs.add(new URI(source));
- }
- return repositoryURIs.toArray( new URI[ repositoryURIs.size() ]);
- }
-
- protected List<String> getDeploymentNames(BootstrapProfileMetaData metaData)
- {
- List<String> deploymentNames = new ArrayList<String>();
- if(metaData.getDeployments() != null && metaData.getDeployments().isEmpty() == false)
- {
- for(BasicProfileDeploymentMetaData deployment : metaData.getDeployments())
- {
- deploymentNames.add(deployment.getPath());
- }
- }
- return deploymentNames;
- }
-
-}
-
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileFactory.java (from rev 97081, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,69 @@
+/*
+ * 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.bootstrap;
+
+import java.util.List;
+
+import org.jboss.profileservice.profile.metadata.FileRepositorySourceMetaData;
+import org.jboss.profileservice.repository.virtual.AbstractVirtualProfileFactory;
+import org.jboss.profileservice.repository.virtual.VirtualDeploymentProfile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * The bootstrap profile factory.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BootstrapProfileFactory extends AbstractVirtualProfileFactory
+ implements ProfileFactory<BootstrapProfileMetaData, VirtualDeploymentProfile>
+{
+
+ /** The types. */
+ private static final String[] types = new String[] { BootstrapProfileMetaData.class.getName() };
+
+ @Override
+ public String[] getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public VirtualDeploymentProfile createProfile(ProfileKey key, BootstrapProfileMetaData metaData) throws Exception
+ {
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ if(metaData == null)
+ {
+ throw new IllegalArgumentException("null profile meta data");
+ }
+ FileRepositorySourceMetaData source = metaData.getSource();
+ List<VirtualDeployment> virtual = getVirtualDeployments(metaData);
+ return new VirtualDeploymentProfile(key, virtual, createRepository(source));
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -25,27 +25,39 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
import org.jboss.profileservice.profile.metadata.BasicProfileDeploymentMetaData;
-import org.jboss.profileservice.profile.metadata.BasicProfileSourceMetaData;
import org.jboss.profileservice.profile.metadata.BasicSubProfileMetaData;
-import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.profile.metadata.FileRepositorySourceMetaData;
+import org.jboss.profileservice.profile.metadata.NamespaceFeatureCapability;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
/**
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
- at XmlType(propOrder = { "source", "deployments" })
-public class BootstrapProfileMetaData extends AbstractProfileMetaData
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "bootstrap")
+ at XmlType(propOrder = { "source", "deployments", "features" })
+public class BootstrapProfileMetaData extends AbstractProfileMetaData implements DomainFeatureNode
{
/** The profile source. */
- private BasicProfileSourceMetaData source;
+ private FileRepositorySourceMetaData source;
/** The deployments. */
private List<BasicProfileDeploymentMetaData> deployments;
@@ -55,21 +67,6 @@
super();
}
- public BootstrapProfileMetaData(String name)
- {
- super(name);
- }
-
- public BootstrapProfileMetaData(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public BootstrapProfileMetaData(ProfileKey key)
- {
- super(key);
- }
-
public List<BasicProfileDeploymentMetaData> getDeployments()
{
return this.deployments;
@@ -107,10 +104,13 @@
}
@Override
- @XmlElement(name = "requires", type = BasicSubProfileMetaData.class)
- public List<SubProfileMetaData> getSubprofiles()
+ @XmlElements({
+ @XmlElement(name = "requires", type = BasicSubProfileMetaData.class),
+ @XmlElement(name = "management", type = NamespaceFeatureCapability.class)
+ })
+ public List<ProfileMetaDataVisitorNode> getFeatures()
{
- return super.getSubprofiles();
+ return super.getFeatures();
}
@XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
@@ -119,13 +119,13 @@
this.deployments = deployments;
}
- @XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
- public BasicProfileSourceMetaData getSource()
+ @XmlElement(name = "file-repository", type = FileRepositorySourceMetaData.class)
+ public FileRepositorySourceMetaData getSource()
{
return this.source;
}
- public void setSource(BasicProfileSourceMetaData source)
+ public void setSource(FileRepositorySourceMetaData source)
{
this.source = source;
}
@@ -134,6 +134,18 @@
{
super.visit(visitor);
}
+
+ @Override
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ public void visit(DomainFeatureVisitor visitor)
+ {
+ visitor.addProfileMetaData(this);
+ }
}
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ActivationPolicy.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ActivationPolicy.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ActivationPolicy.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,46 @@
+/*
+* 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.profile.metadata;
+
+import javax.xml.bind.annotation.XmlEnumValue;
+
+/**
+ * The activation policy.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public enum ActivationPolicy
+{
+// /**
+// * optional
+// */
+// @XmlEnumValue("optional")
+// OPTIONAL,
+
+ /**
+ * install when dependencies are satisfied
+ */
+ @XmlEnumValue("satisfied")
+ SATISFIED
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -21,11 +21,18 @@
*/
package org.jboss.profileservice.profile.metadata;
+import java.util.Collections;
+import java.util.List;
+
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.repository.ArtifactId;
+import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
/**
* The basic profile deployment meta data.
@@ -33,21 +40,56 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class BasicProfileDeploymentMetaData extends FileArtifactId implements ProfileDeploymentMetaData
+ at XmlType(name = "basicDeploymentType", propOrder = {"name"})
+public class BasicProfileDeploymentMetaData implements ProfileDeploymentMetaData, VirtualDeployment
{
+
+ /** The name. */
+ private String name;
@Override
+ public List<VirtualArtifactMetaData> getArtifacts()
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<VirtualDeployment> getChildren()
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
@XmlAttribute(name = "name")
- public String getPath()
+ public String getName()
{
- // FIXME getPath
- return super.getPath();
+ return name;
}
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+ @Override
+ public ArtifactId getPath()
+ {
+ return new FileArtifactId(getName());
+ }
+
+ @Override
public void visit(ProfileMetaDataVisitor visitor)
{
// nothing
}
-
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer(getClass().getSimpleName());
+ buffer.append("{name = ").append(getName()).append("}");
+ return buffer.toString();
+ }
+
}
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -26,15 +26,19 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
/**
* The basic profile meta data.
@@ -42,13 +46,24 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
- at XmlType(name = "profileType", propOrder = {"source", "subprofiles", "deployments"})
-public class BasicProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "profile")
+ at XmlType(name = "profileType", propOrder = {"aliases", "source", "deployments", "features"})
+public class BasicProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData, DomainFeatureNode
{
+
+ /** Requirement on the bootstrap. */
+ private static NamespaceFeatureRequirement BOOTSTRAP = new NamespaceFeatureRequirement(CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE);
- /** The profile source. */
- private BasicProfileSourceMetaData source;
+ /** The aliases. */
+ private List<String> aliases;
+ /** The profile sources. */
+ private FileRepositorySourceMetaData source;
+
/** The deployments. */
private List<ProfileDeploymentMetaData> deployments;
@@ -57,21 +72,6 @@
super();
}
- public BasicProfileMetaData(String name)
- {
- super(name);
- }
-
- public BasicProfileMetaData(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public BasicProfileMetaData(ProfileKey key)
- {
- super(key);
- }
-
public List<ProfileDeploymentMetaData> getDeployments()
{
return this.deployments;
@@ -108,11 +108,30 @@
return super.getName();
}
+ /**
+ * Get the aliases.
+ *
+ * @return the aliases
+ */
+ @XmlElement(name = "alias")
+ public List<String> getAliases()
+ {
+ return aliases;
+ }
+
+ public void setAliases(List<String> aliases)
+ {
+ this.aliases = aliases;
+ }
+
@Override
- @XmlElement(name = "requires", type = BasicSubProfileMetaData.class)
- public List<SubProfileMetaData> getSubprofiles()
+ @XmlElements({
+ @XmlElement(name = "requires", type = BasicSubProfileMetaData.class),
+ @XmlElement(name = "management", type = NamespaceFeatureCapability.class)
+ })
+ public List<ProfileMetaDataVisitorNode> getFeatures()
{
- return super.getSubprofiles();
+ return super.getFeatures();
}
@XmlElements
@@ -125,13 +144,14 @@
this.deployments = deployments;
}
- @XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
- public BasicProfileSourceMetaData getSource()
+ @Override
+ @XmlElement(name = "file-repository", type = FileRepositorySourceMetaData.class)
+ public FileRepositorySourceMetaData getSource()
{
return this.source;
}
- public void setSource(BasicProfileSourceMetaData source)
+ public void setSource(FileRepositorySourceMetaData source)
{
this.source = source;
}
@@ -147,13 +167,20 @@
visitor.visit(deployment);
}
}
+ visitor.addRequirement(BOOTSTRAP);
}
- @XmlTransient
- public boolean isHotDeployment()
+ @Override
+ public void visit(DomainFeatureVisitor visitor)
{
- return false;
+ visitor.addProfileMetaData(this);
}
+
+ @Override
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.PROFILE_NAMESPACE;
+ }
}
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,61 +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.XmlTransient;
-
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
-
-/**
- * The basic profile source meta data.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BasicProfileSourceMetaData implements ProfileSourceMetaData
-{
-
- /** The sources. */
- private List<String> sources;
-
- @XmlTransient
- public String getType()
- {
- return getClass().getName();
- }
-
- @XmlElement(name = "source")
- public List<String> getSources()
- {
- return sources;
- }
-
- public void setSources(List<String> sources)
- {
- this.sources = sources;
- }
-
-}
-
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -39,6 +39,9 @@
/** Is optional. */
private boolean optional = false;
+ /** The activation policy. */
+ private ActivationPolicy activationPolicy;
+
public BasicSubProfileMetaData()
{
super();
@@ -102,5 +105,16 @@
this.optional = optional;
}
+ @XmlAttribute(name = "activation-policy")
+ public ActivationPolicy getActivationPolicy()
+ {
+ return activationPolicy;
+ }
+
+ public void setActivationPolicy(ActivationPolicy activationPolicy)
+ {
+ this.activationPolicy = activationPolicy;
+ }
+
}
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/CommonProfileNameSpaces.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,55 @@
+/*
+* 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.profile.metadata;
+
+/**
+ * The common profile namepsaces.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface CommonProfileNameSpaces
+{
+
+ /** The common profile namespace. */
+ String PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:1.0";
+
+ /** The bootstrap profile namespace. */
+ String BOOTSTRAP_PROFILE_NAMESPACE = "urn:jboss:profileservice:boostrap:1.0";
+
+ /** The classpath namespace. */
+ String CLASSPATH_PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:classpath:1.0";
+
+ /** The required profile reference namespace. */
+ String REQUIRED_PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:required:1.0";
+
+ /** The immutable profile namespace. */
+ String IMMUTABLE_PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:static:1.0";
+
+ /** The hot deployment profile namespace. */
+ String HOTDEPLOY_PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:hot-deployment:1.0";
+
+ /** The farming profile namespace. */
+ String FARMING_PROFILE_NAMESPACE = "urn:jboss:profileservice:profile:farming:1.0";
+
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FileRepositorySourceMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FileRepositorySourceMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/FileRepositorySourceMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,64 @@
+/*
+* 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.profile.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * Additional file repository configuration for a profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class FileRepositorySourceMetaData implements ProfileSourceMetaData
+{
+
+ /** The sub folder in the file repository. */
+ private String group;
+
+ @Override
+ public String getType()
+ {
+ return FileArtifactId.TYPE;
+ }
+
+ /**
+ * Get the file repo group.
+ *
+ * @return the group
+ */
+ @XmlAttribute(name = "group")
+ public String getGroup()
+ {
+ return group;
+ }
+
+ public void setGroup(String group)
+ {
+ this.group = group;
+ }
+
+}
+
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,91 +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.Collections;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at XmlType(name = "hotDeploymentType", propOrder = { "source" })
-public class HotDeploymentProfileMetaData extends BasicProfileMetaData
-{
-
- /** The hot deployment source. */
- private BasicProfileSourceMetaData source;
-
- @Override
- @XmlAttribute
- public String getDomain()
- {
- return super.getDomain();
- }
-
- @Override
- @XmlAttribute
- public String getServer()
- {
- return super.getServer();
- }
-
- @Override
- @XmlAttribute(name = "name")
- public String getName()
- {
- return super.getName();
- }
-
- @XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
- public BasicProfileSourceMetaData getSource()
- {
- return this.source;
- }
-
- public void setSource(BasicProfileSourceMetaData source)
- {
- this.source = source;
- }
-
- @XmlTransient
- public List<ProfileDeploymentMetaData> getDeployments()
- {
- return Collections.emptyList();
- }
-
- @Override
- @XmlTransient
- public boolean isHotDeployment()
- {
- return true;
- }
-
-}
-
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureCapability.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,105 @@
+/*
+* 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.profile.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NamespaceFeatureCapability implements ProfileCapability, ProfileMetaDataVisitorNode
+{
+
+ /** The namespace. */
+ private String nsUri;
+
+ public NamespaceFeatureCapability()
+ {
+ // xml
+ }
+
+ public NamespaceFeatureCapability(String nsUri)
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalArgumentException("null namespace");
+ }
+ this.nsUri = nsUri;
+ }
+
+ @XmlAttribute(name = "namespace", required = true)
+ public String getNsUri()
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalStateException("null namespace value");
+ }
+ return nsUri;
+ }
+
+ public void setNsUri(String nsUri)
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalArgumentException("null namespace value");
+ }
+ this.nsUri = nsUri;
+ }
+
+ @Override
+ public boolean resolves(ProfileRequirement requirement)
+ {
+ if(requirement instanceof NamespaceFeatureRequirement)
+ {
+ String other = ((NamespaceFeatureRequirement)requirement).getNsUri();
+ return nsUri.equals(other);
+ }
+ return false;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ visitor.addCapability(this);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getNsUri().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer(getClass().getSimpleName());
+ buffer.append("{namespace=").append(nsUri).append("}");
+ return buffer.toString();
+ }
+}
+
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/NamespaceFeatureRequirement.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,107 @@
+/*
+* 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.profile.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NamespaceFeatureRequirement implements ProfileRequirement, ProfileMetaDataVisitorNode
+{
+
+ /** The namespace. */
+ private String nsUri;
+
+ public NamespaceFeatureRequirement()
+ {
+ // xml
+ }
+
+ public NamespaceFeatureRequirement(String nsUri)
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalArgumentException("null namespace");
+ }
+ this.nsUri = nsUri;
+ }
+
+ @XmlAttribute(name = "namespace", required = true)
+ public String getNsUri()
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalStateException("null namespace value");
+ }
+ return nsUri;
+ }
+
+ public void setNsUri(String nsUri)
+ {
+ if(nsUri == null)
+ {
+ throw new IllegalArgumentException("null namespace value");
+ }
+ this.nsUri = nsUri;
+ }
+
+ @Override
+ public boolean isConsistent(ProfileRequirement other)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isOptional()
+ {
+ return false;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ visitor.addRequirement(this);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getNsUri().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer(getClass().getSimpleName());
+ buffer.append("{namespace=").append(nsUri).append("}");
+ return buffer.toString();
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -23,19 +23,14 @@
import java.util.List;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileKeyMetaData;
import org.jboss.xb.annotations.JBossXmlSchema;
/**
@@ -43,6 +38,8 @@
*
* <profiles xmlns="urn:jboss:profileservice:profiles:1.0" />
*
+ * NOTE: For profiles configuration we don't replace PropertyRefs!
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
@@ -50,9 +47,10 @@
@JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
namespace= "urn:jboss:profileservice:profiles:1.0",
elementFormDefault=XmlNsForm.QUALIFIED,
- normalizeSpace=true)
+ normalizeSpace=true,
+ replacePropertyRefs=false)
@XmlType(name = "profilesType", propOrder = {"profiles"})
-public class ProfilesMetaData extends AbstractProfileKeyMetaData
+public class ProfilesMetaData
{
/** The profiles. */
@@ -63,57 +61,10 @@
super();
}
- public ProfilesMetaData(String name)
- {
- super(name);
- }
-
- public ProfilesMetaData(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public ProfilesMetaData(ProfileKey key)
- {
- super(key);
- }
-
- @XmlAttribute(name = "name")
- public String getName()
- {
- return super.getName();
- }
-
- /**
- * The domain attribute needs to be configured
- * in the domain meta data and is shared across
- * all local profiles.
- */
- @Override
- @XmlTransient
- public String getDomain()
- {
- return super.getDomain();
- }
-
- /**
- * The server attribute needs to be configured
- * in the domain meta data and is shared across
- * all local profiles.
- */
- @Override
- @XmlTransient
- public String getServer()
- {
- return super.getServer();
- }
-
@XmlElements({
@XmlElement(name = "profile", type = BasicProfileMetaData.class),
- @XmlElement(name = "bootstrap-profile", type = BootstrapProfileMetaData.class),
- @XmlElement(name = "hot-deployment-profile", type = HotDeploymentProfileMetaData.class)
+ @XmlElement(name = "bootstrap", type = BootstrapProfileMetaData.class)
})
- @XmlAnyElement
public List<ProfileMetaData> getProfiles()
{
return profiles;
Modified: 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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -23,15 +23,12 @@
import java.util.List;
-import javax.xml.bind.annotation.XmlAttribute;
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.profileservice.profile.metadata.emtpy.EmptyProfileMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.xb.annotations.JBossXmlSchema;
/**
@@ -44,26 +41,13 @@
elementFormDefault=XmlNsForm.QUALIFIED,
normalizeSpace=true)
@XmlType(name = "rootProfilesType", propOrder = {"rootProfiles", "profiles"})
+ at Deprecated
public class RootProfileMetaData extends ProfilesMetaData
{
-
- /** Extends a profile. */
- private String extendsProfile;
/** The root profiles. */
private List<String> rootProfiles;
-
- @XmlAttribute(name = "extends")
- public String getExtendsProfile()
- {
- return extendsProfile;
- }
- public void setExtendsProfile(String extendsProfile)
- {
- this.extendsProfile = extendsProfile;
- }
-
@XmlElement(name = "profile-ref")
@XmlElementWrapper(name = "profiles")
public List<String> getRootProfiles()
@@ -76,10 +60,5 @@
this.rootProfiles = rootProfiles;
}
- public ProfileMetaData createRootProfile()
- {
- return new EmptyProfileMetaData(getDomain(), getServer(), getName());
- }
-
}
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ClassPathProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ClassPathProfileMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ClassPathProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,131 @@
+/*
+* 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.profile.metadata.plugin;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * TODO does this make sense ?
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.CLASSPATH_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "classpath")
+ at XmlType(name = "classpathProfileType", propOrder = "deployments")
+public class ClassPathProfileMetaData extends AbstractProfileMetaData implements DomainFeatureNode
+{
+
+ /** The system classpath items. */
+ private List<ClassPathItem> classPathItems;
+
+ @Override
+ @XmlAttribute(name = "name")
+ public String getName()
+ {
+ return super.getName();
+ }
+
+ @Override
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.CLASSPATH_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ public void visit(DomainFeatureVisitor visitor)
+ {
+ visitor.addProfileMetaData(this);
+ }
+
+ @Override
+ @XmlElement(name = "source", type = ClassPathItem.class)
+ public List<ClassPathItem> getDeployments()
+ {
+ return classPathItems;
+ }
+
+ public void setDeployments(List<ClassPathItem> classPathItems)
+ {
+ this.classPathItems = classPathItems;
+ }
+
+ @Override
+ @XmlTransient
+ public ProfileSourceMetaData getSource()
+ {
+ return null;
+ }
+
+ public static class ClassPathItem implements ProfileDeploymentMetaData
+ {
+ private String path;
+ private String archives;
+
+ @XmlAttribute(name = "path")
+ public String getPath()
+ {
+ return path;
+ }
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ @XmlAttribute(name = "archives")
+ public String getArchives()
+ {
+ return archives;
+ }
+ public void setArchives(String archives)
+ {
+ this.archives = archives;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ // nothing
+ }
+ }
+
+}
+
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java (from rev 97080, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/emtpy/EmptyProfileMetaData.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/EmptyProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,105 @@
+/*
+ * 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.profile.metadata.plugin;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
+import org.jboss.profileservice.profile.metadata.BasicSubProfileMetaData;
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A empty profile meta meta, which only has a name and dependencies
+ * to other profiles.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.REQUIRED_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "profiles")
+ at XmlType(name = "emptyProfileType", propOrder = "features")
+public class EmptyProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData, DomainFeatureNode
+{
+
+ public EmptyProfileMetaData()
+ {
+ super();
+ }
+
+ @Override
+ @XmlAttribute(name = "name")
+ public String getName()
+ {
+ return super.getName();
+ }
+
+ @Override
+ @XmlElement(name = "requires", type = BasicSubProfileMetaData.class)
+ public List<ProfileMetaDataVisitorNode> getFeatures()
+ {
+ return super.getFeatures();
+ }
+
+ @XmlTransient
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return Collections.emptyList();
+ }
+
+ @XmlTransient
+ public ProfileSourceMetaData getSource()
+ {
+ return null;
+ }
+
+ @Override
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.REQUIRED_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ public void visit(DomainFeatureVisitor visitor)
+ {
+ visitor.addProfileMetaData(this);
+ }
+
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/FarmingProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/FarmingProfileMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/FarmingProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,94 @@
+/*
+ * 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.plugin;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.profile.metadata.NamespaceFeatureRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision: 92346 $
+ */
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.FARMING_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "farming-deployment")
+ at XmlType(name = "farmingDeploymentType", propOrder = { "source", "scanPeriod" })
+public class FarmingProfileMetaData extends PropertyProfileMetaData
+{
+
+ /** The hd scan period configuration. */
+ private ScanPeriod scanPeriod;
+
+ /**
+ * Get the scan period configuration.
+ *
+ * @return the scan period
+ */
+ @XmlElement(name = "scan-period")
+ public ScanPeriod getScanPeriod()
+ {
+ return scanPeriod;
+ }
+
+ public void setScanPeriod(ScanPeriod scanPeriod)
+ {
+ this.scanPeriod = scanPeriod;
+ }
+
+ @Override
+ @XmlTransient
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.FARMING_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ public boolean isHotDeploymentEnabled()
+ {
+ return scanPeriod != null;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ super.visit(visitor);
+ if(scanPeriod != null)
+ {
+ // HD requirement
+ visitor.visit(scanPeriod);
+ }
+ // We require a associated farming namespace
+ visitor.addRequirement(new NamespaceFeatureRequirement(getNameSpace()));
+ }
+
+}
+
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/HotDeploymentProfileMetaData.java (from rev 97080, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/HotDeploymentProfileMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/HotDeploymentProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,91 @@
+/*
+ * 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.plugin;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.HOTDEPLOY_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "hot-deployment")
+ at XmlType(name = "hotDeploymentType", propOrder = { "source", "scanPeriod" })
+public class HotDeploymentProfileMetaData extends PropertyProfileMetaData
+{
+
+ /** The hd scan period configuration. */
+ private ScanPeriod scanPeriod;
+
+ /**
+ * Get the scan period configuration.
+ *
+ * @return the scan period
+ */
+ @XmlElement(name = "scan-period")
+ public ScanPeriod getScanPeriod()
+ {
+ return scanPeriod;
+ }
+
+ public void setScanPeriod(ScanPeriod scanPeriod)
+ {
+ this.scanPeriod = scanPeriod;
+ }
+
+ @Override
+ @XmlTransient
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.HOTDEPLOY_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ public boolean isHotDeploymentEnabled()
+ {
+ return scanPeriod != null;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ super.visit(visitor);
+ if(scanPeriod != null)
+ {
+ // HD requirement
+ visitor.visit(scanPeriod);
+ }
+ }
+
+}
+
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,106 @@
+/*
+* 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.profile.metadata.plugin;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace=CommonProfileNameSpaces.IMMUTABLE_PROFILE_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "static-deployment")
+ at XmlType(name = "hotDeploymentType", propOrder = { "source" })
+public class PropertyProfileMetaData extends AbstractProfileMetaData implements DomainFeatureNode
+{
+
+ /** The source. */
+ private PropertyProfileSourceMetaData source;
+
+ @Override
+ @XmlAttribute(name = "name")
+ public String getName()
+ {
+ return super.getName();
+ }
+
+ @Override
+ @XmlTransient
+ public String getNameSpace()
+ {
+ return CommonProfileNameSpaces.IMMUTABLE_PROFILE_NAMESPACE;
+ }
+
+ @Override
+ @XmlElement(name = "source", type = PropertyProfileSourceMetaData.class)
+ public PropertyProfileSourceMetaData getSource()
+ {
+ return source;
+ }
+
+ public void setSource(PropertyProfileSourceMetaData source)
+ {
+ this.source = source;
+ }
+
+ @Override
+ public void visit(DomainFeatureVisitor visitor)
+ {
+ visitor.addProfileMetaData(this);
+ }
+
+ /**
+ * No, deployments defined - this profile configuration
+ * defines a profile, which scans the folder.
+ */
+ @XmlTransient
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return Collections.emptyList();
+ }
+
+ public boolean isHotDeploymentEnabled()
+ {
+ return false;
+ }
+
+
+}
+
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileSourceMetaData.java (from rev 97080, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileSourceMetaData.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/PropertyProfileSourceMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,59 @@
+/*
+ * 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.plugin;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * The basic profile source meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PropertyProfileSourceMetaData implements ProfileSourceMetaData
+{
+
+ /** The sources. */
+ private String path;
+
+ @XmlTransient
+ public String getType()
+ {
+ return getClass().getName();
+ }
+
+ @XmlAttribute(name = "path")
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+}
+
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/plugin/ScanPeriod.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,106 @@
+/*
+* 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.profile.metadata.plugin;
+
+import static org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces.HOTDEPLOY_PROFILE_NAMESPACE;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.profileservice.hotdeploy.HDScannerFactory.ScannerConfiguration;
+import org.jboss.profileservice.profile.metadata.NamespaceFeatureRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+
+/**
+ * Hot deployment scanner scan-period configuration.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ScanPeriod implements ScannerConfiguration, ProfileMetaDataVisitorNode
+{
+
+ /** Requires hot deployment scanner. */
+ protected static final NamespaceFeatureRequirement requirement;
+
+ static
+ {
+ requirement = new NamespaceFeatureRequirement(HOTDEPLOY_PROFILE_NAMESPACE);
+ }
+
+ /** The interval. */
+ private int interval;
+
+ /** The time unit. */
+ private TimeUnit timeUnit;
+
+ /** Disable hot deployment. */
+ private boolean disabled = false;
+
+ @XmlAttribute(name = "time-unit")
+ public TimeUnit getTimeUnit()
+ {
+ return timeUnit;
+ }
+
+ public void setTimeUnit(TimeUnit timeUnit)
+ {
+ this.timeUnit = timeUnit;
+ }
+
+ @XmlValue
+ public int getInterval()
+ {
+ return interval;
+ }
+
+ public void setInterval(int interval)
+ {
+ this.interval = interval;
+ }
+
+ @XmlAttribute(name = "disabled")
+ public boolean isDisabled()
+ {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled)
+ {
+ this.disabled = disabled;
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitor visitor)
+ {
+ if(isDisabled() == false)
+ {
+ // require hot deployment profile
+ visitor.addRequirement(requirement);
+ }
+ }
+
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/plugin/ClassPathAdapterProfile.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,204 @@
+/*
+* 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.profile.plugin;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.profile.metadata.plugin.ClassPathProfileMetaData.ClassPathItem;
+import org.jboss.profileservice.repository.BasicProfileDeployment;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * ClassPath adapter profile.
+ *
+ * FIXME - test if this actually works
+ *
+ * TODO - does this really make sense as profile?
+ * at least we need to move this out of the profileservice codebase.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ClassPathAdapterProfile implements Profile
+{
+
+ private static final Logger log = Logger.getLogger(ClassPathAdapterProfile.class);
+ private final ProfileKey key;
+ private final String deploymentName;
+ private final List<ClassPathItem> items;
+ private final long lastModified;
+ private ProfileDeployment classPathDeployment;
+
+ public ClassPathAdapterProfile(ProfileKey key, List<ClassPathItem> items)
+ {
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ this.key = key;
+ this.deploymentName = key.getName();
+ this.items = items;
+ this.lastModified = System.currentTimeMillis();
+ }
+
+ public void create() throws Exception
+ {
+ List<VirtualFile> classpath = determineRoots();
+ List<String> roots = new ArrayList<String>();
+ for(VirtualFile vf : classpath)
+ {
+ roots.add(vf.toURI().toString());
+ }
+ VFSClassLoaderFactory10 clMetaData = new VFSClassLoaderFactory10();
+ clMetaData.setRoots(roots);
+ // Create deployment
+ classPathDeployment = new BasicProfileDeployment(deploymentName);
+ classPathDeployment.addAttachment(ClassLoadingMetaData.class.getName(), clMetaData);
+ }
+
+ @Override
+ public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
+ {
+ if(deploymentName.equals(name))
+ {
+ return classPathDeployment;
+ }
+ throw new NoSuchDeploymentException(name);
+ }
+
+ @Override
+ public Set<String> getDeploymentNames()
+ {
+ return Collections.singleton(deploymentName);
+ }
+
+ @Override
+ public Collection<? extends ProfileDeployment> getDeployments()
+ {
+ return Collections.singleton(classPathDeployment);
+ }
+
+ @Override
+ public ProfileKey getKey()
+ {
+ return key;
+ }
+
+ @Override
+ public long getLastModified()
+ {
+ return this.lastModified;
+ }
+
+ @Override
+ public boolean hasDeployment(String name)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isMutable()
+ {
+ return false;
+ }
+
+ protected List<VirtualFile> determineRoots() throws IOException, URISyntaxException
+ {
+ List<VirtualFile> classpath = new ArrayList<VirtualFile>();
+ for(ClassPathItem item : items)
+ {
+ URI uri = new URI(item.getPath());
+
+ String codebase = item.getPath();
+ String archives = item.getArchives();
+
+ log.debug("Processing classpath: codebase=" + codebase + " archives=" + archives);
+ VirtualFile codebaseFile = VFS.getRoot(uri);
+ if (codebaseFile == null)
+ throw new RuntimeException("Cannot use classpath without a root: " + uri);
+
+ if (archives == null)
+ {
+ classpath.add(codebaseFile);
+ }
+ else
+ {
+ ClassPathFilter filter = new ClassPathFilter(archives);
+ List<VirtualFile> archiveFiles = codebaseFile.getChildren(filter);
+ classpath.addAll(archiveFiles);
+ }
+ }
+ return classpath;
+ }
+
+ static class ClassPathFilter implements VirtualFileFilter
+ {
+ /** The patterns */
+ private final Set<String> patterns;
+
+ /** Whether there is the accept all wildcard */
+ private final boolean allowAll;
+
+ public ClassPathFilter(String patternsString)
+ {
+ if (patternsString == null)
+ throw new IllegalArgumentException("Null patternsString");
+
+ StringTokenizer tokens = new StringTokenizer (patternsString, ",");
+ patterns = new HashSet<String>(tokens.countTokens());
+ for (int i=0; tokens.hasMoreTokens (); ++i)
+ {
+ String token = tokens.nextToken();
+ patterns.add(token.trim());
+ }
+ allowAll = patterns.contains("*");
+ }
+
+ public boolean accepts(VirtualFile file)
+ {
+ if (allowAll)
+ return true;
+ return patterns.contains(file.getName());
+ }
+ }
+
+
+}
+
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 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import org.jboss.profileservice.spi.repository.ArtifactId;
import org.jboss.profileservice.spi.repository.ArtifactRepository;
@@ -52,6 +53,16 @@
this.repositoryRoot = VFS.getRoot(root);
this.configuration = new BasicRepositoryConfiguration(type, root);
}
+
+ public AbstractArtifactRepository(String type, VirtualFile root) throws IOException, URISyntaxException
+ {
+ if(root == null)
+ {
+ throw new IllegalArgumentException("null repository root.");
+ }
+ this.repositoryRoot = root;
+ this.configuration = new BasicRepositoryConfiguration(type, root.toURI());
+ }
public AbstractArtifactRepository(ArtifactRepositoryConfiguration configuration) throws IOException
{
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -69,6 +69,12 @@
return location;
}
+ @Override
+ public String getGroup()
+ {
+ return null;
+ }
+
public String getType()
{
return type;
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import org.jboss.profileservice.repository.artifact.AbstractArtifactId;
+import org.jboss.profileservice.spi.repository.ArtifactId;
/**
* The file artifact.
@@ -33,7 +34,10 @@
*/
public class FileArtifactId extends AbstractArtifactId
{
-
+
+ /** An empty artifact. */
+ public final static ArtifactId EMPTY_ARTIFACT = new FileArtifactId();
+
/** The type. */
public final static String TYPE = FileArtifactId.class.getName();
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/LocalFileArtifactRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -21,15 +21,15 @@
*/
package org.jboss.profileservice.repository.artifact.file;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
-import java.net.URL;
+import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import org.jboss.profileservice.repository.artifact.AbstractArtifactRepository;
import org.jboss.profileservice.spi.repository.Artifact;
-import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
@@ -38,18 +38,30 @@
*/
public class LocalFileArtifactRepository extends AbstractArtifactRepository<FileArtifactId>
{
+
+ static VirtualFile hack(VirtualFile parent, String group) throws IOException
+ {
+ VirtualFile vf = parent.getChild(group);
+ return vf != null ? vf : parent;
+ }
public LocalFileArtifactRepository(URI rootURI) throws IOException
{
super(FileArtifactId.TYPE, rootURI);
}
+ public LocalFileArtifactRepository(VirtualFile parent, String group) throws IOException, URISyntaxException
+ {
+ super(FileArtifactId.TYPE, hack(parent, group));
+ }
+
@Override
public boolean containsArtifact(FileArtifactId artifact)
{
try
{
- return getRepositoryRoot().getChild(artifact.getPath()).exists();
+ VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
+ return vf != null ? vf.exists() : false;
}
catch(IOException e)
{
@@ -83,11 +95,11 @@
VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
if(vf == null)
{
- URL url = new URL(artifact.getPath());
- vf = VFS.getRoot(url);
+ throw new FileNotFoundException(artifact.getPath() + ", root: " + getRepositoryRoot());
}
return vf;
}
+
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/maven/LocalMavenArtifactRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -85,7 +85,9 @@
{
MavenArtifact artifact = resolveArtifact(artifactId);
if(artifact == null)
+ {
throw new FileNotFoundException("Artifact not found " + artifactId);
+ }
return resolveArtifactFile(artifact.getIdentifier());
}
@@ -101,5 +103,10 @@
return null;
}
+ protected void checkConsistent()
+ {
+
+ }
+
}
Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,88 +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.repository.legacy;
-
-import org.jboss.profileservice.profile.NoopProfile;
-import org.jboss.profileservice.profile.metadata.BasicProfileMetaData;
-import org.jboss.profileservice.profile.metadata.HotDeploymentProfileMetaData;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileFactory;
-import org.jboss.profileservice.spi.ProfileKey;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BasicProfileFactory implements ProfileFactory<BasicProfileMetaData, Profile>
-{
-
- /** The profile types. */
- private static final String[] types;
-
- /** The deployment repository. */
- private DeploymentRepositoryFactory repositoryFactory;
-
- static
- {
- types = new String[] { HotDeploymentProfileMetaData.class.getName(),
- BasicProfileMetaData.class.getName() };
- }
-
- @Override
- public String[] getTypes()
- {
- return types;
- }
-
- @Override
- public Profile createProfile(ProfileKey key, BasicProfileMetaData 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;
- if(metaData.isHotDeployment())
- {
- // create hot-deployment repository
- }
- // The delegate profile
- // return new DelegateProfile(repository, key);
- return new NoopProfile(key);
- }
-
- public DeploymentRepositoryFactory getRepositoryFactory()
- {
- return repositoryFactory;
- }
-
- public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
- {
- this.repositoryFactory = repositoryFactory;
- }
-
-}
-
Copied: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java (from rev 97080, projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java)
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/LegacyProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,89 @@
+/*
+ * 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.repository.legacy;
+
+import org.jboss.profileservice.profile.NoopProfile;
+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.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * Legacy profile factory for backwards compatibility, which should only
+ * be used as long as the FarmingProfile uses a legacy DeploymentRepository.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LegacyProfileFactory implements ProfileFactory<PropertyProfileMetaData, Profile>
+{
+
+ /** The profile types. */
+ private static final String[] types;
+
+ /** The deployment repository. */
+ private DeploymentRepositoryFactory repositoryFactory;
+
+ static
+ {
+ types = new String[] { HotDeploymentProfileMetaData.class.getName(),
+ PropertyProfileMetaData.class.getName(),
+ FarmingProfileMetaData.class.getName()};
+ }
+
+ @Override
+ public String[] getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ 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;
+ // The delegate profile
+ // return new DelegateProfile(repository, key);
+ return new NoopProfile(key);
+ }
+
+ public DeploymentRepositoryFactory getRepositoryFactory()
+ {
+ return repositoryFactory;
+ }
+
+ public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
+ {
+ this.repositoryFactory = repositoryFactory;
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -81,14 +81,14 @@
throw new IllegalStateException("No profile source.");
// Extract the profile source type
- type = metaData.getSource().getType();
- if( type == null )
- throw new IllegalArgumentException("Null profile source type.");
-
- ProfileSourceMetaData source = metaData.getSource();
+// type = metaData.getSource().getType();
+// if( type == null )
+// throw new IllegalArgumentException("Null profile source type.");
+//
+// ProfileSourceMetaData source = metaData.getSource();
// TODO check if there is a conflict with hotdeployment repositories
- repository = createProfileDeploymentRepository(key, type , source);
+ repository = createProfileDeploymentRepository(key, type , null);
if(repository != null)
{
this.repositories.put(key, repository);
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualProfileFactory.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/AbstractVirtualProfileFactory.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,125 @@
+/*
+* 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.virtual;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.profileservice.profile.metadata.FileRepositorySourceMetaData;
+import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
+import org.jboss.profileservice.repository.artifact.file.LocalFileArtifactRepository;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.repository.ArtifactId;
+import org.jboss.profileservice.spi.repository.ArtifactRepository;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractVirtualProfileFactory
+{
+
+ /** The virtual deployment repository. */
+ private VirtualDeploymentRepository repository;
+
+ public void setRepository(VirtualDeploymentRepository repository)
+ {
+ this.repository = repository;
+ }
+
+ public VirtualDeploymentRepository getRepository()
+ {
+ return repository;
+ }
+
+ public void start()
+ {
+ if(getRepository() == null)
+ {
+ throw new IllegalStateException("virtual deployment repository not set");
+ }
+ }
+
+ protected VirtualDeploymentRepository createRepository(FileRepositorySourceMetaData source) throws Exception
+ {
+ if(source != null && source.getGroup() != null)
+ {
+ // FIXME
+ ArtifactRepository<ArtifactId> repo = repository.getRepository(new FileArtifactId());
+ VirtualFile vf = VFS.getRoot(repo.getConfiguration().getLocation());
+ LocalFileArtifactRepository scoped = new LocalFileArtifactRepository(vf, source.getGroup());
+ return new GroupedVirtualDeploymentRepository(scoped, repository);
+ }
+ return repository;
+ }
+
+ protected List<VirtualDeployment> getVirtualDeployments(ProfileMetaData metaData)
+ {
+ List<? extends ProfileDeploymentMetaData> deployments = metaData.getDeployments();
+ List<VirtualDeployment> virtual = new ArrayList<VirtualDeployment>();
+ // TODO ProfileDeployment extends VirtualDeployment ?
+ if(deployments != null && deployments.isEmpty() == false)
+ {
+ for(ProfileDeploymentMetaData deployment : deployments)
+ {
+ if(deployment instanceof VirtualDeployment)
+ {
+ virtual.add((VirtualDeployment) deployment);
+ }
+ else
+ {
+ throw new IllegalStateException("deployment not a virtual deployment " + deployment);
+ }
+ }
+ }
+ return virtual;
+ }
+
+ static class GroupedVirtualDeploymentRepository extends VirtualDeploymentRepository
+ {
+ private LocalFileArtifactRepository scoped;
+ private VirtualDeploymentRepository parent;
+
+ public GroupedVirtualDeploymentRepository(LocalFileArtifactRepository scoped, VirtualDeploymentRepository parent)
+ {
+ this.scoped = scoped;
+ this.parent = parent;
+ }
+
+ public VirtualFile getVirtualFile(ArtifactId artifact) throws IOException
+ {
+ if(FileArtifactId.TYPE.equals(artifact.getType()))
+ {
+ return scoped.getArtifactFile((FileArtifactId) artifact);
+ }
+ return parent.getVirtualFile(artifact);
+ }
+ }
+
+}
+
Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentProfile.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,183 @@
+/*
+* 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.virtual;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * A immutable profile implementation getting it's deployments from
+ * the virtual deployment descriptors.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class VirtualDeploymentProfile implements Profile
+{
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(VirtualDeploymentProfile.class);
+
+ /** The profile key. */
+ private final ProfileKey key;
+
+ /** The virtual deployments. */
+ private final List<VirtualDeployment> deploymentMetaData;
+
+ /** The virtual deployment repository. */
+ private final VirtualDeploymentRepository repository;
+
+ /** The deployments. */
+ private Map<String, ProfileDeployment> deployments = new HashMap<String, ProfileDeployment>();
+
+ /** The last modified. */
+ private final long lastModified;
+
+ public VirtualDeploymentProfile(ProfileKey key,
+ List<VirtualDeployment> virtual, VirtualDeploymentRepository repository)
+ {
+ if(key == null)
+ {
+ throw new IllegalArgumentException("null profile key");
+ }
+ if(repository == null)
+ {
+ throw new IllegalArgumentException("null virtual deployment repository");
+ }
+ this.key = key;
+ this.deploymentMetaData = virtual;
+ this.repository = repository;
+ this.lastModified = System.currentTimeMillis();
+ }
+
+ /**
+ * Create the deployments. This has to be done in the lifecycle
+ * of the profile since other profiles needs to be installed first
+ * to properly create the virtual file.
+ *
+ * @throws Exception for any error
+ */
+ public void create() throws Exception
+ {
+ if(deploymentMetaData != null && deploymentMetaData.isEmpty() == false)
+ {
+ for(VirtualDeployment virtual: deploymentMetaData)
+ {
+ try
+ {
+ ProfileDeployment deployment = getRepository().createDeployment(virtual);
+ this.deployments.put(deployment.getName(), deployment);
+ }
+ catch(Exception e)
+ {
+ // FIXME, this is only for testing purpose
+ log.error("failed to create deployment " + virtual);
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
+ {
+ return this.deployments.get(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getDeploymentNames()
+ {
+ return this.deployments.keySet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Collection<? extends ProfileDeployment> getDeployments()
+ {
+ return this.deployments.values();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ProfileKey getKey()
+ {
+ return this.key;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long getLastModified()
+ {
+ return this.lastModified;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasDeployment(String name)
+ {
+ return this.deployments.containsKey(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isMutable()
+ {
+ return false;
+ }
+
+ /**
+ * Get the virtual deployment repository.
+ *
+ * @return the virtual deployment repository
+ */
+ protected VirtualDeploymentRepository getRepository()
+ {
+ return this.repository;
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -116,10 +116,10 @@
throw new IllegalArgumentException("null repository configuration");
if(repository.getConfiguration().getType() == null)
throw new IllegalArgumentException("null repository configuration type");
- removeRepository(repository.getConfiguration().getType());
+ removeRepository(repository.getConfiguration().getType(), repository);
}
- public void removeRepository(String type)
+ public void removeRepository(String type, ArtifactRepository<ArtifactId> repository)
{
this.repositories.remove(type);
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.profileservice.spi.virtual.assembly.VirtualAssemblyContext;
import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
/**
@@ -33,18 +32,18 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public abstract class AbstractVirtualAssemblyContext implements VirtualAssemblyContext
+public abstract class AbstractVirtualAssemblyContext
{
/** The roots. */
private final List<String> roots = new ArrayList<String>();
/** The child contexts. */
- private final List<VirtualDeploymentAssemblyContext> childs = new ArrayList<VirtualDeploymentAssemblyContext>();
+ private final List<VirtualDeploymentAssemblyContext> children = new ArrayList<VirtualDeploymentAssemblyContext>();
protected List<VirtualDeploymentAssemblyContext> getChildren()
{
- return this.childs;
+ return children;
}
public List<String> getRoots()
@@ -54,7 +53,7 @@
protected void addRoot(String root)
{
- this.roots.add(root);
+ roots.add(root);
}
protected void addChild(VirtualDeploymentAssemblyContext ctx)
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -26,6 +26,7 @@
import org.jboss.profileservice.spi.repository.ArtifactId;
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssembly;
import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
@@ -39,7 +40,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public abstract class AbstractVirtualDeploymentAssembly
+public abstract class AbstractVirtualDeploymentAssembly implements VirtualDeploymentAssembly
{
/** The assembled context factory. */
@@ -61,7 +62,7 @@
* @return the assembled directory
* @throws IOException
*/
- protected VirtualDeploymentAssemblyContext assemble(VirtualDeployment deployment) throws IOException
+ public VirtualDeploymentAssemblyContext assemble(VirtualDeployment deployment) throws IOException
{
if(deployment == null)
throw new IllegalArgumentException("null virtual deployment");
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -71,13 +71,11 @@
getRoot().mkdir(META_INF);
}
- @Override
public AssembledDirectory getRoot()
{
return this.root;
}
- @Override
public void addChild(VirtualFile vf)
{
if(vf == null)
@@ -87,7 +85,6 @@
getRoot().addChild(vf);
}
- @Override
public void addChild(VirtualFile vf, String name)
{
if(vf == null)
@@ -97,7 +94,6 @@
getRoot().addChild(vf, name);
}
- @Override
public VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException
{
if(child == null)
@@ -114,7 +110,6 @@
return ctx;
}
- @Override
public void addPath(VirtualFile vf) throws IOException
{
if(vf == null)
@@ -124,7 +119,6 @@
getRoot().addPath(vf);
}
- @Override
public void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException
{
if(vf == null)
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -27,7 +27,6 @@
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
/**
* A immutable virtual deployment assembly context, which is not based on
@@ -53,43 +52,17 @@
this.root = root;
}
- @Override
public VirtualFile getRoot()
{
return this.root;
}
- @Override
public void addArtifact(VirtualArtifactMetaData artifact) throws IOException
{
throw new IllegalStateException("TODO");
}
-
- @Override
- public void addChild(VirtualFile vf) throws IOException
- {
- throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
- }
@Override
- public void addChild(VirtualFile vf, String name) throws IOException
- {
- throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
- }
-
- @Override
- public void addPath(VirtualFile vf) throws IOException
- {
- throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
- }
-
- @Override
- public void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException
- {
- throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
- }
-
- @Override
public VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException
{
throw new IllegalStateException("cannot add a child to a non-assembled context");
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -34,6 +34,10 @@
import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
/**
+ * The structure meta data builder.
+ *
+ * TODO move this out of the profileservice project.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
Added: 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 (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/AbstractDomainMetaDataVisitor.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,98 @@
+/*
+* 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.test.profileservice.domain.support;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainFeatureVisitor;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractDomainMetaDataVisitor implements DomainFeatureVisitor, ProfileMetaDataVisitor
+{
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(AbstractDomainMetaDataVisitor.class);
+
+ /** The collected requirements. */
+ private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
+
+ /** The namespace stack. */
+ private Stack<String> stack = new Stack<String>();
+
+ public List<ProfileRequirement> getRequirements()
+ {
+ return requirements;
+ }
+
+ @Override
+ public void addProfileMetaData(ProfileMetaData metaData)
+ {
+ visit(metaData);
+ log.debug(stack.peek() + " " + metaData.getName());
+ }
+
+ @Override
+ public void addCapability(ProfileCapability capability)
+ {
+ // we only care about requirements for the domain
+ }
+
+ @Override
+ public void addRequirement(ProfileRequirement requirement)
+ {
+ this.requirements.add(requirement);
+ }
+
+ @Override
+ public void visit(DomainFeatureNode node)
+ {
+ stack.push(node.getNameSpace());
+ try
+ {
+ node.visit(this);
+ }
+ finally
+ {
+ stack.pop();
+ }
+ }
+
+ @Override
+ public void visit(ProfileMetaDataVisitorNode node)
+ {
+ node.visit(this);
+ }
+
+}
+
Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/DomainMetaDataRepoSupport.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/DomainMetaDataRepoSupport.java (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/domain/support/DomainMetaDataRepoSupport.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,91 @@
+/*
+* 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.test.profileservice.domain.support;
+
+import java.net.URL;
+
+import org.jboss.profileservice.domain.AbstractDomainMetaData;
+import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.profileservice.domain.spi.DomainMetaDataRepository;
+import org.jboss.profileservice.profile.bootstrap.BootstrapProfileMetaData;
+import org.jboss.profileservice.profile.metadata.BasicProfileMetaData;
+import org.jboss.profileservice.profile.metadata.CommonProfileNameSpaces;
+import org.jboss.profileservice.profile.metadata.plugin.ClassPathProfileMetaData;
+import org.jboss.profileservice.profile.metadata.plugin.EmptyProfileMetaData;
+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.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 DomainMetaDataRepoSupport implements DomainMetaDataRepository
+{
+
+ /** The schema resolver. */
+ private static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ static
+ {
+ addSchemaBinding(DomainMetaData.DOMAIN_NAMESPACE, AbstractDomainMetaData.class);
+ // initalize the schema binding
+ addSchemaBinding(CommonProfileNameSpaces.BOOTSTRAP_PROFILE_NAMESPACE, BootstrapProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.PROFILE_NAMESPACE, BasicProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.CLASSPATH_PROFILE_NAMESPACE, ClassPathProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.REQUIRED_PROFILE_NAMESPACE, EmptyProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.HOTDEPLOY_PROFILE_NAMESPACE, HotDeploymentProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.IMMUTABLE_PROFILE_NAMESPACE, PropertyProfileMetaData.class);
+ addSchemaBinding(CommonProfileNameSpaces.FARMING_PROFILE_NAMESPACE, FarmingProfileMetaData.class);
+ }
+
+ protected static void addSchemaBinding(String nsUri, Class<?> clazz)
+ {
+ resolver.addClassBinding(nsUri, clazz);
+ }
+
+ private final URL url;
+
+ public DomainMetaDataRepoSupport(URL url)
+ {
+ this.url = url;
+ }
+
+ @Override
+ public DomainMetaData getDomainMetaData()
+ {
+ try
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return DomainMetaData.class.cast(unmarshaller.unmarshal(url.openStream(), resolver));
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException("failed to parse " + url, e);
+ }
+ }
+
+}
+
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -30,13 +30,12 @@
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.jboss.profileservice.profile.metadata.BasicProfileSourceMetaData;
import org.jboss.profileservice.profile.metadata.BasicSubProfileMetaData;
-import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.profile.metadata.plugin.PropertyProfileSourceMetaData;
import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
import org.jboss.xb.annotations.JBossXmlSchema;
@@ -46,7 +45,7 @@
*/
@JBossXmlSchema(namespace="urn:jboss:profileservice:profile:custom:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
@XmlRootElement(name = "custom-profile")
- at XmlType(name = "customProfileType", propOrder = {"source", "subprofiles", "deployments"})
+ at XmlType(name = "customProfileType", propOrder = {"source", "features", "deployments"})
public class CustomProfileMetaData extends AbstractProfileMetaData
{
@@ -61,21 +60,6 @@
super();
}
- public CustomProfileMetaData(String name)
- {
- super(name);
- }
-
- public CustomProfileMetaData(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public CustomProfileMetaData(ProfileKey key)
- {
- super(key);
- }
-
public List<ProfileDeploymentMetaData> getDeployments()
{
return this.deployments;
@@ -114,9 +98,9 @@
@Override
@XmlElement(name = "profile-dependency", type = BasicSubProfileMetaData.class)
- public List<SubProfileMetaData> getSubprofiles()
+ public List<ProfileMetaDataVisitorNode> getFeatures()
{
- return super.getSubprofiles();
+ return super.getFeatures();
}
@XmlElement(name = "profile-deployment", type = CustomDeploymentMetaData.class)
@@ -125,7 +109,7 @@
this.deployments = deployments;
}
- @XmlElement(name = "custom-source", type = BasicProfileSourceMetaData.class)
+ @XmlElement(name = "custom-source", type = PropertyProfileSourceMetaData.class)
public ProfileSourceMetaData getSource()
{
return this.source;
Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicDomainMetaDataUnitTestCase.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,123 @@
+/*
+* 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.test.profileservice.metadata.test;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.profileservice.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.profileservice.metadata.ProfileMetaDataFactory;
+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.ProfileMetaData;
+import org.jboss.test.profileservice.ProfileServiceTestBase;
+import org.jboss.test.profileservice.domain.support.AbstractDomainMetaDataVisitor;
+import org.jboss.test.profileservice.domain.support.DomainMetaDataRepoSupport;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicDomainMetaDataUnitTestCase extends ProfileServiceTestBase
+{
+
+ List<ProfileDependencyContext> profileCtxs = new ArrayList<ProfileDependencyContext>();
+
+ public BasicDomainMetaDataUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void test() throws Exception
+ {
+ URL profiles = findResource("system/profiles");
+ ProfileMetaDataFactory metaDataFactory = ProfileMetaDataFactory.getInstance();
+
+ metaDataFactory.parse(profiles);
+
+ URL domain = findResource("metadata/domain/domain1.xml");
+ DomainMetaDataRepoSupport support = new DomainMetaDataRepoSupport(domain);
+ DomainMetaData metaData = support.getDomainMetaData();
+ assertNotNull(metaData);
+
+
+ for(ProfileMetaData md : metaDataFactory.getProfiles().values())
+ {
+ ProfileDependencyContext ctx = new ProfileDependencyContext(new ProfileKey(md.getName()), md, null);
+ ctx.visit(md);
+ profileCtxs.add(ctx);
+ }
+
+
+
+ AbstractDomainMetaDataVisitor visitor = new AbstractDomainMetaDataVisitor();
+ for(DomainFeatureNode node : metaData.getFeatures())
+ {
+ visitor.visit(node);
+ }
+ for(ProfileRequirement requirement : visitor.getRequirements())
+ {
+ ProfileKey key = resolve(null, requirement);
+ getLog().debug(requirement + " resolved " + key);
+
+ }
+
+ }
+
+ static URL findResource(String name)
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+
+ protected ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
+ {
+ // Resolve the requirements based on the exposed capabilities
+ final boolean trace = log.isTraceEnabled();
+ for(ProfileDependencyContext child : profileCtxs)
+ {
+ Collection<ProfileCapability> capabilities = child.getCapabilities();
+ if(capabilities != null && capabilities.isEmpty() == false)
+ {
+ for(ProfileCapability capability : capabilities)
+ {
+ if(capability.resolves(requirement))
+ {
+ if(trace)
+ {
+ log.trace(child.getKey() + ":" + capability + " resolved " + requirement);
+ }
+ return child.getKey();
+ }
+ }
+ }
+ }
+ // Unresolved
+ return null;
+ }
+
+}
+
Deleted: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,82 +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.test.profileservice.metadata.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.profileservice.profile.metadata.BasicProfileMetaData;
-import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.test.profileservice.metadata.support.CustomDeploymentMetaData;
-import org.jboss.test.profileservice.metadata.support.CustomProfileMetaData;
-
-/**
- * Basic profile meta data test.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BasicMetaDataUnitTestCase extends AbstractProfileServiceMetaDataTest
-{
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- // SetUp class binding
- addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
- addClassBinding("urn:jboss:profileservice:profile:custom:1.0", CustomProfileMetaData.class);
- }
-
- public void test() throws Exception
- {
- ProfilesMetaData profiles = unmarshall("metadata/test.xml", getResolver(), ProfilesMetaData.class);
- assertNotNull(profiles);
- assertEquals("profiles", profiles.getName());
- assertNull(profiles.getDomain());
- //
- assertNotNull(profiles.getProfiles());
- assertEquals(2, profiles.getProfiles().size());
- //
- Map<String, ProfileMetaData> map = new HashMap<String, ProfileMetaData>();
- for(ProfileMetaData profile : profiles.getProfiles())
- map.put(profile.getName(), profile);
-
- // Test basic
- ProfileMetaData basic = map.get("basic");
- assertNotNull(basic);
- assertTrue(basic instanceof BasicProfileMetaData);
- assertNotNull(((BasicProfileMetaData)basic).getSource().getSources());
-
- // Test custom wildcard
- ProfileMetaData custom = map.get("custom");
- assertNotNull(custom);
- assertTrue(custom instanceof CustomProfileMetaData);
- CustomDeploymentMetaData customDeployment = (CustomDeploymentMetaData) custom.getDeployments().iterator().next();
- assertEquals("org.jboss.test.profileservice", customDeployment.getGroupId());
- assertEquals("profileservice-test-artifact", customDeployment.getName());
- assertEquals("1.0.0.GA", customDeployment.getVersion());
- }
-
-}
-
Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,77 @@
+/*
+* 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.test.profileservice.support;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.jboss.profileservice.spi.repository.Artifact;
+import org.jboss.profileservice.spi.repository.ArtifactId;
+import org.jboss.profileservice.spi.repository.ArtifactRepository;
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NoopArtifactRepository implements ArtifactRepository<ArtifactId>
+{
+
+ @Override
+ public boolean containsArtifact(ArtifactId artifact)
+ {
+ return false;
+ }
+
+ @Override
+ public Artifact<ArtifactId> getArtifact(ArtifactId artifactId)
+ {
+ return null;
+ }
+
+ @Override
+ public VirtualFile getArtifactFile(ArtifactId artifact) throws IOException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<Artifact<ArtifactId>> getArtifacts()
+ {
+ return null;
+ }
+
+ @Override
+ public ArtifactRepositoryConfiguration getConfiguration()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isMutable()
+ {
+ return false;
+ }
+
+}
+
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 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/ProfileServiceBootstrap.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -25,7 +25,7 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.profileservice.ProfileDeployerPluginRegistry;
import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
-import org.jboss.profileservice.domain.DomainMetaData;
+import org.jboss.profileservice.domain.AbstractDomainMetaData;
import org.jboss.profileservice.domain.ManagementDomainMetaData;
import org.jboss.profileservice.domain.ServerMetaData;
import org.jboss.profileservice.spi.Profile;
@@ -85,7 +85,7 @@
public void start() throws Throwable
{
- DomainMetaData domain = new DomainMetaData();
+ AbstractDomainMetaData domain = new AbstractDomainMetaData();
ManagementDomainMetaData mgtDomain = new ManagementDomainMetaData("domain1");
ServerMetaData server = new ServerMetaData("server1");
domain.setDomain(mgtDomain);
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -28,7 +28,6 @@
import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.logging.Logger;
import org.jboss.test.profileservice.ProfileServiceTestBase;
/**
@@ -40,6 +39,12 @@
public abstract class AbstractProfileServiceTest extends ProfileServiceTestBase
{
+ static
+ {
+ System.setProperty("jboss.file.repository.url", findResource("system/static").toString());
+ System.setProperty("jboss.artifact.repository.url", findResource("system/repository").toString());
+ }
+
/** The kernel. */
private Kernel kernel;
@@ -113,5 +118,10 @@
return bootstrap.getKernel();
}
+ static URL findResource(String name)
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+
}
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -22,14 +22,18 @@
package org.jboss.test.profileservice.test;
import java.net.URL;
-import java.util.List;
+import org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap;
import org.jboss.profileservice.dependency.LocalProfileServiceDomain;
-import org.jboss.profileservice.metadata.ProfilesMetaDataFactory;
-import org.jboss.profileservice.repository.legacy.BasicProfileFactory;
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.profileservice.metadata.ProfileMetaDataFactory;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.test.profileservice.domain.support.AbstractDomainMetaDataVisitor;
+import org.jboss.test.profileservice.domain.support.DomainMetaDataRepoSupport;
/**
@@ -38,12 +42,6 @@
*/
public class BasicProfileServiceUnitTestCase extends AbstractProfileServiceTest
{
-
- static
- {
- System.setProperty("jboss.common.profiles.url", findResource("bootstrap/").toExternalForm());
- System.setProperty("jboss.common.deployments.url", findResource("bootstrap/").toExternalForm());
- }
public BasicProfileServiceUnitTestCase(String name)
{
@@ -53,31 +51,39 @@
public void test() throws Exception
{
// Bootstrap ProfileService
- deploy(getResource("bootstrap/bootstrap.xml"));
+ deploy(getResource("system/bootstrap.xml"));
- // Get the meta data factory
- ProfilesMetaDataFactory mf = getBean("ProfileMetaDataFactory", ProfilesMetaDataFactory.class);
+ URL profiles = findResource("system/profiles");
+ ProfileMetaDataFactory metaDataFactory = ProfileMetaDataFactory.getInstance();
- // Parse the root profile
- List<ProfileMetaData> profiles = mf.parse(getResource("bootstrap/root.profile"));
- getLog().debug(profiles);
+ metaDataFactory.parse(profiles);
+
+ URL domain = findResource("metadata/domain/domain1.xml");
+ DomainMetaDataRepoSupport support = new DomainMetaDataRepoSupport(domain);
+ DomainMetaData metaData = support.getDomainMetaData();
+ assertNotNull(metaData);
- // Now get the ProfileService
- ProfileService ps = getBean("org.jboss:service=ProfileService", ProfileService.class);
- LocalProfileServiceDomain domain = getBean("org.jboss:service=LocalProfileServiceDomain", LocalProfileServiceDomain.class);
-
- // And activate the profiles
- for(ProfileKey key : ps.getProfileKeys())
+ ProfileService ps = getBean(AbstractProfileServiceBootstrap.PROFILESERVICE_BEANNAME, ProfileService.class);
+ LocalProfileServiceDomain resolver = getBean(AbstractProfileServiceBootstrap.LOCALDOMAIN_BEANNAME, LocalProfileServiceDomain.class);
+ assertNotNull(ps);
+ assertNotNull(resolver);
+
+ for(ProfileMetaData md : metaDataFactory.getProfiles().values())
{
- ps.activateProfile(key);
+ ps.registerProfile(md);
}
- for(ProfileKey key : ps.getProfileKeys())
+
+ AbstractDomainMetaDataVisitor visitor = new AbstractDomainMetaDataVisitor();
+ for(DomainFeatureNode node : metaData.getFeatures())
{
- ps.validateProfile(key);
+ visitor.visit(node);
}
- // Check the profile.xml
- assertNotNull(getBean("Basic Profile Factory", BasicProfileFactory.class));
-
+ for(ProfileRequirement requirement : visitor.getRequirements())
+ {
+ ProfileKey key = resolver.resolve(null, requirement);
+ ps.activateProfile(key);
+ }
+ getLog().debug(ps.getActiveProfileKeys());
//
// for(ProfileKey key : ps.getActiveProfileKeys())
// {
@@ -92,10 +98,14 @@
// }
}
- static URL findResource(String name)
+ public void testWait() throws Exception
{
- return Thread.currentThread().getContextClassLoader().getResource(name);
+
}
+
+
+
+
}
Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/support/TestArtifactRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,60 @@
+/*
+* 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.test.profileservice.virtual.support;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+
+import org.jboss.profileservice.repository.artifact.file.FileArtifactId;
+import org.jboss.profileservice.repository.artifact.file.LocalFileArtifactRepository;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Test artifact repository, which also resolves full urls.
+ *
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TestArtifactRepository extends LocalFileArtifactRepository
+{
+
+ public TestArtifactRepository(URI rootURI) throws IOException
+ {
+ super(rootURI);
+ }
+
+ @Override
+ public VirtualFile getArtifactFile(FileArtifactId artifact) throws IOException
+ {
+ VirtualFile vf = getRepositoryRoot().getChild(artifact.getPath());
+ if(vf == null)
+ {
+ URL rootURL = new URL(artifact.getPath());
+ return VFS.getRoot(rootURL);
+ }
+ return vf;
+ }
+}
+
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -24,13 +24,13 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.profileservice.repository.artifact.file.LocalFileArtifactRepository;
import org.jboss.profileservice.repository.virtual.VirtualDeploymentRepository;
import org.jboss.profileservice.spi.repository.ArtifactId;
import org.jboss.profileservice.spi.repository.ArtifactRepository;
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
import org.jboss.test.profileservice.ProfileServiceTestBase;
import org.jboss.test.profileservice.metadata.support.VirtualRepositoryMetaData;
+import org.jboss.test.profileservice.virtual.support.TestArtifactRepository;
import org.jboss.virtual.VirtualFile;
/**
@@ -57,7 +57,7 @@
protected ArtifactRepository<ArtifactId> createLocalFileArtifactRepo(String name) throws Exception
{
- return (ArtifactRepository) new LocalFileArtifactRepository(getResource(name).toURI());
+ return (ArtifactRepository) new TestArtifactRepository(getResource(name).toURI());
}
protected void assertIncluded(VirtualFile vf, String... children) throws Exception
Added: projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/domain/domain1.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ TODO: change namespace to server, since this won't be the full domain model
+ NOTE: profile names are *NOT* object names
+ -->
+<domain xmlns="urn:jboss:profileservice:domain:1.0">
+ <!--
+ The required profiles for this configuration.
+ -->
+ <profiles xmlns="urn:jboss:profileservice:profile:required:1.0">
+ <requires name="jboss:profile=minimal" />
+ <requires name="jboss:profile=web" />
+ </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.
+ -->
+ <profile name="jboss:profile=common,flavor=deployments"
+ xmlns="urn:jboss:profileservice:profile:1.0">
+ <file-repository group="common" />
+ <deployment name="ROOT.war" />
+ <deployment name="jmx-console.war" />
+ <deployment name="admin-console.war" />
+ <deployment name="snmp-adaptor.sar" />
+ </profile>
+ <!--
+ A static deployment profile, without hot-deployment
+ capabilities.
+ -->
+ <static-deployment name="jboss:profile=deployers"
+ xmlns="urn:jboss:profileservice:profile:static:1.0">
+ <source path="${jboss.server.home.url}deployers" />
+ </static-deployment>
+ <!--
+ The hot deployment profile.
+ -->
+ <hot-deployment name="jboss:profile=applications,flavor=default"
+ xmlns="urn:jboss:profileservice:profile:hot-deployment:1.0">
+ <source path="${jboss.server.home.url}deploy" />
+ <scan-period time-unit="SECONDS">5</scan-period>
+ </hot-deployment>
+ <!--
+ The farming service.
+ -->
+ <farming-deployment name="jboss:profile=application,flavor=farming"
+ xmlns="urn:jboss:profileservice:profile:farming:1.0">
+ <source path="${jboss.server.home.url}farm" />
+ <scan-period time-unit="MINUTES">1</scan-period>
+ </farming-deployment>
+ <!-- The end -->
+</domain>
Deleted: projects/profileservice/trunk/core/src/test/resources/metadata/test.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/test.xml 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/test.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<profiles xmlns="urn:jboss:profileservice:profiles:1.0"
- name="profiles">
-
- <profile name="basic">
- <profile-source>
- <source>${jboss.server.home.url}deployers</source>
- <source>${jboss.server.home.url}conf</source>
- </profile-source>
- <requires name="ejb3" />
- <deployment>myEjb3Deployment.ear</deployment>
- </profile>
-
- <custom-profile name="custom" xmlns="urn:jboss:profileservice:profile:custom:1.0">
- <custom-source>
- <source>http://repository.jboss.org/maven2</source>
- </custom-source>
- <profile-dependency>basic</profile-dependency>
- <profile-deployment>
- <group-id>org.jboss.test.profileservice</group-id>
- <name>profileservice-test-artifact</name>
- <version>1.0.0.GA</version>
- </profile-deployment>
- </custom-profile>
-
-</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/bootstrap.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ -->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- The Profile Service -->
+ <bean name="ProfileServiceBootstrap" class="org.jboss.test.profileservice.support.ProfileServiceBootstrap">
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=Kernel" /></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" />
+
+ <!-- The bootstrap profile factory -->
+ <bean name="BootstrapProfileFactory" class="org.jboss.profileservice.profile.bootstrap.BootstrapProfileFactory">
+ <property name="repository"><inject bean="VirtualDeploymentRepository" /></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="VirtualDeploymentRepository" class="org.jboss.profileservice.repository.virtual.VirtualDeploymentRepository">
+ <incallback method="addRepository" />
+ <uncallback method="removeRepository" />
+ </bean>
+
+ <!-- The profile factories -->
+ <bean name="TypedProfileFactory" class="org.jboss.profileservice.TypedProfileFactory">
+ <incallback method="addProfileFactory" />
+ <uncallback method="removeProfileFactory" />
+ </bean>
+
+ <bean name="FileRepository" class="org.jboss.profileservice.repository.artifact.file.LocalFileArtifactRepository">
+ <constructor>
+ <parameter class="java.net.URI">${jboss.file.repository.url}</parameter>
+ </constructor>
+ </bean>
+
+ <!--
+ <bean name="ArtifactRepository" class="org.jboss.profileservice.repository.artifact.maven.LocalMavenArtifactRepository">
+ <constructor>
+ <parameter>TODO metadata</parameter>
+ <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/profiles/clustering-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/clustering-profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/clustering-profiles.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,28 @@
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+
+ <profile name="jboss:profile=clustering">
+ <file-repository group="jboss.clustering" />
+ <virtual-deployment name="jboss-cache-manager">
+ <meta-inf path="cache-manager" />
+ </virtual-deployment>
+ <virtual-deployment name="jgroups-channelfactory">
+ <meta-inf path="jgroups" />
+ </virtual-deployment>
+ <virtual-deployment name="clustering">
+ <meta-inf path="clustering" />
+ </virtual-deployment>
+ </profile>
+
+ <!--
+ The farming profile should get automatically activated once the
+ farming-profile is defined, as it sets a requirement on the
+ management namespace.
+ -->
+ <profile name="jboss:profile=deployment,flavor=farming">
+ <file-repository group="jboss.clustering" />
+ <deployment name="farming-jboss-beans.xml" />
+ <management namespace="urn:jboss:profileservice:profile:farming:1.0" />
+ <requires name="jboss:profile=clustering" />
+ </profile>
+
+</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/profiles/common-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/common-profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/common-profiles.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,16 @@
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+
+ <profile name="jboss:profile=default">
+ <file-repository group="deployment" />
+ <deployment name="alias-deployers-jboss-beans.xml" />
+ <deployment name="ear-deployer-jboss-eabs.xml" />
+ <requires name="jboss:profile=minimal" />
+ <requires name="jboss:profile=naming" />
+ </profile>
+
+ <profile name="jboss:profile=naming">
+ <file-repository group="deployment" />
+ <deployment name="core-naming-jboss-beans.xml" />
+ </profile>
+
+</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/core-profiles.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,83 @@
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+
+ <profile name="jboss:profile=minimal">
+ <requires name="jboss:profile=bootstrap" />
+ <requires name="jboss:profile=logging" />
+ <requires name="jboss:profile=threads" />
+ </profile>
+
+ <bootstrap name="jboss:profile=bootstrap">
+ <!--
+ The group should just specify a subfolder
+ of the repository root to easier group files.
+ -->
+ <file-repository group="bootstrap" />
+ <deployment name="aop.xml" />
+ <deployment name="classloader.xml" />
+ <deployment name="deployers.xml" />
+ <deployment name="jmx.xml" />
+ <deployment name="profile.xml" />
+ <deployment name="logging.xml" />
+ <deployment name="vfs.xml" />
+ <management namespace="urn:jboss:profileservice:boostrap:1.0" />
+ </bootstrap>
+
+ <!--
+ The hot-deployment profile should also get installed when
+ other profiles require the namespace only. No direct reference
+ needed, as this is bound to a meta data model anyway
+ -->
+ <profile name="jboss:profile=deployment,flavor=hot-deployment">
+ <file-repository group="deployment" />
+ <deployment name="hd-scanner-jboss-beans.xml" />
+ <management namespace="urn:jboss:profileservice:profile:hot-deployment:1.0" />
+ </profile>
+
+ <!--
+ Since jboss-logging.xml requires the deployer installed first
+ we need to separate the deployment from the deployer profile
+ -->
+ <profile name="jboss:profile=logging">
+ <file-repository group="logging" />
+ <deployment name="jboss-logging.xml" />
+ <requires name="jboss:profile=logging,flavor=deployer" />
+ </profile>
+
+ <profile name="jboss:profile=logging,flavor=deployer">
+ <file-repository group="logging" />
+ <virtual-deployment name="logging.deployer">
+ <meta-inf path="logmanager-jboss-beans.xml" />
+ <artifact groupId="org.jboss.logging" artifactId="logging-service-metadata" />
+ </virtual-deployment>
+ </profile>
+
+ <!--
+ Since jboss-threads.xml requires the deployer installed first
+ we need to separate the deployment from the deployer profile
+ -->
+ <profile name="jboss:profile=threads">
+ <file-repository group="threads" />
+ <deployment name="jboss-threas.xml" />
+ <requires name="jboss:profile=threads,flavor=deployer" />
+ </profile>
+
+ <profile name="jboss:profile=threads,flavor=deployer">
+ <file-repository group="threads" />
+ <virtual-deployment name="threads.deployer">
+ <meta-inf path="threads-deployer-jboss-beans.xml" />
+ <artifact groupId="org.jboss.logging" artifactId="logging-service-metadata" />
+ </virtual-deployment>
+ </profile>
+
+ <!--
+ Profiles should set an explicit requirement on the service binding manager.
+ -->
+ <profile name="jboss:profile=servicebindingmanager">
+ <file-repository group="servicebindingmanager" />
+ <virtual-deployment name="service.binding.manager">
+ <meta-inf path="jboss-beans.xml" />
+ <artifact groupId="org.jboss.jbossas" artifact="jboss-as-varia" classifier="jboss-bindingservice" />
+ </virtual-deployment>
+ </profile>
+
+</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/profiles/stack-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/stack-profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/stack-profiles.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,31 @@
+<!--
+ Plugable software stack configuration.
+
+ Other profiles can depend on the alias, which will only be resolvable
+ when the stack is explicitly referenced in the domain model.
+ -->
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+ <!--
+ Stack one.
+ -->
+ <profile name="jboss:profile=stack1">
+ <alias>jboss:profile=stack</alias>
+ <file-repository group="stack1" />
+ <virtual-deployment name="stack1">
+ <meta-inf path="jboss-beans.xml" />
+ <!-- artifacts for stack1 -->
+ </virtual-deployment>
+ </profile>
+ <!--
+ Stack two.
+ -->
+ <profile name="jboss:profile=stack2">
+ <alias>jboss:profile=stack</alias>
+ <file-repository group="stack2" />
+ <virtual-deployment name="stack2">
+ <meta-inf path="jboss-beans.xml" />
+ <!-- artifacts for stack2 -->
+ </virtual-deployment>
+ </profile>
+
+</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/profiles/web-profiles.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,46 @@
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+
+ <profile name="jboss:profile=web">
+ <requires name="jboss:profile=web,type=core" />
+ <!--
+ activation-policy=satisfied will install this profile
+ when it's requirements are satisfied (e.g. clustering installed)
+ -->
+ <requires name="jboss:profile=web,type=clustering"
+ activation-policy="satisfied" />
+ <!--
+ Depend on an alias of the web stack, which should get
+ activated either if stack1 or stack2 is installed
+ -->
+ <requires name="jboss:profile=web,flavor=stack"
+ activation-policy="satisfied" />
+ </profile>
+
+ <profile name="jboss:profile=web,type=core">
+ <file-repository group="jboss.web" />
+ <virtual-deployment name="jboss.web.deployer">
+ <meta-inf path="deployer" />
+ <artifact groupId="org.jboss.web" artifactId="deployer" />
+ </virtual-deployment>
+ <virtual-deployment name="jboss.web.runtime">
+ <meta-inf path="runtime" />
+ <artifact groupId="org.jboss.web" artifactId="jbossweb" />
+ <artifact groupId="org.jboss.web" artifactId="jboss-web-service" />
+ </virtual-deployment>
+ </profile>
+
+ <profile name="jboss:profile=web,flavor=clustering">
+ <file-repository group="jboss.web" />
+ <virtual-deployment name="jboss.web.clustering">
+ <meta-inf path="clustering" />
+ </virtual-deployment>
+ <requires name="jboss:profile=clustering" />
+ </profile>
+
+ <profile name="jboss:profile=web,flavor=stack">
+ <file-repository group="jboss.web" />
+ <!-- depend on the alias -->
+ <requires name="jboss:profile=stack" />
+ </profile>
+
+</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/system/repository/artifacts.xml
===================================================================
Added: projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/system/static/bootstrap/profile.xml 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,15 @@
+<?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="Basic Profile Factory" class="org.jboss.profileservice.profile.BasicProfileFactory">
+ <property name="repository"><inject bean="VirtualDeploymentRepository" /></property>
+ </bean>
+ <bean name="Legacy Profile Factory" class="org.jboss.profileservice.repository.legacy.LegacyProfileFactory" />
+
+</deployment>
\ No newline at end of file
Copied: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java (from rev 95098, projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java)
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/AbstractDomainMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,108 @@
+/*
+ * 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.domain;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.domain.spi.DomainFeatureNode;
+import org.jboss.profileservice.domain.spi.DomainMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * The domain meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace=DomainMetaData.DOMAIN_NAMESPACE,
+ elementFormDefault=XmlNsForm.QUALIFIED,
+ normalizeSpace=true,
+ replacePropertyRefs=true)
+ at XmlRootElement(name = "domain")
+ at XmlType(name = "managementDomainType", propOrder = {"features"})
+public class AbstractDomainMetaData implements DomainMetaData
+{
+
+ /** The management domain information. */
+ private ManagementDomainMetaData domain;
+
+ /** The local server information. */
+ private ServerMetaData server;
+
+ /** The elements of the domain. */
+ private List<DomainFeatureNode> features;
+
+ /**
+ * Get the management domain information.
+ *
+ * @return the domain meta data
+ */
+ @XmlTransient
+ public ManagementDomainMetaData getDomain()
+ {
+ return domain;
+ }
+
+ public void setDomain(ManagementDomainMetaData domain)
+ {
+ this.domain = domain;
+ }
+
+ /**
+ * Get the server meta data.
+ *
+ * @return the server meta data
+ */
+ @XmlTransient
+ public ServerMetaData getServer()
+ {
+ return server;
+ }
+
+ public void setServer(ServerMetaData server)
+ {
+ this.server = server;
+ }
+
+ /**
+ * Get the domain elements.
+ *
+ * @return the elements
+ */
+ @XmlAnyElement
+ public List<DomainFeatureNode> getFeatures()
+ {
+ return features;
+ }
+
+ public void setFeatures(List<DomainFeatureNode> elements)
+ {
+ this.features = elements;
+ }
+
+}
Deleted: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -1,77 +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.domain;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- * The domain meta data.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at XmlRootElement(name = "domain")
- at XmlType(name = "managementDomainType", propOrder = {"domain", "server"})
-public class DomainMetaData
-{
-
- /** The management domain information. */
- private ManagementDomainMetaData domain;
-
- /** The local server information. */
- private ServerMetaData server;
-
- /**
- * Get the management domain information.
- *
- * @return the domain meta data
- */
- @XmlElement(name = "management-domain")
- public ManagementDomainMetaData getDomain()
- {
- return domain;
- }
-
- public void setDomain(ManagementDomainMetaData domain)
- {
- this.domain = domain;
- }
-
- /**
- * Get the server meta data.
- *
- * @return the server meta data
- */
- @XmlElement(name = "jboss-server")
- public ServerMetaData getServer()
- {
- return server;
- }
-
- public void setServer(ServerMetaData server)
- {
- this.server = server;
- }
-
-}
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureNode.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureNode.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureNode.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,48 @@
+/*
+* 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.domain.spi;
+
+/**
+ * The domain feature node.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DomainFeatureNode
+{
+
+ /**
+ * Get the management namespace.
+ *
+ * @return the management namespace
+ */
+ String getNameSpace();
+
+ /**
+ * Visit a domain element
+ *
+ * @param visitor the visitor
+ */
+ void visit(DomainFeatureVisitor visitor);
+
+}
+
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureVisitor.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureVisitor.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainFeatureVisitor.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,51 @@
+/*
+* 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.domain.spi;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The domain feature visitor.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DomainFeatureVisitor
+{
+
+ /**
+ * Add the profile meta data.
+ *
+ * @param metaData the profile meta data
+ */
+ void addProfileMetaData(ProfileMetaData metaData);
+
+
+ /**
+ * Visit a domain element node.
+ *
+ * @param node the node
+ */
+ void visit(DomainFeatureNode node);
+
+}
+
Added: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,46 @@
+/*
+* 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.domain.spi;
+
+import java.util.List;
+
+/**
+ * The domain meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DomainMetaData
+{
+
+ /** The domain xml namespace. */
+ String DOMAIN_NAMESPACE = "urn:jboss:profileservice:domain:1.0";
+
+ /**
+ * Get the domain features.
+ *
+ * @return the features.
+ */
+ List<DomainFeatureNode> getFeatures();
+
+}
+
Modified: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaDataRepository.java
===================================================================
--- projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaDataRepository.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/spi/DomainMetaDataRepository.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -21,7 +21,6 @@
*/
package org.jboss.profileservice.domain.spi;
-import org.jboss.profileservice.domain.DomainMetaData;
/**
* The local domain meta data repository.
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -40,13 +40,6 @@
ProfileSourceMetaData getSource();
/**
- * Get the sub-profiles.
- *
- * @return the sub-profiles
- */
- List<? extends SubProfileMetaData> getSubprofiles();
-
- /**
* Get the associated deployments to this profile.
*
* @return the deployments
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -21,7 +21,6 @@
*/
package org.jboss.profileservice.spi.metadata.helpers;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.dependency.ProfileCapability;
import org.jboss.profileservice.spi.dependency.ProfileRequirement;
@@ -39,21 +38,6 @@
super();
}
- public AbstractProfileKeyCapability(String name)
- {
- super(name);
- }
-
- public AbstractProfileKeyCapability(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public AbstractProfileKeyCapability(ProfileKey key)
- {
- super(key);
- }
-
public boolean resolves(ProfileRequirement requirement)
{
return super.equals(requirement);
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -134,9 +134,10 @@
*/
protected void toString(StringBuilder builder)
{
- builder.append("domain=").append(getDomain());
- builder.append(", server=").append(getServer());
- builder.append(", name=").append(getName());
+ builder.append("name=").append(getName());
+ // TODO remove domain and server from the meta data ?
+ // builder.append(", domain=").append(getDomain());
+ // builder.append(", server=").append(getServer());
}
private static boolean equals(Object one, Object two)
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileMetaData.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileMetaData.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -23,10 +23,9 @@
import java.util.List;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitorNode;
/**
* A abstract profile meta data.
@@ -37,37 +36,22 @@
public abstract class AbstractProfileMetaData extends AbstractProfileKeyCapability implements ProfileMetaData
{
- /** The sub profiles. */
- private List<SubProfileMetaData> subprofiles;
+ /** The features. */
+ private List<ProfileMetaDataVisitorNode> features;
public AbstractProfileMetaData()
{
super();
}
- public AbstractProfileMetaData(String name)
+ public List<ProfileMetaDataVisitorNode> getFeatures()
{
- super(name);
+ return features;
}
-
- public AbstractProfileMetaData(String domain, String server, String name)
- {
- super(domain, server, name);
- }
-
- public AbstractProfileMetaData(ProfileKey key)
- {
- super(key);
- }
-
- public List<SubProfileMetaData> getSubprofiles()
- {
- return subprofiles;
- }
- public void setSubprofiles(List<SubProfileMetaData> subprofiles)
+ public void setFeatures(List<ProfileMetaDataVisitorNode> features)
{
- this.subprofiles = subprofiles;
+ this.features = features;
}
public void visit(ProfileMetaDataVisitor visitor)
@@ -76,11 +60,11 @@
visitor.addCapability(this);
// Process the SubProfiles
- if(this.subprofiles != null && this.subprofiles.isEmpty() == false)
+ if(this.features != null && this.features.isEmpty() == false)
{
- for(SubProfileMetaData subProfile : subprofiles)
+ for(ProfileMetaDataVisitorNode feature : features)
{
- subProfile.visit(visitor);
+ feature.visit(visitor);
}
}
}
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-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -30,7 +30,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface ArtifactRepositoryConfiguration extends Serializable
+public interface ArtifactRepositoryConfiguration extends Serializable, Identifyable
{
/**
@@ -41,6 +41,13 @@
String getType();
/**
+ * Get the group.
+ *
+ * @return the group
+ */
+ String getGroup();
+
+ /**
* Get the repository location.
*
* @return the location
Deleted: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -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.spi.virtual.assembly;
-
-import java.io.IOException;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * The virtual assembly context, used to assembly virtual deployments.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public interface VirtualAssemblyContext
-{
-
- /**
- * Get the context root.
- *
- * @return the context root
- */
- VirtualFile getRoot();
-
- /**
- * Add a child.
- *
- * @param vf the virtual file
- */
- void addChild(VirtualFile vf) throws IOException;
-
- /**
- * Add a child.
- *
- * @param vf the virtual file
- * @param name the new file name
- */
- void addChild(VirtualFile vf, String name) throws IOException;
-
- /**
- * Recursively add a path.
- *
- * @param vf the virtual file
- */
- void addPath(VirtualFile vf) throws IOException;
-
- /**
- * Recursively add a path.
- *
- * @param vf the virtual file
- * @param filter the virtual file filter
- */
- void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException;
-
-}
-
Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -0,0 +1,45 @@
+/*
+* 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.virtual.assembly;
+
+import java.io.IOException;
+
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface VirtualDeploymentAssembly
+{
+
+ /**
+ * Assemble a virtual deployment.
+ *
+ * @param deployment the virtual deployment
+ * @return the assembly context
+ * @throws IOException
+ */
+ VirtualDeploymentAssemblyContext assemble(VirtualDeployment deployment) throws IOException;
+
+}
+
Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java 2009-12-01 10:52:00 UTC (rev 97216)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java 2009-12-01 11:14:07 UTC (rev 97217)
@@ -25,6 +25,7 @@
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.virtual.VirtualFile;
/**
* A virtual deployment context.
@@ -32,10 +33,17 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public interface VirtualDeploymentAssemblyContext extends VirtualAssemblyContext
+public interface VirtualDeploymentAssemblyContext
{
/**
+ * Get the root.
+ *
+ * @return the root
+ */
+ VirtualFile getRoot();
+
+ /**
* Add a virtual artifact.
*
* @param artifact the artifact
@@ -47,6 +55,7 @@
* Add a child deployment context.
*
* @param child the virtual deployment child
+ * @throws IOException
*/
VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException;
More information about the jboss-cvs-commits
mailing list