[jboss-cvs] JBossAS SVN: r92346 - in projects/profileservice/trunk: build and 93 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 14 07:23:17 EDT 2009


Author: emuckenhuber
Date: 2009-08-14 07:23:12 -0400 (Fri, 14 Aug 2009)
New Revision: 92346

Added:
   projects/profileservice/trunk/build/
   projects/profileservice/trunk/build/.classpath
   projects/profileservice/trunk/build/.project
   projects/profileservice/trunk/build/.settings/
   projects/profileservice/trunk/build/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/build/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/build/pom.xml
   projects/profileservice/trunk/build/src/
   projects/profileservice/trunk/build/src/main/
   projects/profileservice/trunk/build/src/main/java/
   projects/profileservice/trunk/build/src/main/resources/
   projects/profileservice/trunk/build/src/test/
   projects/profileservice/trunk/build/src/test/java/
   projects/profileservice/trunk/build/src/test/resources/
   projects/profileservice/trunk/core/
   projects/profileservice/trunk/core/.classpath
   projects/profileservice/trunk/core/.project
   projects/profileservice/trunk/core/.settings/
   projects/profileservice/trunk/core/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/core/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/core/pom.xml
   projects/profileservice/trunk/core/src/
   projects/profileservice/trunk/core/src/main/
   projects/profileservice/trunk/core/src/main/java/
   projects/profileservice/trunk/core/src/main/java/org/
   projects/profileservice/trunk/core/src/main/java/org/jboss/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractBoostrapProfileFactory.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/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.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/ProfileCreateAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ImplicitProfileRequirement.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/DelegateProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/NoopProfile.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployAction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.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/
   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/BasicProfileSourceMetaData.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/HotDeploymentProfileMetaData.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/profile/metadata/emtpy/
   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/repository/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java
   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/DeploymentUtils.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java
   projects/profileservice/trunk/core/src/test/
   projects/profileservice/trunk/core/src/test/java/
   projects/profileservice/trunk/core/src/test/java/org/
   projects/profileservice/trunk/core/src/test/java/org/jboss/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/ProfileServiceTestBase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomDeploymentMetaData.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/metadata/test/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/AbstractProfileServiceMetaDataTest.java
   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/support/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/
   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/resources/
   projects/profileservice/trunk/core/src/test/resources/log4j.properties
   projects/profileservice/trunk/core/src/test/resources/metadata/
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/clustering.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/default.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/ejb3.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jboss-web.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jmx.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/metadata-deployers.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/profiles/seam.profile
   projects/profileservice/trunk/core/src/test/resources/metadata/test.xml
   projects/profileservice/trunk/domain/
   projects/profileservice/trunk/domain/.classpath
   projects/profileservice/trunk/domain/.project
   projects/profileservice/trunk/domain/.settings/
   projects/profileservice/trunk/domain/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/domain/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/domain/pom.xml
   projects/profileservice/trunk/domain/src/
   projects/profileservice/trunk/domain/src/main/
   projects/profileservice/trunk/domain/src/main/java/
   projects/profileservice/trunk/domain/src/main/java/org/
   projects/profileservice/trunk/domain/src/main/java/org/jboss/
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/
   projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
   projects/profileservice/trunk/domain/src/main/resources/
   projects/profileservice/trunk/domain/src/test/
   projects/profileservice/trunk/domain/src/test/java/
   projects/profileservice/trunk/domain/src/test/resources/
   projects/profileservice/trunk/persistence/
   projects/profileservice/trunk/persistence/.classpath
   projects/profileservice/trunk/persistence/.project
   projects/profileservice/trunk/persistence/.settings/
   projects/profileservice/trunk/persistence/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/persistence/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/persistence/pom.xml
   projects/profileservice/trunk/persistence/src/
   projects/profileservice/trunk/persistence/src/main/
   projects/profileservice/trunk/persistence/src/main/java/
   projects/profileservice/trunk/persistence/src/main/java/org/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectPersistence.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectRecreation.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractPersistenceFactory.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValuePersistence.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValueRecreation.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AttachmentPropertyPopulator.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultPersistenceDelegate.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultRecreationDelegate.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DelegatingPersistencePlugin.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectPersistencePlugin.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectRecreationHelper.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceConstants.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceFactory.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/AbstractComponentMapper.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapper.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapperRegistry.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractElement.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractPersisitedValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/ModificationInfo.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/NullValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedArrayValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCollectionValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedComponent.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCompositeValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedElement.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedEnumValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedGenericValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedManagedObject.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPair.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPropertiesValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedProperty.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedSimpleValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedTableValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValue.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValueVisitor.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistenceRoot.java
   projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/package-info.java
   projects/profileservice/trunk/persistence/src/test/
   projects/profileservice/trunk/persistence/src/test/java/
   projects/profileservice/trunk/persistence/src/test/java/org/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/CompositeMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponent.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponentMapper.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestDeployment.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestMgtComponentImpl.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/AbstractComponentMapperTest.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/ComponentMapperUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/CollectionMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/GenericSupportMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/NestedTestMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/ObjectNameMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/PrimitiveMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleArrayMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleGenericMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleStringMapMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleTableMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/TestMetaData.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/AbstractPersistenceFormatTest.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ArrayValueUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/CollectionValueUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/GenericValueUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/MapCompositeUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ObjectNameUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/PersistenceFormatTestSuite.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TableValueUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
   projects/profileservice/trunk/persistence/src/test/resources/
   projects/profileservice/trunk/persistence/src/test/resources/log4j.properties
   projects/profileservice/trunk/pom.xml
   projects/profileservice/trunk/sandbox/
   projects/profileservice/trunk/sandbox/.classpath
   projects/profileservice/trunk/sandbox/.project
   projects/profileservice/trunk/sandbox/.settings/
   projects/profileservice/trunk/sandbox/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/sandbox/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/sandbox/pom.xml
   projects/profileservice/trunk/sandbox/src/
   projects/profileservice/trunk/sandbox/src/main/
   projects/profileservice/trunk/sandbox/src/main/java/
   projects/profileservice/trunk/sandbox/src/main/resources/
   projects/profileservice/trunk/sandbox/src/test/
   projects/profileservice/trunk/sandbox/src/test/java/
   projects/profileservice/trunk/sandbox/src/test/resources/
   projects/profileservice/trunk/spi/
   projects/profileservice/trunk/spi/.classpath
   projects/profileservice/trunk/spi/.project
   projects/profileservice/trunk/spi/.settings/
   projects/profileservice/trunk/spi/.settings/org.eclipse.jdt.core.prefs
   projects/profileservice/trunk/spi/.settings/org.maven.ide.eclipse.prefs
   projects/profileservice/trunk/spi/pom.xml
   projects/profileservice/trunk/spi/src/
   projects/profileservice/trunk/spi/src/main/
   projects/profileservice/trunk/spi/src/main/java/
   projects/profileservice/trunk/spi/src/main/java/org/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ContextStateMapper.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DelegatingComponentDispatcher.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownComponentTypes.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ManagementView.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/NameMatcher.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentID.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentOptions.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressListener.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentContentFlags.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentOption.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ModificationInfo.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/MutableProfile.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchDeploymentException.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchProfileException.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/Profile.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileFactory.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileDeploymentMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileKeyMetaData.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/ProfileMetaDataVisitor.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitorNode.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileSourceMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/SubProfileMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/
   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/metadata/helpers/AbstractSubProfileKeyMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/ControllerStateMetaType.java
   projects/profileservice/trunk/spi/src/test/
   projects/profileservice/trunk/spi/src/test/java/
Modified:
   projects/profileservice/trunk/
Log:
initial import of profileservice project structure


Property changes on: projects/profileservice/trunk
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
target



Property changes on: projects/profileservice/trunk/build
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/build/.classpath
===================================================================
--- projects/profileservice/trunk/build/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/build/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/build/.project
===================================================================
--- projects/profileservice/trunk/build/.project	                        (rev 0)
+++ projects/profileservice/trunk/build/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-build</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/build/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/build/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/build/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 14:46:38 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/build/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/build/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/build/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Mon Jun 22 19:42:38 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/build/pom.xml
===================================================================
--- projects/profileservice/trunk/build/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/build/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,41 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.profileservice</groupId>
+    <artifactId>jboss-profileservice-parent</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.profileservice</groupId>
+  <artifactId>jboss-profileservice-build</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>JBoss ProfileService Distribution</name>
+  <url>http://www.jboss.org/jbossas</url>
+  <description>JBoss ProfileService Distribution Build</description>
+
+  <build>
+  <!--
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-2</version>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <configuration>
+              <finalName>jboss-man-${project.version}</finalName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    -->
+  </build>
+
+  <dependencies>
+
+  </dependencies>
+  
+</project>


Property changes on: projects/profileservice/trunk/core
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/core/.classpath
===================================================================
--- projects/profileservice/trunk/core/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/core/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/core/.project
===================================================================
--- projects/profileservice/trunk/core/.project	                        (rev 0)
+++ projects/profileservice/trunk/core/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/core/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/core/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 14:46:39 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/core/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/core/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/core/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Mon Jun 22 19:42:38 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/core/pom.xml
===================================================================
--- projects/profileservice/trunk/core/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/core/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>org.jboss.profileservice</groupId>
+		<artifactId>jboss-profileservice-parent</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.jboss.profileservice</groupId>
+	<artifactId>jboss-profileservice-core</artifactId>
+	<version>1.0.0-SNAPSHOT</version>
+	<name>JBoss ProfileService Core</name>
+	<url>http://www.jboss.org/jbossas</url>
+	<description>JBoss ProfileService Core</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.jboss.logging</groupId>
+			<artifactId>jboss-logging-log4j</artifactId>
+			<version>2.1.0.GA</version>
+		</dependency>
+	
+		<dependency>
+			<groupId>org.jboss.profileservice</groupId>
+			<artifactId>jboss-profileservice-spi</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.microcontainer</groupId>
+			<artifactId>jboss-dependency</artifactId>
+			<version>${version.org.jboss.microcontainer}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.microcontainer</groupId>
+			<artifactId>jboss-kernel</artifactId>
+			<version>${version.org.jboss.microcontainer}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+
+</project>

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,425 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ControllerStateModel;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.profileservice.dependency.AbstractProfileContextFactory;
+import org.jboss.profileservice.dependency.ProfileControllerContext;
+import org.jboss.profileservice.dependency.ProfileServiceController;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * The abstract profile service.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileService implements ProfileService
+{
+
+   /** The controller. */
+   private final ProfileServiceController controller;
+   
+   /** The profile controller context factory. */
+   private AbstractProfileContextFactory contextFactory; 
+
+   /** The deployment manager plugin. */
+   private DeploymentManager deploymentMgr;
+   
+   /** The management view plugin. */
+   private ManagementView mgtView;
+
+   public AbstractProfileService(AbstractController parent,
+         ProfileDeployerPluginRegistry reg, ProfileFactory<ProfileMetaData, Profile> delegate)
+   {
+      if(parent == null)
+         throw new IllegalArgumentException("null controller");
+      // Create a scoped controller
+      ProfileServiceController controller = new ProfileServiceController(parent);
+      // TODO this should not be set to the controller
+      controller.setDeployerRegistry(reg);
+      controller.setFactory(delegate);
+      this.controller = controller;
+   }
+   
+   public DeploymentManager getDeploymentManager()
+   {
+      return this.deploymentMgr;
+   }
+   
+   public void setDeploymentManager(DeploymentManager deploymentMgr)
+   {
+      this.deploymentMgr = deploymentMgr;
+   }
+   
+   public ManagementView getViewManager()
+   {
+      return this.mgtView;
+   }
+   
+   public void setViewManager(ManagementView mgtView)
+   {
+      this.mgtView = mgtView;
+   }
+   
+   public AbstractProfileContextFactory getContextFactory()
+   {
+      return contextFactory;
+   }
+   
+   public void setContextFactory(AbstractProfileContextFactory contextFactory)
+   {
+      this.contextFactory = contextFactory;
+   }
+   
+   public void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getContext(key, null);
+      if(ctx == null)
+         throw new NoSuchProfileException("No such registered profile" + key);
+      
+      try
+      {
+         controller.change(ctx, ControllerState.INSTALLED);
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException("failed to install profile " + key, t);
+      }
+   }
+
+   public void deactivateProfile(ProfileKey key) throws NoSuchProfileException
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getInstalledContext(key);
+      if(ctx == null)
+         throw new NoSuchProfileException("No such registered profile" + key);
+      
+      try
+      {
+         controller.change(ctx, ControllerState.NOT_INSTALLED);
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException("failed to uninstall profile " + key, t);
+      }      
+   }
+
+   public Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getInstalledContext(key);
+      if(ctx instanceof ProfileControllerContext)
+      {
+         return ((ProfileControllerContext)ctx).getProfile();
+      }
+      throw new NoSuchProfileException("No active profile " + key);
+   }
+
+   public Collection<ProfileKey> getActiveProfileKeys()
+   {
+      List<ProfileKey> profiles = new ArrayList<ProfileKey>();
+      for(ControllerContext ctx : controller.getContextsByState(ControllerState.INSTALLED))
+      {
+         if(ctx instanceof ProfileControllerContext)
+         {
+            ProfileControllerContext profileCtx = (ProfileControllerContext) ctx;
+            profiles.add((ProfileKey) profileCtx.getName());
+         }
+      }
+      return profiles;
+   }
+
+   public String[] getDomains()
+   {
+      List<String> domains = new ArrayList<String>();
+      Collection<ProfileKey> profiles = getActiveProfileKeys();
+      for(ProfileKey key : profiles)
+         domains.add(key.getDomain());
+      return domains.toArray(new String[ domains.size() ]);
+   }
+
+   public Collection<ProfileKey> getProfileKeys()
+   {
+      List<ProfileKey> profiles = new ArrayList<ProfileKey>();
+      for(ControllerContext ctx : controller.getContextsByState(null))
+      {
+         if(ctx instanceof ProfileControllerContext)
+         {
+            ProfileControllerContext profileCtx = (ProfileControllerContext) ctx;
+            profiles.add((ProfileKey) profileCtx.getName());
+         }
+      }
+      return profiles;
+   }
+
+   public ProfileMetaData getProfileMetaData(ProfileKey key) throws NoSuchProfileException
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getContext(key, null);
+      if(ctx instanceof ProfileControllerContext)
+      {
+         return ((ProfileControllerContext)ctx).getProfileMetaData();
+      }
+      throw new NoSuchProfileException("No such registered profile " + key);
+   }
+
+   public void registerProfile(ProfileMetaData metaData) throws Exception
+   {
+      if(metaData == null)
+         throw new IllegalArgumentException("null profile meta data");
+    
+      ProfileKey key = ProfileKey.createProfileKey(metaData);
+      registerProfile(key, metaData);
+   }
+   
+   public void registerProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
+   {
+      registerProfile(key, metaData, null);
+   }
+   
+   public void registerProfile(ProfileKey key, ProfileMetaData metaData, Profile profile) throws Exception
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      if(metaData == null)
+         throw new IllegalArgumentException("null profile meta data");
+      
+      ProfileControllerContext ctx = contextFactory.createProfileContext(key, metaData, profile);
+      if(ctx == null)
+         throw new IllegalStateException("created null profile context");
+      
+      try
+      {
+         controller.install(ctx);
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException("failed to install profile context"  + key, t);
+      }
+   }
+
+   public void unregisterProfile(ProfileKey key) throws NoSuchProfileException
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getContext(key, null);
+      if(ctx == null)
+         throw new NoSuchProfileException("No such registered profile");
+      
+      controller.uninstall(key);
+   }
+
+   public void validateProfile(ProfileKey key) throws Exception
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      ControllerContext ctx = controller.getContext(key, null);
+      if(ctx == null)
+         throw new NoSuchProfileException("No such profile registered " + key);
+      
+      validate(ctx);
+   }
+   
+   /**
+    * Check if all dependencies are satisfied and the profile was installed successfully.
+    * 
+    * @param context the context to validate
+    * @throws Exception
+    */
+   protected void validate(ControllerContext context) throws Exception
+   {
+      // 
+      Set<String> errors = new HashSet<String>();
+      Map<Object, String> map = new HashMap<Object, String>();
+      // Validate the context, with it's dependencies
+      internalValidateContext(context, errors, map);
+      // Create and throw the Exception
+      logErrors(errors, map.values());
+   }
+   
+   /**
+    * Validate the context and create the error messages if needed.
+    * 
+    * TODO maybe recurse into dependent contexts?
+    * 
+    * @param ctx the context to validate
+    * @param errors a set of errors
+    * @param incomplete a set of incomplete contexts
+    */
+   protected void internalValidateContext(ControllerContext ctx, Set<String> errors, Map<Object, String> incomplete)
+   {
+      if (ctx.getState().equals(ControllerState.ERROR))
+      {
+         JBossStringBuilder builder = new JBossStringBuilder();
+         builder.append("Profile: ").append(ctx.getName());
+         builder.append(" in error due to ").append(ctx.getError().toString()); 
+         errors.add(builder.toString());
+      }
+      else
+      {
+         Object name = ctx.getName();
+         if(incomplete.containsKey(name))
+            return;
+         
+         DependencyInfo dependsInfo = ctx.getDependencyInfo();
+         Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
+         for (DependencyItem item : depends)
+         {
+            if(item.isResolved())
+               continue;
+            
+            ControllerState dependentState = item.getDependentState();
+            if (dependentState == null)
+               dependentState = ControllerState.INSTALLED;
+            
+            ControllerState otherState = null;
+            ControllerContext other = null; 
+            Object iDependOn = item.getIDependOn();
+
+            if (name.equals(iDependOn) == false)
+            {
+               if (iDependOn != null)
+               {
+                  other = controller.getContext(iDependOn, null);
+                  if (other != null)
+                     otherState = other.getState();
+               }
+
+               boolean print = true;
+               if (otherState != null && otherState.equals(ControllerState.ERROR) == false)
+               {
+                  ControllerStateModel states = controller.getStates();
+                  if (states.isBeforeState(otherState, dependentState) == false)
+                     print = false;
+               }
+
+               if (print)
+               {
+                  JBossStringBuilder buffer = new JBossStringBuilder();
+                  buffer.append(name).append(" is missing following dependencies: ");
+
+                  buffer.append(iDependOn).append('{').append(dependentState.getStateString());
+                  buffer.append(':');
+                  if (iDependOn == null)
+                  {
+                     buffer.append("** UNRESOLVED " + item.toHumanReadableString() + " **");
+                  }
+                  else
+                  {
+                     if (other == null)
+                        buffer.append("** NOT FOUND **");
+                     else
+                        buffer.append(otherState.getStateString());
+                  }
+                  buffer.append('}');
+
+                  // Add Error message and check other context.
+                  incomplete.put(name, buffer.toString());
+                  if(other!= null && incomplete.containsKey(other) == false)
+                  {
+                     internalValidateContext(other, errors, incomplete);
+                  }
+               }
+            }
+         }  
+      }
+   }
+   
+   /**
+    * This method just groups the errors and incomplete messages and throws an
+    * Exception if there are errors or missing dependencies.
+    * 
+    * @param errors a set of errors
+    * @param incomplete a set of missing dependencies
+    * @throws Exception in case there are errors or missing dependencies
+    */
+   protected void logErrors(Set<String> errors, Collection<String> incomplete) throws Exception
+   {
+      if(errors.isEmpty() && incomplete.isEmpty())
+         return;
+
+      JBossStringBuilder buffer = new JBossStringBuilder();
+      buffer.append("Incompletely deployed:\n");
+      
+      // Append errors
+      if(errors.size() != 0)
+      {
+         buffer.append("\n*** PROFILES IN ERROR: Name -> Error\n");
+         for(String error : errors)
+            buffer.append(error).append('\n');
+      }
+      
+      // Append missing dependencies
+      if(incomplete.size() != 0)
+      {
+         buffer.append("\n*** PROFILES MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n");
+         for(String missing : incomplete)
+            buffer.append(missing).append('\n');
+      }
+      
+      // Fail
+      throw new IllegalStateException(buffer.toString());
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/AbstractProfileService.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NoopProfileDeployerPlugin implements ProfileDeployerPlugin
+{
+
+   /** The added deployments. */
+   private Map<String, ProfileDeployment> deployments = new HashMap<String, ProfileDeployment>();
+   
+   /** The Logger. */
+   private static final Logger log = Logger.getLogger(NoopProfileDeployerPlugin.class);
+   
+   @Override
+   public void addDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("null profile deployment");
+      this.deployments.put(deployment.getName(), deployment);
+      log.debug("add " + deployment);
+   }
+
+   @Override
+   public void checkComplete(String... names) throws Exception
+   {
+      ///
+   }
+
+   @Override
+   public void checkComplete() throws Exception
+   {
+      ///
+   }
+
+   @Override
+   public void process()
+   {
+      ///
+   }
+
+   @Override
+   public void removeDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployments == null)
+         throw new IllegalArgumentException("null profile deployment");
+      this.deployments.remove(deployment.getName());
+      if(log.isTraceEnabled())
+         log.trace("remove " + deployment);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/NoopProfileDeployerPlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDeployerPlugin
+{
+
+   /**
+    * Add a deployment.
+    * 
+    * @param deployment the profile deployment.
+    * @throws Exception
+    */
+   public void addDeployment(ProfileDeployment deployment) throws Exception;
+   
+   /**
+    * Remove a deployment.
+    * 
+    * @param deployment the profile deployment
+    * @throws Exception
+    */
+   public void removeDeployment(ProfileDeployment deployment) throws Exception;
+   
+   /**
+    * Process ...
+    */
+   public void process();
+   
+   /**
+    * Check complete.
+    * 
+    * @param names the deployment names
+    * @throws Excetion
+    */
+   public void checkComplete(String... names) throws Exception;
+
+   
+   /**
+    * Check complete.
+    * 
+    * @throws Exception
+    */
+   public void checkComplete() throws Exception;
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+
+/**
+ * A deployer registry to swap the used deployer. Normally either a 
+ * BasicXmlDeployer or the MainDeployer.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDeployerPluginRegistry
+{
+   /** The default. */
+   private static final String DEFAULT = "__default___";
+   
+   private Map<String, ProfileDeployerPlugin> map = new ConcurrentHashMap<String, ProfileDeployerPlugin>();
+   
+   public ProfileDeployerPlugin getDeployer(ProfileMetaData metaData)
+   {
+      String type = metaData.getClass().getName();
+      ProfileDeployerPlugin plugin = map.get(type);
+      if(plugin == null)
+         plugin = map.get(DEFAULT);
+         
+      return plugin;
+   }
+   
+   public void addDefaultPlugin(ProfileDeployerPlugin plugin)
+   {
+      if(plugin == null)
+         throw new IllegalArgumentException("null deployer plugin");
+      
+      map.put(DEFAULT, plugin);
+   }
+   
+   public void addPlugin(String type, ProfileDeployerPlugin plugin)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null plugin type");
+      if(plugin == null)
+         throw new IllegalArgumentException("null deployer plugin");
+      
+      map.put(type, plugin);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/ProfileDeployerPluginRegistry.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.profile.NoopProfile;
+import org.jboss.profileservice.profile.metadata.emtpy.EmptyProfileMetaData;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * A typed profile factory. This delegates the creation of profiles to 
+ * the registered factories, based on the class name of the profile meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TypedProfileFactory implements ProfileFactory<ProfileMetaData, Profile>
+{
+
+   /** The type we create locally. */
+   private static final String typeName = EmptyProfileMetaData.class.getName();
+   
+   /** The profile factories. */
+   private Map<String, ProfileFactory<ProfileMetaData, Profile>> factories = new ConcurrentHashMap<String, ProfileFactory<ProfileMetaData, Profile>>();
+
+   public TypedProfileFactory()
+   {
+      super();
+   }
+   
+   public String[] getTypes()
+   {
+      return new String[] { typeName };
+   }
+
+   public Profile createProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
+   {
+      if(key == null)
+         throw new IllegalArgumentException("Null profile key.");
+      if(metaData == null)
+         throw new IllegalArgumentException("Null profile meta data");
+      
+      String profileType = metaData.getClass().getName();
+      if(typeName.equals(profileType))
+         return createNoopProfile(key, metaData);
+      
+      return delegateCreate(profileType, key, metaData);
+   }
+
+   /**
+    * Delegate the creation of a profile to a registered factory.
+    * 
+    * @param profileType the profile type
+    * @param key the profile key
+    * @param metaData the profile meta data
+    * @return the profile
+    * @throws IllegalStateException if there is no factory registered
+    * @throws Exception for any error
+    */
+   protected Profile delegateCreate(String profileType, ProfileKey key, ProfileMetaData metaData) throws Exception
+   {
+      ProfileFactory<ProfileMetaData, Profile> factory = this.factories.get(profileType);
+      if(factory == null)
+         throw new IllegalStateException("Unrecognized meta data type: " + profileType);
+      
+      return factory.createProfile(key, metaData);      
+   }
+   
+   /**
+    * Create a empty profile. 
+    * 
+    * @param key the profile key
+    * @param metaData the profile meta data
+    * @param subProfiles the sub profiles
+    * @return the profile
+    */
+   protected Profile createNoopProfile(ProfileKey key, ProfileMetaData metaData)
+   {
+      return new NoopProfile(key);
+   }
+   
+   /**
+    * Add a profile factory.
+    * 
+    * @param factory the abstract profile factory to add
+    */
+   public void addProfileFactory(ProfileFactory<ProfileMetaData, Profile> factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("Null profile factory.");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("Null factory types.");
+      
+      for(String type : factory.getTypes())
+         addProfileFactory(type, factory);
+   }
+   
+   /**
+    * Add a profile factory.
+    * 
+    * @param type the type
+    * @param factory the factory
+    */
+   public void addProfileFactory(String type, ProfileFactory<ProfileMetaData, Profile> factory)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null factory type");
+      if(factory == null)
+         throw new IllegalArgumentException("null profile factory");
+      this.factories.put(type, factory);
+   }
+   
+   /**
+    * Remove a profile factory.
+    * 
+    * @param factory the abstract profile factory to remove
+    */
+   public void removeProfileFactory(ProfileFactory<ProfileMetaData, Profile> factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("Null profile factory.");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("Null factory types.");
+      
+      for(String type : factory.getTypes())
+         removeProfileFactory(type);
+   }
+   
+   /**
+    * Remove a profile factory.
+    * 
+    * @param type the factory type
+    */
+   public void removeProfileFactory(String type)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null factory type.");
+      this.factories.remove(type);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/TypedProfileFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractBoostrapProfileFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractBoostrapProfileFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractBoostrapProfileFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,34 @@
+/*
+ * 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.bootstrap;
+
+/**
+ * The abstract bootstrap profile factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractBoostrapProfileFactory
+{
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractBoostrapProfileFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,37 @@
+/*
+ * 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.bootstrap;
+
+
+/**
+ * The abstract profile service bootstrap.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileServiceBootstrap
+{
+
+   // TODO
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/bootstrap/AbstractProfileServiceBootstrap.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * A abstract profile install/uninstall action.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileAction implements ControllerContextAction
+{
+   /** The logger. */
+   protected final Logger log = Logger.getLogger(getClass());
+   
+   public void install(Profile profile) throws Exception
+   {
+      //
+   }
+   
+   public void uninstall(Profile profile)
+   {
+      //
+   }
+   
+   @Override
+   public void install(ControllerContext context) throws Throwable
+   {
+      if(context instanceof ProfileControllerContext)
+      {
+         Profile profile = ((ProfileControllerContext)context).getProfile();
+         if(profile == null)
+            return;
+         
+         // Install
+         install(profile);
+      }
+   }
+   
+   @Override
+   public void uninstall(ControllerContext context)
+   {
+      if(context instanceof ProfileControllerContext)
+      {
+         Profile profile = ((ProfileControllerContext)context).getProfile();
+         if(profile == null)
+            return;
+       
+         try
+         {
+            // Uninstall
+            uninstall(profile);
+         }
+         catch (Throwable t)
+         {
+            log.error("Error when uninstalling profile: " + profile, t);
+         }
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileContextFactory
+{
+
+   /** The default actions. */
+   protected static final AbstractControllerContextActions defaultActions;
+   
+   /** The resolver. */
+   private static final ProfilesRequirementResolver resolver = new ProfilesRequirementResolver();
+   
+   static
+   {
+      Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+      actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstace());
+      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
+      actions.put(ControllerState.START, ProfileStartAction.getInstance());
+      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
+      actions.put(ProfileServiceController.DEPLOY_STATE, ProfileDeployAction.getInstance());
+      defaultActions = new AbstractControllerContextActions(actions);
+   }
+   
+   public String[] getTypes()
+   {
+      return new String[0];
+   }
+   
+   /**
+    * Create a ProfileControllerContext.
+    * 
+    * @param key the profile key
+    * @param metaData the profile meta data
+    * @param profile the profile
+    * @return the profile controller context
+    */
+   public abstract ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile);
+   
+   protected ProfilesRequirementResolver getRequirementResolver()
+   {
+      return resolver;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
+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;
+
+/**
+ * The abstract dependency context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileDependencyContext implements ProfileDependencyContext, ProfileMetaDataVisitor
+{
+   
+   /** The profile key. */
+   private final ProfileKey key;
+
+   /** The profile meta data. */
+   private final ProfileMetaData profileMetaData;
+   
+   /** The profile structure. */
+   private final ProfilesRequirementResolver resolver;
+   
+   /** The capabilities. */
+   private List<ProfileCapability> capabilites = new ArrayList<ProfileCapability>();
+   
+   /** The requirements. */
+   private List<ProfileRequirement> requirements = new ArrayList<ProfileRequirement>();
+   
+   public AbstractProfileDependencyContext(ProfileKey key, ProfileMetaData metaData, ProfilesRequirementResolver resolver)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      if(metaData == null)
+         throw new IllegalArgumentException("null meta data");
+      this.key = key;
+      this.profileMetaData = metaData;
+      this.resolver = resolver;
+      // Visit the profile meta data
+      visit(profileMetaData);
+   }
+   
+   public ProfileKey getKey()
+   {
+      return key;
+   }
+   
+   public ProfileMetaData getProfileMetaData()
+   {
+      return profileMetaData;
+   }
+   
+   public ProfilesRequirementResolver getResolver()
+   {
+      return resolver;
+   }
+   
+   public void addCapability(ProfileCapability capability)
+   {
+      this.capabilites.add(capability);
+   }
+
+   public void addRequirement(ProfileRequirement requirement)
+   {
+      this.requirements.add(requirement);
+   }
+
+   public Collection<ProfileCapability> getCapabilities()
+   {
+      return this.capabilites;
+   }
+
+   public Collection<ProfileRequirement> getRequirements()
+   {
+      return this.requirements;
+   }
+
+   public void visit(ProfileMetaDataVisitorNode node)
+   {
+      node.visit(this);
+   }
+
+   public ProfileKey resolve(ProfileRequirement requirement)
+   {
+      return getResolver().resolve(this, requirement); 
+   }
+
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName()).append('@');
+      buffer.append(Integer.toHexString(System.identityHashCode(this)));
+      buffer.append('{');
+      toString(buffer);
+      buffer.append('}');
+      return buffer.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append("key=").append(getKey());
+   }
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileDependencyContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.dependency;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * A abstract profile lifecycle action.
+ * TODO use jboss-reflect for this.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileLifeCycleAction extends AbstractProfileAction
+{
+   private static final Class<?>[] parameterTypes = new Class[0];
+   private static final Object[] args = new Object[0];
+     
+   protected abstract String getInstallMethod();
+   protected abstract String getUninstallMethod();
+
+   @Override
+   public void install(Profile profile) throws Exception
+   {
+      invoke(profile, getInstallMethod());
+   }
+
+   @Override
+   public void uninstall(Profile profile)
+   {
+      try
+      {
+         invoke(profile, getUninstallMethod());
+      }
+      catch(Exception e)
+      {
+         log.warn("Error invoking uninstall method '" + getUninstallMethod()
+               + "' on profile: " + profile.getKey());
+      }
+   }
+
+   protected static void invoke(Profile profile, String method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
+   {
+      Method m = null;
+      try
+      {
+         m = profile.getClass().getMethod(method, parameterTypes);
+      }
+      catch(NoSuchMethodException ignore)
+      {
+         return;
+      }
+      invoke(profile, m);
+   }
+
+   private static void invoke(Profile profile, final Method method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if (sm == null)
+         method.setAccessible(true);
+      else
+      {
+         AccessController.doPrivileged(new PrivilegedAction<Object>()
+         {
+            public Object run()
+            {
+               method.setAccessible(true);
+               return null;
+            }
+         });
+      }
+      // invoke
+      method.invoke(profile, args);
+   }
+   
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/AbstractProfileLifeCycleAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+
+/**
+ * The default profile controller context factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultProfileContextFactory extends AbstractProfileContextFactory
+{
+   
+   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
+   {
+      ProfileDependencyContext ctx = createDependencyContext(key, metaData);
+      return new ProfileControllerContext(ctx, defaultActions, profile);
+   }
+   
+   protected ProfileDependencyContext createDependencyContext(ProfileKey key, ProfileMetaData metaData)
+   {
+      return new AbstractProfileDependencyContext(key, metaData, getRequirementResolver());
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DefaultProfileContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The delegating profile context factory. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DelegatingProfileContextFactory extends AbstractProfileContextFactory
+{
+
+   /** The factories. */
+   private Map<String, AbstractProfileContextFactory> factories = new ConcurrentHashMap<String, AbstractProfileContextFactory>();
+ 
+   private DefaultProfileContextFactory defaultFactory;
+   
+   public void setDefaultContextFactory(DefaultProfileContextFactory defaultFactory)
+   {
+      this.defaultFactory = defaultFactory;
+   }
+   
+   public DefaultProfileContextFactory getDefaultContextFactory()
+   {
+      return defaultFactory;
+   }
+   
+   public void create()
+   {
+      if(getDefaultContextFactory() == null)
+         throw new IllegalStateException("null default ctx factory");
+   }
+   
+   @Override
+   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("null profile key");
+      if(metaData == null)
+         throw new IllegalArgumentException("null profile meta data");
+      
+      String factoryType = metaData.getClass().getName();
+      AbstractProfileContextFactory factory = factories.get(factoryType);
+      if(factory == null)
+         factory = getDefaultContextFactory();
+      
+      ProfileControllerContext ctx = factory.createProfileContext(key, metaData, profile);
+      if(ctx == null)
+         throw new IllegalStateException("created null ctx");
+      // add dependency context
+      getRequirementResolver().addDependencyContext(ctx.getDependencyContext());
+      return ctx;
+   }
+   
+   public void addProfileContextFactory(AbstractProfileContextFactory factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("null profile ctx factory");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("null profile ctx factory types");
+      for(String type : factory.getTypes())
+         this.factories.put(type, factory);
+   }
+
+   public void removeProfileContextFactory(AbstractProfileContextFactory factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("null profile ctx factory");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("null profile ctx factory types");
+      for(String type : factory.getTypes())
+         this.factories.remove(type);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/DelegatingProfileContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import java.util.Collection;
+
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.spi.ControllerContextActions;
+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.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The profile controller context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileControllerContext extends AbstractControllerContext
+{
+   
+   /** The profile assembly context. */
+   private ProfileDependencyContext ctx;
+   
+   protected static ProfileKey getKey(ProfileDependencyContext ctx)
+   {
+      if(ctx == null)
+         throw new IllegalArgumentException("null ctx");
+      if(ctx.getKey() == null)
+         throw new IllegalArgumentException("null profile key");
+      
+      return ctx.getKey();
+   }
+   
+   public ProfileControllerContext(ProfileDependencyContext ctx, ControllerContextActions actions)
+   {
+      this(ctx, actions, null);
+   }
+   
+   public ProfileControllerContext(ProfileDependencyContext ctx, ControllerContextActions actions, Profile profile)
+   {
+      super(getKey(ctx), actions);
+      if(ctx == null)
+         throw new IllegalArgumentException("null profile meta data");
+      
+      this.ctx = ctx;
+      if(profile != null)
+         setTarget(profile);
+      //
+      processMetaData();
+      setMode(ControllerMode.ON_DEMAND);
+   }
+   
+   public ProfileMetaData getProfileMetaData()
+   {
+      return getDependencyContext().getProfileMetaData();
+   }
+   
+   public ProfileDependencyContext getDependencyContext()
+   {
+      return ctx;
+   }
+   
+   public ProfileKey getProfileKey()
+   {
+      return (ProfileKey) this.getName();
+   }
+   
+   public Profile getProfile()
+   {
+      return getTarget();
+   }
+   
+   @Override
+   public Profile getTarget()
+   {
+      return (Profile) super.getTarget();
+   }
+   
+   public ProfileKey resolve(ProfileRequirementDependencyItem dependencyItem)
+   {
+      ProfileRequirement requirement = dependencyItem.getRequirement();
+      return getDependencyContext().resolve(requirement);
+   }
+
+   protected void processMetaData()
+   {
+      Collection<ProfileRequirement> requirements = getDependencyContext().getRequirements();
+      if(requirements != null && requirements.isEmpty() == false)
+      {
+         for(ProfileRequirement requirement : requirements)
+         {
+            getDependencyInfo().addIDependOn(
+                  new ProfileRequirementDependencyItem(this,
+                        requirement, ControllerState.DESCRIBED));
+         }
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileControllerContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+
+/**
+ * Basic profile create/destroy action.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileCreateAction extends AbstractProfileLifeCycleAction
+{
+   /** The instance. */
+   private static final ProfileCreateAction INSTANCE = new ProfileCreateAction();
+ 
+   public static ProfileCreateAction getInstance()
+   {
+      return INSTANCE;
+   }
+
+   @Override
+   protected String getInstallMethod()
+   {
+      return "create";
+   }
+   
+   @Override
+   protected String getUninstallMethod()
+   {
+      return "destroy";
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileCreateAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.dependency;
+
+import java.util.Collection;
+
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * deploy/undeploy action. This deploys/undeploys the profile deployments
+ * based on the lifecycle of the profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDeployAction implements ControllerContextAction
+{
+   
+   /** The instance. */
+   protected static final ProfileDeployAction instance = new ProfileDeployAction();
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(ProfileDeployAction.class); 
+   
+   public static ProfileDeployAction getInstance()
+   {
+      return instance;
+   }
+   
+   @Override
+   public void install(ControllerContext context) throws Exception
+   {
+      if(context instanceof ProfileControllerContext == false) return;
+      ProfileControllerContext ctx = (ProfileControllerContext) context;
+      
+      Profile profile = ctx.getProfile();
+      if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
+      {
+         ProfileDeployerPlugin deployer = ((ProfileServiceController)ctx.getController()).getDeployer(ctx.getProfileMetaData());
+         if(profile == null)
+            throw new NoSuchProfileException("null profile " + ctx.getProfileKey());
+         if(deployer == null)
+            throw new IllegalStateException("null deployer");
+            
+         // Deploy
+         deploy(profile, deployer);         
+      }
+   }
+
+   @Override
+   public void uninstall(ControllerContext context)
+   {
+      if(context instanceof ProfileControllerContext == false) return;
+      ProfileControllerContext ctx = (ProfileControllerContext) context;
+      
+      Profile profile = ctx.getProfile();
+      if(profile.getDeployments() != null & profile.getDeployments().isEmpty() == false)
+      {
+         ProfileDeployerPlugin deployer = ((ProfileServiceController)ctx.getController()).getDeployer(ctx.getProfileMetaData());
+         if(profile == null || deployer == null)
+            return;
+         
+         // Undeploy
+         undeployer(profile, deployer);
+      }
+   }
+   
+   protected void deploy(Profile profile, ProfileDeployerPlugin deployer) throws Exception
+   {
+      Collection<? extends ProfileDeployment> deployments = profile.getDeployments();
+      if (deployments != null && !deployments.isEmpty())
+      {
+         // Add deployments
+         for (ProfileDeployment deployment : profile.getDeployments())
+         {
+            try
+            {
+               // Add deployment
+               deployer.addDeployment(deployment);
+            }
+            catch(Exception e)
+            {
+               log.error("Failed to add deployment: " + deployment, e);
+            }
+         }
+
+         // deploy
+         deployer.process();
+      }
+   }
+   
+   protected void undeployer(Profile profile, ProfileDeployerPlugin deployer)
+   {
+      Collection<? extends ProfileDeployment> deployments = profile.getDeployments();
+      if (deployments != null && !deployments.isEmpty())
+      {
+         // remove deployments
+         for (ProfileDeployment deployment : profile.getDeployments())
+         {
+            try
+            {
+               // remove deployment
+               deployer.removeDeployment(deployment);
+            }
+            catch(Throwable t)
+            {
+               log.warn("failed to remove deployment: " + deployment, t);
+            }
+         }
+
+         // undeploy
+         deployer.process();
+      }      
+   }
+   
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileDeployAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileInstallAction extends AbstractProfileAction
+{
+
+   /** The instance. */
+   private static final ProfileInstallAction instance = new ProfileInstallAction();
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(ProfileInstallAction.class);
+   
+   public static ProfileInstallAction getInstance()
+   {
+      return instance;
+   }
+   
+   @Override
+   public void install(Profile profile) throws Exception
+   {
+      log.debug("installing profile " + profile);
+      
+   }
+   
+   @Override
+   public void uninstall(Profile profile)
+   {
+      if(log.isTraceEnabled())
+         log.trace("uninstalling profile " + profile);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstallAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileInstantiateAction implements ControllerContextAction
+{
+
+   /** The instance. */
+   protected final static ProfileInstantiateAction instace = new ProfileInstantiateAction();
+   
+   public static ProfileInstantiateAction getInstace()
+   {
+      return instace;
+   }
+   
+   @Override
+   public void install(ControllerContext context) throws Throwable
+   {
+      if(context instanceof ProfileControllerContext == false) return;
+      ProfileControllerContext ctx = (ProfileControllerContext) context;
+      
+      if(ctx.getTarget() != null && ctx.getTarget() instanceof Profile)
+         return;
+      
+      ProfileServiceController controller = (ProfileServiceController) ctx.getController();
+      Profile profile = controller.createProfile(ctx.getProfileKey(), ctx.getProfileMetaData());
+      if(profile == null)
+         throw new IllegalStateException("created null profile");
+      
+      ctx.setTarget(profile);
+   }
+   
+   @Override
+   public void uninstall(ControllerContext context)
+   {
+      //
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileInstantiateAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * The Profile requirement dependency item.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileRequirementDependencyItem extends AbstractDependencyItem
+{
+
+   /** The profile controller context. */
+   private ProfileControllerContext context;
+   
+   /** The profile requirement to resolve. */
+   private ProfileRequirement requirement;
+   
+   /** The on demand ctx. */
+   private ProfileKey resolvedCtx;
+   
+   public ProfileRequirementDependencyItem(ProfileControllerContext context, ProfileRequirement requirement, ControllerState state)
+   {
+      super(context != null ? context.getName() : null, null, state, ControllerState.INSTALLED);
+      if(context == null)
+         throw new IllegalArgumentException("null context");
+      if(requirement == null)
+         throw new IllegalArgumentException("null requirement");
+      this.context = context;
+      this.requirement = requirement;
+   }
+
+   public ProfileRequirement getRequirement()
+   {
+      return requirement;
+   }
+   
+   @Override
+   public boolean resolve(Controller controller)
+   {
+      ProfileKey iDependOn = resolvedCtx;
+      if(iDependOn == null)
+      {
+         // Cache the result, as we only do setIDependOn
+         // when the dependent context is installed (fully deployed)
+         iDependOn = context.resolve(this);
+      }
+      if(iDependOn != null)
+      {
+         // Resolve dependencies on ourself
+         if(getName().equals(iDependOn))
+         {
+            setResolved(true);
+         }
+         else
+         {
+            ControllerContext context = controller.getContext(iDependOn, getDependentState());
+            if(context != null)
+            {
+               setIDependOn(iDependOn);
+               addDependsOnMe(controller, context);
+               setResolved(true);  
+            }
+            else
+            {
+               context = controller.getContext(iDependOn, null);
+               if(context != null && ControllerMode.ON_DEMAND.equals(context.getMode()))
+               {
+                  try
+                  {
+                     // Cache the ctx, so that we don't need to resolve it again
+                     resolvedCtx = iDependOn;
+                     controller.enableOnDemand(context);
+                  }
+                  catch(Throwable ignored)
+                  {
+                     if(log.isTraceEnabled())
+                        log.trace("Unexpected error", ignored);
+                  }
+               }
+               else
+               {
+                  setResolved(false);
+               }
+            }            
+         }
+      }
+      else
+      {
+         // Resolve optional requirements
+         if(getRequirement().isOptional())
+            setResolved(true);
+      }
+      return isResolved();
+   }
+   
+   @Override
+   public boolean unresolved(Controller controller)
+   {
+      setIDependOn(null);
+      setResolved(false);
+      resolvedCtx = null;
+      return true;
+   }
+ 
+   @Override
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      super.toShortString(buffer);
+      buffer.append(", requirement=").append(getRequirement());
+   }
+   
+   @Override
+   protected void toHumanReadableString(StringBuilder builder)
+   {
+      super.toHumanReadableString(builder);
+      builder.append(", requirement=").append(getRequirement());
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileRequirementDependencyItem.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.plugins.ScopedController;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.ProfileDeployerPluginRegistry;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * A scoped controller for the profile controller context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileServiceController extends ScopedController
+{
+   
+   /** The deploy state. */
+   public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy"); 
+   
+   /** The profile factory. */
+   private ProfileFactory<ProfileMetaData, Profile> factory;
+   
+   /** The deployers registry. */
+   private ProfileDeployerPluginRegistry registry;
+   
+   public ProfileServiceController(AbstractController parentController)
+   {
+      setScopeKey(new ScopeKey(CommonLevels.SUBSYSTEM, "Profile"));
+      setParentController(parentController);
+      setUnderlyingController(this);
+      getParentController().addController(this);
+      addState(DEPLOY_STATE, ControllerState.INSTALLED);
+   }
+   
+   public void setFactory(ProfileFactory<ProfileMetaData, Profile> factory)
+   {
+      this.factory = factory;
+   }
+   
+   public Profile createProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
+   {
+      return this.factory.createProfile(key, metaData);
+   }
+   
+   public void setDeployerRegistry(ProfileDeployerPluginRegistry registry)
+   {
+      this.registry = registry;
+   }
+
+   public ProfileDeployerPlugin getDeployer(ProfileMetaData metaData)
+   {
+      return registry.getDeployer(metaData);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileServiceController.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+/**
+ * Basic profile start/stop action.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileStartAction extends AbstractProfileLifeCycleAction
+{
+
+   /** The instance. */
+   private static final AbstractProfileLifeCycleAction INSTANCE = new ProfileStartAction();
+   
+   public static AbstractProfileLifeCycleAction getInstance()
+   {
+      return INSTANCE;
+   }
+
+   @Override
+   protected String getInstallMethod()
+   {
+      return "start";
+   }
+
+   @Override
+   protected String getUninstallMethod()
+   {
+      return "stop";
+   }
+
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfileStartAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.dependency;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+
+/**
+ * A ordered structure of ProfileContexts used for resolving dependencies.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfilesRequirementResolver
+{
+   
+   /** The dependency contexts. */
+   private List<ProfileDependencyContext> contexts = new CopyOnWriteArrayList<ProfileDependencyContext>();
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(ProfilesRequirementResolver.class);
+   
+   public void addDependencyContext(ProfileDependencyContext ctx)
+   {
+      if(ctx == null)
+         throw new IllegalArgumentException("null dependency context");
+      this.contexts.add(ctx);
+   }
+   
+   public void removeDependencyContext(ProfileDependencyContext ctx)
+   {
+      if(ctx == null)
+         throw new IllegalArgumentException("null dependency context");
+      this.contexts.remove(ctx);
+   }
+   
+   public ProfileKey resolve(ProfileDependencyContext ctx, ProfileRequirement requirement)
+   {
+      // Resolve the requirements based on the exposed capabilities
+      boolean trace = log.isTraceEnabled();
+      for(ProfileDependencyContext child : contexts)
+      {
+         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() + " matched " + requirement + " with capability " + capability);
+                  return child.getKey();
+               }
+            }
+         }
+      }
+      
+      // Unresolved
+      return null;
+   }
+
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName()).append('@');
+      buffer.append(Integer.toHexString(System.identityHashCode(this)));
+      buffer.append('{');
+      toString(buffer);
+      buffer.append('}');
+      return buffer.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", contexts=").append(this.contexts);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/dependency/ProfilesRequirementResolver.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ImplicitProfileRequirement.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ImplicitProfileRequirement.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ImplicitProfileRequirement.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.metadata;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractSubProfileKeyMetaData;
+
+/**
+ * A implicit profile requirement, used by the parsing layer to set a
+ * dependency on a previous profile. This requirement is optional.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImplicitProfileRequirement extends AbstractSubProfileKeyMetaData 
+{
+
+   public ImplicitProfileRequirement()
+   {
+      super();
+   }
+   
+   public ImplicitProfileRequirement(String name)
+   {
+      super(name);
+   }
+   
+   public ImplicitProfileRequirement(String domain, String server, String name)
+   {
+      super(domain, server, name);
+   }
+   
+   public ImplicitProfileRequirement(ProfileKeyMetaData metaData)
+   {
+      super(metaData.getDomain(), metaData.getServer(), metaData.getName());
+   }
+   
+   public ImplicitProfileRequirement(ProfileKey key)
+   {
+      super(key);
+   }
+   
+   @Override
+   public boolean isOptional()
+   {
+      return true;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ImplicitProfileRequirement.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.metadata;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.profileservice.profile.metadata.ProfilesMetaData;
+import org.jboss.profileservice.profile.metadata.RootProfileMetaData;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfilesMetaDataFactory
+{
+
+   /** The schema binding resolver. */
+   private static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+   
+   /** The profiles. */
+   private ThreadLocal<List<ProfileMetaData>> profiles = new ThreadLocal<List<ProfileMetaData>>();
+   
+   static
+   {
+      setClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
+      setClassBinding("urn:jboss:profileservice:root:profile:1.0", RootProfileMetaData.class);
+   }
+   
+   public static void setClassBinding(String nsUri, Class<?> clazz)
+   {
+      resolver.addClassBinding(nsUri, clazz);
+   }
+   
+   public List<ProfileMetaData> parse(URL rootURL) throws Exception
+   {
+      return parse(ProfileKey.DEFAULT_PROFILE_KEY, rootURL);
+   }
+   
+   public List<ProfileMetaData> parse(ProfileKey key, URL rootURL) throws Exception
+   {
+      this.profiles.set(new ArrayList<ProfileMetaData>());
+      try
+      {
+         RootProfileMetaData root = unmarshal(rootURL.openStream(), RootProfileMetaData.class);
+         //
+         if(root.getRootProfiles() != null && root.getRootProfiles().isEmpty() == false)
+         {
+            for(String profile : root.getRootProfiles())
+            {
+               URL url = new URL(profile);
+               processProfiles(url);
+            }  
+         }
+         //
+         if(root.getProfiles() != null && root.getProfiles().isEmpty() == false)
+         {
+            for(ProfileMetaData metaData : root.getProfiles())
+            {
+               processProfileMetaData(metaData);
+            }  
+         }
+         
+         // Register the root profile
+         addProfile(root.createRootProfile());
+         
+         return getProfiles();
+      }
+      finally
+      {
+         this.profiles.set(null);
+      }         
+   }
+   
+   protected List<ProfileMetaData> getProfiles()
+   {
+      return this.profiles.get();
+   }
+   
+   protected void processProfilesMetaData(ProfilesMetaData metaData) throws Exception
+   {
+      if(metaData.getProfiles() != null && metaData.getProfiles().isEmpty() == false)
+      {
+         for(ProfileMetaData md : metaData.getProfiles())
+         {
+            processProfileMetaData(md);
+         }
+      }
+   }
+   
+   protected void processProfileMetaData(ProfileMetaData metaData) throws Exception
+   {
+      addProfile(metaData);
+   }
+   
+   protected void addProfile(ProfileMetaData metaData) throws Exception
+   {
+      getProfiles().add(metaData);      
+   }
+   
+   protected void processProfiles(URL url) throws Exception
+   {
+      InputStream is = url.openStream();
+      if(is == null)
+         throw new IllegalStateException("Could not open stream " + url);
+      processProfilesMetaData(unmarshal(is, ProfilesMetaData.class));
+   }
+   
+   protected <T> T unmarshal(InputStream is, Class<T> clazz) throws JBossXBException
+   {
+      Unmarshaller un = UnmarshallerFactory.newInstance().newUnmarshaller();
+      return clazz.cast(un.unmarshal(is, resolver));      
+   }
+ 
+   protected ProfileKey createProfileKey(ProfileKeyMetaData metaData)
+   {
+      return ProfileKey.createProfileKey(metaData);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/ProfilesMetaDataFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.metadata;
+
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * A meta data factory, which automatically registers profiles.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RegisteringProfileMetaDataFactory extends ProfilesMetaDataFactory
+{
+
+   /** The profile service. */
+   private final ProfileService ps;
+   
+   public RegisteringProfileMetaDataFactory(ProfileService ps)
+   {
+      this.ps = ps;
+   }
+   
+   public void addClassBinding(String nsUri, Class<?> clazz)
+   {
+      setClassBinding(nsUri, clazz);
+   }
+   
+   @Override
+   protected void addProfile(ProfileMetaData metaData) throws Exception
+   {
+      // Register
+      this.ps.registerProfile(metaData);
+      super.addProfile(metaData);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/metadata/RegisteringProfileMetaDataFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,138 @@
+/*
+ * 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;
+
+import java.net.URI;
+import java.util.List;
+
+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.VirtualFile;
+
+/**
+ * A immutable vfs based profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractImmutableProfile extends AbstractVFSProfileSource implements Profile
+{
+
+   /** The profile key. */
+   private ProfileKey key;
+  
+   public AbstractImmutableProfile(ProfileKey key, URI[] uris)
+   {
+      super(uris);
+      //
+      if(key == null)
+         throw new IllegalArgumentException("Null profile key.");
+      
+      this.key = key;
+   }
+   
+   public void create() throws Exception
+   {
+      for(URI uri : getRepositoryURIs())
+      {
+         VirtualFile root = getCachedVirtualFile(uri);
+         loadApplications(root);
+      }
+      updateLastModfied();
+   }
+   
+   public ProfileKey getKey()
+   {
+      return this.key;
+   }
+   
+   @Override
+   public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null name");
+      
+      ProfileDeployment ctx = super.getDeployment(vfsPath);
+      if(ctx == null)
+      {
+         List<String> names = findDeploymentContent(vfsPath);
+         if(names.size() == 1)
+         {
+            ctx = super.getDeployment(names.get(0));
+         }
+         else if(names.size() > 1)
+         {
+            throw new NoSuchDeploymentException("Multiple deployments found for: "+ vfsPath +", available: " + names);            
+         }
+      }
+      if(ctx == null)
+      {
+         log.debug("Failed to find application for: "+vfsPath+", available: " + getDeploymentNames());
+         throw new NoSuchDeploymentException("Failed to find deployment in file: " + vfsPath);
+      }
+      return ctx;
+   }
+
+   public boolean hasDeployment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+
+      try
+      {
+         return super.getDeployment(name) != null;
+      }
+      catch(Exception e)
+      {
+         return false;
+      }
+   }
+
+   public boolean isMutable()
+   {
+      return false;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{key = ").append(getKey());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractImmutableProfile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,377 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * A abstract VFS based source for profile deployments.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractVFSProfileSource
+{
+   
+   /** The repository uris. */
+   protected final Collection<URI> uris;
+
+   /** The VFSDeployments. */
+   private Map<String, ProfileDeployment> applicationCtxs = new ConcurrentHashMap<String, ProfileDeployment>();
+   
+   /** Allowed deployments filter. */
+   private VirtualFileFilter deploymentFilter;
+   
+   /** The application files keyed by VirtualFile URI string. */
+   private final Map<String, VirtualFile> applicationVFCache = new ConcurrentHashMap<String, VirtualFile>();
+   
+   /** Do a recursive search - default == true. */
+   private boolean recursiveScan = true;
+
+   /** The last time the profile was modified. */
+   private volatile long lastModified;
+   
+   /** The logger. */
+   protected final Logger log = Logger.getLogger(getClass());
+   
+   public AbstractVFSProfileSource(URI[] uris)
+   {
+      if(uris == null)
+         throw new IllegalArgumentException("Null uris");
+      
+      this.uris = new ArrayList<URI>();
+      for(URI uri : uris)
+      {
+         this.uris.add(uri);
+      }
+   }
+
+   public VirtualFileFilter getDeploymentFilter()
+   {
+      return deploymentFilter;
+   }
+   
+   public void setDeploymentFilter(VirtualFileFilter deploymentFilter)
+   {
+      this.deploymentFilter = deploymentFilter;
+   }
+   
+   public boolean isRecursiveScan()
+   {
+      return recursiveScan;
+   }
+   
+   public void setRecursiveScan(boolean recursiveScan)
+   {
+      this.recursiveScan = recursiveScan;
+   }
+   
+   public URI[] getRepositoryURIs()
+   {
+      return uris.toArray(new URI[uris.size()]);
+   }
+   
+   public Set<String> getDeploymentNames()
+   {
+      return this.applicationCtxs.keySet();
+   }
+
+   public Collection<ProfileDeployment> getDeployments()
+   {
+      return this.applicationCtxs.values();
+   }
+   
+   public long getLastModified()
+   {
+      return this.lastModified;
+   }
+   
+   public void destroy()
+   {
+      // Unload
+      this.applicationCtxs.clear();
+      this.applicationVFCache.clear();
+      updateLastModfied();
+   }
+   
+   /**
+    * Add a deployment to this profile source. 
+    * 
+    * @param d the deployment
+    * @throws IllegalArgumentException for a null deployment
+    */
+   protected void addDeployment(ProfileDeployment d)
+   {
+      if(d == null)
+         throw new IllegalArgumentException("null deployment");
+      
+      // Add deployment and vfs
+      this.applicationCtxs.put(d.getName(), d);
+      if(d.getRoot() != null)
+         this.applicationVFCache.put(d.getName(), d.getRoot());
+      updateLastModfied();
+   }
+   
+   /**
+    * Get the deployment
+    * 
+    * @param vfsPath the deployment
+    * @return the deployment or null if it does not exist
+    */
+   protected ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null vfsPath");
+
+      return this.applicationCtxs.get(vfsPath);
+   }
+   
+   /**
+    * Remove a deployment from this source.
+    * 
+    * @param vfsPath the deployment name
+    * @return the deployment
+    * @throws NoSuchProfileException if the deployment does not exist
+    */
+   public ProfileDeployment removeDeployment(String vfsPath) throws Exception
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null vfsPath");
+      
+      // Get the deployment
+      ProfileDeployment deployment = getDeployment(vfsPath);
+      // Remove the entries
+      this.applicationCtxs.remove(deployment.getName());
+      this.applicationVFCache.remove(deployment.getName());
+      // Update last modified
+      updateLastModfied();
+      // Return
+      return deployment;
+   }
+   
+   /**
+    * Load all the applications under the applicationDir.
+    * 
+    * @param applicationDir the application directory
+    * @throws IOException
+    */
+   protected void loadApplications(VirtualFile applicationDir) throws Exception
+   {
+      ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+      addedDeployment(added, applicationDir);
+      for (VirtualFile vf : added)
+      {
+         ProfileDeployment vfCtx = createDeployment(vf);
+         addDeployment(vfCtx);
+      }
+   }
+   
+   /**
+    * Scan the children of the root for deployments.
+    * 
+    * @param list a list of virtual files, where new deployments are added to
+    * @param root the root to scan
+    * @throws IOException
+    * @throws URISyntaxException
+    */
+   protected void addedDeployments(List<VirtualFile> list, VirtualFile root) throws IOException, URISyntaxException
+   {
+      if(root.isLeaf() == true || root.isArchive() == true)
+      {
+         addedDeployment(list, root);
+      }
+      else
+      {
+         List<VirtualFile> components = root.getChildren();
+         for (VirtualFile component : components)
+         {
+            addedDeployment(list, component);
+         }         
+      }
+   }
+   
+   /**
+    * Scan a given virtualFile for deployments.
+    * 
+    * @param list a list of virtual files, where new deployments are added to
+    * @param component the root file
+    * @throws IOException
+    * @throws URISyntaxException
+    */
+   protected void addedDeployment(List<VirtualFile> list, VirtualFile component) throws IOException, URISyntaxException
+   {
+      // Excluding files from scanning
+      if(deploymentFilter != null && this.deploymentFilter.accepts(component) == false)
+      {
+         if(log.isTraceEnabled())
+            log.trace("ignoring "+ component);
+         return;
+      }
+      
+      // Check if we accept this deployment
+      String key = component.toURI().toString();
+      if(acceptsDeployment(key) == false)
+         return;
+
+      // If it's a directory or exploded deployment
+      if(component.isLeaf() == false && component.isArchive() == false)
+      {
+         // Check the name
+         if(isRecursiveScan() && component.getName().indexOf('.') == -1)
+         {
+            // recurse if not '.' in name and recursive search is enabled
+            addedDeployments(list, component);            
+         }
+         else
+         {
+            list.add(component);
+         }
+      }
+      else
+      {
+         list.add(component);
+      }
+   }
+   
+   /**
+    * Check if the deployment should be added.
+    * 
+    * @param name the deployment name
+    * @return  
+    */
+   protected boolean acceptsDeployment(String name)
+   {
+      return applicationCtxs.containsKey(name) == false;
+   }
+   
+   /**
+    * Try to find a deployment, based on the cached
+    * virtual roots of deployments we have.
+    * 
+    * @param name the deployment name
+    * @return a collection of matching names
+    */
+   protected List<String> findDeploymentContent(String name)
+   {
+      if(this.applicationVFCache.containsKey(name))
+      {
+         return Collections.singletonList(name);
+      }
+      
+      List<String> contents = new ArrayList<String>();
+      for(String cacheName : this.applicationVFCache.keySet())
+      {
+         String fixedName = cacheName;
+         if(cacheName.endsWith("/"))
+            fixedName = cacheName.substring(0, cacheName.length() -1);
+         
+         if(fixedName.endsWith(name))
+         {
+            contents.add(cacheName);
+         }
+      }
+      return contents;
+   }
+   
+   /**
+    * Add a virtualFile to the local virtualFileCache
+    * 
+    * @param vf the virtual file
+    * @return the name
+    * @throws MalformedURLException
+    * @throws URISyntaxException
+    */
+   protected String addVirtualFileCache(VirtualFile vf) throws MalformedURLException, URISyntaxException
+   {
+      String uri = vf.toURI().toString();
+      this.applicationVFCache.put(uri, vf);
+      return uri;
+   }
+
+   /**
+    * Get a cached virtual file.
+    * 
+    * @param name the name
+    * @return the virtual file or null, if it does not exist
+    */
+   protected VirtualFile getCachedVirtualFile(String name)
+   {
+      return this.applicationVFCache.get(name);
+   }
+   
+   /**
+    * Get a cached virtual file. This will add the uri to the
+    * virtualFile if it does not exist.
+    * 
+    * @param uri the uri
+    * @return the virtual file
+    * @throws IOException
+    */
+   protected VirtualFile getCachedVirtualFile(URI uri) throws IOException 
+   {
+      VirtualFile vf = getCachedVirtualFile(uri.toString());
+      if(vf == null)
+      {
+         vf = VFS.getRoot(uri);
+         this.applicationVFCache.put(uri.toString(), vf);
+      }
+      return vf;
+   }
+   
+   /**
+    * Create a ProfileDeployment, based on the virtual file.
+    * 
+    * @param vf the deployment root
+    * @return the profile deployment
+    * @throws Exception
+    */
+   protected static ProfileDeployment createDeployment(VirtualFile vf) throws Exception
+   {
+      return new ProfileVFSDeployment(vf);
+   }
+   
+   /**
+    * Internally update the lastModified timestamp.
+    */
+   protected void updateLastModfied()
+   {
+      this.lastModified = System.currentTimeMillis();
+   }
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/DelegateProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/DelegateProfile.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/DelegateProfile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,172 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * A basic profile implementation, which delegates all the deployment
+ * actions a DeploymentRepository.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DelegateProfile implements MutableProfile
+{
+
+   /** The profile key */
+   final private ProfileKey key;
+   
+   /** The repository containing the deployment contents */
+   final private DeploymentRepository repository;
+   
+   /** Is hot deployment checking enabled */
+   private volatile boolean hotdeployEnabled = false;
+
+   public DelegateProfile(DeploymentRepository repository, ProfileKey key)
+   {
+      if(key == null)
+         throw new IllegalArgumentException("Null profile key.");
+      if(repository == null)
+         throw new IllegalArgumentException("Null deployment repository.");
+            
+      this.key = key;
+      this.repository = repository;
+   }
+
+   public void addDeployment(ProfileDeployment d) throws Exception
+   {
+      if(d == null)
+         throw new IllegalArgumentException("Null deployment");
+      this.repository.addDeployment(d.getName(), d);
+   }
+
+   public void enableModifiedDeploymentChecks(boolean flag)
+   {
+      this.hotdeployEnabled = flag;
+   }
+   
+   public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+      return this.repository.getDeployment(name);
+   }
+
+   public Set<String> getDeploymentNames()
+   {
+      return this.repository.getDeploymentNames();
+   }
+
+   public Collection<ProfileDeployment> getDeployments()
+   {
+      return this.repository.getDeployments();
+   }
+
+   public ProfileKey getKey()
+   {
+      return this.key;
+   }
+
+   public long getLastModified()
+   {
+      return this.repository.getLastModified();
+   }
+
+   public Collection<ModificationInfo> getModifiedDeployments() throws Exception
+   {
+      if(this.hotdeployEnabled == false)
+         return Collections.emptySet();
+      return this.repository.getModifiedDeployments();
+   }
+
+   public boolean hasDeployment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+
+      try
+      {
+         return this.repository.getDeployment(name) != null;
+      }
+      catch(Exception e)
+      {
+         return false;
+      }
+   }
+
+   public ProfileDeployment removeDeployment(String name) throws Exception
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+      return this.repository.removeDeployment(name);
+   }
+   
+   public void create() throws Exception
+   {
+      if(this.repository == null)
+         throw new IllegalStateException("Null deployment repository.");
+      // Load
+      this.repository.load();
+   }
+   
+   public void destroy()
+   {
+      this.repository.unload();
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{key = ").append(getKey());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+
+   public boolean isMutable()
+   {
+      return true;
+   }
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/DelegateProfile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,152 @@
+/*
+ * 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;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+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.VirtualFile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class FilteredProfile extends AbstractVFSProfileSource implements Profile
+{
+
+   /** The profile key. */
+   private ProfileKey key;
+   
+   /** The deployments names. */
+   private final Collection<String> deploymentNames;
+   
+   public FilteredProfile(ProfileKey key, Collection<String> deploymentNames, URI[] uris)
+   {
+      super(uris);
+      this.key = key;
+      this.deploymentNames = deploymentNames;
+   }
+
+   public void create() throws Exception
+   {
+      for(String deploymentName : deploymentNames)
+      {
+         VirtualFile deployment = null; 
+         for(URI uri : getRepositoryURIs())
+         {
+            VirtualFile root = getCachedVirtualFile(uri);
+            deployment = root.getChild(deploymentName);
+            if(deployment != null)
+               break;
+         }
+         if(deployment == null)
+            throw new IllegalStateException("could not find deployment " + deploymentName + " in "
+                  + Arrays.asList(getRepositoryURIs()));
+         
+         ProfileDeployment d = createDeployment(deployment);
+         super.addDeployment(d);
+      }
+   }
+   
+   @Override
+   public ProfileKey getKey()
+   {
+      return this.key;
+   }
+   
+   @Override
+   public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null name");
+      
+      ProfileDeployment ctx = super.getDeployment(vfsPath);
+      if(ctx == null)
+      {
+         List<String> names = findDeploymentContent(vfsPath);
+         if(names.size() == 1)
+         {
+            ctx = super.getDeployment(names.get(0));
+         }
+         else if(names.size() > 1)
+         {
+            throw new NoSuchDeploymentException("Multiple deployments found for: "+ vfsPath +", available: " + names);            
+         }
+      }
+      if(ctx == null)
+      {
+         log.debug("Failed to find application for: "+vfsPath+", available: " + getDeploymentNames());
+         throw new NoSuchDeploymentException("Failed to find deployment in file: " + vfsPath);
+      }
+      return ctx;
+   }
+
+   public boolean hasDeployment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name.");
+
+      try
+      {
+         return super.getDeployment(name) != null;
+      }
+      catch(Exception e)
+      {
+         return false;
+      }
+   }
+
+   @Override
+   public boolean isMutable()
+   {
+      return false;
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{key = ").append(getKey());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", deployments=").append(getDeploymentNames());
+   }
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/FilteredProfile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/NoopProfile.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/NoopProfile.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/NoopProfile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,108 @@
+/*
+ * 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;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * A empty profile, which does not contain any deployments. This profile
+ * basically just has a key and dependencies on other profiles.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NoopProfile implements Profile
+{
+   
+   private final ProfileKey key;
+   private final long lastModified;
+   
+   public NoopProfile(ProfileKey key)
+   {
+      this.key = key;
+      this.lastModified = System.currentTimeMillis();
+   }
+
+   public ProfileKey getKey()
+   {
+      return this.key;
+   }
+
+   public long getLastModified()
+   {
+      return this.lastModified;
+   }
+   
+   public Set<String> getDeploymentNames()
+   {
+      return Collections.emptySet();
+   }
+
+   public Collection<ProfileDeployment> getDeployments()
+   {
+      return Collections.emptySet();
+   }
+   
+   public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
+   {
+      throw new NoSuchDeploymentException("This profiles does not contain any deployments.");
+   }
+
+   public boolean hasDeployment(String name)
+   {
+      return false;
+   }
+
+   public boolean isMutable()
+   {
+      return false;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{key = ").append(getKey());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/NoopProfile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.jboss.profileservice.spi.helpers.AbstractProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A basic VFS based ProfileDeployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileVFSDeployment extends AbstractProfileDeployment
+{
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 7214390961641933878L;
+
+   public ProfileVFSDeployment(VirtualFile root)
+   {
+      setName(safeVirtualFileName(root));
+      setRoot(root);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployAction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployAction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployAction.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,80 @@
+/*
+ * 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 org.jboss.logging.Logger;
+import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.dependency.ProfileDeployAction;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * A deploy action used for the BootstrapDeployerPlugin.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BootstrapDeployAction extends ProfileDeployAction
+{
+
+   /** The instance. */
+   protected final static BootstrapDeployAction instance = new BootstrapDeployAction();
+   
+   public static BootstrapDeployAction getInstance()
+   {
+      return instance;
+   }
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(BootstrapDeployAction.class);
+   
+   @Override
+   protected void deploy(Profile profile, ProfileDeployerPlugin deployer) throws Exception
+   {
+      boolean trace = log.isTraceEnabled();
+      for(ProfileDeployment deployment : profile.getDeployments())
+      {
+         if(trace) log.trace("Deploying " + deployment);
+         deployer.addDeployment(deployment);
+      }
+   }
+   
+   @Override
+   protected void undeployer(Profile profile, ProfileDeployerPlugin deployer)
+   {
+      boolean trace = log.isTraceEnabled();
+      for(ProfileDeployment deployment : profile.getDeployments())
+      {
+         try
+         {
+            if(trace) log.trace("Undeploying " + deployment);
+            deployer.removeDeployment(deployment);
+         }
+         catch(Throwable t)
+         {
+            log.debug("failed to undeploy " + deployment, t);
+         }
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.profileservice.profile.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.profileservice.ProfileDeployerPlugin;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BootstrapDeployerPlugin implements ProfileDeployerPlugin
+{
+
+   /** The deployments. */
+   private final Collection<String> deployments = new ArrayList<String>();
+   
+   /** The deployer. */
+   private final BasicXMLDeployer deployer;
+
+   public BootstrapDeployerPlugin(Kernel kernel)
+   {
+      if(kernel == null)
+         throw new IllegalArgumentException("null kernel");
+      this.deployer = new BasicXMLDeployer(kernel);
+   }
+   
+   @Override
+   public void addDeployment(ProfileDeployment deployment) throws Exception
+   {
+      try
+      {
+         // Deploy
+         this.deployer.deploy(deployment.getRoot().toURL());
+         // Add to the deployments
+         this.deployments.add(deployment.getName());
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException("failed to deploy " + deployment);
+      }
+   }
+
+   @Override
+   public void checkComplete(String... names) throws Exception
+   {
+      if(names != null && names.length > 0)
+      {
+         // 
+      }
+   }
+
+   @Override
+   public void checkComplete() throws Exception
+   {
+      try
+      {
+         this.deployer.validate();
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException(t);
+      }
+   }
+
+   @Override
+   public void process()
+   {
+      // no process required for this type of deployer
+   }
+
+   @Override
+   public void removeDeployment(ProfileDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("null deployment");
+      
+      if(this.deployments.contains(deployment.getName()))
+      {
+         this.deployments.remove(deployment.getName());
+         this.deployer.undeploy(deployment.getRoot().toURL());
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapDeployerPlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,132 @@
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.profileservice.dependency.AbstractProfileContextFactory;
+import org.jboss.profileservice.dependency.AbstractProfileDependencyContext;
+import org.jboss.profileservice.dependency.ProfileControllerContext;
+import org.jboss.profileservice.dependency.ProfileCreateAction;
+import org.jboss.profileservice.dependency.ProfileInstallAction;
+import org.jboss.profileservice.dependency.ProfileInstantiateAction;
+import org.jboss.profileservice.dependency.ProfileServiceController;
+import org.jboss.profileservice.dependency.ProfileStartAction;
+import org.jboss.profileservice.profile.FilteredProfile;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileDependencyContext;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BootstrapProfileContextFactory extends AbstractProfileContextFactory implements ProfileFactory<BootstrapProfileMetaData, FilteredProfile>
+{
+
+   /** The types. */
+   private static final String[] types = new String[] { BootstrapProfileMetaData.class.getName() };
+   
+   /** The default actions. */
+   protected static final AbstractControllerContextActions defaultActions;
+   
+   static
+   {
+      Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+      actions.put(ControllerState.INSTANTIATED, ProfileInstantiateAction.getInstace());
+      actions.put(ControllerState.CREATE, ProfileCreateAction.getInstance());
+      actions.put(ControllerState.START, ProfileStartAction.getInstance());
+      actions.put(ControllerState.INSTALLED, ProfileInstallAction.getInstance());
+      actions.put(ProfileServiceController.DEPLOY_STATE, BootstrapDeployAction.getInstance());
+      defaultActions = new AbstractControllerContextActions(actions);
+   }
+   
+   @Override
+   public String[] getTypes()
+   {
+      return types;
+   }
+   
+   @Override
+   public ProfileControllerContext createProfileContext(ProfileKey key, ProfileMetaData metaData, Profile profile)
+   {
+      ProfileDependencyContext ctx = createDependencyContext(key, metaData);
+      return new ProfileControllerContext(ctx, defaultActions, profile);
+   }
+   
+   protected ProfileDependencyContext createDependencyContext(ProfileKey key, ProfileMetaData metaData)
+   {
+      return new AbstractProfileDependencyContext(key, metaData, getRequirementResolver());
+   }
+
+   @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(ProfileMetaData 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(ProfileMetaData metaData)
+   {
+      List<String> deploymentNames = new ArrayList<String>();
+      if(metaData.getDeployments() != null && metaData.getDeployments().isEmpty() == false)
+      {
+         for(ProfileDeploymentMetaData deployment : metaData.getDeployments())
+         {
+            deploymentNames.add(deployment.getName());
+         }
+      }
+      return deploymentNames;
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,138 @@
+/*
+ * 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 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.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.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(propOrder = { "source", "deployments" })
+public class BootstrapProfileMetaData extends AbstractProfileMetaData
+{
+   
+   /** The profile source. */
+   private ProfileSourceMetaData source;
+   
+   /** The deployments. */
+   private List<ProfileDeploymentMetaData> deployments;
+
+   public BootstrapProfileMetaData()
+   {
+      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<ProfileDeploymentMetaData> getDeployments()
+   {
+      return this.deployments;
+   }
+   
+   @Override
+   @XmlAttribute(name = "domain")
+   public String getDomain()
+   {
+      return super.getDomain();
+   }
+   
+   @Override
+   @XmlAttribute(name = "server")
+   public String getServer()
+   {
+      return super.getServer();
+   }
+   
+   @Override
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return super.getName();
+   }
+   
+   @Override
+   @XmlElement(name = "requires", type = BasicSubProfileMetaData.class)
+   public List<SubProfileMetaData> getSubprofiles()
+   {
+      return super.getSubprofiles();
+   }
+   
+   @Override
+   @XmlTransient
+   public ProfileKey getKey()
+   {
+      return super.getKey();
+   }
+   
+   @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
+   public void setDeployments(List<ProfileDeploymentMetaData> deployments)
+   {
+      this.deployments = deployments;
+   }
+
+   @XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
+   public ProfileSourceMetaData getSource()
+   {
+      return this.source;
+   }
+   
+   public void setSource(ProfileSourceMetaData source)
+   {
+      this.source = source;
+   }
+ 
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      super.visit(visitor);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,58 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+
+/**
+ * The basic profile deployment meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileDeploymentMetaData implements ProfileDeploymentMetaData
+{
+
+   /** The deployment name. */
+   private String name;
+   
+   @XmlValue
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      // nothing
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileDeploymentMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,144 @@
+/*
+ * 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.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.ProfileKey;
+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.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+
+/**
+ * The basic profile meta data.
+ * 
+ * @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
+{
+   
+   /** The profile source. */
+   private ProfileSourceMetaData source;
+   
+   /** The deployments. */
+   private List<ProfileDeploymentMetaData> deployments;
+
+   public BasicProfileMetaData()
+   {
+      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;
+   }
+   
+   @Override
+   @XmlAttribute(name = "domain")
+   public String getDomain()
+   {
+      return super.getDomain();
+   }
+   
+   @Override
+   @XmlAttribute(name = "server")
+   public String getServer()
+   {
+      return super.getServer();
+   }
+   
+   @Override
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return super.getName();
+   }
+   
+   @Override
+   @XmlElement(name = "requires", type = BasicSubProfileMetaData.class)
+   public List<SubProfileMetaData> getSubprofiles()
+   {
+      return super.getSubprofiles();
+   }
+   
+   @Override
+   @XmlTransient
+   public ProfileKey getKey()
+   {
+      return super.getKey();
+   }
+   
+   @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
+   public void setDeployments(List<ProfileDeploymentMetaData> deployments)
+   {
+      this.deployments = deployments;
+   }
+
+   @XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
+   public ProfileSourceMetaData getSource()
+   {
+      return this.source;
+   }
+   
+   public void setSource(ProfileSourceMetaData source)
+   {
+      this.source = source;
+   }
+ 
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      super.visit(visitor);
+   }
+   
+   @XmlTransient
+   public boolean isHotDeployment()
+   {
+      return false;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,61 @@
+/*
+ * 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;
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileSourceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,88 @@
+/*
+ * 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 javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractSubProfileKeyMetaData;
+
+/**
+ * The basic sub profile meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicSubProfileMetaData extends AbstractSubProfileKeyMetaData
+{
+
+   public BasicSubProfileMetaData()
+   {
+      super();
+   }
+   
+   public BasicSubProfileMetaData(String name)
+   {
+      super(name);
+   }
+   
+   public BasicSubProfileMetaData(String domain, String server, String name)
+   {
+      super(domain, server, name);
+   }
+   
+   public BasicSubProfileMetaData(ProfileKey key)
+   {
+      super(key);
+   }
+   
+   @Override
+   @XmlAttribute(name = "domain")
+   public String getDomain()
+   {
+      return super.getDomain();
+   }
+   
+   @Override
+   @XmlAttribute(name = "server")
+   public String getServer()
+   {
+      return super.getServer();
+   }
+   
+   @Override
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return super.getName();
+   }
+   
+   @Override
+   @XmlTransient
+   public ProfileKey getKey()
+   {
+      return super.getKey();
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicSubProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -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;
+
+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;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/HotDeploymentProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,115 @@
+/*
+ * 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;
+
+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.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;
+
+/**
+ * The a container xml format for profile meta data.
+ * 
+ * <profiles xmlns="urn:jboss:profileservice:profiles:1.0" />
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = "profiles")
+ at JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
+      namespace= "urn:jboss:profileservice:profiles:1.0",
+      elementFormDefault=XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+ at XmlType(name = "profilesType", propOrder = {"profiles"})
+public class ProfilesMetaData extends AbstractProfileKeyMetaData
+{
+   
+   /** The profiles. */
+   private List<ProfileMetaData> profiles;
+   
+   public ProfilesMetaData()
+   {
+      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();
+   }
+   
+   @XmlAttribute(name = "server")
+   public String getServer()
+   {
+      return super.getServer();
+   }
+
+   @XmlAttribute(name = "domain")
+   public String getDomain()
+   {
+      return super.getDomain();
+   }
+   
+   @XmlElements({
+      @XmlElement(name = "profile", type = BasicProfileMetaData.class),
+      @XmlElement(name = "bootstrap-profile", type = BootstrapProfileMetaData.class),
+      @XmlElement(name = "hot-deployment-profile", type = HotDeploymentProfileMetaData.class)
+   })
+   @XmlAnyElement
+   public List<ProfileMetaData> getProfiles()
+   {
+      return profiles;
+   }
+   
+   public void setProfiles(List<ProfileMetaData> profiles)
+   {
+      this.profiles = profiles;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/ProfilesMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,85 @@
+/*
+ * 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.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;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = "root-profile")
+ at JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
+      namespace= "urn:jboss:profileservice:root:profile:1.0",
+      elementFormDefault=XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+ at XmlType(name = "rootProfilesType", propOrder = {"rootProfiles", "profiles"})
+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()
+   {
+      return rootProfiles;
+   }
+   
+   public void setRootProfiles(List<String> rootProfiles)
+   {
+      this.rootProfiles = rootProfiles;
+   }
+   
+   public ProfileMetaData createRootProfile()
+   {
+      return new EmptyProfileMetaData(getDomain(), getServer(), getName());
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/RootProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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/emtpy/EmptyProfileMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/emtpy/EmptyProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,74 @@
+/*
+ * 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.emtpy;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
+
+/**
+ * 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$
+ */
+public class EmptyProfileMetaData extends AbstractProfileMetaData implements ProfileMetaData
+{
+   
+   public EmptyProfileMetaData()
+   {
+      super();
+   }
+   
+   public EmptyProfileMetaData(String domain, String server, String name)
+   {
+      super(domain, server, name);
+   }
+   
+   public EmptyProfileMetaData(String domain, String server, String name, List<SubProfileMetaData> subProfiles)
+   {
+      super(domain, server, name);
+      setSubprofiles(subProfiles);
+   }
+   
+   @XmlTransient
+   public List<ProfileDeploymentMetaData> getDeployments()
+   {
+      return Collections.emptyList();
+   }
+
+   @XmlTransient
+   public ProfileSourceMetaData getSource()
+   {
+      return null;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/emtpy/EmptyProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,236 @@
+/*
+ * 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.repository.legacy;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.profile.AbstractVFSProfileSource;
+import org.jboss.profileservice.spi.DeploymentContentFlags;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A abstract VFS based deployment repository.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDeploymentRepository extends AbstractVFSProfileSource implements DeploymentRepository
+{
+   
+   /** The ignore flags. */
+   protected final static int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
+   
+   /** The associated profile key. */
+   private ProfileKey key;
+   
+   /** The content flags. */
+   private Map<String, Integer> contentFlags = new ConcurrentHashMap<String, Integer>();
+      
+   public AbstractDeploymentRepository(ProfileKey key, URI[] uris)
+   {
+      super(uris);
+      if(key == null)
+         throw new IllegalArgumentException("Null profile key.");
+      
+      this.key = key;
+   }
+   
+   public ProfileKey getProfileKey()
+   {
+      return this.key;
+   }
+
+   public void create() throws Exception
+   {
+      //
+   }
+   
+   public void unload()
+   {
+      super.destroy();
+      // Unload
+      this.contentFlags.clear();
+   }
+   
+   @Override
+   public void addDeployment(String vfsPath, ProfileDeployment d) throws Exception
+   {
+      super.addDeployment(d);
+   }
+   
+   @Override
+   public ProfileDeployment removeDeployment(String vfsPath) throws Exception
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null vfsPath");
+      
+      // Get the deployment
+      ProfileDeployment deployment = super.removeDeployment(vfsPath);
+      // Remove the entries
+      this.contentFlags.remove(deployment.getName());
+      // Return
+      return deployment;
+   }
+
+   @Override
+   public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+   {
+      if(vfsPath == null)
+         throw new IllegalArgumentException("Null vfsPath");
+      
+      ProfileDeployment ctx = super.getDeployment(vfsPath);
+      if(ctx == null)
+      {
+         List<String> names = findDeploymentContent(vfsPath);
+         if(names.size() == 1)
+         {
+            ctx = super.getDeployment(names.get(0));
+         }
+         else if(names.size() > 1)
+         {
+            throw new NoSuchDeploymentException("Multiple deployments found for: "+ vfsPath +", available: " + names);            
+         }
+      }
+      if(ctx == null)
+      {
+         log.debug("Failed to find application for: "+vfsPath+", available: " + getDeploymentNames());
+         throw new NoSuchDeploymentException("Failed to find deployment in file: " + vfsPath);
+      }
+      return ctx;
+   }
+
+   public VirtualFile getDeploymentContent(String name) throws IOException
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null name");
+      
+      // A deploy content needs to be added over addDeployContent
+      VirtualFile vf = getCachedVirtualFile(name);
+      if(vf == null)
+      {
+         List<String> matchingNames = findDeploymentContent(name);
+         if(matchingNames.size() == 1)
+         {
+            vf = getCachedVirtualFile(matchingNames.get(0));
+         }
+         else if(matchingNames.size() > 1)
+         {
+            throw new FileNotFoundException("Multiple names found for name: " + name + ", profile: "+ key + ", available: " + matchingNames);
+         }
+      }
+      if(vf == null)
+         throw new FileNotFoundException("Failed to find content in profile: "+ key + " filename: " + name);
+      
+      return vf;
+   }
+   
+   public String[] getRepositoryNames(String... names) throws IOException
+   {
+      if(names == null)
+         throw new IllegalArgumentException("Null names[]");
+      
+      Collection<String> tmp = new HashSet<String>();
+      for(String name : names)
+      {
+         if(getCachedVirtualFile(name) != null)
+         {
+            tmp.add(name);
+         }
+         else
+         {
+            // Try to find the name
+            List<String> deploymentNames = findDeploymentContent(name);
+            if(deploymentNames != null)
+               tmp.addAll(deploymentNames);  
+         }
+      }
+      return tmp.toArray(new String[tmp.size()]);
+   }
+
+   public int lockDeploymentContent(String vfsPath)
+   {
+      if( log.isTraceEnabled() )
+         log.trace("lockDeploymentContent, "+vfsPath);
+      return setDeploymentContentFlags(vfsPath, DeploymentContentFlags.LOCKED);
+   }
+
+   public int unlockDeploymentContent(String vfsPath)
+   {
+      if( log.isTraceEnabled() )
+         log.trace("unlockDeploymentContent, "+vfsPath);
+      return clearDeploymentContentFlags(vfsPath, DeploymentContentFlags.LOCKED);
+   }
+
+   public int getDeploymentContentFlags(String vfsPath)
+   {
+      Integer flags = contentFlags.get(vfsPath);
+      return flags != null ? flags : 0;
+   }
+   public synchronized int clearDeploymentContentFlags(String vfsPath, int flags)
+   {
+      Integer dflags = contentFlags.get(vfsPath);
+      if(dflags != null)
+      {
+         dflags &= ~flags;
+         contentFlags.put(vfsPath, dflags);
+      }
+      return dflags != null ? dflags : 0;
+   }
+   public boolean hasDeploymentContentFlags(String vfsPath, int flag)
+   {
+      Integer flags = contentFlags.get(vfsPath);
+      boolean hasFlag = false;
+      if(flags != null )
+         hasFlag = (flags & flag) != 0;
+      return hasFlag;
+   }
+   public int setDeploymentContentFlags(String vfsPath, int flags)
+   {
+      contentFlags.put(vfsPath, flags);
+      return flags;
+   }
+   
+   @Override
+   protected boolean acceptsDeployment(String name)
+   {
+      if(hasDeploymentContentFlags(name, ignoreFlags))
+      {
+         if(log.isTraceEnabled())
+            log.trace("Ignoring locked application: " + name);
+         
+         return false;
+      }
+      return super.acceptsDeployment(name);
+   }
+
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/AbstractDeploymentRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,348 @@
+/*
+ * 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.repository.legacy;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.SyncFailedException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.profileservice.spi.DeploymentContentFlags;
+import org.jboss.profileservice.spi.DeploymentOption;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A basic deployment repository.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicDeploymentRepository extends AbstractDeploymentRepository
+{
+
+   /** Should an attempt to overwrite existing content fail in {@link #addDeploymentContent(String, ZipInputStream)}*/
+   private boolean failIfAlreadyExists = false;
+   
+   /** A optional upload uri. */
+   private URI uploadUri;
+   
+   /** A lock for the hot deployment/{@link #getModifiedDeployments()} */
+   private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
+   
+   public BasicDeploymentRepository(ProfileKey key, URI[] uris)
+   {
+      super(key, uris);
+   }
+   
+   public boolean isFailIfAlreadyExists()
+   {
+      return failIfAlreadyExists;
+   }
+   
+   public void setFailIfAlreadyExists(boolean failIfAlreadyExists)
+   {
+      this.failIfAlreadyExists = failIfAlreadyExists;
+   }
+   
+   public URI getUploadUri()
+   {
+      if(uploadUri != null)
+         return uploadUri;
+
+      if(getRepositoryURIs() != null && getRepositoryURIs().length > 0)
+         return getRepositoryURIs()[0];
+      
+      throw new IllegalArgumentException("No upload uri available.");
+   }
+   
+   public void setUploadUri(URI uploadUri)
+   {
+      if(uploadUri == null)
+      {
+         this.uploadUri = null;
+         return;
+      }
+      // Validate
+      if(getRepositoryURIs() != null && getRepositoryURIs().length > 0)
+      {
+         if(Arrays.asList(getRepositoryURIs()).contains(uploadUri))
+         {
+            this.uploadUri = uploadUri;
+            return;
+         }
+      }
+      throw new IllegalArgumentException("Upload uri is not managed by this repository: "+ uploadUri);
+   }
+
+   public void load() throws Exception
+   {
+      for(URI uri : getRepositoryURIs())
+      {
+         VirtualFile root = getCachedVirtualFile(uri);
+         loadApplications(root);
+      }
+      updateLastModfied();
+   }
+   
+   @Override
+   public void addDeployment(String vfsPath, ProfileDeployment d) throws Exception
+   {
+      // Suspend hot deployment checking
+      if( log.isTraceEnabled() )
+         log.trace("Aquiring content write lock");
+      lockWrite();
+      try
+      {
+         internalAddDeployment(vfsPath, d);
+      }
+      finally
+      {
+         // Allow hot deployment checking
+         unlockWrite();
+         if(log.isTraceEnabled())
+            log.trace("Released content write lock");
+      }
+   }
+   
+   public Collection<ModificationInfo> getModifiedDeployments() throws Exception
+   {
+      return Collections.emptySet();
+   }
+
+   public String addDeploymentContent(String vfsPath, InputStream contentIS) throws IOException
+   {
+      return addDeploymentContent(vfsPath, contentIS, new DeploymentOption[0]);
+   }
+   
+   public String addDeploymentContent(String vfsPath, InputStream contentIS, DeploymentOption... options)
+      throws IOException
+   {     
+      boolean trace = log.isTraceEnabled();
+      // Suspend hot deployment checking
+      if( trace )
+         log.trace("Aquiring content write lock");
+      lockWrite();
+      String repositoryName = null;
+      try
+      {
+         // Write the content out
+         File contentRoot = new File(getUploadUri()); 
+         if(contentRoot == null)
+            throw new FileNotFoundException("Failed to obtain content dir for phase: "+vfsPath);
+         if(contentRoot.isDirectory() == false)
+            throw new FileNotFoundException("The content root is not a directory." + contentRoot.getAbsolutePath());
+         // The content file
+         File contentFile = new File(contentRoot, vfsPath);
+         
+         // Check if it already exists
+         boolean exists = contentFile.exists();
+         // Get the content options
+         List<DeploymentOption> deploymentOptions = Arrays.asList(options); 
+         boolean failIfAlreadyExsists = isFailIfAlreadyExists()
+                  || deploymentOptions.contains(DeploymentOption.FailIfExists);
+         if(exists && failIfAlreadyExsists)
+            throw new SyncFailedException("Deployment content already exists: "+ contentFile.getAbsolutePath());
+         
+         // Check if we need unpack this deployment
+         if(deploymentOptions.contains(DeploymentOption.Explode))
+         {
+            // Unjar
+            DeploymentUtils.unjar(contentIS, contentFile);
+         }
+         else
+         {
+            // Copy stream
+            FileOutputStream fos = new FileOutputStream(contentFile);
+            try
+            {
+               byte[] tmp = new byte[4096];
+               int read;
+               while((read = contentIS.read(tmp)) > 0)
+               {
+                  if (trace)
+                     log.trace("write, " + read);
+                  fos.write(tmp, 0, read);
+               }
+               fos.flush();
+            }
+            finally
+            {
+               try
+               {
+                  fos.close();
+               }
+               catch (IOException ignored)
+               {
+               }
+            }            
+         }
+
+         // Get the vfs uri and add the VFS uri to the cached VFS uris
+         VirtualFile contentVF = VFS.getRoot(contentFile.toURI());
+         try
+         {
+            // Add the new virtual file to the cache
+            repositoryName = addVirtualFileCache(contentVF);
+            
+            // Cleanup 
+            if(exists)
+               cleanUpRoot(contentVF);
+         }
+         catch(URISyntaxException e)
+         {
+            throw new RuntimeException(e); // This should not happen anyway
+         }
+
+         // Lock the content
+         setDeploymentContentFlags(repositoryName, DeploymentContentFlags.LOCKED);
+      }
+      finally
+      {
+         // Allow hot deployment checking
+         unlockWrite();
+         if(trace)
+            log.trace("Released content write lock");
+      }
+      return repositoryName;
+   }
+   
+   public ProfileDeployment removeDeployment(String vfsPath) throws Exception
+   {
+      return removeDeployment(vfsPath, true);
+   }
+
+   /**
+    * Internal add the deployment, without locking the repository.
+    * 
+    * @param vfsPath - the name of the deployment
+    * @param deployment - the deployment
+    * @throws Exception
+    */
+   protected void internalAddDeployment(String vfsPath, ProfileDeployment deployment) throws Exception
+   {
+      super.addDeployment(vfsPath, deployment);
+   }
+   
+   /**
+    * Remove deployment.
+    *
+    * @param vfsPath the vfs path
+    * @param deleteFile do we delete the file
+    * @return found profile deployment
+    * @throws Exception for any error
+    */
+   protected ProfileDeployment removeDeployment(String vfsPath, boolean deleteFile) throws Exception
+   {
+      // Suspend hot deployment checking
+      if( log.isTraceEnabled() )
+         log.trace("Aquiring content write lock");
+      lockWrite();
+      try
+      {
+         // Remove the deployment from the filesystem
+         ProfileDeployment deployment = getDeployment(vfsPath);
+         VirtualFile root = deployment.getRoot();
+         
+         if(deleteFile && root != null)
+         {
+            // Delete the file
+            if(root.delete() == false)
+               throw new IOException("Failed to delete: " + root);
+            
+            cleanUpRoot(root);  
+         }
+         
+         // Cleanup
+         return super.removeDeployment(deployment.getName());
+      }
+      finally
+      {
+         unlockWrite();
+         if (log.isTraceEnabled())
+            log.trace("Released content write lock");
+      }
+   }
+   
+   /**
+    * A way for the hot-deployment repository to cleanup
+    * the root (modification checker).
+    * 
+    * @param vf the deployment root
+    */
+   protected void cleanUpRoot(VirtualFile vf)
+   {
+      //
+   }
+   
+   public void remove() throws Exception
+   {
+      // FIXME remove
+   }
+   
+   /**
+    * Lock for read
+    */
+   protected void lockRead()
+   {
+      lock.readLock().lock();
+   }
+
+   /**
+    * Unlock for read
+    */
+   protected void unlockRead()
+   {
+      lock.readLock().unlock();
+   }
+
+   /**
+    * Lock for write
+    */
+   protected void lockWrite()
+   {
+      lock.writeLock().lock();
+   }
+
+   /**
+    * Unlock for write
+    */
+   protected void unlockWrite()
+   {
+      lock.writeLock().unlock();
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicDeploymentRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,88 @@
+/*
+ * 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;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/BasicProfileFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/DeploymentUtils.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/DeploymentUtils.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/DeploymentUtils.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,132 @@
+/*
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+import org.jboss.util.file.JarUtils;
+
+/**
+ * Deployment Utils.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DeploymentUtils
+{
+   
+   /**
+    * Try to unpack an inputStream.
+    * This is a fork of {@link JarUtils#unjar}, but does not close the
+    * InputStream itself, as this is done by the remote deploymentTarget.
+    * 
+    * @param in the InputStream
+    * @param dest the destination file
+    * @throws IOException
+    */
+   public static void unjar(InputStream in, File dest) throws IOException
+   {
+      if (!dest.exists())
+      {
+         dest.mkdirs();
+      }
+      if (!dest.isDirectory())
+      {
+         throw new IOException("Destination must be a directory.");
+      }
+      JarInputStream jin = new JarInputStream(in);
+      byte[] buffer = new byte[1024];
+      
+      ZipEntry entry = jin.getNextEntry();
+      while (entry != null)
+      {
+         String fileName = entry.getName();
+         if (fileName.charAt(fileName.length() - 1) == '/')
+         {
+            fileName = fileName.substring(0, fileName.length() - 1);
+         }
+         if (fileName.charAt(0) == '/')
+         {
+            fileName = fileName.substring(1);
+         }
+         if (File.separatorChar != '/')
+         {
+            fileName = fileName.replace('/', File.separatorChar);
+         }
+         File file = new File(dest, fileName);
+         if (entry.isDirectory())
+         {
+            // make sure the directory exists
+            file.mkdirs();
+            jin.closeEntry();
+         } 
+         else
+         {
+            // make sure the directory exists
+            File parent = file.getParentFile();
+            if (parent != null && !parent.exists())
+            {
+               parent.mkdirs();
+            }
+            
+            // dump the file
+            OutputStream out = new FileOutputStream(file);
+            int len = 0;
+            while ((len = jin.read(buffer, 0, buffer.length)) != -1)
+            {
+               out.write(buffer, 0, len);
+            }
+            out.flush();
+            out.close();
+            jin.closeEntry();
+            file.setLastModified(entry.getTime());
+         }
+         entry = jin.getNextEntry();
+      }
+      /* Explicity write out the META-INF/MANIFEST.MF so that any headers such
+      as the Class-Path are see for the unpackaged jar
+      */
+      Manifest mf = jin.getManifest();
+      if (mf != null)
+      {
+         File file = new File(dest, "META-INF/MANIFEST.MF");
+         File parent = file.getParentFile();
+         if( parent.exists() == false )
+         {
+            parent.mkdirs();
+         }
+         OutputStream out = new FileOutputStream(file);
+         mf.write(out);
+         out.flush();
+         out.close();
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/DeploymentUtils.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,142 @@
+/*
+ * 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 java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * The profile repository.
+ * 
+ * This accepts any implementation of DeploymentRepositoryFactory and delegates
+ * the creation of the repository to one of the installed factories, based on
+ * the exposed types. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TypedProfileRepository implements ProfileRepository
+{
+   
+   /** The repository factories. */
+   private Map<String, DeploymentRepositoryFactory> repositoryFactories = new ConcurrentHashMap<String, DeploymentRepositoryFactory>();
+
+   /** The created repositories. */
+   private Map<ProfileKey, DeploymentRepository> repositories = new ConcurrentHashMap<ProfileKey, DeploymentRepository>();
+   
+   public Collection<ProfileKey> getProfileKeys()
+   {
+      return this.repositories.keySet();
+   }
+
+   public DeploymentRepository getProfileDeploymentRepository(ProfileKey key) throws NoSuchProfileException
+   {
+      DeploymentRepository repository = this.repositories.get(key);
+      if(repository == null)
+         throw new NoSuchProfileException("No such repository for profile: "  + key);
+      
+      return repository;
+   }
+   
+   public DeploymentRepository createProfileDeploymentRepository(ProfileKey key, ProfileMetaData metaData) throws Exception
+   {
+      if(metaData == null)
+         throw new IllegalArgumentException("Null metaData");
+      if(metaData.getName() == null)
+         throw new IllegalArgumentException("Null metaData name");
+      
+      DeploymentRepository repository = this.repositories.get(key);
+      if(repository == null)
+      {
+         String type = null;
+         if(metaData.getSource() == null)
+            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();
+         
+         // TODO check if there is a conflict with hotdeployment repositories
+         repository = createProfileDeploymentRepository(key, type , source);
+         if(repository != null)
+         {
+            this.repositories.put(key, repository);
+         }
+      }
+      return repository;
+   }
+   
+   protected DeploymentRepository createProfileDeploymentRepository(ProfileKey key, String repositoryType, ProfileSourceMetaData metaData) throws Exception
+   {
+      DeploymentRepositoryFactory factory = this.repositoryFactories.get(repositoryType);
+      if(factory ==  null)
+         throw new IllegalStateException("No registered factory for repository type: "+ repositoryType);
+      
+      // Let the factory create the repository
+      return factory.createDeploymentRepository(key, metaData);
+   }
+
+   public void removeProfileDeploymentRepository(ProfileKey key) throws Exception, NoSuchProfileException
+   {
+      DeploymentRepository repository = this.repositories.remove(key);
+      if(repository == null)
+         throw new NoSuchProfileException("No such repository for profile: "  + key);
+      
+      // Remove
+      repository.remove();
+   }
+   
+   public void addRepositoryFactory(DeploymentRepositoryFactory factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("Null factory.");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("Empty factory type.");
+      
+      for(String type : factory.getTypes())
+         this.repositoryFactories.put(type, factory);
+   }
+   
+   public void removeRepositoryFactory(DeploymentRepositoryFactory factory)
+   {
+      if(factory == null)
+         throw new IllegalArgumentException("Null factory.");
+      if(factory.getTypes() == null)
+         throw new IllegalArgumentException("Empty factory type.");
+      
+      for(String type : factory.getTypes())
+         this.repositoryFactories.remove(type);
+   }
+   
+}


Property changes on: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/legacy/TypedProfileRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/ProfileServiceTestBase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/ProfileServiceTestBase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/ProfileServiceTestBase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+
+import org.jboss.logging.Logger;
+
+/**
+ * The profileservice test base.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class ProfileServiceTestBase extends TestCase
+{
+
+   /** The logger. */
+   protected final Logger log = Logger.getLogger(getClass());
+   
+   protected Logger getLog()
+   {
+      return this.log;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/ProfileServiceTestBase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomDeploymentMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomDeploymentMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomDeploymentMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,86 @@
+/*
+ * 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.support;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(name = "cDeploymentType", propOrder = { "groupId", "name", "version" })
+public class CustomDeploymentMetaData implements ProfileDeploymentMetaData
+{
+
+   /** The deployment name. */
+   private String name;
+   
+   /** The groudId. */
+   private String groupId;
+   
+   /** The version. */
+   private String version;
+   
+   @XmlElement(name = "name")
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   @XmlElement(name = "group-id")
+   public String getGroupId()
+   {
+      return groupId;
+   }
+   
+   public void setGroupId(String groupId)
+   {
+      this.groupId = groupId;
+   }
+   
+   @XmlElement(name = "version")
+   public String getVersion()
+   {
+      return version;
+   }
+   
+   public void setVersion(String version)
+   {
+      this.version = version;
+   }
+
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      // nothing
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomDeploymentMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,134 @@
+/*
+ * 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.support;
+
+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.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.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+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;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace="urn:jboss:profileservice:profile:custom:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "custom-profile")
+ at XmlType(name = "customProfileType", propOrder = {"source", "subprofiles", "deployments"})
+public class CustomProfileMetaData extends AbstractProfileMetaData
+{
+
+   /** The profile source. */
+   private ProfileSourceMetaData source;
+   
+   /** The deployments. */
+   private List<ProfileDeploymentMetaData> deployments;
+
+   public CustomProfileMetaData()
+   {
+      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;
+   }
+   
+   @Override
+   @XmlAttribute(name = "domain")
+   public String getDomain()
+   {
+      return super.getDomain();
+   }
+   
+   @Override
+   @XmlAttribute(name = "server")
+   public String getServer()
+   {
+      return super.getServer();
+   }
+   
+   @Override
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return super.getName();
+   }
+   
+   @Override
+   @XmlElement(name = "profile-dependency", type = BasicSubProfileMetaData.class)
+   public List<SubProfileMetaData> getSubprofiles()
+   {
+      return super.getSubprofiles();
+   }
+   
+   @XmlElement(name = "profile-deployment",  type = CustomDeploymentMetaData.class)
+   public void setDeployments(List<ProfileDeploymentMetaData> deployments)
+   {
+      this.deployments = deployments;
+   }
+
+   @XmlElement(name = "custom-source", type = BasicProfileSourceMetaData.class)
+   public ProfileSourceMetaData getSource()
+   {
+      return this.source;
+   }
+   
+   public void setSource(ProfileSourceMetaData source)
+   {
+      this.source = source;
+   }
+ 
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      super.visit(visitor);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/support/CustomProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/AbstractProfileServiceMetaDataTest.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/AbstractProfileServiceMetaDataTest.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/AbstractProfileServiceMetaDataTest.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,72 @@
+/*
+ * 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.io.InputStream;
+
+import junit.framework.TestCase;
+
+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;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileServiceMetaDataTest extends TestCase
+{
+
+   /** The schema resolver. */
+   private final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+   
+   /** The unmarshaller factory. */
+   private final UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
+   
+   protected DefaultSchemaResolver getResolver()
+   {
+      return resolver;
+   }
+   
+   @SuppressWarnings("unchecked")
+   protected <T> T unmarshall(String name, SchemaBindingResolver resolver, Class<T> expected) throws JBossXBException
+   {
+      Unmarshaller unmarshaller = factory.newUnmarshaller();
+      return (T) unmarshaller.unmarshal(getIS(name), resolver);
+   }
+   
+   protected void addClassBinding(String nsUri, Class<?> clazz)
+   {
+      resolver.addClassBinding(nsUri, clazz);
+   }
+   
+   protected InputStream getIS(String name)
+   {
+      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+      assertNotNull(name, is);
+      return is;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/AbstractProfileServiceMetaDataTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,82 @@
+/*
+ * 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(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());
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,87 @@
+/*
+ * 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.test;
+
+import junit.framework.TestCase;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+
+/**
+ * The abstract ProfileService test base.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileServiceTest extends TestCase
+{
+
+   /** The logger. */
+   protected final Logger log = Logger.getLogger(getClass());
+   
+   /** The kernel. */
+   private Kernel kernel;
+   
+   /** The kernel controller. */
+   private KernelController controller;
+   
+   @Override
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      this.kernel = bootstrapKernel();
+      this.controller = kernel.getController();
+   }
+   
+   @Override
+   public void tearDown() throws Exception
+   {
+      getController().shutdown();
+      super.tearDown();
+   }
+   
+   protected Logger getLog()
+   {
+      return this.log;
+   }
+   
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+   
+   public KernelController getController()
+   {
+      return controller;
+   }
+   
+   private Kernel bootstrapKernel()
+   {
+      BasicBootstrap bootstrap = new BasicBootstrap();
+      bootstrap.run();
+      return bootstrap.getKernel();
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,39 @@
+/*
+ * 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.test;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileServiceUnitTestCase extends AbstractProfileServiceTest
+{
+
+   public void test()
+   {
+      assertNotNull(getKernel());
+      assertNotNull(getController());
+      getLog().debug(getController());
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/test/BasicProfileServiceUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/core/src/test/resources/log4j.properties
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/log4j.properties	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/log4j.properties	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,18 @@
+### ====================================================================== ###
+##                                                                          ##
+##  JBoss Bootstrap Log4j Configuration                                     ##
+##                                                                          ##
+### ====================================================================== ###
+
+### $Id: log4j.properties 71868 2008-04-10 02:14:32Z scott.stark at jboss.org $ ###
+
+log4j.rootCategory=DEBUG, CONSOLE
+log4j.org.jboss.util=TRACE
+log4j.org.jboss.profileservice=TRACE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.CONSOLE.org.jboss.xb.binding.parser.sax=INFO

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/clustering.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/clustering.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/clustering.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="clustering">
+
+	<profile name="clustering-deployers">
+		<profile-source>
+			<source>${jboss.server.base.url}deployers</source>
+		</profile-source>
+		<deployment>clustering-deployer-jboss-beans.xml</deployment>
+	</profile>
+
+	<profile name="clustering-runtime">
+		<profile-source>
+			<source>${jboss.server.base.url}deploy</source>
+		</profile-source>
+		<deployment>httpha-invoker.sar</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/default.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/default.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/default.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0">
+
+	<profile name="ignored-profile">
+		<profile-source>
+			<source>${jboss.server.base.url}conf</source>	
+		</profile-source>
+		<deployment>someDeployment</deployment>
+	</profile>
+
+	<profile name="default">
+		<profile-source>
+			<source>${jboss.server.base.url}deploy</source>
+			<source>${jboss.server.base.url}deploy2</source>
+		</profile-source>
+		<requires name="jmx" />
+		<requires name="seam" />
+		<requires name="jboss-web />
+		<requires name="clustering" />
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/ejb3.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/ejb3.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/ejb3.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="ejb3">
+
+	<profile name="ejb3-deployers">
+		<profile-source>
+			<source>${jboss.server.base.url}deployers</source>
+		</profile-source>
+		<requires name="metadata-deployers" />
+		<deployment>ejb3.deployer</deployment>
+	</profile>
+
+	<profile name="ejb3-runtime">
+		<profile-source>
+			<source>${jboss.server.base.url}deploy</source>
+		</profile-source>
+		<deployment>ejb3-container-jboss-beans.xml</deployment>
+		<deployment>ejb3-interceptors-aop.xml</deployment>
+		<deployment>ejb3-timer-service.xml</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jboss-web.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jboss-web.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jboss-web.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="jboss-web">
+
+	<profile name="jboss-web-deployers">
+		<profile-source>
+			<source>${jboss.server.base.url}deployers</source>
+		</profile-source>
+		<requires name="metadata-deployers" />
+		<deployment>jbossweb.deployer</deployment>
+	</profile>
+	
+	<profile name="jboss-web-runtime">
+		<profile-source>
+			<source>${jboss.server.base.url}deploy</source>
+		</profile-source>
+		<deployment>jbossweb.sar</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jmx.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jmx.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/jmx.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="jmx">
+
+	<profile name="bootstrap">
+		<profile-source>
+			<source>${jboss.server.base.url}conf</source>
+		</profile-source>
+		<deployment>jboss-service.xml</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/metadata-deployers.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/metadata-deployers.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/metadata-deployers.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles 
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="metadata-deployers">
+
+	<profile name="metadata-deployer-beans">
+		<profile-source>
+			<source>${jboss.server.base.url}deployers</source>
+		</profile-source>
+		<deployment>metadata-deployer-jboss-beans.xml</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/profiles/seam.profile
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/profiles/seam.profile	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/profiles/seam.profile	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles
+	xmlns="urn:jboss:profileservice:profiles:1.0"
+	name="seam">
+
+	<profile name="seam-deployers">
+		<profile-source>
+			<source>${jboss.server.base.url}deployers</source>
+		</profile-source>
+		<requires name="ejb3" />
+		<deployment>seam.deployer</deployment>
+	</profile>
+
+</profiles>
\ No newline at end of file

Added: projects/profileservice/trunk/core/src/test/resources/metadata/test.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/metadata/test.xml	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/metadata/test.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,25 @@
+<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


Property changes on: projects/profileservice/trunk/domain
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/domain/.classpath
===================================================================
--- projects/profileservice/trunk/domain/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/domain/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/domain/.project
===================================================================
--- projects/profileservice/trunk/domain/.project	                        (rev 0)
+++ projects/profileservice/trunk/domain/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-domain</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/domain/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/domain/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/domain/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 15:18:50 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/domain/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/domain/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/domain/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Thu Aug 13 15:18:47 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/domain/pom.xml
===================================================================
--- projects/profileservice/trunk/domain/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/domain/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.profileservice</groupId>
+    <artifactId>jboss-profileservice-parent</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.profileservice</groupId>
+  <artifactId>jboss-profileservice-domain</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>JBoss ProfileService Domain Model</name>
+  <url>http://www.jboss.org/jbossas</url>
+  <description>JBoss ProfileService Management Domain Model</description>
+
+  <dependencies>
+  </dependencies>
+  
+</project>

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DomainMetaData
+{
+
+}
+


Property changes on: projects/profileservice/trunk/domain/src/main/java/org/jboss/profileservice/domain/DomainMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision


Property changes on: projects/profileservice/trunk/persistence
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/persistence/.classpath
===================================================================
--- projects/profileservice/trunk/persistence/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/persistence/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/persistence/.project
===================================================================
--- projects/profileservice/trunk/persistence/.project	                        (rev 0)
+++ projects/profileservice/trunk/persistence/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-persistence</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/persistence/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/persistence/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/persistence/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 14:46:39 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/persistence/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/persistence/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/persistence/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Mon Jun 22 19:42:38 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/persistence/pom.xml
===================================================================
--- projects/profileservice/trunk/persistence/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/persistence/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,42 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>org.jboss.profileservice</groupId>
+		<artifactId>jboss-profileservice-parent</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.jboss.profileservice</groupId>
+	<artifactId>jboss-profileservice-persistence</artifactId>
+	<version>1.0.0-SNAPSHOT</version>
+	<name>JBoss ProfileService Persistence Plugin</name>
+	<url>http://www.jboss.org/jbossas</url>
+	<description>JBoss ProfileService Persistence Plugin</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.jboss.man</groupId>
+			<artifactId>jboss-managed</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.man</groupId>
+			<artifactId>jboss-metatype</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>sun-jaxb</groupId>
+			<artifactId>jaxb-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>sun-jaxb</groupId>
+			<artifactId>jaxb-impl</artifactId>
+		</dependency>
+	</dependencies>
+
+</project>

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectPersistence.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectPersistence.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectPersistence.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,326 @@
+/*
+ * 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.persistence;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.profileservice.persistence.xml.PersistedValue;
+
+/**
+ * A abstract ManagedObject persistence helper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractManagedObjectPersistence 
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(AbstractManagedObjectPersistence.class);
+   
+   /** The value persistence. */
+   private final AbstractValuePersistence valuePersistence;
+   
+   protected AbstractManagedObjectPersistence(AbstractValuePersistence valuePersistence)
+   {
+      if(valuePersistence == null)
+         throw new IllegalArgumentException("null value persistence.");
+      
+      this.valuePersistence = valuePersistence;
+   }
+   
+   public AbstractValuePersistence getValuePersistence()
+   {
+      return valuePersistence;
+   }
+   
+   /**
+    * Create a persisted managed object.
+    * 
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   public PersistedManagedObject createPersistedManagedObject(ManagedObject mo)
+   {
+      PersistedManagedObject persisted = new PersistedManagedObject();
+      return createPersistedManagedObject(persisted, mo);
+   }
+   
+   /**
+    * Process a managed object.
+    * 
+    * @param persisted the xml meta data
+    * @param mo the managed object
+    * @return isModified
+    */
+   public PersistedManagedObject createPersistedManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("Null persisted managed object.");
+      if(mo == null)
+         throw new IllegalArgumentException("Null managed object");
+      
+      // Set the template and class-name 
+      String className = mo.getAttachmentName();
+      if(mo.getAttachment() != null)
+      {
+         Class<?> attachment = mo.getAttachment().getClass();
+         className = attachment.getName();
+         // Set the template name
+         if(className.equals(mo.getAttachmentName()) == false)
+         {
+            // If the MO template is different from the actual attachment
+            persisted.setTemplateName(mo.getAttachmentName());
+         }
+      }
+      String name = mo.getName();
+      if(mo.getComponentName() != null && mo.getComponentName() instanceof String)
+         name = (String) mo.getComponentName();
+      
+      if(persisted.getOriginalName() == null)
+         persisted.setOriginalName(name);
+
+      // Set the managed-object meta information
+      persisted.setName(name);
+      persisted.setClassName(className);
+
+      return persisted;
+   }
+
+   /**
+    * Process the properties of the ManagedObject.
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    */
+   protected void processProperties(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      boolean trace = log.isTraceEnabled();
+      processProperties(persisted, mo, trace);
+   }
+   
+   /**
+    * Process the properties of the ManagedObject.
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    * @param trace enable trace logs
+    */
+   protected void processProperties(PersistedManagedObject persisted, ManagedObject mo, boolean trace)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("Null persisted object");
+      if(mo == null)
+         throw new IllegalArgumentException("Null managed object.");
+     
+      //
+      Map<String, PersistedProperty> properties = getPersistedProperties(persisted);
+      for(String propertyName : mo.getPropertyNames())
+      {
+         //
+         ManagedProperty property = mo.getProperty(propertyName);
+         PersistedProperty persistedProperty = properties.get(propertyName);
+         
+         if(persistedProperty == null)
+         {
+            // Create a new persisted property
+            persistedProperty = createPersistedProperty(property);
+         }
+         
+         // Process
+         if(processProperty(property, persistedProperty, trace))
+         {
+            persisted.getProperties().add(persistedProperty);
+         }
+      }
+   }
+   
+   /**
+    * Create a persisted property.
+    * 
+    * @param property the managed Property.
+    * @param persisted
+    * @return
+    */
+   protected PersistedProperty createPersistedProperty(ManagedProperty property)
+   {
+      if(property == null)
+         throw new IllegalArgumentException("Null managed property.");
+      
+      PersistedProperty persisted = new PersistedProperty();
+      persisted.setName(property.getName());
+      return persisted;
+   }
+
+   /**
+    * Process a managed property.
+    * 
+    * @param property the managed property
+    * @param persisted the persisted property
+    * @return true, if the property was processed
+    */
+   protected boolean processProperty(ManagedProperty property, PersistedProperty persisted)
+   {
+      boolean trace = log.isTraceEnabled();
+      return processProperty(property, persisted, trace);
+   }
+   
+   /**
+    * Process a managed property.
+    * 
+    * @param property the managed property
+    * @param persisted the persisted property
+    * @param trace enable trace logs
+    * @return true, if the property was processed
+    */   
+   protected boolean processProperty(ManagedProperty property, PersistedProperty persisted, boolean trace)
+   {
+      if(property == null)
+         throw new IllegalArgumentException("Null managed property.");
+      if(persisted == null)
+         throw new IllegalArgumentException("Null persisted property.");
+      
+      boolean processed = false;
+      // Check if we need to process this property
+      if(isProcessProperty(property, trace))
+      {
+         // 
+         MetaValue metaValue = property.getField(Fields.VALUE, MetaValue.class);
+         MetaType metaType = property.getField(Fields.META_TYPE, MetaType.class);
+         // Override metaType
+         if(metaValue != null)
+            metaType = metaValue.getMetaType();
+         
+         // Create the persisted value
+         PersistedValue value = createPersistedValue(metaValue, metaType, persisted.getValue());
+         if(value != null)
+         {
+            persisted.setValue(value);
+            if(trace)
+               log.trace("value for property ("+ property.getName() +"): " + value);
+            processed = true;
+         }
+      }
+      return processed;
+   }
+   
+   /**
+    * Create a persisted value. This delegates the value creation
+    * to the ValuePeristence.
+    * 
+    * @param metaValue the meta value
+    * @param metaType the meta type
+    * @param persisted the persisted value
+    * @return the created persisted value
+    */
+   private PersistedValue createPersistedValue(MetaValue metaValue, MetaType metaType, PersistedValue persisted)
+   {
+      return getValuePersistence().createPersistedValue(metaValue, metaType, persisted);
+   }
+   
+   /**
+    * Does this property needs to be processed.
+    * 
+    * @param property the managed property
+    * @param trace enable trace logs
+    * @return false if the property does not need to be processed otherwise true
+    */
+   protected boolean isProcessProperty(ManagedProperty property, boolean trace)
+   {
+      boolean process = false;
+      // 
+      if(property == null)
+         return process;
+      
+      // Skip non configuration properties
+      if(property.hasViewUse(ViewUse.CONFIGURATION) == false)
+      {
+         if(trace)
+            log.trace("Skip non configuration property: " + property.getName());
+         return process;
+      }
+      // Skip read only properties
+      if(property.isReadOnly())
+      {
+         if(trace)
+            log.trace("Skip readOnly property: " + property.getName());
+         return process;
+      }
+      // Skip removed properties
+      if(property.isRemoved())
+      {
+         if(trace)
+            log.trace("Skip removed property: " + property.getName());
+         return process;
+      }
+      // Skip read only properties
+      PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+      if(propertyInfo != null && propertyInfo.isReadable() == false)
+      {
+         if(trace)
+            log.trace("Skip non readable property: " + property.getName());
+         return process;
+      }      
+      return true;
+   }
+   
+   /**
+    * Get a map of persisted managed objects, with the property name as key.
+    * 
+    * @param persisted the persisted managed object
+    * @return a map of persisted properties
+    */
+   protected static Map<String, PersistedProperty> getPersistedProperties(PersistedManagedObject persisted)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("Null persisted managed object.");
+      
+      Map<String, PersistedProperty> properties = new HashMap<String, PersistedProperty>();
+      List<PersistedProperty> list = persisted.getProperties();
+      if(list == null)
+      {
+         list = new ArrayList<PersistedProperty>();
+         persisted.setProperties(list);
+      }
+      if(list.isEmpty() == false)
+      {
+         for(PersistedProperty p : list)
+            properties.put(p.getName(), p);
+      }
+      return properties;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectPersistence.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectRecreation.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectRecreation.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectRecreation.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,226 @@
+/*
+ * 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.persistence;
+
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.profileservice.persistence.xml.PersistedValue;
+
+/**
+ * A abstract ManagedObject recreation helper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractManagedObjectRecreation
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(AbstractManagedObjectRecreation.class);
+   
+   /** The value recreation. */
+   private final AbstractValueRecreation valueRecreation;
+
+   public AbstractManagedObjectRecreation(AbstractValueRecreation valueRecreation)
+   {
+      this.valueRecreation = valueRecreation;
+   }
+   
+   public AbstractValueRecreation getValueRecreation()
+   {
+      return this.valueRecreation;
+   }
+   
+   /**
+    * Process the properties of the persisted ManagedObject.
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the ManagedObject
+    */
+   protected void processProperties(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      if(mo == null)
+         throw new IllegalArgumentException("null managed object");
+      
+      // Get the xml to see what we need to update
+      if(persisted.getProperties() != null && persisted.getProperties().isEmpty() == false)
+      {
+         for(PersistedProperty propertyElement : persisted.getProperties())
+         {
+            ManagedProperty property = mo.getProperty(propertyElement.getName());
+            if(property == null)
+               throw new IllegalStateException("unable to find propery: "+ propertyElement.getName());
+
+            // getProperty
+            processManagedProperty(propertyElement, property, mo.getAttachment());
+         }  
+      }
+   }
+
+   /**
+    * Process a managed property and set it's values to the attachment.
+    * 
+    * @param persisted the persisted property
+    * @param property the managed property
+    * @param attachment the attachment
+    * @return the meta value of this property
+    */
+   protected MetaValue processManagedProperty(PersistedProperty persisted, ManagedProperty property, Object attachment)
+   {
+      if(attachment == null)
+         throw new IllegalArgumentException("null attachment");
+      
+      // Get the property name
+      String name = property.getMappedName() != null ? property.getMappedName() : property.getName();
+      // Process the property
+      MetaValue metaValue = processManagedProperty(persisted, property);
+      // Set value
+      setValue(name, property, attachment);
+      // Return
+      return metaValue;
+   }
+   
+   /**
+    * Set the value to the managed property/
+    * 
+    * @param name the property name
+    * @param property the managed property itself
+    * @param attachment the attachment
+    */
+   protected abstract void setValue(String name, ManagedProperty property, Object attachment);
+   
+   /**
+    * Process the managed property.
+    * 
+    * @param persisted the persisted property
+    * @param property the managed property
+    * @return the value
+    */
+   protected MetaValue processManagedProperty(PersistedProperty persisted, ManagedProperty property)
+   {
+      return processManagedProperty(persisted, property, false);
+   }
+   
+   /**
+    * Process the managed property.
+    * 
+    * @param persisted the persisted property
+    * @param property the managed property
+    * @param trace enable trace logs
+    * @return the value
+    */
+   protected MetaValue processManagedProperty(PersistedProperty persisted, ManagedProperty property, boolean trace)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted property");
+      if(property == null)
+         throw new IllegalArgumentException("null managed property");
+
+      MetaValue metaValue = property.getValue();
+      PersistedValue persistedValue = persisted.getValue();
+      if(persistedValue != null && isProcessProperty(property, trace))
+      {
+         MetaType metaType = property.getMetaType();
+         if(metaValue != null)
+            metaType = metaValue.getMetaType();
+
+         // Create the value based on the persisted information
+         metaValue = createValue(persistedValue, metaType);
+
+         // Update property
+         property.setField(Fields.VALUE, metaValue);
+         if(metaValue != null)
+            property.setField(Fields.META_TYPE, metaValue.getMetaType());
+      }
+      return metaValue;
+   }
+   
+   /**
+    * Call the value recreation to recreate a persisted value.
+    * 
+    * @param value the persisted value
+    * @param metaType the meta type
+    * @return the meta value
+    */
+   protected MetaValue createValue(PersistedValue value, MetaType metaType)
+   {
+      return getValueRecreation().createMetaValue(value, metaType);
+   }
+   
+   /**
+    * Does this property needs to be processed.
+    * 
+    * @param property the managed property
+    * @param trace enable trace logs
+    * @return false if the property does not need to be processed otherwise true
+    */
+   protected boolean isProcessProperty(ManagedProperty property, boolean trace)
+   {
+      // 
+      boolean process = false;
+      if(property == null)
+         return process;
+      
+      // Skip non configuration properties
+      if(property.hasViewUse(ViewUse.CONFIGURATION) == false)
+      {
+         if(trace)
+            log.trace("Skip non configuration property: " + property.getName());
+         return process;
+      }
+      // Skip read only properties
+      if(property.isReadOnly())
+      {
+         if(trace)
+            log.trace("Skip readOnly property: " + property.getName());
+         return process;
+      }
+      // Skip removed properties
+      if(property.isRemoved())
+      {
+         if(trace)
+            log.trace("Skip removed property: " + property.getName());
+         return process;
+      }
+      // Skip read only properties
+      PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+      if(propertyInfo != null && propertyInfo.isReadable() == false)
+      {
+         if(trace)
+            log.trace("Skip non readable property: " + property.getName());
+         return process;
+      }
+      return true;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractManagedObjectRecreation.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractPersistenceFactory.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractPersistenceFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractPersistenceFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,349 @@
+/*
+ * 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.persistence;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.profileservice.persistence.component.ComponentMapper;
+import org.jboss.profileservice.persistence.component.ComponentMapperRegistry;
+import org.jboss.profileservice.persistence.xml.ModificationInfo;
+import org.jboss.profileservice.persistence.xml.PersistedComponent;
+import org.jboss.profileservice.persistence.xml.PersistenceRoot;
+
+/**
+ * The abstract persistence factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractPersistenceFactory extends PersistenceFactory 
+{
+
+   /** The component mapper registry. */
+   private final ComponentMapperRegistry componentMapper = ComponentMapperRegistry.getInstance();
+
+   /** The delegating persistence plugin. */
+   private final DelegatingPersistencePlugin persistencePlugin;
+   
+   /** The recreation helper. */
+   private final ManagedObjectRecreationHelper recreationHelper;
+   
+   public AbstractPersistenceFactory()
+   {
+      this(ManagedObjectFactory.getInstance());
+   }
+   
+   public AbstractPersistenceFactory(ManagedObjectFactory managedObjectFactory)
+   {
+      super(managedObjectFactory);
+      this.recreationHelper = new ManagedObjectRecreationHelper(managedObjectFactory);
+      this.persistencePlugin = new DelegatingPersistencePlugin(recreationHelper);
+   }
+   
+   /**
+    * {@inheritDoc}
+    */
+   public ManagedObjectPersistencePlugin getPersistencePlugin()
+   {
+      return persistencePlugin;
+   }
+   
+   /**
+    * Apply the persisted information to a attachment.
+    * 
+    * @param root the persistence root
+    * @param attachment the root attachment
+    * @param classLoader the classloader
+    */
+   @Override
+   public void restorePersistenceRoot(PersistenceRoot root, Object parentAttachment, ClassLoader classLoader)
+   {
+      if(root == null)
+         throw new IllegalArgumentException("null root");
+      if(parentAttachment == null)
+         throw new IllegalArgumentException("null attachment");
+      
+      if(root.getComponents() != null && root.getComponents().isEmpty() == false)
+      {
+         // Set the classloader
+         recreationHelper.setLoader(classLoader);
+         try
+         {
+            // Restore the components
+            ComponentMapper mapper = getComponentMapper(root);
+            for(PersistedComponent component : root.getComponents())
+            {
+               mapper.restoreComponent(parentAttachment, component);
+            }
+         }
+         finally
+         {
+            recreationHelper.setLoader(null);
+         }
+      }
+   }
+   
+   /**
+    * Add a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   @Override
+   public PersistenceRoot addComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component)
+   {
+      if(root == null)
+         throw new IllegalArgumentException("null persistence root");
+      ComponentMapper mapper = getComponentMapper(parent);
+      PersistedComponent persistedComponent = mapper.addComponent(parent.getAttachment(), component);
+      return addPersistedComponent(root, persistedComponent);
+   }
+
+   /**
+    * Remove a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   @Override
+   public PersistenceRoot removeComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component)
+   {
+      if(root == null)
+         throw new IllegalArgumentException("null persistence root");
+      
+      ComponentMapper mapper = getComponentMapper(parent);
+      PersistedComponent persistedComponent = mapper.removeComponent(parent.getAttachment(), component);
+      return addPersistedComponent(root, persistedComponent);
+   }
+
+   /**
+    * Update a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   @Override
+   public PersistenceRoot updateComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component)
+   {
+      if(root == null)
+         throw new IllegalArgumentException("null persistence root");
+      
+      ComponentMapper mapper = getComponentMapper(parent);
+      PersistedComponent persistedComponent = mapper.updateComponent(parent.getAttachment(), component);
+      return addPersistedComponent(root, persistedComponent);
+   }
+
+   /**
+    * Reset a component. This will remove the persisted information.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   @Override
+   public PersistenceRoot resetComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component)
+   {
+      ComponentMapper mapper = getComponentMapper(parent);
+      PersistedComponent persistedComponent = mapper.updateComponent(parent.getAttachment(), component);
+      // Map the components
+      Map<String, PersistedComponent> components = mapComponents(root);
+      // Remove the component
+      PersistedComponent previous = components.remove(persistedComponent.getOriginalName());
+      if(previous == null)
+         previous = components.remove(persistedComponent.getName());
+      // Set the new values
+      root.setComponents(new ArrayList<PersistedComponent>(components.values()));
+      return root;
+   }
+   
+   /**
+    * Add a persisted component to the root. This will map and override
+    * existing components.
+    * 
+    * @param root the persistence root
+    * @param component the persisted component
+    * @return the update persistence root
+    */
+   protected PersistenceRoot addPersistedComponent(PersistenceRoot root, PersistedComponent component)
+   {
+      Map<String, PersistedComponent> components = mapComponents(root);
+      PersistedComponent previous = components.remove(component.getOriginalName());
+      if(previous == null)
+         previous = components.remove(component.getName());
+      // Add the persisted component
+      components.put(component.getName(), component);
+      
+      // Override with some previous information
+      if(previous != null)
+      {
+         // A added component should remain on added
+         if(previous.getModificationInfo() == ModificationInfo.ADDED
+               && component.getModificationInfo() == ModificationInfo.MODIFIED)
+            component.setModificationInfo(ModificationInfo.ADDED);
+         
+         // Just remove a previously added component
+         if(previous.getModificationInfo() == ModificationInfo.ADDED
+               && component.getModificationInfo() == ModificationInfo.REMOVED)
+            components.remove(component.getName());
+         
+         // Override the name
+         if(previous.getOriginalName() != null)
+            component.setOriginalName(previous.getOriginalName());         
+      }
+      
+      root.setComponents(new ArrayList<PersistedComponent>(components.values()));
+      return root;
+   }
+
+   /**
+    * Get the component mapper for a given ManagedObject.
+    * 
+    * @param parent the managed object
+    * @return the component mapper
+    * @throws IllegalStateException if no mapper is registered for this type
+    */
+   protected ComponentMapper getComponentMapper(ManagedObject parent)
+   {
+      ComponentMapper mapper = null;
+      if(parent.getAttachmentName() != null)
+         mapper = getComponentMapper(parent.getAttachmentName());
+      if(mapper == null && parent.getAttachment() != null)
+         mapper = getComponentMapper(parent.getAttachment().getClass().getName());
+
+      if(mapper == null)
+         throw new IllegalStateException("no mapper registered for type: " + parent.getAttachmentName());
+      
+      return mapper;
+   }
+   
+   /**
+    * Get the component mapper for a persistence root.
+    * 
+    * @param root the persistence root
+    * @return the component mapper
+    * @throws IllegalStateException if no mapper is registered for this type
+    */
+   protected ComponentMapper getComponentMapper(PersistenceRoot root)
+   {
+      ComponentMapper mapper = null;
+      if(root.getName() != null)
+         mapper = getComponentMapper(root.getName());
+      if(root.getClassName() != null)
+         mapper = getComponentMapper(root.getClassName());
+      
+      if(mapper == null)
+         throw new IllegalStateException("no mapper registered for type: " + root);
+      
+      return mapper;
+   }
+   
+   /**
+    * Get the component mapper for a given type.
+    * 
+    * @param type the type
+    * @return the component mapper, null if not registered
+    * @throw IllegalArgumentException for a null type
+    */
+   protected ComponentMapper getComponentMapper(String type)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null type");
+
+      return componentMapper.getMapper(type);
+   }
+   
+   /**
+    * Map the components based on their names.
+    * 
+    * @param root the persistence root
+    * @return a map of persisted components
+    */
+   protected static Map<String, PersistedComponent> mapComponents(PersistenceRoot root)
+   {
+      Map<String, PersistedComponent> map = new HashMap<String, PersistedComponent>();
+      if(root.getComponents() != null && root.getComponents().isEmpty() == false)
+      {
+         for(PersistedComponent component : root.getComponents())
+         {
+            // Map this based on the name, as this should 
+            // match the original name of the new component
+            map.put(component.getName(), component);
+         }
+      }
+      return map;
+   }
+
+   /**
+    * InstallCallback for adding a component mapper.
+    * 
+    * @param mapper the component mapper
+    */
+   public void addComponentMapper(ComponentMapper mapper)
+   {
+      componentMapper.addMapper(mapper);
+   }
+   
+   /**
+    * UnInstallCallback for removing a component mapper.
+    * 
+    * @param mapper the component mapper
+    * @return the removed component mapper
+    */
+   public ComponentMapper removeComponentMapper(ComponentMapper mapper)
+   {
+      return componentMapper.removeComponentMapper(mapper);
+   }
+   
+   /**
+    * InstallCallback for adding a persistence plugin.
+    * 
+    * @param plugin the persistence plugin
+    */
+   public void addPersistencePlugin(ManagedObjectPersistencePlugin plugin)
+   {
+      persistencePlugin.addPlugin(plugin);
+   }
+   
+   /**
+    * UnInstallCallback for removing a persistence plugin.
+    * 
+    * @param plugin the plugin
+    */
+   public void removePersistencePlugin(ManagedObjectPersistencePlugin plugin)
+   {
+      persistencePlugin.removePlugin(plugin);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractPersistenceFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValuePersistence.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValuePersistence.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValuePersistence.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,479 @@
+/*
+ * 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.persistence;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.TableValue;
+import org.jboss.profileservice.persistence.xml.NullValue;
+import org.jboss.profileservice.persistence.xml.PersistedArrayValue;
+import org.jboss.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.profileservice.persistence.xml.PersistedCompositeValue;
+import org.jboss.profileservice.persistence.xml.PersistedEnumValue;
+import org.jboss.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedPair;
+import org.jboss.profileservice.persistence.xml.PersistedPropertiesValue;
+import org.jboss.profileservice.persistence.xml.PersistedSimpleValue;
+import org.jboss.profileservice.persistence.xml.PersistedTableValue;
+import org.jboss.profileservice.persistence.xml.PersistedValue;
+
+/**
+ * The AbstractValuePersistence creates a xml representation of MetaValues
+ * which are used for the ProfileService attachment persistence.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractValuePersistence
+{
+   
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(AbstractValuePersistence.class);
+
+   /** The meta value factory. */
+   private final MetaValueFactory metaValueFactory;
+   
+   /** The plugin. */
+   private final ManagedObjectPersistencePlugin plugin;
+   
+   public AbstractValuePersistence(ManagedObjectPersistencePlugin callback, MetaValueFactory metaValueFactory)
+   {
+      if(callback == null)
+         throw new IllegalArgumentException("Null managed object persistence callback.");
+      if(metaValueFactory == null)
+         throw new IllegalArgumentException("Null meta value factory.");
+      
+      this.plugin = callback;
+      this.metaValueFactory = metaValueFactory;
+   }
+   
+   /**
+    * Get the meta value factory.
+    * 
+    * @return the meta value factory
+    */
+   public MetaValueFactory getMetaValueFactory()
+   {
+      return this.metaValueFactory;
+   }
+   
+   protected ManagedObjectPersistencePlugin getPlugin()
+   {
+      return this.plugin;
+   }
+   
+   /**
+    * Create the peristed xml meta data.
+    * 
+    * @param value the meta value
+    * @param metaType the meta type
+    * @return the xml value
+    */
+   protected PersistedValue createPersistedValue(MetaValue value, MetaType metaType)
+   {
+      return createPersistedValue(value, metaType, null);
+   }
+   
+   /**
+    * Create the peristed xml meta data.
+    * 
+    * @param value the meta value
+    * @param metaType the meta type
+    * @param persisted
+    * @return the xml value.
+    */
+   protected PersistedValue createPersistedValue(MetaValue value, MetaType metaType, PersistedValue persisted)
+   {
+      if(log.isTraceEnabled())
+         log.trace("creating persisted value for : " + value + " with metaType " + metaType);
+      
+      if(value == null)
+         return new NullValue();
+
+      // Override the metaType e.g. the MapCompositeValueSupport
+      metaType = value.getMetaType();
+
+
+      PersistedValue persistedValue = null;
+      if(metaType.isSimple())
+      {
+         persistedValue = createSimpleValue(
+               (SimpleValue) value);
+      }
+      else if(metaType.isEnum())
+      {
+         persistedValue = createEnumValue(
+               (EnumValue) value);
+      }
+      else if(metaType.isCollection())
+      {
+         persistedValue = createCollectionValue(
+               (CollectionValue) value);
+      }
+      else if(metaType.isGeneric())
+      {
+         persistedValue = createGenericValue(
+               (GenericValue) value);
+      }
+      else if(metaType.isComposite())
+      {
+         persistedValue = createCompositeValue(
+               (CompositeValue) value,
+               (CompositeMetaType) metaType);
+      }
+      else if(metaType.isArray())
+      {
+         persistedValue = createArrayValue(
+               (ArrayValue) value,
+               (ArrayMetaType) metaType);
+      }
+      else if(metaType.isTable())
+      {
+         persistedValue = createTableValue(
+               (TableValue) value);
+      }
+      else if(metaType.isProperties())
+      {
+         persistedValue = createPropertiesValue(
+               (PropertiesMetaValue) value);
+      }
+      else
+      {
+         throw new IllegalStateException("unknown metaType");
+      }
+      return persistedValue;
+   }
+   
+
+   /**
+    * Create the persistence enum value.
+    * 
+    * @param value the enum value
+    * @return the enum xml meta data
+    */
+   protected PersistedEnumValue createEnumValue(EnumValue value)
+   {
+      PersistedEnumValue persistedValue = new PersistedEnumValue();
+      persistedValue.setValue(value.getValue());
+      return persistedValue;
+   }
+
+   /**
+    * Create the persistence simple value.
+    * 
+    * @param value the simple value
+    * @return the simple xml meta data
+    */
+   protected PersistedSimpleValue createSimpleValue(SimpleValue value)
+   {
+      PersistedSimpleValue persistedValue = new PersistedSimpleValue();
+      persistedValue.setValue(convertSimple2String(value));
+      return persistedValue;
+   }
+   
+   /**
+    * Create the persistence collection value.
+    * 
+    * @param value the collection value
+    * @return the collection xml meta data
+    */
+   protected PersistedCollectionValue createCollectionValue(CollectionValue value)
+   {
+      PersistedCollectionValue collection = new PersistedCollectionValue();
+      for(MetaValue child : value.getElements())
+      {
+         PersistedValue persistedValue = createPersistedValue(child, child.getMetaType());
+         collection.addValue(persistedValue);
+      }
+      return collection;
+   }
+
+   /**
+    * Create the persistence generic value.
+    * 
+    * @param value the generic value
+    * @return the generic xml meta data
+    */
+   protected PersistedGenericValue createGenericValue(GenericValue value)
+   {
+      //
+      PersistedGenericValue generic = new PersistedGenericValue();
+      return createGenericValue(value, generic);
+   }
+   
+   /**
+    * Create the persistence generic value.
+    * 
+    * @param value the generic value
+    * @param the persisted generic value
+    * @return the generic xml meta data
+    */
+   protected PersistedGenericValue createGenericValue(GenericValue value, PersistedGenericValue generic)
+   {
+      Object o = value.getValue();
+      if(o == null)
+         return generic;
+      
+      if(o instanceof ManagedObject)
+      {
+         PersistedManagedObject mo;
+         
+         if(generic.getManagedObject() == null)
+            mo = plugin.createPersistedManagedObject((ManagedObject) o);
+         else
+            mo = plugin.createPersistedManagedObject(generic.getManagedObject(), (ManagedObject) o);
+         
+         generic.setManagedObject(mo);
+      }
+      else
+      {
+         throw new IllegalStateException("The value of GenericValue must be a ManagedObject: " + value);
+      }
+      return generic;
+   }
+
+   /**
+    * Create the persistence array value.
+    * 
+    * @param value the array value
+    * @return
+    */
+   protected PersistedArrayValue createArrayValue(ArrayValue value, ArrayMetaType metaType)
+   {
+      //
+      PersistedArrayValue array = new PersistedArrayValue();
+      MetaType elementType = metaType.getElementType();
+      for (int i = 0; i < value.getLength(); i++)
+      {
+         PersistedValue persistedValue = null;
+         Object subElement = value.getValue(i);
+
+         if (subElement instanceof MetaValue)
+         {
+            persistedValue = createPersistedValue((MetaValue) subElement, elementType);
+         }
+         else if (subElement != null && subElement.getClass().isArray())
+         {
+            persistedValue = unwrapArray(array, subElement, elementType);
+         }
+         // Add to parent
+         array.addValue(persistedValue);
+      }
+      return array;
+   }
+   
+   /**
+    * Unwrap array.
+    * 
+    * @param array the parent array
+    * @param element the array value
+    * @param type the element meta type
+    * @return the persistence xml meta data
+    */
+   protected PersistedArrayValue unwrapArray(PersistedArrayValue array, Object element, MetaType type)
+   {
+      PersistedArrayValue newElement = new PersistedArrayValue();
+      int subSize = Array.getLength(element);
+      for (int i = 0; i < subSize; i++)
+      {
+         PersistedValue persistedValue = null;
+         Object subElement = Array.get(element, i);
+         if (subElement instanceof MetaValue)
+         {
+            persistedValue = createPersistedValue((MetaValue) subElement, type);
+         }
+         else if (subElement != null && subElement.getClass().isArray())
+         {
+            persistedValue = unwrapArray(newElement, subElement, type);
+         }
+
+         newElement.addValue(persistedValue);
+      }
+      return newElement;
+   }
+   
+   /**
+    * Create the persistence composite value.
+    * 
+    * @param value the composite value
+    * @param metaType the composite meta type
+    * @param the persisted composite value
+    * @return the persistence composite xml meta data
+    */
+   protected PersistedCompositeValue createCompositeValue(CompositeValue value, CompositeMetaType metaType)
+   {
+      PersistedCompositeValue composite = new PersistedCompositeValue();
+      // Fix the values
+      List<PersistedValue> values = composite.getValues();
+      if(values == null)
+      {
+         values = new ArrayList<PersistedValue>();
+         composite.setValues(values);
+      }
+      for(String item : metaType.itemSet())
+      {
+         MetaType itemType = metaType.getType(item);
+         MetaValue itemValue = value.get(item);
+         
+         // Create item 
+         PersistedValue persistedValue = createPersistedValue(itemValue, itemType);
+         persistedValue.setName(item);
+         
+         values.add(persistedValue);
+      }
+      return composite;
+   }
+   
+   /**
+    * Create the persistence table value.
+    * 
+    * @param value the table value
+    * @param the persisted table
+    * @return the persistence table xml meta data
+    */   
+   protected PersistedTableValue createTableValue(TableValue value)
+   {
+      PersistedTableValue table = new PersistedTableValue();
+      // Fix the entries
+      List<PersistedCompositeValue> entries = table.getEntries();
+      if(entries == null)
+      {
+         entries = new ArrayList<PersistedCompositeValue>();
+         table.setEntries(entries);
+      }
+      // Process values
+      Collection<CompositeValue> values = value.values();
+      for(CompositeValue entry : values)
+      {
+         entries.add(createCompositeValue(entry, entry.getMetaType()));
+      }
+      return table;
+   }
+   
+   /**
+    * Create the persistence properties value.
+    * 
+    * @param value the properties value
+    * @param the persisted properties
+    * @return the persistence properties xml meta data
+    */
+   protected PersistedValue createPropertiesValue(PropertiesMetaValue value)
+   {
+      PersistedPropertiesValue properties = new PersistedPropertiesValue();
+      List<PersistedPair> pairs = properties.getEntries();
+      if(pairs == null)
+      {
+         pairs = new ArrayList<PersistedPair>();
+         properties.setEntries(pairs);
+      }
+      for(Object key : value.keySet())
+      {
+         Object kvalue = value.get(key);
+         PersistedPair pair = new PersistedPair(key.toString(), kvalue.toString());
+         pairs.add(pair);
+      }
+      return properties;
+   }
+
+   /**
+    * Create a emtpy xml meta data, based on the meta type
+    * 
+    * @param metaType the meta type
+    * @return the peristence value
+    */
+   protected static PersistedValue emtpyPersistedValue(MetaType metaType)
+   {
+      if(metaType.isSimple())
+      {
+         return new PersistedSimpleValue(); 
+      }
+      else if(metaType.isEnum())
+      {
+         return new PersistedEnumValue();
+      }
+      else if(metaType.isCollection())
+      {
+         return new PersistedCollectionValue();
+      }
+      else if(metaType.isGeneric())
+      {
+         return new PersistedGenericValue();
+      }
+      else if(metaType.isComposite())
+      {
+         return new PersistedCompositeValue();
+      }
+      else if(metaType.isTable())
+      {
+         return new PersistedTableValue();
+      }
+      else if(metaType.isArray())
+      {
+         return new PersistedArrayValue();
+      }
+      else if(metaType.isProperties())
+      {
+         return new PersistedPropertiesValue();
+      }
+      else
+      {
+         throw new IllegalStateException("unknown metaType");
+      }
+   }
+   
+   /**
+    * Convert a simple meta value to a String.
+    * 
+    * @param value the simple meta value.
+    * @return the string.
+    */
+   protected String convertSimple2String(SimpleValue value)
+   {       
+      if(value == null)
+         throw new IllegalArgumentException("Null value.");
+      
+      Object unwrappedValue = getMetaValueFactory().unwrap(value);
+      if(unwrappedValue == null)
+         return null; 
+      // Convert to String
+      return ("" + unwrappedValue);
+   }
+   
+}
\ No newline at end of file


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValuePersistence.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValueRecreation.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValueRecreation.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValueRecreation.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,479 @@
+/*
+ * 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.persistence;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.EnumMetaType;
+import org.jboss.metatype.api.types.GenericMetaType;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.Name;
+import org.jboss.metatype.api.types.PropertiesMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.types.TableMetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.ArrayValueSupport;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.EnumValueSupport;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.TableValue;
+import org.jboss.metatype.api.values.TableValueSupport;
+import org.jboss.metatype.plugins.types.StringName;
+import org.jboss.profileservice.persistence.xml.NullValue;
+import org.jboss.profileservice.persistence.xml.PersistedArrayValue;
+import org.jboss.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.profileservice.persistence.xml.PersistedCompositeValue;
+import org.jboss.profileservice.persistence.xml.PersistedEnumValue;
+import org.jboss.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.profileservice.persistence.xml.PersistedPair;
+import org.jboss.profileservice.persistence.xml.PersistedPropertiesValue;
+import org.jboss.profileservice.persistence.xml.PersistedSimpleValue;
+import org.jboss.profileservice.persistence.xml.PersistedTableValue;
+import org.jboss.profileservice.persistence.xml.PersistedValue;
+import org.jboss.reflect.plugins.ValueConvertor;
+
+/**
+ * The abstract value recreation creates MetaValues based on the persisted
+ * managed object information and the MetaTypes of the ManagedObject used
+ * for persistence. The recreation of ManagedObjects itself is delegated
+ * to a ManagedObjectRecreationPlugin.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractValueRecreation
+{
+   
+   /** The simple types. */
+   private final static Map<String, Class<? extends Serializable>> simpleTypes = new HashMap<String, Class<? extends Serializable>>();
+   
+   /** The logger. */
+   private final static Logger log = Logger.getLogger(AbstractValueRecreation.class);
+   
+   /** The recreation plugin. */
+   private final ManagedObjectPersistencePlugin plugin;
+   
+   static
+   {
+      // Fill simple types map.
+      simpleTypes.put(BigDecimal.class.getName(), BigDecimal.class);
+      simpleTypes.put(BigInteger.class.getName(), BigInteger.class);
+      simpleTypes.put(Boolean.class.getName(), Boolean.class);
+      simpleTypes.put(Byte.class.getName(), Byte.class);
+      simpleTypes.put(Character.class.getName(), Character.class);
+      simpleTypes.put(Date.class.getName(), Date.class);
+      simpleTypes.put(Double.class.getName(), Double.class);
+      simpleTypes.put(Float.class.getName(), Float.class);
+      simpleTypes.put(Integer.class.getName(), Integer.class);
+      simpleTypes.put(Long.class.getName(), Long.class);
+      simpleTypes.put(Short.class.getName(), Short.class);
+      simpleTypes.put(String.class.getName(), String.class);
+      simpleTypes.put(Name.class.getName(), Name.class);
+      // primitive classes
+      simpleTypes.put(byte.class.getName(), byte.class);
+      simpleTypes.put(char.class.getName(), char.class);
+      simpleTypes.put(double.class.getName(), double.class);
+      simpleTypes.put(float.class.getName(), float.class);
+      simpleTypes.put(int.class.getName(), int.class);
+      simpleTypes.put(short.class.getName(), short.class);
+      simpleTypes.put(long.class.getName(), long.class);
+      simpleTypes.put(boolean.class.getName(), boolean.class);
+   }
+   
+   public AbstractValueRecreation(ManagedObjectPersistencePlugin callback)
+   {
+      if(callback == null)
+         throw new IllegalArgumentException("null managed object persistence callback");
+      
+      this.plugin = callback;
+   }
+   
+   public ManagedObjectPersistencePlugin getPlugin()
+   {
+      return plugin;
+   }
+   
+   /**
+    * Create the meta value, based on the xml persisted
+    * value and the generated MetaType.
+    * 
+    * @param valueElement the persisted xml element
+    * @param type the meta type
+    * @return the created meta value
+    */
+   public MetaValue createMetaValue(PersistedValue valueElement, MetaType metaType)
+   {
+      if(log.isTraceEnabled())
+      {
+         log.trace("processing value " + valueElement + " type: " + metaType);
+      }
+      
+      if(valueElement instanceof NullValue)
+         return null;
+      
+      if(valueElement == null)
+         return null;
+      
+      MetaValue metaValue = null;
+      try
+      {
+         if(metaType.isSimple())
+         {
+            metaValue = createSimpleValue(
+                  (PersistedSimpleValue) valueElement,
+                  (SimpleMetaType) metaType);
+         }
+         else if(metaType.isEnum())
+         {
+            metaValue = createEnumValue(
+                  (PersistedEnumValue) valueElement,
+                  (EnumMetaType) metaType);
+         }
+         else if(metaType.isCollection())
+         {
+            metaValue = createCollectionValue(
+                  (PersistedCollectionValue) valueElement,
+                  (CollectionMetaType) metaType);
+         }
+         else if(metaType.isGeneric())
+         {
+            metaValue = createGenericValue(
+                  (PersistedGenericValue) valueElement,
+                  (GenericMetaType) metaType);
+         }
+         else if(metaType.isComposite())
+         {
+            metaValue = createCompositeValue(
+                  (PersistedCompositeValue) valueElement,
+                  (CompositeMetaType) metaType);
+         }
+         else if(metaType.isTable())
+         {
+            metaValue = createTableValue(
+                  (PersistedTableValue) valueElement,
+                  (TableMetaType)metaType);
+         }
+         else if(metaType.isArray())
+         {
+            metaValue = createArrayValue(
+                  (PersistedArrayValue) valueElement,
+                  (ArrayMetaType) metaType);
+         }
+         else if(metaType.isProperties())
+         {
+            metaValue = createPropertiesValue(
+                  (PersistedPropertiesValue) valueElement,
+                  (PropertiesMetaType) metaType);
+         }
+         else
+         {
+            throw new IllegalStateException("unknown metaType");
+         }
+      }
+      finally
+      {
+         //
+      }
+      return metaValue;
+   }
+   
+   /**
+    * Create simple value.
+    * 
+    * @param valueElement the persisted xml meta data
+    * @param value the simple value
+    * @return a simple value
+    */
+   protected SimpleValue createSimpleValue(PersistedSimpleValue valueElement, SimpleMetaType metaType)
+   {
+      String elementValue = valueElement.getValue();
+      
+      Serializable converted = null;
+      if(elementValue != null)
+      {
+         if(metaType.equals(SimpleMetaType.STRING))
+         {
+            converted = (String) elementValue;
+         }
+         else if (metaType.equals(SimpleMetaType.NAMEDOBJECT))
+         {
+            converted = new StringName(elementValue);
+         }
+         else if (metaType.equals(SimpleMetaType.VOID))
+         {  
+            // 
+         }
+         else
+         {
+            converted = convert2Type(metaType.getTypeName(), elementValue);
+         }
+      }
+      return new SimpleValueSupport(metaType, converted);
+   }
+ 
+   /**
+    * Process an Enum value.
+    * 
+    * @param enumElement the persisted xml meta data
+    * @param value the enum value
+    * @return a enum value
+    */
+   protected EnumValue createEnumValue(PersistedEnumValue enumElement, EnumMetaType type)
+   {
+      return new EnumValueSupport(type, enumElement.getValue());
+   }
+   
+   /**
+    * Create composite value.
+    * 
+    * @param composite the persisted xml meta data
+    * @param value the composite value
+    * @return a composite value
+    */
+   protected CompositeValue createCompositeValue(PersistedCompositeValue composite, CompositeMetaType type)
+   {
+      // Handle the mapCompositeMetaType differently
+      if(type instanceof MapCompositeMetaType)
+         return handleMapCompositeMetaType(composite, (MapCompositeMetaType) type);
+      
+      // Create composite value
+      Map<String, MetaValue> values = new HashMap<String, MetaValue>();
+      if(composite.getValues() != null && composite.getValues().isEmpty() == false)
+      {
+         for(PersistedValue persistedValue : composite.getValues())
+         {
+            MetaType elementType = type.getType(persistedValue.getName());
+            if(elementType == null)
+               throw new IllegalStateException("Failed to process composite value: " + persistedValue.getName());
+            
+            // Create
+            MetaValue metaValue = createMetaValue(persistedValue, elementType);
+            // Put
+            values.put(persistedValue.getName(), metaValue);
+         }
+      }     
+      return new CompositeValueSupport(type, values);
+   }
+
+   /**
+    * Create the MapCompositeValueSupport value.
+    * 
+    * @param composite the persisted composite xml meta data
+    * @param type the MapComposite meta type
+    * @return the MapCompositeValueSupport
+    */
+   protected MapCompositeValueSupport handleMapCompositeMetaType(PersistedCompositeValue composite, MapCompositeMetaType type)
+   {
+      Map<String, MetaValue> values = new HashMap<String, MetaValue>();
+      if(composite.getValues() != null && composite.getValues().isEmpty() == false)
+      {
+         for(PersistedValue persistedValue : composite.getValues())
+         {
+            MetaValue value = createMetaValue(persistedValue, type.getValueType());
+            values.put(persistedValue.getName(), value);
+         }
+      }
+      return new MapCompositeValueSupport(values, type);
+   }
+   
+   /**
+    * Process a collection.
+    * 
+    * @param collection the persisted xml meta data
+    * @param value the collection value
+    * @return a collection value
+    */
+   protected CollectionValue createCollectionValue(PersistedCollectionValue collection, CollectionMetaType type)
+   {
+      List<MetaValue> elementList = new ArrayList<MetaValue>();
+      if(collection.getValues() != null && collection.getValues().isEmpty() == false)
+      {
+         for(PersistedValue element : collection.getValues())
+         {
+            elementList.add(
+                  createMetaValue(element, type.getElementType()));
+         }  
+      }
+      return new CollectionValueSupport(type, elementList.toArray(new MetaValue[elementList.size()]));
+   }
+   
+   /**
+    * Create generic value. 
+    * 
+    * @param genericElement the persisted generic xml meta data 
+    * @param metaType the generic meta type
+    * @return the generic value
+    */
+   protected GenericValue createGenericValue(PersistedGenericValue genericElement, GenericMetaType metaType)
+   {
+      Serializable value = null;
+      if(genericElement.getManagedObject() != null)
+      {
+         value = getPlugin().createManagedObject(genericElement.getManagedObject());
+      }
+      return new GenericValueSupport(metaType, value);
+   }
+   
+   /**
+    * Create the table value.
+    * 
+    * @param table the persisted table value
+    * @param type the table meta type
+    * @return the table value
+    */
+   protected TableValue createTableValue(PersistedTableValue table, TableMetaType type)
+   {
+      TableValueSupport support = new TableValueSupport(type);
+      if(table.getEntries() != null && table.getEntries().isEmpty() == false)
+      {
+         for(PersistedCompositeValue entry : table.getEntries())
+         {
+            support.put(createCompositeValue(entry, type.getRowType()));
+         }         
+      }
+      return support;
+   }
+   
+   /**
+    * Create the properties value.
+    * 
+    * @param value the persisted properties value
+    * @param metaType the properties meta type
+    * @return the properties value
+    */
+   protected MetaValue createPropertiesValue(
+         PersistedPropertiesValue value, PropertiesMetaType metaType)
+   {
+      PropertiesMetaValue properties = new PropertiesMetaValue();
+      for(PersistedPair pair : value.getEntries())
+      {
+         properties.setProperty(pair.getKey(), pair.getValue());
+      }
+
+      return properties;
+   }
+
+   /**
+    * Create array value.
+    * 
+    * @param valueElement the persisted array xml value
+    * @param type the array meta type 
+    * @return the array value
+    */
+   @SuppressWarnings("unchecked")
+   protected ArrayValue createArrayValue(PersistedArrayValue valueElement, ArrayMetaType type)
+   {
+      int size = valueElement.size();
+      List values = new ArrayList(size);
+      for(PersistedValue elementValue : valueElement.getValues())
+      {
+         if(elementValue instanceof PersistedArrayValue)
+         {
+            values.add(
+                  recreateArrayValue((PersistedArrayValue) elementValue, type.getElementType()));
+         }
+         else
+         {
+            MetaValue value = createMetaValue(elementValue, type.getElementType());
+            values.add(value);
+         }
+      }
+      return new ArrayValueSupport(type, values.toArray());
+   }
+
+   /**
+    * Recreate the array values.
+    * 
+    * @param valueElement the persisted xml value
+    * @param type the element type
+    * @return the recreated array
+    */
+   @SuppressWarnings("unchecked")
+   protected Object recreateArrayValue(PersistedArrayValue valueElement, MetaType type)
+   {
+      List values = new ArrayList(valueElement.size());
+      for(PersistedValue elementValue : valueElement.getValues())
+      {
+         if(elementValue instanceof PersistedArrayValue)
+         {
+            values.add(
+                  recreateArrayValue((PersistedArrayValue) elementValue, type));
+         }
+         else
+         {
+            MetaValue value = createMetaValue(elementValue, type);
+            values.add(value);
+         }
+      }
+      return values.toArray();
+   }
+   
+   /**
+    * Convert simple types.
+    * 
+    * @param clazz a primitive serializable class.
+    * @param value the String
+    * @return the converted object, null in case of any failure.
+    */
+   public Serializable convert2Type(String className, String value)
+   {
+      if(value == null)
+         return null;
+      
+      Class<?> clazz = simpleTypes.get(className);
+      if(clazz == null)
+         throw new IllegalStateException("Cannot find simple type entry for "+ value + " and class "+ className);
+      
+      try
+      {
+         return (Serializable) ValueConvertor.convertValue(clazz, value);
+      }
+      catch(Throwable t)
+      {
+         log.debug("could convert "+ value +" to " + clazz.getName());
+         return null;
+      }
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AbstractValueRecreation.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AttachmentPropertyPopulator.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AttachmentPropertyPopulator.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AttachmentPropertyPopulator.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,220 @@
+/*
+ * 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.persistence;
+
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.WeakHashMap;
+
+import javax.management.ObjectName;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.config.plugins.property.PropertyConfiguration;
+import org.jboss.config.spi.Configuration;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.InstanceFactory;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.plugins.values.ListInstanceFactory;
+import org.jboss.metatype.plugins.values.SetInstanceFactory;
+import org.jboss.metatype.plugins.values.SortedSetInstanceFactory;
+import org.jboss.metatype.spi.values.MetaMapper;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ * The AttachmentPropertyPopulator, this writes the values of a 
+ * ManagedProperty to the attachment using a registered ICF.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AttachmentPropertyPopulator
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(AttachmentPropertyPopulator.class);
+   
+   /** The meta value factory. */
+   private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+   
+   /** The configuration */
+   private static final Configuration configuration;
+   
+   /** The managed object factory. */
+   private final ManagedObjectFactory managedObjectFactory;
+   
+   /** The helper. */
+   private final ManagedObjectRecreationHelper helper;
+   
+   /** The instance factory builders */
+   private Map<Class<?>, InstanceFactory<?>> instanceFactoryMap = new WeakHashMap<Class<?>, InstanceFactory<?>>();
+
+   static
+   {
+      configuration = AccessController.doPrivileged(new PrivilegedAction<Configuration>()
+      {
+         public Configuration run()
+         {
+            return new PropertyConfiguration();
+         }
+      });
+   }
+   
+   public <T> void setInstanceFactory(Class<T> clazz, InstanceFactory<T> factory)
+   {
+      synchronized(instanceFactoryMap)
+      {
+         if (factory == null)
+            instanceFactoryMap.remove(clazz);
+         else
+            instanceFactoryMap.put(clazz, factory);
+      }
+   }
+   
+   public AttachmentPropertyPopulator(ManagedObjectFactory managedObjectFactory,
+         ManagedObjectRecreationHelper helper)
+   {
+      if(managedObjectFactory == null)
+         throw new IllegalArgumentException("null managed object factory.");
+      if(helper == null)
+         throw new IllegalArgumentException("null helper");
+      
+      this.managedObjectFactory = managedObjectFactory;
+      this.helper = helper;
+      // set default collection instance factories
+      setInstanceFactory(List.class, ListInstanceFactory.INSTANCE);
+      setInstanceFactory(Set.class, SetInstanceFactory.INSTANCE);
+      setInstanceFactory(SortedSet.class, SortedSetInstanceFactory.INSTANCE);
+   }
+   
+   /**
+    * Process a ManagedProperty.
+    * 
+    * @param propertyElement the persisted xml meta data.
+    * @param name the property name.
+    * @param property the managed property.
+    * @param attachment the managed object attachment.
+    */
+   public void processManagedProperty(String name, ManagedProperty property, Object attachment) throws Throwable
+   {
+      boolean trace = log.isTraceEnabled();
+      PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);     
+      // Skip not writable properties
+      if (propertyInfo == null || propertyInfo.isWritable() == false)
+      {
+         if (trace)
+            log.debug("Skipping not writable property " + propertyInfo);
+         return;
+      }
+
+      // Get the meta data information
+      MetaType metaType = property.getMetaType();
+      MetaValue value = property.getValue();
+      if(value != null)
+         metaType = value.getMetaType();
+
+      MetaMapper<?> mapper = property.getTransientAttachment(MetaMapper.class);
+      if (mapper == null)
+      {
+         if(metaType.isComposite())
+         {
+            // FIXME skip CompositeValueInvocationHandler
+            if(metaType.getTypeName().equals(ObjectName.class.getName()) == false)
+            {
+               // unwrap
+               Object unwrapped = metaValueFactory.unwrap(value, propertyInfo.getType());
+               if(unwrapped != null)
+               {
+                  if (Proxy.isProxyClass(unwrapped.getClass()))
+                     throw new IllegalStateException("cannot unwrap composite value for property " + property.getName()
+                           + " maybe missing @MetaMapping? " + metaType.getTypeName());                  
+               }
+            }
+         }
+         else if(metaType.isCollection())
+         {
+            CollectionMetaType collectionMetaType = (CollectionMetaType) metaType;
+            if(collectionMetaType.getElementType() == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
+            {
+               // FIXME
+               Collection<?> newCollection = unwrapGenericCollection((CollectionValue) value, propertyInfo);
+               propertyInfo.set(attachment, newCollection);
+               return;
+            }
+         }
+      }
+      
+      // Set value
+      InstanceClassFactory icf = managedObjectFactory.getInstanceClassFactory(attachment.getClass(), null);
+      BeanInfo beanInfo = propertyInfo.getBeanInfo();
+      icf.setValue(beanInfo, property, attachment, value);
+   }
+   
+   @SuppressWarnings("unchecked")
+   protected Collection<?> unwrapGenericCollection(CollectionValue collection, PropertyInfo propertyInfo) throws Throwable
+   {
+      // Create a new collection        
+      BeanInfo beanInfo = configuration.getBeanInfo(propertyInfo.getType());
+      Collection newCollection = (Collection) createNewInstance(beanInfo);
+      
+      // unwrap generic collection
+      for(MetaValue value : collection.getElements())
+      {
+         ManagedObject o = (ManagedObject) ((GenericValue)value).getValue();
+         newCollection.add(o.getAttachment());
+      }
+      return newCollection;
+   }
+   
+   @SuppressWarnings("deprecation")
+   protected Object createNewInstance(BeanInfo beanInfo) throws Throwable
+   {
+      ClassInfo classInfo = beanInfo.getClassInfo();
+      if (classInfo.isInterface())
+      {
+         InstanceFactory<?> instanceFactory = instanceFactoryMap.get(classInfo.getType());
+         if (instanceFactory == null)
+            throw new IllegalArgumentException("Cannot instantiate interface BeanInfo, missing InstanceFactory: " + classInfo);
+
+         return instanceFactory.instantiate(beanInfo);
+      }
+      return beanInfo.newInstance();
+   }
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/AttachmentPropertyPopulator.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,96 @@
+/*
+ * 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.persistence;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * The default ManagedObject persistence plugin. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultManagedObjectPersistencePlugin implements ManagedObjectPersistencePlugin
+{
+
+   /** The default persistence delegate. */
+   private final DefaultPersistenceDelegate persistenceDelegate;
+   
+   /** The default recreation delegate. */
+   private final DefaultRecreationDelegate recreationDelegate;
+   
+   public DefaultManagedObjectPersistencePlugin(AbstractValuePersistence valuePersistence,
+         AbstractValueRecreation valueRecreation, ManagedObjectRecreationHelper helper)
+   {
+      // Create the delegates
+      this.persistenceDelegate = new DefaultPersistenceDelegate(valuePersistence);
+      this.recreationDelegate = new DefaultRecreationDelegate(valueRecreation, helper);
+   }
+   
+   public String getType()
+   {
+      return Object.class.getName();
+   }
+
+   protected DefaultPersistenceDelegate getPersistenceDelegate()
+   {
+      return persistenceDelegate;
+   }
+   
+   protected DefaultRecreationDelegate getRecreationDelegate()
+   {
+      return recreationDelegate;
+   }
+   
+   public AbstractValuePersistence getValuePersistence()
+   {
+      return persistenceDelegate.getValuePersistence();
+   }
+   
+   public AbstractValueRecreation getValueRecreation()
+   {
+      return recreationDelegate.getValueRecreation();
+   }
+   
+   public PersistedManagedObject createPersistedManagedObject(ManagedObject mo)
+   {
+      return persistenceDelegate.createPersistedManagedObject(mo);
+   }
+   
+   public PersistedManagedObject createPersistedManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      return persistenceDelegate.createPersistedManagedObject(persisted, mo);
+   }
+   
+   public ManagedObject createManagedObject(PersistedManagedObject persisted)
+   {
+      return recreationDelegate.createManagedObject(persisted);
+   }
+   
+   public ManagedObject updateManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      return recreationDelegate.updateManagedObject(persisted, mo);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultManagedObjectPersistencePlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultPersistenceDelegate.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultPersistenceDelegate.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultPersistenceDelegate.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,54 @@
+/*
+ * 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.persistence;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * The default persistence plugin. This will create a PersistedManagedObject
+ * with it's properties.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultPersistenceDelegate extends AbstractManagedObjectPersistence
+{
+   
+   public DefaultPersistenceDelegate(AbstractValuePersistence valuePersistence)
+   {
+      super(valuePersistence);
+   }
+   
+   @Override
+   public PersistedManagedObject createPersistedManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      // Create the persisted information
+      persisted = super.createPersistedManagedObject(persisted, mo);
+      // Process the properties
+      processProperties(persisted, mo);
+      // Return
+      return persisted;
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultPersistenceDelegate.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultRecreationDelegate.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultRecreationDelegate.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultRecreationDelegate.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,103 @@
+/*
+ * 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.persistence;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * The default ManagedObject recreation plugin. This will process and update
+ * the ManagedObject and it's properties.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultRecreationDelegate extends AbstractManagedObjectRecreation
+{
+   
+   /** The recreation helper. */
+   private final ManagedObjectRecreationHelper helper;
+   
+   public DefaultRecreationDelegate(AbstractValueRecreation valueRecreation, ManagedObjectRecreationHelper helper)
+   {
+      super(valueRecreation);
+      if(helper == null)
+         throw new IllegalArgumentException("null helper");
+      
+      this.helper = helper;
+   }
+
+   public ManagedObject createManagedObject(PersistedManagedObject persisted)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object.");
+      
+      String className = persisted.getTemplateName();
+      if(className == null)
+         className = persisted.getClassName();
+
+      ManagedObject mo = createManagedObjectSkeleton(className);
+      if(mo == null)
+         throw new RuntimeException("could not recreate managed object for class " + className);
+      return updateManagedObject(persisted, mo);
+   }
+
+   public ManagedObject updateManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      if(mo == null)
+         throw new IllegalArgumentException("null managed object");
+      
+      // Process properties
+      processProperties(persisted, mo);
+      
+      return mo;
+   }
+   
+   protected ManagedObject createManagedObjectSkeleton(String className)
+   {
+      try
+      {
+         return this.helper.createManagedObjectSkeleton(className);
+      }
+      catch(ClassNotFoundException cnfe)
+      {
+         throw new RuntimeException("could not recreate attachment", cnfe);
+      }
+   }
+   
+   @Override
+   protected void setValue(String name, ManagedProperty property, Object attachment)
+   {
+      try
+      {
+         this.helper.setValue(name, property, attachment);
+      }
+      catch (Throwable e)
+      {
+         throw new RuntimeException("Could not set value for property: " + property, e);
+      }
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DefaultRecreationDelegate.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DelegatingPersistencePlugin.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DelegatingPersistencePlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DelegatingPersistencePlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,233 @@
+/*
+ * 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.persistence;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.plugins.values.MetaValueFactoryBuilder;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * A delegating persistence plugin.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DelegatingPersistencePlugin implements ManagedObjectPersistencePlugin
+{
+
+   /** The meta data plugins. */
+   private Map<String, ManagedObjectPersistencePlugin> plugins = new ConcurrentHashMap<String, ManagedObjectPersistencePlugin>();
+
+   /** The default plugin. */
+   private final ManagedObjectPersistencePlugin defaultPlugin;
+   
+   /** The meta value factory. */
+   private final MetaValueFactory metaValueFactory = MetaValueFactoryBuilder.create();
+   
+   /** The value persistence. */
+   private final AbstractValuePersistence valuePersistence;
+   
+   /** The value recreation. */
+   private AbstractValueRecreation valueRecreation;
+   
+   public DelegatingPersistencePlugin(ManagedObjectRecreationHelper helper)
+   {
+      this.valuePersistence = new AbstractValuePersistence(this, metaValueFactory);
+      this.valueRecreation = new AbstractValueRecreation(this);
+      this.defaultPlugin = new DefaultManagedObjectPersistencePlugin(valuePersistence, valueRecreation, helper);
+   }
+   
+   public String getType()
+   {
+      return Object.class.getName();
+   }
+   
+   /**
+    * Get the value recreation.
+    * 
+    * @return the value recreation
+    */
+   public AbstractValuePersistence getValuePersistence()
+   {
+      return this.valuePersistence;
+   }
+   
+   /**
+    * Create a persisted managed object.
+    * 
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   public PersistedManagedObject createPersistedManagedObject(ManagedObject mo)
+   {
+      if(mo == null)
+         throw new IllegalArgumentException("Null managed object.");
+      
+      ManagedObjectPersistencePlugin plugin = getPlugin(mo);
+      return plugin.createPersistedManagedObject(mo);
+   }
+
+   /**
+    * Create a persisted managed object
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   public PersistedManagedObject createPersistedManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("Null persisted managed object.");
+      if(mo == null)
+         throw new IllegalArgumentException("Null managed object.");
+      
+      ManagedObjectPersistencePlugin plugin = getPlugin(mo);
+      return plugin.createPersistedManagedObject(persisted, mo);
+   }
+   
+   /**
+    * Get the value persistence.
+    * 
+    * @return the value persistence
+    */
+   public AbstractValueRecreation getValueRecreation()
+   {
+      return this.valueRecreation;
+   }
+   
+   /**
+    * Create a persisted managed object
+    * 
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   public ManagedObject createManagedObject(PersistedManagedObject persisted)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      
+      ManagedObjectPersistencePlugin plugin = getPlugin(persisted);
+      return plugin.createManagedObject(persisted);
+   }
+
+   /**
+    * Create a persisted managed object
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   public ManagedObject updateManagedObject(PersistedManagedObject persisted, ManagedObject mo)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      if(mo == null)
+         throw new IllegalArgumentException("null managed object");
+      
+      ManagedObjectPersistencePlugin plugin = getPlugin(persisted);
+      return plugin.updateManagedObject(persisted, mo);
+   }
+   
+   /**
+    * Extract the type name and get the plugin.
+    * 
+    * @param mo the managed object
+    * @return the managed object plugin
+    */
+   protected ManagedObjectPersistencePlugin getPlugin(ManagedObject mo)
+   {
+      String type = mo.getAttachmentName();
+      if(type == null && mo.getAttachment() != null)
+         type = mo.getAttachment().getClass().getName();
+
+      return getPlugin(type);
+   }
+   
+   /**
+    * Get the plugin registered for persisted managed object.
+    * 
+    * @param persisted the persisted managed object
+    * @return the ManagedObject recreation plugin
+    */
+   protected ManagedObjectPersistencePlugin getPlugin(PersistedManagedObject persisted)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      
+      String className = persisted.getTemplateName();
+      if(className == null)
+         className = persisted.getClassName();
+      return getPlugin(className);
+   }
+   
+   /**
+    * Get the plugin.
+    * 
+    * @param type the managed object type
+    * @return the managed object plugin
+    */
+   public ManagedObjectPersistencePlugin getPlugin(String type)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("Null type.");
+      
+      ManagedObjectPersistencePlugin plugin = this.plugins.get(type);
+      if(plugin == null)
+         plugin = defaultPlugin;
+      return plugin;
+   }
+   
+   /**
+    * Add a managed object plugin.
+    * 
+    * @param plugin the plugin to add
+    */
+   public void addPlugin(ManagedObjectPersistencePlugin plugin)
+   {
+      if(plugin == null)
+         throw new IllegalArgumentException("Null plugin.");
+      if(plugin.getType() == null)
+         throw new IllegalArgumentException("Null plugin type.");
+
+      this.plugins.put(plugin.getType(), plugin);
+   }
+
+   /**
+    * Remove a managed object plugin.
+    * 
+    * @param plugin the plugin to remove
+    */
+   public void removePlugin(ManagedObjectPersistencePlugin plugin)
+   {
+      if(plugin == null)
+         throw new IllegalArgumentException("Null plugin.");
+      if(plugin.getType() == null)
+         throw new IllegalArgumentException("Null plugin type.");
+
+      this.plugins.remove(plugin.getType());
+   }
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/DelegatingPersistencePlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectPersistencePlugin.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectPersistencePlugin.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectPersistencePlugin.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,92 @@
+/*
+ * 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.persistence;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * The managed object persistence plugin, handling the persistence
+ * of a ManagedObject.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ManagedObjectPersistencePlugin
+{
+
+   /**
+    * Get the plugin type.
+    * 
+    * @return the type
+    */
+   String getType();
+   
+   /**
+    * Get the value persistence.
+    * 
+    * @return the value persistence
+    */
+   AbstractValuePersistence getValuePersistence();
+   
+   /**
+    * Get the value recreation.
+    * 
+    * @return the value recreation
+    */
+   AbstractValueRecreation getValueRecreation();
+   
+   /**
+    * Create a persisted managed object
+    * 
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   PersistedManagedObject createPersistedManagedObject(ManagedObject mo);
+ 
+   /**
+    * Create a persisted managed object
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    * @return the persistence xml meta data for managed object
+    */
+   PersistedManagedObject createPersistedManagedObject(PersistedManagedObject persisted, ManagedObject mo);
+   
+   /**
+    * Create a managed object, based on the persisted information.
+    * 
+    * @param persisted the persisted managed object
+    * @return the managed object
+    */
+   ManagedObject createManagedObject(PersistedManagedObject persisted);
+   
+   /**
+    * Update a managed object, based on the persisted information.
+    * 
+    * @param persisted the persisted managed object
+    * @param mo the managed object
+    * @return the managed object
+    */
+   ManagedObject updateManagedObject(PersistedManagedObject persisted, ManagedObject mo);
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectPersistencePlugin.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectRecreationHelper.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectRecreationHelper.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectRecreationHelper.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,132 @@
+/*
+ * 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.persistence;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+
+/**
+ * A recreation helper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedObjectRecreationHelper
+{
+
+   /** The loader. */
+   private final ThreadLocal<ClassLoader> loader = new ThreadLocal<ClassLoader>();
+   
+   /** The managed object factory. */
+   private final ManagedObjectFactory mangedObjectFactory;
+   
+   /** The attachment property populator. */
+   private final AttachmentPropertyPopulator attachmentPopulator;
+   
+   public ManagedObjectRecreationHelper(ManagedObjectFactory mangedObjectFactory)
+   {
+      if(mangedObjectFactory == null)
+         throw new IllegalArgumentException("null managed object factory");
+      
+      this.mangedObjectFactory = mangedObjectFactory;
+      this.attachmentPopulator =  new AttachmentPropertyPopulator(mangedObjectFactory, this);
+   }
+   
+   public ClassLoader getLoader()
+   {
+      return this.loader.get();
+   }
+   
+   public void setLoader(ClassLoader loader)
+   {
+      this.loader.set(loader);
+   }
+   
+   /**
+    * Set a value to a managed property. This delegates
+    * to the AttachmentPropertyPopulator.
+    * 
+    * @param name the property name
+    * @param property the managed property
+    * @param attachment the attachment
+    * @throws Throwable for any erro
+    */
+   public void setValue(String name, ManagedProperty property, Object attachment) throws Throwable
+   {
+      attachmentPopulator.processManagedProperty(name, property, attachment);
+   }
+   
+   /**
+    * Create a ManagedObject skeleton based on a class name.
+    * 
+    * @param className the class name
+    * @return the ManagedObject, null if the class has no ManagementObject annotations
+    * @throws ClassNotFoundException 
+    */
+   protected ManagedObject createManagedObjectSkeleton(String className) throws ClassNotFoundException
+   {
+      Class<?> clazz = loadClass(className);
+      return mangedObjectFactory.createManagedObject(clazz);
+   }
+   
+   /**
+    * Load class.
+    * 
+    * @param className the class name
+    * @return the class
+    * @throws ClassNotFoundException
+    */
+   protected Class<?> loadClass(String className) throws ClassNotFoundException
+   {
+      ClassLoader cl = getLoader();
+      if(cl == null)
+         cl = SecurityActions.getContextClassLoader();
+      return cl.loadClass(className); 
+   }
+   
+   private static final class SecurityActions
+   {
+      public static ClassLoader getContextClassLoader()
+      {
+         if (System.getSecurityManager() == null)
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+         else
+         {
+            return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+            {
+                public ClassLoader run()
+                {
+                   return Thread.currentThread().getContextClassLoader();
+                }
+            });
+         }  
+      }
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/ManagedObjectRecreationHelper.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceConstants.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceConstants.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceConstants.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,45 @@
+/*
+ * 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.persistence;
+
+/**
+ * The PersistenceConstants.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistenceConstants
+{
+   
+   /** The repository xml namespace. */
+   public static final String REPOSITORY_NAMESPACE_1_0 = "urn:org:jboss:profileservice:attachments:1.0";
+
+   /** The component xml namespace. */
+   public static final String COMPONENT_NAMESPACE_1_0 = "urn:org:jboss:profileservice:persistence:managed-component:1.0";
+   
+   /** The managed-object name. */
+   public static final String MANAGED_OBJECT_ELEMENT_NAME = "managed-object";
+   
+   /** The managed-component name. */
+   public static final String MANAGED_COMPONENT_ELEMENT_NAME = "managed-component";
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceConstants.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceFactory.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,170 @@
+/*
+ * 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.persistence;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.profileservice.persistence.xml.PersistenceRoot;
+
+/**
+ * The persistence factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class PersistenceFactory
+{
+
+   /** The managed object factory. */
+   private final ManagedObjectFactory managedObjectFactory;
+   
+   protected PersistenceFactory(ManagedObjectFactory managedObjectFactory)
+   {
+      if(managedObjectFactory == null)
+         throw new IllegalArgumentException("null managed object factory");
+      //
+      this.managedObjectFactory = managedObjectFactory;
+   }
+   
+   /**
+    * Get the managed object factory.
+    * 
+    * @return the manged object factory
+    */
+   public ManagedObjectFactory getManagedObjectFactory()
+   {
+      return managedObjectFactory;
+   }
+   
+   /**
+    * Get the persistence plugin.
+    * 
+    * @return the persistence plugin
+    */
+   public abstract ManagedObjectPersistencePlugin getPersistencePlugin();
+
+   /**
+    * Apply the persisted information to a attachment.
+    * 
+    * @param root the persistence root
+    * @param attachment the root attachment
+    * @param classLoader the classloader
+    */
+   public abstract void restorePersistenceRoot(PersistenceRoot root, Object attachment, ClassLoader classLoader);
+   
+   /**
+    * Add a ManagedComponent.
+    * 
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public PersistenceRoot addComponent(ManagedObject parent, ManagedComponent component)
+   {
+      if(parent == null)
+         throw new IllegalArgumentException("null parent managed object");
+      if(component == null)
+         throw new IllegalArgumentException("null managed component");
+      
+      PersistenceRoot root = new PersistenceRoot();
+      return addComponent(root, parent, component);
+   }
+   
+   /**
+    * Add a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public abstract PersistenceRoot addComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component);
+   
+   /**
+    * Update a ManagedComponent.
+    * 
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public PersistenceRoot updateComponent(ManagedObject parent, ManagedComponent component)
+   {
+      if(parent == null)
+         throw new IllegalArgumentException("null parent managed object");
+      if(component == null)
+         throw new IllegalArgumentException("null managed component");
+      
+      PersistenceRoot root = new PersistenceRoot();
+      return updateComponent(root, parent, component);
+   }
+   
+   /**
+    * Update a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public abstract PersistenceRoot updateComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component);
+
+   /**
+    * Remove a ManagedComponent.
+    * 
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public PersistenceRoot removeComponent(ManagedObject parent, ManagedComponent component)
+   {
+      if(parent == null)
+         throw new IllegalArgumentException("null parent managed object");
+      if(component == null)
+         throw new IllegalArgumentException("null managed component");
+      
+      PersistenceRoot root = new PersistenceRoot();
+      return removeComponent(root, parent, component); 
+   }
+   
+   /**
+    * Remove a ManagedComponent.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public abstract PersistenceRoot removeComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component);
+
+   /**
+    * Reset a component. This will remove the persisted information.
+    * 
+    * @param root the persistence root
+    * @param parent the parent managed object
+    * @param component the managed component
+    * @return the updated persistence root
+    */
+   public abstract PersistenceRoot resetComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component);
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/PersistenceFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/AbstractComponentMapper.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/AbstractComponentMapper.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/AbstractComponentMapper.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,189 @@
+/*
+ * 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.persistence.component;
+
+import java.util.ArrayList;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.profileservice.persistence.ManagedObjectPersistencePlugin;
+import org.jboss.profileservice.persistence.PersistenceFactory;
+import org.jboss.profileservice.persistence.xml.ModificationInfo;
+import org.jboss.profileservice.persistence.xml.PersistedComponent;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedProperty;
+
+/**
+ * The abstract component mapper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractComponentMapper implements ComponentMapper
+{
+
+   /** The persistence factory. */
+   private final PersistenceFactory persistenceFactory;
+   
+   public AbstractComponentMapper(PersistenceFactory persistenceFactory)
+   {
+      if(persistenceFactory == null)
+         throw new IllegalArgumentException("null persistence factory");
+      
+      this.persistenceFactory = persistenceFactory;
+   }
+   
+   public ManagedObjectPersistencePlugin getPersistencePlugin()
+   {
+      return persistenceFactory.getPersistencePlugin();
+   }
+   
+   public ManagedObjectFactory getMOF()
+   {
+      return persistenceFactory.getManagedObjectFactory();
+   }
+  
+   public void restoreComponent(Object attachment, PersistedComponent component)
+   {
+      if(attachment == null)
+         throw new IllegalArgumentException("null attachment");
+      if(component == null)
+         throw new IllegalArgumentException("null component");
+
+      // Check what we need to do
+      ModificationInfo modification = component.getModificationInfo();
+      if(modification == null)
+         modification = ModificationInfo.MODIFIED;
+      switch(modification)
+      {
+         case ADDED:
+            updateComponent(attachment, component, true);
+            break;
+         case MODIFIED:
+            updateComponent(attachment, component, false);
+            break;
+         case REMOVED:
+            removeComponent(attachment, component);
+            break;
+      }
+   }
+
+   public PersistedComponent addComponent(Object attachment, ManagedComponent component)
+   {
+      return createPersistedComponent(attachment, component, ModificationInfo.ADDED);
+   }
+   
+   public PersistedComponent updateComponent(Object attachment, ManagedComponent component)
+   {
+      return createPersistedComponent(attachment, component, ModificationInfo.MODIFIED);
+   }
+   
+   public PersistedComponent removeComponent(Object attachment, ManagedComponent component)
+   {
+      PersistedComponent persisted = createPersistedComponent(attachment, component, ModificationInfo.REMOVED);
+      // FIXME cleanup properties, as they are not need for removed components
+      persisted.setProperties(new ArrayList<PersistedProperty>());
+      return persisted;
+   }
+   
+   /**
+    * Remove a component from the attachment.
+    * 
+    * @param attachment the attachment
+    * @param component the component to remove
+    */
+   protected abstract void removeComponent(Object attachment, PersistedComponent component);
+
+   /**
+    * Get a ManagedObject for a given component, based on the information
+    * in the attachment descriptor.
+    * 
+    * @param attachment the attachment
+    * @param component the component
+    * @param create whether to create a non existing component or not
+    * @return the managed object for the component
+    */
+   protected abstract ManagedObject getComponent(Object attachment, PersistedComponent component, boolean create);
+   
+   /**
+    * Create the persisted information for a given ManagedComponent.
+    * 
+    * @param attachment the attachment
+    * @param component the managed component
+    * @return the persisted component
+    */
+   protected PersistedComponent createComponent(Object attachment, ManagedComponent component)
+   {
+      // ManagedObject mo = component.getDeployment().getManagedObject(component.getName());
+      ManagedObject mo = (ManagedObject) component.getParent();
+      PersistedManagedObject persisted = getPersistencePlugin().createPersistedManagedObject(mo);
+      PersistedComponent persistedComponent = new PersistedComponent(persisted);
+      setComponentName(persistedComponent, mo);
+      return persistedComponent;
+   }
+   
+   /**
+    * Set the current name for this component.
+    * 
+    * @param component the persisted component
+    * @param mo the managed object
+    */
+   protected abstract void setComponentName(PersistedComponent component, ManagedObject mo);
+   
+   /**
+    * Update a attachment descripto based on the persisted
+    * component information.
+    * 
+    * @param attachment the attachment
+    * @param component the persisted component
+    * @param added whether this component was added or not
+    */
+   protected void updateComponent(Object attachment, PersistedComponent component, boolean added)
+   {
+      ManagedObject mo = getComponent(attachment, component, added);
+      getPersistencePlugin().updateManagedObject(component, mo);
+   }
+
+   /**
+    * Create a persisted component for a given ManagedComponent.
+    * 
+    * @param attachment the attachment
+    * @param component the managed component
+    * @param modification the modification info
+    * @return the persisted component
+    */
+   protected PersistedComponent createPersistedComponent(Object attachment, ManagedComponent component, ModificationInfo modification)
+   {
+      if(attachment == null)
+         throw new IllegalArgumentException("null attachment");
+      if(component == null)
+         throw new IllegalArgumentException("null component");
+      if(modification == null)
+         throw new IllegalArgumentException("null modification info");
+      // Create the component and set the modification information
+      PersistedComponent persisted = createComponent(attachment, component);
+      persisted.setModificationInfo(modification);
+      return persisted;      
+   }
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/AbstractComponentMapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapper.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapper.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapper.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,82 @@
+/*
+ * 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.persistence.component;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.profileservice.persistence.xml.PersistedComponent;
+
+/**
+ * The ComponentMapper maps a ManagedComponent to it's parent ManagedObject
+ * attachment. This is used to identify the ManagedComponents in their
+ * deployment descriptor, create the persistence information and
+ * restore them again.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ComponentMapper
+{
+
+   /**
+    * Get the component mapper type.
+    * 
+    * @return the type
+    */
+   String getType();
+   
+   /**
+    * Restore a component based on the persisted information.
+    * 
+    * @param attachment the attachment
+    * @param component the persisted component
+    */
+   void restoreComponent(Object attachment, PersistedComponent component);
+
+   /**
+    * Add a component.
+    * 
+    * @param attachment the parent attachment
+    * @param component the managed component
+    * @return the persisted managed component
+    */
+   PersistedComponent addComponent(Object attachment, ManagedComponent component);
+   
+   /**
+    * Update a component.
+    * 
+    * @param attachment the parent attachment
+    * @param component the managed component
+    * @return the persisted managed component
+    */
+   PersistedComponent updateComponent(Object attachment, ManagedComponent component);
+   
+   /**
+    * Remove a component.
+    * 
+    * @param attachment the parent attachment
+    * @param component the managed component
+    * @return the persisted managed component
+    */
+   PersistedComponent removeComponent(Object attachment, ManagedComponent component);
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapperRegistry.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapperRegistry.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapperRegistry.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -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.persistence.component;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A component mapper registry.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ComponentMapperRegistry
+{
+   
+   /** The instance. */
+   private static final ComponentMapperRegistry INSTANCE = new ComponentMapperRegistry();
+   
+   /** The component mapper map. */
+   private final Map<String, ComponentMapper> map = new ConcurrentHashMap<String, ComponentMapper>();
+
+   protected ComponentMapperRegistry()
+   {
+      //
+   }
+   
+   public static ComponentMapperRegistry getInstance()
+   {
+      return INSTANCE;
+   }
+   
+   /**
+    * Get a component mapper.
+    * 
+    * @param name the mapper type
+    * @return the mapper or null if not registered
+    */
+   public ComponentMapper getMapper(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("null name");
+      
+      return this.map.get(name);
+   }
+   
+   /**
+    * Add a component mapper.
+    * 
+    * @param mapper the component mapper
+    */
+   public void addMapper(ComponentMapper mapper)
+   {
+      if(mapper == null)
+         throw new IllegalArgumentException("null mapper");
+      
+      this.map.put(mapper.getType(), mapper);
+   }
+   
+   public void addMapper(String type, ComponentMapper mapper)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null mapper type");
+
+      this.map.put(type, mapper);      
+   }
+
+   /**
+    * Remove a component mapper.
+    * 
+    * @param mapper the component mapper
+    * @return the previous mapper or null
+    */
+   public ComponentMapper removeComponentMapper(ComponentMapper mapper)
+   {
+      if(mapper == null)
+         throw new IllegalArgumentException("null mapper");
+      return removeComponentMapper(mapper.getType());
+   }
+   
+   public ComponentMapper removeComponentMapper(String type)
+   {
+      if(type == null)
+         throw new IllegalArgumentException("null mapper type");
+      
+      return this.map.remove(type);
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/component/ComponentMapperRegistry.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractElement.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractElement.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractElement.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,101 @@
+/*
+ * 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.persistence.xml;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+
+/**
+ * The abstract element.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractElement implements PersistedElement
+{
+   
+   /** The name. */
+   private String name;
+   
+   /** The class name. */
+   private String className;
+   
+   public AbstractElement()
+   {
+      //
+   }
+   
+   public AbstractElement(String name)
+   {
+      this(name, null);
+   }
+   
+   public AbstractElement(String name, String className)
+   {
+      this.name = name;
+      this.className = className;
+   }
+
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @XmlAttribute(name = "class-name")
+   public String getClassName()
+   {
+      return this.className;
+   }
+
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{name = ").append(getName());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+ 
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractElement.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractPersisitedValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractPersisitedValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractPersisitedValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,40 @@
+/*
+ * 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.persistence.xml;
+
+
+
+/**
+ * A abstract persisted value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPersisitedValue extends AbstractElement implements PersistedValue
+{
+  
+   public void visit(PersistedValueVisitor visitor)
+   {
+      // nothing here
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/AbstractPersisitedValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/ModificationInfo.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/ModificationInfo.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/ModificationInfo.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,40 @@
+/*
+ * 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.persistence.xml;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ * Flag indicating the modification of a value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlEnum
+public enum ModificationInfo {
+
+   ADDED,
+   MODIFIED,
+   REMOVED
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/ModificationInfo.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/NullValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/NullValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/NullValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,34 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * A <null/> value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class NullValue extends AbstractPersisitedValue implements PersistedValue
+{
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/NullValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedArrayValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedArrayValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedArrayValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,34 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * The persisted ArrayValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedArrayValue extends PersistedCollectionValue
+{
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedArrayValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCollectionValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCollectionValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCollectionValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,93 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+/**
+ * The persisted collection value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedCollectionValue extends AbstractPersisitedValue implements PersistedValue
+{
+   /** The values. */
+   private List<PersistedValue> values = new ArrayList<PersistedValue>();
+   
+   @XmlElements( value = {         
+         @XmlElement(name = "null", type = NullValue.class),
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "properties", type = PersistedPropertiesValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public List<PersistedValue> getValues()
+   {
+      return this.values;
+   }
+   
+   public void setValues(List<PersistedValue> collection)
+   {
+      this.values = collection;
+   }
+   
+   public void addValue(PersistedValue value)
+   {
+      if(this.values == null)
+         this.values = new ArrayList<PersistedValue>();
+      
+      this.values.add(value);
+   }
+
+   public int size()
+   {
+      if(values == null) return 0;
+      return values.size();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", values = ").append(getValues());
+   }
+   
+   @Override
+   public void visit(PersistedValueVisitor visitor)
+   {
+      if(this.values != null && this.values.isEmpty() == false)
+      {
+         for(PersistedValue value : this.values)
+         {
+            value.visit(visitor);
+         }
+      }
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCollectionValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedComponent.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedComponent.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedComponent.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,53 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * A persisted managed component.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedComponent extends PersistedManagedObject
+{
+
+   public PersistedComponent()
+   {
+      //
+   }
+   
+   public PersistedComponent(PersistedManagedObject persisted)
+   {
+      if(persisted == null)
+         throw new IllegalArgumentException("null persisted managed object");
+      
+      setName(persisted.getName());
+      setClassName(persisted.getClassName());
+      setProperties(persisted.getProperties());
+      setOriginalName(persisted.getOriginalName());
+      setTemplateName(persisted.getTemplateName());
+      // TODO the modificationInfo should be handled here
+      setModificationInfo(persisted.getModificationInfo());
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedComponent.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCompositeValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCompositeValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCompositeValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+/**
+ * The persisted composite value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedCompositeValue extends AbstractPersisitedValue implements PersistedValue
+{
+
+   /** The values */
+   private List<PersistedValue> values;
+   
+   @XmlElements( value = {
+         @XmlElement(name = "null", type = NullValue.class),
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "properties", type = PersistedPropertiesValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public List<PersistedValue> getValues()
+   {
+      return this.values;
+   }
+   
+   public void setValues(List<PersistedValue> values)
+   {
+      this.values = values;
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", values = ").append(this.values);
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedCompositeValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedElement.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedElement.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedElement.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,46 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * A Element.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedElement
+{
+   /**
+    * GetName()
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * SetName
+    * 
+    * @param name the name
+    */
+   void setName(String name);
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedElement.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedEnumValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedEnumValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedEnumValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,49 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * The persisted EnumValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedEnumValue extends PersistedSimpleValue
+{
+
+   public PersistedEnumValue()
+   {
+      super();
+   }
+   
+   public PersistedEnumValue(String name)
+   {
+      super(name);
+   }
+   
+   @Override
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", enum-value = ").append(getValue());
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedEnumValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedGenericValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedGenericValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedGenericValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,83 @@
+/*
+ * 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.persistence.xml;
+
+import static org.jboss.profileservice.persistence.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.w3c.dom.Element;
+
+/**
+ * The persisted generic value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedGenericValue extends AbstractPersisitedValue implements PersistedValue
+{
+   
+   /** A managed-object. */
+   private PersistedManagedObject managedObject;
+   
+   /** A generic element. */
+   private Element generic;
+   
+   @XmlElement(name = MANAGED_OBJECT_ELEMENT_NAME, type = PersistedManagedObject.class)
+   public PersistedManagedObject getManagedObject()
+   {
+      return managedObject;
+   }
+   
+   public void setManagedObject(PersistedManagedObject managedObject)
+   {
+      this.managedObject = managedObject;
+   }
+   
+   @XmlAnyElement
+   public Element getGeneric()
+   {
+      return generic;
+   }
+   
+   public void setGeneric(Element generic)
+   {
+      this.generic = generic;
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      if(getManagedObject() != null)
+         builder.append(", managed-object = ").append(getManagedObject());
+      if(getGeneric() != null)
+         builder.append(", generic-value = ").append(getGeneric());
+   }
+   
+   @Override
+   public void visit(PersistedValueVisitor visitor)
+   {
+      if(this.managedObject != null)
+         visitor.addPersistedManagedObject(this.managedObject);
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedGenericValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedManagedObject.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedManagedObject.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedManagedObject.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,123 @@
+/*
+ * 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.persistence.xml;
+
+import static org.jboss.profileservice.persistence.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
+
+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.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A persisted xml representation of a ManagedObject.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = MANAGED_OBJECT_ELEMENT_NAME)
+ at XmlType(propOrder = {"originalName", "templateName", "properties"})
+public class PersistedManagedObject extends AbstractElement
+{
+   
+   /** The original name. */
+   private String originalName;
+   
+   /** The template name. */
+   private String templateName;
+   
+   /** The properties */
+   private List<PersistedProperty> properties;
+   
+   /** The modification info. */
+   // TODO this should be in PersistedComponent
+   private ModificationInfo modificationInfo;
+   
+   public PersistedManagedObject()
+   {
+      //
+   }
+   
+   public PersistedManagedObject(String name)
+   {
+      super(name);
+   }
+   
+   public PersistedManagedObject(String name, String className)
+   {
+      super(name, className);
+   }
+   
+   @XmlAttribute(name = "template-name")
+   public String getTemplateName()
+   {
+      return templateName;
+   }
+   
+   public void setTemplateName(String templateName)
+   {
+      this.templateName = templateName;
+   }
+   
+   @XmlAttribute(name = "original-name")
+   public String getOriginalName()
+   {
+      return originalName;
+   }
+   
+   public void setOriginalName(String originalName)
+   {
+      this.originalName = originalName;
+   }
+   
+   @XmlAttribute(name = "modification")
+   public ModificationInfo getModificationInfo()
+   {
+      return this.modificationInfo;
+   }
+   
+   public void setModificationInfo(ModificationInfo info)
+   {
+      this.modificationInfo = info;
+   }
+   
+   @XmlElementWrapper(name="properties")
+   @XmlElement(name = "property")
+   public List<PersistedProperty> getProperties()
+   {
+      return this.properties;
+   }
+   
+   public void setProperties(List<PersistedProperty> properties)
+   {
+      this.properties = properties;
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", template-name = ").append(getTemplateName());
+   }
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedManagedObject.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPair.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPair.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPair.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,65 @@
+/*
+ * 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.persistence.xml;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * The SimpleValue/SimpleMetaType.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedPair extends PersistedSimpleValue
+{
+   /** The name. */
+   private String key;
+   
+   public PersistedPair()
+   {
+      super("pair");
+   }
+   
+   public PersistedPair(String key, String value)
+   {
+      super("pair");
+      this.key = key;
+      super.setValue(value);
+   }
+
+   @XmlAttribute(name = "key")
+   public String getKey()
+   {
+      return this.key;
+   }
+   
+   public void setKey(String key)
+   {
+      this.key = key;
+   }
+
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", key = ").append(getKey());
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPair.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPropertiesValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPropertiesValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPropertiesValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * The persisted TableValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedPropertiesValue extends AbstractPersisitedValue implements PersistedValue
+{
+
+   /** The entries. */
+   List<PersistedPair> entries;
+
+   @XmlElement(name = "entry")
+   public List<PersistedPair> getEntries()
+   {
+      return entries;
+   }
+   
+   public void setEntries(List<PersistedPair> entries)
+   {
+      this.entries = entries;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedPropertiesValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedProperty.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedProperty.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedProperty.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,82 @@
+/*
+ * 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.persistence.xml;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * The persisted ManagedProperty.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(name = "persited-propertyType")
+public class PersistedProperty extends AbstractElement
+{
+   
+   /** The value */
+   private PersistedValue value;
+   
+   public PersistedProperty()
+   {
+      //
+   }
+   
+   public PersistedProperty(String name)
+   {
+      super(name);
+   }
+   
+   public PersistedProperty(String name, String className)
+   {
+      super(name, className);
+   }
+   
+   @XmlElements( value = {
+         @XmlElement(name = "null", type = NullValue.class),
+         @XmlElement(name = "simple", type = PersistedSimpleValue.class),
+         @XmlElement(name = "enum", type = PersistedEnumValue.class),
+         @XmlElement(name = "composite", type = PersistedCompositeValue.class),
+         @XmlElement(name = "generic", type = PersistedGenericValue.class),
+         @XmlElement(name = "collection", type = PersistedCollectionValue.class),
+         @XmlElement(name = "properties", type = PersistedPropertiesValue.class),
+         @XmlElement(name = "table", type = PersistedTableValue.class),
+         @XmlElement(name = "array", type = PersistedArrayValue.class)
+   })
+   public PersistedValue getValue()
+   {
+      return value;
+   }
+   
+   public void setValue(PersistedValue value)
+   {
+      this.value = value;
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", value = ").append(getValue());
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedProperty.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedSimpleValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedSimpleValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedSimpleValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,114 @@
+/*
+ * 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.persistence.xml;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * The SimpleValue/SimpleMetaType.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedSimpleValue implements PersistedValue, PersistedElement
+{
+   /** The name. */
+   private String name;
+   
+   /** The class name. */
+   private String className;
+   
+   /** The value. */
+   private String value;
+   
+   public PersistedSimpleValue()
+   {
+      //
+   }
+   
+   public PersistedSimpleValue(String name)
+   {
+      this(name, null);
+   }
+   
+   public PersistedSimpleValue(String name, String className)
+   {
+      this.name = name;
+      this.className = className;
+   }
+
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @XmlAttribute(name = "class-name")
+   public String getClassName()
+   {
+      return this.className;
+   }
+
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   @XmlValue 
+   public String getValue()
+   {
+      return value;
+   }
+   
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+   
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{name = ").append(getName());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   protected void toString(StringBuilder builder)
+   {
+      builder.append(", value = ").append(getValue());
+   }
+
+   public void visit(PersistedValueVisitor visitor)
+   {
+      // nothing here
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedSimpleValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedTableValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedTableValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedTableValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * The persisted TableValue.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistedTableValue extends AbstractPersisitedValue implements PersistedValue
+{
+
+   /** The entries. */
+   List<PersistedCompositeValue> entries;
+
+   @XmlElement(name = "entry")
+   public List<PersistedCompositeValue> getEntries()
+   {
+      return entries;
+   }
+   
+   public void setEntries(List<PersistedCompositeValue> entries)
+   {
+      this.entries = entries;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedTableValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValue.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValue.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValue.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,40 @@
+/*
+ * 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.persistence.xml;
+
+/**
+ * A persisted value.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedValue extends PersistedElement
+{
+   
+   /**
+    * Visit this value.
+    * 
+    * @param visitor the visitor
+    */
+   void visit(PersistedValueVisitor visitor);
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValue.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValueVisitor.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValueVisitor.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValueVisitor.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.Collection;
+
+import org.jboss.metatype.api.types.MetaType;
+
+
+/**
+ * A persisted value visitor, extracting persisted managed objects.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PersistedValueVisitor
+{
+
+   /**
+    * Get the meta type of the property.
+    * 
+    * @return the metaType.
+    */
+   MetaType getMetaType();
+   
+   /**
+    * Get the persisted managed objects of this node.
+    * 
+    * @return the persisted managed objects.
+    */
+   Collection<PersistedManagedObject> getManagedObjects();
+   
+   /**
+    * Add a persisted managed object.
+    * 
+    * @param mo the persisted managed object.
+    */
+   void addPersistedManagedObject(PersistedManagedObject mo);
+
+   /**
+    * Visit a persisted value.
+    * 
+    * @param the value
+    */
+   void visit(PersistedValue value);
+ 
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistedValueVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistenceRoot.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistenceRoot.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistenceRoot.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,87 @@
+/*
+ * 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.persistence.xml;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.persistence.PersistenceConstants;
+
+/**
+ * The attachment persistence xml root.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = "root", namespace = PersistenceConstants.COMPONENT_NAMESPACE_1_0)
+ at XmlType(propOrder = {"components"})
+public class PersistenceRoot
+{
+
+   /** The name */
+   private String name;
+   
+   /** The attachment class name. */
+   private String className;
+   
+   /** The components. */
+   private List<PersistedComponent> components;
+   
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   @XmlAttribute(name = "class-name")
+   public String getClassName()
+   {
+      return className;
+   }
+   
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   @XmlElement(name = "component")
+   public List<PersistedComponent> getComponents()
+   {
+      return components;
+   }
+   
+   public void setComponents(List<PersistedComponent> components)
+   {
+      this.components = components;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/PersistenceRoot.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/package-info.java
===================================================================
--- projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/package-info.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/package-info.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+ at XmlSchema(namespace = "urn:org:jboss:profileservice:persistence:managed-component:1.0", 
+      elementFormDefault = XmlNsForm.QUALIFIED,
+      xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") }
+)
+package org.jboss.profileservice.persistence.xml;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+


Property changes on: projects/profileservice/trunk/persistence/src/main/java/org/jboss/profileservice/persistence/xml/package-info.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/CompositeMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/CompositeMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/CompositeMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,78 @@
+/*
+ * 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.test.profileservice.component.persistence.support;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CompositeMetaData
+{
+
+   String string;
+   char character;   
+   Integer integer;
+   
+   public CompositeMetaData()
+   {
+      //
+   }
+   
+   public CompositeMetaData(String string, char character, Integer integer)
+   {
+      this.string = string;
+      this.character = character;
+      this.integer = integer;
+   }
+   
+   public String getString()
+   {
+      return string;
+   }
+   
+   public void setString(String string)
+   {
+      this.string = string;
+   }
+   
+   public char getCharacter()
+   {
+      return character;
+   }
+   
+   public void setCharacter(char character)
+   {
+      this.character = character;
+   }
+   
+   public Integer getInteger()
+   {
+      return integer;
+   }
+   
+   public void setInteger(Integer integer)
+   {
+      this.integer = integer;
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/CompositeMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponent.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponent.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponent.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,78 @@
+/*
+ * 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.test.profileservice.component.persistence.support;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject(componentType = @ManagementComponent(type="test", subtype="test"))
+public class TestComponent
+{
+
+   String name;
+   ObjectName objectName;
+   CompositeMetaData composite;
+   
+   @ManagementProperty
+   @ManagementObjectID
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   @ManagementProperty
+   public ObjectName getObjectName()
+   {
+      return objectName;
+   }
+   
+   public void setObjectName(ObjectName objectName)
+   {
+      this.objectName = objectName;
+   }
+   
+   @ManagementProperty
+   public CompositeMetaData getComposite()
+   {
+      return composite;
+   }
+   
+   public void setComposite(CompositeMetaData composite)
+   {
+      this.composite = composite;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponent.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponentMapper.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponentMapper.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponentMapper.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,122 @@
+/*
+ * 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.test.profileservice.component.persistence.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.profileservice.persistence.PersistenceFactory;
+import org.jboss.profileservice.persistence.component.AbstractComponentMapper;
+import org.jboss.profileservice.persistence.xml.PersistedComponent;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TestComponentMapper extends AbstractComponentMapper
+{
+
+   public TestComponentMapper(PersistenceFactory persistenceFactory)
+   {
+      super(persistenceFactory);
+   }
+
+   @Override
+   protected PersistedComponent createComponent(Object attachment, ManagedComponent component)
+   {
+      // Note: this is using the TestMgtComponentImpl to get the MO
+      ManagedObject mo = (ManagedObject) component.getParent();
+      PersistedManagedObject persistedMO = getPersistencePlugin().createPersistedManagedObject(mo);
+      PersistedComponent persisted = new PersistedComponent(persistedMO);
+      setComponentName(persisted, mo);
+      return persisted;
+   }
+   
+   @Override
+   protected void setComponentName(PersistedComponent component, ManagedObject mo)
+   {
+      // Set the current name for tracking.
+      component.setName((String) ((SimpleValue)mo.getProperty("name").getValue()).getValue()); 
+   }
+
+   @Override
+   protected ManagedObject getComponent(Object attachment, PersistedComponent component, boolean create)
+   {
+      TestDeployment deployment = (TestDeployment) attachment;
+      TestComponent instance = null;
+      if(deployment.getComponents() != null && deployment.getComponents().isEmpty() == false)
+      {
+         for(TestComponent md : deployment.getComponents())
+         {
+            if(md.getName().equals(component.getOriginalName()))
+            {
+               instance = md;
+               break;
+            }
+         }
+      }
+      if(instance == null && create)
+      {
+         instance = createTestComponent(component);
+         deployment.getComponents().add(instance);
+      }
+      if(instance == null)
+      {
+         throw new IllegalStateException("could not find instance with name " + component.getOriginalName());
+      }
+      return getMOF().initManagedObject(instance, null);
+   }
+
+   @Override
+   protected void removeComponent(Object attachment, PersistedComponent component)
+   {
+      TestDeployment deployment = (TestDeployment) attachment;
+      List<TestComponent> components = new ArrayList<TestComponent>(); 
+      if(deployment.getComponents() != null && deployment.getComponents().isEmpty() == false)
+      {
+         for(TestComponent md : deployment.getComponents())
+         {
+            if(md.getName().equals(component.getOriginalName()) == false)
+               components.add(md);
+         }
+         deployment.setComponents(components);
+      }
+   }
+   
+   protected TestComponent createTestComponent(PersistedComponent component)
+   {
+      TestComponent test = new TestComponent();
+      test.setName(component.getOriginalName());
+      return test;
+   }
+
+   public String getType()
+   {
+      return TestDeployment.class.getName();
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestComponentMapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestDeployment.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestDeployment.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,52 @@
+/*
+ * 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.test.profileservice.component.persistence.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class TestDeployment
+{
+
+   /** The test components. */
+   private List<TestComponent> components = new ArrayList<TestComponent>();
+   
+   @ManagementProperty(managed = true)
+   public List<TestComponent> getComponents()
+   {
+      return components;
+   }
+   
+   public void setComponents(List<TestComponent> components)
+   {
+      this.components = components;
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestMgtComponentImpl.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestMgtComponentImpl.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestMgtComponentImpl.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,93 @@
+/*
+ * 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.test.profileservice.component.persistence.support;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.RunState;
+import org.jboss.managed.plugins.DelegateManagedCommonImpl;
+
+/**
+ * A test managed component, to have access to the ManagedObject over
+ * the getParent() method.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TestMgtComponentImpl extends DelegateManagedCommonImpl
+   implements ManagedComponent, Serializable
+{
+
+   private ManagedObject mo;
+   
+   public TestMgtComponentImpl(ManagedObject delegate)
+   {
+      super(delegate);
+      this.mo = delegate;
+   }
+   
+   @Override
+   public ManagedCommon getParent()
+   {
+      return mo;
+   }
+
+   public Map<String, Annotation> getAnnotations()
+   {
+      // FIXME getAnnotations
+      return null;
+   }
+
+   public ManagedDeployment getDeployment()
+   {
+      // FIXME getDeployment
+      return null;
+   }
+
+   public RunState getRunState()
+   {
+      // FIXME getRunState
+      return null;
+   }
+
+   public ComponentType getType()
+   {
+      // FIXME getType
+      return null;
+   }
+
+   public boolean update()
+   {
+      // FIXME update
+      return false;
+   }
+
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/support/TestMgtComponentImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/AbstractComponentMapperTest.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/AbstractComponentMapperTest.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/AbstractComponentMapperTest.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,95 @@
+/*
+ * 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.test.profileservice.component.persistence.test;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.profileservice.persistence.AbstractPersistenceFactory;
+import org.jboss.profileservice.persistence.PersistenceFactory;
+import org.jboss.profileservice.persistence.component.ComponentMapper;
+import org.jboss.profileservice.persistence.xml.PersistenceRoot;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractComponentMapperTest extends TestCase
+{
+
+   /** The managed object factory. */
+   private ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
+   
+   /** The persistence factory. */
+   private AbstractPersistenceFactory persistenceFactory = new AbstractPersistenceFactory();
+   
+   public AbstractComponentMapperTest(String name)
+   {
+      super(name);
+   }
+
+   protected ManagedObjectFactory getMOF()
+   {
+      return managedObjectFactory;
+   }
+   
+   protected PersistenceFactory getPersistenceFactory()
+   {
+      return persistenceFactory;
+   }
+   
+   protected void addComponentMapper(ComponentMapper mapper)
+   {
+      persistenceFactory.addComponentMapper(mapper);
+   }
+   
+   protected PersistenceRoot restore(PersistenceRoot root) throws Exception
+   {
+      File file = File.createTempFile("test", null);
+      serialize(root, file);
+      return deserialize(file);
+   }
+   
+   protected void serialize(PersistenceRoot moElement, File file) throws Exception
+   {
+      JAXBContext ctx = JAXBContext.newInstance(PersistenceRoot.class);
+      Marshaller marshaller = ctx.createMarshaller();
+      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+      marshaller.marshal(moElement, file);
+      marshaller.marshal(moElement, System.out);
+   }
+   
+   protected PersistenceRoot deserialize(File file) throws Exception
+   {
+      JAXBContext ctx = JAXBContext.newInstance(PersistenceRoot.class);
+      Unmarshaller unmarshaller = ctx.createUnmarshaller();
+      return (PersistenceRoot) unmarshaller.unmarshal(file);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/AbstractComponentMapperTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/ComponentMapperUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/ComponentMapperUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/ComponentMapperUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,227 @@
+/*
+ * 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.test.profileservice.component.persistence.test;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.persistence.xml.PersistenceRoot;
+import org.jboss.test.profileservice.component.persistence.support.CompositeMetaData;
+import org.jboss.test.profileservice.component.persistence.support.TestComponent;
+import org.jboss.test.profileservice.component.persistence.support.TestComponentMapper;
+import org.jboss.test.profileservice.component.persistence.support.TestDeployment;
+import org.jboss.test.profileservice.component.persistence.support.TestMgtComponentImpl;
+
+/**
+ * Basic component mapper unit test case.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ComponentMapperUnitTestCase extends AbstractComponentMapperTest
+{
+   
+   public ComponentMapperUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+   }
+   
+   public void testAdd() throws Exception
+   {
+      // Add the component mapper
+      addComponentMapper(new TestComponentMapper(getPersistenceFactory()));
+
+      TestComponent addComponent = createComponentMetaData("component3",
+            new ObjectName("org.jboss:type=testComponent3"),
+            createCompositeMetaData("composite3", 'c', new Integer(3)));
+      
+      ManagedObject temp = getMOF().initManagedObject(addComponent, null);
+      ManagedComponent component = new TestMgtComponentImpl(temp);
+      
+      ManagedObject mo = createDeploymentMO();
+      
+      PersistenceRoot root = getPersistenceFactory().addComponent(mo, component);
+      root.setClassName(TestDeployment.class.getName());
+      
+      root = restore(root);
+      
+      
+      TestDeployment attachment = createDeploymentMetaData();
+      getPersistenceFactory().restorePersistenceRoot(root, attachment, null);
+      
+      //
+      assertEquals(3, attachment.getComponents().size());
+   }
+   
+   public void testUpdate() throws Exception
+   {
+      // Add the component mapper
+      addComponentMapper(new TestComponentMapper(getPersistenceFactory()));
+
+      // Get the components
+      ManagedObject mo = createDeploymentMO();
+      Iterator<?> iterator = ((CollectionValue) mo.getProperty("components").getValue()).iterator();
+      ManagedObject component1 = (ManagedObject) ((GenericValue) iterator.next()).getValue();
+      ManagedObject component2 = (ManagedObject) ((GenericValue) iterator.next()).getValue();
+      
+      // create the persistence information
+      TestMgtComponentImpl tComp1 = new TestMgtComponentImpl(component1);
+      PersistenceRoot root = getPersistenceFactory().updateComponent(mo, tComp1);
+      root.setClassName(TestDeployment.class.getName());
+      
+      TestMgtComponentImpl tComp2 = new TestMgtComponentImpl(component2);
+      root = getPersistenceFactory().updateComponent(root, mo, tComp2);      
+      
+      assertNotNull(root.getComponents());
+      // serialize / deserialize
+      PersistenceRoot persisted = restore(root);
+      
+      // Create a new root attachment with empty components
+      TestDeployment test = new TestDeployment();
+      test.getComponents().add(createComponentMetaData("component1", null, null));
+      test.getComponents().add(createComponentMetaData("component2", null, null));
+      // Apply the persisted information, which should recreate the missing properties
+      getPersistenceFactory().restorePersistenceRoot(persisted, test, null);
+      assertFalse(test.getComponents().isEmpty());
+      
+      // Check if the properties are available again
+      for(TestComponent restoredComponent : test.getComponents())
+      {
+         assertNotNull("null object name "+ restoredComponent.getName(), restoredComponent.getObjectName());
+         assertNotNull("null composite "+ restoredComponent.getName(), restoredComponent.getComposite());
+      }
+   }
+   
+   public void testRemove() throws Exception
+   {
+      // Add the component mapper
+      addComponentMapper(new TestComponentMapper(getPersistenceFactory()));
+
+      // Get the components
+      ManagedObject mo = createDeploymentMO();      
+      Iterator<?> iterator = ((CollectionValue) mo.getProperty("components").getValue()).iterator();
+      ManagedObject component1 = (ManagedObject) ((GenericValue) iterator.next()).getValue();
+      
+      // create the persistence information
+      TestMgtComponentImpl tComp1 = new TestMgtComponentImpl(component1);
+      PersistenceRoot root = getPersistenceFactory().removeComponent(mo, tComp1);
+      root.setClassName(TestDeployment.class.getName());
+      PersistenceRoot persisted = restore(root);
+
+      // Check removed
+      TestDeployment deployment = createDeploymentMetaData();
+      getPersistenceFactory().restorePersistenceRoot(persisted, deployment, null);
+      assertEquals(1, deployment.getComponents().size());
+      
+      // Reset
+      root = getPersistenceFactory().resetComponent(persisted, mo, tComp1);
+      persisted = restore(root);
+      assertNull(persisted.getComponents());
+   }
+   
+   public void testNameChanges() throws Exception
+   {
+      // Add the component mapper
+      addComponentMapper(new TestComponentMapper(getPersistenceFactory()));
+
+      // Get the components
+      ManagedObject mo = createDeploymentMO();
+
+      PersistenceRoot root = new PersistenceRoot();
+      root.setClassName(TestDeployment.class.getName());
+      
+      TestDeployment deployment = updateName(root, mo, "change1");
+      mo = getMOF().initManagedObject(deployment, null); 
+      
+      deployment = updateName(root, mo, "change2");
+      mo = getMOF().initManagedObject(deployment, null);
+      
+      deployment = updateName(root, mo, "change3");
+      mo = getMOF().initManagedObject(deployment, null);      
+      
+   }
+   
+   protected TestDeployment updateName(PersistenceRoot root, ManagedObject mo, String name) throws Exception
+   {
+      Iterator<?> iterator = ((CollectionValue) mo.getProperty("components").getValue()).iterator();
+      ManagedObject component = (ManagedObject) ((GenericValue) iterator.next()).getValue();
+      
+      component.getProperty("name").setValue(SimpleValueSupport.wrap(name));
+      root = getPersistenceFactory().updateComponent(root, mo, new TestMgtComponentImpl(component));
+      root = restore(root);
+      
+      TestDeployment deployment = createDeploymentMetaData();
+      getPersistenceFactory().restorePersistenceRoot(root, deployment, null);
+      return deployment;
+   }
+   
+   protected ManagedObject createDeploymentMO() throws Exception
+   {
+      return getMOF().initManagedObject(createDeploymentMetaData(), null);
+   }
+   
+   protected TestDeployment createDeploymentMetaData() throws Exception
+   {
+      TestDeployment deployment = new TestDeployment();
+      List<TestComponent> components = new ArrayList<TestComponent>();
+      components.add(
+            createComponentMetaData("component1",
+                  new ObjectName("org.jboss:type=testComponent1"),
+                  createCompositeMetaData("composite1", 'a', new Integer(1))));
+      components.add(
+            createComponentMetaData("component2",
+                  new ObjectName("org.jboss:type=testComponent2"),
+                  createCompositeMetaData("composite2", 'b', new Integer(2))));
+      deployment.setComponents(components);
+      return deployment;
+   }
+   
+   protected TestComponent createComponentMetaData(String name, ObjectName objectName,
+         CompositeMetaData composite)
+   {
+      TestComponent component = new TestComponent();
+      component.setName(name);
+      component.setObjectName(objectName);
+      component.setComposite(composite);
+      return component;
+   }
+   
+   protected CompositeMetaData createCompositeMetaData(String name, char character, Integer integer)
+   {
+      return new CompositeMetaData(name, character, integer);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/component/persistence/test/ComponentMapperUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/CollectionMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/CollectionMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/CollectionMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * 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.persistence.support;
+
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class CollectionMetaData
+{
+
+   List<String> collection;
+   
+   @ManagementProperty
+   public List<String> getCollection()
+   {
+      return collection;
+   }
+   
+   public void setCollection(List<String> collection)
+   {
+      this.collection = collection;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/CollectionMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/GenericSupportMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/GenericSupportMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/GenericSupportMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * 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.persistence.support;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class GenericSupportMetaData
+{
+
+   /** The list. */
+   List<SimpleGenericMetaData> list;
+   
+   /** The array. */
+   SimpleGenericMetaData[][] array;
+   
+   @ManagementProperty(managed = true)
+   public List<SimpleGenericMetaData> getList()
+   {
+      return Collections.unmodifiableList(list);
+   }
+   
+   public void setList(List<SimpleGenericMetaData> list)
+   {
+      this.list = list;
+   }
+   
+   @ManagementProperty(managed = true)
+   public SimpleGenericMetaData[][] getArray()
+   {
+      return array;
+   }
+   
+   public void setArray(SimpleGenericMetaData[][] array)
+   {
+      this.array = array;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/GenericSupportMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/NestedTestMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/NestedTestMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/NestedTestMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,53 @@
+/*
+ * 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.test.profileservice.persistence.support;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class NestedTestMetaData implements Serializable
+{
+
+   List<TestMetaData> deployments;
+
+   @ManagementProperty(managed = true)
+   public List<TestMetaData> getDeployments()
+   {
+      return deployments;
+   }
+   
+   public void setDeployments(List<TestMetaData> deployments)
+   {
+      this.deployments = deployments;
+   }
+   
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/NestedTestMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/ObjectNameMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/ObjectNameMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/ObjectNameMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * 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.test.profileservice.persistence.support;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.jboss.metatype.plugins.values.mappers.StringObjectNameMetaMapper;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class ObjectNameMetaData
+{
+   /** The object name. */
+   ObjectName name;
+   
+   /** The other object name. */
+   ObjectName otherName;
+
+   @ManagementProperty
+   public ObjectName getName()
+   {
+      return name;
+   }
+   
+   public void setName(ObjectName name)
+   {
+      this.name = name;
+   }
+   
+   @ManagementProperty
+   @MetaMapping(StringObjectNameMetaMapper.class)
+   public ObjectName getOtherName()
+   {
+      return otherName;
+   }
+   
+   public void setOtherName(ObjectName otherName)
+   {
+      this.otherName = otherName;
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/ObjectNameMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/PrimitiveMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/PrimitiveMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/PrimitiveMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,78 @@
+/*
+ * 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.test.profileservice.persistence.support;
+
+import java.io.Serializable;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class PrimitiveMetaData implements Serializable
+{
+   /** The name */
+   String name;
+   
+   /** The optional name */
+   String optionalName;
+   
+   /** The integer */
+   int integer;
+
+   @ManagementProperty
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @ManagementProperty
+   public int getInteger()
+   {
+      return integer;
+   }
+
+   public void setInteger(int integer)
+   {
+      this.integer = integer;
+   }
+
+   @ManagementProperty
+   public String getOptionalName()
+   {
+      return optionalName;
+   }
+   
+   public void setOptionalName(String optionalName)
+   {
+      this.optionalName = optionalName;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/PrimitiveMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleArrayMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleArrayMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleArrayMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,76 @@
+/*
+ * 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.persistence.support;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class SimpleArrayMetaData
+{
+   /** one dimension */
+   char[] test1D;
+   
+   /** two dimensions */
+   char[][] test2D;
+   
+   /** three dimensions */
+   char[][][] test3D;
+
+   @ManagementProperty
+   public char[] getTest1D()
+   {
+      return test1D;
+   }
+
+   public void setTest1D(char[] test1D)
+   {
+      this.test1D = test1D;
+   }
+
+   @ManagementProperty
+   public char[][] getTest2D()
+   {
+      return test2D;
+   }
+
+   public void setTest2D(char[][] test2D)
+   {
+      this.test2D = test2D;
+   }
+
+   @ManagementProperty
+   public char[][][] getTest3D()
+   {
+      return test3D;
+   }
+
+   public void setTest3D(char[][][] test3D)
+   {
+      this.test3D = test3D;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleArrayMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleGenericMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleGenericMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleGenericMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -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.test.profileservice.persistence.support;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class SimpleGenericMetaData
+{
+
+   private String string;
+   
+   private Integer integer;
+   
+   private SimpleGenericMetaData child;
+   
+   public SimpleGenericMetaData()
+   {
+      //
+   }
+   
+   public SimpleGenericMetaData(String string, int integer, SimpleGenericMetaData child)
+   {
+      this.string = string;
+      this.integer = integer;
+      this.child = child;
+   }
+
+   @ManagementObjectID
+   @ManagementProperty
+   public String getString()
+   {
+      return string;
+   }
+
+   public void setString(String string)
+   {
+      this.string = string;
+   }
+
+   @ManagementProperty
+   public Integer getInteger()
+   {
+      return integer;
+   }
+
+   public void setInteger(Integer integer)
+   {
+      this.integer = integer;
+   }
+
+   @ManagementProperty
+   public SimpleGenericMetaData getChild()
+   {
+      return child;
+   }
+
+   public void setChild(SimpleGenericMetaData child)
+   {
+      this.child = child;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleGenericMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleStringMapMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleStringMapMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleStringMapMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,50 @@
+/*
+ * 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.persistence.support;
+
+import java.util.Map;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class SimpleStringMapMetaData
+{
+   Map<String, String> map;
+   
+   @ManagementProperty
+   public Map<String, String> getMap()
+   {
+      return map;
+   }
+   
+   public void setMap(Map<String, String> map)
+   {
+      this.map = map;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleStringMapMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleTableMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleTableMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleTableMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * 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.persistence.support;
+
+import java.util.Map;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class SimpleTableMetaData
+{
+
+   Map<Integer, String> map;
+   
+   @ManagementProperty
+   public Map<Integer, String> getMap()
+   {
+      return map;
+   }
+   
+   public void setMap(Map<Integer, String> map)
+   {
+      this.map = map;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/SimpleTableMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/TestMetaData.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/TestMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/TestMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,134 @@
+/*
+ * 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.test.profileservice.persistence.support;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject
+public class TestMetaData
+{
+
+   /** The name. */
+   String name;
+   
+   /** The primitive */
+   PrimitiveMetaData primitive;
+   
+   /** A primitive List */
+   List<String> list;
+   
+   Map<String, String> testMap;
+   
+   Character[] charArray;
+   
+   char[][] test2dChar;
+   
+   Map<Integer, String> table;
+   
+   @ManagementProperty
+   @ManagementObjectID
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   @ManagementProperty
+   public PrimitiveMetaData getPrimitive()
+   {
+      return primitive;
+   }
+   
+   public void setPrimitive(PrimitiveMetaData primitive)
+   {
+      this.primitive = primitive;
+   }
+   
+   @ManagementProperty
+   public List<String> getList()
+   {
+      return list;
+   }
+   
+   public void setList(List<String> list)
+   {
+      this.list = list;
+   }
+
+   @ManagementProperty
+   public Map<String, String> getTestMap()
+   {
+      return testMap;
+   }
+   
+   public void setTestMap(Map<String, String> testMap)
+   {
+      this.testMap = testMap;
+   }
+
+   @ManagementProperty
+   public Character[] getCharArray()
+   {
+      return charArray;
+   }
+   
+   public void setCharArray(Character[] charArray)
+   {
+      this.charArray = charArray;
+   }
+
+   @ManagementProperty
+   public char[][] getTest2dChar()
+   {
+      return test2dChar;
+   }
+   
+   public void setTest2dChar(char[][] test2dChar)
+   {
+      this.test2dChar = test2dChar;
+   }
+
+   @ManagementProperty
+   public Map<Integer, String> getTable()
+   {
+      return table;
+   }
+   
+   public void setTable(Map<Integer, String> table)
+   {
+      this.table = table;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/support/TestMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/AbstractPersistenceFormatTest.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/AbstractPersistenceFormatTest.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/AbstractPersistenceFormatTest.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,143 @@
+/*
+ * 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.test.profileservice.persistence.test;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.metatype.api.types.MetaTypeFactory;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.profileservice.persistence.DelegatingPersistencePlugin;
+import org.jboss.profileservice.persistence.ManagedObjectPersistencePlugin;
+import org.jboss.profileservice.persistence.ManagedObjectRecreationHelper;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPersistenceFormatTest extends TestCase
+{
+
+   /** The managed object factory */
+   private static final ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
+   
+   /** A helper. */
+   private static final ManagedObjectRecreationHelper helper;
+   
+   /** The meta value factory */
+   private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+   
+   /** The meta type factory */
+   private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
+   
+   /** The persistence plugin. */
+   private DelegatingPersistencePlugin plugin = new DelegatingPersistencePlugin(helper);
+   
+   /** The logger. */
+   protected Logger log = Logger.getLogger(getClass());
+   
+   static
+   {
+      helper = new ManagedObjectRecreationHelper(managedObjectFactory);
+   }
+   
+   public AbstractPersistenceFormatTest(String name)
+   {
+      super(name);
+   }
+
+   protected ManagedObjectPersistencePlugin getPersistencePlugin()
+   {
+      return this.plugin;
+   }
+   
+   protected ManagedObjectFactory getMOF()
+   {
+      return managedObjectFactory;
+   }
+   
+   protected MetaValueFactory getMVF()
+   {
+      return this.metaValueFactory;
+   }
+   
+   protected MetaTypeFactory getMTF()
+   {
+      return this.metaTypeFactory;
+   }
+   
+   protected ManagedObject initManagedObject(Object o)
+   {
+      return getMOF().initManagedObject(o, null);
+   }
+   
+   protected PersistedManagedObject restore(ManagedObject mo) throws Exception
+   {
+      PersistedManagedObject moElement = plugin.createPersistedManagedObject(mo);
+      
+      File file = File.createTempFile("test", null);
+      serialize(moElement, file);
+      return deserialize(file);
+   }
+   
+   protected void serialize(PersistedManagedObject moElement, File file) throws Exception
+   {
+      JAXBContext ctx = JAXBContext.newInstance(PersistedManagedObject.class);
+      Marshaller marshaller = ctx.createMarshaller();
+      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+      marshaller.marshal(moElement, file);
+      marshaller.marshal(moElement, System.out);
+   }
+   
+   protected PersistedManagedObject deserialize(File file) throws Exception
+   {
+      JAXBContext ctx = JAXBContext.newInstance(PersistedManagedObject.class);
+      Unmarshaller un = ctx.createUnmarshaller();
+      return (PersistedManagedObject) un.unmarshal(file);
+   }
+   
+   protected ManagedObject update(Object attachment, PersistedManagedObject moElement)
+   {
+      ManagedObject mo = getMOF().initManagedObject(attachment, null);
+      return update(mo, moElement);
+   }
+   
+   protected ManagedObject update(ManagedObject mo, PersistedManagedObject persisted)
+   {
+      return getPersistencePlugin().updateManagedObject(persisted, mo);
+   }
+
+   protected Logger getLog()
+   {
+      return log;
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/AbstractPersistenceFormatTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ArrayValueUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ArrayValueUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ArrayValueUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,116 @@
+/*
+ * 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.persistence.test;
+
+import java.util.Arrays;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.SimpleArrayMetaData;
+
+/**
+ * Simple attachment persistence test for array values.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ArrayValueUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public ArrayValueUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testSimpleArray() throws Throwable
+   {
+      ManagedObject mo = initMO();
+      PersistedManagedObject moElement = restore(mo);
+      
+      assertNotNull(moElement);
+      ManagedObject restored = update(new SimpleArrayMetaData(), moElement);
+      
+      assertNotNull(restored.getProperties());
+      assertEquals(3, restored.getProperties().size());
+      
+      // Test 1D
+      ArrayValue test1D = (ArrayValue) restored.getProperty("test1D").getValue();
+      assertNotNull(test1D);
+      
+      char[] unwrapped1D = (char[]) getMVF().unwrap(test1D);
+      assertNotNull(unwrapped1D);
+      assertTrue(Arrays.equals(init1D(), unwrapped1D));
+      
+      // Test 2D
+      ArrayValue test2D = (ArrayValue) restored.getProperty("test2D").getValue();
+      assertNotNull(test2D);
+      assertEquals(2, test2D.getMetaType().getDimension());
+      
+      char[][] unwrapped2D = (char[][]) getMVF().unwrap(test2D);
+      assertNotNull(unwrapped2D);
+      assertEquals(2, unwrapped2D.length);
+      assertEquals('a', unwrapped2D[0][0]);
+      assertEquals('f', unwrapped2D[1][1]);
+
+      // Test 3D
+      ArrayValue test3D = (ArrayValue) restored.getProperty("test3D").getValue();
+      assertNotNull(test3D);
+      assertEquals(3, test3D.getMetaType().getDimension());
+
+      char[][][] unwrapped3D = (char[][][]) getMVF().unwrap(test3D);
+      assertNotNull(unwrapped3D);
+      
+      assertEquals(3, unwrapped3D[0].length);
+      assertEquals(3, unwrapped3D[0][0].length);
+      assertEquals(2, unwrapped3D[0][1].length);
+      assertEquals(2, unwrapped3D[0][2].length);
+      assertEquals('g', unwrapped3D[0][2][0]);
+      assertEquals('h', unwrapped3D[0][2][1]);
+   }
+   
+   protected ManagedObject initMO()
+   {
+      SimpleArrayMetaData instance = new SimpleArrayMetaData();
+      instance.setTest1D(init1D());
+      instance.setTest2D(init2D());
+      instance.setTest3D(init3D());
+      
+      return getMOF().initManagedObject(instance, null);
+   }
+   
+   protected char[] init1D()
+   {
+      return new char[] {'a', 'b', 'c'};
+   }
+   
+   protected char[][] init2D()
+   {
+      return new char[][] {{'a', 'b', 'c'}, { 'e', 'f'}};
+   }
+   
+   protected char[][][] init3D()
+   {
+      return new char[][][] {{{'a', 'b', 'c'}, { 'e', 'f'}, {'g', 'h'}}};
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ArrayValueUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,250 @@
+/*
+ * 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.persistence.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.PrimitiveMetaData;
+import org.jboss.test.profileservice.persistence.support.TestMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicPersistenceFormatUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public BasicPersistenceFormatUnitTestCase(String name)
+   {
+      super(name);
+   }
+   public void testPrimitive() throws Throwable
+   {
+      // Create initial model
+      ManagedObject mo = createPrimitiveMO();
+      assertNotNull(mo);
+      
+      ManagedProperty p = mo.getProperty("name");
+      assertNotNull(p);
+      p.setValue(SimpleValueSupport.wrap("newName"));
+      
+      p = mo.getProperty("integer");
+      p.setValue(SimpleValueSupport.wrap(111));
+      
+      mo.getProperty("optionalName").setValue(SimpleValueSupport.wrap("optional"));
+      
+      // Assert the restored information
+      PersistedManagedObject restored = restore(mo);
+      assertNotNull(restored);
+      
+      mo = update(new PrimitiveMetaData(), restored);
+      
+      assertEquals("newName", getMVF().unwrap(mo.getProperty("name").getValue()));
+      SimpleValue integer = (SimpleValue) mo.getProperty("integer").getValue();
+      assertEquals(111, getMVF().unwrap(integer));
+      assertTrue("actual " + integer , SimpleMetaType.INTEGER_PRIMITIVE.isValue(integer));
+      assertEquals("optional", ((SimpleValue) mo.getProperty("optionalName").getValue()).getValue());
+      
+   }
+   
+   public void testMetaDataPrimitive() throws Throwable
+   {
+      ManagedObject mo = createTestMetaDataMO();
+      assertNotNull(mo);
+      ManagedProperty p = mo.getProperty("primitive");
+      assertNotNull(p);
+      
+      CompositeValue nested = (CompositeValue) p.getValue();
+      MetaValue name = nested.get("name");
+      assertNotNull(name);
+      MetaValue integer = nested.get("integer");
+      assertNotNull(integer);
+
+      // Change values
+      Map<String, MetaValue> changedMap = new HashMap<String, MetaValue>();
+      changedMap.put("name", new SimpleValueSupport(
+            (SimpleMetaType) name.getMetaType(), "newName"));
+      changedMap.put("integer", new SimpleValueSupport(
+            (SimpleMetaType) integer.getMetaType(), 111));
+      
+      // Set new values
+      p.setValue(
+            new CompositeValueSupport(nested.getMetaType(), changedMap)
+            );
+
+      // Save and restore
+      PersistedManagedObject restored = restore(mo);
+      assertNotNull(restored);
+      
+      // Create empty
+      mo = update(new TestMetaData(), restored);
+      
+      p = mo.getProperty("primitive");
+      nested = (CompositeValue) p.getValue();
+      name = nested.get("name");
+      assertNotNull(name);
+      integer = nested.get("integer");
+      assertNotNull(integer);
+      
+      //
+      assertEquals(111, ((SimpleValue) integer).getValue());
+      assertEquals("newName", ((SimpleValue) name).getValue());
+   }
+   
+   
+   public void testMetaDataMap() throws Throwable
+   {
+      ManagedObject mo = createTestMetaDataMO();
+      assertNotNull(mo);
+      
+      ManagedProperty p = mo.getProperty("testMap");
+      assertNotNull(p);
+      
+      MapCompositeValueSupport composite = (MapCompositeValueSupport) p.getValue();
+      assertNotNull(composite);
+      
+      SimpleValue v = (SimpleValue) composite.get("testString2");
+      assertNotNull(v);
+      
+      composite.put("testString2", SimpleValueSupport.wrap("changedString"));
+      
+      PersistedManagedObject restored = restore(mo);
+      assertNotNull(restored);
+      
+      mo = update(new TestMetaData(), restored);
+      
+      p = mo.getProperty("testMap");
+      assertNotNull(p);
+      
+      CompositeValue changedComposite = (CompositeValue) p.getValue();
+      assertNotNull(changedComposite);
+      
+      v = (SimpleValue) changedComposite.get("testString2");
+      assertEquals("changedString", v.getValue());
+   }
+   
+   public void testPrimitiveArray() throws Throwable
+   {
+      ManagedObject mo = createTestMetaDataMO();
+      assertNotNull(mo);
+      
+      ManagedProperty p = mo.getProperty("charArray");
+      assertNotNull(p);
+      
+      ArrayValue a = (ArrayValue) p.getValue();
+      assertNotNull(a);
+      
+      SimpleValueSupport svs = (SimpleValueSupport) a.getValue(1);
+      assertNotNull(svs);
+      svs.setValue('H');
+      
+      PersistedManagedObject restored = restore(mo);
+      assertNotNull(restored);
+      
+      //
+      mo = update(new TestMetaData(), restored);
+      
+      p = mo.getProperty("charArray");
+      assertNotNull(p);
+      
+      a = (ArrayValue) p.getValue();
+      assertNotNull(a);
+      
+      assertEquals('H', ((SimpleValue) a.getValue(1)).getValue());
+   }
+   
+   protected ManagedObject createMO(Object o)
+   {
+      return getMOF().initManagedObject(o, null);
+   }
+   
+   protected ManagedObject createPrimitiveMO()
+   {
+      PrimitiveMetaData md = createPrimitive();
+      assertNotNull(md);
+      return createMO(md);
+   }
+   
+   protected ManagedObject createTestMetaDataMO()
+   {
+      return createMO(createTestMetaData());
+   }
+   
+   protected TestMetaData createTestMetaData()
+   {
+      TestMetaData test = new TestMetaData();
+      test.setPrimitive(createPrimitive());
+      
+      // Create list
+      List<String> list = new ArrayList<String>();
+      
+      list.add("String1");
+      list.add("String2");
+      list.add("String3");
+      
+      test.setList(list);
+      
+      // Create map
+      Map<String, String> map = new HashMap<String, String>();
+      
+      map.put("testString1", "string1");
+      map.put("testString2", "string2");
+      map.put("testString3", "string3");
+      
+      test.setTestMap(map);
+      
+      // Create primitive array
+      
+      Character[] array = new Character[3];
+      
+      array[0] = 'A';
+      array[1] = 'B';
+      array[2] = 'C';
+      
+      test.setCharArray(array);
+      
+      return test;
+   }
+   
+   protected PrimitiveMetaData createPrimitive()
+   {
+      PrimitiveMetaData primitive = new PrimitiveMetaData();
+      primitive.setInteger(12);
+      primitive.setName("testName");
+      return primitive;
+   }
+
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/CollectionValueUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/CollectionValueUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/CollectionValueUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,83 @@
+/*
+ * 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.persistence.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.CollectionMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CollectionValueUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public CollectionValueUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void test() throws Throwable
+   {
+      ManagedObject mo = initMO();
+      PersistedManagedObject moElement = restore(mo);
+      assertNotNull(moElement);
+      
+      ManagedObject restored = update(new CollectionMetaData(), moElement);
+      
+      assertNotNull(restored);
+
+      assertNotNull(restored.getProperty("collection"));
+      
+      List<String> restoredList = ((CollectionMetaData) restored.getAttachment()).getCollection(); 
+      assertNotNull(restoredList);
+      assertEquals(3, restoredList.size());
+      assertTrue(restoredList.containsAll(initList()));
+
+   }
+
+   protected CollectionMetaData createMetaData()
+   {
+      CollectionMetaData instance = new CollectionMetaData();
+      instance.setCollection(initList());
+      return instance;
+   }
+   
+   protected ManagedObject initMO()
+   {
+      return getMOF().initManagedObject(createMetaData(), null);
+   }
+   
+   protected List<String> initList()
+   {
+      List<String> list = new ArrayList<String>();
+      list.add("string1");
+      list.add("string2");
+      list.add("string3");
+      return list;
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/CollectionValueUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/GenericValueUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/GenericValueUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/GenericValueUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,103 @@
+/*
+ * 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.persistence.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.GenericSupportMetaData;
+import org.jboss.test.profileservice.persistence.support.SimpleGenericMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class GenericValueUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public GenericValueUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test() throws Throwable
+   {
+      ManagedObject mo = createTestMO();
+
+      CollectionValue collection = (CollectionValue) mo.getProperty("list").getValue();
+      ManagedObject child2 = (ManagedObject) ((GenericValue) collection.getElements()[1]).getValue();
+      child2.getProperty("string").setValue(SimpleValueSupport.wrap("changedName"));
+      // TODO test generic array
+      
+      PersistedManagedObject moElement = restore(mo);
+
+      ManagedObject restored = update(new GenericSupportMetaData(), moElement);
+
+      GenericSupportMetaData md = (GenericSupportMetaData) restored.getAttachment();
+      assertNotNull(md);
+      
+      SimpleGenericMetaData child = md.getList().get(1);
+      assertEquals(child.getString(), "changedName");
+   }
+
+   private ManagedObject createTestMO()
+   {
+      return getMOF().initManagedObject(createTestMetaData(), null);
+   }
+
+   private GenericSupportMetaData createTestMetaData()
+   {
+      GenericSupportMetaData metaData = new GenericSupportMetaData();
+
+      List<SimpleGenericMetaData> list = new ArrayList<SimpleGenericMetaData>();
+
+      SimpleGenericMetaData child1 = createSImple("child1", 11, null);
+      SimpleGenericMetaData child2 = createSImple("child2", 21, null);
+
+      list.add(createSImple("parent1", 1, child1));
+      list.add(createSImple("parent2", 2, child2));
+
+      metaData.setList(list);
+
+      return metaData;
+   }
+   
+   protected SimpleGenericMetaData[][] createArray()
+   {
+
+      SimpleGenericMetaData child1 = createSImple("array11", 11, null);
+      SimpleGenericMetaData child2 = createSImple("array12", 12, null);
+      SimpleGenericMetaData child3 = createSImple("array21", 21, null);
+      SimpleGenericMetaData child4 = createSImple("array22", 22, null);      
+      return new SimpleGenericMetaData[][] {{child1, child2}, {child3, child4}};
+   }
+
+   private SimpleGenericMetaData createSImple(String string, int integer, SimpleGenericMetaData child)
+   {
+      return new SimpleGenericMetaData(string, integer, child);
+   }
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/GenericValueUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/MapCompositeUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/MapCompositeUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/MapCompositeUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,87 @@
+/*
+ * 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.persistence.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.SimpleStringMapMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MapCompositeUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public MapCompositeUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test() throws Throwable
+   {
+      ManagedObject mo = initMO();
+      
+      ManagedProperty p = mo.getProperty("map");
+      assertNotNull(p);
+      MapCompositeValueSupport value = (MapCompositeValueSupport) p.getValue();
+      assertNotNull(value);
+      assertNotNull(value.get("test1"));
+      getLog().debug("keys: " + value.getMetaType().itemSet());
+      
+      PersistedManagedObject moElement = restore(mo);
+      assertNotNull(moElement);
+      
+      ManagedObject restored = update(new SimpleStringMapMetaData(), moElement);
+      assertNotNull(restored);
+      SimpleStringMapMetaData metadata = (SimpleStringMapMetaData) restored.getAttachment();
+      assertTrue(metadata.getMap().equals(initMap()));
+   }
+   
+   protected SimpleStringMapMetaData createTestMetaData()
+   {
+      SimpleStringMapMetaData instance = new SimpleStringMapMetaData();
+      instance.setMap(initMap());
+      return instance;
+   }
+   
+   protected ManagedObject initMO()
+   {
+      return getMOF().initManagedObject(createTestMetaData(), null);
+   }
+   
+   protected Map<String, String> initMap()
+   {
+      Map<String, String> map = new HashMap<String, String>();
+      map.put("test1", "one");
+      map.put("test2", "two");
+      map.put("test3", "three");
+      return map;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/MapCompositeUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ObjectNameUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ObjectNameUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ObjectNameUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,109 @@
+/*
+ * 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.test.profileservice.persistence.test;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.PropertiesMetaValue;
+import org.jboss.profileservice.persistence.xml.PersistedCompositeValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.profileservice.persistence.xml.PersistedPropertiesValue;
+import org.jboss.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.profileservice.persistence.xml.PersistedSimpleValue;
+import org.jboss.test.profileservice.persistence.support.ObjectNameMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ObjectNameUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public ObjectNameUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void test() throws Throwable
+   {
+      ManagedObject mo = getMOF().initManagedObject(createMD(), null);
+      assertNotNull(mo);
+      
+      ManagedProperty p = mo.getProperty("name");
+      CompositeValue c = (CompositeValue) p.getValue();
+      assertNotNull(c);
+      PropertiesMetaValue properties = (PropertiesMetaValue) c.get("keyPropertyList");
+      properties.put("v", "value5");
+
+      // Assert xml information
+      PersistedManagedObject restoredElement = restore(mo);
+      assertNotNull(restoredElement);
+      
+      
+      // The objectName
+      PersistedProperty pp = restoredElement.getProperties().get(1);
+      assertNotNull(pp);
+      
+      PersistedCompositeValue pcv = (PersistedCompositeValue) pp.getValue();
+      assertNotNull(pcv);
+      
+      PersistedSimpleValue psv = (PersistedSimpleValue) pcv.getValues().get(0);
+      assertEquals("domain", psv.getName());
+      assertEquals("org.jboss", psv.getValue());
+      
+      PersistedPropertiesValue ppv = (PersistedPropertiesValue) pcv.getValues().get(1); 
+      assertEquals("keyPropertyList", ppv.getName());
+      assertEquals(2, ppv.getEntries().size());
+      
+      // The other object name
+      PersistedProperty po = restoredElement.getProperties().get(0);
+      assertNotNull(po);
+      assertTrue(po.getValue() instanceof PersistedSimpleValue);
+      
+      //
+      ManagedObject restored = update(new ObjectNameMetaData(), restoredElement);
+      assertNotNull(restored);
+      ObjectNameMetaData metaData = (ObjectNameMetaData) restored.getAttachment();
+      assertEquals(createObjectName("value5"), metaData.getName());
+
+   }
+   
+   
+   protected ObjectNameMetaData createMD() throws Exception
+   {
+      ObjectNameMetaData md = new ObjectNameMetaData();
+      // Set objectName
+      md.setName(createObjectName("value1"));
+      md.setOtherName(createObjectName("value2"));
+      
+      return md;
+   }
+   
+   protected ObjectName createObjectName(String v) throws Exception
+   {
+      return new ObjectName("org.jboss:test=test,v="+v);
+   }
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/ObjectNameUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/PersistenceFormatTestSuite.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/PersistenceFormatTestSuite.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/PersistenceFormatTestSuite.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,51 @@
+/*
+ * 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.persistence.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PersistenceFormatTestSuite extends TestSuite
+{
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("PS persistence format tests.");
+      
+      suite.addTestSuite(ArrayValueUnitTestCase.class);
+      suite.addTestSuite(BasicPersistenceFormatUnitTestCase.class);
+      suite.addTestSuite(CollectionValueUnitTestCase.class);
+      suite.addTestSuite(GenericValueUnitTestCase.class);
+      suite.addTestSuite(MapCompositeUnitTestCase.class);
+      suite.addTestSuite(TableValueUnitTestCase.class);
+      suite.addTestSuite(TestNestedPeristenceFormatUnitTestCase.class);
+      suite.addTestSuite(ObjectNameUnitTestCase.class);
+      
+      return suite;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/PersistenceFormatTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TableValueUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TableValueUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TableValueUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,112 @@
+/*
+ * 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.persistence.test;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.TableMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.api.values.TableValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.SimpleTableMetaData;
+
+
+/**
+ * Simple attachment persistence test for table values.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TableValueUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public TableValueUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testSimpleTableValue() throws Throwable
+   {
+      ManagedObject mo = initMO();
+      assertNotNull(mo);
+
+      // Restore
+      PersistedManagedObject moElement = restore(mo);
+      assertNotNull(moElement);
+      assertNotNull(moElement.getProperties());
+
+      // Recreate MO
+      ManagedObject restored = update(new SimpleTableMetaData(), moElement);
+
+      // Assert
+      ManagedProperty p = restored.getProperty("map");
+      assertTrue(p.getValue() instanceof TableValue);
+      assertTrue(p.getMetaType() instanceof TableMetaType);
+      
+      TableValue table = (TableValue) p.getValue();
+      assertRow(table, 1, "one");
+      assertRow(table, 2, "two");
+      assertRow(table, 3, "three");
+      
+      SimpleTableMetaData metaData = (SimpleTableMetaData) restored.getAttachment();
+      assertTrue(metaData.getMap().equals(initMap()));
+   }
+   
+   protected void assertRow(TableValue table, Serializable key, Serializable value)
+   {
+      CompositeValue v = (CompositeValue) table.get(new MetaValue[] { SimpleValueSupport.wrap(key) });
+      assertNotNull(v);
+      // Assert value
+      SimpleValue simple = (SimpleValue) v.get("value");
+      assertNotNull(simple);
+      assertEquals(value, simple.getValue());      
+   }
+   
+   protected SimpleTableMetaData createTestMetaData()
+   {
+      SimpleTableMetaData t = new SimpleTableMetaData();
+      t.setMap(initMap());
+      return t;
+   }
+
+   protected ManagedObject initMO()
+   {
+      return getMOF().initManagedObject(createTestMetaData(), null);
+   }
+   
+   protected Map<Integer, String> initMap()
+   {
+      Map<Integer, String> map = new HashMap<Integer, String>();
+      map.put(1, "one");
+      map.put(2, "two");
+      map.put(3, "three");
+      return map;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TableValueUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,246 @@
+/*
+ * 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.test.profileservice.persistence.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.profileservice.persistence.support.NestedTestMetaData;
+import org.jboss.test.profileservice.persistence.support.PrimitiveMetaData;
+import org.jboss.test.profileservice.persistence.support.TestMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TestNestedPeristenceFormatUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+   public TestNestedPeristenceFormatUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test() throws Throwable
+   {
+      ManagedObject mo = createNestedMO();
+      
+      // deployment1
+      ManagedObject deployment = getDeployment("testDeployment1", mo);
+      assertNotNull(deployment);
+      deployment.getProperty("");
+      
+      ManagedProperty p = deployment.getProperty("primitive");
+      assertNotNull(p);
+      
+      CompositeValue composite = (CompositeValue) p.getValue();
+      
+      Map<String, MetaValue> valueMap = new HashMap<String, MetaValue>();
+      valueMap.put("optionalName",
+            new SimpleValueSupport(SimpleMetaType.STRING, "changed"));
+      valueMap.put("integer", new SimpleValueSupport(
+            SimpleMetaType.INTEGER_PRIMITIVE, 111));
+
+      //
+      p.setValue(new CompositeValueSupport(composite.getMetaType(), valueMap));
+
+      ManagedProperty property = deployment.getProperty("name");
+      assertNotNull(property);
+      property.setValue(SimpleValueSupport.wrap("ChangedName"));
+      
+      // deployment3
+      deployment = getDeployment("testDeployment3", mo);
+      assertNotNull(deployment);
+      
+      property = deployment.getProperty("name");
+      assertNotNull(property);
+      property.setValue(SimpleValueSupport.wrap("ChangedName3"));
+
+      PersistedManagedObject restored = restore(mo);
+      assertNotNull(restored);
+      PersistedCollectionValue collection = (PersistedCollectionValue) restored.getProperties().get(0).getValue(); 
+      assertNotNull(collection);
+      PersistedManagedObject o = ((PersistedGenericValue) collection.getValues().get(0)).getManagedObject();
+      assertNotNull(o);
+
+      // Recreate
+      mo = update(createNestedTestMetaData(), restored);
+      
+      deployment = getDeployment("ChangedName", mo); 
+      assertNotNull("changed name deployment null", deployment);
+      
+      p = deployment.getProperty("primitive");
+      assertNotNull(p);
+      
+      composite = (CompositeValue) p.getValue();
+      assertNotNull(composite);
+      
+      assertEquals("changed", ((SimpleValue)composite.get("optionalName")).getValue());
+      
+      
+      deployment = getDeployment("testDeployment2", mo);
+      assertNotNull(deployment);
+      
+      deployment = getDeployment("ChangedName3", mo);
+      assertNotNull(deployment);
+
+      // Null
+      deployment = getDeployment("testDeployment1", mo);
+      assertNull(deployment);
+      // Null
+      deployment = getDeployment("testDeployment3", mo);
+      assertNull(deployment);
+
+      NestedTestMetaData md = (NestedTestMetaData) mo.getAttachment();
+      assertNotNull(md);
+      
+      assertNotNull(md.getDeployments());
+   }
+   
+   protected ManagedObject getDeployment(String name, ManagedObject mo)
+   {
+    
+      ManagedProperty p = mo.getProperty("deployments");
+      CollectionValue collection = (CollectionValue) p.getValue();
+      
+      assertTrue(p.getMetaType().isCollection());
+      assertNotNull("null collection", collection);
+      assertEquals(3, collection.getSize());;
+      
+      for(MetaValue value : collection)
+      {         
+         ManagedObject deployment = (ManagedObject) ((GenericValue) value).getValue();
+         
+         ManagedProperty nameProp = deployment.getProperty("name");
+         assertNotNull(nameProp);
+         
+         String deploymentName = (String) ((SimpleValue) deployment.getProperty("name").getValue()).getValue();
+         
+         if(name.equals(deploymentName))
+            return deployment; 
+      }
+      return null;
+   }
+   
+   protected ManagedObject createNestedMO()
+   {
+      return createMO(createNestedTestMetaData());
+   }
+   
+   protected ManagedObject createMO(Object o)
+   {
+      return getMOF().initManagedObject(o, null);
+   }
+   
+   protected NestedTestMetaData createNestedTestMetaData()
+   {
+      NestedTestMetaData test = new NestedTestMetaData();
+      
+      List<TestMetaData> deployments = new ArrayList<TestMetaData>();
+      
+      deployments.add(createTestMetaData("testDeployment1"));
+      deployments.add(createTestMetaData("testDeployment2"));
+      deployments.add(createTestMetaData("testDeployment3"));
+      
+      test.setDeployments(deployments);
+      return test;
+   }
+   
+   protected TestMetaData createTestMetaData(String name)
+   {
+      TestMetaData test = new TestMetaData();
+      
+      //
+      test.setName(name);
+      
+      // primitive
+      test.setPrimitive(createPrimitive());
+      
+      // Create list
+      List<String> list = new ArrayList<String>();
+      
+      list.add("String1");
+      list.add("String2");
+      list.add("String3");
+      
+      test.setList(list);
+      
+      // Create map
+      Map<String, String> map = new HashMap<String, String>();
+      
+      map.put("testString1", "string1");
+      map.put("testString2", "string2");
+      map.put("testString3", "string3");
+      
+      test.setTestMap(map);
+      
+      // Create primitive array
+      Character[] array = new Character[3];
+      
+      array[0] = 'A';
+      array[1] = 'B';
+      array[2] = 'C';
+      
+      test.setCharArray(array);
+      
+      // Create 2D array
+      char[][] test2D = {{'h', 'e'}, {'l', 'l', 'o'}};
+      test.setTest2dChar(test2D);
+      
+      getLog().debug(test2D.length);
+      
+      // Create table
+      Map<Integer, String> table = new HashMap<Integer, String>();
+      table.put(1, "one");
+      table.put(2, "two");
+      table.put(3, "three");
+      
+      test.setTable(table);
+      
+      return test;
+   }
+   
+   protected PrimitiveMetaData createPrimitive()
+   {
+      PrimitiveMetaData primitive = new PrimitiveMetaData();
+      primitive.setInteger(12);
+      primitive.setName("testName");
+      return primitive;
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/persistence/src/test/java/org/jboss/test/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/persistence/src/test/resources/log4j.properties
===================================================================
--- projects/profileservice/trunk/persistence/src/test/resources/log4j.properties	                        (rev 0)
+++ projects/profileservice/trunk/persistence/src/test/resources/log4j.properties	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,18 @@
+### ====================================================================== ###
+##                                                                          ##
+##  JBoss Bootstrap Log4j Configuration                                     ##
+##                                                                          ##
+### ====================================================================== ###
+
+### $Id: log4j.properties 71868 2008-04-10 02:14:32Z scott.stark at jboss.org $ ###
+
+log4j.rootCategory=DEBUG, CONSOLE
+log4j.org.jboss.util=TRACE
+log4j.org.jboss.profileservice=TRACE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.CONSOLE.org.jboss.xb.binding.parser.sax=INFO

Added: projects/profileservice/trunk/pom.xml
===================================================================
--- projects/profileservice/trunk/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.jboss</groupId>
+		<artifactId>jboss-parent</artifactId>
+		<version>4</version>
+	</parent>
+	<groupId>org.jboss.profileservice</groupId>
+	<artifactId>jboss-profileservice-parent</artifactId>
+	<version>1.0.0-SNAPSHOT</version>
+	<packaging>pom</packaging>
+	<name>JBoss ProfileService Parent POM</name>
+	<url>http://www.jboss.org/jbossas</url>
+	<description>JBoss ProfileService Parent POM</description>
+	<scm>
+		<!--
+			<connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/profileservice/trunk/</connection>
+			<developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/profileservice/trunk/</developerConnection>
+			<url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/profileservice/trunk/</url>
+		-->
+	</scm>
+
+	<!-- Properties -->
+	<properties>
+	    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	    
+		<version.junit>3.8.2</version.junit>
+		<version.org.jboss.common.core>2.2.11.GA</version.org.jboss.common.core>
+		<version.org.jboss.jbossxb>2.0.1.GA</version.org.jboss.jbossxb>
+		<version.org.jboss.logging>2.0.5.GA</version.org.jboss.logging>
+		<version.org.jboss.man>2.1.1.CR1</version.org.jboss.man>
+		<version.org.jboss.microcontainer>2.0.4.GA</version.org.jboss.microcontainer>
+		<version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
+		<version.org.jboss.vfs>2.1.0.GA</version.org.jboss.vfs>
+		<version.sun.jaxb>2.1.9-brew</version.sun.jaxb>
+	</properties>
+
+	<modules>
+		<module>spi</module>
+		<module>persistence</module>
+		<module>domain</module>
+		<module>core</module>
+		<module>sandbox</module>
+		<module>build</module>
+	</modules>
+
+	<build>
+		<finalName>${artifactId}</finalName>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.0.2</version>
+				<configuration>
+					<source>1.6</source>
+					<target>1.6</target>
+					<showDeprecation>true</showDeprecation>
+					<showWarnings>true</showWarnings>
+					<optimize>true</optimize>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-release-plugin</artifactId>
+				<version>2.0-beta-7</version>
+				<!--
+					<configuration>
+					<tagBase>https://svn.jboss.org/repos/jbossas/projects/jboss-profileservice/tags</tagBase>
+					<autoVersionSubmodules>true</autoVersionSubmodules>
+					</configuration>
+				-->
+			</plugin>
+		</plugins>
+
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<artifactId>maven-idea-plugin</artifactId>
+					<configuration>
+						<downloadSources>true</downloadSources>
+					</configuration>
+				</plugin>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-jar-plugin</artifactId>
+					<version>2.2</version>
+				</plugin>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-surefire-plugin</artifactId>
+					<version>2.4.2</version>
+					<configuration>
+						<redirectTestOutputToFile>true</redirectTestOutputToFile>
+						<includes>
+							<include>org/jboss/test/**/*TestCase.java</include>
+						</includes>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+
+	<reporting>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-project-info-reports-plugin</artifactId>
+				<reportSets>
+					<reportSet>
+						<reports>
+							<report>dependencies</report>
+							<report>issue-tracking</report>
+							<report>license</report>
+							<report>scm</report>
+						</reports>
+					</reportSet>
+				</reportSets>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>findbugs-maven-plugin</artifactId>
+				<version>1.0.0</version>
+			</plugin>
+		</plugins>
+	</reporting>
+
+	<dependencyManagement>
+		<dependencies>
+
+			<dependency>
+				<groupId>junit</groupId>
+				<artifactId>junit</artifactId>
+				<version>${version.junit}</version>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss</groupId>
+				<artifactId>jboss-common-core</artifactId>
+				<version>${version.org.jboss.common.core}</version>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss.logging</groupId>
+				<artifactId>jboss-logging-spi</artifactId>
+				<version>2.1.0.GA</version>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.logging</groupId>
+				<artifactId>jboss-logging-jdk</artifactId>
+				<version>2.1.0.GA</version>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.logging</groupId>
+				<artifactId>jboss-logging-log4j</artifactId>
+				<version>2.1.0.GA</version>
+				<exclusions>
+					<exclusion>
+						<groupId>apache-log4j</groupId>
+						<artifactId>log4j</artifactId>
+					</exclusion>
+				</exclusions>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss.man</groupId>
+				<artifactId>jboss-managed</artifactId>
+				<version>${version.org.jboss.man}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.man</groupId>
+				<artifactId>jboss-metatype</artifactId>
+				<version>${version.org.jboss.man}</version>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss</groupId>
+				<artifactId>jbossxb</artifactId>
+				<version>${version.org.jboss.jbossxb}</version>
+				<exclusions>
+					<exclusion>
+						<groupId>jboss</groupId>
+						<artifactId>jboss-common-core</artifactId>
+					</exclusion>
+					<exclusion>
+						<groupId>apache-xerces</groupId>
+						<artifactId>xercesImpl</artifactId>
+					</exclusion>
+				</exclusions>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss.microcontainer</groupId>
+				<artifactId>jboss-dependency</artifactId>
+				<version>${version.org.jboss.microcontainer}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.jboss.microcontainer</groupId>
+				<artifactId>jboss-kernel</artifactId>
+				<version>${version.org.jboss.microcontainer}</version>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jboss</groupId>
+				<artifactId>jboss-vfs</artifactId>
+				<version>${version.org.jboss.vfs}</version>
+			</dependency>
+
+			<dependency>
+				<groupId>sun-jaxb</groupId>
+				<artifactId>jaxb-api</artifactId>
+				<version>${version.sun.jaxb}</version>
+			</dependency>
+			<dependency>
+				<groupId>sun-jaxb</groupId>
+				<artifactId>jaxb-impl</artifactId>
+				<version>${version.sun.jaxb}</version>
+			</dependency>
+
+		</dependencies>
+	</dependencyManagement>
+
+  <!-- Repositories -->
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Releases Repository</name>
+      <url>http://repository.jboss.org/maven2</url>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshots Repository</name>
+      <url>http://snapshots.jboss.org/maven2</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <!-- Plugin Repositories -->
+  <pluginRepositories>
+    <pluginRepository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Plugin Releases</name>
+      <url>http://repository.jboss.org/maven2</url>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </pluginRepository>
+    <pluginRepository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Plugin Snapshots</name>
+      <url>http://snapshots.jboss.org/maven2</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+
+</project>


Property changes on: projects/profileservice/trunk/sandbox
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/sandbox/.classpath
===================================================================
--- projects/profileservice/trunk/sandbox/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/sandbox/.project
===================================================================
--- projects/profileservice/trunk/sandbox/.project	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-sandbox</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/sandbox/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/sandbox/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 15:18:50 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/sandbox/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/sandbox/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Thu Aug 13 15:18:47 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/sandbox/pom.xml
===================================================================
--- projects/profileservice/trunk/sandbox/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.profileservice</groupId>
+    <artifactId>jboss-profileservice-parent</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.profileservice</groupId>
+  <artifactId>jboss-profileservice-sandbox</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>JBoss ProfileService Sandbox</name>
+  <url>http://www.jboss.org/jbossas</url>
+  <description>JBoss ProfileService Sandbox</description>
+
+  <dependencies>
+  </dependencies>
+  
+</project>


Property changes on: projects/profileservice/trunk/spi
___________________________________________________________________
Name: svn:ignore
   + target


Added: projects/profileservice/trunk/spi/.classpath
===================================================================
--- projects/profileservice/trunk/spi/.classpath	                        (rev 0)
+++ projects/profileservice/trunk/spi/.classpath	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: projects/profileservice/trunk/spi/.project
===================================================================
--- projects/profileservice/trunk/spi/.project	                        (rev 0)
+++ projects/profileservice/trunk/spi/.project	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-profileservice-spi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/profileservice/trunk/spi/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/profileservice/trunk/spi/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/profileservice/trunk/spi/.settings/org.eclipse.jdt.core.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,5 @@
+#Thu Aug 13 14:46:38 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: projects/profileservice/trunk/spi/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/profileservice/trunk/spi/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/profileservice/trunk/spi/.settings/org.maven.ide.eclipse.prefs	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,9 @@
+#Mon Jun 22 19:42:38 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/profileservice/trunk/spi/pom.xml
===================================================================
--- projects/profileservice/trunk/spi/pom.xml	                        (rev 0)
+++ projects/profileservice/trunk/spi/pom.xml	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,36 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>org.jboss.profileservice</groupId>
+		<artifactId>jboss-profileservice-parent</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.jboss.profileservice</groupId>
+	<artifactId>jboss-profileservice-spi</artifactId>
+	<version>1.0.0-SNAPSHOT</version>
+	<packaging>jar</packaging>
+	<name>JBoss ProfileService SPI</name>
+	<url>http://www.jboss.org/jbossas</url>
+	<description>JBoss ProfileService SPI</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.jboss.man</groupId>
+			<artifactId>jboss-managed</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.man</groupId>
+			<artifactId>jboss-metatype</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss</groupId>
+			<artifactId>jboss-vfs</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.microcontainer</groupId>
+			<artifactId>jboss-dependency</artifactId>
+		</dependency>
+	</dependencies>
+
+</project>

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ContextStateMapper.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ContextStateMapper.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ContextStateMapper.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,93 @@
+/*
+ * 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.deployers.spi.management;
+
+import java.util.Map;
+
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Basic state mapper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ContextStateMapper<T extends Enum<?>>
+{
+   
+   /** The state mappings. */
+   private Map<String, T> mappings;
+   
+   /** Installing state. */
+   private T installState;
+   
+   /** Uninstalling state. */
+   private T uninstallState;
+   
+   /** The unknown state. */
+   private T unknown;
+   
+   /** The error state. */
+   private T error;
+
+   public ContextStateMapper(Map<String, T> mappings,
+         T installState, T uninstallState, T error, T unknown)
+   {
+      this.mappings = mappings;
+      this.installState = installState;
+      this.uninstallState = uninstallState;
+      this.error = error;
+      this.unknown = unknown;
+   }
+   
+   public T getErrorState()
+   {
+      return this.error;
+   }
+   
+   public T map(ControllerState currentState, ControllerState toState)
+   {
+      // If the context is in the required state 
+      if(toState == null || currentState.equals(toState))
+         return getMapping(currentState);
+      // The error state
+      if(ControllerState.ERROR.equals(currentState))
+         return error;
+      // installing state
+      if(ControllerState.INSTALLED.equals(toState))
+         return installState;
+      // uninstalling state
+      if(ControllerState.NOT_INSTALLED.equals(toState))
+         return uninstallState;
+      // Fallback
+      return getMapping(currentState);
+   }
+   
+   protected T getMapping(ControllerState controllerState)
+   {
+      T state = unknown;
+      if(controllerState != null)
+       state = mappings.get(controllerState.getStateString());
+      return state;
+   }
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ContextStateMapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DelegatingComponentDispatcher.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DelegatingComponentDispatcher.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DelegatingComponentDispatcher.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.deployers.spi.management;
+
+import org.jboss.managed.api.RunState;
+import org.jboss.metatype.api.values.MetaValue;
+
+/**
+ * A delegating runtime component dispatcher interface used by proxies for
+ * ManagedProperty gets and ManagedOperation invokes.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DelegatingComponentDispatcher
+{
+   /**
+    * Get a property value from a runtime component
+    * 
+    * @param propID - the unique id associated with the ManagedProperty
+    * @param componentName - runtime component name
+    * @param propertyName - property name
+    * @return wrapped MetaValue view of the property value
+    */
+   MetaValue get(Long propID, Object componentName, String propertyName);
+
+   /**
+    * Invoke an operation on a runtime component.
+    * 
+    * @param opID - the unique id associated with the ManagedOperation
+    * @param componentName - runtime component name
+    * @param methodName - the operation name
+    * @param param - the wrapped parameters for the invocation
+    * @return wrapped MetaValue view of the operation result
+    */
+   MetaValue invoke(Long opID, Object componentName, String methodName, MetaValue... param);
+   
+   /**
+    * Get the current RunState of the component.
+    * 
+    * @param componentName - runtime component name
+    * @return the run state
+    */
+   RunState updateRunState(Object componentName); 
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DelegatingComponentDispatcher.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * 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.deployers.spi.management;
+
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A DeploymentTemplate is a template for creating a DeploymentContext given
+ * a set of ManagedProperty representing the template properties
+ * to set in the resulting deployment.
+ * 
+ * TODO: this needs to be fleshed out in terms of the various pieces, raw deployment
+ * files, ManagedObjects, etc. 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentTemplate
+{
+   /**
+    * Get the exportable representation of the properties that the
+    * template supports.
+    * 
+    * @return the external representation of the template properties.
+    */
+   DeploymentTemplateInfo getInfo();
+
+   /**
+    * Get a deployment name based on the base name, which checks
+    * if the name is valid and get the correct suffix for the deployers. 
+    * 
+    * @param deploymentBaseName the base name.
+    * @return the deployment name
+    */
+   String getDeploymentName(String deploymentBaseName);
+   
+   /**
+    * Create a temporary deployment virtual that can be added to a profile.
+    * 
+    * @param values - the template ManagedProperty values
+    * @return a virtual file, which gets distributed to the server and deleted afterwards
+    * @throws Exception - thrown on any failure to create the deployment
+    */
+   VirtualFile applyTemplate(DeploymentTemplateInfo values)
+      throws Exception;
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/DeploymentTemplate.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownComponentTypes.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownComponentTypes.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownComponentTypes.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,374 @@
+/*
+ * 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.deployers.spi.management;
+
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * A collection of enums for the well known component types.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface KnownComponentTypes
+{
+   // constants for well known subtypes
+   public static final String ANY = "*";
+   public static final String XA = "XA";
+   public static final String LOCAL_TX = "LocalTx";
+   public static final String NO_TX = "NoTx";
+   public static final String TX = "Tx";
+   public static final String QUEUE = "Queue";
+   public static final String TOPIC = "Topic";
+   public static final String DURABLE = "DurableTopic";
+
+
+   /**
+    * A component type that should match any other
+    */
+   public static ComponentType ANY_TYPE = new ComponentType(ANY, ANY);
+
+   /**
+    * Enums for the DataSource types
+    */
+   public enum DataSourceTypes
+   {
+      XA("DataSource", KnownComponentTypes.XA), 
+      LocalTx("DataSource", LOCAL_TX), 
+      NoTx("DataSource", NO_TX);
+
+      private final String type;
+      private final String subtype;
+      private DataSourceTypes(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+
+   /**
+    * Enums for generic ConnectionFactory types
+    */
+   public enum ConnectionFactoryTypes
+   {
+      /**
+       * @deprecated use {@link #Tx}
+       */
+      XA("ConnectionFactory", KnownComponentTypes.XA),
+      /**
+       * A transacted connection factory
+       */
+      Tx("ConnectionFactory", TX),
+      /**
+       * A connection factory that does not support transactions
+       */
+      NoTx("ConnectionFactory", NO_TX);
+
+      private final String type;
+      private final String subtype;
+      private ConnectionFactoryTypes(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+
+   /**
+    * Enums for the JMSDestination/{Queue,Topic,DurableTopic} types
+    */
+   public enum JMSDestination
+   {
+      Queue("JMSDestination", "Queue"), 
+      Topic("JMSDestination", "Topic"),
+      DurableTopic("JMSDestination", "DurableTopic");
+
+      private final String type;
+      private final String subtype;
+      private JMSDestination(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+
+   /**
+    * Enums for the EJB/{StatelessSession,StatefulSession,Entity,MDB} types
+    */
+   public enum EJB
+   {
+      StatelessSession("EJB", "StatelessSession"),
+      StatefulSession("EJB", "StatefulSession"),
+      Entity("EJB", "Entity"),
+      MDB("EJB", "MDB");
+
+      private final String type;
+      private final String subtype;
+      private EJB(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+   
+   /**
+    * Enums for the EJB3/{StatelessSession,StatefulSession,MessageDriven} types
+    */   
+   public enum EJB3
+   {
+      StatelessSession("EJB3", "SLSB"),
+      StatefulSession("EJB3", "SFSB"),
+      MessageDriven("EJB3", "MDB");
+
+      private final String type;
+      private final String subtype;
+      private EJB3(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+   
+   /**
+    * Enums for JPA entity bean.
+    */
+   public enum JPA
+   {
+      Entity("JPA", "Entity");
+      
+      private final String type;
+      private final String subtype;
+      private JPA(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }      
+   }
+
+   /**
+    * Enums for the MBean/{Dynamic,Standard,Model,Open,Persistent,XMBean} types
+    */
+   public enum MBean
+   {
+      Dynamic("MBean", "Dynamic"),
+      Standard("MBean", "Standard"),
+      Model("MBean", "Model"),
+      Open("MBean", "Open"),
+      Persistent("MBean", "Persistent"),
+      XMBean("MBean", "XMBean"),
+      Platform("MBean", "Platform");
+
+      private final String type;
+      private final String subtype;
+      private MBean(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   };
+
+   /**
+    * Enums for the MCBean types
+    */
+   public enum MCBean
+   {
+      Any("MCBean", "*");
+
+      private final String type;
+      private final String subtype;
+      private MCBean(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   }
+   
+   /**
+    * Enums for the web component types
+    */
+   public enum Web
+   {
+      Application("Web", "Application"),
+      ApplicationManager("Web", "ApplicationManager"),
+      Connector("Web", "Connector"),
+      Filter("Web", "Filter"),
+      Host("Web", "Host"),
+      Listener("Web", "Listener"),
+      RequestProcessor("Web", "RequestProcessor"),
+      ThreadPool("Web", "ThreadPool"),
+      Servlet("Web", "Servlet");
+
+      private final String type;
+      private final String subtype;
+      private Web(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   }
+   /**
+    * Enums for Server component types
+    */
+   public enum Server
+   {
+      ServerInfo("Server", "ServerInfo"),
+      ServerConfig("Server", "ServerConfig"),
+      MCServer("Server", "MCServer");
+
+      private final String type;
+      private final String subtype;
+      private Server(String type, String subtype)
+      {
+         this.type = type;
+         this.subtype = subtype;
+      }
+
+      public String type()
+      {
+         return type;
+      }
+      public String subtype()
+      {
+         return subtype;
+      }
+      public ComponentType getType()
+      {
+         return new ComponentType(type, subtype);
+      }
+   }
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownComponentTypes.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownDeploymentTypes.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownDeploymentTypes.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management;
+
+import org.jboss.managed.api.ManagedDeployment;
+
+/**
+ * Enum for the known deployment types.
+ * @see {@linkplain ManagedDeployment#getTypes()}
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public enum KnownDeploymentTypes
+{
+   JavaEEApplication("ear"),
+   JavaEEClientApplication("car"),
+   JavaEEEnterpriseBeans2x("ejb2x"),
+   JavaEEEnterpriseBeans3x("ejb3x"),
+   JavaEEWebApplication("war"),
+   JavaEEResourceAdaptor("rar"),
+   JavaEEPersistenceUnit("par"),
+   JBossServices("sar"),
+   MCBeans("beans"),
+   OSGIBundle("bundle"),
+   SpringApplication("spring"),
+   Unknown("*")
+   ;
+
+   /** The simple type string, usually used as the deployment archive suffix */
+   private final String type;
+
+   private KnownDeploymentTypes(String type)
+   {
+      this.type = type;
+   }
+
+   /**
+    * Get the simple deployment type string. This is usually used as the
+    * associated deployment archive suffix.
+    * 
+    * @return the simple deployment type string.
+    */
+   public String getType()
+   {
+      return type;
+   }
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/KnownDeploymentTypes.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ManagementView.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ManagementView.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ManagementView.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,208 @@
+/*
+ * 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.deployers.spi.management;
+
+import java.util.Set;
+
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+
+/**
+ * The management view plugin spi for querying profiles for the
+ * deployment management object interface roots.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ManagementView
+{
+   /**
+    * Load all active profiles in the ManagementView for future operations.  
+    * This must be called before the other ManagementView operations may be used.
+    * 
+    * @return if the ManagementView was reloaded
+    */
+   boolean load();
+
+   /**
+    * Reload the current profiles managed deployments/objects.
+    */
+   void reload();
+
+   /**
+    * Get the names of all deployments.
+    * 
+    * @return the deployment names
+    */
+   Set<String> getDeploymentNames();
+
+   /**
+    * Get the names of the deployment that have the given deployment type.
+    * 
+    * @param type - the deployment type
+    * @return the names
+    */
+   Set<String> getDeploymentNamesForType(String type);
+
+   /**
+    * Search for all deployment names with a name matching the regex expression.
+    * 
+    * @param regex - the regex to query deployment name 
+    * @return the deployment name.
+    * @throws NoSuchDeploymentException if no matches are found 
+    */
+   Set<String> getMatchingDeploymentName(String regex)
+      throws NoSuchDeploymentException;
+   
+   /**
+    * Search for all deployments matched by the matcher.
+    * 
+    * @param name - the name to input to the matcher
+    * @param matcher - the matcher 
+    * @return a possibly empty set of ManagedDeployment accepted by the matcher
+    * @throws Exception
+    */
+   Set<ManagedDeployment> getMatchingDeployments(String name, NameMatcher<ManagedDeployment> matcher)
+      throws NoSuchDeploymentException, Exception;
+
+   /**
+    * Get a deployment.
+    * 
+    * @param name the name
+    * @return the deployment
+    * @throws NoSuchDeploymentException if no matches are found 
+    */
+   ManagedDeployment getDeployment(String name)
+      throws NoSuchDeploymentException;
+
+   /**
+    * Get the deployments of a type.
+    * 
+    * @param type - the deployment or module type.
+    * @return the possibly empty set of deployment with the given type.
+    * @throws Exception
+    */
+   Set<ManagedDeployment> getDeploymentsForType(String type)
+      throws Exception;
+
+   /**
+    * Get a set of the component types in use in the profiles
+    * @return set of component types in use
+    */
+   Set<ComponentType> getComponentTypes();
+
+   /**
+    * Get the components of a type. 
+    * 
+    * @param type - the component type.
+    * @return the possibly empty set of components with the given type.
+    * @throws Exception
+    */
+   Set<ManagedComponent> getComponentsForType(ComponentType type)
+      throws Exception;
+
+   /**
+    * Obtain the ManagedComponent for the given name/type
+    * 
+    * @see #getComponent(String, ComponentType, NameMatcher)
+    * @param name - the ManagedComponent#getName value to match
+    * @param type - the component type
+    * @return the possibly null ManagedComponent
+    * @throws Exception
+    */
+   ManagedComponent getComponent(String name, ComponentType type)
+      throws Exception;
+   /**
+    * Obtain the ManagedComponents for the given name/type and matcher.
+    * 
+    * @param name - the ManagedComponent#getName value to match
+    * @param type - the component type
+    * @param matcher - a matcher that compares name to candidate ManagedComponent
+    * @return the possibly empty set of ManagedComponent matches.
+    * @throws Exception
+    */
+   Set<ManagedComponent> getMatchingComponents(String name, ComponentType type,
+         NameMatcher<ManagedComponent> matcher)
+      throws Exception;
+
+   /**
+    * Update the given component. This takes the component ManagedDeployment,
+    * obtains the ManagedObject set for the underlying deployment, and applies
+    * the component ManagedProperty set to matching the deployment ManagedObject
+    * properties.
+    * 
+    * @param comp the managed component
+    * @throws Exception
+    */
+   void updateComponent(ManagedComponent comp)
+      throws Exception;
+   
+   /**
+    * Removes a given component. This will remove a component from the
+    * associated ManagedDeployment.
+    * 
+    * @param comp the managed component.
+    * @throws Exception
+    */
+   void removeComponent(ManagedComponent comp)
+      throws Exception;
+   
+   /**
+    * Get the registered DeploymentTemplate names.
+    * 
+    * TODO: probably needs a Map<String, DeploymentType> notion
+    * @return the template names
+    */
+   Set<String> getTemplateNames();
+
+   /**
+    * Get a deployment template.
+    * 
+    * @param name - the deployment name to identify the template to retrieve
+    * @return the named DeploymentTemplate
+    * @throws NoSuchDeploymentException - if there is no such template
+    */
+   DeploymentTemplateInfo getTemplate(String name)
+      throws NoSuchDeploymentException;
+
+   /**
+    * Create a deployment based on the given DeploymentTemplateInfo.
+    * 
+    * @param deploymentBaseName the base name
+    * @param info the deployment template info
+    * @throws Exception
+    */
+   void applyTemplate(String deploymentBaseName, DeploymentTemplateInfo info)
+       throws Exception;
+
+   /**
+    * Process the changes made to the profile.
+    * 
+    * @throws Exception
+    */
+   void process() throws Exception;
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/ManagementView.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/NameMatcher.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/NameMatcher.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/NameMatcher.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management;
+
+
+/**
+ * An interface for matching a name against a managed element
+ * 
+ * @see ManagementView##getComponent(String, ComponentType, NameMatcher)
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface NameMatcher<T>
+{
+   /**
+    * 
+    * @param managed - the managed element whose name is to be matched
+    * @param name - the name input from the client
+    * @return
+    */
+   public boolean matches(T comp, String name);
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/NameMatcher.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,74 @@
+/*
+ * 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.deployers.spi.management;
+
+import org.jboss.metatype.api.values.MetaValue;
+
+/**
+ * Dispatches ManagedOperation invocation to runtime component
+ * associated with attachment.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision$
+ */
+public interface RuntimeComponentDispatcher
+{
+   /**
+    * Get value.
+    *
+    * @param componentName the runtime component name
+    * @param propertyName the property name
+    * @return the return meta value
+    */
+   MetaValue get(Object componentName, String propertyName);
+
+   /**
+    * Set the value.
+    *
+    * @param componentName the runtime component name
+    * @param propertyName the property name
+    * @param value the meta value
+    */
+   void set(Object componentName, String propertyName, MetaValue value);
+
+   /**
+    * Dispatch ManagedOperation invocation
+    * with param parameters to coresponding attachment.
+    *
+    * @param componentName the runtime component name
+    * @param methodName the methodName
+    * @param param the parameters
+    * @return runtime component's return value
+    */
+   Object invoke(Object componentName, String methodName, MetaValue... param);
+   
+   /**
+    * Map the state of the component.
+    * 
+    * @param <T> the state enum
+    * @param name the component name
+    * @param mapper the state mapper
+    * @return the mapped state
+    */
+   <T extends Enum<?>> T mapControllerState(Object name, ContextStateMapper<T> mapper);
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentID.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentID.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentID.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+import java.net.URL;
+
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * A representation of a top-level deployment id.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentID extends DeploymentOptions
+{
+   /**
+    * Get the names of the deployments.
+    *
+    * @return the deployment name
+    */
+   String[] getNames();
+   
+   /**
+    * The target profile this deployment is
+    * associated with.
+    * 
+    * @return the profile key.
+    */
+   ProfileKey getProfile();
+   
+   /**
+    * Get the unique names of the deployments in the repository. Some DeploymentManager
+    * operations like distribute produce an alternate unique name that differs
+    * from the input name. In this case this method will provide the unique
+    * names for the input names. Otherwise this returns the same value as
+    * getNames.
+    * 
+    * @return the unique names of the deployments in the repository
+    */
+   String[] getRepositoryNames();
+   
+   /**
+    * Set the unique names of the deployments in the repository.
+    * @see #getRepositoryNames()
+    * @param names - the unique names of the deployments in the repository
+    */
+   void setRepositoryNames(String[] names);
+
+   /**
+    * An optional content URL used for distribute/redeploy operations.
+    * @return
+    */
+   URL getContentURL();
+
+   /**
+    * Do we copy content or jut ref it.
+    * @return
+    */
+   boolean isCopyContent();
+
+   /**
+    * Get a description of the deployment
+    *
+    * @return the identifier
+    */
+   String getDescription();
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentID.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentManager.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentManager.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.profileservice.spi.DeploymentOption;
+import org.jboss.profileservice.spi.ProfileKey;
+
+/**
+ * An interface for uploading and controlling deployments in a profile.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentManager
+{
+   
+   /**
+    * Load and associate the given profile with the DeploymentManager
+    * for future operations.
+    * 
+    * @param key - the profile to load
+    * @throws Exception for any error
+    */
+   public void loadProfile(ProfileKey key) throws Exception;
+
+   /**
+    * Release the previous loaded profile.
+    * 
+    * @throws Exception
+    */
+   public void releaseProfile() throws Exception;
+   
+   /**
+    * Get a collection of profiles supporting deployment actions.
+    * 
+    * @return a collection of profiles keys
+    */
+   Collection<ProfileKey> getProfiles();
+
+   /**
+    * Map from the external name passed to distribute to the uploaded
+    * deployment repository name.
+    * 
+    * @param names - the list of external deployment names
+    * @return the mapped list of unique names in the deployment repository.
+    * @throws Exception for any error
+    */
+   String[] getRepositoryNames(String[] names) throws Exception;
+
+   /**
+    * Add raw deployment content to the profile.
+    * 
+    * @param name the deployment name
+    * @param contentURL - URL for obtaining the deployment archive
+    * @param copyContent should we copy content or just reference it
+    * @return a DeploymentProgress used to run and track the distribute progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress distribute(String name, URL contentURL, boolean copyContent) throws Exception;
+
+   /**
+    * Add raw deployment to the profile without starting the deployment.
+    * The deployments options can be used to specify certain behavior. 
+    * 
+    * @param name the deployment name
+    * @param contentURL - URL for obtaining the deployment archive
+    * @param options - the deployment options
+    * @return a DeploymentProgress used to run and track the distribute progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress distribute(String name, URL contentURL, DeploymentOption... options) throws Exception;
+   
+   /**
+    * Prepare a set of deployments through their dependency analysis phase.
+    *
+    * @param names the unique names of the deployments
+    * @return a DeploymentProgress used to run and track the prepare progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress prepare(String... names) throws Exception;
+
+   /**
+    * Start a previously distributed deployment. 
+    * 
+    * @param names the unique names of the deployments
+    * @return a DeploymentProgress used to run and track the start progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress start(String... names) throws Exception;
+
+   /**
+    * Is redeploy supported.
+    *
+    * @return true if the loaded profile supports redeploy
+    */
+   boolean isRedeploySupported();
+   
+   /**
+    * Do redeploy.
+    * 
+    * @param name the deployment to redeploy
+    * @return a DeploymentProgress used to run and track the redeploy progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress redeploy(String name) throws Exception;
+   
+   /**
+    * Stop a previously started deployment.
+    * 
+    * @param names the unique names of the deployments
+    * @return a DeploymentProgress used to run and track the stop progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress stop(String... names) throws Exception;
+   
+   /**
+    * Remove a previously distributed deployment.
+    * 
+    * @param names the unique names of the deployments
+    * @return a DeploymentProgress used to run and track the remove progress.
+    * @throws Exception for any error
+    */
+   DeploymentProgress remove(String... names) throws Exception;
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentManager.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentOptions.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentOptions.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentOptions.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,66 @@
+/*
+ * 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.deployers.spi.management.deploy;
+
+import org.jboss.profileservice.spi.DeploymentOption;
+
+/**
+ * The deployment options.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentOptions
+{
+   
+   /**
+    * Add a deployment option.
+    * 
+    * @param option the option
+    */
+   void addDeploymentOption(DeploymentOption option);
+   
+   /**
+    * Remove a deployment option.
+    * 
+    * @param option the option
+    * @return true, if the option was present 
+    */
+   boolean removeDeploymentOption(DeploymentOption option);
+   
+   /**
+    * Has a given deployment option.
+    * 
+    * @param option the deployment option
+    * @return true, if the option is set
+    */
+   boolean hasDeploymentOption(DeploymentOption option);
+   
+   /**
+    * Get all deployment options.
+    * 
+    * @return the set deployment option
+    */
+   DeploymentOption[] getDeploymentOptions();
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentOptions.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+import java.util.List;
+
+/**
+ * An interface for tracking the progress of a deployment upload to a
+ * profile via the profile service DeploymentManager spi.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentProgress
+{
+   /**
+    * Retrieve the status of the deployment
+    *
+    * @return the status
+    */
+   DeploymentStatus getDeploymentStatus();
+
+   /**
+    * Get the identifier for the deployment the progress applies to
+    * @return
+    */
+   DeploymentID getDeploymentID();
+
+   /**
+    * Retrieve the list of targets the deployment is distributed to
+    *
+    * @return the deployment targets
+    */
+   List<DeploymentTarget> getDeploymentTargets();
+
+   /**
+    * Begins the deployment command
+    */
+   void run();
+
+   /**
+    * Cancels the deployment
+    *
+    */
+   void cancel();
+   
+   /**
+    * Add a progress listener
+    *
+    * @param listener the listener
+    */
+   void addProgressListener(ProgressListener listener);
+   
+   /**
+    * Remove a progress listener
+    *
+    * @param listener the listener
+    */
+   void removeProgressListener(ProgressListener listener);
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentProgress.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+
+/**
+ * A deployment status interface used to provide information about a
+ * DeploymentProgress event associated with a {@linkplain DeploymentManager}
+ * command.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentStatus
+{
+   public enum StateType {
+      UPLOADING, DEPLOYING, RUNNING, COMPLETED, FAILED, CANCELLED
+   }
+   public enum CommandType {
+      DISTRIBUTE, PREPARE, START, STOP, REMOVE, REDEPLOY 
+   }
+
+   /**
+    * Get the state of the deployment
+    *
+    * @return the state
+    */
+   StateType getState();
+   
+   /**
+    * The deployment command
+    *
+    * @return the command
+    */
+   CommandType getCommand();
+
+   /**
+    * The target the status applies to
+    * @return
+    */
+   DeploymentTarget getTarget();
+
+   /**
+    * Get the current status message
+    *
+    * @return the message
+    */
+   String getMessage();
+
+   /**
+    * Get the failure exception.
+    * @return any failure exception associated with reaching the FAILED state.
+    */
+   Exception getFailure();
+
+   /**
+    * Is the deployment complete
+    *
+    * @return true when complete, false otherwise
+    */
+   boolean isCompleted();
+
+   /**
+    * Has the deployment failed
+    *
+    * @return true when failed, false otherwise
+    */
+   boolean isFailed();
+   
+   /**
+    * Is the deployment in progress
+    *
+    * @return true when in progress, false otherwise
+    */
+   boolean isRunning();
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentStatus.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+
+/**
+ * A target to which a deployment is uploaded.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentTarget
+{
+   /**
+    * Get the target name
+    *
+    * @return the name
+    */
+   String getName();
+
+   
+   String[] getRepositoryNames(DeploymentID deployment)
+      throws Exception;
+
+   void distribute(DeploymentID deployment)
+      throws Exception;
+   void redeploy(DeploymentID deployment)
+      throws Exception;
+   void prepare(DeploymentID deployment)
+      throws Exception;
+   void start(DeploymentID deployment)
+      throws Exception;
+   void stop(DeploymentID deployment)
+      throws Exception;
+   void remove(DeploymentID deployment)
+      throws Exception;
+
+   /**
+    * Get the target description
+    *
+    * @return the description
+    */
+   String getDescription();
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/DeploymentTarget.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressEvent.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressEvent.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+import java.io.Serializable;
+
+/**
+ * A deployment progress event object.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ProgressEvent
+   implements Serializable
+{
+   private static final long serialVersionUID = 1;
+   private DeploymentID deploymentTargetID;
+   private DeploymentStatus status;
+   
+   public ProgressEvent(DeploymentID deploymentTargetID, DeploymentStatus status)
+   {
+      super();
+      this.deploymentTargetID = deploymentTargetID;
+      this.status = status;
+   }
+
+   public DeploymentID getDeploymentName()
+   {
+      return deploymentTargetID;
+   }
+   public DeploymentStatus getStatus()
+   {
+      return status;
+   }
+
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer("ProgressEvent(");
+      tmp.append("deploymentTargetID=");
+      tmp.append(this.deploymentTargetID);
+      tmp.append("status=");
+      tmp.append(this.status);
+      tmp.append(")");
+      return tmp.toString();
+   }
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressEvent.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressListener.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressListener.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressListener.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.deployers.spi.management.deploy;
+
+/**
+ * A progress notification listener interface
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ProgressListener
+{
+   void progressEvent(ProgressEvent eventInfo);
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/deployers/spi/management/deploy/ProgressListener.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentContentFlags.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentContentFlags.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentContentFlags.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.spi;
+
+/**
+ * States for DeploymentRepository content
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DeploymentContentFlags
+{
+   /** content that is not publicly visible in profile */
+   public static final int DISABLED=1;
+   /** content that is visible in profile */
+   public static final int ENABLED=2;
+   /** exists in profile, but is excluded from modified deployment checks. */
+   public static final int LOCKED=4;
+   /** Can be used to explicitly put a deployment into the modified list */
+   public static final int MODIFIED=8;
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentContentFlags.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentOption.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentOption.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentOption.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,45 @@
+/*
+ * 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.spi;
+
+/**
+ * The deployment options.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public enum DeploymentOption
+{
+   
+   /**
+    * Fail if the deployment already exists on the
+    * server.
+    */
+   FailIfExists,
+   
+   /**
+    * Unpack the deployment on the server. 
+    */
+   Explode
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentOption.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,226 @@
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Set;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An interface for managing the contents of a Profile.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentRepository
+{
+   /**
+    * Get the uris of this repository.
+    * 
+    * @return URI[] the uris of this repository
+    */
+   URI[] getRepositoryURIs();
+	
+   /**
+    * Create the repository.
+    * 
+    * @throws Exception
+    */
+   void create() throws Exception;
+   
+   /**
+    * Load the repository contents.
+    * 
+    * @throws Exception
+    */
+   void load() throws Exception;
+   
+   /**
+    * Unload the repository;
+    */
+   void unload();
+   
+   /**
+    * Delete the repository.
+    * 
+    * @throws Exception
+    */
+   void remove() throws Exception;
+   
+   /**
+    * Get the time any contents were last modified.
+    * 
+    * @return last modified
+    */
+   long getLastModified();
+
+   /**
+    * Get the names of all deployments in the repository
+    * 
+    * @return the deployment names
+    */
+   Set<String> getDeploymentNames();
+   
+   /**
+    * Get repository names.
+    *
+    * @param names the names
+    * @return the matching repository names
+    * @throws Exception for any error
+    */
+   String[] getRepositoryNames(String... names) throws Exception;
+
+   /**
+    * Upload raw deployment content to a profile repository. This does not make
+    * the deployment available to getDeployments or getModifiedDeployments
+    * 
+    * @param name - the full vfs path of the deployment 
+    * @param contentIS - the input stream for the deployment contents
+    * @return the unique name of the deployment in the repository
+    * @throws IOException
+    */
+   String addDeploymentContent(String name, InputStream contentIS)
+      throws IOException;
+   
+   /**
+    * Upload raw deployment content to a profile repository. This does not make
+    * the deployment available to getDeployments or getModifiedDeployments
+    * 
+    * @param name - the full vfs path of the deployment 
+    * @param contentIS - the input stream for the deployment contents
+    * @param options - optional deployment options
+    * @return the unique name of the deployment in the repository
+    * @throws IOException
+    */
+   String addDeploymentContent(String name, InputStream contentIS, DeploymentOption... options)
+      throws IOException;
+
+   /**
+    * Get the repository virtual file for the given deployment name.
+    * 
+    * @param name - the unique virtual file URI name as returned by addDeploymentContent
+    * @return the deployment content virtual file
+    * @throws IOException for any error
+    */
+   VirtualFile getDeploymentContent(String name)
+      throws IOException, URISyntaxException;
+
+   /**
+    * lock deployment content and exclude it from modified deployment checks.
+    * 
+    * @param name - the full vfs path of the deployment
+    * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+    */
+   int lockDeploymentContent(String name);
+   /**
+    * Unlock a previously locked deployment content.
+    * 
+    * @param name - the full vfs path of the deployment
+    * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+    */
+   int unlockDeploymentContent(String name);
+
+   /**
+    * Get the status flags for the deployment path
+    * 
+    * @param name - the full vfs path of the deployment
+    * @return the deployment content flags, {@linkplain DeploymentContentFlags}
+    */
+   int getDeploymentContentFlags(String name);
+   /**
+    * Set one or more flags for the deployment.
+    * @see #clearDeploymentContentFlags(String)
+    * 
+    * @param name - the full vfs path of the deployment
+    * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+    */
+   int setDeploymentContentFlags(String name, int flags);
+   /**
+    * Clear one or more flags for the deployment. This ands the compliment of
+    * the flags argument into the existing content flags and returns the result.
+    * 
+    * @param name - the full vfs path of the deployment
+    * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+    */
+   int clearDeploymentContentFlags(String name, int flags);
+   /**
+    * Does a deployment content have the indicated flag.
+    * 
+    * @param name - the full vfs path of the deployment
+    * @param flags - the deployment content flags, {@linkplain DeploymentContentFlags}
+    * @return true if the content flags contains the flag, false otherwise.
+    */
+   boolean hasDeploymentContentFlags(String name, int flag);
+
+   /**
+    * Add a deployment.
+    * 
+    * @param name - the name of the deployment
+    * @param deployment the deployment
+    * @throws Exception for any error
+    */
+   void addDeployment(String name, ProfileDeployment deployment)
+      throws Exception;
+
+   /**
+    * Get a named deployment.
+    * 
+    * @param name - the deployment name
+    * @return the deployment
+    * @throws NoSuchDeploymentException - if there is no such deployment
+    */
+   ProfileDeployment getDeployment(String name)
+      throws NoSuchDeploymentException;
+
+   /**
+    * Remove a deployment.
+    * 
+    * @param name - the name of the deployment
+    * @return the removed deployment
+    * @throws Exception for any error
+    */
+   ProfileDeployment removeDeployment(String name) throws Exception;
+
+   /**
+    * Get all deployments defined in this profile
+    * 
+    * @return the deployment instances in this profile
+    */
+   Collection<ProfileDeployment> getDeployments();
+
+   /**
+    * Get the modified deployments.
+    * 
+    * @return the modified deployments, empty if there are no
+    *  modifications or hot deployment is not supported.
+    * @throws Exception for any error
+    */
+   Collection<ModificationInfo> getModifiedDeployments() throws Exception;
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,53 @@
+/*
+ * 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.spi;
+
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * A factory for DeploymentRepository.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface DeploymentRepositoryFactory
+{
+   
+   /**
+    * The repository types.
+    * 
+    * @return the type
+    */
+   String[] getTypes();
+   
+   /**
+    * Create a DeploymentRepository based on a type.
+    * 
+    * @param repositoryType the repository type
+    * @param metaData the profile source meta data
+    * @return the deploymentRepository
+    * @throws Exception for any error
+    */
+   DeploymentRepository createDeploymentRepository(ProfileKey key, ProfileSourceMetaData metaData) throws Exception;
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepositoryFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ModificationInfo.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ModificationInfo.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ModificationInfo.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,68 @@
+/*
+ * 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.spi;
+
+import java.io.Serializable;
+
+/**
+ * Represents a modified deployment returned from the modified deployments scan.
+ *  
+ * @see Profile#getModifiedDeployments()
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @version $Revision$
+ */
+public class ModificationInfo implements Serializable
+{
+   /** The serialVersionUID. */
+   private final static long serialVersionUID = 1;
+
+   public enum ModifyStatus { ADDED, MODIFIED, REMOVED };
+   
+   private ProfileDeployment deployment;
+   private ModifyStatus status;
+   private long lastModified;
+
+   public ModificationInfo(ProfileDeployment deployment, long lastModified, ModifyStatus status)
+   {
+      this.status = status;
+      this.deployment = deployment;
+      this.lastModified = lastModified;
+   }
+
+   public ProfileDeployment getDeployment()
+   {
+      return deployment;
+   }
+
+   public ModifyStatus getStatus()
+   {
+      return status;
+   }
+   
+   public long getLastModified()
+   {
+      return lastModified;
+   }
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ModificationInfo.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/MutableProfile.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/MutableProfile.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/MutableProfile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import java.util.Collection;
+
+/**
+ * A mutable profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface MutableProfile extends Profile
+{
+   
+   /**
+    * Add a deployment.
+    * 
+    * @param deployment the deployment
+    * @throws Exception for any error
+    */
+   void addDeployment(ProfileDeployment deployment) throws Exception;
+
+   /**
+    * Remove a deployment.
+    * 
+    * @param name the deployment name
+    * @return the ProfileDeployment for the name if found
+    * @throws NoSuchDeploymentException if the deployment was not found
+    * @throws Exception for any error
+    */
+   ProfileDeployment removeDeployment(String name) throws NoSuchDeploymentException, Exception;
+   
+   /**
+    * Get the deployments that have been modified since the last
+    * check. 
+    * 
+    * @return the modified deployments, empty if none exist
+    * @throws Exception - thrown on error scanning for deployments
+    */
+   Collection<ModificationInfo> getModifiedDeployments() throws Exception;
+   
+   /**
+    * Enable/disable the getModifiedDeployments results. This can be
+    * used to disable the getModifiedDeployments results during
+    * periods such as bootstrap where changes should be delayed.
+    * 
+    * @see #getModifiedDeployments
+    * @param flag - the enable/disable flag
+    */
+   void enableModifiedDeploymentChecks(boolean flag);
+
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/MutableProfile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchDeploymentException.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchDeploymentException.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchDeploymentException.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,52 @@
+/*
+ * 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.spi;
+
+/**
+ * An exception thrown when there is no matching deployment.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class NoSuchDeploymentException extends Exception
+{
+   
+   /** The serialVersionUID.*/
+   private static final long serialVersionUID = 1;
+   
+   public NoSuchDeploymentException()
+   {
+      super();
+   }
+
+   public NoSuchDeploymentException(String msg)
+   {
+      super(msg);
+   }
+
+   public NoSuchDeploymentException(String msg, Throwable cause)
+   {
+      super(msg, cause);
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchDeploymentException.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchProfileException.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchProfileException.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchProfileException.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,52 @@
+/*
+ * 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.spi;
+
+/**
+ * Exception thrown when a profile query fails to find a match.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class NoSuchProfileException extends Exception
+{
+   
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 461561859030090797L;
+
+   public NoSuchProfileException(String message)
+   {
+      super(message);
+   }
+
+   public NoSuchProfileException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   public NoSuchProfileException(Throwable cause)
+   {
+      super(cause);
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/NoSuchProfileException.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/Profile.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/Profile.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/Profile.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,87 @@
+/*
+ * 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.spi;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * A profile represents a named collection of deployments on a server.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface Profile
+{
+   
+   /**
+    * Get the key used to create the Profile
+    * @return key used to create the Profile
+    */
+   ProfileKey getKey();
+
+   /**
+    * Get the names of the deployments in the profile.
+    * @return names of deployments
+    */
+   Set<String> getDeploymentNames();
+
+   /**
+    * Get all deployments defined in this profile
+    * @return the deployment instances in this profile.
+    */
+   Collection<? extends ProfileDeployment> getDeployments();
+   
+   /**
+    * Get a named deployment.
+    * 
+    * @param name - the deployment name
+    * @return the deployment
+    * @throws NoSuchDeploymentException - if there is no such bootstrap
+    */
+   ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException;
+
+   /**
+    * Checks whether a deployment context is available in this profile.
+    * 
+    * @param    name    the name of the deployment
+    * @return   true if the deployment is found or false otherwise
+    */
+   boolean hasDeployment(String name);
+   
+   /**
+    * Get the system time in milliseconds the profile was last modified. 
+    * @return System.currentTimeMillis of last modification
+    */
+   long getLastModified();
+   
+   /**
+    * Flag indicating if the the profile is mutable
+    * and implements the MutableProfile interface.
+    * 
+    * @return true, if the profile is mutable
+    */
+   boolean isMutable();
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/Profile.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,146 @@
+/*
+ * 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.spi;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The profile deployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDeployment extends Serializable
+{
+
+   /**
+    * Get the deployment name
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * Get the root of the deployment
+    * 
+    * @return the deployment root, null if it's not a VFS based deployment
+    */
+   VirtualFile getRoot();
+   
+   /**
+    * Get all attachments.
+    * 
+    * @return the attachments
+    */
+   Map<String, Object> getAttachments();
+   
+   /**
+    * Get attachment.
+    * 
+    * @param name the name of the attachment
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   Object getAttachment(String name);
+   
+   /**
+    * Get attachment.
+    * 
+    * @param <T> the expected type
+    * @param name the name of the attachment
+    * @param expectedType the expected type
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   <T> T getAttachment(String name, Class<T> expectedType);
+   
+   /**
+    * Add attachment
+    *
+    * @param name the name of the attachment
+    * @param attachment the attachment
+    * @return any previous attachment
+    * 
+    * @throws IllegalArgumentException for a null name or attachment
+    */
+   Object addAttachment(String name, Object attachment);
+   
+   /**
+    * Remove attachment.
+    * 
+    * @param name the attachment name
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   Object removeAttachment(String name);
+   
+   /**
+    * Get transient attachment.
+    * 
+    * @param name the name of the attachment
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   Object getTransientAttachment(String name);
+   
+   /**
+    * Get transient attachment.
+    * 
+    * @param <T> the expected type
+    * @param name the name of the attachment
+    * @param expectedType the expected type
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   <T> T getTransientAttachment(String name, Class<T> expectedType);
+   
+   /**
+    * Add transient attachment
+    *
+    * @param name the name of the attachment
+    * @param attachment the attachment
+    * @return any previous attachment
+    * 
+    * @throws IllegalArgumentException for a null name or attachment
+    */
+   Object addTransientAttachment(String name, Object attachment);
+   
+   /**
+    * Remove transient attachment.
+    * 
+    * @param name the attachment name
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   Object removeTransientAttachment(String name);
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileFactory.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileFactory.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,53 @@
+/*
+ * 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.spi;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The profile factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileFactory<T extends ProfileMetaData, X extends Profile>
+{
+   
+   /**
+    * The repository types.
+    * 
+    * @return the type
+    */
+   String[] getTypes();
+
+   /**
+    * Create a profile based on the meta data.
+    * 
+    * @param key the profile key
+    * @param metaData the profile meta data
+    * @return the profile
+    * @throws Exception
+    */
+   X createProfile(ProfileKey key, T metaData) throws Exception;
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,195 @@
+/*
+ * 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.spi;
+
+import java.io.Serializable;
+
+import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+
+/**
+ * The key for a Profile. It consists of the domain, server and name.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ProfileKey
+   implements Comparable<ProfileKey>, Serializable
+{
+   private static final long serialVersionUID = 1;
+   
+   /** The DEFAULT value for domain, server, name */
+   public static final String DEFAULT = "default";
+   
+   /** The DEFAULT profile key. */
+   public static final ProfileKey DEFAULT_PROFILE_KEY = new ProfileKey(DEFAULT, DEFAULT, DEFAULT);
+
+   /** The profile domain/cluster */
+   private String domain;
+   /** The server/node */
+   private String server;
+   /** The profile name */
+   private String name;
+
+   /**
+    * Create the profile key based on the meta data.
+    * 
+    * @param metaData the profile key meta data
+    * @return the profile key
+    */
+   public static ProfileKey createProfileKey(ProfileKeyMetaData metaData)
+   {
+      if(metaData == null)
+         throw new IllegalArgumentException("null meta data.");
+      
+      return new ProfileKey(metaData);
+   }
+   
+   /**
+    * Calls this this(DEFAULT, DEFAULT, name)
+    * @param name - the profile name
+    */
+   public ProfileKey(String name)
+   {
+      this(DEFAULT, DEFAULT, name);
+   }
+
+   /**
+    * Build a profile key from the domain, server and name. If any parameter
+    * is null it defaulted to "default".
+    * 
+    * @param domain - the admin domain
+    * @param server - the server instance name
+    * @param name - the profile name
+    */
+   public ProfileKey(String domain, String server, String name)
+   {
+      if( domain == null )
+         domain = DEFAULT;
+      this.domain = domain;
+      if( server == null )
+         server = DEFAULT;
+      this.server = server;
+      if( name == null )
+         name = DEFAULT;
+      this.name = name;
+   }
+   
+   /**
+    * Build a profile key based on the profile key meta data.
+    * 
+    * @param metaData the meta data
+    */
+   public ProfileKey(ProfileKeyMetaData metaData)
+   {
+      this(metaData.getDomain(), metaData.getServer(), metaData.getName());
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public String getDomain()
+   {
+      return domain;
+   }
+   public void setDomain(String domain)
+   {
+      this.domain = domain;
+   }
+
+   public String getServer()
+   {
+      return server;
+   }
+   public void setServer(String server)
+   {
+      this.server = server;
+   }
+
+   /**
+    * Is this a default key. A default key is one where all
+    * fields are {@link #DEFAULT}
+    * @return true if default, false otherwise.
+    */
+   public boolean isDefaultKey()
+   {
+      return DEFAULT.equalsIgnoreCase(domain)
+         && DEFAULT.equalsIgnoreCase(server)
+         && DEFAULT.equalsIgnoreCase(name);
+   }
+
+   /**
+    * Compare based on domain, then server and finally name.
+    * 
+    * @param pk - the ProfileKey instance to compare to
+    * @return < 0, 0, > 0 based on whether this is less than, equal to
+    *    or greater than o.
+    */
+   public int compareTo(ProfileKey pk)
+   {
+      int compareTo = domain.compareTo(pk.domain);
+      if( compareTo == 0 )
+      {
+         compareTo = server.compareTo(pk.server);
+         if( compareTo == 0 )
+         {
+            compareTo = name.compareTo(pk.name);
+         }
+      }
+      return compareTo;
+   }
+   
+   public boolean equals(Object o)
+   {
+      if(o instanceof ProfileKey)
+         return compareTo((ProfileKey) o) == 0;
+      return false;
+   }
+   
+   public int hashCode()
+   {
+      int hash = domain.hashCode() + server.hashCode() + name.hashCode();
+      return hash;
+   }
+
+   public String toString()
+   {
+      StringBuilder tmp = new StringBuilder();
+      tmp.append(getClass().getSimpleName());
+      tmp.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      tmp.append('[');
+      tmp.append("domain=");
+      tmp.append(getDomain());
+      tmp.append(", server=");
+      tmp.append(getServer());
+      tmp.append(", name=");
+      tmp.append(getName());
+      tmp.append(']');
+      return tmp.toString();
+   }
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileRepository.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileRepository.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,77 @@
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * An interface for obtaining a DeploymentRepository for a Profile.
+ *  
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileRepository
+{
+   /**
+    * Get the keys for all known profiles with a
+    * deploymentRepository.
+    * 
+    * @return keys for all known profiles.
+    */
+   Collection<ProfileKey> getProfileKeys();
+
+   /**
+    * Create a new DeploymentRepository for a profile.
+    * 
+    * @Param key - the profile key.
+    * @param metaData - the profile meta data.
+    * @return the profile DeploymentRepository
+    * @throws Exception for any error
+    */
+   DeploymentRepository createProfileDeploymentRepository(ProfileKey key, ProfileMetaData metaData)
+      throws Exception;
+
+   /**
+    * Get a created DeploymentRepository for the given profile key.
+    * 
+    * @param key - the key for the Profile to obtain the DeploymentRepository for.
+    * @return the profile DeploymentRepository
+    * @throws NoSuchProfileException thrown if there is no such profile.
+    */
+   DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
+      throws NoSuchProfileException;
+
+   /**
+    * Remove the DeploymentRepository for the given profile key.
+    * 
+    * @param key - the key for the Profile to obtain the DeploymentRepository for.
+    * @throws NoSuchProfileException thrown if there is no such profile.
+    * @throws IOException thrown on error removing the repository
+    * @throws Exception for any error
+    */
+   void removeProfileDeploymentRepository(ProfileKey key)
+      throws Exception, NoSuchProfileException;
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileRepository.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,153 @@
+/*
+ * 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.spi;
+
+import java.util.Collection;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The entry point service for accessing/administering server profiles
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileService
+{
+   
+   /**
+    * Get the unique domains for which profiles exist.
+    * 
+    * @return array of profile domains
+    */
+   String[] getDomains();
+
+   /**
+    * Get the keys for all registered profiles.
+    * 
+    * @return keys for all registered profiles
+    */
+   Collection<ProfileKey> getProfileKeys();
+
+   /**
+    * Obtain the registered profile for the key.
+    * 
+    * @param key - the key for the profile
+    * @return the matching profile meta data
+    * @throws NoSuchProfileException
+    */
+   ProfileMetaData getProfileMetaData(ProfileKey key) throws NoSuchProfileException;
+
+   /**
+    * Get the keys for all active profiles.
+    * 
+    * @return keys for all active profiles
+    */
+   Collection<ProfileKey> getActiveProfileKeys();
+   
+   /**
+    * Obtain a activated profile for the key.
+    * 
+    * @param key - the key for the profile
+    * @return the active profile
+    * @throws NoSuchProfileException thrown if there is no
+    *    active profile 
+    */
+   Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException;
+   
+   /**
+    * Obtain the ManagementView plugin.
+    * @return the ManagementView plugin if supported
+    */
+   ManagementView getViewManager();
+
+   /**
+    * Obtain the DeploymentManager plugin.
+    * @return the DeploymentManager plugin if supported
+    */
+   DeploymentManager getDeploymentManager();
+   
+   /**
+    * Register a Profile.
+    * 
+    * @param profile the profile meta data
+    * @throws Exception for any error
+    */
+   void registerProfile(ProfileMetaData metaData) throws Exception;
+   
+   /**
+    * Register a Profile.
+    * 
+    * @param key the profile key
+    * @param profile the profile meta data
+    * @throws Exception for any error
+    */
+   void registerProfile(ProfileKey key, ProfileMetaData metaData) throws Exception;
+   
+   /**
+    * Register a Profile.
+    * 
+    * @param key the profile key
+    * @param profile the profile meta data
+    * @param profile the profile
+    * @throws Exception for any error
+    */
+   void registerProfile(ProfileKey key, ProfileMetaData metaData, Profile profile) throws Exception;
+   
+   /**
+    * Activate a registered profile.
+    * 
+    * @param key the profile key
+    * @throws NoSuchProfileException if the profile is not registered
+    * @throws Exception for any error
+    */
+   void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception;
+   
+   /**
+    * Deactivate the profile.
+    * 
+    * @param key the profile key
+    * @throws NoSuchProfileException if the profile is not active
+    */
+   void deactivateProfile(ProfileKey key) throws NoSuchProfileException;
+
+   /**
+    * Unregister a profile.
+    * 
+    * @param key the profile key
+    * @throws NoSuchProfileException if the profile is not registered
+    */
+   void unregisterProfile(ProfileKey key) throws NoSuchProfileException;
+
+   /**
+    * Validate a registered profile.
+    * 
+    * @param key the profile key
+    * @throws NoSuchProfileException if the profile is not registered
+    * @throws Exception if the profile is not installed correctly
+    */
+   void validateProfile(ProfileKey key) throws Exception;
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileService.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,43 @@
+/*
+ * 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.dependency;
+
+
+/**
+ * The profile capability.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileCapability
+{
+
+   /**
+    * Try to resolve a profile requirement.
+    * 
+    * @param the profile requirement
+    * @return true if the capability resolves the given requirement, otherwise false.
+    */
+   boolean resolves(ProfileRequirement requirement);
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileCapability.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,75 @@
+/*
+ * 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.dependency;
+
+import java.util.Collection;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * A dependency context for a profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDependencyContext
+{
+
+   /**
+    * Get the profile key.
+    * 
+    * @return
+    */
+   ProfileKey getKey();
+   
+   /**
+    * Get the profile meta data.
+    * 
+    * @return the meta data
+    */
+   ProfileMetaData getProfileMetaData();
+   
+   /**
+    * Get the capabilities of the profile.
+    * 
+    * @return the capabilities
+    */
+   Collection<ProfileCapability> getCapabilities();
+   
+   /**
+    * Get the requirements of the profile.
+    * 
+    * @return the requirements
+    */
+   Collection<ProfileRequirement> getRequirements();
+
+   /**
+    * Try to resolve a profile requirement.
+    * 
+    * @param requirement the profile requirement
+    * @return the resolved profile key, null if the requirement cannot be resolved
+    */
+   ProfileKey resolve(ProfileRequirement requirement);
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileDependencyContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,41 @@
+/*
+ * 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.dependency;
+
+/**
+ * The profile requirement.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileRequirement
+{
+   
+   /**
+    * isOptional.
+    * 
+    * @return if this requirement is optional
+    */
+   boolean isOptional();
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/dependency/ProfileRequirement.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,285 @@
+/*
+ * 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.helpers;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileDeployment implements ProfileDeployment
+{
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1536294883676418931L;
+
+   /** The name. */
+   private String name;
+   
+   /** The vfs root. */
+   private VirtualFile root;
+
+   /** The attachments. */
+   private Map<String, Object> attachments = new ConcurrentHashMap<String, Object>();
+   
+   /** The transient attachments. */
+   private transient Map<String, Object> transientAttachments = new ConcurrentHashMap<String, Object>();
+   
+   /**
+    * Get the vfs file name safely.
+    * @see VFSDeployment
+    * 
+    * @param root the virtual file
+    * @return the name
+    */
+   protected static final String safeVirtualFileName(VirtualFile root)
+   {
+      if (root == null)
+         throw new IllegalArgumentException("null root");
+
+      try
+      {
+         return root.toURI().toString();
+      }
+      catch (Exception e)
+      {
+         return root.getName();
+      }
+   }
+
+   /**
+    * Get the deployment name.
+    * 
+    * @return the name
+    */
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   /**
+    * Set the deployment name.
+    * 
+    * @param name the name
+    */
+   protected void setName(String name)
+   {
+      this.name = name;
+   }
+
+   /**
+    * Get the root of the deployment.
+    * 
+    * @return the root, or null if it's not a VFS deployment.
+    */
+   public VirtualFile getRoot()
+   {
+      return this.root;
+   }
+   
+   /**
+    * Set the VirtualFile root.
+    * 
+    * @param root the root
+    */
+   protected void setRoot(VirtualFile root)
+   {
+      this.root = root;
+   }
+   
+   /**
+    * Get all attachments.
+    * 
+    * @return the attachments
+    */
+   public Map<String, Object> getAttachments()
+   {
+      return Collections.unmodifiableMap(this.attachments);
+   }
+   
+   /**
+    * Get attachment.
+    * 
+    * @param name the name of the attachment
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public Object getAttachment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      
+      return this.attachments.get(name);
+   }
+   
+   /**
+    * Get attachment.
+    * 
+    * @param <T> the expected type
+    * @param name the name of the attachment
+    * @param expected the expected type
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public <T> T getAttachment(String name, Class<T> expectedType)
+   {
+      if(expectedType == null)
+         throw new IllegalArgumentException("null expected type");
+      
+      Object attachment = getAttachment(name);
+      if(attachment == null)
+         return null;
+     
+      if(expectedType.isInstance(attachment) == false)
+         throw new IllegalStateException("attachment " + name + 
+            " with value " + attachment + " is not of the expected type " + expectedType);
+      
+      return expectedType.cast(attachment);
+   }
+
+   /**
+    * Add attachment.
+    *
+    * @param name the name of the attachment
+    * @param attachment the attachment
+    * @return any previous attachment
+    * 
+    * @throws IllegalArgumentException for a null name or attachment
+    */
+   public Object addAttachment(String name, Object attachment)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      if(attachment == null)
+         throw new IllegalArgumentException("Null attachment.");
+      
+      return this.attachments.put(name, attachment);
+   }
+   
+   /**
+    * Remove attachment.
+    * 
+    * @param name the attachment name
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public Object removeAttachment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      
+      return this.attachments.remove(name);
+   }
+   
+   /**
+    * Get the transient attachment. 
+    * 
+    * @param name the name of the attachment
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public Object getTransientAttachment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      
+      return this.transientAttachments.get(name);
+   }
+   
+   /**
+    * Get transient attachment.
+    * 
+    * @param <T> the expected type
+    * @param name the name of the attachment
+    * @param expected the expected type
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public <T> T getTransientAttachment(String name, Class<T> expectedType)
+   {
+      if(expectedType == null)
+         throw new IllegalArgumentException("null expected type");
+      
+      Object attachment = getTransientAttachment(name);
+      if(attachment == null)
+         return null;
+     
+      if(expectedType.isInstance(attachment) == false)
+         throw new IllegalStateException("attachment " + name + 
+            " with value " + attachment + " is not of the expected type " + expectedType);
+      
+      return expectedType.cast(attachment);
+   }
+   
+   /**
+    * Add transient attachment
+    * 
+    * @param name the name of the attachment
+    * @param attachment the attachment
+    * @return any previous attachment
+    * 
+    * @throws IllegalArgumentException for a null name or attachment 
+    */
+   public Object addTransientAttachment(String name, Object attachment)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      if(attachment == null)
+         throw new IllegalArgumentException("Null attachment.");
+      
+      return this.transientAttachments.put(name, attachment);
+   }
+   
+   /**
+    * Remove transient attachment.
+    * 
+    * @param name the attachment name
+    * @return the attachment or null if not present
+    * 
+    * @throws IllegalArgumentException for a null name
+    */
+   public Object removeTransientAttachment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("Null attachment name.");
+      
+      return this.transientAttachments.remove(name);
+   }
+   
+   public String toString()
+   {
+      return "AbstractProfileDeployment(" + (root != null ? root.getName() : name) + ")";
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileDeploymentMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileDeploymentMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileDeploymentMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,42 @@
+/*
+ * 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.spi.metadata;
+
+
+/**
+ * The meta data for a profile deployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileDeploymentMetaData extends ProfileMetaDataVisitorNode
+{
+   
+   /**
+    * Get the deployment name.
+    * 
+    * @return
+    */
+   String getName();
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileDeploymentMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileKeyMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileKeyMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileKeyMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,55 @@
+/*
+ * 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.spi.metadata;
+
+/**
+ * The profileKey meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileKeyMetaData
+{
+
+   /**
+    * Get the profileKey domain attribute.
+    * 
+    * @return the domain
+    */
+   String getDomain();
+   
+   /**
+    * Get the profileKey server attribute.
+    * 
+    * @return the server
+    */
+   String getServer();
+
+   /**
+    * Get the profile name.
+    * 
+    * @return the name
+    */
+   String getName();
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileKeyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,56 @@
+/*
+ * 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.spi.metadata;
+
+import java.util.List;
+
+/**
+ * The meta data making up a profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileMetaData extends ProfileKeyMetaData, ProfileMetaDataVisitorNode
+{
+   
+   /**
+    * Get the ProfileSource.
+    * 
+    * @return the profile source
+    */
+   ProfileSourceMetaData getSource();
+
+   /**
+    * Get the sub-profiles.
+    * 
+    * @return the sub-profiles
+    */
+   List<? extends SubProfileMetaData> getSubprofiles();
+
+   /**
+    * Get the associated deployments to this profile.
+    * 
+    * @return the deployments
+    */
+   List<? extends ProfileDeploymentMetaData> getDeployments();
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,58 @@
+/*
+ * 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.metadata;
+
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+
+/**
+ * The profile meta data visitor.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileMetaDataVisitor
+{
+
+   /**
+    * Add a profile capability.
+    * 
+    * @param capability the profile capability
+    */
+   void addCapability(ProfileCapability capability);
+   
+   /**
+    * Add a profile requirement.
+    * 
+    * @param requirement the profile requirement
+    */
+   void addRequirement(ProfileRequirement requirement);
+   
+   /**
+    * Visit a profile meta data node.
+    * 
+    * @param node the profile meta data node.
+    */
+   void visit(ProfileMetaDataVisitorNode node);
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitorNode.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitorNode.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitorNode.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,41 @@
+/*
+ * 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.metadata;
+
+/**
+ * A profile meta data visitor node.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileMetaDataVisitorNode
+{
+
+   /**
+    * Visit a node.
+    * 
+    * @param the profile meta data visitor
+    */
+   void visit(ProfileMetaDataVisitor visitor);
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileMetaDataVisitorNode.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileSourceMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileSourceMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileSourceMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,50 @@
+/*
+ * 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.spi.metadata;
+
+import java.util.List;
+
+/**
+ * The meta data defining a profile source.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ProfileSourceMetaData
+{
+
+   /**
+    * Get the profile source type.
+    * 
+    * @return the type
+    */
+   String getType();
+
+   /**
+    * Get the sources URIs for this source;
+    * 
+    * @return the sources
+    */
+   List<String> getSources();
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/ProfileSourceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/SubProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/SubProfileMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/SubProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,36 @@
+/*
+ * 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.spi.metadata;
+
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+
+/**
+ * The meta data describing a required sub-profile - a dependency
+ * on a different profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface SubProfileMetaData extends ProfileKeyMetaData, ProfileMetaDataVisitorNode, ProfileRequirement
+{
+   
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/SubProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,70 @@
+/*
+ * 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.metadata.helpers;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.dependency.ProfileCapability;
+import org.jboss.profileservice.spi.dependency.ProfileRequirement;
+
+/**
+ * A abstract ProfileKey capability.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileKeyCapability extends AbstractProfileKeyMetaData implements ProfileCapability
+{
+
+   public AbstractProfileKeyCapability()
+   {
+      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)
+   {
+      if(requirement instanceof AbstractProfileKeyMetaData)
+      {
+         // Resolve against any other AbstractProfileKeyMetaData
+         AbstractProfileKeyMetaData other = (AbstractProfileKeyMetaData) requirement;
+         if(getKey() != null && getKey().equals(other.getKey()))
+            return true;
+      }
+      return false;
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyCapability.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,144 @@
+/*
+ * 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.metadata.helpers;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+
+
+/**
+ * The abstract profile key meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileKeyMetaData implements ProfileKeyMetaData
+{
+
+   /** The profile name. */
+   private String name;
+   
+   /** The server. */
+   private String server;
+   
+   /** The domain. */
+   private String domain;
+   
+   /** The profile key. */
+   private ProfileKey key;
+   
+   public AbstractProfileKeyMetaData()
+   {
+      //
+   }
+   
+   public AbstractProfileKeyMetaData(String name)
+   {
+      this(null, null, name);
+   }
+   
+   public AbstractProfileKeyMetaData(String domain, String server, String name)
+   {
+      this.domain = domain;
+      this.server = server;
+      this.name = name;
+      createKey();
+   }
+   
+   public AbstractProfileKeyMetaData(ProfileKey key)
+   {
+      this.domain = key.getDomain();
+      this.server = key.getServer();
+      this.name = key.getName();
+      this.key = key;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   public String getServer()
+   {
+      return server;
+   }
+
+   public void setServer(String server)
+   {
+      this.server = server;
+   }
+
+   public String getDomain()
+   {
+      return domain;
+   }
+
+   public void setDomain(String domain)
+   {
+      this.domain = domain;
+   }
+   
+   public ProfileKey getKey()
+   {
+      if(this.key == null)
+         createKey();
+      
+      return this.key;
+   }
+   
+   protected void createKey()
+   {
+      this.key = new ProfileKey(this);
+   }
+   
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getClass().getSimpleName());
+      builder.append('@').append(Integer.toHexString(System.identityHashCode(this)));
+      builder.append("{");
+      builder.append("domain=").append(getDomain());
+      builder.append(", server=").append(getServer());
+      builder.append(", name=").append(getName());
+      toString(builder);
+      builder.append("}");
+      return builder.toString();
+   }
+   
+   /**
+    * Additional information for toString().
+    * 
+    * @param builder the builder.
+    */
+   protected void toString(StringBuilder builder)
+   {
+      //
+   }
+   
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileKeyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: 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	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -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.spi.metadata.helpers;
+
+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;
+
+/**
+ * A abstract profile meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileMetaData extends AbstractProfileKeyCapability implements ProfileMetaData
+{
+   
+   /** The sub profiles. */
+   private List<SubProfileMetaData> subprofiles;
+
+   public AbstractProfileMetaData()
+   {
+      super();
+   }
+   
+   public AbstractProfileMetaData(String name)
+   {
+      super(name);
+   }
+   
+   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)
+   {
+      this.subprofiles = subprofiles;
+   }
+
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      // We provide a profile
+      visitor.addCapability(this);
+
+      // Process the SubProfiles
+      if(this.subprofiles != null && this.subprofiles.isEmpty() == false)
+      {
+         for(SubProfileMetaData subProfile : subprofiles)
+         {
+            subProfile.visit(visitor);
+         }
+      }
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractProfileMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractSubProfileKeyMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractSubProfileKeyMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractSubProfileKeyMetaData.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -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.spi.metadata.helpers;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+
+/**
+ * The abstract SubProfileKeyMetaData. This additionally represents a requirement
+ * on a different profile.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractSubProfileKeyMetaData extends AbstractProfileKeyMetaData implements SubProfileMetaData
+{
+   
+   public AbstractSubProfileKeyMetaData()
+   {
+      super();
+   }
+   
+   public AbstractSubProfileKeyMetaData(String name)
+   {
+      super(name);
+   }
+   
+   public AbstractSubProfileKeyMetaData(String domain, String server, String name)
+   {
+      super(domain, server, name);
+   }
+   
+   public AbstractSubProfileKeyMetaData(ProfileKey key)
+   {
+      super(key);
+   }
+   
+   public boolean isOptional()
+   {
+      return false;
+   }
+   
+   public void visit(ProfileMetaDataVisitor visitor)
+   {
+      visitor.addRequirement(this);  
+   }
+
+}
+


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/metadata/helpers/AbstractSubProfileKeyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/ControllerStateMetaType.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/ControllerStateMetaType.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/ControllerStateMetaType.java	2009-08-14 11:23:12 UTC (rev 92346)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.spi.types;
+
+import java.util.Arrays;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.metatype.api.types.EnumMetaType;
+
+/**
+ * An EnumMetaType for the kernel ControllerState values.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ControllerStateMetaType extends EnumMetaType
+{
+   private static final long serialVersionUID = 2;
+   private static final String[] VALID_VALUES = {
+      "**ERROR**",
+      "Not Installed",
+      "PreInstall",
+      "Described",
+      "Instantiated",
+      "Configured",
+      "Create",
+      "Start",
+      "Installed"
+   };
+   public static final EnumMetaType TYPE = new ControllerStateMetaType();
+
+   private ControllerStateMetaType()
+   {
+      super(ControllerState.class.getName(), Arrays.asList(VALID_VALUES));
+   }
+}


Property changes on: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/types/ControllerStateMetaType.java
___________________________________________________________________
Name: svn:keywords
   + Id Date Revision




More information about the jboss-cvs-commits mailing list