[jboss-cvs] JBossAS SVN: r85526 - in branches/Branch_5_x: cluster/src/main/org/jboss/ha/singleton and 92 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 6 10:21:52 EST 2009
Author: emuckenhuber
Date: 2009-03-06 10:21:50 -0500 (Fri, 06 Mar 2009)
New Revision: 85526
Added:
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivatorMBean.java
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManagerMBean.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractImmutableProfile.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/package-info.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AttachmentPropertyPopulator.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/MOCreatorPlugin.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectOverride.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ModificationInfo.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractVFSProfileSource.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultDeploymentRepositoryFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java
branches/Branch_5_x/system/src/resources/parsing-tests/
branches/Branch_5_x/system/src/resources/parsing-tests/common/
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile
branches/Branch_5_x/system/src/resources/parsing-tests/config/
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile
branches/Branch_5_x/system/src/resources/parsing-tests/parsing/
branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml
branches/Branch_5_x/system/src/resources/server-root/
branches/Branch_5_x/system/src/resources/server-root/conf/
branches/Branch_5_x/system/src/resources/server-root/conf/jboss-service.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-container-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-interceptors-aop.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-timer-service.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/httpha-invoker.sar
branches/Branch_5_x/system/src/resources/server-root/deploy/jbossweb.sar
branches/Branch_5_x/system/src/resources/server-root/deploy/myDeployment.jar
branches/Branch_5_x/system/src/resources/server-root/deploy2/
branches/Branch_5_x/system/src/resources/server-root/deploy2/myDeployment12.jar
branches/Branch_5_x/system/src/resources/server-root/deployers/
branches/Branch_5_x/system/src/resources/server-root/deployers/clustering-deployer-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deployers/ejb3.deployer
branches/Branch_5_x/system/src/resources/server-root/deployers/jbossweb.deployer
branches/Branch_5_x/system/src/resources/server-root/deployers/metadata-deployer-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deployers/seam.deployer
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/bootstrap/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JMSDestinationPersistenceFormatTestCase.java
Removed:
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
branches/Branch_5_x/profileservice/src/test/main/org/jboss/test/ps/SerializableDeploymentRepositoryUnitTest.java
branches/Branch_5_x/server/src/etc/conf/default/bootstrap-norepo.xml
branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile-repository.xml
branches/Branch_5_x/system/component-info.xml
branches/Branch_5_x/system/src/main/org/jboss/aop/
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/basic/
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AttachmentsResource.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/CapabilityImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/VFSDeploymentResource.java
branches/Branch_5_x/system/src/main/org/jboss/system/tools/AbstractDeploymentRepositoryAdapter.java
branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentRepositoryAdapter.java
branches/Branch_5_x/system/src/resources/parsing-tests/common/
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile
branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile
branches/Branch_5_x/system/src/resources/parsing-tests/config/
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile
branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile
branches/Branch_5_x/system/src/resources/parsing-tests/parsing/
branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml
branches/Branch_5_x/system/src/resources/server-root/conf/
branches/Branch_5_x/system/src/resources/server-root/conf/jboss-service.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-container-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-interceptors-aop.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-timer-service.xml
branches/Branch_5_x/system/src/resources/server-root/deploy/httpha-invoker.sar
branches/Branch_5_x/system/src/resources/server-root/deploy/jbossweb.sar
branches/Branch_5_x/system/src/resources/server-root/deploy/myDeployment.jar
branches/Branch_5_x/system/src/resources/server-root/deploy2/
branches/Branch_5_x/system/src/resources/server-root/deploy2/myDeployment12.jar
branches/Branch_5_x/system/src/resources/server-root/deployers/
branches/Branch_5_x/system/src/resources/server-root/deployers/clustering-deployer-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deployers/ejb3.deployer
branches/Branch_5_x/system/src/resources/server-root/deployers/jbossweb.deployer
branches/Branch_5_x/system/src/resources/server-root/deployers/metadata-deployer-jboss-beans.xml
branches/Branch_5_x/system/src/resources/server-root/deployers/seam.deployer
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/support/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/SimplePersistenceFormatUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/TestNestedPeristenceFormatUnitTestCase.java
Modified:
branches/Branch_5_x/cluster/src/etc/deploy-hasingleton-jboss-beans.xml
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java
branches/Branch_5_x/component-matrix/pom.xml
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java
branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java
branches/Branch_5_x/profileservice/.classpath
branches/Branch_5_x/profileservice/.project
branches/Branch_5_x/profileservice/build.bat
branches/Branch_5_x/profileservice/build.sh
branches/Branch_5_x/profileservice/build.xml
branches/Branch_5_x/profileservice/pom.xml
branches/Branch_5_x/profileservice/src/etc/default.mf
branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/TraceAdvice.java
branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperAdvice.java
branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperIterator.java
branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperSet.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/aop/MainDeployerAdvice.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/aop/ManagedObjectInvokeAspect.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureDeploymentManager.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureProfileServiceBean.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/BaseManagedObject.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/messages.properties
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentStatus.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProxyFactory.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/SecurityActions.java
branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml
branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml
branches/Branch_5_x/profileservice/src/test/resources/log4j.properties
branches/Branch_5_x/server/src/etc/conf/default/bootstrap.xml
branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
branches/Branch_5_x/system/.classpath
branches/Branch_5_x/system/.project
branches/Branch_5_x/system/build-test.xml
branches/Branch_5_x/system/pom.xml
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java
branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java
branches/Branch_5_x/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java
branches/Branch_5_x/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/ServerInfo.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/BootstrapDeployment.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
branches/Branch_5_x/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentScanner.java
branches/Branch_5_x/system/src/resources/deploy/beans/test-beans.xml
branches/Branch_5_x/system/src/resources/deploy/beans/unpacked.beans/META-INF/jboss-beans.xml
branches/Branch_5_x/system/src/resources/dtd/jboss-service_4_2.dtd
branches/Branch_5_x/system/src/resources/dtd/jboss-service_5_0.dtd
branches/Branch_5_x/system/src/resources/tests/bootstrap/default/deployer-beans.xml
branches/Branch_5_x/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml
branches/Branch_5_x/system/src/resources/tests/conf/test-log4j.xml
branches/Branch_5_x/system/src/resources/tests/modules/getopt.jar
branches/Branch_5_x/system/src/resources/tests/modules/sax.jar/inner.jar
branches/Branch_5_x/system/src/resources/tests/xml/org/jboss/test/server/profileservice/test-beans.xml
branches/Branch_5_x/system/src/tests/org/jboss/beans/container/support/SimpleBean.java
branches/Branch_5_x/system/src/tests/org/jboss/beans/container/support/SimpleBeanImpl.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/profileservice/test/ClusteredDeployUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/client/test/ClientDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDClientDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDConnectorDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EmbeddedDatasourceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean1/MBean1.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean1/MBean1MBean.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean2/MBean2.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean2/MBean2MBean.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/test/EARDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/AComplexPK.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPK.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPKBean.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPKHome.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamBookingExampleUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamDvdExampleUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamExampleTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamJpaExampleUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamNumberguessExampleUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamVFSClassloadingUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/lib/startup/StartupMonitor.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/mcbeans/Bean1.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/ConnectionFactoryRestartUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/JmsDestinationRestartUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/PersistedDataSourceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/AbstractPersistenceFormatTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JBossServicePersistenceFormatTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/LocalDataSourcePersistenceFormatTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServiceBindingManagedObjectsTestCase.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java
Log:
[JBAS-6472] merge with trunk, update profileservice
Modified: branches/Branch_5_x/cluster/src/etc/deploy-hasingleton-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/cluster/src/etc/deploy-hasingleton-jboss-beans.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/cluster/src/etc/deploy-hasingleton-jboss-beans.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -11,21 +11,30 @@
<!--
|
- | Deployment scanner that can be called by an HASingletonController
+ | Interface to the ProfileService that can be called by an HASingletonController.
+ | Creates ProfileService sub-profile from the given list of URIs and then
+ | activates/deactivates the profile when called by the HASingletonController.
|
-->
- <bean name="HASingletonDeploymentScanner" class="org.jboss.ha.singleton.HASingletonDeploymentScanner">
+ <bean name="HASingletonProfileManager" class="org.jboss.ha.singleton.HASingletonProfileManager">
- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HASingletonDeploymentScanner,partition=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.singleton.HASingletonDeploymentScannerMBean.class, registerDirectly=true)</annotation>
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HASingletonProfileManager,partition=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.singleton.HASingletonProfileManagerMBean.class, registerDirectly=true)</annotation>
<property name="profileService"><inject bean="ProfileService"/></property>
- <property name="filterInstance"><inject bean="DeploymentFilter"/></property>
- <property name="deploymentManager"><inject bean="DeploymentManager"/></property>
+ <property name="profileFactory"><inject bean="ProfileFactory"/></property>
+
+ <!-- Build a profile from the contents of these URIs -->
+ <property name="URIList">
+ <list elementClass="java.net.URI">
+ <value>${jboss.server.home.url}deploy-hasingleton</value>
+ </list>
+ </property>
</bean>
<!--
|
- | Use the deployer service on the singleton node.
+ | Tracks who the HASingleton master is and notifies the HASingletonProfileManager
+ | when it becomes the master or is no longer the master.
|
-->
<bean name="HASingletonDeployer"
@@ -39,33 +48,31 @@
<depends>HASingletonDeployerBarrierController</depends>
<property name="HAPartition"><inject bean="HAPartition"/></property>
- <property name="target"><inject bean="HASingletonDeploymentScanner"/></property>
- <property name="targetStartMethod">deploySingletons</property>
- <property name="targetStartMethodArgument">${jboss.server.home.url}deploy-hasingleton</property>
- <property name="targetStopMethod">undeploySingletons</property>
- <property name="targetStopMethodArgument">${jboss.server.home.url}deploy-hasingleton</property>
+ <property name="target"><inject bean="HASingletonProfileManager"/></property>
+ <property name="targetStartMethod">activateProfile</property>
+ <property name="targetStopMethod">releaseProfile</property>
<!-- whether to register thread context classloader for the RPC handler, default is false -->
- <!--<property name="registerThreadContextClassLoader">false</property>-->
-
- <!-- Whether the singleton should be restarted (i.e. invoke the TargetStopMethod and then the
- TargetStartMethod) if a cluster merge occurs while this node is the singleton master.
- A cluster merge means there may have been more than one singleton master during the period
- when communication between some or all of the nodes in the cluster was disrupted; hence the
- surviving master may not be aware of state changes made by another master. Restarting the
- singleton gives it a signal that it should refresh its internal state from any external
- store.
- By default this is set to true.
- -->
+ <!--<property name="registerThreadContextClassLoader">false</property>-->
+
+ <!-- Whether the singleton should be restarted (i.e. invoke the TargetStopMethod and then the
+ TargetStartMethod) if a cluster merge occurs while this node is the singleton master.
+ A cluster merge means there may have been more than one singleton master during the period
+ when communication between some or all of the nodes in the cluster was disrupted; hence the
+ surviving master may not be aware of state changes made by another master. Restarting the
+ singleton gives it a signal that it should refresh its internal state from any external
+ store.
+ By default this is set to true.
+ -->
<property name="restartOnMerge">true</property>
</bean>
<!--
| A BarrierController that controls the lifecycle of a Barrier mbean
- | based on notifications received by the HASingletonController above.
+ | based on JMX notifications issued by the HASingletonController above.
|
- | Services deployed normally inside ./deploy or ./farm that want to be
+ | Services deployed normally inside ./deploy that want to be
| started/stopped whenever the content of ./deploy-hasingleton/ gets
| deployed/undeployed, or else, whenever the current node becomes the
| master, need only specify a dependency on the Barrier:
@@ -132,4 +139,4 @@
</property>
</bean>
-</deployment>
+</deployment>
\ No newline at end of file
Deleted: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,229 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton;
-
-import java.net.URI;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profileservice.DeploymentPhaseVFSScanner;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFSScanner that exposes methods whereby an HASingletonController
- * can trigger the deployment or undeployment.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class HASingletonDeploymentScanner extends DeploymentPhaseVFSScanner implements HASingletonDeploymentScannerMBean
-{
- private static final DeploymentPhase DEPLOYMENT_PHASE = DeploymentPhase.APPLICATION;
-
- private DeploymentManager deploymentManager;
-
- private boolean deployed;
-
- private ProfileKey activeProfile;
-
- private Set<String> uploadedNames = new LinkedHashSet<String>();
-
- /**
- * Create a new HASingletonDeploymentScanner.
- *
- */
- public HASingletonDeploymentScanner()
- {
- super(DEPLOYMENT_PHASE);
- }
-
- // ---------------------------------------------------------- Properties
-
-
- @Override
- public void setProfileService(ProfileService profileService)
- {
- super.setProfileService(profileService);
- if (profileService != null)
- {
- // In case someone forgot to dependency inject DeploymentManager
- // AND we're lucky enough that the DeploymentManager is already
- // installed into the ProfileService
- if (this.deploymentManager == null)
- {
- this.deploymentManager = profileService.getDeploymentManager();
- }
- }
- else
- {
- this.deploymentManager = null;
- }
- }
-
- public DeploymentManager getDeploymentManager()
- {
- return deploymentManager;
- }
-
- public void setDeploymentManager(DeploymentManager deploymentManager)
- {
- this.deploymentManager = deploymentManager;
- }
-
- // ----------------------------------------------------------------- Public
-
- /**
- * Deploy the content under the given URIs. Called by the
- * HASingletonController when we become the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void deploySingletons(String uris) throws Exception
- {
- if (!this.deployed)
- {
- if (this.deploymentManager == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or directly inject a DeploymentManager");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- addURI(new URI(uri));
- }
-
- scan();
-
- String[] allUploaded = getAllUploadedNames();
- if (allUploaded.length > 0) // JBAS-6441
- {
- DeploymentProgress progress = this.deploymentManager.start(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = true;
- }
- }
-
- /**
- * Undeploy the content under the given URIs. Called by the
- * HASingletonController when we are no longer the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void undeploySingletons(String uris) throws Exception
- {
- if (this.deployed)
- {
- if (this.deploymentManager == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or directly inject a DeploymentManager");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- removeURI(new URI(uri));
- }
-
- scan();
-
- String[] allUploaded = getAllUploadedNames();
-
- this.uploadedNames.clear();
-
- if (allUploaded.length > 0) // JBAS-6441
- {
- DeploymentProgress progress = this.deploymentManager.stop(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- progress = this.deploymentManager.undeploy(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = false;
- }
- }
-
- // ---------------------------------------------------- Protected Overrides
-
- @Override
- protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
- {
- VFSDeployment deployment = createDeployment(file);
-
- activateProfile(profile.getKey());
-
- String name = file.getPathName();
- DeploymentProgress progress = this.deploymentManager.distribute(name, DEPLOYMENT_PHASE, file.toURL(), true);
- progress.run();
-
- String[] repoNames = progress.getDeploymentID().getRepositoryNames();
- if (repoNames != null)
- {
- for (String repoName : repoNames)
- {
- uploadedNames.add(repoName);
- }
- }
-
- return deployment;
- }
-
- @Override
- protected void remove(Profile profile, String name) throws Exception
- {
- // we deal with everything at the end of undeploySingletons
- }
-
- // ---------------------------------------------------------------- Private
-
- private void activateProfile(ProfileKey key) throws Exception
- {
- if (activeProfile != key)
- {
- this.deploymentManager.loadProfile(key, false);
- activeProfile = key;
- }
- }
-
- private String[] getAllUploadedNames()
- {
- String[] result = new String[this.uploadedNames.size()];
- return this.uploadedNames.toArray(result);
- }
-
-}
Modified: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,15 +21,13 @@
*/
package org.jboss.ha.singleton;
-import java.net.URI;
-import java.util.List;
/**
* StandardMBean interface for {@link HASingletonDeploymentScanner}
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public interface HASingletonDeploymentScannerMBean
{
Property changes on: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java (from rev 85385, trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java)
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java (rev 0)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,252 @@
+/*
+ * 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.ha.singleton;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+
+/**
+ * Bean that activates a configurable Profile when notified by a singleton
+ * controller, and releases it when notified.
+ *
+ * TODO rename and move to another package, as there is nothing
+ * HASingleton-specific about what this bean does; it just exposes an
+ * operation an HASingletonController can use.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 82920 $
+ */
+public class HASingletonProfileActivator implements HASingletonProfileActivatorMBean
+{
+ /** Default value for {@link #getProfileName()} */
+ public static final String DEFAULT_PROFILE_NAME = "deploy-hasingleton";
+
+ protected final Logger log = Logger.getLogger(getClass());
+
+ /** Whether this node has activated its profile */
+ private boolean activated;
+
+ /** The profile service key domain */
+ private String profileDomain;
+
+ /** The profile service key name */
+ private String profileServer;
+
+ /** The profile service key name */
+ private String profileName;
+
+ /** The profile service key */
+ private ProfileKey profileKey;
+
+ /** The profile service */
+ private ProfileService profileService;
+
+ // ----------------------------------------------------------- Constructors
+
+ /**
+ * Create a new HASingletonProfileActivator.
+ */
+ public HASingletonProfileActivator()
+ {
+ super();
+ }
+
+ // ------------------------------------------------------------- Properties
+
+ /**
+ * Gets the ProfileService.
+ *
+ * @return the profileService.
+ */
+ public ProfileService getProfileService()
+ {
+ return profileService;
+ }
+
+ /**
+ * Sets the ProfileService reference.
+ *
+ * @param profileService the profileService. Cannot be <code>null</code>
+ *
+ * @throws IllegalArgumentException if <code>profileService</code> is <code>null</code>
+ */
+ public void setProfileService(ProfileService profileService)
+ {
+ if (profileService == null)
+ {
+ throw new IllegalArgumentException("profileService is null");
+ }
+
+ this.profileService = profileService;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getProfileDomain()
+ {
+ return profileDomain;
+ }
+
+ /**
+ * Sets the value that should be used for the
+ * {@link ProfileKey#getDomain() domain} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @param profileDomain the domain, or <code>null</code>
+ */
+ public void setProfileDomain(String profileDomain)
+ {
+ this.profileDomain = profileDomain;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getProfileServer()
+ {
+ return profileServer;
+ }
+
+ /**
+ * Sets the value that should be used for the
+ * {@link ProfileKey#getServer() server} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @param profileServer the server, or <code>null</code>
+ */
+ public void setProfileServer(String profileServer)
+ {
+ this.profileServer = profileServer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getProfileName()
+ {
+ return profileName == null ? DEFAULT_PROFILE_NAME : profileName;
+ }
+
+ /**
+ * Sets the value that should be used for the
+ * {@link ProfileKey#getName() name} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @param profileName the name, or <code>null</code>
+ */
+ public void setProfileName(String profileName)
+ {
+ this.profileName = profileName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isActivated()
+ {
+ return activated;
+ }
+
+ // -------------------------------------------------------------- Public
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void activateProfile() throws Exception
+ {
+ if (this.profileService == null)
+ {
+ throw new IllegalStateException("Must configure the ProfileService");
+ }
+
+ if (!this.activated)
+ {
+ try
+ {
+ this.profileService.activateProfile(getProfileKey());
+
+ this.activated = true;
+ }
+ catch (NoSuchProfileException e)
+ {
+ handleNoSuchProfileException(e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void releaseProfile() throws Exception
+ {
+ if (this.activated)
+ {
+ try
+ {
+ this.profileService.deactivateProfile(getProfileKey());
+ }
+ catch (NoSuchProfileException e)
+ {
+ log.warn("No Profile is registered under key " + getProfileKey());
+ }
+
+ this.activated = false;
+ }
+ }
+
+ /**
+ * Gets the key for the {@link Profile} that we activate and release.
+ *
+ * @return the key. Will not return <code>null</code>
+ *
+ * @see HASingletonProfileActivator#getProfileDomain()
+ * @see HASingletonProfileActivator#getProfileServer()
+ * @see HASingletonProfileActivator#getProfileName()
+ */
+ public ProfileKey getProfileKey()
+ {
+ if (this.profileKey == null)
+ {
+ this.profileKey = new ProfileKey(getProfileDomain(), getProfileServer(), getProfileName());
+ }
+ return this.profileKey;
+ }
+
+ // -------------------------------------------------------------- Protected
+
+
+ /**
+ * Handle a NoSuchProfileException thrown in {@link #activateProfile()}.
+ * This base implementation just logs a WARN.
+ */
+ protected void handleNoSuchProfileException(NoSuchProfileException e)
+ {
+ log.warn("No Profile has been registered under key " + getProfileKey() +
+ " -- perhaps you have a deployed deploy-hasingleton-jboss-beans.xml " +
+ " without any corresponding profile configured?");
+ }
+
+}
\ No newline at end of file
Copied: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivatorMBean.java (from rev 85385, trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivatorMBean.java)
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivatorMBean.java (rev 0)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivatorMBean.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,84 @@
+/*
+ * 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.ha.singleton;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+
+/**
+ * StandardMBean interface for {@link HASingletonProfileActivator}.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 82920 $
+ */
+public interface HASingletonProfileActivatorMBean
+{
+
+ /**
+ * Gets the value that should be used for the
+ * {@link ProfileKey#getDomain() domain} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @return the domain, or <code>null</code> if not set
+ */
+ String getProfileDomain();
+
+ /**
+ * Gets the value that should be used for the
+ * {@link ProfileKey#getServer() server} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @return the server, or <code>null</code> if not set
+ */
+ String getProfileServer();
+
+ /**
+ * Gets the value that should be used for the
+ * {@link ProfileKey#getName() name} portion of
+ * the singleton @{link Profile}'s {@link #getProfileKey() ProfileKey}.
+ *
+ * @return the name, or {@link #DEFAULT_PROFILE_NAME} if not set
+ */
+ String getProfileName();
+
+ /**
+ * Gets whether this object has activated its profile.
+ *
+ * @return <code>true</code> if {@link #activateProfile()} has successfully
+ * completed and {@link #releaseProfile()} has not been called;
+ * <code>false</code> otherwise.
+ */
+ boolean isActivated();
+
+ /**
+ * Tells the ProfileService to {@link ProfileService#activateProfile(ProfileKey) activate the profile}.
+ * Called by the HASingletonController when we become the singleton master.
+ */
+ void activateProfile() throws Exception;
+
+ /**
+ * Tells the ProfileService to {@link ProfileService#releaseProfile(ProfileKey) release the profile}.
+ * Called by the HASingletonController when we are no longer the singleton master.
+ */
+ void releaseProfile() throws Exception;
+
+}
\ No newline at end of file
Copied: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java (from rev 85385, trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java)
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java (rev 0)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,239 @@
+/*
+ * 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.ha.singleton;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.AbstractProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicSubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.ImmutableProfileSourceMetaData;
+import org.jboss.system.server.profileservice.repository.AbstractProfileFactory;
+
+/**
+ * Extends {@link HASingletonProfileActivator} by actually creating and
+ * registering a {@link Profile} from a configurable set of URIs during
+ * the {@link #start()} phase, deregistering it in the {@link #stop()} phase.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 82920 $
+ */
+public class HASingletonProfileManager extends HASingletonProfileActivator implements HASingletonProfileManagerMBean
+{
+ private AbstractProfileFactory profileFactory;
+
+ /** The list of URIs to scan */
+ private List<URI> uriList = new CopyOnWriteArrayList<URI>();
+
+ /**
+ * Create a new HASingletonProfileManager.
+ *
+ */
+ public HASingletonProfileManager()
+ {
+ super();
+ }
+
+ // ---------------------------------------------------------- Properties
+
+ public AbstractProfileFactory getProfileFactory()
+ {
+ return profileFactory;
+ }
+
+ public void setProfileFactory(AbstractProfileFactory profileFactory)
+ {
+ this.profileFactory = profileFactory;
+ }
+
+ /**
+ * Set the uri list
+ *
+ * @param list the list
+ * @throws IOException
+ */
+ public void setURIList(final List<URI> list) throws IOException
+ {
+ if (list == null)
+ {
+ throw new NullPointerException("list argument cannot be null");
+ }
+
+ // start out with a fresh list
+ uriList.clear();
+
+ for(int n = 0; n < list.size(); n ++)
+ {
+ URI uri = list.get(n);
+ if (uri == null)
+ {
+ throw new IllegalArgumentException("list element["+n+"] is null");
+ }
+
+ if( uriList.add(uri) == true )
+ {
+ log.debug("Added URI: " + uri);
+ }
+ }
+ log.debug("URI list: " + uriList);
+ }
+
+ /**
+ * Get the uri list
+ *
+ * @return the list
+ */
+ public List<URI> getURIList()
+ {
+ return new ArrayList<URI>(uriList);
+ }
+
+
+
+ // ----------------------------------------------------------------- Public
+
+ /**
+ * Builds a profile from the {@link #getURIList() URI list} and registers
+ * it under the configured {@link #getProfileKey()}.
+ */
+ public void start() throws Exception
+ {
+ if (this.profileFactory == null)
+ {
+ throw new IllegalStateException("Must configure profileFactory");
+ }
+
+ if (getProfileService() == null)
+ {
+ throw new IllegalStateException("Must configure profileService");
+ }
+
+ URI[] rootURIs = uriList.toArray(new URI[uriList.size()]);
+ // TODO add dependencies on bootstrap profiles
+ String[] rootSubProfiles = new String[0];
+ // Create a hotdeployment profile
+ ProfileMetaData metadata = createProfileMetaData(true, rootURIs, rootSubProfiles);
+
+ Profile profile = profileFactory.createProfile(getProfileKey(), metadata);
+ getProfileService().registerProfile(profile);
+ }
+
+ /**
+ * Unregisters the profile registered in {@link #start()}.
+ */
+ public void stop() throws Exception
+ {
+ ProfileService profSvc = getProfileService();
+ ProfileKey profKey = getProfileKey();
+ if (profSvc != null && profKey != null)
+ {
+ try
+ {
+ // Inactivate first if needed
+ if (profSvc.getActiveProfileKeys().contains(profKey))
+ {
+ releaseProfile();
+ }
+
+ profSvc.unregisterProfile(profKey);
+ }
+ catch (NoSuchProfileException e)
+ {
+ log.warn("Could not unregister unknown profile " + profKey);
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------- Private
+
+
+ /**
+ * Create a profile meta data.
+ *
+ * @param name the profile name.
+ * @param repositoryType the repository type.
+ * @param uris the repository uris.
+ * @param subProfiles a list of profile dependencies.
+ * @return the profile meta data.
+ */
+ private ProfileMetaData createProfileMetaData(boolean hotDeployment, URI[] uris, String[] subProfiles)
+ {
+ // Create profile
+ BasicProfileMetaData metaData = new BasicProfileMetaData();
+ metaData.setDomain(getProfileDomain());
+ metaData.setServer(getProfileServer());
+ metaData.setName(getProfileName());
+
+ // Create profile sources
+ ProfileSourceMetaData source = createSource(uris, hotDeployment);
+ metaData.setSource(source);
+
+ List<SubProfileMetaData> profileList = new ArrayList<SubProfileMetaData>();
+ for(String subProfile : subProfiles)
+ {
+ BasicSubProfileMetaData md = new BasicSubProfileMetaData();
+ md.setName(subProfile);
+ profileList.add(md);
+ }
+ metaData.setSubprofiles(profileList);
+
+ return metaData;
+ }
+
+ /**
+ * Create a profile repository source meta data.
+ *
+ * @param type the repository type.
+ * @param uri the uri
+ * @return the profile source meta data.
+ */
+ protected ProfileSourceMetaData createSource(URI[] uris, boolean hotDeployment)
+ {
+ AbstractProfileSourceMetaData source = null;
+ if(hotDeployment)
+ {
+ source = new HotDeploymentProfileSourceMetaData();
+ }
+ else
+ {
+ source = new ImmutableProfileSourceMetaData();
+ }
+ List<String> sources = new ArrayList<String>();
+ for(URI uri : uris)
+ sources.add(uri.toString());
+ source.setSources(sources);
+ return source;
+ }
+
+}
Copied: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManagerMBean.java (from rev 85385, trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManagerMBean.java)
===================================================================
--- branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManagerMBean.java (rev 0)
+++ branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManagerMBean.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.ha.singleton;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+/**
+ * StandardMBean interface for {@link HASingletonProfileManager}.
+ *
+ * @author Brian Stansberry
+ * @version $Revision: 82920 $
+ */
+public interface HASingletonProfileManagerMBean
+{
+
+ /**
+ * Set the uri list
+ *
+ * @param list the list
+ * @throws IOException
+ */
+ public abstract void setURIList(final List<URI> list) throws IOException;
+
+ /**
+ * Get the uri list
+ *
+ * @return the list
+ */
+ public abstract List<URI> getURIList();
+
+}
\ No newline at end of file
Property changes on: branches/Branch_5_x/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/component-matrix/pom.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -68,7 +68,7 @@
<version.org.jboss.ejb3.proxy.clustered.client>1.0.0</version.org.jboss.ejb3.proxy.clustered.client>
<version.org.jboss.ejb3.security.client>1.0.0</version.org.jboss.ejb3.security.client>
<version.org.jboss.ejb3>1.1.1</version.org.jboss.ejb3>
- <version.org.jboss.integration>5.0.3.GA</version.org.jboss.integration>
+ <version.org.jboss.integration>5.1.0.CR1</version.org.jboss.integration>
<version.org.jboss.jbossxb>2.0.0.GA</version.org.jboss.jbossxb>
<version.org.jboss.jpa>1.0.0-CR1</version.org.jboss.jpa>
<version.org.jboss.logbridge>1.0.0.CR1</version.org.jboss.logbridge>
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/AbstractConnectionFactoryICF.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/AbstractNonXADataSourceICF.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
===================================================================
--- branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -23,8 +23,7 @@
import java.io.File;
import java.io.FileWriter;
-import java.io.Serializable;
-import java.net.URI;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
@@ -45,6 +44,7 @@
import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
import org.jboss.resource.metadata.mcf.TxConnectionFactoryDeploymentMetaData;
import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
@@ -57,18 +57,42 @@
public class DsDataSourceTemplate
implements DeploymentTemplate
{
+ /** The logger. */
private static final Logger log = Logger.getLogger(DsDataSourceTemplate.class);
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-ds.xml";
+
+ /** The deployment template info. */
private DeploymentTemplateInfo info;
+
- @SuppressWarnings("deprecation")
- public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values) throws Exception
+ public String getDeploymentName(String deploymentBaseName)
{
- String dsName = deploymentBaseName+"-ds.xml";
- URI dsXmlURI = new URI(root.toURI()+dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
+
+ public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
+ DeploymentTemplateInfo values)
+ throws Exception
+ {
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
public DeploymentTemplateInfo getInfo()
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/InstanceClassFactoryUtils.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/LocalDSInstanceClassFactory.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/NoTxCFInstanceClassFactory.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/NoTxInstanceClassFactory.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/TxInstanceClassFactory.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java
===================================================================
--- branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -40,7 +40,7 @@
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision: $</tt>
+ * @version <tt>$Revision$</tt>
*/
public class XAConnectionFactoryProperty
extends ManagedPropertyImpl
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XAConnectionFactoryProperty.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/XADSInstanceClassFactory.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/.classpath
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/.project
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/build.bat
===================================================================
--- branches/Branch_5_x/profileservice/build.bat 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/build.bat 2009-03-06 15:21:50 UTC (rev 85526)
@@ -8,7 +8,7 @@
REM
REM ======================================================================
REM
-REM $Id: build.bat 24242 2004-10-04 20:13:37Z andd $
+REM $Id$
REM
REM Authors:
REM Jason Dillon <jason at planet57.com>
Property changes on: branches/Branch_5_x/profileservice/build.bat
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/build.sh
===================================================================
--- branches/Branch_5_x/profileservice/build.sh 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/build.sh 2009-03-06 15:21:50 UTC (rev 85526)
@@ -8,7 +8,7 @@
## ##
### ====================================================================== ###
-# $Id: build.sh 24242 2004-10-04 20:13:37Z andd $
+# $Id$
PROGNAME=`basename $0`
DIRNAME=`dirname $0`
Property changes on: branches/Branch_5_x/profileservice/build.sh
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/build.xml
===================================================================
--- branches/Branch_5_x/profileservice/build.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/build.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -15,7 +15,7 @@
<!-- -->
<!-- ====================================================================== -->
-<!-- $Id: build.xml 59266 2007-01-02 07:31:32Z scott.stark at jboss.org $ -->
+<!-- $Id$ -->
<project default="main" name="JBoss/ProfileService">
@@ -94,6 +94,7 @@
<!-- The combined dependant module classpath -->
<path id="dependentmodule.classpath">
+ <path refid="jboss.system.classpath"/>
</path>
<!-- ===== -->
Property changes on: branches/Branch_5_x/profileservice/build.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/etc/default.mf
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/TraceAdvice.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/TraceAdvice.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/TraceAdvice.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,7 @@
* TraceAdvice.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class TraceAdvice
{
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/TraceAdvice.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperAdvice.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperAdvice.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperAdvice.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -34,7 +34,7 @@
* that require proxies.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 63962 $
+ * @version $Revision$
*/
public class WrapperAdvice
{
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperAdvice.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperIterator.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperIterator.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperIterator.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,7 +28,7 @@
*
* @param <T> the interface
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class WrapperIterator<T> implements Iterator<T>
{
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperIterator.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperSet.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperSet.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperSet.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,7 @@
*
* @param <T> the interface type
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
class WrapperSet<T> extends AbstractSet<T> implements Serializable
{
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/managed/plugins/advice/WrapperSet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/aop/MainDeployerAdvice.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/aop/ManagedObjectInvokeAspect.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureDeploymentManager.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureDeploymentManager.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureDeploymentManager.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -22,6 +22,7 @@
package org.jboss.profileservice.ejb;
import java.net.URL;
+import java.util.Collection;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -42,7 +43,7 @@
/**
* A secured ejb facade over the DeploymentManager interface
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
@Stateless(name="SecureDeploymentManager")
@SecurityDomain(value="profileservice", unauthenticatedPrincipal="nobody")
@@ -68,60 +69,49 @@
{
delegate = null;
}
- public DeploymentProgress distribute(String name, DeploymentPhase phase,
- URL contentURL, boolean copyContent) throws Exception
+ public DeploymentProgress distribute(String name, URL contentURL, boolean copyContent) throws Exception
{
- return delegate.distribute(name, phase, contentURL, copyContent);
+ return delegate.distribute(name, contentURL, copyContent);
}
- public DeploymentProgress distribute(String name, DeploymentPhase phase,
- URL contentURL) throws Exception
+ public Collection<ProfileKey> getProfiles()
{
- return delegate.distribute(name, phase, contentURL);
+ return delegate.getProfiles();
}
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase)
- throws Exception
+ public String[] getRepositoryNames(String[] names) throws Exception
{
- return delegate.getRepositoryNames(names, phase);
+ return delegate.getRepositoryNames(names);
}
public boolean isRedeploySupported()
{
return delegate.isRedeploySupported();
}
- public void loadProfile(ProfileKey key, boolean allowHotDeployments)
- throws Exception
+ public void loadProfile(ProfileKey key) throws Exception
{
- delegate.loadProfile(key, allowHotDeployments);
+ delegate.loadProfile(key);
}
- public DeploymentProgress prepare(DeploymentPhase phase, String... names)
- throws Exception
+ public DeploymentProgress prepare(String... names) throws Exception
{
- return delegate.prepare(phase, names);
+ return delegate.prepare(names);
}
- public DeploymentProgress redeploy(String name, DeploymentPhase phase,
- URL contentURL) throws Exception
+ public DeploymentProgress redeploy(String name) throws Exception
{
- return delegate.redeploy(name, phase, contentURL);
+ return delegate.redeploy(name);
}
- public void releaseProfile(ProfileKey key, boolean allowHotDeployments)
- throws Exception
+ public void releaseProfile() throws Exception
{
- delegate.releaseProfile(key, allowHotDeployments);
+ delegate.releaseProfile();
}
- public DeploymentProgress start(DeploymentPhase phase, String... names)
- throws Exception
+ public DeploymentProgress remove(String... names) throws Exception
{
- return delegate.start(phase, names);
+ return delegate.remove(names);
}
- public DeploymentProgress stop(DeploymentPhase phase, String... names)
- throws Exception
+ public DeploymentProgress start(String... names) throws Exception
{
- return delegate.stop(phase, names);
+ return delegate.start(names);
}
- public DeploymentProgress undeploy(DeploymentPhase phase, String... names)
- throws Exception
+ public DeploymentProgress stop(String... names) throws Exception
{
- return delegate.undeploy(phase, names);
+ return delegate.stop(names);
}
-
}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,22 +31,20 @@
import javax.ejb.Stateless;
import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.ejb3.annotation.SecurityDomain;
import org.jboss.deployers.spi.management.NameMatcher;
+import org.jboss.ejb3.annotation.SecurityDomain;
import org.jboss.logging.Logger;
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.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
/**
* A secured ejb facade over the ManagementView interface
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
@Stateless
@SecurityDomain(value="profileservice", unauthenticatedPrincipal="nobody")
@@ -73,10 +71,10 @@
delegate = null;
}
- public void applyTemplate(DeploymentPhase phase, String deploymentBaseName,
+ public void applyTemplate(String deploymentBaseName,
DeploymentTemplateInfo info) throws Exception
{
- delegate.applyTemplate(phase, deploymentBaseName, info);
+ delegate.applyTemplate(deploymentBaseName, info);
}
public ManagedComponent getComponent(String name, ComponentType type)
@@ -91,10 +89,10 @@
return delegate.getComponentsForType(type);
}
- public ManagedDeployment getDeployment(String name, DeploymentPhase phase)
- throws NoSuchDeploymentException, Exception
+ public ManagedDeployment getDeployment(String name)
+ throws NoSuchDeploymentException
{
- return delegate.getDeployment(name, phase);
+ return delegate.getDeployment(name);
}
public Set<String> getDeploymentNames()
@@ -144,9 +142,9 @@
return delegate.getTemplateNames();
}
- public void loadProfile(ProfileKey key) throws Exception
+ public void load()
{
- delegate.loadProfile(key);
+ delegate.load();
}
public void process() throws Exception
@@ -154,20 +152,19 @@
delegate.process();
}
- public void reloadProfile() throws Exception
+ public void reload()
{
- delegate.reloadProfile();
+ delegate.reload();
}
- public void removeDeployment(String deploymentName, DeploymentPhase phase)
- throws NoSuchDeploymentException, Exception
- {
- delegate.removeDeployment(deploymentName, phase);
- }
-
public void updateComponent(ManagedComponent comp) throws Exception
{
delegate.updateComponent(comp);
}
+ public void removeComponent(ManagedComponent comp) throws Exception
+ {
+ delegate.removeComponent(comp);
+ }
+
}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureProfileServiceBean.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureProfileServiceBean.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureProfileServiceBean.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,6 @@
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.ejb3.annotation.RemoteBinding;
import org.jboss.ejb3.annotation.SecurityDomain;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
@@ -41,7 +40,7 @@
/**
* A secured ejb facade over the ProfileService interface
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
@Stateless(name="SecureProfileService")
@SecurityDomain(value="profileservice", unauthenticatedPrincipal="nobody")
@@ -52,11 +51,23 @@
@Resource(mappedName="ProfileService")
private ProfileService delegate;
@EJB(beanName="SecureManagementView") ManagementView mgtView;
-
- public Profile getActiveProfile() throws NoSuchProfileException
+
+ public void activateProfile(ProfileKey key) throws NoSuchProfileException, Exception
{
- return delegate.getActiveProfile();
+ delegate.activateProfile(key);
}
+ public void deactivateProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ delegate.deactivateProfile(key);
+ }
+ public Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ return delegate.getActiveProfile(key);
+ }
+ public Collection<ProfileKey> getActiveProfileKeys()
+ {
+ return delegate.getActiveProfileKeys();
+ }
public DeploymentManager getDeploymentManager()
{
return delegate.getDeploymentManager();
@@ -69,25 +80,25 @@
{
return delegate.getProfile(key);
}
- public String[] getProfileDeploymentNames(ProfileKey key)
- throws NoSuchProfileException
- {
- return delegate.getProfileDeploymentNames(key);
- }
public Collection<ProfileKey> getProfileKeys()
{
return delegate.getProfileKeys();
}
public ManagementView getViewManager()
{
- return mgtView;
+ return delegate.getViewManager();
}
- public Profile newProfile(ProfileKey key) throws Exception
+ public void registerProfile(Profile profile) throws Exception
{
- return delegate.newProfile(key);
+ delegate.registerProfile(profile);
}
- public void removeProfile(ProfileKey key) throws Exception
+ public void unregisterProfile(ProfileKey key) throws NoSuchProfileException
{
- delegate.removeProfile(key);
+ delegate.unregisterProfile(key);
}
+ public void validateProfile(ProfileKey key) throws Exception
+ {
+ delegate.validateProfile(key);
+ }
+
}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java (from rev 85384, trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java)
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java (rev 0)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,196 @@
+/*
+ * 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.management;
+
+import java.net.URL;
+
+import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A basic template creator, which applies and distributes the template.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractTemplateCreator
+{
+
+ /** The deployment manager. */
+ private DeploymentManager deploymentMgr;
+
+ /** The default profile key. */
+ private ProfileKey defaultKey = new ProfileKey(ProfileKey.DEFAULT);
+
+ public DeploymentManager getDeploymentManager()
+ {
+ return deploymentMgr;
+ }
+
+ public void setDeploymentManager(DeploymentManager deploymentMgr)
+ {
+ this.deploymentMgr = deploymentMgr;
+ }
+
+ public ProfileKey getDefaulProfiletKey()
+ {
+ return defaultKey;
+ }
+
+ public void setDefaultProfileKey(ProfileKey defaultKey)
+ {
+ this.defaultKey = defaultKey;
+ }
+
+ public String applyTemplate(DeploymentTemplate template, String deploymentBaseName, DeploymentTemplateInfo info)
+ throws Exception
+ {
+ if(template == null)
+ throw new IllegalArgumentException("Null deployment template.");
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null deployment name.");
+ if(info == null)
+ throw new IllegalArgumentException("Null deployment template info.");
+
+ // Load the deployment manager
+ this.deploymentMgr.loadProfile(defaultKey);
+ // The virtual file
+ VirtualFile base = null;
+ // Deploy the deployment
+ String[] repositoryNames = null;
+ try
+ {
+ // Apply the template
+ String deploymentName = template.getDeploymentName(deploymentBaseName);
+ if(deploymentName == null)
+ throw new IllegalStateException("getDeploymentName returned a null value.");
+ base = template.applyTemplate(info);
+ if(base == null)
+ throw new IllegalStateException("applyTemplate returned null virtual file.");
+
+ try
+ {
+ // Distribute
+ repositoryNames = distribute(deploymentName, base.toURL());
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ // Try to remove
+ if(repositoryNames != null)
+ remove(repositoryNames);
+ }
+ catch(Exception ignore) { }
+ // Rethrow
+ throw e;
+ }
+
+ try
+ {
+ // Start the deployment
+ start(repositoryNames);
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ // Try to stop
+ stop(repositoryNames);
+ }
+ catch(Exception ignore)
+ {
+ //
+ }
+ try
+ {
+ // Try to remove
+ remove(repositoryNames);
+ }
+ catch(Exception ignore)
+ {
+ //
+ }
+ // Rethrow
+ throw e;
+ }
+ }
+ finally
+ {
+ // Release the deployment manager
+ this.deploymentMgr.releaseProfile();
+
+ // Remove the temp file
+ if(base != null)
+ base.delete();
+ }
+ return repositoryNames[0];
+ }
+
+ protected String[] distribute(String name, URL url) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.distribute(name, url, true);
+ progress.run();
+
+ //
+ checkComplete(progress);
+
+ return progress.getDeploymentID().getRepositoryNames();
+ }
+
+ protected void start(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.start(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void stop(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.stop(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void remove(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.remove(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void checkComplete(DeploymentProgress progress) throws Exception
+ {
+ if(progress.getDeploymentStatus().isFailed())
+ {
+ throw new RuntimeException("Failed to process template.", progress.getDeploymentStatus().getFailure());
+ }
+ }
+
+}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/BaseManagedObject.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,11 +28,8 @@
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.registry.KernelBus;
-import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.EnumValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.profileservice.spi.types.ControllerStateMetaType;
/**
* Microcontainer KernelBus runtime component dispatcher.
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,6 +21,7 @@
*/
package org.jboss.profileservice.management;
+import java.io.IOException;
import java.lang.annotation.Annotation;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -42,14 +43,12 @@
import org.jboss.aspects.remoting.MergeMetaDataInterceptor;
import org.jboss.aspects.remoting.Remoting;
import org.jboss.aspects.security.SecurityClientInterceptor;
-import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.management.DeploymentTemplate;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.NameMatcher;
import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
@@ -62,7 +61,6 @@
import org.jboss.managed.api.MutableManagedComponent;
import org.jboss.managed.api.MutableManagedObject;
import org.jboss.managed.api.RunState;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.managed.api.annotation.ManagementComponent;
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectID;
@@ -86,10 +84,11 @@
import org.jboss.profileservice.spi.NoSuchDeploymentException;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.remoting.InvokerLocator;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
/**
* The default ManagementView implementation.
@@ -97,59 +96,71 @@
* @author Scott.Stark at jboss.org
* @author adrian at jboss.org
* @author ales.justin at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
@ManagementObject(name="ManagementView", componentType=@ManagementComponent(type="MCBean", subtype="*"))
-public class ManagementViewImpl implements ManagementView
+public class ManagementViewImpl extends AbstractTemplateCreator implements ManagementView
{
+ /** The logger. */
private static Logger log = Logger.getLogger(ManagementViewImpl.class);
private static final String BUNDLE_NAME = "org.jboss.profileservice.management.messages"; //$NON-NLS-1$
-
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
/** The ProfileService for loading profiles */
private ProfileService ps;
- /** The currently loaded profile */
- private Profile activeProfile;
- private long activeProfileLastModified;
- /** The MainDeployer used to process profile changes */
+ /** The last modified cache for loaded profiles */
+ private Map<ProfileKey, Long> lastModified = new HashMap<ProfileKey, Long>();
+ /** Force a reload of ManagementView. */
+ private boolean forceReload;
+
+ /** The MainDeployer only used to get the ManagedDeployments */
private MainDeployer mainDeployer;
+ /** The attachment store to persist the component changes. */
+ private AttachmentStore store;
- private InvokerLocator locator;
-
/** The deployment templates that have been registered with the MV */
private HashMap<String, DeploymentTemplate> templates = new HashMap<String, DeploymentTemplate>();
+
/** The internationalization resource bundle */
private ResourceBundle i18n;
/** the Locale for the i18n messages */
private Locale currentLocale;
/** The formatter used for i18n messages */
private MessageFormat formatter = new MessageFormat("");
+
/** An index of ManagedComponent by ComponentType */
private HashMap<ComponentType, Set<ManagedComponent>> compByCompType = new HashMap<ComponentType, Set<ManagedComponent>>();
/** id/type key to ManagedObject map */
private Map<String, ManagedObject> moRegistry = new HashMap<String, ManagedObject>();
- /** The deployment name to ManagedDeployment map */
- private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
- /** The bootstrap deployment name to ManagedDeployment map */
- private Map<String, ManagedDeployment> bootstrapManagedDeployments = Collections.emptyMap();
/** The ManagedPropertys with unresolved ManagementObjectRefs */
private Map<String, Set<ManagedProperty>> unresolvedRefs = new HashMap<String, Set<ManagedProperty>>();
- /** A map of runtime ManagedObjects needing to be merged with their
- * matching ManagedObject.
- */
+ /** A map of runtime ManagedObjects needing to be merged with their matching ManagedObject. */
private Map<String, ManagedObject> runtimeMOs = new HashMap<String, ManagedObject>();
+
+ /** The bootstrap deployment name to ManagedDeployment map */
+ private Map<String, ManagedDeployment> bootstrapManagedDeployments = Collections.emptyMap();
+ /** The deployment name to ManagedDeployment map */
+ private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
+ /** The root deployments to resolve the deployment name. */
+ private List<String> rootDeployments = new ArrayList<String>();
+
+ @Deprecated
+ private Map<String, ProfileKey> deploymentsToProfile = new HashMap<String, ProfileKey>();
+
+ /** The state mappings. */
private Map<String, String> stateMappings = new HashMap<String, String>();
+
/** The dispatcher handles ManagedOperation dispatches */
private RuntimeComponentDispatcher dispatcher;
- /** */
+ private InvokerLocator locator;
+ /** . */
private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
/** ManagedObjectFactory used for platform mbean ManagedObjects */
ManagedObjectFactory managedObjFactory = ManagedObjectFactory.getInstance();
-
- public ManagementViewImpl()
+
+ public ManagementViewImpl() throws IOException
{
+
currentLocale = Locale.getDefault();
formatter.setLocale(currentLocale);
i18n = ResourceBundle.getBundle(BUNDLE_NAME, currentLocale);
@@ -164,69 +175,37 @@
stateMappings.put("Start", RunState.STARTING.name());
stateMappings.put("Installed", RunState.RUNNING.name());
}
-
- /**
- * Load and associate the given profile with the ManagementView
- * for future operations. This must be called before the other ManagementView
- * operations may be used. Currently there can only be one actively loaded
- * profile against which a client is performing management operations.
- *
- * @param key - the profile to load
- * @throws NoSuchProfileException
- */
- public void loadProfile(ProfileKey key)
- throws Exception
+
+ public synchronized void load()
{
+ // If the profile is not modified do nothing
+ if(isReload() == false)
+ {
+ log.debug("Not reloading profiles.");
+ return;
+ }
+ this.forceReload = false;
+
// Clear any thread interrupt
boolean wasInterrupted = Thread.interrupted();
if(wasInterrupted)
log.debug("Cleared interrupted state of calling thread");
- // If the profile is unmodified do nothing
- if(activeProfile != null && activeProfile.getKey().equals(key))
- {
- if(activeProfile.getLastModified() <= activeProfileLastModified)
- {
- log.debug("Not reloading profile: "+key+", "+activeProfileLastModified);
- return;
- }
- }
- activeProfile = ps.getProfile(key);
- if( activeProfile == null )
- {
- formatter.applyPattern(i18n.getString("ManagementView.NoSuchProfileException")); //$NON-NLS-1$
- Object[] args = {key};
- String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
- }
// Cleanup
- this.compByCompType.clear();
- this.managedDeployments.clear();
- this.moRegistry.clear();
- this.runtimeMOs.clear();
- this.unresolvedRefs.clear();
+ release();
- // Process the deployments
+ //
boolean trace = log.isTraceEnabled();
- Collection<VFSDeployment> deployments = activeProfile.getDeployments();
- for(VFSDeployment deployment : deployments)
- {
- try
- {
- ManagedDeployment md = getManagedDeployment(deployment);
- processManagedDeployment(md, 0, trace);
- }
- catch(Exception e)
- {
- log.warn("Failed to create ManagedDeployment for: " + deployment.getName(), e);
- }
- }
+
+ // load the profiles
+ loadProfiles(trace);
+
// Process the bootstrap deployments
for(ManagedDeployment md : bootstrapManagedDeployments.values())
{
try
{
- processManagedDeployment(md, 0, trace);
+ processManagedDeployment(md, null, 0, trace);
}
catch(Exception e)
{
@@ -235,37 +214,42 @@
}
if(this.runtimeMOs.size() > 0)
log.warn("Failed to merged the following runtime ManagedObjects: "+runtimeMOs);
-
+
// Now create a ManagedDeployment for the platform beans
Map<String, ManagedObject> platformMBeanMOs = ManagementFactoryUtils.getPlatformMBeanMOs(managedObjFactory);
- ManagedDeploymentImpl platformMBeans = new ManagedDeploymentImpl("JDK PlatformMBeans",
- "PlatformMBeans", null, null, platformMBeanMOs);
+ ManagedDeploymentImpl platformMBeans = new ManagedDeploymentImpl("JDK PlatformMBeans", "PlatformMBeans", null,
+ null, platformMBeanMOs);
List<ManagedObject> gcMbeans = ManagementFactoryUtils.getGarbageCollectorMXBeans(managedObjFactory);
Map<String, ManagedObject> gcMOs = new HashMap<String, ManagedObject>();
- for(ManagedObject mo : gcMbeans)
+ for (ManagedObject mo : gcMbeans)
gcMOs.put(mo.getName(), mo);
List<ManagedObject> mmMbeans = ManagementFactoryUtils.getMemoryManagerMXBeans(managedObjFactory);
Map<String, ManagedObject> mmMOs = new HashMap<String, ManagedObject>();
- for(ManagedObject mo : mmMbeans)
+ for (ManagedObject mo : mmMbeans)
mmMOs.put(mo.getName(), mo);
List<ManagedObject> mpoolMBeans = ManagementFactoryUtils.getMemoryPoolMXBeans(managedObjFactory);
Map<String, ManagedObject> mpoolMOs = new HashMap<String, ManagedObject>();
- for(ManagedObject mo : mpoolMBeans)
+ for (ManagedObject mo : mpoolMBeans)
mpoolMOs.put(mo.getName(), mo);
- ManagedDeploymentImpl gcMD = new ManagedDeploymentImpl("GarbageCollectorMXBeans",
- "GarbageCollectorMXBeans", null, null, gcMOs);
+ ManagedDeploymentImpl gcMD = new ManagedDeploymentImpl("GarbageCollectorMXBeans", "GarbageCollectorMXBeans",
+ null, null, gcMOs);
platformMBeans.getChildren().add(gcMD);
- ManagedDeploymentImpl mmMD = new ManagedDeploymentImpl("MemoryManagerMXBeans",
- "MemoryManagerMXBeans", null, null, mmMOs);
+ ManagedDeploymentImpl mmMD = new ManagedDeploymentImpl("MemoryManagerMXBeans", "MemoryManagerMXBeans", null,
+ null, mmMOs);
platformMBeans.getChildren().add(mmMD);
- ManagedDeploymentImpl mpoolMD = new ManagedDeploymentImpl("MemoryPoolMXBeans",
- "MemoryPoolMXBeans", null, null, mpoolMOs);
+ ManagedDeploymentImpl mpoolMD = new ManagedDeploymentImpl("MemoryPoolMXBeans", "MemoryPoolMXBeans", null, null,
+ mpoolMOs);
platformMBeans.getChildren().add(mpoolMD);
- // Create the ManagedComponents
- processManagedDeployment(platformMBeans, 0, trace);
- // Update the modified timestamp
- activeProfileLastModified = activeProfile.getLastModified();
+ try
+ {
+ // Create the ManagedComponents
+ processManagedDeployment(platformMBeans, null, 0, trace);
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to process ManagedDeployments for the platform beans");
+ }
if(wasInterrupted)
{
@@ -273,21 +257,95 @@
log.debug("Restored interrupted state of calling thread");
}
}
- public void reloadProfile() throws Exception
+
+ public void reload()
{
- activeProfileLastModified = 0;
- loadProfile(activeProfile.getKey());
+ forceReload = true;
+ load();
}
+
+ public void release()
+ {
+ // Cleanup
+ this.compByCompType.clear();
+ this.managedDeployments.clear();
+ this.moRegistry.clear();
+ this.runtimeMOs.clear();
+ this.unresolvedRefs.clear();
+ this.lastModified.clear();
+ this.rootDeployments.clear();
+ this.deploymentsToProfile.clear();
+ }
+
+ protected void loadProfiles(boolean trace)
+ {
+ log.debug("reloading profiles: "+ this.ps.getActiveProfileKeys());
+ for(ProfileKey key : this.ps.getActiveProfileKeys())
+ {
+ try
+ {
+ // Get the active profile
+ Profile profile = this.ps.getActiveProfile(key);
+ // Get the deployments
+ Collection<ProfileDeployment> deployments = profile.getDeployments();
+ // Add the lastModified cache
+ this.lastModified.put(key, profile.getLastModified());
+ // Process the deployments
+ for(ProfileDeployment deployment : deployments)
+ {
+ try
+ {
+ ManagedDeployment md = getManagedDeployment(deployment);
+ processManagedDeployment(md, key, 0, trace);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create ManagedDeployment for: " + deployment.getName(), e);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to load profile " + key, e);
+ }
+ }
+ }
+
+ protected boolean isReload()
+ {
+ if(forceReload == true)
+ {
+ forceReload = false;
+ return true;
+ }
+ for(ProfileKey key : this.ps.getActiveProfileKeys())
+ {
+ if(this.lastModified.containsKey(key) == false)
+ return true;
+
+ try
+ {
+ Profile profile = this.ps.getActiveProfile(key);
+ long lastModified = this.lastModified.get(key);
+ if(profile.getLastModified() > lastModified)
+ return true;
+ }
+ catch(Exception ignore) { /** . */ }
+ }
+ return false;
+ }
+
/**
* Process managed deployment.
*
* @param md the managed deployment
+ * @param profile the associated profile key
* @param level depth level
* @param trace is trace enabled
* @throws Exception for any error
*/
- protected void processManagedDeployment(ManagedDeployment md, int level, boolean trace) throws Exception
+ protected void processManagedDeployment(ManagedDeployment md, ProfileKey profile, int level, boolean trace) throws Exception
{
String name = md.getName();
if (trace)
@@ -300,14 +358,22 @@
processManagedObject(mo, md);
}
managedDeployments.put(name, md);
+
+ // TODO this mapping should not be needed
+ if(profile != null)
+ deploymentsToProfile.put(name, profile);
+ // Add root deployments
+ if(level == 0)
+ this.rootDeployments.add(name);
+
// Process children
List<ManagedDeployment> mdChildren = md.getChildren();
if(mdChildren != null && mdChildren.isEmpty() == false)
{
for(ManagedDeployment mdChild : mdChildren)
{
- processManagedDeployment(mdChild, level + 1, trace);
+ processManagedDeployment(mdChild, profile, level + 1, trace);
}
}
}
@@ -353,7 +419,7 @@
RunState state = updateRunState(mo, comp);
log.debug("Updated component: "+comp+" run state to: "+state);
}
- // There is no further processing of runtime ManagedObjects, unless its marked as a component
+ // There is no further processing of runtime ManagedObjects, unless its marked as a component
ManagementComponent mc = managementObject.componentType();
if (mc.type().length() == 0 && mc.subtype().length() == 0)
return;
@@ -399,7 +465,7 @@
// Map any existing ManagedComponent types
for(ManagedComponent comp : md.getComponents().values())
{
- log.debug("Updating ManagementComponent types for: "+comp);
+ log.debug("Updating ManagementComponent: "+comp);
ComponentType type = comp.getType();
Set<ManagedComponent> typeComps = compByCompType.get(type);
if (typeComps == null)
@@ -414,8 +480,6 @@
ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
if (mc != null && md.getComponent(mo.getName()) == null)
{
- if(mo.getName().indexOf("ServerInfo") >= 0)
- log.info("ServerInfo component...");
ComponentType type = new ComponentType(mc.type(), mc.subtype());
ManagedComponentImpl comp = new ManagedComponentImpl(type, md, mo);
md.addComponent(mo.getName(), comp);
@@ -618,6 +682,16 @@
this.locator = locator;
}
+ public AttachmentStore getAttachmentStore()
+ {
+ return store;
+ }
+
+ public void setAttachmentStore(AttachmentStore store)
+ {
+ this.store = store;
+ }
+
public MainDeployer getMainDeployer()
{
return mainDeployer;
@@ -646,7 +720,7 @@
{
this.managedObjFactory = managedObjFactory;
}
-
+
public void setDispatcher(RuntimeComponentDispatcher dispatcher)
{
this.dispatcher = dispatcher;
@@ -657,13 +731,7 @@
*/
public Set<String> getDeploymentNames()
{
- Set<String> names = new HashSet<String>();
- Set<String> profileNames = activeProfile.getDeploymentNames();
- if(profileNames != null)
- names.addAll(profileNames);
- if(bootstrapManagedDeployments != null)
- names.addAll(bootstrapManagedDeployments.keySet());
- return names;
+ return new HashSet<String>(this.managedDeployments.keySet());
}
/**
@@ -750,15 +818,18 @@
log.debug("removeTemplate: "+template);
}
+
/**
+ * Get the managed deployment.
*
- * @param key
- * @param name
- * @return
+ * @param name the deployment name
+ * @throws NoSuchDeploymentException if no matching deployment was found
*/
- public ManagedDeployment getDeployment(String name, DeploymentPhase phase) throws NoSuchDeploymentException,
- Exception
+ public ManagedDeployment getDeployment(String name) throws NoSuchDeploymentException
{
+ if(name == null)
+ throw new IllegalArgumentException("Null deployment name");
+
// Resolve internally.
ManagedDeployment md = this.managedDeployments.get(name);
if (md == null)
@@ -767,13 +838,22 @@
md = this.bootstrapManagedDeployments.get(name);
}
- // Let the DeploymentRepository try to resolve the deployment (simpleName)
+ // Check the file name
if(md == null)
{
- Deployment ctx = activeProfile.getDeployment(name, phase);
- md = this.managedDeployments.get(ctx.getName());
+ for(String deployment : this.rootDeployments)
+ {
+ String fixedDeploymentName = deployment;
+ if(deployment.endsWith("/"))
+ fixedDeploymentName = deployment.substring(0, deployment.length() - 1);
+
+ if(fixedDeploymentName.endsWith(name))
+ {
+ md = this.managedDeployments.get(deployment);
+ break;
+ }
+ }
}
-
// Do not return null
if (md == null)
throw new NoSuchDeploymentException("Managed deployment: " + name + " not found.");
@@ -795,7 +875,7 @@
HashSet<ManagedDeployment> mds = new HashSet<ManagedDeployment>();
for(String name : names)
{
- Deployment ctx = activeProfile.getDeployment(name, null);
+ ProfileDeployment ctx = getProfileDeployment(name);
ManagedDeployment md = getManagedDeployment(ctx);
mds.add(md);
}
@@ -886,7 +966,7 @@
return info;
}
- public void applyTemplate(DeploymentPhase phase, String deploymentBaseName, DeploymentTemplateInfo info)
+ public void applyTemplate(String deploymentBaseName, DeploymentTemplateInfo info)
throws Exception
{
DeploymentTemplate template = templates.get(info.getName());
@@ -899,21 +979,15 @@
}
// Create a deployment base from the template
- VirtualFile root = activeProfile.getRootFile(phase);
if( log.isTraceEnabled() )
- log.trace("applyTemplate, profile="+activeProfile+", deploymentBaseName="+deploymentBaseName+", phase="+phase+", info="+info);
- VirtualFile vf = template.applyTemplate(root, deploymentBaseName, info);
- VFSDeployment ctx = deploymentFactory.createVFSDeployment(vf);
- activeProfile.addDeployment(ctx, phase);
- mainDeployer.addDeployment(ctx);
- // Seems useless, what was the original point of this?
- template.updateTemplateDeployment(ctx, info);
- mainDeployer.process();
-
+ log.trace("applyTemplate, deploymentBaseName="+deploymentBaseName +", info="+info);
+ // Create, distribute and start a deployment template
+ String deploymentName = super.applyTemplate(template, deploymentBaseName, info);
+
/* Scan through the template properties to see if there is a
- property with an ManagementObjectID annotation that needs
- to be used to update the associated ManagedObject name.
+ property with an ManagementObjectID annotation that needs
+ to be used to update the associated ManagedObject name.
*/
for(ManagedProperty prop : info.getProperties().values())
{
@@ -947,16 +1021,16 @@
}
}
}
-
+
// Now apply the managed properties to get the deployment ManagedObjects
- Map<String, ManagedObject> mos = mainDeployer.getManagedObjects(ctx.getName());
- log.debug("applyTemplate, profile="+activeProfile+", deploymentBaseName="+deploymentBaseName+", phase="+phase+", :"+mos);
+ Map<String, ManagedObject> mos = mainDeployer.getManagedObjects(deploymentName);
+ log.debug("applyTemplate, deploymentBaseName="+deploymentBaseName+":"+mos);
// Map the
String propName = info.getRootManagedPropertyName();
if(propName != null)
{
// Flatten out the root objects
- ManagedObject rootMO = mos.get(ctx.getName());
+ ManagedObject rootMO = mos.get(deploymentName);
if(rootMO != null)
flattenRootObject(rootMO, propName, mos);
}
@@ -965,11 +1039,11 @@
// Skip null values
if( prop.getValue() == null )
continue;
-
+
ManagedObject mo = prop.getManagedObject();
if (mo == null)
throw new IllegalArgumentException("Null managed object: " + prop);
-
+
ManagedObject ctxMO = mos.get(mo.getName());
if( ctxMO == null )
{
@@ -1004,69 +1078,19 @@
}
MetaValue metaValue = (MetaValue)value;
ctxProp.setValue(metaValue);
-
+
// todo - should this also dispatch to runtime component?
Object componentName = getComponentName(ctxProp);
if (componentName != null)
dispatcher.set(componentName, ctxProp.getName(), metaValue);
}
}
-
- public void removeDeployment(String deploymentName, DeploymentPhase phase)
- throws NoSuchProfileException, NoSuchDeploymentException, Exception
+
+ public void process() throws DeploymentException
{
- log.debug("removeDeployment, "+deploymentName+", phase: "+phase);
- Deployment ctx = activeProfile.removeDeployment(deploymentName, phase);
- if( ctx == null )
- {
- formatter.applyPattern(i18n.getString("ManagementView.NoSuchDeploymentException")); //$NON-NLS-1$
- Object[] args = {deploymentName};
- String msg = formatter.format(args);
- throw new NoSuchDeploymentException(msg);
- }
-
- if( mainDeployer.removeDeployment(ctx.getName()) == false )
- {
- formatter.applyPattern(i18n.getString("ManagementView.MainDeployerRemoveException")); //$NON-NLS-1$
- Object[] args = {deploymentName};
- String msg = formatter.format(args);
- throw new NoSuchDeploymentException(msg);
-
- }
- // Remove the ManagedDeployment/ManagedComponents
- ManagedDeployment md = managedDeployments.remove(deploymentName);
- if(md != null)
- {
- log.debug("removeDeployment, md: "+md);
- Map<String, ManagedComponent> comps = md.getComponents();
- if(comps != null)
- {
- for(ManagedComponent mc : comps.values())
- {
- ComponentType type = mc.getType();
- Set<ManagedComponent> compsForType = compByCompType.get(type);
- if(compsForType != null)
- {
- if(compsForType.remove(mc) == true)
- log.debug("Removed mc: "+mc);
- else
- log.debug(mc+" was not found in set: "+compsForType);
- }
- }
- }
- }
- }
-
- /**
- * Process the changes made to the profile.
- *
- * @throws Exception
- */
- public void process() throws Exception
- {
mainDeployer.process();
mainDeployer.checkComplete();
- activeProfileLastModified = 0;
+ this.forceReload = true;
}
/**
@@ -1083,8 +1107,7 @@
md = md.getParent();
String name = md.getName();
- DeploymentPhase phase = md.getDeploymentPhase();
- VFSDeployment compDeployment = activeProfile.getDeployment(name, phase);
+ ProfileDeployment compDeployment = getProfileDeployment(name);
if( compDeployment == null )
{
formatter.applyPattern(i18n.getString("ManagementView.NoSuchDeploymentException")); //$NON-NLS-1$
@@ -1095,7 +1118,7 @@
// Apply the managed properties to the server ManagedDeployment/ManagedComponent
ManagedDeployment compMD = managedDeployments.get(md.getName());
- log.debug("updateComponent, profile="+activeProfile+", deploymentName="+name+", phase="+phase+", :"+compMD);
+ log.debug("updateComponent, deploymentName="+name+": "+compMD);
ManagedComponent serverComp = null;
// Find the managed component again
@@ -1164,10 +1187,16 @@
dispatcher.set(componentName, ctxProp.getName(), metaValue);
}
-
- // Update the repository deployment attachments
- activeProfile.updateDeployment(compDeployment, phase, serverComp);
+ // Persist the changed values
+ this.store.updateDeployment(compDeployment, serverComp);
+ // Force reload
+ this.forceReload = true;
}
+
+ public void removeComponent(ManagedComponent comp) throws Exception
+ {
+ // FIXME
+ }
/**
* Get the component name from managed property.
@@ -1306,11 +1335,6 @@
return opProxies;
}
- private ManagedDeployment getManagedDeployment(Deployment ctx)
- throws Exception
- {
- return mainDeployer.getManagedDeployment(ctx.getName());
- }
/**
* Take the root managed object and the associated deployment unit
* managed object map, and look to the root MO for a collection type
@@ -1348,9 +1372,6 @@
}
}
- /**
- * The remoting dispatch target of the client side proxy
- */
public class ManagedOperationDelegate implements ManagedOperation
{
private static final long serialVersionUID = -775240509110032859L;
@@ -1405,11 +1426,30 @@
{
return delegate.getParameters();
}
-
+
public String[] getReflectionSignature()
{
return delegate.getReflectionSignature();
}
}
+ private ManagedDeployment getManagedDeployment(ProfileDeployment ctx) throws DeploymentException
+ {
+ return mainDeployer.getManagedDeployment(ctx.getName());
+ }
+
+ private Profile getProfileForDeployment(String name) throws Exception
+ {
+ ProfileKey key = this.deploymentsToProfile.get(name);
+ if(key == null)
+ throw new NoSuchDeploymentException("No associated profile found for deployment:" + name);
+
+ return this.ps.getActiveProfile(key);
+ }
+
+ private ProfileDeployment getProfileDeployment(String name) throws Exception
+ {
+ Profile profile = getProfileForDeployment(name);
+ return profile.getDeployment(name);
+ }
}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
___________________________________________________________________
Name: svn:keywords
- Revision Id
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -35,7 +35,7 @@
* addition to the component name.
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class AliasMatcher implements NameMatcher<ManagedComponent>
, Serializable
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/messages.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.FileWriter;
-import java.net.URI;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@@ -38,6 +37,7 @@
import org.jboss.metatype.api.values.CompositeValue;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.util.xml.DOMWriter;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
@@ -49,14 +49,31 @@
*
* @author Scott.Stark at jboss.org
* @author adrian at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class DsXmlDataSourceTemplate
implements DeploymentTemplate
{
+ /** The logger. */
private static final Logger log = Logger.getLogger(DsXmlDataSourceTemplate.class);
+
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-ds.xml";
+
+ /** The deployment template info. */
private DeploymentTemplateInfo info;
+ public String getDeploymentName(String deploymentBaseName)
+ {
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
+
/**
* Creates a root/{deploymentBaseName}-ds.xml base descriptor.
*/
@@ -64,13 +81,19 @@
DeploymentTemplateInfo values)
throws Exception
{
- String dsName = deploymentBaseName+"-ds.xml";
- URI dsXmlURI = new URI(root.toURI()+dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
-
+
/**
* There is no update of the ctx by this template since the data model
* is driven from the descriptor created by applyTemplate.
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -23,10 +23,10 @@
import java.io.File;
import java.io.FileWriter;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
@@ -34,24 +34,41 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
+
import org.jboss.deployers.spi.management.DeploymentTemplate;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
* A template for creating jms destinations
*
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision: $</tt>
+ * @version <tt>$Revision$</tt>
*/
public class JmsDestinationTemplate
implements DeploymentTemplate
{
+
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-service.xml";
+
private DeploymentTemplateInfo info;
+
+ public String getDeploymentName(String deploymentBaseName)
+ {
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
public DeploymentTemplateInfo getInfo()
{
@@ -63,14 +80,21 @@
this.info = info;
}
- public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values)
+ public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
+ DeploymentTemplateInfo values)
throws Exception
{
- String dsName = deploymentBaseName + "-service.xml";
- URI dsXmlURI = new URI(root.toURI() + dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
public void updateTemplateDeployment(VFSDeployment ctx, DeploymentTemplateInfo values) throws Exception
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,12 +28,11 @@
import java.util.Map;
import org.jboss.annotation.factory.AnnotationProxy;
-import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.Fields;
import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
import org.jboss.managed.plugins.ManagedObjectImpl;
-import org.jboss.managed.plugins.DefaultFieldsImpl;
import org.jboss.managed.plugins.ManagedPropertyImpl;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.types.SimpleMetaType;
@@ -41,7 +40,7 @@
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision: $</tt>
+ * @version <tt>$Revision$</tt>
*/
public class JmsDestinationTemplateInfo extends BasicDeploymentTemplateInfo
{
@@ -67,7 +66,7 @@
}
@Override
- public DeploymentTemplateInfo copy()
+ public JmsDestinationTemplateInfo copy()
{
JmsDestinationTemplateInfo copy = new JmsDestinationTemplateInfo(getName(), getDescription(), destinationType);
super.copy(copy);
@@ -88,6 +87,7 @@
addManagedProperty("name", "The destination name", true, false, SimpleMetaType.STRING, mo);
addManagedProperty("JNDIName", "The destination's JNDI name", false, true, SimpleMetaType.STRING, mo);
}
+
private void addManagedProperty(String fieldName,
String fieldDescr,
boolean mandatory,
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java (from rev 85384, trunk/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java)
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java (rev 0)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractTransientProfileManager.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,162 @@
+/*
+ * 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.management.upload;
+
+import java.util.ArrayList;
+
+import org.jboss.logging.Logger;
+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.system.server.profile.repository.metadata.BasicProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.ImmutableProfileSourceMetaData;
+
+/**
+ * The AbstractTransientProfileManager maintains a profile for transient deployments.
+ * Transient deployments are copyContent = false, therefore they are not
+ * getting deployed again after AS is restarted.
+ * The aim of the transient profile is to expose those deployments to the
+ * ManagementView.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractTransientProfileManager
+{
+ /** The transient profile name. */
+ public static final String TRANSIENT_PROFILE_NAME = "transient-deployment-profile";
+
+ /** The transient profile key. */
+ public static final ProfileKey TRANSIENT_PROFILE_KEY = new ProfileKey(TRANSIENT_PROFILE_NAME);
+
+ /** The profile factory. */
+ private ProfileFactory profileFactory;
+
+ /** The profile service. */
+ protected ProfileService ps;
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(AbstractTransientProfileManager.class);
+
+ public ProfileService getProfileService()
+ {
+ return this.ps;
+ }
+
+ public void setProfileService(ProfileService ps)
+ {
+ this.ps = ps;
+ }
+
+ public ProfileFactory getProfileFactory()
+ {
+ return profileFactory;
+ }
+
+ public void setProfileFactory(ProfileFactory profileFactory)
+ {
+ this.profileFactory = profileFactory;
+ }
+
+ /**
+ * Start registers and activates the transient deployments profile
+ *
+ * @throws Exception for any error
+ */
+ public void start() throws Exception
+ {
+ if(this.ps == null)
+ throw new IllegalStateException("Null profile service.");
+ if(this.profileFactory == null)
+ throw new IllegalStateException("Null profile factory.");
+
+ // Create the transient deployment profile
+ Profile profile = createTransientProfile();
+ // Register
+ this.ps.registerProfile(profile);
+ // Activate
+ {
+ log.debug("activating transient profile " + TRANSIENT_PROFILE_NAME);
+ this.ps.activateProfile(TRANSIENT_PROFILE_KEY);
+ }
+ }
+
+ /**
+ * Stop deactivates and unregisters the transient deployments profile.
+ */
+ public void stop()
+ {
+ try
+ {
+ // Deactivate
+ log.debug("deactivating transient profile: " + TRANSIENT_PROFILE_NAME);
+ this.ps.deactivateProfile(TRANSIENT_PROFILE_KEY);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to deactivate transient profile: ", e);
+ }
+ try
+ {
+ // Unregister
+ log.debug("unregistering transient profile: " + TRANSIENT_PROFILE_NAME);
+ this.ps.unregisterProfile(TRANSIENT_PROFILE_KEY);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to unregister transient profile: ", e);
+ }
+ }
+
+ /**
+ * Create the transient profile.
+ *
+ * @return the transient profile
+ * @throws Exception for any error
+ */
+ protected Profile createTransientProfile() throws Exception
+ {
+ ProfileMetaData metaData = createTransientProfileMetaData();
+ return profileFactory.createProfile(TRANSIENT_PROFILE_KEY, metaData);
+ }
+
+ /**
+ * Create the transient profile meta data.
+ *
+ * @return the transient profile meta data
+ */
+ protected ProfileMetaData createTransientProfileMetaData()
+ {
+ // Source
+ ImmutableProfileSourceMetaData source = new ImmutableProfileSourceMetaData();
+ source.setSources(new ArrayList<String>());
+ // Profile
+ BasicProfileMetaData profile = new BasicProfileMetaData();
+ profile.setSource(source);
+ profile.setName(TRANSIENT_PROFILE_NAME);
+ //
+ return profile;
+ }
+
+}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,6 +24,8 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -33,11 +35,8 @@
import org.jboss.deployers.spi.management.deploy.DeploymentTarget;
import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.management.upload.remoting.DeployHandler;
import org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
@@ -45,28 +44,38 @@
import org.jboss.remoting.InvokerLocator;
/**
- * The remoting base DeploymentManager implementation
+ * The remoting base DeploymentManager implementation.
+ *
* @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
public class DeploymentManagerImpl implements DeploymentManager
{
+ /** The logger. */
private static Logger log = Logger.getLogger(DeploymentManagerImpl.class);
+
+ /** The bundle name. */
private static final String BUNDLE_NAME = "org.jboss.profileservice.management.upload.messages"; //$NON-NLS-1$
- /** */
+
+ /** The profile service. */
private ProfileService ps;
- /** The currently loaded profile */
- private Profile activeProfile;
- private DeploymentRepositoryFactory repositoryFactory;
- private DeployHandler deployHandler;
+
+ /** The default profile key to upload contents. */
+ private ProfileKey defaultKey;
+ /** The loaded profile key. */
+ private ProfileKey activeProfileKey;
- /** */
+ /** The resource bundle. */
private ResourceBundle i18n;
- /** */
+ /** The current locale. */
private Locale currentLocale;
- /** */
+ /** The message formatter. */
private MessageFormat formatter = new MessageFormat("");
+
+ /** The invoker locator. */
private InvokerLocator locator;
+ /** The remoting subSystem. */
private String remotingSubsystem = "DeploymentManager";
public DeploymentManagerImpl()
@@ -76,34 +85,24 @@
i18n = ResourceBundle.getBundle(BUNDLE_NAME, currentLocale);
}
+ public ProfileKey getDefaultProfileKey()
+ {
+ return defaultKey;
+ }
+ public void setDefaultProfileKey(ProfileKey defaultKey)
+ {
+ this.defaultKey = defaultKey;
+ }
public ProfileService getProfileService()
{
- return ps;
+ return this.ps;
}
public void setProfileService(ProfileService ps)
{
this.ps = ps;
}
- public DeploymentRepositoryFactory getRepositoryFactory()
- {
- return repositoryFactory;
- }
- public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
- {
- this.repositoryFactory = repositoryFactory;
- }
-
- public DeployHandler getDeployHandler()
- {
- return deployHandler;
- }
- public void setDeployHandler(DeployHandler deployHandler)
- {
- this.deployHandler = deployHandler;
- }
-
public InvokerLocator getLocator()
{
return locator;
@@ -122,132 +121,198 @@
this.remotingSubsystem = remotingSubsystem;
}
- public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL)
+ /**
+ * Get the mutable profile keys.
+ */
+ public Collection<ProfileKey> getProfiles()
+ {
+ Collection<ProfileKey> mutableProfiles = new HashSet<ProfileKey>();
+ for( ProfileKey key : this.ps.getActiveProfileKeys())
+ {
+ // Exclude the transient profile
+ if(key.equals(AbstractTransientProfileManager.TRANSIENT_PROFILE_KEY))
+ continue;
+
+ try
+ {
+ Profile profile = this.ps.getActiveProfile(key);
+ if(profile.isMutable())
+ mutableProfiles.add(key);
+ }
+ catch(NoSuchProfileException ignore)
+ {
+ //
+ }
+ }
+ return mutableProfiles;
+ }
+
+ public DeploymentProgress distribute(String name, URL contentURL)
throws Exception
{
- return distribute(name, phase, contentURL, true);
+ return distribute(name, contentURL, true);
}
- public DeploymentProgress distribute(String name, DeploymentPhase phase, URL contentURL, boolean copyContent)
- throws Exception
+ public DeploymentProgress distribute(String name, URL contentURL, boolean copyContent)
{
- if(activeProfile == null)
+ if(name == null)
+ throw new IllegalArgumentException("Null name.");
+ if(contentURL == null)
+ throw new IllegalArgumentException("Null content url.");
+
+ if(getTargetProfile() == null)
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
Object[] args = {};
String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
+ throw new IllegalStateException(msg);
}
List<DeploymentTarget> targets = getDeploymentTargets();
- SerializableDeploymentID deployment = new SerializableDeploymentID(name, phase, contentURL.toString());
+ SerializableDeploymentID deployment = new SerializableDeploymentID(name, getTargetProfile(), contentURL.toString());
deployment.setContentURL(contentURL);
deployment.setCopyContent(copyContent);
return new DeploymentProgressImpl(targets, deployment, CommandType.DISTRIBUTE);
}
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws Exception
+ public String[] getRepositoryNames(String[] names) throws Exception
{
List<DeploymentTarget> targets = getDeploymentTargets();
- return targets.get(0).getRepositoryNames(names, phase);
+ SerializableDeploymentID deployment = new SerializableDeploymentID(names, getTargetProfile(), null);
+ return targets.get(0).getRepositoryNames(deployment);
}
-
+
public boolean isRedeploySupported()
{
+ // TODO
return false;
}
- public void loadProfile(ProfileKey key, boolean allowHotDeployments)
- throws Exception
+ public boolean isRedeploySupported(ProfileKey key) throws NoSuchProfileException
{
- activeProfile = ps.getProfile(key);
- if( activeProfile == null )
- {
- formatter.applyPattern(i18n.getString("DeploymentManager.NoSuchProfileException")); //$NON-NLS-1$
- Object[] args = {key};
- String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
- }
- log.debug("Loading profile, key: "+key+", allowHotDeployments: "+allowHotDeployments);
- activeProfile.enableModifiedDeploymentChecks(allowHotDeployments);
- // Set the deployment repository on the handler
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- log.debug("DeploymentRepository for profile: "+repository);
- deployHandler.setDeploymentRepository(repository);
+ // FIXME
+ return false;
}
-
- public void releaseProfile(ProfileKey key, boolean allowHotDeployments)
- throws Exception
+
+ public void loadProfile(ProfileKey key) throws NoSuchProfileException
{
- activeProfile = ps.getProfile(key);
- if( activeProfile == null )
- {
- formatter.applyPattern(i18n.getString("DeploymentManager.NoSuchProfileException")); //$NON-NLS-1$
- Object[] args = {key};
- String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
- }
- log.debug("Releasing profile, key: "+key);
- activeProfile.enableModifiedDeploymentChecks(allowHotDeployments);
- deployHandler.setDeploymentRepository(null);
+ // Override a DEFAULT key with the injected default
+ if(key.isDefaultKey() && this.defaultKey != null)
+ key = this.defaultKey;
+
+ // Get the mutable profile
+ MutableProfile profile = getProfile(key);
+
+ // Set the key
+ this.activeProfileKey = profile.getKey();
}
+
+ public void releaseProfile()
+ {
+ this.activeProfileKey = null;
+ }
- public DeploymentProgress redeploy(String name, DeploymentPhase phase, URL contentURL)
- throws Exception
+ public DeploymentProgress redeploy(String name)
{
- if(activeProfile == null)
+ if(name == null)
+ throw new IllegalArgumentException("Null name.");
+
+ if(getTargetProfile() == null)
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
Object[] args = {};
String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
+ throw new IllegalStateException(msg);
}
List<DeploymentTarget> targets = getDeploymentTargets();
- SerializableDeploymentID deployment = new SerializableDeploymentID(name, phase, null);
+ SerializableDeploymentID deployment = new SerializableDeploymentID(name, getTargetProfile(), null);
return new DeploymentProgressImpl(targets, deployment, CommandType.REDEPLOY);
}
- public DeploymentProgress prepare(DeploymentPhase phase, String... names) throws Exception
+ public DeploymentProgress prepare(String... names) throws Exception
{
- return doProgress(CommandType.PREPARE, phase, names);
+ return doProgress(CommandType.PREPARE, names);
}
- public DeploymentProgress start(DeploymentPhase phase, String... names) throws Exception
+ public DeploymentProgress start(String... names)
{
- return doProgress(CommandType.START, phase, names);
+ if(names == null)
+ throw new IllegalArgumentException("Null names.");
+
+ return doProgress(CommandType.START, names);
}
- public DeploymentProgress stop(DeploymentPhase phase, String... names) throws Exception
+ public DeploymentProgress stop(String... names)
{
- return doProgress(CommandType.STOP, phase, names);
+ if(names == null)
+ throw new IllegalArgumentException("Null names.");
+
+ return doProgress(CommandType.STOP, names);
}
- public DeploymentProgress undeploy(DeploymentPhase phase, String... names) throws Exception
+ public DeploymentProgress remove(String... names)
{
- return doProgress(CommandType.UNDEPLOY, phase, names);
+ if(names == null)
+ throw new IllegalArgumentException("Null names.");
+
+ return doProgress(CommandType.REMOVE, names);
}
- protected DeploymentProgress doProgress(CommandType type, DeploymentPhase phase, String... names)
- throws Exception
+ protected DeploymentProgress doProgress(CommandType type, String... names)
{
- if(activeProfile == null)
+ if(getTargetProfile() == null)
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
Object[] args = {};
String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
+ throw new IllegalStateException(msg);
}
if (names == null || names.length == 0)
log.warn("Null or empty names.");
List<DeploymentTarget> targets = getDeploymentTargets();
- SerializableDeploymentID deployment = new SerializableDeploymentID(names, phase, null);
+ SerializableDeploymentID deployment = new SerializableDeploymentID(names, getTargetProfile(), null);
return new DeploymentProgressImpl(targets, deployment, type);
}
/**
+ * Get a mutable profile
+ *
+ * @param key the profile key
+ * @return the mutable profile
+ * @throws NoSuchProfileException if the profile does not exist or is not mutable
+ */
+ public MutableProfile getProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ Profile profile = this.ps.getActiveProfile(key);
+ if(profile.isMutable() == false)
+ {
+ formatter.applyPattern(i18n.getString("DeploymentManager.NoMutableProfileException")); //$NON-NLS-1$
+ Object[] args = {};
+ String msg = formatter.format(args);
+ throw new NoSuchProfileException(msg);
+ }
+ return (MutableProfile) profile;
+ }
+
+ /**
+ * Get the target profile to upload contents.
+ * If the DeploymentManager was not loaded, the
+ * default key is used.
+ *
+ * @return the target profile key
+ */
+ protected ProfileKey getTargetProfile()
+ {
+ if(this.activeProfileKey == null)
+ return this.defaultKey;
+
+ return this.activeProfileKey;
+ }
+
+ /**
* TODO: should the targets include cluster info
* @param name
* @return
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,16 +28,16 @@
import org.jboss.deployers.spi.management.deploy.DeploymentID;
import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus.StateType;
import org.jboss.deployers.spi.management.deploy.DeploymentTarget;
import org.jboss.deployers.spi.management.deploy.ProgressEvent;
import org.jboss.deployers.spi.management.deploy.ProgressListener;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus.StateType;
/**
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class DeploymentProgressImpl implements DeploymentProgress, Serializable
{
@@ -87,8 +87,8 @@
case STOP:
stop();
break;
- case UNDEPLOY:
- undeploy();
+ case REMOVE:
+ remove();
break;
default:
throw new IllegalStateException(command+" is not currently handled");
@@ -288,7 +288,7 @@
}
}
- protected void undeploy()
+ protected void remove()
{
SerializableDeploymentStatus status = new SerializableDeploymentStatus(command, StateType.RUNNING);
status.setMessage("Running undeploy to: "+targets);
@@ -309,7 +309,7 @@
try
{
- target.undeploy(deployment);
+ target.remove(deployment);
status = new SerializableDeploymentStatus(command, StateType.COMPLETED);
status.setTarget(target);
status.setMessage("Completed undeploy for target: "+target);
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -27,11 +27,11 @@
import java.util.Arrays;
import org.jboss.deployers.spi.management.deploy.DeploymentID;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.ProfileKey;
/**
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class SerializableDeploymentID implements DeploymentID, Serializable
{
@@ -41,23 +41,25 @@
private transient InputStream contentIS;
private String[] deploymentNames;
private String[] repositoryNames;
- private DeploymentPhase phase;
+ private ProfileKey profileKey;
private String description;
private URL contentURL;
private boolean copyContent;
public SerializableDeploymentID(DeploymentID deployment)
{
- this(deployment.getNames(), deployment.getPhase(), deployment.getDescription());
+ this(deployment.getNames(), deployment.getProfile(), deployment.getDescription());
}
- public SerializableDeploymentID(String name, DeploymentPhase phase, String description)
+
+ public SerializableDeploymentID(String name, ProfileKey profileKey, String description)
{
- this(new String[]{name}, phase, description);
+ this(new String[]{name}, profileKey, description);
}
- public SerializableDeploymentID(String[] names, DeploymentPhase phase, String description)
+
+ public SerializableDeploymentID(String[] names, ProfileKey profileKey, String description)
{
this.deploymentNames = names;
- this.phase = phase;
+ this.profileKey = profileKey;
this.description = description;
this.copyContent = true; // by default we copy content
}
@@ -77,11 +79,16 @@
{
this.repositoryNames = names;
}
- public DeploymentPhase getPhase()
+
+ /**
+ * The target profile for the deployment.
+ * For further use.
+ */
+ public ProfileKey getProfile()
{
- return phase;
+ return this.profileKey;
}
-
+
public String getDescription()
{
return description;
@@ -100,7 +107,6 @@
{
return copyContent;
}
-
public void setCopyContent(boolean copyContent)
{
this.copyContent = copyContent;
@@ -131,10 +137,11 @@
buffer.append("names=").append(Arrays.toString(getNames()));
// Only add the repositoryNames if it differs from deploymentNames
if(getRepositoryNames() != getNames())
- buffer.append("repositoryNames=").append(Arrays.toString(getRepositoryNames()));
- buffer.append("phase=").append(phase);
- buffer.append("copyContent=").append(copyContent);
- buffer.append("description=").append(description);
+ buffer.append(", repositoryNames=").append(Arrays.toString(getRepositoryNames()));
+ buffer.append(", copyContent=").append(copyContent);
+ if(description != null)
+ buffer.append(", description=").append(description);
return buffer.toString();
}
+
}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentStatus.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,2 +1,3 @@
# resource bundle for the DeploymentManager
DeploymentManager.NoSuchProfileException=Failed to find profile for key: {0}
+DeploymentManager.NoMutableProfileException=Profile does not support deployment actions: {0}
\ No newline at end of file
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java (from rev 85384, trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java)
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java (rev 0)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,350 @@
+/*
+ * 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.management.upload.remoting;
+
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.management.deploy.DeploymentID;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.management.upload.SerializableDeploymentID;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.stream.StreamInvocationHandler;
+import org.jboss.system.server.profileservice.repository.DefaultProfileDeploymentFactory;
+import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A remoting StreamInvocationHandler installed as the profile service subsystem
+ * handler and used by the StreamingDeploymentTarget implementation.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractDeployHandler extends AOPRemotingInvocationHandler
+ implements StreamInvocationHandler
+{
+
+ /** The profile repository. */
+ protected ProfileRepository profileRepository;
+
+ /** The deployer. */
+ private MainDeployerAdapter deployer;
+
+ /** The deployment factory */
+ private static final DefaultProfileDeploymentFactory deploymentFactory = DefaultProfileDeploymentFactory.getInstance();
+
+ /** The logger. */
+ protected static final Logger log = Logger.getLogger(DeployHandler.class);
+
+ public ProfileRepository getProfileRepository()
+ {
+ return profileRepository;
+ }
+
+ public void setProfileRepository(ProfileRepository profileRepository)
+ {
+ this.profileRepository = profileRepository;
+ }
+
+ public MainDeployerAdapter getDeployer()
+ {
+ return deployer;
+ }
+
+ public void setDeployer(MainDeployerAdapter deployer)
+ {
+ this.deployer = deployer;
+ }
+
+ protected String[] getRepositoryNames(String[] names, DeploymentRepository deploymentRepository) throws Exception
+ {
+ if(names == null || names.length == 0)
+ return new String[0];
+
+ return deploymentRepository.getRepositoryNames(names);
+ }
+
+ public void addListener(InvokerCallbackHandler arg0)
+ {
+ }
+
+ public void removeListener(InvokerCallbackHandler arg0)
+ {
+ }
+
+ public void setInvoker(ServerInvoker arg0)
+ {
+ }
+
+ public void setMBeanServer(MBeanServer arg0)
+ {
+ }
+
+ /**
+ * Get the deployment repository for a given DeploymentID.
+ *
+ * @param dtID the DeploymentID
+ * @return the deployment repository
+ * @throws NoSuchProfileException if the deployment repository does not exist
+ */
+ protected DeploymentRepository getDeploymentRepository(DeploymentID dtID) throws Exception
+ {
+ ProfileKey key = dtID.getProfile();
+ if(key == null)
+ throw new IllegalStateException("No profile key attached to deploymentID "+ dtID);
+
+ return this.profileRepository.getProfileDeploymentRepository(key);
+ }
+
+ /**
+ * Handle a DeploymentManager invocation other than distribute
+ *
+ * @param request - the remoting invocation
+ * @return the result of the invocation
+ */
+ public Object invoke(InvocationRequest request) throws Throwable
+ {
+ Object parameter = request.getParameter();
+ Object returnValue = null;
+
+ if(parameter instanceof Invocation)
+ {
+ returnValue = super.invoke(request);
+ }
+ else
+ {
+ Map payload = request.getRequestPayload();
+ DeploymentID dtID = (DeploymentID) payload.get("DeploymentTargetID");
+ log.debug("invoke, payload: "+payload+", parameter: "+parameter);
+ try
+ {
+ if( parameter.equals("getRepositoryNames"))
+ {
+ String[] names = dtID.getNames();
+ DeploymentRepository deploymentRepository = getDeploymentRepository(dtID);
+ returnValue = getRepositoryNames(names, deploymentRepository);
+ }
+ else if( parameter.equals("distribute") )
+ {
+ returnValue = distribute(dtID);
+ }
+ else if( parameter.equals("start") )
+ {
+ start(dtID);
+ }
+ else if( parameter.equals("stop") )
+ {
+ stop(dtID);
+ }
+ else if( parameter.equals("remove"))
+ {
+ remove(dtID);
+ }
+ // Keep for backward compatibility
+ else if( parameter.equals("undeploy") )
+ {
+ remove(dtID);
+ }
+ }
+ catch(Exception e)
+ {
+ // Server side logging
+ log.info("Failed to complete command: ["+ parameter +"] for deployment: " + dtID, e);
+ throw e;
+ }
+
+ }
+ return returnValue;
+ }
+
+ protected abstract String[] distribute(DeploymentID dtID) throws Exception;
+
+ /**
+ * Handle a DeploymentManager distribute invocation for copyContent == true
+ *
+ * @see DeploymentManager#distribute(String, DeploymentPhase, java.net.URL)
+ * @param request - the remoting invocation
+ */
+ public Object handleStream(InputStream contentIS, InvocationRequest request) throws Throwable
+ {
+ // Get the deployment repository for this deploymentID
+ SerializableDeploymentID deploymentTarget = (SerializableDeploymentID) request.getParameter();
+ DeploymentRepository deploymentRepository = getDeploymentRepository(deploymentTarget);
+ // Start to handle stream
+ log.info("Handle stream, deploymentTarget: " + deploymentTarget);
+ deploymentTarget.setContentIS(contentIS);
+ String[] names = deploymentTarget.getNames();
+ // Add deployment content to the repository
+ String repositoryName = deploymentRepository.addDeploymentContent(names[0], contentIS);
+ log.info("End handle stream, repositoryName: " + repositoryName);
+ // Return the repository names
+ String[] rnames = {repositoryName};
+ deploymentTarget.setRepositoryNames(rnames);
+ return new InvocationResponse(repositoryName);
+ }
+
+ /**
+ * Start a deployment.
+ *
+ * @param dtID the deployment id
+ * @throws Exception for any error
+ */
+ protected void start(DeploymentID dtID) throws Exception
+ {
+ String[] names = dtID.getNames();
+ DeploymentRepository deploymentRepository = getDeploymentRepository(dtID);
+ log.info("Begin start, "+Arrays.asList(names));
+
+ for(String name : names)
+ {
+ // Schedule start for the deployment
+ scheduleStart(name, deploymentRepository);
+ }
+ // CheckComplete
+ processCheckComplete();
+ log.info("End start, "+Arrays.asList(names));
+ }
+
+ protected void scheduleStart(String name, DeploymentRepository deploymentRepository) throws Exception
+ {
+ VirtualFile vf = deploymentRepository.getDeploymentContent(name);
+ scheduleStart(vf, deploymentRepository);
+ }
+
+ protected void scheduleStart(VirtualFile vf, DeploymentRepository repository) throws Exception
+ {
+ // Create profile deployment
+ ProfileDeployment profileDeployment = createDeployment(vf);
+ // Add deployment to profile
+ repository.addDeployment(profileDeployment.getName(), profileDeployment);
+ // Add deployment
+ deployer.addDeployment(profileDeployment);
+ // Unlock the contents
+ repository.unlockDeploymentContent(profileDeployment.getName());
+
+ log.debug("Scheduling start for: "+ profileDeployment);
+ }
+
+ /**
+ * Stop the deployments.
+ *
+ * @param dtID the deployment id
+ * @throws Exception for any error
+ */
+ protected void stop(DeploymentID dtID) throws Exception
+ {
+ String[] names = dtID.getNames();
+ DeploymentRepository deploymentRepository = getDeploymentRepository(dtID);
+ log.info("Stop, "+Arrays.asList(names));
+
+ for(String name : names)
+ {
+ // Schedule stop
+ scheduleStop(name, deploymentRepository);
+ }
+ // CheckComplete
+ processCheckComplete();
+ }
+
+ protected void scheduleStop(String name, DeploymentRepository repository) throws Exception
+ {
+ // Obtain the deployment
+ ProfileDeployment vfsd = repository.getDeployment(name);
+ // Lock the content to make it unavailable to the deployment scanner
+ repository.lockDeploymentContent(vfsd.getName());
+ // Remove deployment
+ deployer.removeDeployment(vfsd);
+
+ log.debug("Scheduling stop for: "+ vfsd);
+ }
+
+ /**
+ * Remove a deployment from the deployment repository.
+ * This will delete the file for non-transient deployments.
+ *
+ * @param dtID the deployment id
+ * @throws Exception for any error
+ */
+ protected void remove(DeploymentID dtID) throws Exception
+ {
+ String[] names = dtID.getNames();
+ DeploymentRepository deploymentRepository = getDeploymentRepository(dtID);
+ log.info("Remove, "+Arrays.asList(names));
+
+ for(String name : names)
+ {
+ // Remove from repository
+ removeDeployment(name, deploymentRepository);
+ }
+ }
+
+ protected void removeDeployment(String name, DeploymentRepository repository) throws Exception
+ {
+ // Remove the deployment
+ ProfileDeployment deployment = repository.removeDeployment(name);
+ // Reset to an unlocked deployment
+ if(deployment != null)
+ repository.unlockDeploymentContent(deployment.getName());
+ log.debug("Removed: "+name);
+ }
+
+ protected void processCheckComplete() throws DeploymentException
+ {
+ // Process
+ deployer.process();
+ // And checkComplete
+ deployer.checkComplete();
+ }
+
+ /**
+ * Create a profile deployment.
+ *
+ * @param file the root file
+ * @return the deployment
+ */
+ protected ProfileDeployment createDeployment(VirtualFile file)
+ {
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+
+ return deploymentFactory.createProfileDeployment(file);
+ }
+
+}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -22,270 +22,183 @@
package org.jboss.profileservice.management.upload.remoting;
import java.io.IOException;
-import java.io.InputStream;
+import java.net.URISyntaxException;
import java.net.URL;
-import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
-import javax.management.MBeanServer;
+import java.util.concurrent.ConcurrentHashMap;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.InvocationResponse;
-import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
-import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.spi.management.deploy.DeploymentID;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.management.upload.SerializableDeploymentID;
+import org.jboss.profileservice.management.upload.AbstractTransientProfileManager;
import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.stream.StreamInvocationHandler;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
- * A remoting StreamInvocationHandler installed as the profile service subsystem
- * handler and used by the StreamingDeploymentTarget implementation.
+ * A profile service deploy subsystem handling transient deployments.
+ * The AbstractDeployHandler takes care of the profile deployments.
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
*/
-public class DeployHandler extends AOPRemotingInvocationHandler
- implements StreamInvocationHandler
+public class DeployHandler extends AbstractDeployHandler
{
- static Logger log = Logger.getLogger(DeployHandler.class);
- private DeploymentRepository deploymentRepository;
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
- private MainDeployer mainDeployer;
+ /** The logger. */
+ static final Logger log = Logger.getLogger(DeployHandler.class);
-
- public DeploymentRepository getDeploymentRepository()
+ /** The transient deployment repository. */
+ private DeploymentRepository transientDeploymentRepository;
+
+ /** The transient deployments map. */
+ Map<String, VirtualFile> transientDeployments = new ConcurrentHashMap<String, VirtualFile>();
+
+ public DeploymentRepository getTransientDeploymentRepository()
{
- return deploymentRepository;
+ return transientDeploymentRepository;
}
- public void setDeploymentRepository(DeploymentRepository deploymentRepository)
+
+ public void start() throws Exception
{
- log.debug("setDeploymentRepository, "+deploymentRepository);
- this.deploymentRepository = deploymentRepository;
+ // Set the transient profile repository
+ this.transientDeploymentRepository = profileRepository.getProfileDeploymentRepository(AbstractTransientProfileManager.TRANSIENT_PROFILE_KEY);
}
-
- public VFSDeploymentFactory getDeploymentFactory()
+ @Override
+ protected String[] getRepositoryNames(String[] names, DeploymentRepository deploymentRepository) throws Exception
{
- return deploymentFactory;
+ // get the transient repository names
+ List<String> repositoryNames = getTransientRepositoryNames(names);
+
+ // Add the results from the profile deployment repository
+ for(String name : super.getRepositoryNames(names, deploymentRepository))
+ repositoryNames.add(name);
+
+ return repositoryNames.toArray( new String[repositoryNames.size()] );
}
- public void setDeploymentFactory(VFSDeploymentFactory deploymentFactory)
+
+ protected List<String> getTransientRepositoryNames(String[] names)
{
- this.deploymentFactory = deploymentFactory;
- }
-
- public MainDeployer getMainDeployer()
- {
- return mainDeployer;
- }
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
- /**
- * Handle a DeploymentManager distribute invocation
- * @see DeploymentManager#distribute(String, DeploymentPhase, java.net.URL)
- * @param request - the remoting invocation
- */
- public Object handleStream(InputStream contentIS, InvocationRequest request) throws Throwable
- {
- SerializableDeploymentID deploymentTarget = (SerializableDeploymentID) request.getParameter();
- log.info("Handle stream, deploymentTarget: " + deploymentTarget);
- deploymentTarget.setContentIS(contentIS);
- DeploymentPhase phase = deploymentTarget.getPhase();
- String[] names = deploymentTarget.getNames();
- String repositoryName = deploymentRepository.addDeploymentContent(names[0], contentIS, phase);
- log.info("End handle stream, repositoryName: " + repositoryName);
- String[] rnames = {repositoryName};
- deploymentTarget.setRepositoryNames(rnames);
- return new InvocationResponse(repositoryName);
- }
-
- public void addListener(InvokerCallbackHandler arg0)
- {
- }
-
- /**
- * Handle a DeploymentManager invocation other than distribute
- * @param request - the remoting invocation
- * @return the result of the invocation
- */
- public Object invoke(InvocationRequest request) throws Throwable
- {
- Object parameter = request.getParameter();
- Object returnValue = null;
-
- if(parameter instanceof Invocation)
+ List<String> repositoryNames = new ArrayList<String>();
+ for(String name : names)
{
- returnValue = super.invoke(request);
- }
- else
- {
- Map payload = request.getRequestPayload();
- DeploymentID dtID = (DeploymentID) payload.get("DeploymentTargetID");
- log.debug("invoke, payload: "+payload+", parameter: "+parameter);
- if( parameter.equals("getRepositoryNames"))
+ if(this.transientDeployments.containsKey(name))
{
- String[] names = (String[]) payload.get("names");
- DeploymentPhase phase = (DeploymentPhase) payload.get("phase");
- returnValue = getRepositoryNames(names, phase);
+ repositoryNames.add(name);
+ continue;
}
- else if( parameter.equals("distribute") )
+ for(VirtualFile vf : this.transientDeployments.values())
{
- returnValue = distribute(dtID);
+ if(vf.getName().equals(name))
+ {
+ try
+ {
+ repositoryNames.add(vf.toURI().toString());
+ }
+ catch(Exception ignored) { }
+ }
}
- else if( parameter.equals("start") )
- {
- start(dtID);
- }
- else if( parameter.equals("stop") )
- {
- stop(dtID);
- }
- else if( parameter.equals("undeploy") )
- {
- undeploy(dtID);
- }
}
- return returnValue;
+ return repositoryNames;
}
- public void removeListener(InvokerCallbackHandler arg0)
+ /**
+ * Distribute a transient (copyContent == false) deployment.
+ *
+ * @param dtID the deployment id
+ * @return the name of the deployment
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ @Override
+ protected String[] distribute(DeploymentID dtID) throws IOException, URISyntaxException
{
- }
+ URL contentURL = dtID.getContentURL();
+ log.info("Begin distribute, content url: " + contentURL);
- public void setInvoker(ServerInvoker arg0)
- {
+ // Create the virtual file
+ VirtualFile vf = VFS.getRoot(contentURL);
+ String name = vf.toURI().toString();
+ this.transientDeployments.put(name, vf);
+
+ log.info("End distribute, " + name);
+ return new String[] { name };
}
- public void setMBeanServer(MBeanServer arg0)
+ @Override
+ protected void scheduleStart(String name, DeploymentRepository deploymentRepository) throws Exception
{
- }
-
- protected String[] getRepositoryNames(String[] names, DeploymentPhase phase)
- throws IOException
- {
- return deploymentRepository.getRepositoryNames(names, phase);
- }
-
- protected String[] distribute(DeploymentID dtID) throws Exception
- {
- URL contentURL = dtID.getContentURL();
- DeploymentPhase phase = dtID.getPhase();
- log.info("Begin distribute, content url: " + contentURL + ", phase: " + phase);
- // Prevent hot deployment scans from seeing in transition deployments
- deploymentRepository.acquireDeploymentContentLock();
- try
+ String deploymentName = resolveDeploymentName(name);
+ if(deploymentName != null)
{
- VirtualFile vf = VFS.getRoot(contentURL);
- VFSDeployment vfsd = createDeployment(vf);
- deploymentRepository.addDeployment(vfsd.getName(), vfsd, phase);
- mainDeployer.addDeployment(vfsd);
- mainDeployer.process();
- mainDeployer.checkComplete();
- String[] rnames = {vfsd.getName()};
- log.info("End distribute, " + contentURL);
- return rnames;
+ VirtualFile vf = this.transientDeployments.get(name);
+ super.scheduleStart(vf, this.transientDeploymentRepository);
}
- finally
+ else
{
- deploymentRepository.releaseDeploymentContentLock();
+ super.scheduleStart(name, deploymentRepository);
}
}
-
- protected void start(DeploymentID dtID) throws Exception
+
+ @Override
+ protected void scheduleStop(String name, DeploymentRepository deploymentRepository) throws Exception
{
- String[] names = dtID.getNames();
- DeploymentPhase phase = dtID.getPhase();
- log.info("Begin start, "+Arrays.asList(names) + ", phase: " + phase);
- // Prevent hot deployment scans from seeing in transition deployments
- deploymentRepository.acquireDeploymentContentLock();
- try
+ String deploymentName = resolveDeploymentName(name);
+ if(deploymentName != null)
{
- for(String name : names)
- {
- VirtualFile vf = deploymentRepository.getDeploymentContent(name, phase);
- VFSDeployment vfsd = createDeployment(vf);
- deploymentRepository.addDeployment(vfsd.getName(), vfsd, phase);
- deploymentRepository.unlockDeploymentContent(vf.getPathName(), phase);
- mainDeployer.addDeployment(vfsd);
- log.info("Scheduling start for: "+vfsd);
- }
- mainDeployer.process();
- mainDeployer.checkComplete();
+ super.scheduleStop(name, this.transientDeploymentRepository);
}
- finally
+ else
{
- deploymentRepository.releaseDeploymentContentLock();
+ super.scheduleStop(name, deploymentRepository);
}
- log.info("End start, "+Arrays.asList(names));
}
-
- protected void stop(DeploymentID dtID) throws Exception
+
+ @Override
+ protected void removeDeployment(String name, DeploymentRepository deploymentRepository) throws Exception
{
- String[] names = dtID.getNames();
- log.info("Stop, "+Arrays.asList(names));
- deploymentRepository.acquireDeploymentContentLock();
- try
+ String deploymentName = resolveDeploymentName(name);
+ if(deploymentName != null)
{
- for(String name : names)
- {
- // Obtain the
- VFSDeployment vfsd = deploymentRepository.getDeployment(name, dtID.getPhase());
- // Lock the content to make it unavailable to the deployment scanner
- String path = vfsd.getRoot().getPathName();
- deploymentRepository.lockDeploymentContent(path, dtID.getPhase());
- mainDeployer.removeDeployment(vfsd);
- log.info("Scheduling stop for: "+vfsd);
- }
- mainDeployer.process();
- mainDeployer.checkComplete();
+ this.transientDeployments.remove(deploymentName);
+ super.removeDeployment(deploymentName, this.transientDeploymentRepository);
}
- finally
+ else
{
- deploymentRepository.releaseDeploymentContentLock();
+ super.removeDeployment(name, deploymentRepository);
}
}
-
- protected void undeploy(DeploymentID dtID) throws Exception
+
+ /**
+ * Try to resolve the deployment name.
+ *
+ * @param name the name
+ * @return the deployment name, null if there was no matching name
+ * @throws IllegalStateException if multiple matching names were found
+ */
+ protected String resolveDeploymentName(String name)
{
- String[] names = dtID.getNames();
- log.info("Undeploy, "+Arrays.asList(names));
- deploymentRepository.acquireDeploymentContentLock();
- try
+ String deploymentName = null;
+ if(this.transientDeployments.containsKey(name))
{
- for(String name : names)
+ deploymentName = name;
+ }
+ // Try to resolve the name
+ if(deploymentName == null)
+ {
+ List<String> names = getTransientRepositoryNames(new String[]{ name });
+ if(names.size() == 1)
{
- deploymentRepository.removeDeployment(name, dtID.getPhase());
- log.info("Undeployed: "+name);
+ deploymentName = names.get(0);
}
+ else if(names.size() > 1)
+ {
+ throw new IllegalStateException("Multiple matching deployments found for name: "+ name + " available " + names);
+ }
}
- finally
- {
- deploymentRepository.releaseDeploymentContentLock();
- }
+ return deploymentName;
}
-
- /**
- * Create a deployment
- *
- * @param file the root file
- * @return the deployment
- */
- protected VFSDeployment createDeployment(VirtualFile file)
- {
- if (file == null)
- throw new IllegalArgumentException("Null file");
- return deploymentFactory.createVFSDeployment(file);
- }
+
}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -34,7 +34,6 @@
import org.jboss.deployers.spi.management.deploy.DeploymentID;
import org.jboss.deployers.spi.management.deploy.DeploymentTarget;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.profileservice.management.upload.SerializableDeploymentID;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
@@ -122,16 +121,13 @@
}
}
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws Exception
+ public String[] getRepositoryNames(DeploymentID dtID) throws Exception
{
Client client = getClient();
try
{
- log.debug("Begin getRepositoryNames: " + Arrays.asList(names));
- HashMap<Object, Object> args = new HashMap<Object, Object>();
- args.put("names", names);
- args.put("phase", phase);
- String[] rnames = (String[]) invoke(client, "getRepositoryNames", args);
+ log.debug("Begin getRepositoryNames: " + Arrays.asList(dtID.getNames()));
+ String[] rnames = (String[]) invoke(client, "getRepositoryNames", createArgs(dtID));
log.debug("End getRepositoryNames: " + Arrays.asList(rnames));
return rnames;
}
@@ -197,11 +193,14 @@
client.disconnect();
}
}
-
+
/**
- * Undeploy a given module
+ * Remove a given module.
+ *
+ * @param dtID the deployment id
+ * @throws Exception
*/
- public void undeploy(DeploymentID dtID) throws Exception
+ public void remove(DeploymentID dtID) throws Exception
{
Client client = getClient();
try
@@ -213,7 +212,7 @@
finally
{
client.disconnect();
- }
+ }
}
public String toString()
@@ -221,9 +220,9 @@
StringBuilder tmp = new StringBuilder();
tmp.append("name=");
tmp.append(name);
- tmp.append(",locator=");
+ tmp.append(", locator=");
tmp.append(locator);
- tmp.append(",subsystem=");
+ tmp.append(", subsystem=");
tmp.append(subsystem);
return tmp.toString();
}
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,8 +21,6 @@
*/
package org.jboss.profileservice.remoting;
-import java.security.Principal;
-
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
import org.jboss.deployers.spi.management.ManagementView;
@@ -39,7 +37,7 @@
* @see AOPRemotingInvocationHandler
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class ProfileServiceInvocationHandler extends AOPRemotingInvocationHandler
implements ServerInvocationHandler
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/ProxyFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/SecurityActions.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/SecurityActions.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/SecurityActions.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,8 +28,8 @@
import org.jboss.security.ISecurityManagement;
import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SecurityContextFactory;
-import org.jboss.security.SecurityContextAssociation;
/**
* Privileged Blocks
Property changes on: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/remoting/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -3,17 +3,23 @@
<!--
Hot deployment scanning
- $Id: profileservice-jboss-beans.xml 79345 2008-10-10 13:46:55Z emuckenhuber $
+ $Id$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- Hotdeployment of applications -->
<bean name="HDScanner"
class="org.jboss.system.server.profileservice.hotdeploy.HDScanner">
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ <property name="deployer"><inject bean="ProfileServiceDeployer"/></property>
<property name="controller"><inject bean="jboss.kernel:service=KernelController"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
<property name="scanPeriod">5000</property>
<property name="scanThreadName">HDScanner</property>
</bean>
+
+ <bean name="ToolsDeploymentScanner" class="org.jboss.system.tools.DeploymentScanner">
+ <property name="serverConfig"><inject bean="JBossServer" property="config"/></property>
+ <property name="profileService"><inject bean="ProfileService"/></property>
+ </bean>
+
</deployment>
Property changes on: branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -60,15 +60,28 @@
<uninstall bean="ConnectorMBean" method="removeInvocationHandler">
<parameter>DeploymentManager</parameter>
</uninstall>
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ <property name="deployer"><inject bean="ProfileServiceDeployer"/></property>
+ <property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
+ <depends>TransientDeploymentsProfileManager</depends>
</bean>
+ <bean name="TransientDeploymentsProfileManager"
+ class="org.jboss.profileservice.management.upload.AbstractTransientProfileManager">
+ <property name="profileService"><inject bean="ProfileService"/></property>
+ <property name="profileFactory"><inject bean="ProfileFactory" /></property>
+ </bean>
+
<bean name="RuntimeComponentDispatcher" class="org.jboss.profileservice.management.KernelBusRuntimeComponentDispatcher">
<constructor>
<parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter>
</constructor>
</bean>
-
+
+ <!-- The default applications profile key -->
+ <bean name="ApplicationsProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
+ <constructor><parameter><inject bean="BootstrapProfileFactory" property="applicationsName" /></parameter></constructor>
+ </bean>
+
<!--
The ManagementView plugin
-->
@@ -85,6 +98,9 @@
</uninstall>
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
+ <property name="attachmentStore"><inject bean="AttachmentStore" /></property>
+ <property name="deploymentManager"><inject bean="DeploymentManager"/></property>
+ <property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
<property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
<property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
<property name="bootstrapManagedDeployments"><inject bean="ProfileServiceBootstrap" property="bootstrapMDs"/></property>
@@ -108,9 +124,8 @@
<null/>
</parameter>
</uninstall>
- <property name="repositoryFactory"><inject bean="SerializableDeploymentRepositoryFactory" /></property>
+ <property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
- <property name="deployHandler"><inject bean="DeploymentInvocationHandler"/></property>
<property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
<property name="remotingSubsystem">DeploymentManager</property>
</bean>
Property changes on: branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Deleted: branches/Branch_5_x/profileservice/src/test/main/org/jboss/test/ps/SerializableDeploymentRepositoryUnitTest.java
===================================================================
--- branches/Branch_5_x/profileservice/src/test/main/org/jboss/test/ps/SerializableDeploymentRepositoryUnitTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/profileservice/src/test/main/org/jboss/test/ps/SerializableDeploymentRepositoryUnitTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,144 +0,0 @@
-/*
- * 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.test.ps;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Collection;
-
-import junit.framework.TestCase;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.profileservice.spi.DeploymentContentFlags;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.system.server.profileservice.repository.JavaSerializationAttachmentsSerializer;
-import org.jboss.system.server.profileservice.repository.SerializableDeploymentRepository;
-
-
-/**
- * Tests of the SerializableDeploymentRepository implementation details.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class SerializableDeploymentRepositoryUnitTest
- extends TestCase
-{
- private static Logger log = Logger.getLogger(SerializableDeploymentRepositoryUnitTest.class);
-
- public SerializableDeploymentRepositoryUnitTest(String name)
- {
- super(name);
- }
-
- /**
- * Test the behavior of the {@link DeploymentContentFlags#LOCKED} flag
- * @throws Exception
- */
- public void testDeploymentContentFlagsLocked()
- throws Exception
- {
- File root = getServerRoot();
- URI[] appURIs = {root.toURI().resolve("default/deploy")};
- ProfileKey key = new ProfileKey("default");
- log.info("Creating SDR with root: "+root+", appURI: "+appURIs[0]);
- SerializableDeploymentRepository sdr = new SerializableDeploymentRepository(root, appURIs, key);
- AttachmentsSerializer serializer = new JavaSerializationAttachmentsSerializer();
- sdr.setSerializer(serializer);
- sdr.load();
-
- log.info("DeploymentNames: "+sdr.getDeploymentNames());
- // Validate we can get the ROOT.war
- VFSDeployment rootWar = sdr.getDeployment("ROOT.war", DeploymentPhase.APPLICATION);
- assertNotNull("deploy/ROOT.war", rootWar);
-
- // Modify the ROOT.war
- URI warURI = rootWar.getRoot().toURI();
- File warFile = new File(warURI.getPath());
- warFile.setLastModified(System.currentTimeMillis());
- // Check its flags
- int flags = sdr.getDeploymentContentFlags("ROOT.war", DeploymentPhase.APPLICATION);
- assertEquals("ROOT.war flags", 0, flags);
-
- // Validate the ROOT.war is in the modified deployments
- Collection<ModificationInfo> mods = sdr.getModifiedDeployments();
- assertEquals("Collection<ModificationInfo> size is 1", 1, mods.size());
- ModificationInfo warMods = mods.iterator().next();
- assertEquals("ModificationInfo.status is MODIFIED", ModificationInfo.ModifyStatus.MODIFIED, warMods.getStatus());
- assertEquals("ModificationInfo.name is ROOT.war", "ROOT.war", warMods.getDeployment().getSimpleName());
-
- // lock the war
- flags = sdr.setDeploymentContentFlags("ROOT.war", DeploymentPhase.APPLICATION,
- DeploymentContentFlags.LOCKED);
- assertEquals(flags, DeploymentContentFlags.LOCKED);
- warFile.setLastModified(System.currentTimeMillis()+1000);
- // It should be modified, but not show up in the mods
- assertTrue("vfsfile ROOT.war hasBeenModified", rootWar.getRoot().hasBeenModified());
- mods = sdr.getModifiedDeployments();
- assertEquals("Collection<ModificationInfo> size is 0", 0, mods.size());
-
- // Validate that the locked flag overrides the modified flag
- assertFalse("vfsfile ROOT.war hasBeenModified", rootWar.getRoot().hasBeenModified());
- flags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.MODIFIED;
- sdr.setDeploymentContentFlags("ROOT.war", DeploymentPhase.APPLICATION, flags);
- mods = sdr.getModifiedDeployments();
- assertEquals("Collection<ModificationInfo> size is 0", 0, mods.size());
-
- // Validate that the modified flag allows it to show
- flags = sdr.clearDeploymentContentFlags("ROOT.war", DeploymentPhase.APPLICATION,
- DeploymentContentFlags.LOCKED);
- assertEquals("ROOT.war has MODIFIED flag", flags, DeploymentContentFlags.MODIFIED);
- mods = sdr.getModifiedDeployments();
- assertEquals("Collection<ModificationInfo> size is 1", 1, mods.size());
- warMods = mods.iterator().next();
- assertEquals("ModificationInfo.status is MODIFIED", ModificationInfo.ModifyStatus.MODIFIED, warMods.getStatus());
- assertEquals("ModificationInfo.name is ROOT.war", "ROOT.war", warMods.getDeployment().getSimpleName());
- }
-
- /**
- * Get the file for the jboss server directory. Relies on one
- * of the following variables to be set:
- * JBOSS_HOME env variable
- * jboss.home system property
- *
- * @return
- * @throws IOException
- */
- protected File getServerRoot() throws IOException
- {
- String home = System.getenv("JBOSS_HOME");
- if(home == null)
- {
- home = System.getProperty("jboss.home");
- }
- File defaultDir = new File(home, "server");
- if(defaultDir.exists() == false)
- throw new FileNotFoundException(defaultDir.getAbsolutePath()+", check the JBOSS_HOME env variable or jboss.home system property");
- return defaultDir;
- }
-}
Property changes on: branches/Branch_5_x/profileservice/src/test/resources/log4j.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile-repository.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile-repository.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile-repository.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- The profile service
- $Id$
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <classloader><inject bean="profile-classloader:0.0.0"/></classloader>
-
- <classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
- <root>${jboss.lib.url}jboss-profileservice-spi.jar</root>
- </classloader>
-
- <bean name="StructureModCache" class="org.jboss.deployers.vfs.spi.structure.modified.DefaultStructureCache">
- <destroy method="flush"/>
- </bean>
-
- <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
- <constructor>
- <parameter><inject bean="MainDeployer" /></parameter>
- </constructor>
- <property name="cache"><inject bean="StructureModCache" /></property>
- <property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
- </bean>
-
- <!--
- The file repository profile service which provides full
- support ProfileService spi.
- -->
- <bean name="ProfileService" class="org.jboss.system.server.profileservice.repository.ProfileServiceImpl">
- <constructor>
- <parameter>${jboss.server.name}</parameter>
- </constructor>
- <property name="profileRepository"><inject bean="FileProfileRepository"/></property>
- </bean>
- <bean name="FileProfileRepository" class="org.jboss.system.server.profileservice.repository.FileProfileRepository">
- <property name="storeRoot">${jboss.server.base.dir}</property>
- <property name="repositoryFactory"><inject bean="SerializableDeploymentRepositoryFactory"/></property>
- </bean>
- <bean name="SerializableDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.SerializableDeploymentRepositoryFactory">
- <property name="storeRoot">${jboss.server.base.dir}</property>
- <property name="attachmentsRoot">${jboss.server.data.dir}/attachments</property>
- <property name="applicationURIs">
- <array elementClass="java.net.URI">
- <value>${jboss.server.home.url}deploy</value>
- </array>
- </property>
- <property name="serializer"><inject bean="AttachmentsSerializer"/></property>
- <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
- <property name="checker"><inject bean="StructureModificationChecker"/></property>
- <depends>ProfileServicePersistenceDeployer</depends>
- </bean>
- <bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer" />
-
- <!-- The Bootstrap implementation that loads the Profile from the ProfileService -->
- <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="mof"><inject bean="ManagedObjectFactory"/></property>
- <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
- </bean>
-
- <bean name="ProfileServicePersistenceDeployer" class="org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer" />
-
- <!-- A filter for excluding files from the scanner -->
- <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
- <!-- Files starting with theses strings are ignored -->
- <property name="prefixes">#,%,\,,.,_$</property>
- <!-- Files ending with theses strings are ignored -->
- <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
- <!-- Files matching with theses strings are ignored -->
- <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
- </bean>
-
- <bean name="SerializableDeploymentRepositoryAdapter" class="org.jboss.system.tools.SerializableDeploymentRepositoryAdapter">
- <constructor>
- <parameter><inject bean="ProfileService" property="deploymentRepository"/></parameter>
- </constructor>
- </bean>
-
- <bean name="ToolsDeploymentScanner" class="org.jboss.system.tools.DeploymentScanner">
- <constructor>
- <parameter><inject bean="SerializableDeploymentRepositoryAdapter"/></parameter>
- </constructor>
- <property name="serverConfig"><inject bean="JBossServer" property="config"/></property>
- </bean>
-
-</deployment>
Modified: branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -2,93 +2,114 @@
<!--
The profile service
- $Id:$
+ $Id$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <classloader><inject bean="profile-classloader:0.0.0"/></classloader>
+ <classloader><inject bean="profile-classloader:0.0.0" /></classloader>
- <classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
- <root>${jboss.lib.url}jboss-profileservice-spi.jar</root>
- </classloader>
+ <classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
+ <root>${jboss.lib.url}jboss-profileservice-spi.jar</root>
+ </classloader>
- <bean name="StructureModCache" class="org.jboss.deployers.vfs.spi.structure.modified.DefaultStructureCache">
- <destroy method="flush"/>
- </bean>
+ <!--
+ The profile configuration
+ This contains required properties:
+ The uri to jboss-service.xml.
+ The uri to the deployers folder.
+ A list of uris to deploy folders. -->
+ <bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
+ <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
+ <property name="deployersURI">${jboss.server.home.url}deployers</property>
+ <property name="applicationURIs">
+ <list elementClass="java.net.URI">
+ <value>${jboss.server.home.url}deploy</value>
+ </list>
+ </property>
+ <property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
+ <property name="profileFactory"><inject bean="ProfileFactory" /></property>
+ </bean>
+
+ <!-- The default profile key -->
+ <bean name="DefaultProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
+ <constructor><parameter>${jboss.server.name}</parameter></constructor>
+ </bean>
- <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
- <constructor>
- <parameter><inject bean="MainDeployer" /></parameter>
- </constructor>
- <property name="cache"><inject bean="StructureModCache" /></property>
- <property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
- </bean>
+ <!-- The ProfileService -->
+ <bean name="ProfileService" class="org.jboss.system.server.profileservice.repository.AbstractProfileService">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
+ <property name="deployer"><inject bean="ProfileServiceDeployer" /></property>
+ <property name="defaultProfile"><inject bean="DefaultProfileKey" /></property>
+ </bean>
- <!-- The basic profile service which relies on vfs scanners
- to determine the profile deployments. This version does not
- support the full ProfileService spi.
- -->
- <bean name="ProfileService" class="org.jboss.system.server.profileservice.basic.MetaDataAwareProfileService">
- <constructor>
- <parameter>${jboss.server.name}</parameter>
- </constructor>
- <property name="profileRoot">${jboss.server.home.dir}</property>
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
- <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
- <property name="checker"><inject bean="StructureModificationChecker"/></property>
- </bean>
+ <!-- The Bootstrap implementation that loads the Profile from the ProfileService -->
+ <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="profileKey"><inject bean="DefaultProfileKey" /></property>
+ <property name="mainDeployer"><inject bean="MainDeployer" /></property>
+ <property name="profileService"><inject bean="ProfileService" /></property>
+ <property name="mof"><inject bean="ManagedObjectFactory" /></property>
+ <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator" /></property>
+ <property name="bootstrapProfileFactory"><inject bean="BootstrapProfileFactory" /></property>
+ </bean>
- <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="mof"><inject bean="ManagedObjectFactory"/></property>
- <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
- </bean>
+ <!-- The profile factory -->
+ <bean name="ProfileFactory" class="org.jboss.system.server.profileservice.repository.AbstractProfileFactory">
+ <property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
+ </bean>
- <!-- A filter for excluding files from the scanner -->
- <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
- <!-- Files starting with theses strings are ignored -->
- <property name="prefixes">#,%,\,,.,_$</property>
- <!-- Files ending with theses strings are ignored -->
- <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
- <!-- Files matching with theses strings are ignored -->
- <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
- </bean>
+ <!-- The profile repository factory -->
+ <bean name="ProfileRepositoryFactory" class="org.jboss.system.server.profileservice.repository.TypedProfileRepository">
+ <!-- Accept any DeploymentRepositoryFactory -->
+ <incallback method="addRepositoryFactory" />
+ <uncallback method="removeRepositoryFactory" />
+ </bean>
- <!-- Scan for bootstraps -->
- <bean name="VFSBootstrapScanner" class="org.jboss.system.server.profileservice.VFSBootstrapScannerImpl">
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="filterInstance"><inject bean="DeploymentFilter"/></property>
- <property name="URIList">
- <list elementClass="java.net.URI">
- <!-- Legacy static conf/jboss-service.xml -->
- <value>${jboss.server.home.url}conf/jboss-service.xml</value>
- </list>
- </property>
- </bean>
+ <!-- The structure modification cache and checker -->
- <!-- Scan for deployers -->
- <bean name="VFSDeployerScanner" class="org.jboss.system.server.profileservice.VFSDeployerScannerImpl">
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="filterInstance"><inject bean="DeploymentFilter"/></property>
- <property name="URIList">
- <list elementClass="java.net.URI">
- <!-- Directory for deployers -->
- <value>${jboss.server.home.url}deployers/</value>
- </list>
- </property>
- </bean>
+ <bean name="StructureModCache" class="org.jboss.deployers.vfs.spi.structure.modified.DefaultStructureCache">
+ <destroy method="flush"/>
+ </bean>
- <!-- Scan for applications -->
- <bean name="VFSDeploymentScanner" class="org.jboss.system.server.profileservice.VFSDeploymentScannerImpl">
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="filterInstance"><inject bean="DeploymentFilter"/></property>
- <property name="URIList">
- <list elementClass="java.net.URI">
- <!-- Standard hot deployment directory -->
- <value>${jboss.server.home.url}deploy/</value>
- </list>
- </property>
- </bean>
+ <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
+ <constructor>
+ <parameter><inject bean="MainDeployer" /></parameter>
+ </constructor>
+ <property name="cache"><inject bean="StructureModCache" /></property>
+ <property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
+ </bean>
-</deployment>
+ <!-- The default deployment repository factory -->
+ <bean name="DefaultDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.DefaultDeploymentRepositoryFactory">
+ <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
+ <property name="checker"><inject bean="StructureModificationChecker" /></property>
+ </bean>
+
+ <!-- The attachment store -->
+ <bean name="AttachmentStore" class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore">
+ <constructor><parameter><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
+ <property name="mainDeployer"><inject bean="MainDeployer" /></property>
+ <property name="serializer"><inject bean="AttachmentsSerializer" /></property>
+ </bean>
+
+ <bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer">
+ <constructor><parameter><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
+ </bean>
+
+ <bean name="ProfileServiceDeployer" class="org.jboss.system.server.profileservice.repository.MainDeployerAdapter">
+ <property name="mainDeployer"><inject bean="MainDeployer" /></property>
+ <property name="attachmentStore"><inject bean="AttachmentStore" /></property>
+ </bean>
+
+ <bean name="ProfileServicePersistenceDeployer" class="org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer" />
+
+ <!-- A filter for excluding files from the scanner -->
+ <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
+ <!-- Files starting with theses strings are ignored -->
+ <property name="prefixes">#,%,\,,.,_$</property>
+ <!-- Files ending with theses strings are ignored -->
+ <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
+ <!-- Files matching with theses strings are ignored -->
+ <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Deleted: branches/Branch_5_x/server/src/etc/conf/default/bootstrap-norepo.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap-norepo.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap-norepo.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- The list of URLs for mc beans to load during bootstrap.
- $Id$
--->
-<bootstrap xmlns="urn:jboss:bootstrap:1.0">
-
- <url>bootstrap/vfs.xml</url>
- <url>bootstrap/classloader.xml</url>
- <url>bootstrap/aop.xml</url>
- <url>bootstrap/jmx.xml</url>
- <url>bootstrap/deployers.xml</url>
- <url>bootstrap/bindings.xml</url>
- <url>bootstrap/profile.xml</url>
-
-</bootstrap>
Modified: branches/Branch_5_x/server/src/etc/conf/default/bootstrap.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -12,6 +12,6 @@
<url>bootstrap/jmx.xml</url>
<url>bootstrap/deployers.xml</url>
<url>bootstrap/bindings.xml</url>
- <url>bootstrap/profile-repository.xml</url>
+ <url>bootstrap/profile.xml</url>
</bootstrap>
Modified: branches/Branch_5_x/system/.classpath
===================================================================
--- branches/Branch_5_x/system/.classpath 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/.classpath 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,13 +28,16 @@
<classpathentry combineaccessrules="false" kind="src" path="/main"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-core.jar" sourcepath="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-core-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/profileservice-spi/lib/jboss-profileservice-spi.jar" sourcepath="/thirdparty/jboss/profileservice-spi/lib/jboss-profileservice-spi-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/jboss-bootstrap/lib/jboss-bootstrap.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-client.jar" sourcepath="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-client-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-jaxb/lib/jaxb-impl.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-jaf/lib/activation.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-mdr/lib/jboss-mdr.jar" sourcepath="/thirdparty/jboss/jboss-mdr/lib/jboss-mdr-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar" sourcepath="/thirdparty/jboss/common-core/lib/jboss-common-core-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jboss-reflect/lib/jboss-reflect.jar" sourcepath="/thirdparty/jboss/jboss-reflect/lib/jboss-reflect-sources.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-kernel.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-kernel-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-sources.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar" sourcepath="/thirdparty/jboss/common-core/lib/jboss-common-core-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jboss-bootstrap/lib/jboss-bootstrap.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Property changes on: branches/Branch_5_x/system/.classpath
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/.project
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/build-test.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/component-info.xml
===================================================================
--- branches/Branch_5_x/system/component-info.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/component-info.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,39 +0,0 @@
-<project name="system-component-info">
- <!-- ============================================================ -->
- <!-- System -->
- <!-- ============================================================ -->
-
- <component id="system"
- module="jboss-system"
- version="5.0-SNAPSHOT"
- specTitle="JBoss"
- specVersion="5.0.0"
- specVendor="JBoss (http://www.jboss.org)"
- implTitle="JBoss"
- implURL="http://www.jboss.org"
- implVersion="5.0.0"
- implVendor="JBoss.org"
-
-
- >
- <artifact id="jboss-system.jar"/>
- <artifact id="jboss-system-client.jar"/>
- <artifact id="jboss-boot.jar"/>
- <artifact id="run.jar"/>
- <artifact id="log4j-boot.jar"/>
- <artifact id="testsuite-support.jar"/>
- <artifact id="jboss-service_3_2.dtd" release="docs/dtd"/>
- <artifact id="jboss-service_4_0.dtd" release="docs/dtd"/>
- <artifact id="jboss-subscription.dtd" release="docs/dtd"/>
- <export>
- <include input="jboss-system.jar"/>
- </export>
-
- <artifact id="run.sh"/>
- <artifact id="run.bat"/>
- <artifact id="run.conf"/>
- <artifact id="classpath.sh"/>
-
- </component>
-
-</project>
\ No newline at end of file
Modified: branches/Branch_5_x/system/pom.xml
===================================================================
--- branches/Branch_5_x/system/pom.xml 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/pom.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -40,6 +40,86 @@
<descriptorSourceDirectory>src/assembly</descriptorSourceDirectory>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-output</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+
+ <tstamp>
+ <format property="build.number" pattern="yyyyMMddHHmm"/>
+ <format property="YEAR" pattern="yyyy"/>
+ </tstamp>
+ <property name="build.id" value="${build.number}"/>
+
+ <property file="../tools/etc/buildmagic/version.properties"/>
+
+ <filter filtersfile="../tools/etc/buildmagic/version.properties"/>
+ <filter token="version.cvstag" value="JBoss_${version.major}_${version.minor}_${version.revision}_${version.tag}"/>
+ <filter token="build.number" value="${build.number}"/>
+ <filter token="build.id" value="${build.id}"/>
+ <filter token="DSTAMP" value="${DSTAMP}"/>
+ <filter token="TSTAMP" value="${TSTAMP}"/>
+ <filter token="TODAY" value="${TODAY}"/>
+
+ <filter token="java.version" value="${java.version}"/>
+ <filter token="java.vendor" value="${java.vendor}"/>
+ <filter token="java.vm.specification.version" value="${java.vm.specification.version}"/>
+ <filter token="java.vm.version" value="${java.vm.version}"/>
+ <filter token="java.vm.name" value="${java.vm.name}"/>
+ <filter token="java.vm.info" value="${java.vm.info}"/>
+ <filter token="java.specification.version" value="${java.specification.version}"/>
+ <filter token="java.class.version" value="${java.class.version}"/>
+
+ <filter token="os.name" value="${os.name}"/>
+ <filter token="os.arch" value="${os.arch}"/>
+ <filter token="os.version" value="${os.version}"/>
+
+ <mkdir dir="output/resources"/>
+ <copy todir="output/resources" filtering="yes">
+ <fileset dir="src/resources">
+ <include name="**"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="output/lib"/>
+ <copy file="target/${artifactId}-${version}.jar"
+ tofile="output/lib/jboss-system.jar"/>
+ <copy file="target/${artifactId}-${version}-client.jar"
+ tofile="output/lib/jboss-system-client.jar"/>
+
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>clean-output</id>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <phase>clean</phase>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>output</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
Property changes on: branches/Branch_5_x/system/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,6 +31,7 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectClass;
@@ -154,8 +155,11 @@
// First look to the mapped name
String name = property.getMappedName();
if (name == null)
- property.getName();
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ name = property.getName();
+ PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+ if(propertyInfo == null)
+ propertyInfo = beanInfo.getProperty(name);
+
Object bean = locateBean(attachment.getName());
Object value = null;
MetaValue mvalue = null;
@@ -193,16 +197,19 @@
// First look to the mapped name
String name = property.getMappedName();
if (name == null)
- property.getName();
+ name = property.getName();
try
{
ClassLoader loader = getClassLoader(attachment);
// Set the mbean class loader as the TCL
SecurityActions.setContextClassLoader(loader);
- PropertyInfo propertyInfo = beanInfo.getProperty(name);
+ PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
if(propertyInfo == null)
+ propertyInfo = beanInfo.getProperty(name);
+ if(propertyInfo == null)
throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
+
if(propertyInfo.isWritable() == false)
{
if(log.isTraceEnabled())
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/DefaultManagedObjectCreator.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,7 +28,7 @@
* Package privileged actions
*
* @author Scott.Stark at jboss.org
- * @version $Revision: 71039 $
+ * @version $Revision$
*/
class SecurityActions
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/TypedManagedDeploymentCreator.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/scanner/VFSDeploymentScannerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/deployers/LegacyDeploymentContextComparator.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -30,7 +30,7 @@
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class TempBeanMetaDataDeployer extends BeanMetaDataDeployer
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/deployers/TempBeanMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/ServerInfo.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/ServerInfo.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/ServerInfo.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -128,6 +128,10 @@
log.info("Java version: " +
System.getProperty("java.version") + "," +
System.getProperty("java.vendor"));
+
+ log.info("Java Runtime: " +
+ System.getProperty("java.runtime.name") + " (build " +
+ System.getProperty("java.runtime.version") + ")");
log.info("Java Runtime: " +
System.getProperty("java.runtime.name") + " (build " +
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.basic;
-
-import java.io.IOException;
-
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Profile monitoring metadata changes.
- *
- * We need to cache files's last modifed timestamps,
- * since file.getChildren re-caches handlers,
- * hence hasBeenModified is useless.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class MetaDataAwareProfile extends ProfileImpl
-{
- private MainDeployerStructure mainDeployer;
- private VirtualFileFilter filter;
- private StructureModificationChecker checker;
-
- public MetaDataAwareProfile(String profileRoot, ProfileKey key)
- {
- super(profileRoot, key);
- }
-
- /**
- * Set main deployer structure.
- *
- * @param mainDeployer the main deployer structure
- */
- @Deprecated
- public void setMainDeployer(MainDeployerStructure mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Set the metadata resources filter.
- *
- * @param filter the metadata resources filter
- */
- @Deprecated
- public void setFilter(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- protected StructureModificationChecker getChecker()
- {
- if (checker == null)
- throw new IllegalArgumentException("Null checker");
-
- return checker;
- }
-
- /**
- * Set the structure modification checker.
- *
- * @param checker the structure modification checker
- */
- public void setChecker(StructureModificationChecker checker)
- {
- this.checker = checker;
- }
-
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- return getChecker().hasStructureBeenModified(root);
- }
-
- /**
- * Has vfs deployment context been modified.
- *
- * @param deploymentContext the vfs deployment context
- * @return true if modified
- * @throws IOException for any error
- */
- @Deprecated
- protected boolean hasBeenModified(VFSDeploymentContext deploymentContext) throws IOException
- {
- return getChecker().hasStructureBeenModified(deploymentContext);
- }
-
- // expecting all deployments from same context root
- // so path name should group them per deployment unit
- protected void postRemove(VFSDeployment deployment) throws Exception
- {
- getChecker().removeStructureRoot(deployment.getRoot());
- }
-
- /**
- * Get deployment context.
- *
- * @param name the deployment context name
- * @return vfs deployment context or null if doesn't exist or not vfs based
- */
- @SuppressWarnings("deprecation")
- @Deprecated
- protected VFSDeploymentContext getDeploymentContext(String name)
- {
- if (mainDeployer == null)
- throw new IllegalArgumentException("Null main deployer");
-
- DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
- if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
- return null;
-
- return (VFSDeploymentContext)deploymentContext;
- }
-}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,532 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.basic;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
-import org.jboss.system.server.profileservice.VFSScanner;
-import org.jboss.util.JBossObject;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * A basic profile implementation that uses in memory store for the applications.
- * This has to be populated by some other components.
- *
- * @see VFSScanner and subclasses for an example usage.
- *
- * @author Scott.Stark at jboss.org
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class ProfileImpl extends JBossObject implements Profile
-{
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
-
- private ProfileKey key;
- /** The directory containing the profiles */
- private File profileRoot;
- private LinkedHashMap<String, VFSDeployment> bootstraps = new LinkedHashMap<String, VFSDeployment>();
- private LinkedHashMap<String, VFSDeployment> applications = new LinkedHashMap<String, VFSDeployment>();
- private LinkedHashMap<String, VFSDeployment> deployers = new LinkedHashMap<String, VFSDeployment>();
- /** Is hot deployment checking enabled */
- private volatile boolean hotdeployEnabled;
- /** The last time the profile was modified */
- private long lastModified;
- /** The deployment filter */
- private VirtualFileFilter deploymentFilter;
-
- public ProfileImpl(String profileRoot, ProfileKey key)
- {
- this.key = key;
- this.profileRoot = new File(profileRoot);
- log.info("Using profile root:"+this.profileRoot.getAbsolutePath());
- }
-
- public String getName()
- {
- return key.getName();
- }
-
- public ProfileKey getKey()
- {
- return key;
- }
-
- public String getVersion()
- {
- return null;
- }
-
-
- public long getLastModified()
- {
- return this.lastModified;
- }
-
- public VirtualFileFilter getDeploymentFilter()
- {
- return deploymentFilter;
- }
-
- public void setDeploymentFilter(VirtualFileFilter deploymentFilter)
- {
- this.deploymentFilter = deploymentFilter;
- }
-
- /**
- * Get the names of the applications in the profile
- * @return names of applications
- */
- public Set<String> getDeploymentNames()
- {
- HashSet<String> names = new HashSet<String>();
- names.addAll(this.bootstraps.keySet());
- names.addAll(this.deployers.keySet());
- names.addAll(this.applications.keySet());
- return names;
- }
-
- public VirtualFile getRootFile(DeploymentPhase phase)
- throws Exception
- {
- VirtualFile root = VFS.getRoot(profileRoot.toURI());
- switch( phase )
- {
- case BOOTSTRAP:
- root = root.findChild("conf");
- break;
- case DEPLOYER:
- root = root.findChild("deployers");
- break;
- case APPLICATION:
- root = root.findChild("deploy");
- break;
- }
- return root;
- }
-
- public void addDeployment(VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.addBootstrap(d);
- break;
- case DEPLOYER:
- this.addDeployer(d);
- break;
- case APPLICATION:
- this.addApplication(d);
- break;
- }
- this.lastModified = System.currentTimeMillis();
- }
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- ManagedComponent comp)
- throws Exception
- {
-
- }
-
- /**
- * Find a deployment context from the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return the deployment or null if not found
- */
- private VFSDeployment findDeployment(String name, DeploymentPhase phase)
- {
- VFSDeployment d = null;
- if( phase == null )
- {
- // Try all phases
- d = this.getBootstrap(name);
- if( d == null )
- d = this.getDeployer(name);
- if( d == null )
- d = this.getApplication(name);
- }
- else
- {
- switch( phase )
- {
- case BOOTSTRAP:
- d = this.getBootstrap(name);
- break;
- case DEPLOYER:
- d = this.getDeployer(name);
- break;
- case APPLICATION:
- d = this.getApplication(name);
- break;
- }
- }
- return d;
- }
-
- /**
- * Get a deployment context from the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return the deployment or NoSuchDeploymentException
- * @throws NoSuchDeploymentException if the deployment can't be found
- */
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws NoSuchDeploymentException
- {
- VFSDeployment d = findDeployment(name, phase);
- // Make sure we don't return null
- if( d == null )
- throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- return d;
- }
-
- /**
- * Checks whether a deployment context is available in the basic profile service.
- *
- * @param name the name of the deployment
- * @param phase optionally a deployment phase, if null search all
- * @return true if the deployment is found or false otherwise
- */
- public boolean hasDeployment(String name, DeploymentPhase phase)
- {
- return findDeployment(name, phase) != null;
- }
-
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- HashSet<String> names = new HashSet<String>();
- switch( phase )
- {
- case BOOTSTRAP:
- names.addAll(this.bootstraps.keySet());
- break;
- case DEPLOYER:
- names.addAll(this.deployers.keySet());
- break;
- case APPLICATION:
- names.addAll(this.applications.keySet());
- break;
- }
- return names;
- }
-
- public Set<String> getDeploymentNamesForType(String type)
- {
- throw new UnsupportedOperationException("getDeploymentNamesForType");
- /** TODO Deployment.getTypes()
- HashSet<String> names = new HashSet<String>();
- for(VFSDeployment d : bootstraps.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- for(VFSDeployment d : deployers.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- for(VFSDeployment d : applications.values())
- {
- if( d.getTypes().contains(type) )
- names.add(d.getName());
- }
- return names;
- */
- }
-
- public Collection<VFSDeployment> getDeployments()
- {
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- deployments.addAll(this.bootstraps.values());
- deployments.addAll(this.deployers.values());
- deployments.addAll(this.applications.values());
- return Collections.unmodifiableCollection(deployments);
- }
-
- /**
- * Go through the applications looking for modifications. This also
- * picks the last application parent directory as the basis for
- * scanning for new deployments.
- * TODO: to handle multiple application/hotdeployment directories a
- * set of parent dirs needs to be built.
- */
- public Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- if( hotdeployEnabled == false )
- return Collections.emptyList();
-
- ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
- Collection<VFSDeployment> apps = applications.values();
- boolean trace = log.isTraceEnabled();
- if( trace )
- log.trace("Checking applications for modifications");
- VirtualFile applicationDir = null;
- if( apps != null )
- {
- Iterator<VFSDeployment> iter = apps.iterator();
- while( iter.hasNext() )
- {
- VFSDeployment d = iter.next();
- VirtualFile root = d.getRoot();
- // Save the containing parent dir to scan for new deployments
- VirtualFile parent = root.getParent();
- if(parent != null && (applicationDir == null || parent.getPathName().compareTo(applicationDir.getPathName()) < 0 ))
- applicationDir = parent;
- // Check for removal
- if( root.exists() == false )
- {
- long rootLastModified = root.getLastModified();
- ModificationInfo info = new ModificationInfo(d, rootLastModified, ModifyStatus.REMOVED);
- modified.add(info);
- iter.remove();
- if( trace )
- log.trace(root.getPathName() + " was removed");
- postRemove(d);
- }
- // Check for modification
- else if(hasBeenModified(root))
- {
- long rootLastModified = root.getLastModified();
- if( trace )
- log.trace(root.getPathName() + " was modified: " + rootLastModified);
- // Need to create a duplicate ctx
- VFSDeployment deployment2 = deploymentFactory.createVFSDeployment(root);
- ModificationInfo info = new ModificationInfo(deployment2, rootLastModified, ModifyStatus.MODIFIED);
- modified.add(info);
- }
- // TODO: this could check metadata files modifications as well
- }
-
- // If there are no apps, use the default appplication root
- if( applicationDir == null )
- applicationDir = getRootFile(DeploymentPhase.APPLICATION);
- // Now check for additions
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addDeployments(added, applicationDir);
- for(VirtualFile vf : added)
- {
- VFSDeployment d = deploymentFactory.createVFSDeployment(vf);
- ModificationInfo info = new ModificationInfo(d, vf.getLastModified(), ModifyStatus.ADDED);
- modified.add(info);
- applications.put(d.getName(), d);
- }
- }
- if(modified.size() > 0)
- lastModified = System.currentTimeMillis();
- return modified;
- }
-
- /**
- * Has the root been modified.
- *
- * @param root the virtual file root
- * @return true if modifed
- * @throws Exception for any error
- */
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- return root.hasBeenModified();
- }
-
- /**
- * Apply post remove operation.
- *
- * @param deployment the vfs deployment
- * @throws Exception for any error
- */
- protected void postRemove(VFSDeployment deployment) throws Exception
- {
- // noop here
- }
-
- /**
- * Noop as basic profile does not support hot deployment currently
- */
- public void enableModifiedDeploymentChecks(boolean flag)
- {
- this.hotdeployEnabled = flag;
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- {
- Collection<VFSDeployment> deployments = null;
- switch( phase )
- {
- case BOOTSTRAP:
- deployments = this.getBootstraps();
- break;
- case DEPLOYER:
- deployments = this.getDeployers();
- break;
- case APPLICATION:
- deployments = this.getApplications();
- break;
- }
- return deployments;
- }
-
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- VFSDeployment d = null;
- switch( phase )
- {
- case BOOTSTRAP:
- d = this.removeBootstrap(name);
- break;
- case DEPLOYER:
- d = this.removeDeployer(name);
- break;
- case APPLICATION:
- d = this.removeApplication(name);
- break;
- }
- return d;
- }
-
- public Map<String, Object> getConfig()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected void addBootstrap(VFSDeployment d)
- {
- bootstraps.put(d.getName(), d);
- }
-
- protected VFSDeployment removeBootstrap(String name)
- {
- return bootstraps.remove(name);
- }
-
- protected VFSDeployment getBootstrap(String name)
- {
- return bootstraps.get(name);
- }
-
- protected Collection<VFSDeployment> getBootstraps()
- {
- return Collections.unmodifiableCollection(bootstraps.values());
- }
-
- protected void addDeployer(VFSDeployment d)
- {
- deployers.put(d.getName(), d);
- }
-
- protected VFSDeployment removeDeployer(String name)
- {
- return deployers.remove(name);
- }
-
- protected VFSDeployment getDeployer(String name)
- {
- return deployers.get(name);
- }
-
- protected Collection<VFSDeployment> getDeployers()
- {
- return Collections.unmodifiableCollection(deployers.values());
- }
-
- protected void addApplication(VFSDeployment d)
- {
- applications.put(d.getName(), d);
- }
-
- protected VFSDeployment removeApplication(String name)
- {
- return applications.remove(name);
- }
-
- protected VFSDeployment getApplication(String name)
- {
- return applications.get(name);
- }
-
- protected Collection<VFSDeployment> getApplications()
- {
- return Collections.unmodifiableCollection(applications.values());
- }
-
- private void addDeployments(List<VirtualFile> list, VirtualFile root)
- throws Exception
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- // Excluding files from scanning
- if(! this.deploymentFilter.accepts(component))
- {
- log.trace("ignoring "+ component);
- continue;
- }
-
- String key = component.toURI().toString();
- if( applications.containsKey(key) == true )
- continue;
-
- if (component.isLeaf())
- {
- list.add(component);
- }
- else if (component.getName().indexOf('.') == -1)
- {
- // recurse if not '.' in name and recursive search is enabled
- addDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
-}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractImmutableProfile.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractImmutableProfile.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractImmutableProfile.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractImmutableProfile.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository;
+
+import java.net.URI;
+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.system.server.profileservice.repository.AbstractVFSProfileSource;
+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;
+
+ /** The profile dependencies */
+ private List<ProfileKey> subProfiles;
+
+ public AbstractImmutableProfile(ProfileKey key, URI[] uris)
+ {
+ this(key, uris, null);
+ }
+
+ public AbstractImmutableProfile(ProfileKey key, URI[] uris, List<ProfileKey> subprofiles)
+ {
+ super(uris);
+ //
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+
+ this.key = key;
+ this.subProfiles = subprofiles;
+ }
+
+ public void create() throws Exception
+ {
+ for(URI uri : getRepositoryURIs())
+ {
+ VirtualFile root = getCachedVirtualFile(uri);
+ loadApplications(root);
+ }
+ updateLastModfied();
+ }
+
+ public ProfileKey getKey()
+ {
+ return this.key;
+ }
+
+ public Collection<ProfileKey> getSubProfiles()
+ {
+ return this.subProfiles;
+ }
+
+ public void setSubProfiles(List<ProfileKey> subProfiles)
+ {
+ this.subProfiles = subProfiles;
+ }
+
+ @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;
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,192 @@
+/*
+ * 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.system.server.profile.repository;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+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 the a DeploymentRepository.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfile implements MutableProfile
+{
+
+ /** The profile key */
+ final private ProfileKey key;
+
+ /** The repository containing the deployment contents */
+ final private DeploymentRepository repository;
+
+ /** The profile dependencies */
+ List<ProfileKey> subProfiles;
+
+ /** Is hot deployment checking enabled */
+ private volatile boolean hotdeployEnabled = false;
+
+ public AbstractProfile(DeploymentRepository repository, ProfileKey key)
+ {
+ this(repository, key, null);
+ }
+
+ public AbstractProfile(DeploymentRepository repository, ProfileKey key, List<ProfileKey> subProfiles)
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+ if(repository == null)
+ throw new IllegalArgumentException("Null deployment repository.");
+
+ this.key = key;
+ this.repository = repository;
+ this.subProfiles = subProfiles;
+ }
+
+ 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 Collection<ProfileKey> getSubProfiles()
+ {
+ return this.subProfiles;
+ }
+
+ public void setSubProfiles(List<ProfileKey> subProfiles)
+ {
+ this.subProfiles = subProfiles;
+ }
+
+ 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.");
+ // FIXME
+ 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;
+ }
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,198 +0,0 @@
-/*
- * 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.system.server.profile.repository;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.util.JBossObject;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A profile implementation that uses the DeploymentRepository to store
- * deployments and admin metadata.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ProfileImpl extends JBossObject
- implements Profile
-{
- private ProfileKey key;
- private String version;
- /** The repository containing the deployment contents */
- private DeploymentRepository repository;
- /** Is hot deployment checking enabled */
- private volatile boolean hotdeployEnabled;
-
- /**
- *
- * @param repository the repository
- * @param key the key
- */
- public ProfileImpl(DeploymentRepository repository, ProfileKey key)
- {
- this.key = key;
- this.repository = repository;
- log.info("Using repository:"+repository);
- }
-
- public String getName()
- {
- return key.getName();
- }
-
- public ProfileKey getKey()
- {
- return key;
- }
-
- public String getVersion()
- {
- return version;
- }
-
-
- public long getLastModified()
- {
- return repository.getLastModified();
- }
-
- /**
- * Get the names of the deployments in the profile
- * @return names of deployments
- */
- public Set<String> getDeploymentNames()
- {
- return repository.getDeploymentNames();
- }
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- return repository.getDeploymentNames(phase);
- }
-
- public VirtualFile getRootFile(DeploymentPhase phase)
- throws Exception
- {
- URI uri = repository.getDeploymentURI(phase);
- return VFS.getRoot(uri);
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception
- {
- return repository.getDeployments(phase);
- }
- public Collection<VFSDeployment> getDeployments()
- throws Exception
- {
- return repository.getDeployments();
- }
-
- /**
- *
- */
- public Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- Collection<ModificationInfo> modified = Collections.emptyList();
- if( hotdeployEnabled == true )
- modified = repository.getModifiedDeployments();
- return modified;
- }
- /**
- * Enable/disable getModifiedDeployments results.
- */
- public synchronized void enableModifiedDeploymentChecks(boolean flag)
- {
- this.hotdeployEnabled = flag;
- }
-
- public void addDeployment(VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- String name = d.getName();
- repository.addDeployment(name, d, phase);
- }
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- ManagedComponent mo)
- throws Exception
- {
- repository.updateDeployment(d, phase, mo);
- }
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws Exception, NoSuchDeploymentException
- {
- return repository.getDeployment(name, phase);
- }
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- return repository.removeDeployment(name, phase);
- }
-
- public Map<String, Object> getConfig()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean hasDeployment(String name, DeploymentPhase phase)
- {
- // TODO: Wolf: needs refactoring / review
- try
- {
- getDeployment(name, phase);
- return true;
- }
- catch(NoSuchDeploymentException e)
- {
- return false;
- }
- catch(Exception e)
- {
- log.warn("getDeployment return exception", e);
- return false;
- }
- }
-
- @Override
- protected void toString(JBossStringBuilder buffer)
- {
- buffer.append("key=");
- buffer.append(this.key);
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata)
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
-
-/**
- * The abstract profile meta data.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileMetaData implements ProfileMetaData
-{
-
- /** The profile name. */
- private String name;
-
- /** The server. */
- private String server;
-
- /** The doamin. */
- private String domain;
-
- /** The profile sources. */
- private ProfileSourceMetaData source;
-
- /** The sub profiles. */
- private List<SubProfileMetaData> subprofiles;
-
- @XmlAttribute(name = "name")
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- @XmlAttribute(name = "server")
- public String getServer()
- {
- return server;
- }
-
- public void setServer(String server)
- {
- this.server = server;
- }
-
- @XmlAttribute(name = "domain")
- public String getDomain()
- {
- return domain;
- }
-
- public void setDomain(String domain)
- {
- this.domain = domain;
- }
-
- @XmlElement(name = "profile-source", type = FilteredProfileSourceMetaData.class)
- public ProfileSourceMetaData getSource()
- {
- return source;
- }
-
- public void setSource(ProfileSourceMetaData source)
- {
- this.source = source;
- }
-
- @XmlElement(name = "sub-profile", type = BasicSubProfileMetaData.class)
- public List<SubProfileMetaData> getSubprofiles()
- {
- return subprofiles;
- }
-
- public void setSubprofiles(List<SubProfileMetaData> subprofiles)
- {
- this.subprofiles = subprofiles;
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,112 @@
+/*
+ * 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.system.server.profile.repository.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+
+/**
+ * The abstract profile meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileMetaData implements ProfileMetaData
+{
+
+ /** The profile name. */
+ private String name;
+
+ /** The server. */
+ private String server;
+
+ /** The doamin. */
+ private String domain;
+
+ /** The profile sources. */
+ private ProfileSourceMetaData source;
+
+ /** The sub profiles. */
+ private List<SubProfileMetaData> subprofiles;
+
+ @XmlAttribute(name = "name")
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlAttribute(name = "server")
+ public String getServer()
+ {
+ return server;
+ }
+
+ public void setServer(String server)
+ {
+ this.server = server;
+ }
+
+ @XmlAttribute(name = "domain")
+ public String getDomain()
+ {
+ return domain;
+ }
+
+ public void setDomain(String domain)
+ {
+ this.domain = domain;
+ }
+
+ @XmlElement(name = "profile-source", type = FilteredProfileSourceMetaData.class)
+ public ProfileSourceMetaData getSource()
+ {
+ return source;
+ }
+
+ public void setSource(ProfileSourceMetaData source)
+ {
+ this.source = source;
+ }
+
+ @XmlElement(name = "sub-profile", type = BasicSubProfileMetaData.class)
+ public List<SubProfileMetaData> getSubprofiles()
+ {
+ return subprofiles;
+ }
+
+ public void setSubprofiles(List<SubProfileMetaData> subprofiles)
+ {
+ this.subprofiles = subprofiles;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
-
-/**
- * A abstract profile source meta data, which type is based on the
- * runtime class name.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileSourceMetaData implements ProfileSourceMetaData
-{
-
- /** The source. */
- 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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/AbstractProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,62 @@
+/*
+ * 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.system.server.profile.repository.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+
+/**
+ * A abstract profile source meta data, which type is based on the
+ * runtime class name.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileSourceMetaData implements ProfileSourceMetaData
+{
+
+ /** The source. */
+ 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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import javax.xml.bind.annotation.XmlValue;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-
-/**
- * @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 name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileDeploymentMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+
+/**
+ * @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 name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BasicProfileMetaData extends AbstractProfileMetaData
-{
-
- /** The deployments. */
- private List<ProfileDeploymentMetaData> deployments;
-
- @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
- public List<ProfileDeploymentMetaData> getDeployments()
- {
- return deployments;
- }
-
- public void setDeployments(List<ProfileDeploymentMetaData> deployments)
- {
- this.deployments = deployments;
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileMetaData extends AbstractProfileMetaData
+{
+
+ /** The deployments. */
+ private List<ProfileDeploymentMetaData> deployments;
+
+ @XmlElement(name = "deployment", type = BasicProfileDeploymentMetaData.class)
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return deployments;
+ }
+
+ public void setDeployments(List<ProfileDeploymentMetaData> deployments)
+ {
+ this.deployments = deployments;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BasicSubProfileMetaData implements SubProfileMetaData
-{
-
- /** The name. */
- private String name;
-
- /** The server. */
- private String server;
-
- /** The doamin. */
- private String domain;
-
- @XmlValue
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- @XmlAttribute(name = "server")
- public String getServer()
- {
- return server;
- }
-
- public void setServer(String server)
- {
- this.server = server;
- }
-
- @XmlAttribute(name = "domain")
- public String getDomain()
- {
- return domain;
- }
-
- public void setDomain(String domain)
- {
- this.domain = domain;
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/BasicSubProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicSubProfileMetaData implements SubProfileMetaData
+{
+
+ /** The name. */
+ private String name;
+
+ /** The server. */
+ private String server;
+
+ /** The doamin. */
+ private String domain;
+
+ @XmlValue
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlAttribute(name = "server")
+ public String getServer()
+ {
+ return server;
+ }
+
+ public void setServer(String server)
+ {
+ this.server = server;
+ }
+
+ @XmlAttribute(name = "domain")
+ public String getDomain()
+ {
+ return domain;
+ }
+
+ public void setDomain(String domain)
+ {
+ this.domain = domain;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * The meta data defining a filtered profile. This is the
- * standard type of a profile.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at JBossXmlSchema(namespace="urn:jboss:profileservice:profile:filtered:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlRootElement(name = "profile")
-public class FilteredProfileMetaData extends BasicProfileMetaData
-{
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * The meta data defining a filtered profile. This is the
+ * standard type of a profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace="urn:jboss:profileservice:profile:filtered:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "profile")
+public class FilteredProfileMetaData extends BasicProfileMetaData
+{
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * A filtered profile source meta data.
- * This is a workaround that we can a filtered deploymentRepository
- * on this metadata only, based on the deployments list.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at JBossXmlSchema(namespace="urn:jboss:profileservice:source:filtered:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlRootElement(name = "profile-source")
-public class FilteredProfileSourceMetaData extends AbstractProfileSourceMetaData
-{
-
- /** The deployments */
- List<ProfileDeploymentMetaData> deployments;
-
- @XmlTransient
- public List<ProfileDeploymentMetaData> getDeployments()
- {
- return deployments;
- }
-
- public void setDeployments(List<ProfileDeploymentMetaData> deployments)
- {
- this.deployments = deployments;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/FilteredProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,61 @@
+/*
+ * 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.system.server.profile.repository.metadata;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * A filtered profile source meta data.
+ * This is a workaround that we can a filtered deploymentRepository
+ * on this metadata only, based on the deployments list.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace="urn:jboss:profileservice:source:filtered:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "profile-source")
+public class FilteredProfileSourceMetaData extends AbstractProfileSourceMetaData
+{
+
+ /** The deployments */
+ List<ProfileDeploymentMetaData> deployments;
+
+ @XmlTransient
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return deployments;
+ }
+
+ public void setDeployments(List<ProfileDeploymentMetaData> deployments)
+ {
+ this.deployments = deployments;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-import org.jboss.xb.annotations.JBossXmlSchema;
-
-/**
- * The meta data defining a hot deployment profile.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
- at JBossXmlSchema(namespace="urn:jboss:profileservice:profile:hotdeployment:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlRootElement(name = "hotdeployment-profile")
-public class HotDeploymentProfileMetaData extends AbstractProfileMetaData
-{
-
- /**
- * There cannot be any specific deployments for a
- * hot deployment profile, as it will scan the folders.
- */
- public List<ProfileDeploymentMetaData> getDeployments()
- {
- return Collections.emptyList();
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * The meta data defining a hot deployment profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at JBossXmlSchema(namespace="urn:jboss:profileservice:profile:hotdeployment:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "hotdeployment-profile")
+public class HotDeploymentProfileMetaData extends AbstractProfileMetaData
+{
+
+ /**
+ * There cannot be any specific deployments for a
+ * hot deployment profile, as it will scan the folders.
+ */
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return Collections.emptyList();
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-/**
- * A hot deployment profile source meta data.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class HotDeploymentProfileSourceMetaData extends AbstractProfileSourceMetaData
-{
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/HotDeploymentProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+/**
+ * A hot deployment profile source meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class HotDeploymentProfileSourceMetaData extends AbstractProfileSourceMetaData
+{
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
-
-
-/**
- * The meta data defining a immutable profile.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ImmutableProfileMetaData extends AbstractProfileMetaData
-{
-
- /**
- * There cannot be any specific deployments for a
- * immutable profile, as it will scan the folders.
- */
- public List<ProfileDeploymentMetaData> getDeployments()
- {
- return Collections.emptyList();
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+
+
+/**
+ * The meta data defining a immutable profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImmutableProfileMetaData extends AbstractProfileMetaData
+{
+
+ /**
+ * There cannot be any specific deployments for a
+ * immutable profile, as it will scan the folders.
+ */
+ public List<ProfileDeploymentMetaData> getDeployments()
+ {
+ return Collections.emptyList();
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.metadata;
-
-/**
- * A immutable profile source meta data.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ImmutableProfileSourceMetaData extends AbstractProfileSourceMetaData
-{
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ImmutableProfileSourceMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.metadata;
+
+/**
+ * A immutable profile source meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImmutableProfileSourceMetaData extends AbstractProfileSourceMetaData
+{
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,114 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profile.repository.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 org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-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)
-public class ProfilesMetaData implements ProfileKeyMetaData
-{
- /** The name. */
- private String name;
-
- /** The server. */
- private String server;
-
- /** The doamin. */
- private String domain;
-
- /** The profiles. */
- private List<ProfileMetaData> profiles;
-
- @XmlAttribute(name = "name")
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- @XmlAttribute(name = "server")
- public String getServer()
- {
- return server;
- }
-
- public void setServer(String server)
- {
- this.server = server;
- }
-
- @XmlAttribute(name = "domain")
- public String getDomain()
- {
- return domain;
- }
-
- public void setDomain(String domain)
- {
- this.domain = domain;
- }
-
- @XmlElements({
- @XmlElement(name = "profile", type = FilteredProfileMetaData.class),
- @XmlElement(name = "hotdeployment-profile", type = HotDeploymentProfileMetaData.class)
- })
- @XmlAnyElement
- public List<ProfileMetaData> getProfiles()
- {
- return profiles;
- }
-
- public void setProfiles(List<ProfileMetaData> profiles)
- {
- this.profiles = profiles;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/repository/metadata/ProfilesMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profile.repository.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 org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+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)
+public class ProfilesMetaData implements ProfileKeyMetaData
+{
+ /** The name. */
+ private String name;
+
+ /** The server. */
+ private String server;
+
+ /** The doamin. */
+ private String domain;
+
+ /** The profiles. */
+ private List<ProfileMetaData> profiles;
+
+ @XmlAttribute(name = "name")
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlAttribute(name = "server")
+ public String getServer()
+ {
+ return server;
+ }
+
+ public void setServer(String server)
+ {
+ this.server = server;
+ }
+
+ @XmlAttribute(name = "domain")
+ public String getDomain()
+ {
+ return domain;
+ }
+
+ public void setDomain(String domain)
+ {
+ this.domain = domain;
+ }
+
+ @XmlElements({
+ @XmlElement(name = "profile", type = FilteredProfileMetaData.class),
+ @XmlElement(name = "hotdeployment-profile", type = HotDeploymentProfileMetaData.class)
+ })
+ @XmlAnyElement
+ public List<ProfileMetaData> getProfiles()
+ {
+ return profiles;
+ }
+
+ public void setProfiles(List<ProfileMetaData> profiles)
+ {
+ this.profiles = profiles;
+ }
+
+}
+
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/BootstrapDeployment.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/BootstrapDeployment.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/BootstrapDeployment.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -37,7 +37,7 @@
/**
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class BootstrapDeployment extends AbstractDeploymentUnit
implements DeploymentUnit
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/BootstrapDeployment.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/DeploymentPhaseVFSScanner.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.managed.api.ManagedDeployment;
-
-/**
- * DeploymentPhaseScanner.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class DeploymentPhaseVFSScanner extends VFSScanner
-{
- private ManagedDeployment.DeploymentPhase phase;
-
- protected DeploymentPhaseVFSScanner(ManagedDeployment.DeploymentPhase phase)
- {
- if (phase == null)
- throw new IllegalArgumentException("Null deployment phase");
- this.phase = phase;
- }
-
- protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
- {
- VFSDeployment deployment = createDeployment(file);
- if(profile.hasDeployment(deployment.getName(), phase) == false)
- profile.addDeployment(deployment, phase);
- return deployment;
- }
-
- protected void remove(Profile profile, String name) throws Exception
- {
- profile.removeDeployment(name, phase);
- }
-}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -22,10 +22,12 @@
package org.jboss.system.server.profileservice;
import java.lang.annotation.Annotation;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -39,22 +41,18 @@
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.IncompleteDeploymentException;
import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.plugins.main.MainDeployerImpl;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
import org.jboss.deployers.spi.management.KnownComponentTypes;
-import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
import org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer.KernelDeploymentVisitor;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.logging.Logger;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.api.MutableManagedObject;
@@ -71,16 +69,21 @@
import org.jboss.metatype.api.values.ArrayValueSupport;
import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.EnumValueSupport;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.types.ControllerStateMetaType;
+import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
/**
* Bootstraps the profile service
*
* @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 class ProfileServiceBootstrap implements Bootstrap
@@ -88,9 +91,12 @@
/** The log */
private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
- /** The name of the profile that is being booted */
- protected String profileName = "default";
+ /** The root profile key. */
+ protected ProfileKey profileKey;
+ /** The loaded profiles. */
+ private List<ProfileKey> bootstrapProfiles = new ArrayList<ProfileKey>();
+
/** The server MainDeployer */
protected MainDeployer mainDeployer;
@@ -103,6 +109,9 @@
private ManagedObjectFactory mof;
/** The ManagedDeployment map for the MCServer KernelDeployments */
private Map<String, ManagedDeployment> bootstrapMDs = new HashMap<String, ManagedDeployment>();
+
+ /** The profile bootstrap factory */
+ private AbstractBootstrapProfileFactory profileFactory;
/** Whether we are shutdown */
private AtomicBoolean shutdown = new AtomicBoolean(false);
@@ -142,13 +151,14 @@
this.profileService = profileService;
}
- public String getProfileName()
+ public ProfileKey getProfileKey()
{
- return profileName;
+ return profileKey;
}
- public void setProfileName(String profileName)
+
+ public void setProfileKey(ProfileKey profileKey)
{
- this.profileName = profileName;
+ this.profileKey = profileKey;
}
public ManagedObjectFactory getMof()
@@ -169,6 +179,16 @@
this.mgtDeploymentCreator = mgtDeploymentCreator;
}
+ public AbstractBootstrapProfileFactory getBootstrapProfileFactory()
+ {
+ return profileFactory;
+ }
+
+ public void setBootstrapProfileFactory(AbstractBootstrapProfileFactory profileFactory)
+ {
+ this.profileFactory = profileFactory;
+ }
+
public Map<String, ManagedDeployment> getBootstrapMDs()
{
return bootstrapMDs;
@@ -199,11 +219,31 @@
// Expose the bootstrap ManagedDeployments
initBootstrapMDs(server);
- // Load the profile beans
+ // Load the profiles
+ if(this.profileKey == null)
+ this.profileKey = new ProfileKey(server.getConfig().getServerName());
+
+ Map<String, Object> metaData = server.getMetaData();
+ ProfileMetaData pmd = (ProfileMetaData) metaData.get(ProfileMetaData.class.getName());
+
+ // Register the profiles
+ Collection<Profile> bootstrapProfiles = profileFactory.createProfiles(profileKey, null);
+ for(Profile profile : bootstrapProfiles)
+ {
+ profileService.registerProfile(profile);
+ // Add to loaded profiles
+ if(this.profileKey.equals(profile.getKey()) == false)
+ this.bootstrapProfiles.add(0, profile.getKey());
+ }
+
+ // Activate the root profile
+ log.info("Loading profile: " + this.profileKey);
+ profileService.activateProfile(this.profileKey);
+
try
{
- profileName = server.getConfig().getServerName();
- loadProfile(profileName);
+ // Check if everything is complete
+ mainDeployer.checkComplete();
}
catch (IncompleteDeploymentException e)
{
@@ -213,10 +253,18 @@
{
log.error("Failed to load profile: ", e);
}
+
// Mark the profile as ready for hotdeployment if supported
- Profile profile = profileService.getActiveProfile();
- if( profile != null )
- profile.enableModifiedDeploymentChecks(true);
+ for(ProfileKey key : profileService.getActiveProfileKeys())
+ {
+ try
+ {
+ Profile profile = profileService.getActiveProfile(key);
+ if(profile.isMutable() && profile instanceof MutableProfile)
+ ((MutableProfile) profile).enableModifiedDeploymentChecks(true);
+ }
+ catch(NoSuchProfileException ignore) { }
+ }
}
public void prepareShutdown(Server server)
@@ -228,195 +276,90 @@
public void shutdown(Server server)
{
- unloadProfile(profileName);
- try
+ // Disable hotdeployment scanning
+ for(ProfileKey key : profileService.getActiveProfileKeys())
{
- mainDeployer.shutdown();
+ try
+ {
+ Profile profile = profileService.getActiveProfile(key);
+ if(profile.isMutable() && profile instanceof MutableProfile)
+ ((MutableProfile) profile).enableModifiedDeploymentChecks(false);
+ }
+ catch(NoSuchProfileException ignore) { }
}
- catch (Throwable t)
- {
- log.warn("Error shutting down the main deployer", t);
- }
- }
-
- /**
- * Load the deployments associated with the named profile and deploy them
- * using the MainDeployer.
- *
- * @param name
- * @throws Exception for any error
- * @throws NullPointerException if either the MainDeployer or ProfileService
- * have not been injected.
- */
- protected void loadProfile(String name) throws Exception
- {
- MainDeployer deployer = getMainDeployer();
- if (deployer == null)
- throw new NullPointerException("MainDeployer has not been set");
- ProfileService ps = getProfileService();
- if (ps == null)
- throw new NullPointerException("ProfileService has not been set");
-
- // Load the named profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = ps.getProfile(key);
-
- // HACK
- VFSDeployment first = null;
- // Deploy the profile bootstrap deployments
- Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
- for (VFSDeployment d : boostraps)
+
+ // Deactivate the root profile
+ try
{
- deployer.addDeployment(d);
- if (first == null)
- first = d;
+ // Release
+ profileService.deactivateProfile(profileKey);
}
- deployer.process();
- deployer.checkComplete();
-
- Thread thread = Thread.currentThread();
- ClassLoader old = thread.getContextClassLoader();
- // FIXME remove this hack
- MainDeployerStructure hack = (MainDeployerStructure) deployer;
- ClassLoader cl = null;
- if (first != null)
+ catch(Throwable t)
{
- DeploymentContext ctx = hack.getDeploymentContext(first.getName());
- if (ctx != null)
- cl = ctx.getClassLoader();
+ log.warn("Error deactivating profile: " + this.profileKey, t);
}
- //if (cl != null)
- // thread.setContextClassLoader(cl);
try
{
-
- // Deploy the profile deployers
- Collection<VFSDeployment> profileDeployers = profile.getDeployments(DeploymentPhase.DEPLOYER);
- for (VFSDeployment d : profileDeployers)
- deployer.addDeployment(d);
- deployer.process();
- deployer.checkComplete();
-
- // Deploy the profile applications
- Collection<VFSDeployment> profileDeployments = profile.getDeployments(DeploymentPhase.APPLICATION);
- for (VFSDeployment d : profileDeployments)
- deployer.addDeployment(d);
- deployer.process();
- deployer.checkComplete();
+ // Unregister
+ Profile profile = profileService.getProfile(profileKey);
+ profileService.unregisterProfile(profileKey);
}
- finally
+ catch(Throwable t)
{
- thread.setContextClassLoader(old);
+ log.warn("Error unregistering profile: " + this.profileKey, t);
}
- }
-
- /**
- * Unload the deployments associated with the named profile and undeploy them
- * using the MainDeployer in reverse phase order.
- *
- * @param name the profile name
- * @throws NullPointerException if either the MainDeployer or ProfileService
- * have not been injected.
- */
- protected void unloadProfile(String name)
- {
- MainDeployer deployer = getMainDeployer();
- if (deployer == null)
+
+ // Deactivate all profiles we registered
+ deactivateProfiles(this.bootstrapProfiles);
+
+ // Deactivate all still active profiles
+ deactivateProfiles(this.profileService.getActiveProfileKeys());
+
+ // Unregister all profiles at once
+ for(ProfileKey key : profileService.getProfileKeys())
{
- log.warn("MainDeployer has not been set");
- return;
- }
- ProfileService ps = getProfileService();
- if (ps == null)
- {
- log.warn("ProfileService has not been set");
- return;
- }
-
- try
- {
- // Load the named profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = ps.getProfile(key);
-
- // HACK
- VFSDeployment first = null;
-
- // Deploy the bootstrap
- Collection<VFSDeployment> boostraps = profile.getDeployments(DeploymentPhase.BOOTSTRAP);
- for (VFSDeployment d : boostraps)
- {
- if (first == null)
- {
- first = d;
- break;
- }
- }
-
- Thread thread = Thread.currentThread();
- ClassLoader old = thread.getContextClassLoader();
- // FIXME remove this hack
- MainDeployerImpl hack = (MainDeployerImpl) deployer;
- ClassLoader cl = null;
- if (first != null)
- {
- try
- {
- DeploymentContext ctx = hack.getDeploymentContext(first.getName());
- if (ctx != null)
- cl = ctx.getClassLoader();
- }
- catch (Exception e)
- {
- log.debug("Unable to get first deployment", e);
- }
- }
- //if (cl != null)
- // thread.setContextClassLoader(cl);
try
{
- // Undeploy the applications
- unload(deployer, profile.getDeployments(DeploymentPhase.APPLICATION));
- // Undeploy the deployers
- unload(deployer, profile.getDeployments(DeploymentPhase.DEPLOYER));
- // Undeploy the bootstrap
- unload(deployer, profile.getDeployments(DeploymentPhase.BOOTSTRAP));
+ // TODO update to unregister(ProfileKey);
+ profileService.unregisterProfile(key);
}
- finally
+ catch(Throwable t)
{
- thread.setContextClassLoader(old);
+ // Ignore
}
}
+
+ try
+ {
+ mainDeployer.shutdown();
+ }
catch (Throwable t)
{
- log.warn("Error unloading profile", t);
+ log.warn("Error shutting down the main deployer", t);
}
}
-
- /**
- * Unload a set of deployments
- *
- * @param deployer the main deployer
- * @param deployments the deployments
- */
- protected void unload(MainDeployer deployer, Collection<VFSDeployment> deployments)
+
+ protected void deactivateProfiles(Collection<ProfileKey> profiles)
{
- if (deployments == null || deployments.isEmpty())
- return;
-
- for (VFSDeployment d : deployments)
+ if(profiles != null && profiles.isEmpty() == false)
{
- try
+ for(ProfileKey key : profiles)
{
- deployer.removeDeployment(d);
+ try
+ {
+ profileService.deactivateProfile(key);
+ }
+ catch(NoSuchProfileException e)
+ {
+ // ignore
+ }
+ catch(Throwable t)
+ {
+ log.warn("Error unloading profile: " + this.profileKey, t);
+ }
}
- catch (Exception e)
- {
- log.warn("Unable to remove deployment: " + d);
- }
}
- deployer.process();
}
/**
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
___________________________________________________________________
Name: svn:keywords
- Id, Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSBootstrapScannerImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSBootstrapScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSBootstrapScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSBootstrapScannerImpl()
- {
- super(DeploymentPhase.BOOTSTRAP);
- }
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeployerScannerImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSDeployerScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSDeployerScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSDeployerScannerImpl()
- {
- super(DeploymentPhase.DEPLOYER);
- }
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSDeploymentScannerImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice;
-
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-
-/**
- * VFSDeploymentScannerImpl.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class VFSDeploymentScannerImpl extends DeploymentPhaseVFSScanner
-{
- public VFSDeploymentScannerImpl()
- {
- super(DeploymentPhase.APPLICATION);
- }
-}
-
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/VFSScanner.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,64 @@
+/*
+ * 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.system.server.profileservice.attachments;
+
+import java.net.URI;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * The AttachmentStore.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface AttachmentStore
+{
+
+ /**
+ * Get the uri where the attachments are stored.
+ *
+ * @return the attachment store root.
+ */
+ URI getAttachmentStoreRoot();
+
+ /**
+ * Persist the changes of the managed component.
+ *
+ * @param deployment the profile deployment.
+ * @param comp the managed component.
+ * @throws Exception
+ */
+ void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
+
+ /**
+ * Create the deployment with the persisted attachments.
+ *
+ * @param deployment the profile deployment.
+ * @return the mc deployment.
+ * @throws Exception
+ */
+ Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception;
+
+}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentClassPathMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/DeploymentStructureMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -27,9 +27,9 @@
import org.jboss.deployers.spi.attachments.AttachmentsFactory;
import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
import org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer;
import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
/**
* Basic wrapper for MutableAttachmets. This maintains a list of associated
@@ -47,7 +47,7 @@
private final MutableAttachments delegate;
/** The attachmentsSerializer. */
- private final AttachmentsSerializer serializer;
+ private final AbstractFileAttachmentsSerializer serializer;
/** The relative path. */
private final String relativePath;
@@ -55,7 +55,7 @@
/** The available attachments. */
private final Collection<String> attachments;
- public LazyPredeterminedManagedObjects(AttachmentsSerializer serializer, String relativePath, Collection<String> attachments)
+ public LazyPredeterminedManagedObjects(AbstractFileAttachmentsSerializer serializer, String relativePath, Collection<String> attachments)
{
if(serializer == null)
throw new IllegalArgumentException("serializer may not be null;");
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/LazyPredeterminedManagedObjects.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,14 +24,20 @@
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
/**
* Metadata describing the persisted deployment attachments.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
+ at JBossXmlSchema(namespace = "urn:org:jboss:profileservice:attachments:1.0", elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") })
@XmlRootElement(name = "attachments-metadata")
public class RepositoryAttachmentMetaData
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/RepositoryAttachmentMetaDataFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/package-info.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/attachments/package-info.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/package-info.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/package-info.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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:attachments:1.0",
+ elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") }
+)
+package org.jboss.system.server.profileservice.attachments;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -29,15 +29,16 @@
import java.util.concurrent.TimeUnit;
import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
/**
* A DeploymentScanner built on the ProfileService and MainDeployer. This
@@ -51,6 +52,7 @@
* @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
* @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 class HDScanner
@@ -59,7 +61,7 @@
private static final Logger log = Logger.getLogger(HDScanner.class);
// Private Data --------------------------------------------------
/** The MainDeployer used to deploy modifications */
- private MainDeployer mainDeployer;
+ private MainDeployerAdapter deployer;
/** The controller */
private KernelController controller;
@@ -86,9 +88,9 @@
// Attributes ----------------------------------------------------
- public void setMainDeployer(MainDeployer deployer)
+ public void setDeployer(MainDeployerAdapter deployer)
{
- this.mainDeployer = deployer;
+ this.deployer = deployer;
}
public KernelController getController()
@@ -191,7 +193,7 @@
// Operations ----------------------------------------------------
- public void start() throws Exception
+ public void create() throws Exception
{
// Default to a single thread executor
if( scanExecutor == null )
@@ -206,6 +208,11 @@
}
);
}
+ }
+
+
+ public void start() throws Exception
+ {
activeScan = scanExecutor.scheduleWithFixedDelay(this, 0,
scanPeriod, TimeUnit.MILLISECONDS);
}
@@ -247,54 +254,85 @@
if( trace )
log.trace("Begin deployment scan");
-
- // Get the modified deployments
- Profile activeProfile = profileService.getActiveProfile();
- if( activeProfile == null )
+ // Get the active profiles
+ Collection<ProfileKey> activeProfiles = profileService.getActiveProfileKeys();
+ if(activeProfiles == null || activeProfiles.isEmpty())
{
if( trace )
- log.trace("End deployment scan, no activeProfile");
+ log.trace("End deployment scan, no active profiles");
return;
}
+ // Current workaround for JBAS-4206
+ Profile firstProfile = null;
- Collection<ModificationInfo> modified = activeProfile.getModifiedDeployments();
- for(ModificationInfo info : modified)
+ // Get the modified deployments
+ boolean modified = false;
+ for(ProfileKey key : activeProfiles)
{
- VFSDeployment ctx = info.getDeployment();
- switch( info.getStatus() )
+ // The profile
+ Profile profile = null;
+ try
{
- case ADDED:
- mainDeployer.addDeployment(ctx);
- break;
- case MODIFIED:
- mainDeployer.addDeployment(ctx);
- break;
- case REMOVED:
- mainDeployer.removeDeployment(ctx.getName());
- break;
+ profile = profileService.getActiveProfile(key);
}
+ catch(NoSuchProfileException ignore)
+ {
+ if(trace)
+ log.debug("failed to get profile for key: "+ key);
+ continue;
+ }
+ // Check if it's a mutable profile
+ if( profile.isMutable() == false)
+ {
+ if( trace )
+ log.trace("Ignoring not mutable profile: "+ key);
+ continue;
+ }
+ MutableProfile activeProfile = (MutableProfile) profile;
+ // Current workaround for JBAS-4206
+ if(firstProfile == null)
+ firstProfile = activeProfile;
+
+ Collection<ModificationInfo> modifiedDeployments = activeProfile.getModifiedDeployments();
+ for(ModificationInfo info : modifiedDeployments)
+ {
+ ProfileDeployment ctx = info.getDeployment();
+ switch( info.getStatus() )
+ {
+ case ADDED:
+ case MODIFIED:
+ deployer.addDeployment(ctx);
+ break;
+ case REMOVED:
+ deployer.removeDeployment(ctx.getName());
+ break;
+ }
+ }
+
+ if(modifiedDeployments.size() > 0)
+ modified = true;
}
// Process the changes
try
{
- if( modified.size() > 0 )
+ if( modified )
{
// Current workaround for JBAS-4206
- ClassLoader oldTCL = Thread.currentThread().getContextClassLoader();
- ClassLoader tcl = getTCL(activeProfile);
+// ClassLoader oldTCL = Thread.currentThread().getContextClassLoader();
+// ClassLoader tcl = getTCL(firstProfile);
try
{
- if (tcl != null)
- Thread.currentThread().setContextClassLoader(tcl);
- mainDeployer.process();
+// if (tcl != null)
+// Thread.currentThread().setContextClassLoader(tcl);
+ deployer.process();
// Can be nulled by a shutdown
- if(mainDeployer != null)
- mainDeployer.checkComplete();
+ if(deployer != null)
+ deployer.checkComplete();
}
finally
{
- Thread.currentThread().setContextClassLoader(oldTCL);
+// Thread.currentThread().setContextClassLoader(oldTCL);
}
}
}
@@ -304,6 +342,7 @@
// TODO: somehow need to ignore bad deployments to avoid repeated errors
return;
}
+
if( trace )
log.trace("End deployment scan");
@@ -324,32 +363,32 @@
/**
* Current workaround for JBAS-4206
*/
- private ClassLoader getTCL(Profile activeProfile)
- throws Exception
- {
- MainDeployerStructure structure = (MainDeployerStructure) mainDeployer;
- Collection<VFSDeployment> ctxs = activeProfile.getDeployments(DeploymentPhase.BOOTSTRAP);
- if (ctxs != null && ctxs.isEmpty() == false)
- {
- for (VFSDeployment deployment : ctxs)
- {
- DeploymentUnit unit = structure.getDeploymentUnit(deployment.getName());
- if (unit != null)
- {
- try
- {
- ClassLoader cl = unit.getClassLoader();
- if (cl != null)
- return cl;
- }
- catch (Exception ignored)
- {
- }
- }
-
- }
- }
- log.warn("No bootstrap deployments? profile=" + activeProfile);
- return null;
- }
+// private ClassLoader getTCL(Profile activeProfile)
+// throws Exception
+// {
+// MainDeployerStructure structure = (MainDeployerStructure) mainDeployer;
+// Collection<VFSDeployment> ctxs = activeProfile.getDeployments();
+// if (ctxs != null && ctxs.isEmpty() == false)
+// {
+// for (VFSDeployment deployment : ctxs)
+// {
+// DeploymentUnit unit = structure.getDeploymentUnit(deployment.getName());
+// if (unit != null)
+// {
+// try
+// {
+// ClassLoader cl = unit.getClassLoader();
+// if (cl != null)
+// return cl;
+// }
+// catch (Exception ignored)
+// {
+// }
+// }
+//
+// }
+// }
+// log.warn("No bootstrap deployments? profile=" + activeProfile);
+// return null;
+// }
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AttachmentPropertyPopulator.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/AttachmentPropertyPopulator.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AttachmentPropertyPopulator.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AttachmentPropertyPopulator.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,107 @@
+/*
+ * 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.system.server.profileservice.persistence;
+
+import java.lang.reflect.Proxy;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * The AttachmentPropertyPopulator, this writes the values of a
+ * ManagedProperty to a attachment.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AttachmentPropertyPopulator
+{
+
+ /** The managed object factory. */
+ private ManagedObjectFactory managedObjectFactory;
+
+ /** The meta value factory. */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(AttachmentPropertyPopulator.class);
+
+ public AttachmentPropertyPopulator()
+ {
+ this.managedObjectFactory = ManagedObjectFactory.getInstance();
+ }
+
+ public AttachmentPropertyPopulator(ManagedObjectFactory managedObjectFactory)
+ {
+ this.managedObjectFactory = managedObjectFactory;
+ }
+
+ /**
+ * 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();
+
+ // FIXME skip CompositeValueInvocationHandler
+ if (metaType.isComposite())
+ {
+ // unwrap
+ Object unwrapped = metaValueFactory.unwrap(value, propertyInfo.getType());
+ if (Proxy.isProxyClass(unwrapped.getClass()))
+ return;
+
+ }
+
+ // Set value
+ InstanceClassFactory icf = managedObjectFactory.getInstanceClassFactory(attachment.getClass(), null);
+ BeanInfo beanInfo = propertyInfo.getBeanInfo();
+ icf.setValue(beanInfo, property, attachment, value);
+
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/MOCreatorPlugin.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/MOCreatorPlugin.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/MOCreatorPlugin.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/MOCreatorPlugin.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,92 @@
+/*
+ * 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.system.server.profileservice.persistence;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * ManagedObject creator plugin.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MOCreatorPlugin
+{
+
+ /** The classloader. */
+ private ClassLoader loader;
+
+ /** The managed object factory. */
+ private ManagedObjectFactory managedObjectFactory;
+
+ public MOCreatorPlugin()
+ {
+ this.managedObjectFactory = ManagedObjectFactoryBuilder.create();
+ }
+
+ public MOCreatorPlugin(ManagedObjectFactory managedObjectFactory)
+ {
+ this.managedObjectFactory = managedObjectFactory;
+ }
+
+ public ManagedObjectFactory getMOF()
+ {
+ return managedObjectFactory;
+ }
+
+ public void setMOF(ManagedObjectFactory managedObjectFactory)
+ {
+ this.managedObjectFactory = managedObjectFactory;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ if(this.loader == null)
+ return Thread.currentThread().getContextClassLoader();
+ return this.loader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.loader = classLoader;
+ }
+
+ public ManagedObject createManagedObject(String clazz, MetaData metaData) throws Exception
+ {
+ return getMOF().createManagedObject(createManagedObjectClass(clazz), metaData);
+ }
+
+ public ManagedObject initManagedObject(Object o, MetaData metaData) throws Exception
+ {
+ return getMOF().initManagedObject(o, metaData);
+ }
+
+ protected Class<?> createManagedObjectClass(String clazz) throws Exception
+ {
+ return getClassLoader().loadClass(clazz);
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,214 @@
+/*
+ * 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.system.server.profileservice.persistence;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Stack;
+
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
+
+/**
+ * A handler for updating generic values.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedGenericOverrideHandler extends ManagedObjectOverride
+{
+
+ /** The merging stack. */
+ private Stack<MergingProperties> properties = new Stack<MergingProperties>();
+
+ @Override
+ protected void processProperty(ManagedProperty property, PersistedProperty propertyElement, Object attachment,
+ boolean trace) throws Throwable
+ {
+
+ if (property == null)
+ throw new IllegalStateException("Null property");
+
+ // The propertyInfo
+ PropertyInfo info = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+ if(info.isReadable() == false)
+ {
+ log.trace("Skipping not readable property " + info);
+ return;
+ }
+
+ // Push the merging item
+ MergingProperties item = new MergingProperties(attachment, info, propertyElement);
+ this.properties.push(item);
+ try
+ {
+ super.processProperty(property, propertyElement, attachment, trace);
+ }
+ finally
+ {
+ this.properties.pop();
+ }
+ }
+
+ @Override
+ protected void setValue(ManagedProperty property, MetaValue value, Object attachment) throws Throwable
+ {
+ if(value == null)
+ return;
+
+ if (value.getMetaType().isGeneric())
+ {
+ // FIXME
+ if(value.getMetaType().equals(GENERIC_PERSISTED_VALUE_TYPE))
+ {
+ // See if we need to recreate a managed object
+ PersistedGenericValue moElement = (PersistedGenericValue) ((GenericValue) value).getValue();
+ if (moElement.getManagedObject() == null)
+ return;
+
+ ManagedObject mo = createManagedObject(moElement.getManagedObject());
+ value = new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
+ }
+ }
+ //
+ super.setValue(property, value, attachment);
+ }
+
+
+ /**
+ * Create a merged collection value.
+ *
+ * @param original the original collection
+ * @param override the override collection
+ * @return the merged collection
+ * @throws Throwable
+ */
+ @Override
+ protected CollectionValue mergeCollection(CollectionValue original, CollectionValue override, boolean trace)
+ throws Throwable
+ {
+ CollectionMetaType metaType = original.getMetaType();
+ if (metaType.getElementType().isGeneric())
+ {
+ // Check if the recreation was wrapping the correct value
+// CollectionMetaType overrideMetaType = override.getMetaType();
+// if(overrideMetaType.getElementType().equals(GENERIC_PERSISTED_VALUE_TYPE) == false)
+// throw new IllegalStateException("Wrong generic value type: " + overrideMetaType.getElementType());
+
+ // Extract the information
+ MergingProperties item = this.properties.peek();
+ PropertyInfo propertyInfo = item.getPropertyInfo();
+ Object attachment = item.getAttachment();
+
+ // Extract original collection
+ Collection<?> c = (Collection<?>) propertyInfo.get(attachment);
+
+ // This should not happen
+ if(c.size() < override.getSize())
+ throw new IllegalStateException("c.size() < override.getSize()");
+
+ Iterator<?> rawIterator = c.iterator();
+ Iterator<MetaValue> originalIterator = original.iterator();
+ Iterator<MetaValue> overrideIterator = override.iterator();
+
+ while (rawIterator.hasNext())
+ {
+ // The raw object
+ rawIterator.next();
+
+ // Skip generic values which are not annotated
+ GenericValue originalGeneric = (GenericValue) originalIterator.next();
+
+ // Extract the generic information
+ GenericValue overrideGeneric = (GenericValue) overrideIterator.next();
+ PersistedGenericValue overrideGenericValue = (PersistedGenericValue) overrideGeneric.getValue();
+
+ // Skip not annotated managed objects
+ if(originalGeneric.getValue() == null)
+ continue;
+
+ // TODO Remove a ManagedObject
+ ModificationInfo modificationInfo = overrideGenericValue.getModificationInfo();
+ if(modificationInfo != null && modificationInfo == ModificationInfo.REMOVED)
+ {
+ rawIterator.remove();
+ continue;
+ }
+
+ // process the generic value
+ processGenericValue(originalGeneric, overrideGenericValue, trace);
+ }
+
+ // This does not need to get populated
+ return null;
+ }
+ else
+ {
+ // Normal merge
+ return super.mergeCollection(original, override, trace);
+ }
+ }
+
+ public static class MergingProperties
+ {
+ /** The attachment. */
+ private Object attachment;
+
+ /** The managed object. */
+ private PropertyInfo propertyInfo;
+
+ /** The persisted property. */
+ private PersistedProperty propertyElement;
+
+ public MergingProperties(Object attachment, PropertyInfo info, PersistedProperty propertyElement)
+ {
+ this.attachment = attachment;
+ this.propertyInfo = info;
+ this.propertyElement = propertyElement;
+ }
+
+ public Object getAttachment()
+ {
+ return attachment;
+ }
+ public PropertyInfo getPropertyInfo()
+ {
+ return propertyInfo;
+ }
+ public PersistedProperty getPropertyElement()
+ {
+ return propertyElement;
+ }
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectOverride.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectOverride.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectOverride.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectOverride.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,298 @@
+/*
+ * 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.system.server.profileservice.persistence;
+
+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.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.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.TableValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedValue;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedObjectOverride extends ManagedObjectRecreation
+{
+
+ /** The logger. */
+ protected static final Logger log = Logger.getLogger(ManagedObjectOverride.class);
+
+ /** The attachment property populator. */
+ private AttachmentPropertyPopulator populator = new AttachmentPropertyPopulator();
+
+ public ManagedObject update(Object attachment, PersistedManagedObject element) throws Throwable
+ {
+ if (attachment == null)
+ throw new IllegalArgumentException("Null attachment");
+ if (element == null)
+ throw new IllegalArgumentException("Null persisted information.");
+
+ // The managed object
+ ManagedObject mo = buildManagedObject(attachment);
+
+ //
+ if(mo == null)
+ return null;
+
+ // Update
+ updateManagedObject(mo, element, attachment);
+
+ return mo;
+ }
+
+ public void updateManagedObject(ManagedObject mo, PersistedManagedObject element, Object attachment)
+ throws Throwable
+ {
+ if(mo == null)
+ throw new IllegalArgumentException("Null managed object.");
+ if(element == null)
+ throw new IllegalArgumentException("Null persisted information.");
+ //
+ if(attachment == null)
+ attachment = mo.getAttachment();
+ if(attachment == null)
+ throw new IllegalArgumentException("Null attachment.");
+
+ boolean trace = log.isTraceEnabled();
+
+ // Process properties
+ for (PersistedProperty persisted : element.getProperties())
+ {
+ ManagedProperty property = mo.getProperty(persisted.getName());
+ // Process
+ processProperty(property, persisted, attachment, trace);
+ }
+ }
+
+ protected void processProperty(ManagedProperty property, PersistedProperty propertyElement, Object attachment,
+ boolean trace) throws Throwable
+ {
+ if (property == null)
+ throw new IllegalStateException("Null property");
+
+ // Get the original values
+ MetaValue metaValue = property.getValue();
+ MetaType metaType = property.getMetaType();
+ if (metaValue != null)
+ metaType = metaValue.getMetaType();
+
+ //
+ PersistedValue valueElement = propertyElement.getValue();
+ if (valueElement.getModificationInfo() == null)
+ {
+ // TODO
+ }
+ // Recreate the metaValue
+ MetaValue override = createMetaValue(valueElement, metaType);
+
+ // Process
+ MetaValue value = processMetaValue(metaValue, override, trace);
+
+ //
+ setValue(property, value, attachment);
+ }
+
+ protected void setValue(ManagedProperty property, MetaValue value, Object attachment)
+ throws Throwable
+ {
+ // Skip null metaValues
+ if(value == null)
+ return;
+
+ // Set the values
+ property.setField(Fields.VALUE, value);
+ // Update meta type
+ property.setField(Fields.META_TYPE, value.getMetaType());
+
+ // Populate the values
+ populator.processManagedProperty(property.getName(), property, attachment);
+ }
+
+ protected MetaValue processMetaValue(MetaValue original, MetaValue override, boolean trace) throws Throwable
+ {
+ if (override == null)
+ return original;
+ if (original == null)
+ return override;
+
+ if (original.getMetaType() == null)
+ throw new IllegalStateException("Original meta value is null " + original);
+
+// if (original.getMetaType().getTypeName().equals(override.getMetaType().getTypeName()) == false)
+// {
+// // On generic values the restored is different from the original
+// if(original.getMetaType().isGeneric() == false)
+// throw new RuntimeException("Cannot merge two different types original: " + original.getMetaType()
+// + " override: " + override.getMetaType());
+// }
+
+
+ // Now try to merge
+ MetaType metaType = original.getMetaType();
+ MetaValue metaValue = null;
+ if (metaType.isSimple())
+ {
+ metaValue = override;
+ }
+ else if (metaType.isEnum())
+ {
+ metaValue = override;
+ }
+ else if (metaType.isCollection())
+ {
+ metaValue = mergeCollection(
+ (CollectionValue) original,
+ (CollectionValue) override, trace);
+ }
+ else if (metaType.isGeneric())
+ {
+ metaValue = mergeGenericValue(
+ (GenericValue) original,
+ (GenericValue) override, trace);
+ }
+ else if (metaType.isComposite())
+ {
+ metaValue = mergeCompositeValue(
+ (CompositeValue) original,
+ (CompositeValue) override, trace);
+ }
+ else if (metaType.isTable())
+ {
+ metaValue = mergeTableValue(
+ (TableValue) original,
+ (TableValue) override, trace);
+ }
+ else if (metaType.isArray())
+ {
+ metaValue = mergeArray(
+ (ArrayValue) original,
+ (ArrayValue) override, trace);
+ }
+ else
+ {
+ throw new IllegalStateException("unknown metaType");
+ }
+ return metaValue;
+ }
+
+ /**
+ * Merge a composite value.
+ *
+ * @param original
+ * @param override
+ * @return
+ */
+ protected CompositeValue mergeCompositeValue(CompositeValue original, CompositeValue override, boolean trace)
+ {
+ return override;
+ }
+
+ /**
+ * Merge a table
+ *
+ * @param original
+ * @param override
+ * @return
+ */
+ protected TableValue mergeTableValue(TableValue original, TableValue override, boolean trace)
+ {
+ return override;
+ }
+
+ /**
+ * Create a merged array value.
+ *
+ * @param original the original array
+ * @param override the override array
+ * @return the merged array
+ */
+ protected ArrayValue mergeArray(ArrayValue original, ArrayValue override, boolean trace)
+ {
+ return override;
+ }
+
+ /**
+ * Create a merged collection value.
+ *
+ * @param original the original collection
+ * @param override the override collection
+ * @return the merged collection
+ * @throws Throwable
+ */
+ protected CollectionValue mergeCollection(CollectionValue original, CollectionValue override, boolean trace)
+ throws Throwable
+ {
+ return override;
+ }
+
+ /**
+ * Merge a generic value.
+ *
+ * @param original the original generic value
+ * @param override the override generic value
+ * @return the merged value
+ */
+ protected GenericValue mergeGenericValue(GenericValue original, GenericValue override, boolean trace)
+ throws Throwable
+ {
+ Object v = override.getValue();
+ if (v instanceof PersistedGenericValue)
+ {
+ PersistedGenericValue moElement = (PersistedGenericValue) override.getValue();
+
+ return processGenericValue(original, moElement, trace);
+ }
+ // Don't do anything
+ return null;
+ }
+
+ protected GenericValue processGenericValue(GenericValue original, PersistedGenericValue override, boolean trace)
+ throws Throwable
+ {
+ // Don't do anything
+ if(override.getManagedObject() == null)
+ return null;
+
+ Object o = original.getValue();
+ if ((o instanceof ManagedObject))
+ {
+ ManagedObject originalMO = (ManagedObject) o;
+
+ // process
+ updateManagedObject(originalMO, override.getManagedObject(), originalMO.getAttachment());
+ return original;
+ }
+ throw new RuntimeException("Cannot merge original: " + original + ", override: " + override);
+ }
+
+}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,7 +21,10 @@
*/
package org.jboss.system.server.profileservice.persistence;
-import java.util.Set;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import org.jboss.beans.info.spi.PropertyInfo;
import org.jboss.logging.Logger;
@@ -40,6 +43,8 @@
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.TableValue;
+import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
import org.jboss.system.server.profileservice.persistence.xml.PersistedArrayValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
import org.jboss.system.server.profileservice.persistence.xml.PersistedCompositeValue;
@@ -59,11 +64,28 @@
*/
public class ManagedObjectPeristenceHandler
{
+
/** The meta value factory. */
- MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
/** The logger. */
private static final Logger log = Logger.getLogger(ManagedObjectPeristenceHandler.class);
+
+ /**
+ * Create the persistence meta data for a ManagedObject.
+ *
+ * @param mo the managed object
+ * @return the persistence meta data
+ */
+ public PersistedManagedObject createPersistenceMetaData(ManagedObject mo)
+ {
+ if(mo == null)
+ throw new IllegalArgumentException("Null managedObject.");
+
+ PersistedManagedObject moElement = new PersistedManagedObject();
+ processManagedObject(moElement, mo);
+ return moElement;
+ }
/**
* Process a managed object.
@@ -72,24 +94,42 @@
* @param mo the managed object
* @return isModified
*/
- public boolean processManagedObject(PersistedManagedObject moElement, ManagedObject mo)
+ public void processManagedObject(PersistedManagedObject moElement, ManagedObject mo)
{
if(moElement == null)
throw new IllegalArgumentException("Null rootElement.");
if(mo == null)
throw new IllegalArgumentException("null managedObject");
+ boolean trace = log.isTraceEnabled();
+
+ // 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
+ moElement.setTemplateName(mo.getAttachmentName());
+ }
+ }
+
+ // Set the managed-object meta information
moElement.setName(mo.getName());
- moElement.setClassName(mo.getAttachmentName());
+ moElement.setClassName(className);
- // Store the original name, if it does not exist.
- if(moElement.getOriginalName() == null)
- moElement.setOriginalName(mo.getName());
-
- boolean changed = false;
- Set<String> propertyNames = mo.getPropertyNames();
- for(String propertyName : propertyNames)
+ // Process the properties
+ List<PersistedProperty> properties = moElement.getProperties();
+ if(properties == null)
{
+ properties = new ArrayList<PersistedProperty>();
+ moElement.setProperties(properties);
+ }
+ for(String propertyName : mo.getPropertyNames())
+ {
ManagedProperty property = mo.getProperty(propertyName);
if(property == null)
throw new IllegalStateException("unable to find propery: "+ property);
@@ -98,269 +138,310 @@
continue;
// getProperty
- PersistedProperty propertyElement = moElement.get(propertyName);
- if(propertyElement == null)
- propertyElement = new PersistedProperty(property.getName());
- boolean propertyChanged = processManagedProperty(propertyElement, propertyName, property);
-
- if(propertyChanged)
+ PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
+ // Skip not readable properties
+ if(propertyInfo != null && propertyInfo.isReadable() == false)
{
- changed = true;
- moElement.put(propertyName, propertyElement);
+ if(trace)
+ log.trace("skipping property "+ propertyName + "is not readable");
+ continue;
}
+
+ PersistedProperty propertyElement = createPersistedProperty(
+ propertyName,
+ property.getValue(),
+ property.getMetaType(), trace);
+
+ properties.add(propertyElement);
}
- return changed;
}
/**
- * Process a ManagedProperty.
+ * Create the persisted property.
*
- * @param persistedProperty the xml property meta data.
- * @param name the property name.
- * @param property the managed property.
- * @return isModified.
+ * @param name the property name
+ * @param value the meta value
+ * @param metaType the meta type
+ * @return the property
*/
- protected boolean processManagedProperty(PersistedProperty persistedProperty, String name, ManagedProperty property)
+ protected PersistedProperty createPersistedProperty(String name, MetaValue value, MetaType metaType, boolean trace)
{
- boolean trace = log.isTraceEnabled();
- PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
- // Skip not readable properties
- if(propertyInfo != null && propertyInfo.isReadable() == false)
- {
- if(trace)
- log.trace("property "+ name + "is not readable");
- return false;
- }
+ if(name == null)
+ throw new IllegalArgumentException("Null name.");
+ if(metaType == null)
+ throw new IllegalArgumentException("Null meta type.");
+
+ if(trace)
+ log.trace("processing property name="+ name + "[metaValue="+ value + ", metaType="+ metaType + "]" );
- // TODO Check if property was modified
- // MetaType metaType = property.getMetaType();
- // if( ! metaType.isCollection() && ! metaType.isArray() )
- // {
- // if(property.isModified() == false)
- // return false;
- // }
-
- // Get MetaValue
- MetaValue value = property.getValue();
- // Check if there is a previous persisted property value
- PersistedValue persistedValue = persistedProperty.getValue();
- // Process
- boolean changed = false;
- if(value != null)
- {
- // Create a new value, if needed
- if(persistedValue == null)
- persistedValue = createPersistedValue(value.getMetaType());
- // Process
- changed = processMetaValue(persistedValue, value);
- }
-
- persistedProperty.setValue(persistedValue);
-
- return changed;
+ // Create Property
+ PersistedProperty property = new PersistedProperty(name);
+ // Create persisted value
+ PersistedValue persistedValue = createPersistedValue(value, metaType);
+ persistedValue.setModificationInfo(ModificationInfo.MODIFIED);
+ //
+ property.setValue(persistedValue);
+ // Return
+ return property;
}
/**
- * Process a MetaValue.
+ * Create the peristed xml meta data.
*
- * @param valueElement the xml metadata.
- * @param value the meta value.
- * @return isModified.
+ * @param value the meta value
+ * @param metaType the meta type
+ * @return the xml value.
*/
- protected boolean processMetaValue(PersistedValue valueElement, MetaValue value)
+ protected PersistedValue createPersistedValue(MetaValue value, MetaType metaType)
{
- // FIXME a MetaValue should never be null ?
+ if(log.isTraceEnabled())
+ log.trace("creating persisted value for : " + value + " with metaType " + metaType);
+
if(value == null)
- return false;
+ return emtpyPersistedValue(metaType);
- // TODO we need to know if the MetaValue was modified too.
- boolean changed = false;
- MetaType metaType = value.getMetaType();
+ // Override the metaType e.g. the MapCompositeValueSupport
+ metaType = value.getMetaType();
+ PersistedValue persistedValue = null;
if(metaType.isSimple())
{
- changed = processSimpleValue((PersistedSimpleValue) valueElement, (SimpleValue) value);
+ persistedValue = createSimpleValue(
+ (SimpleValue) value);
}
else if(metaType.isEnum())
{
- changed = processEnumValue((PersistedEnumValue) valueElement, (EnumValue) value);
+ persistedValue = createEnumValue(
+ (EnumValue) value);
}
else if(metaType.isCollection())
{
- changed = processCollectionValue((PersistedCollectionValue) valueElement, (CollectionValue) value);
+ persistedValue = createCollectionValue(
+ (CollectionValue) value);
}
else if(metaType.isGeneric())
{
- changed = processGenericValue((PersistedGenericValue) valueElement, (GenericValue) value);
+ persistedValue = createGenericValue(
+ (GenericValue) value);
}
else if(metaType.isComposite())
{
- changed = processCompositeValue((PersistedCompositeValue) valueElement, (CompositeValue) value);
+ persistedValue = createCompositeValue(
+ (CompositeValue) value,
+ (CompositeMetaType) metaType);
}
else if(metaType.isArray())
{
- changed = processArrayValue((PersistedArrayValue) valueElement, (ArrayValue) value);
+ persistedValue = createArrayValue(
+ (ArrayValue) value,
+ (ArrayMetaType) metaType);
}
else if(metaType.isTable())
{
- throw new UnsupportedOperationException("Persisting a table value.");
+ persistedValue = createTableValue(
+ (TableValue) value);
}
else
{
throw new IllegalStateException("unknown metaType");
}
- return changed;
+ return persistedValue;
}
/**
- * Process a simple value.
+ * Create the persistence enum value.
*
- * @param valueElement the xml meta data.
- * @param value the simple value.
- * @return isModified.
+ * @param value the enum value
+ * @return the enum xml meta data
*/
- protected boolean processSimpleValue(PersistedSimpleValue valueElement, SimpleValue value)
+ private PersistedEnumValue createEnumValue(EnumValue value)
{
- valueElement.setValue(convertSimple2String(value));
- return true;
+ PersistedEnumValue persistedValue = new PersistedEnumValue();
+ persistedValue.setValue(value.getValue());
+ return persistedValue;
}
-
+
/**
- * Process a enumValue.
+ * Create the persistence simple value.
*
- * @param enumElement the xml meta data.
- * @param value the enum value.
+ * @param value the simple value
+ * @return the simple xml meta data
*/
- protected boolean processEnumValue(PersistedEnumValue enumElement, EnumValue value)
+ private PersistedSimpleValue createSimpleValue(SimpleValue value)
{
- enumElement.setValue(value.getValue());
- return true;
+ PersistedSimpleValue persistedValue = new PersistedSimpleValue();
+ persistedValue.setValue(convertSimple2String(value));
+ return persistedValue;
}
/**
- * Process a collection value.
+ * Create the persistence collection value.
*
- * @param valueElement the xml meta data.
- * @param value the collection value.
- * @return isModified.
+ * @param value the collection value
+ * @return the collection xml meta data
*/
- protected boolean processCollectionValue(PersistedCollectionValue valueElement, CollectionValue value)
+ private PersistedCollectionValue createCollectionValue(CollectionValue value)
{
- boolean changed = false;
+ PersistedCollectionValue collection = new PersistedCollectionValue();
for(MetaValue child : value.getElements())
{
- PersistedValue persistedValue = createPersistedValue(child.getMetaType());
-
- if( processMetaValue(persistedValue, child) == true)
- changed = true;
-
- valueElement.addValue(persistedValue);
+ PersistedValue persistedValue = createPersistedValue(child, child.getMetaType());
+ collection.addValue(persistedValue);
}
- return changed;
+ return collection;
}
-
+
/**
- * Process a generic value.
+ * Create the persistence generic value.
*
- * @param genericElement the xml metadata.
- * @param value the generic value.
- * @return isModified.
+ * @param value the generic value
+ * @return the generic xml meta data
*/
- protected boolean processGenericValue(PersistedGenericValue genericElement, GenericValue value)
+ private PersistedGenericValue createGenericValue(GenericValue value)
{
+ //
+ PersistedGenericValue generic = new PersistedGenericValue();
Object o = value.getValue();
if(o == null)
- return false;
+ return generic;
- boolean changed = false;
if(o instanceof ManagedObject)
{
- PersistedManagedObject mo = new PersistedManagedObject();
- if(processManagedObject(mo, (ManagedObject) o) == true)
- changed = true;
- genericElement.setManagedObject(mo);
- return changed;
+ PersistedManagedObject mo = createPersistenceMetaData((ManagedObject) o);
+ generic.setManagedObject(mo);
}
else
{
throw new IllegalStateException("The value of GenericValue must be a ManagedObject: " + value);
}
+ return generic;
}
-
+
/**
- * Process the array value.
+ * Create the persistence array value.
*
- * @param array the xml meta data.
- * @param value the array value.
- * @return isModified.
+ * @param value the array value
+ * @return
*/
- protected boolean processArrayValue(PersistedArrayValue array, ArrayValue value)
+ private PersistedArrayValue createArrayValue(ArrayValue value, ArrayMetaType metaType)
{
- ArrayMetaType metaType = value.getMetaType();
-
- if(! metaType.getElementType().isSimple())
- throw new UnsupportedOperationException("Persisting a non primitive array.");
-
- boolean changed = false;
- for(int i = 0; i < value.getLength(); i++)
+ //
+ PersistedArrayValue array = new PersistedArrayValue();
+ MetaType elementType = metaType.getElementType();
+ for (int i = 0; i < value.getLength(); i++)
{
- MetaValue metaValue = (MetaValue) value.getValue(i);
- PersistedValue persistedValue = createPersistedValue(metaType.getElementType());
-
- if(processMetaValue(persistedValue, metaValue) == true)
- changed = true;
-
+ 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 changed;
+ return array;
}
/**
- * Process a composite value.
+ * Unwrap array.
*
- * @param composite the xml meta data.
- * @param value the composite value.
- * @return isModified.
+ * @param array the parent array
+ * @param element the array value
+ * @param type the element meta type
+ * @return the persistence xml meta data
*/
- protected boolean processCompositeValue(PersistedCompositeValue composite, CompositeValue value)
+ protected PersistedArrayValue unwrapArray(PersistedArrayValue array, Object element, MetaType type)
{
- CompositeMetaType metaType = value.getMetaType();
-
- boolean changed = false;
- for(String item : metaType.itemSet())
+ PersistedArrayValue newElement = new PersistedArrayValue();
+ int subSize = Array.getLength(element);
+ for (int i = 0; i < subSize; i++)
{
- MetaValue itemValue = value.get(item);
-
- // FIXME a value should never be null ?
- MetaType itemType = null;
- if(itemValue != null)
+ PersistedValue persistedValue = null;
+ Object subElement = Array.get(element, i);
+ if (subElement instanceof MetaValue)
{
- itemType = itemValue.getMetaType();
+ persistedValue = createPersistedValue((MetaValue) subElement, type);
}
- else
+ else if (subElement != null && subElement.getClass().isArray())
{
- itemType = metaType.getType(item);
+ 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
+ * @return the persistence composite xml meta data
+ */
+ private 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);
- PersistedValue persistedValue = createPersistedValue(itemType);
+ // Create item
+ PersistedValue persistedValue = createPersistedValue(itemValue, itemType);
persistedValue.setName(item);
- if(processMetaValue(persistedValue, itemValue) == true)
- changed = true;
-
- composite.put(item, persistedValue);
+ values.add(persistedValue);
}
- return changed;
+ return composite;
}
-
+
/**
- * Create an empty xml value representation.
+ * Create the persistence table value.
*
- * @param metaType the meta type.
- * @return a empty xml meta data, based on the meta type.
+ * @param value the table value
+ * @return the persistence table xml meta data
*/
- protected static PersistedValue createPersistedValue(MetaType metaType)
+ private 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 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();
@@ -403,16 +484,13 @@
*/
protected String convertSimple2String(SimpleValue value)
{
- // TODO a metaValue should never be null?
if(value == null)
- return null;
+ throw new IllegalArgumentException("Null value.");
Object unwrappedValue = metaValueFactory.unwrap(value);
-
if(unwrappedValue == null)
return null;
-
+ // Convert to String
return ("" + unwrappedValue);
}
-
-}
\ No newline at end of file
+}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRecreation.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,569 @@
+/*
+ * 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.system.server.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.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metadata.spi.MetaData;
+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.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.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.reflect.plugins.ValueConvertor;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedArrayValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedCompositeValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedEnumValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedSimpleValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedTableValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedValue;
+
+/**
+ * This handler recreates only the ManagedObject based on the persisted meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedObjectRecreation
+{
+ /** The generic type of a persisted generic value */
+ public final static GenericMetaType GENERIC_PERSISTED_VALUE_TYPE = new GenericMetaType(PersistedGenericValue.class.getName(), "persisted generic value");
+
+ /** The meta data. */
+ private MetaData metaData;
+
+ /** The plugin. */
+ private MOCreatorPlugin plugin;
+
+ /** 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(ManagedObjectRecreation.class);
+
+ 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 ManagedObjectRecreation()
+ {
+ this.plugin = new MOCreatorPlugin();
+ }
+
+ protected ManagedObject createManagedObject(PersistedManagedObject moElement) throws Exception
+ {
+ if(moElement == null)
+ throw new IllegalArgumentException("Null persisted meta data.");
+ if(moElement.getClassName() == null)
+ throw new IllegalArgumentException("Null class-name for managed object.");
+
+ // Check if we need to use a template for the managed object
+ String className = moElement.getTemplateName();
+ if(className == null)
+ {
+ className = moElement.getClassName();
+ }
+ ManagedObject mo = buildManagedObject(className);
+
+
+ if(mo instanceof MutableManagedObject)
+ {
+ // Update the name
+ ((MutableManagedObject) mo).setName(moElement.getName());
+
+ if(moElement.getTemplateName() != null)
+ {
+ // Override the actual attachment
+ Class<?> attachment = plugin.getClassLoader().loadClass(moElement.getClassName());
+ ((MutableManagedObject) mo).setAttachment(attachment.newInstance());
+ }
+ }
+
+ // Process
+ processManagedObject(moElement, mo);
+
+ // Return
+ return mo;
+ }
+
+ /**
+ * Process a ManagedObject.
+ *
+ * @param moElement the persisted xml meta data.
+ * @param mo the managed object
+ * @return the attachment meta data.
+ */
+ private void processManagedObject(PersistedManagedObject moElement, ManagedObject mo)
+ {
+ if(moElement == null)
+ throw new IllegalArgumentException("Null rootElement.");
+ if(mo == null)
+ throw new IllegalArgumentException("null managedObject");
+
+ // Get the xml to see what we need to merge
+ if(moElement.getProperties() != null && moElement.getProperties().isEmpty() == false)
+ {
+ for(PersistedProperty propertyElement : moElement.getProperties())
+ {
+ ManagedProperty property = mo.getProperty(propertyElement.getName());
+ if(property == null)
+ throw new IllegalStateException("unable to find propery: "+ property);
+
+ // Skip all non configuration properties
+ if(! property.hasViewUse(ViewUse.CONFIGURATION))
+ continue;
+
+ // getProperty
+ processManagedProperty(propertyElement, propertyElement.getName(), property, mo.getAttachment());
+ }
+ }
+ }
+
+ /**
+ * Build a managed object based on the attachment.
+ *
+ * @param attachment the attachment
+ * @return the ManagedObject
+ * @throws Exception
+ */
+ protected ManagedObject buildManagedObject(Object attachment) throws Exception
+ {
+ return plugin.initManagedObject(attachment, null);
+ }
+
+
+ /**
+ * Build a managedObject based on the className
+ *
+ * @param className the name of the class
+ * @return the ManagedObject
+ * @throws Exception
+ */
+ protected ManagedObject buildManagedObject(String className) throws Exception
+ {
+ return plugin.createManagedObject(className, metaData);
+ }
+
+ /**
+ * Process a ManagedProperty.
+ *
+ * @param propertyElement the persisted xml meta data.
+ * @param name the property name.
+ * @param property the managed property.
+ */
+ protected void processManagedProperty(PersistedProperty propertyElement, String name, ManagedProperty property, Object attachment)
+ {
+ // Get MetaType
+ MetaType metaType = property.getMetaType();
+ // Process the value
+ PersistedValue persistedValue = propertyElement.getValue();
+ if(persistedValue != null)
+ {
+ // recurse = true
+ MetaValue value = createMetaValue(persistedValue, metaType);
+ // Set the value Field
+ property.setField(Fields.VALUE, value);
+ // Update meta type
+ if(value != null)
+ property.setField(Fields.META_TYPE, value.getMetaType());
+ }
+ // Done
+ }
+
+ /**
+ * Create the meta value, based on the xml persited
+ * value and the generated MetaType.
+ *
+ * @param valueElement the persisted xml element
+ * @param type the meta type.
+ * @return the created meta value.
+ */
+ protected MetaValue createMetaValue(PersistedValue valueElement, MetaType metaType)
+ {
+ if(log.isTraceEnabled())
+ {
+ log.trace("processing value " + valueElement + " type: " + metaType);
+ }
+
+ 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
+ {
+ 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 SimpleValueSupport.wrap(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()));
+ }
+ }
+ // Generic values are getting wrapped differently
+ if(type.isGeneric())
+ {
+ type = new CollectionMetaType(type.getClassName(), "", GENERIC_PERSISTED_VALUE_TYPE);
+ }
+ 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)
+ {
+ // If we don't recurse, someone else needs to extract the managed object
+ return new GenericValueSupport(GENERIC_PERSISTED_VALUE_TYPE, genericElement);
+ }
+
+ /**
+ * 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 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;
+ }
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,542 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice.persistence;
-
-import java.io.Serializable;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.beans.info.spi.BeanInfo;
-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.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-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.MetaType;
-import org.jboss.metatype.api.types.Name;
-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.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.api.values.TableValueSupport;
-import org.jboss.metatype.plugins.types.StringName;
-import org.jboss.reflect.plugins.ValueConvertor;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedArrayValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCompositeValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedEnumValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedSimpleValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedValue;
-
-
-/**
- * Handler for merging the persisted information with a ManagedObject.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ManagedObjectUpdateHandler
-{
-
- /** The managed object factory. */
- ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
-
- /** The meta value factory. */
- MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- /** The simple types. */
- private static final Map<String, Class<? extends Serializable>> simpleTypes = new HashMap<String, Class<? extends Serializable>>();
-
- /** The logger. */
- private final static Logger log = Logger.getLogger(ManagedObjectUpdateHandler.class);
-
- 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);
- }
-
- /**
- * Process a ManagedObject.
- *
- * @param moElement the persisted xml meta data.
- * @param mo the managed object
- * @return the attachment meta data.
- */
- public Object processManagedObject(PersistedManagedObject moElement, ManagedObject mo)
- {
- if(moElement == null)
- throw new IllegalArgumentException("Null rootElement.");
- if(mo == null)
- throw new IllegalArgumentException("null managedObject");
-
- Object attachment = mo.getAttachment();
-
- // Get the xml to see what we need to merge
- Set<String> propertyNames = moElement.keySet();
- for(String propertyName : propertyNames)
- {
- ManagedProperty property = mo.getProperty(propertyName);
- if(property == null)
- throw new IllegalStateException("unable to find propery: "+ property);
-
- // Skip statistic - although they should not be persisted anyway
- if(property.hasViewUse(ViewUse.STATISTIC))
- continue;
-
- // getProperty
- PersistedProperty propertyElement = moElement.get(propertyName);
- processManagedProperty(propertyElement, propertyName, property, attachment);
- }
- return attachment;
- }
-
- /**
- * 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.
- */
- protected void processManagedProperty(PersistedProperty propertyElement, String name, ManagedProperty property, Object attachment)
- {
- boolean trace = log.isTraceEnabled();
- PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
-
- // Skip not readable properties
- if(propertyInfo != null && propertyInfo.isReadable() == false)
- {
- if(trace)
- log.trace("property "+ name + "is not readable");
- return;
- }
-
- // Get MetaValue
- MetaValue value = property.getValue();
- if(value == null)
- {
- value = createEmptyMetaValue(property.getMetaType());
- }
-
- // Get the xml value
- PersistedValue persistedValue = propertyElement.getValue();
- // Skip null values
- if(value != null && persistedValue != null)
- {
- // Process the meta value.
- MetaValue merged = processMetaValue(persistedValue, value);
- // If merged != null
- if(merged != null)
- {
- // TODO Can this be null anyway ?
- if(propertyInfo == null)
- return;
- // throw new IllegalStateException("null propertyInfo");
-
- // Skip not writable properties
- if(propertyInfo.isWritable() == false)
- {
- if(trace)
- log.trace("property "+ name + "is not writable");
- return;
- }
-
- // FIXME Ignore some metaTypes for now
- MetaType metaType = merged.getMetaType();
- if( ! metaType.isCollection()
- && ! metaType.isArray()
- && ! metaType.isTable() )
- {
-
- try
- {
- // set the value Field
- property.setField(Fields.VALUE, merged);
-
- // FIXME skip CompositeValueInvocationHandler
- if( metaType.isComposite() )
- {
- // unwrap
- Object unwrapped = metaValueFactory.unwrap(merged, propertyInfo.getType());
- if(Proxy.isProxyClass(unwrapped.getClass()))
- return;
- }
-
- // Set value
- InstanceClassFactory icf = managedObjectFactory.getInstanceClassFactory(attachment.getClass(), null);
- BeanInfo beanInfo = propertyInfo.getBeanInfo();
- icf.setValue(beanInfo, property, attachment, merged);
-
- }
- catch(Throwable t)
- {
- log.debug("failed to set value to property: "+ propertyInfo, t);
- }
- }
- }
- }
- else
- {
- return;
- }
- }
-
- /**
- * Process a MetaValue.
- *
- * @param valueElement the persisted xml meta data.
- * @param value the meta value.
- * @return a meta value.
- */
- protected MetaValue processMetaValue(PersistedValue valueElement, MetaValue value)
- {
- MetaType metaType = value.getMetaType();
-
- MetaValue metaValue = null;
- if(metaType.isSimple())
- {
- metaValue = processSimpleValue(
- (PersistedSimpleValue) valueElement,
- (SimpleValue) value);
- }
- else if(metaType.isEnum())
- {
- metaValue = processEnumValue(
- (PersistedEnumValue) valueElement,
- (EnumValue) value);
- }
- else if(metaType.isCollection())
- {
- metaValue = processCollectionValue(
- (PersistedCollectionValue) valueElement,
- (CollectionValue) value);
- }
- else if(metaType.isGeneric())
- {
- metaValue = processGenericValue(
- (PersistedGenericValue) valueElement,
- (GenericValue) value);
- }
- else if(metaType.isComposite())
- {
- metaValue = processCompositeValue(
- (PersistedCompositeValue) valueElement,
- (CompositeValue) value);
- }
- else if(metaType.isTable())
- {
- // FIXME process Table
- }
- else if(metaType.isArray())
- {
- metaValue = processArrayValue(
- (PersistedArrayValue) valueElement,
- (ArrayValue) value);
- }
- else
- {
- throw new IllegalStateException("unknown metaType");
- }
- return metaValue;
- }
-
- /**
- * Process an Enum value.
- *
- * @param enumElement the persisted xml meta data.
- * @param value the enum value.
- * @return a enum value.
- */
- protected EnumValue processEnumValue(PersistedEnumValue enumElement, EnumValue value)
- {
- return new EnumValueSupport(value.getMetaType(), enumElement.getValue());
- }
-
- /**
- * Process a collection.
- * TODO - support merging of collections.
- *
- * @param collection the persisted xml meta data.
- * @param value the collection value.
- * @return a collection value.
- */
- protected CollectionValue processCollectionValue(PersistedCollectionValue collection, CollectionValue value)
- {
- if(collection.size() == 0)
- return value;
-
- // FIXME merge collections
- if(collection.size() != value.getSize())
- {
- log.warn("unable to merge collection: " + value);
- return value;
- }
-
- ArrayList<MetaValue> elementList = new ArrayList<MetaValue>();
- Iterator<PersistedValue> i = collection.getValues().iterator();
- for(MetaValue item : value)
- {
- MetaValue newValue = processMetaValue(i.next(), item);
- if(newValue != null)
- {
- elementList.add(newValue);
- }
- }
- return new CollectionValueSupport(value.getMetaType(), elementList.toArray(new MetaValue[elementList.size()]));
- }
-
- /**
- * Process a GenericValue.
- *
- * @param genericElement the persisted xml meta data.
- * @param value the generic value.
- * @return a generic value.
- */
- protected MetaValue processGenericValue(PersistedGenericValue genericElement, GenericValue value)
- {
- PersistedManagedObject po = genericElement.getManagedObject();
- if(po == null || value.getValue() == null)
- return value;
-
- if(value.getValue() instanceof ManagedObject)
- {
- ManagedObject mo = (ManagedObject) value.getValue();
- processManagedObject(po, mo);
-
- return value;
- }
- else
- {
- throw new IllegalStateException("The value of GenericValue must be a ManagedObject: " + value);
- }
- }
-
- /**
- * Process composite value.
- *
- * @param composite the persisted xml meta data.
- * @param value the composite value.
- * @return a composite value.
- */
- protected CompositeValue processCompositeValue(PersistedCompositeValue composite, CompositeValue value)
- {
- CompositeMetaType metaType = value.getMetaType();
- Map<String, MetaValue> values = new HashMap<String, MetaValue>();
-
- for(String key : composite.keySet())
- {
- MetaValue metaValue = value.get(key);
- if(metaValue == null)
- {
- metaValue = createEmptyMetaValue(metaType.getType(key));
- }
- PersistedValue persistedValue = composite.get(key);
-
- metaValue = processMetaValue(persistedValue, metaValue);
-
- values.put(key, metaValue);
- }
- return new CompositeValueSupport(metaType, values);
- }
-
- /**
- * process an arrayValue.
- * FIXME - support merging of arrays.
- *
- * @param array the persisted xml meta data.
- * @param value the array value.
- * @return a array value.
- */
- protected ArrayValue processArrayValue(PersistedArrayValue array, ArrayValue value)
- {
- // FIXME
- if(array.size() != value.getLength())
- {
- log.debug("cannot merge array: " + value);
- return null;
- }
-
- ArrayList<MetaValue> arrayList = new ArrayList<MetaValue>();
- for(int i = 0; i < value.getLength(); i++)
- {
- PersistedValue persisted = array.getValue(i);
- MetaValue restored = processMetaValue(persisted, (MetaValue) value.getValue(i));
- if(restored != null)
- arrayList.add(restored);
- }
-
- return new ArrayValueSupport(value.getMetaType(), arrayList.toArray(new MetaValue[arrayList.size()]));
- }
-
- /**
- * Process simple value.
- *
- * @param valueElement the persisted xml meta data.
- * @param value the simple value.
- * @return a simple value.
- */
- protected SimpleValue processSimpleValue(PersistedSimpleValue valueElement, SimpleValue value)
- {
- SimpleMetaType metaType = value.getMetaType();
- 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 SimpleValueSupport.wrap(converted);
- }
-
- /**
- * Create a empty meta value, based on a given MetaType.
- *
- * @param metaType the meta type.
- * @return a meta value.
- */
- protected MetaValue createEmptyMetaValue(MetaType metaType)
- {
- MetaValue metaValue = null;
- if(metaType.isSimple())
- {
- metaValue = new SimpleValueSupport((SimpleMetaType) metaType, null);
- }
- else if(metaType.isEnum())
- {
- metaValue = new EnumValueSupport((EnumMetaType) metaType, (String) null);
- }
- else if(metaType.isCollection())
- {
- metaValue = new CollectionValueSupport((CollectionMetaType) metaType);
- }
- else if(metaType.isGeneric())
- {
- // TODO
- }
- else if(metaType.isComposite())
- {
- metaValue = new CompositeValueSupport((CompositeMetaType) metaType);
- }
- else if(metaType.isTable())
- {
- metaValue = new TableValueSupport((TableMetaType) metaType);
- }
- else if(metaType.isArray())
- {
- metaValue = new ArrayValueSupport((ArrayMetaType) metaType);
- }
- return metaValue;
- }
-
- /**
- * 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;
- }
- }
-
-}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -32,7 +32,7 @@
import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
import org.jboss.metadata.spi.MetaData;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectUpdateHandler;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
/**
@@ -48,9 +48,10 @@
/** The managed prefix. */
public static final String PERSISTED_ATTACHMENT_PREFIX = "PERISTED";
- /** The managed update handler. */
- private ManagedObjectUpdateHandler handler = new ManagedObjectUpdateHandler();
+ /** The managed object override handler. */
+ private ManagedGenericOverrideHandler overrideHandler = new ManagedGenericOverrideHandler();
+ /** The managed object factory. */
private final ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
/** The Logger. */
@@ -66,8 +67,6 @@
@Override
protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
- MetaData metaData = unit.getMetaData();
-
// Check all attachments, if they have a managed attachment
// TODO there might be a better way to do that ? :)
Set<String> attachments = unit.getTransientManagedObjects().getAttachments().keySet();
@@ -79,14 +78,21 @@
{
// Get the transient attachment
Object instance = unit.getTransientManagedObjects().getAttachment(attachment);
- // Create the managed object
- ManagedObject mo = factory.initManagedObject(instance, metaData);
- // Update the attachment
- Object o = handler.processManagedObject(persistedManagedObject, mo);
- // Debug
- log.debug("updated attachment with persisted information: " + o);
- // Override
- unit.addAttachment(attachment, o);
+ try
+ {
+ MetaData metaData = unit.getMetaData();
+ ManagedObject original = factory.initManagedObject(instance, metaData);
+
+ // Update the attachment
+ overrideHandler.updateManagedObject(original, persistedManagedObject, instance);
+
+ // Override
+ unit.addAttachment(attachment, original.getAttachment());
+ }
+ catch(Throwable e)
+ {
+ log.debug("Failed to update the persisted attachment information", e);
+ }
}
}
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/deployer/ProfileServicePersistenceDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractElement.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractMapSupport.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice.persistence.xml;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A Map helper class.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractMapSupport<T extends PersistedElement> extends AbstractElement
-{
- /** The map. */
- private Map<String, T> map = new HashMap<String, T>();
-
- public AbstractMapSupport()
- {
- //
- }
-
- public AbstractMapSupport(String name)
- {
- super(name, null);
- }
-
- public AbstractMapSupport(String name, String className)
- {
- super(name, className);
- }
-
- public Set<String> keySet()
- {
- return map.keySet();
- }
-
- public T get(String name)
- {
- return map.get(name);
- }
-
- public void put(String name, T element)
- {
- if(name == null)
- throw new IllegalArgumentException("Null name.");
-
- this.map.put(name, element);
- }
-
- public Collection<T> values()
- {
- return this.map.values();
- }
-
- public void createMap(Collection<T> collection)
- {
- if(collection == null)
- throw new IllegalArgumentException("null children.");
-
- for(T element : collection)
- {
- if(element.getName() == null)
- throw new IllegalStateException("name required for element: "+ element);
-
- this.map.put(element.getName(), element);
- }
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,48 @@
+/*
+ * 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.system.server.profileservice.persistence.xml;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * 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
+{
+ /** The modification info. */
+ ModificationInfo info;
+
+ @XmlAttribute(name = "modification")
+ public ModificationInfo getModificationInfo()
+ {
+ return this.info;
+ }
+
+ public void setModificationInfo(ModificationInfo info)
+ {
+ this.info = info;
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ModificationInfo.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ModificationInfo.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ModificationInfo.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ModificationInfo.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.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
+
+}
+
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -29,6 +29,6 @@
*/
public class PersistedArrayValue extends PersistedCollectionValue
{
-
+
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedArrayValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -33,7 +33,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class PersistedCollectionValue extends AbstractElement implements PersistedValue
+public class PersistedCollectionValue extends AbstractPersisitedValue implements PersistedValue
{
/** The values. */
private List<PersistedValue> values = new ArrayList<PersistedValue>();
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCollectionValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,7 +21,6 @@
*/
package org.jboss.system.server.profileservice.persistence.xml;
-import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -33,9 +32,12 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class PersistedCompositeValue extends AbstractMapSupport<PersistedValue> implements PersistedValue
+public class PersistedCompositeValue extends AbstractPersisitedValue implements PersistedValue
{
+ /** The values */
+ List<PersistedValue> values;
+
@XmlElements( value = {
@XmlElement(name = "simple", type = PersistedSimpleValue.class),
@XmlElement(name = "enum", type = PersistedEnumValue.class),
@@ -47,17 +49,17 @@
})
public List<PersistedValue> getValues()
{
- return new ArrayList<PersistedValue>(super.values());
+ return this.values;
}
public void setValues(List<PersistedValue> values)
{
- super.createMap(values);
+ this.values = values;
}
protected void toString(StringBuilder builder)
{
- builder.append(", keySet = ").append(keySet());
+ builder.append(", values = ").append(this.values);
}
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedCompositeValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedElement.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -30,6 +30,16 @@
public class PersistedEnumValue extends PersistedSimpleValue
{
+ public PersistedEnumValue()
+ {
+ super();
+ }
+
+ public PersistedEnumValue(String name)
+ {
+ super(name);
+ }
+
@Override
protected void toString(StringBuilder builder)
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedEnumValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -23,6 +23,8 @@
import static org.jboss.system.server.profileservice.persistence.xml.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlElement;
/**
@@ -31,9 +33,12 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class PersistedGenericValue extends AbstractElement implements PersistedValue
+public class PersistedGenericValue extends AbstractPersisitedValue implements PersistedValue, Serializable
{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -6858198681439447173L;
+
/** A managed-object. */
private PersistedManagedObject managedObject;
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedGenericValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -23,16 +23,13 @@
import static org.jboss.system.server.profileservice.persistence.xml.PersistenceConstants.MANAGED_OBJECT_ELEMENT_NAME;
-import java.util.ArrayList;
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.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
import org.jboss.xb.annotations.JBossXmlSchema;
@@ -42,19 +39,16 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
- at JBossXmlSchema(
- xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") },
- ignoreUnresolvedFieldOrClass=false,
- namespace = PersistenceConstants.NAMESPACE_1_0,
- elementFormDefault = XmlNsForm.QUALIFIED,
- normalizeSpace=true)
+ at JBossXmlSchema(namespace = PersistenceConstants.NAMESPACE_1_0, elementFormDefault = XmlNsForm.QUALIFIED)
@XmlRootElement(name = MANAGED_OBJECT_ELEMENT_NAME)
- at XmlType(name = "managedObjectType", namespace = PersistenceConstants.NAMESPACE_1_0)
-public class PersistedManagedObject extends AbstractMapSupport<PersistedProperty>
+public class PersistedManagedObject extends AbstractElement
{
- /** The original name. */
- private String originalName;
+ /** The template name. */
+ private String templateName;
+ /** The properties */
+ private List<PersistedProperty> properties;
+
public PersistedManagedObject()
{
//
@@ -70,32 +64,32 @@
super(name, className);
}
- @XmlAttribute(name = "original-name")
- public String getOriginalName()
+ @XmlAttribute(name = "template-name")
+ public String getTemplateName()
{
- return originalName;
+ return templateName;
}
- public void setOriginalName(String originalName)
+ public void setTemplateName(String templateName)
{
- this.originalName = originalName;
+ this.templateName = templateName;
}
@XmlElementWrapper(name="properties")
@XmlElement(name = "property")
public List<PersistedProperty> getProperties()
{
- return new ArrayList(super.values());
+ return this.properties;
}
public void setProperties(List<PersistedProperty> properties)
{
- super.createMap(properties);
+ this.properties = properties;
}
protected void toString(StringBuilder builder)
{
- builder.append(", original-name = ").append(getOriginalName());
+ builder.append(", template-name = ").append(getTemplateName());
}
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedProperty.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -39,8 +39,11 @@
private String className;
/** The value. */
- String value;
+ private String value;
+ /** The modification info. */
+ private ModificationInfo info;
+
public PersistedSimpleValue()
{
//
@@ -79,6 +82,17 @@
this.className = className;
}
+ @XmlAttribute(name = "modification")
+ public ModificationInfo getModificationInfo()
+ {
+ return this.info;
+ }
+
+ public void setModificationInfo(ModificationInfo info)
+ {
+ this.info = info;
+ }
+
@XmlValue
public String getValue()
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,14 +21,31 @@
*/
package org.jboss.system.server.profileservice.persistence.xml;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
/**
- * TODO The persisted TableValue.
+ * The persisted TableValue.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class PersistedTableValue extends AbstractElement implements PersistedValue
+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: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedTableValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -22,7 +22,7 @@
package org.jboss.system.server.profileservice.persistence.xml;
/**
- * A Value.
+ * A persisted value.
*
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -30,5 +30,20 @@
public interface PersistedValue extends PersistedElement
{
+ /**
+ * Get the modification info for this value.
+ *
+ * @return the modification info
+ */
+ ModificationInfo getModificationInfo();
+
+
+ /**
+ * Set the modification info.
+ *
+ * @param info the modification info
+ */
+ void setModificationInfo(ModificationInfo info);
+
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,7 @@
{
/** The xml namespace. */
- public static final String NAMESPACE_1_0 = "urn:jboss:managed-persistence:1.0";
+ public static final String NAMESPACE_1_0 = "urn:org:jboss:profileservice:persistence:managed-object:1.0";
/** The managed-object name. */
public static final String MANAGED_OBJECT_ELEMENT_NAME = "managed-object";
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistenceConstants.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -19,7 +19,7 @@
* 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 = PersistenceConstants.NAMESPACE_1_0,
+ at XmlSchema(namespace = "urn:org:jboss:profileservice:persistence:managed-object:1.0",
elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = { @XmlNs(namespaceURI = "http://www.w3.org/2001/XMLSchema", prefix = "xs") }
)
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URISyntaxException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -33,13 +34,14 @@
import java.util.List;
import java.util.Set;
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
import org.jboss.logging.Logger;
@@ -47,9 +49,9 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
+import org.jboss.profileservice.spi.ProfileDeployment;
import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
import org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects;
@@ -65,11 +67,13 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public abstract class AbstractAttachmentStore
+public class AbstractAttachmentStore implements AttachmentStore
{
+ /** The attachment store root. */
+ private final URI attatchmentStoreRoot;
/** The attachment serializer. */
- protected AttachmentsSerializer serializer;
+ protected AbstractFileAttachmentsSerializer serializer;
/** The deployment factory. */
protected VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
@@ -86,6 +90,20 @@
/** The logger. */
private static final Logger log = Logger.getLogger(AbstractAttachmentStore.class);
+ public AbstractAttachmentStore(File root)
+ {
+ if(root == null)
+ throw new IllegalArgumentException("Null attachmentStoreDir");
+ if(root.exists() && root.isDirectory() == false)
+ throw new IllegalArgumentException("AttachmentStoreRoot is not a directory.");
+ this.attatchmentStoreRoot = root.toURI();
+ }
+
+ public URI getAttachmentStoreRoot()
+ {
+ return this.attatchmentStoreRoot;
+ }
+
public VFSDeploymentFactory getDeploymentFactory()
{
return deploymentFactory;
@@ -106,16 +124,28 @@
this.mainDeployer = mainDeployer;
}
- public AttachmentsSerializer getSerializer()
+ public AbstractFileAttachmentsSerializer getSerializer()
{
return serializer;
}
- public void setSerializer(AttachmentsSerializer serializer)
+ public void setSerializer(AbstractFileAttachmentsSerializer serializer)
{
this.serializer = serializer;
}
+ public Deployment createMCDeployment(ProfileDeployment profileDeployment) throws Exception
+ {
+ if(profileDeployment.getRoot() == null)
+ {
+ return new AbstractDeployment(profileDeployment.getName());
+ }
+ else
+ {
+ return deploymentFactory.createVFSDeployment(profileDeployment.getRoot());
+ }
+ }
+
/**
* Create a VFSDeployment with predetermined managed object.
*
@@ -123,20 +153,24 @@
* @param phase the deployment phase
* @return the VFSDeployment
*/
- protected VFSDeployment loadDeploymentData(VirtualFile file, DeploymentPhase phase) throws Exception
+ public Deployment loadDeploymentData(ProfileDeployment profileDeployment) throws Exception
{
- if(file == null)
- throw new IllegalArgumentException("Cannot create a deployment for a null file.");
+ if(profileDeployment == null)
+ throw new IllegalArgumentException("Null profile deployment.");
boolean trace = log.isTraceEnabled();
+
// Create VFS deployment
- VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
- if(trace)
+ Deployment deployment = createMCDeployment(profileDeployment);
+ if(log.isTraceEnabled())
log.trace("Created deployment: " + deployment);
-
+
+ // TODO also handle normal Deployments
+ if(profileDeployment.getRoot() == null)
+ return deployment;
+
// simpleName + hash
- String deploymentPath = createRelativeDeploymentPath(deployment);
-
+ String deploymentPath = createRelativeDeploymentPath(profileDeployment);
if(trace)
log.trace("trying to load attachment from relative path: " + deploymentPath);
@@ -156,7 +190,7 @@
// If the deployment has changes we skip restoring the persisted metadata.
// TODO delete attachments ?
// TODO check metadata locations
- if(attachPredeterminedObject(file, attachmentMetaData) == false)
+ if(attachPredeterminedObject(profileDeployment.getRoot(), attachmentMetaData) == false)
{
log.debug("Not using the persisted metadata, as the deployment was modified.");
return deployment;
@@ -164,7 +198,7 @@
}
catch(IOException e)
{
- log.error("failed to get LastModified date for file, not using persisted metadata: "+ file.getPathName());
+ log.error("failed to get LastModified date for file, not using persisted metadata: "+ profileDeployment.getName());
return deployment;
}
@@ -205,17 +239,27 @@
* @param comp the managed component.
* @throws Exception
*/
- protected void updateDeployment(VFSDeployment deployment, DeploymentPhase phase, ManagedComponent comp)
+ public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp)
throws Exception
{
if(deployment == null)
- throw new IllegalArgumentException("VFSDeployment may not be null.");
+ throw new IllegalArgumentException("ProfileDeployment may not be null.");
+ if(deployment.getRoot() == null)
+ {
+ // TODO
+ log.debug("Cannot persist attachments for non VFS based deployment: " + deployment);
+ return;
+ }
+
if(comp == null)
throw new IllegalArgumentException("ManagedComponent may not be null.");
boolean trace = log.isTraceEnabled();
+ // Log
+ log.debug("updating deployment: "+ deployment + ", component: "+ comp);
+
// simpleName + hash
String deploymentPath = createRelativeDeploymentPath(deployment);
RepositoryAttachmentMetaData savedMetaData = loadAttachmentMetaData(deploymentPath);
@@ -369,7 +413,7 @@
boolean trace = log.isTraceEnabled();
// Save attachments for the root context
- if(metaData.getAttachments() != null && !metaData.getAttachments().isEmpty())
+ if(metaData.getAttachments() != null && metaData.getAttachments().isEmpty() == false)
{
for(AttachmentMetaData attachment : metaData.getAttachments())
{
@@ -391,7 +435,7 @@
}
// Save the attachments for the childs
- if(metaData.getChildren() != null && ! metaData.getChildren().isEmpty())
+ if(metaData.getChildren() != null && metaData.getChildren().isEmpty() == false)
{
for(RepositoryAttachmentMetaData child : metaData.getChildren())
{
@@ -409,12 +453,8 @@
*/
protected PersistedManagedObject createPersistedMetaData(ManagedObject mo)
{
- // TODO - load already persisted attachment.
- PersistedManagedObject root = new PersistedManagedObject();
- // Process
- handler.processManagedObject(root, mo);
// Return
- return root;
+ return handler.createPersistenceMetaData(mo);
}
/**
@@ -426,7 +466,7 @@
* @param deploymentPath the path to the attachment
* @param attachmentMetaData the meta data
*/
- protected void rebuildStructureContext(VFSDeployment deployment,
+ protected void rebuildStructureContext(Deployment deployment,
String contextName,
String deploymentPath,
RepositoryAttachmentMetaData attachmentMetaData,
@@ -498,7 +538,7 @@
// Process children
List<RepositoryAttachmentMetaData> children = attachmentMetaData.getChildren();
- if(children != null && ! children.isEmpty())
+ if(children != null && children.isEmpty() == false)
{
for(RepositoryAttachmentMetaData childMetaData : children)
{
@@ -524,14 +564,18 @@
* @return the relative name
* @throws Exception
*/
- protected String createRelativeDeploymentPath(VFSDeployment deployment) throws Exception
+ protected String createRelativeDeploymentPath(ProfileDeployment deployment) throws Exception
{
if(deployment == null)
throw new IllegalStateException("Null deployment.");
- String hash = HashGenerator.createHash(deployment);
+ // deployment URI toString
+ String pathName = deployment.getRoot().toURI().toString();
+ String fileName = deployment.getRoot().getName();
+ // Generate hash
+ String hash = HashGenerator.createHash(pathName);
// simple name + "-" + hash
- return deployment.getSimpleName() + "-" + hash + File.separator;
+ return fileName + "-" + hash + File.separator;
}
@@ -654,11 +698,9 @@
* @throws MalformedURLException
* @throws URISyntaxException
*/
- public static String createHash(VFSDeployment deployment)
+ public static String createHash(String pathName)
throws NoSuchAlgorithmException, MalformedURLException, URISyntaxException
{
- // deployment URI toString
- String pathName = deployment.getRoot().toURI().toString();
// buffer
StringBuffer buffer = new StringBuffer();
// formatter
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractBootstrapProfileFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,263 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileKeyMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+
+/**
+ * The abstract profile factory.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractBootstrapProfileFactory
+{
+ /** The profile map. */
+ private Map<ProfileKey, ProfileMetaData> profileMap = new HashMap<ProfileKey, ProfileMetaData>();
+
+ /** The profiles map. */
+ private Map<ProfileKey, List<ProfileMetaData>> profilesMetaData = new HashMap<ProfileKey, List<ProfileMetaData>>();
+
+ /** The profile factory. */
+ private AbstractProfileFactory profileFactory;
+
+ /** The logger */
+ protected final Logger log = Logger.getLogger(getClass());
+
+ public AbstractProfileFactory getProfileFactory()
+ {
+ return profileFactory;
+ }
+
+ public void setProfileFactory(AbstractProfileFactory profileFactory)
+ {
+ this.profileFactory = profileFactory;
+ }
+
+ /**
+ * Create the meta data required for this profile.
+ *
+ * @param key the root profile key.
+ * @throws Exception
+ */
+ protected abstract void createProfileMetaData(ProfileKey key, URL url) throws Exception;
+
+ /**
+ * Create the profiles required for this profile.
+ *
+ * @param rootKey the root profile key.
+ * @param uri the profile root uri for parsing.
+ * @return a collection of profiles
+ * @throws Exception
+ */
+ public Collection<Profile> createProfiles(ProfileKey rootKey, URL url) throws Exception
+ {
+ if(rootKey == null)
+ throw new IllegalArgumentException("Null profile key");
+
+ // Create the profile meta data.
+ createProfileMetaData(rootKey, url);
+
+ Map<ProfileKey, Profile> profiles = new HashMap<ProfileKey, Profile>();
+ // Create the real profiles
+ createProfiles(profiles, rootKey);
+
+ return profiles.values();
+ }
+
+ /**
+ * Create profiles
+ *
+ * @param profiles the profiles map
+ * @param key the ProfileKey
+ * @throws Exception
+ */
+ public void createProfiles(Map<ProfileKey, Profile> profiles, ProfileKey key) throws Exception
+ {
+ ProfileMetaData profileMetaData = this.profileMap.get(key);
+ if(profileMetaData == null)
+ throw new IllegalStateException("Could not find metaData for key: " + key);
+
+ List<ProfileKey> subProfiles = new ArrayList<ProfileKey>();
+
+ // Create the profile
+ createProfile(profiles, subProfiles, key, profileMetaData);
+
+ }
+
+ /**
+ * Create a Profile with it's sub-profiles.
+ *
+ * @param profiles the profiles map
+ * @param subProfiles the sub-profiles list
+ * @param key the ProfileKey
+ * @param profileMetaData the profile meta data
+ * @throws Exception
+ */
+ public void createProfile(Map<ProfileKey, Profile> profiles, List<ProfileKey> subProfiles, ProfileKey key, ProfileMetaData profileMetaData) throws Exception
+ {
+ // Don't process a profile twice
+ if(profiles.containsKey(key))
+ return;
+
+ if(log.isTraceEnabled())
+ log.trace("Creating profile for key: " + key);
+
+ // First recursively process the sub profiles
+ processSubProfiles(profiles, subProfiles, profileMetaData.getSubprofiles());
+
+ // Create the profile
+ Profile profile = profileFactory.createProfile(key, profileMetaData, subProfiles);
+
+ // Add to the profileMap
+ profiles.put(key, profile);
+
+ // FIXME add a implicit dependency for the next
+ if(subProfiles.contains(key) == false)
+ subProfiles.add(key);
+ }
+
+ /**
+ * Process the sub-profiles.
+ *
+ * @param profiles the profiles map
+ * @param subProfileKeys the sub-profiles
+ * @param subProfilesMetaData a list of sub-profile metadata
+ * @throws Exception
+ */
+ private void processSubProfiles(Map<ProfileKey, Profile> profiles, List<ProfileKey> subProfileKeys, List<SubProfileMetaData> subProfilesMetaData) throws Exception
+ {
+ if(subProfilesMetaData == null || subProfilesMetaData.isEmpty())
+ return;
+
+ for(SubProfileMetaData subProfile : subProfilesMetaData)
+ {
+ ProfileKey subProfileKey = createProfileKey(subProfile);
+ if(this.profileMap.containsKey(subProfileKey))
+ {
+ createProfile(profiles, subProfileKeys, subProfileKey, this.profileMap.get(subProfileKey));
+ }
+ else if(this.profilesMetaData.containsKey(subProfileKey))
+ {
+ List<ProfileMetaData> subProfileAliases = this.profilesMetaData.get(subProfileKey);
+ processSubProfileAlias(profiles, subProfileKeys, subProfileAliases);
+ }
+ else
+ {
+ throw new IllegalStateException("Could not resolve profile meta data for key: " + subProfileKey);
+ }
+ }
+ }
+
+ /**
+ * Process the profiles alias for a sub-profile.
+ *
+ * @param profiles the profiles map
+ * @param subProfileKeys the sub-profiles
+ * @param subprofileAliases the profile meta data for the sub-profiles
+ * @throws Exception
+ */
+ private void processSubProfileAlias(Map<ProfileKey, Profile> profiles, List<ProfileKey> subProfileKeys, List<ProfileMetaData> subprofileAliases) throws Exception
+ {
+ if(subprofileAliases == null || subprofileAliases.isEmpty())
+ return;
+
+ for(ProfileMetaData metaData : subprofileAliases)
+ {
+ ProfileKey key = createProfileKey(metaData);
+ createProfile(profiles, subProfileKeys, key, metaData);
+ }
+ }
+
+ /**
+ * Add profile meta data.
+ *
+ * @param key the profile key.
+ * @param metaData the profile meta data.
+ */
+ protected void addProfile(ProfileKey key, ProfileMetaData metaData)
+ {
+ // The keys have be unique
+ if(this.profileMap.containsKey(key))
+ throw new IllegalStateException("Duplicate key: " + key);
+
+ if(this.profilesMetaData.containsKey(key))
+ throw new IllegalStateException("Duplicate key: " + key);
+
+ this.profileMap.put(key, metaData);
+ }
+
+ /**
+ * Add the profiles meta data, which is basically is a reference to
+ * a list of profile meta data.
+ *
+ * @param key the profile key.
+ * @param metaData a list of profile meta data.
+ */
+ protected void addProfiles(ProfileKey key, List<ProfileMetaData> metaData)
+ {
+ if(this.profileMap.containsKey(key))
+ {
+ // Ignore the default key, which gets generated for <profiles/>
+ if(ProfileKey.DEFAULT.equals(key.getDomain())
+ && ProfileKey.DEFAULT.equals(key.getServer())
+ && ProfileKey.DEFAULT.equals(key.getName()))
+ {
+ return;
+ }
+ else
+ {
+ throw new IllegalStateException("Duplicate key: " + key);
+ }
+ }
+
+ // Create a entry for <profiles>
+ List<ProfileMetaData> profileList = this.profilesMetaData.get(key);
+ if(profileList == null)
+ {
+ profileList = new ArrayList<ProfileMetaData>();
+ this.profilesMetaData.put(key, profileList);
+ }
+
+ if(metaData != null && metaData.isEmpty() == false)
+ {
+ profileList.addAll(metaData);
+ }
+ }
+
+ public static ProfileKey createProfileKey(ProfileKeyMetaData md)
+ {
+ return new ProfileKey(md.getDomain(), md.getServer(), md.getName());
+ }
+}
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,230 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+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.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
+ protected boolean acceptsDeployment(String name)
+ {
+ if(hasDeploymentContentFlags(name, ignoreFlags))
+ {
+ if(log.isTraceEnabled())
+ log.trace("Ignoring locked application: " + name);
+
+ return false;
+ }
+ return super.acceptsDeployment(name);
+ }
+
+ @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;
+ }
+
+}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -26,16 +26,15 @@
import java.io.NotSerializableException;
import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
/**
* A base AttachmentsSerializer that uses a file system based store.
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
*/
public abstract class AbstractFileAttachmentsSerializer
- implements AttachmentsSerializer
{
private static final Logger log = Logger.getLogger(AbstractFileAttachmentsSerializer.class);
@@ -43,16 +42,19 @@
private static final String ATTACHMENT_SUFFIX = ".attachment";
/** The deployment pre-processed attachments store dir */
- private File attachmentsStoreDir;
+ private final File attachmentsStoreDir;
+ public AbstractFileAttachmentsSerializer(File dir)
+ {
+ if(dir == null)
+ throw new IllegalArgumentException("Null store dir.");
+ this.attachmentsStoreDir = dir;
+ }
+
public File getAttachmentsStoreDir()
{
return attachmentsStoreDir;
}
- public void setAttachmentsStoreDir(File attachmentsStoreDir)
- {
- this.attachmentsStoreDir = attachmentsStoreDir;
- }
public <T> T loadAttachment(String baseName, Class<T> expected)
throws Exception
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,78 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+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 abstract class AbstractProfileAction
+{
+ /** The logger. */
+ protected final Logger log = Logger.getLogger(getClass());
+
+ public abstract void install(Profile profile) throws Exception;
+
+ public abstract void uninstall(Profile profile) throws Exception;
+
+ /**
+ * Install.
+ *
+ * @param context the profile context.
+ * @throws Exception
+ */
+ public void install(ProfileContext context) throws Exception
+ {
+ Profile profile = context.getProfile();
+ if(profile == null)
+ return;
+
+ // Install
+ install(profile);
+ }
+
+ /**
+ * Uninstall.
+ *
+ * @param context the profile context.
+ */
+ public void uninstall(ProfileContext context)
+ {
+ Profile profile = context.getProfile();
+ if(profile == null)
+ return;
+
+ try
+ {
+ // Uninstall
+ uninstall(profile);
+ }
+ catch (Throwable t)
+ {
+ log.error("Error when uninstalling profile: " + profile, t);
+ }
+ }
+}
+
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileDeployment.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,157 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The profile deployment.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileDeployment implements ProfileDeployment
+{
+
+ /** The name. */
+ private String name;
+
+ /** The vfs root. */
+ private VirtualFile root;
+
+ /** The attachments. */
+ private Map<String, Object> attachments = new ConcurrentHashMap<String, Object>();
+
+ /** The serialVersionUID. */
+ private static final long serialVersionUID = -2600392045205267112L;
+
+ /**
+ * Get the vfs file name safely.
+ * @see VFSDeployment
+ *
+ * @param root the virtual file
+ * @return the name
+ */
+ 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();
+ }
+ }
+
+ public AbstractProfileDeployment(String name)
+ {
+ if(name == null)
+ throw new IllegalArgumentException("Null name.");
+ this.name = name;
+ }
+
+ public AbstractProfileDeployment(VirtualFile root)
+ {
+ this(safeVirtualFileName(root));
+ this.root = root;
+ }
+
+ /**
+ * Get the deployment name.
+ *
+ * @return the name
+ */
+ public String getName()
+ {
+ return this.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;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Get all attachments.
+ *
+ * @return the attachments
+ */
+ public Map<String, Object> getAttachments()
+ {
+ return Collections.unmodifiableMap(this.attachments);
+ }
+
+ public String toString()
+ {
+ return "AbstractProfileDeployment(" + root != null ? root.getName() : name + ")";
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,91 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.system.server.profile.repository.AbstractProfile;
+
+/**
+ * The abstract profile factory.
+ *
+ * TODO this should create the profile based on the meta data,
+ * as it only creates a AbstractProfile with it's DeploymentRepository
+ * at the moment.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileFactory implements ProfileFactory
+{
+ /** The deployment repository factory. */
+ private ProfileRepository profileRepository;
+
+ public String[] getTypes()
+ {
+ // For further use
+ return null;
+ }
+
+ public ProfileRepository getProfileRepository()
+ {
+ return profileRepository;
+ }
+
+ public void setProfileRepository(ProfileRepository profileRepository)
+ {
+ this.profileRepository = profileRepository;
+ }
+
+ public Profile createProfile(ProfileKey key, ProfileMetaData metaData) throws Exception
+ {
+ return createProfile(key, metaData, Collections.EMPTY_LIST);
+ }
+
+ public Profile createProfile(ProfileKey key, ProfileMetaData metaData, List<ProfileKey> subProfiles) throws Exception
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+ if(metaData == null)
+ throw new IllegalArgumentException("Null profile meta data.");
+
+ // Start to create the profile
+ DeploymentRepository repository = profileRepository.createProfileDeploymentRepository(key, metaData);
+
+ // Create the profile
+ AbstractProfile profile = new AbstractProfile(repository, key);
+
+ // Copy the sub-profile keys
+ profile.setSubProfiles(new ArrayList<ProfileKey>(subProfiles));
+
+ return profile;
+ }
+
+}
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+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<?>[] methodTypes = 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) throws Exception
+ {
+ invoke(profile, getUninstallMethod());
+ }
+
+ protected static void invoke(Profile profile, String method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
+ {
+ Method m = null;
+ try
+ {
+ m = profile.getClass().getMethod(method, methodTypes);
+ }
+ catch(NoSuchMethodException ignore)
+ {
+ return;
+ }
+ boolean isAccessible = m.isAccessible();
+ try
+ {
+ m.setAccessible(true);
+ m.invoke(profile, args);
+ }
+ finally
+ {
+ m.setAccessible(isAccessible);
+ }
+ }
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,579 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerContextActions;
+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.logging.Logger;
+import org.jboss.profileservice.spi.NoSuchProfileException;
+import org.jboss.profileservice.spi.Profile;
+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 ProfileService.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileService implements ProfileService, ControllerContextActions
+{
+
+ /** The default profile. */
+ private ProfileKey defaultProfile;
+
+ /** The registered profiles. */
+ private Map<ProfileKey, ProfileContext> registeredProfiles = new ConcurrentHashMap<ProfileKey, ProfileContext>();
+
+ /** The active profiles. */
+ private List<ProfileKey> activeProfiles = new CopyOnWriteArrayList<ProfileKey>();
+
+ /** The deployment manager. */
+ private DeploymentManager deploymentManager;
+
+ /** The management view. */
+ private ManagementView managementView;
+
+ /** The main deployer. */
+ private MainDeployerAdapter deployer;
+
+ /** The controller. */
+ private Controller controller;
+
+ /** The deploy state */
+ public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy");
+
+ /** The profileActions. */
+ private Map<ControllerState, AbstractProfileAction> profileActions = new HashMap<ControllerState, AbstractProfileAction>();
+
+ /** The Logger. */
+ private final static Logger log = Logger.getLogger(AbstractProfileService.class);
+
+ public AbstractProfileService(AbstractController controller)
+ {
+ if(controller == null)
+ throw new IllegalArgumentException("Null controller.");
+ // Create a scoped controller
+ this.controller = new ScopedProfileServiceController(controller);
+ }
+
+ public ProfileKey getDefaultProfile()
+ {
+ return defaultProfile;
+ }
+
+ public void setDefaultProfile(ProfileKey defaultProfile)
+ {
+ this.defaultProfile = defaultProfile;
+ }
+
+ public MainDeployerAdapter getDeployer()
+ {
+ return deployer;
+ }
+
+ public void setDeployer(MainDeployerAdapter deployer)
+ {
+ this.deployer = deployer;
+ }
+
+ public DeploymentManager getDeploymentManager()
+ {
+ return this.deploymentManager;
+ }
+
+ public void setDeploymentManager(DeploymentManager deploymentManager)
+ {
+ this.deploymentManager = deploymentManager;
+ }
+
+ public ManagementView getViewManager()
+ {
+ return this.managementView;
+ }
+
+ public void setViewManager(ManagementView managementView)
+ {
+ this.managementView = managementView;
+ }
+
+ public String[] getDomains()
+ {
+ // TODO do we need that ?
+ Collection<String> domains = new ArrayList<String>();
+ for(ProfileKey key : activeProfiles)
+ domains.add(key.getDomain());
+ return domains.toArray(new String[domains.size()]);
+ }
+
+ public String[] getProfileDeploymentNames(ProfileKey key) throws NoSuchProfileException
+ {
+ Profile profile = getActiveProfile(key);
+ Collection<String> deploymentNames = profile.getDeploymentNames();
+ return deploymentNames.toArray(new String[deploymentNames.size()]);
+ }
+
+ public Collection<ProfileKey> getProfileKeys()
+ {
+ return new ArrayList<ProfileKey>(this.registeredProfiles.keySet());
+ }
+
+ /**
+ * Obtain the registered profile for the key.
+ *
+ * @param key - the key for the profile
+ * @return the matching profile.
+ * @throws NoSuchProfileException if there is no such profile registered.
+ */
+ public Profile getProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+
+ ProfileContext profile = this.registeredProfiles.get(key);
+ if(profile == null)
+ throw new NoSuchProfileException("No such profile: " + key);
+
+ return profile.getProfile();
+ }
+
+ public Collection<ProfileKey> getActiveProfileKeys()
+ {
+ return Collections.unmodifiableCollection(this.activeProfiles);
+ }
+
+ /**
+ * Obtain the active profile for the key.
+ *
+ * @param key - the key for the profile
+ * @return the matching active profile.
+ * @throws NoSuchProfileException if there is no such profile active.
+ */
+ public Profile getActiveProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+
+ ProfileContext profile = null;
+ if(this.activeProfiles.contains(key))
+ profile = (ProfileContext) controller.getInstalledContext(key);
+
+ // If the key is a default key, fallback to the injected default key
+ if(key.isDefaultKey() && this.defaultProfile != null)
+ profile = (ProfileContext) controller.getInstalledContext(this.defaultProfile);
+
+ if(profile == null)
+ throw new NoSuchProfileException("Profile not installed: " + key);
+ return profile.getProfile();
+ }
+
+ /**
+ * Create the profile service actions.
+ *
+ * @throws Exception
+ */
+ public void create() throws Exception
+ {
+ if(this.controller == null)
+ throw new IllegalStateException("Null controller.");
+ if(this.deployer == null)
+ throw new IllegalStateException("Null main deployer.");
+
+ // FIXME this should be moved to static actions
+ this.profileActions.put(ControllerState.CREATE, new ProfileCreateAction());
+ this.profileActions.put(ControllerState.START, new ProfileStartAction());
+ this.profileActions.put(DEPLOY_STATE, new ProfileDeployAction(deployer));
+ this.profileActions.put(ControllerState.INSTALLED, new ProfileInstallAction());
+ }
+
+ /**
+ * Destroy the profileService.
+ *
+ */
+ public void destroy()
+ {
+ //
+ this.profileActions.clear();
+ }
+
+ /**
+ * Create and register a profile.
+ *
+ * @param metaData the profile meta data.
+ * @throws Exception
+ */
+ public ProfileKey createProfile(ProfileMetaData metaData) throws Exception
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("Null meta data");
+
+ // FIXME
+ throw new IllegalStateException("NYI");
+ }
+
+ /**
+ * Register a Profile.
+ *
+ * @param profile the profile.
+ * @throws Exception
+ */
+ public void registerProfile(Profile profile) throws Exception
+ {
+ if(profile == null)
+ throw new IllegalArgumentException("Null profile.");
+
+ ProfileKey key = profile.getKey();
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+ if(registeredProfiles.get(profile.getKey()) != null)
+ return;
+
+ if(controller.isShutdown())
+ throw new IllegalStateException("Controller is shutdown.");
+
+ log.debug("registering profile: " + profile);
+ ProfileContext context = new ProfileContext(profile, this);
+ try
+ {
+ controller.install(context);
+ this.registeredProfiles.put(key, context);
+ }
+ catch(Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ /**
+ * Activate a registered profile.
+ *
+ * @param key the profile key.
+ * @throws NoSuchProfileException if there is no such profile registered.
+ * @throws Exception
+ */
+ public void activateProfile(ProfileKey key) throws Exception
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+ if(controller.isShutdown())
+ throw new IllegalStateException("Controller is shutdown.");
+ if(this.activeProfiles.contains(key))
+ return;
+
+ ProfileContext context = this.registeredProfiles.get(key);
+ if(context == null)
+ throw new NoSuchProfileException("No such profile: "+ key);
+
+ try
+ {
+ log.debug("Activating profile: " + context.getProfile());
+ controller.change(context, ControllerState.INSTALLED);
+ }
+ catch(Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+
+ // TODO let the caller validate
+ // Check if the profile was activated successfully
+ validate(context);
+ }
+
+ public void validateProfile(ProfileKey key) throws Exception
+ {
+ ProfileContext profile = this.registeredProfiles.get(key);
+ if(profile == null)
+ throw new NoSuchProfileException("No such profile registered: "+ key);
+
+ validate(profile);
+ }
+
+ /**
+ * 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());
+ }
+
+ public void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
+ {
+ if(context instanceof ProfileContext == false)
+ return;
+ // TODO
+ AbstractProfileAction action = this.profileActions.get(toState);
+ if(action != null)
+ action.install((ProfileContext) context);
+ }
+
+ public void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
+ {
+ if(context instanceof ProfileContext == false)
+ return;
+ // TODO
+ AbstractProfileAction action = this.profileActions.get(fromState);
+ if(action != null)
+ action.uninstall((ProfileContext) context);
+ }
+
+ /**
+ * Deactivate the profile.
+ *
+ * @param key the profile key.
+ * @throws NoSuchProfileException if the profile is not active.
+ */
+ public void deactivateProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+
+ if(this.activeProfiles.contains(key) == false)
+ throw new NoSuchProfileException("No active profile for: " + key);
+
+ if(controller.isShutdown())
+ return;
+
+ ControllerContext context = controller.getContext(key, ControllerState.INSTALLED);
+ if(context == null)
+ throw new IllegalStateException("Profile not installed: "+ key);
+ try
+ {
+ log.debug("deactivating profile: " + key);
+ controller.change(context, ControllerState.NOT_INSTALLED);
+
+ // TODO release other not needed contexts ?
+ }
+ catch(Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ /**
+ * Unregister a profile.
+ *
+ * @param key the profile key
+ * @throws NoSuchProfileException if the profile is not registered.
+ */
+ public void unregisterProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+
+ if(this.activeProfiles.contains(key))
+ throw new IllegalStateException("Cannot unregister active profile: "+ key);
+
+ if(this.registeredProfiles.containsKey(key) == false)
+ throw new NoSuchProfileException("Profile not registered: " + key);
+
+ log.debug("unregistering profile: " + key);
+ this.registeredProfiles.remove(key);
+
+ if(controller.isShutdown())
+ return;
+
+ controller.uninstall(key);
+ }
+
+ /**
+ * Delegates to unregisterProfile(ProfileKey)
+ *
+ * @param profile
+ * @throws NoSuchProfileException if the profile is not registered.
+ */
+ public void unregisterProfile(Profile profile) throws NoSuchProfileException
+ {
+ if(profile == null)
+ throw new IllegalArgumentException("Null profile.");
+
+ unregisterProfile(profile.getKey());
+ }
+
+ /**
+ * 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)
+ {
+ 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());
+ }
+
+ /**
+ * A simple lifecycle action to add/remove a profile to the activeProfiles.
+ */
+ private class ProfileInstallAction extends AbstractProfileAction
+ {
+ public void install(Profile profile) throws Exception
+ {
+ // activate profile
+ activeProfiles.add(0, profile.getKey());
+ }
+ public void uninstall(Profile profile)
+ {
+ // release profile
+ activeProfiles.remove(profile.getKey());
+ }
+ }
+
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractVFSProfileSource.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractVFSProfileSource.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractVFSProfileSource.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractVFSProfileSource.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,274 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.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.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 phase deployment files keyed by VirtualFile URI string. */
+ private final Map<String, VirtualFile> applicationVFCache = new ConcurrentHashMap<String, VirtualFile>();
+
+ /** 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 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();
+ }
+
+ public void addDeployment(String vfsPath, ProfileDeployment d) throws Exception
+ {
+ if(vfsPath == null)
+ throw new IllegalArgumentException("Null vfsPath");
+ 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();
+ }
+
+ public ProfileDeployment getDeployment(String vfsPath) throws NoSuchDeploymentException
+ {
+ if(vfsPath == null)
+ throw new IllegalArgumentException("Null vfsPath");
+
+ return this.applicationCtxs.get(vfsPath);
+ }
+
+ 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>();
+ addedDeployments(added, applicationDir);
+ for (VirtualFile vf : added)
+ {
+ ProfileDeployment vfCtx = createDeployment(vf);
+ addDeployment(vfCtx.getName(), vfCtx);
+ }
+ }
+
+ protected void addedDeployments(List<VirtualFile> list, VirtualFile root) throws IOException, URISyntaxException
+ {
+ if(root.isLeaf())
+ {
+ addedDeployment(list, root);
+ }
+ else
+ {
+ List<VirtualFile> components = root.getChildren();
+ for (VirtualFile component : components)
+ {
+ addedDeployment(list, component);
+ }
+ }
+ }
+
+ protected void addedDeployment(List<VirtualFile> list, VirtualFile component) throws IOException, URISyntaxException
+ {
+ // Excluding files from scanning
+ if(deploymentFilter != null && ! this.deploymentFilter.accepts(component))
+ {
+ if(log.isTraceEnabled())
+ log.trace("ignoring "+ component);
+ return;
+ }
+
+ String key = component.toURI().toString();
+ if(acceptsDeployment(key) == false)
+ return;
+
+ if (component.isLeaf())
+ {
+ list.add(component);
+ }
+ else if (component.getName().indexOf('.') == -1)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addedDeployments(list, component);
+ }
+ else
+ {
+ list.add(component);
+ }
+ }
+
+ protected boolean acceptsDeployment(String name)
+ {
+ if (applicationCtxs.containsKey(name) == true)
+ return false;
+
+ return true;
+ }
+
+ 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;
+ }
+
+ protected ProfileDeployment createDeployment(VirtualFile vf) throws Exception
+ {
+ return new AbstractProfileDeployment(vf);
+ }
+
+ protected VirtualFile getCachedVirtualFile(String name)
+ {
+ return this.applicationVFCache.get(name);
+ }
+
+ 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;
+ }
+
+ protected void updateLastModfied()
+ {
+ this.lastModified = System.currentTimeMillis();
+ }
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AttachmentsResource.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AttachmentsResource.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AttachmentsResource.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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.system.server.profileservice.repository;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.Map;
-
-import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.profileservice.spi.repository.Capability;
-import org.jboss.profileservice.spi.repository.Repository;
-import org.jboss.profileservice.spi.repository.Requirement;
-import org.jboss.profileservice.spi.repository.Resource;
-import org.jboss.profileservice.spi.repository.Version;
-
-/**
- * A Resource implementation for a VFSDeployment attachments.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AttachmentsResource implements Resource
-{
- private String vfsPath;
- private Repository repository;
- private String[] categories = {};
- private Capability[] capabilities = {};
- private Map<String, Object> props;
-
- public AttachmentsResource(String vfsPath, Attachments edits, Repository repository)
- {
- this.vfsPath = vfsPath;
- this.repository = repository;
- this.props = Collections.singletonMap("attachments", (Object)edits);
- }
-
- public Capability[] getCapabilities()
- {
- return capabilities;
- }
-
- public String[] getCategories()
- {
- return categories;
- }
-
- public String getId()
- {
- return vfsPath;
- }
-
- public String getPresentationName()
- {
- return vfsPath;
- }
-
- public Map getProperties()
- {
- return props;
- }
-
- public Repository getRepository()
- {
- return repository;
- }
-
- public Requirement[] getRequirements()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getSymbolicName()
- {
- return vfsPath;
- }
-
- public URI getURI()
- {
- URI repoURI = repository.getURI();
- URI uri = null;
- try
- {
- // TODO: this probably does not work
- uri = repoURI.resolve(vfsPath);
- }
- catch(Exception e)
- {
- throw new IllegalStateException(e);
- }
- return uri;
- }
-
- public Version getVersion()
- {
- // TODO Auto-generated method stub
- return null;
- }
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/CapabilityImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/CapabilityImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/CapabilityImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,67 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.jboss.profileservice.spi.repository.Capability;
-
-/**
- * Default Capability implementation
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class CapabilityImpl implements Capability
-{
- private String name;
- private Map<String, Object> props;
-
- public CapabilityImpl(String name)
- {
- this(name, Collections.EMPTY_MAP);
- }
- public CapabilityImpl(String name, Map<String, Object> props)
- {
- this.name = name;
- this.props = props;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Map<String, Object> getProperties()
- {
- return props;
- }
- public void setProperties(Map<String, Object> props)
- {
- this.props = props;
- }
- public Object addProperty(String name, Object value)
- {
- return props.put(name, value);
- }
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultDeploymentRepositoryFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultDeploymentRepositoryFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultDeploymentRepositoryFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultDeploymentRepositoryFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,150 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.ImmutableProfileSourceMetaData;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * The default repository factory for immutable and mutable repositories.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultDeploymentRepositoryFactory implements DeploymentRepositoryFactory
+{
+ /** The mutable type. */
+ public final static String MUTABLE_TYPE = HotDeploymentProfileSourceMetaData.class.getName();
+
+ /** The immutable type. */
+ public final static String IMMUTABLE_TYPE = ImmutableProfileSourceMetaData.class.getName();
+
+ /** The repository types. */
+ public final static Collection<String> types;
+
+ /** The deployment filter. */
+ private VirtualFileFilter deploymentFilter;
+
+ /** The structure modification checker */
+ private StructureModificationChecker checker;
+
+ static
+ {
+ types = Arrays.asList(MUTABLE_TYPE, IMMUTABLE_TYPE);
+ }
+
+ public String[] getTypes()
+ {
+ return types.toArray(new String[types.size()]);
+ }
+
+ public VirtualFileFilter getDeploymentFilter()
+ {
+ return deploymentFilter;
+ }
+
+ public void setDeploymentFilter(VirtualFileFilter deploymentFilter)
+ {
+ this.deploymentFilter = deploymentFilter;
+ }
+
+ public StructureModificationChecker getChecker()
+ {
+ return checker;
+ }
+
+ public void setChecker(StructureModificationChecker checker)
+ {
+ this.checker = checker;
+ }
+
+ public DeploymentRepository createDeploymentRepository(ProfileKey key, ProfileSourceMetaData metaData)
+ throws Exception
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("Null metaData");
+
+ // Sanity check
+ String repositoryType = metaData.getType();
+ if(repositoryType == null)
+ throw new IllegalArgumentException("Null repository type.");
+ if(types.contains(repositoryType) == false)
+ throw new IllegalArgumentException("Cannot handle type: " + repositoryType);
+
+ boolean mutable = false;
+ if(repositoryType.equals(MUTABLE_TYPE))
+ {
+ mutable = true;
+ }
+
+ return createDeploymentRepository(mutable, key, createUris(metaData));
+ }
+
+ protected DeploymentRepository createDeploymentRepository(boolean mutable, ProfileKey key, URI[] uris) throws Exception
+ {
+ if(key == null)
+ throw new IllegalArgumentException("Null profile key.");
+ if(uris == null)
+ throw new IllegalArgumentException("Null uris");
+
+ if(mutable)
+ {
+ MutableDeploymentRepository repository = new MutableDeploymentRepository(key, uris);
+ // Manually inject beans :)
+ repository.setDeploymentFilter(deploymentFilter);
+ repository.setChecker(checker);
+
+ return repository;
+ }
+ else
+ {
+ ImmutableDeploymentRepository repository = new ImmutableDeploymentRepository(key, uris);
+ repository.setDeploymentFilter(deploymentFilter);
+
+ return repository;
+ }
+ }
+
+ protected URI[] createUris(ProfileSourceMetaData metaData) throws URISyntaxException
+ {
+ List<URI> uris = new ArrayList<URI>();
+ for(String source : metaData.getSources())
+ {
+ URI uri = new URI(source);
+ uris.add(uri);
+ }
+ return uris.toArray(new URI[uris.size()]);
+ }
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DefaultProfileDeploymentFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,60 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Basic ProfileDeploymentFactory.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class DefaultProfileDeploymentFactory
+{
+
+ /** The instance. */
+ private static final DefaultProfileDeploymentFactory INSTANCE = new DefaultProfileDeploymentFactory();
+
+ protected DefaultProfileDeploymentFactory()
+ {
+ //
+ }
+
+ public static DefaultProfileDeploymentFactory getInstance()
+ {
+ return INSTANCE;
+ }
+
+ public ProfileDeployment createProfileDeployment(String name)
+ {
+ return new AbstractProfileDeployment(name);
+ }
+
+ public ProfileDeployment createProfileDeployment(VirtualFile vf)
+ {
+ return new AbstractProfileDeployment(vf);
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/DeploymentRecord.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,34 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.io.Serializable;
-
-/**
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class DeploymentRecord implements Serializable
-{
- private static final long serialVersionUID = 1;
-
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FileProfileRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,146 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.jboss.deployers.client.spi.main.MainDeployer;
-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;
-
-/**
- * An implementation of ProfileRepository that uses the following
- * file system structure for storing deployments and admin
- * edits.
- *
- * root-file
- * + server/{name}/bootstrap - bootstrap beans/services
- * + server/{name}/deployers - profile deployers
- * + server/{name}/deploy - installed deployments
- * + server/{name}/apps - post install deployments
- * + server/{name}/admin - admin edits to deployments
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class FileProfileRepository
- implements ProfileRepository
-{
- private File root;
- DeploymentRepositoryFactory repositoryFactory;
- private MainDeployer mainDeployer;
-
- public FileProfileRepository()
- {
- this(null);
- }
- public FileProfileRepository(File root)
- {
- this.root = root;
- }
-
- public DeploymentRepositoryFactory getRepositoryFactory()
- {
- return repositoryFactory;
- }
- public void setRepositoryFactory(DeploymentRepositoryFactory repositoryFactory)
- {
- this.repositoryFactory = repositoryFactory;
- }
- public MainDeployer getMainDeployer()
- {
- return mainDeployer;
- }
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Get the server profile store root directory.
- * @return the server profile root directory containing the
- * available profiles.
- */
- public File getStoreRoot()
- {
- return root;
- }
- /**
- * Set the profiles store root.
- * @param root - the server profile root directory containing the
- * available profiles.
- */
- public void setStoreRoot(File root)
- {
- this.root = root;
- }
-
- /**
- * Get the keys for all known profiles. This lists the root store to
- * obtain the server profiles.
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys()
- {
- Collection<ProfileKey> keys = new HashSet<ProfileKey>();
- for(File profile : root.listFiles())
- {
- keys.add(new ProfileKey(profile.getName()));
- }
- return keys;
- }
-
- /**
- *
- */
- public DeploymentRepository createProfileDeploymentRepository(ProfileKey key)
- throws Exception
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.create();
- return repository;
- }
-
- /**
- * Load an existing profile deployment repository.
- */
- public DeploymentRepository getProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.load();
- return repository;
- }
-
- public void removeProfileDeploymentRepository(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- DeploymentRepository repository = repositoryFactory.getDeploymentRepository(key);
- repository.remove();
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/FilteredDeploymentRepositoryFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,167 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+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 org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.FilteredProfileSourceMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * TODO
+ *
+ * Create a filtered deployment repository, based on the deployments
+ * of the filtered profile source meta data.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class FilteredDeploymentRepositoryFactory implements DeploymentRepositoryFactory
+{
+
+ /** The filtered immutable type. */
+ public final static String[] FACTORY_TYPE = new String[] { FilteredProfileSourceMetaData.class.getName() };
+
+ public String[] getTypes()
+ {
+ return FACTORY_TYPE;
+ }
+
+ public DeploymentRepository createDeploymentRepository(ProfileKey key, ProfileSourceMetaData metaData)
+ throws Exception
+ {
+ if(metaData instanceof FilteredProfileSourceMetaData == false)
+ throw new IllegalArgumentException("Wrong profileSource meta data");
+
+ return internalCreateRepository(key, (FilteredProfileSourceMetaData) metaData);
+ }
+
+ protected DeploymentRepository internalCreateRepository(ProfileKey key, FilteredProfileSourceMetaData metaData) throws Exception
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("Null metadata");
+
+ List<String> deploymentList = new ArrayList<String>();
+ if(metaData.getDeployments() != null && metaData.getDeployments().isEmpty() == false)
+ {
+ for(ProfileDeploymentMetaData deployment : metaData.getDeployments())
+ {
+ String deploymentName = deployment.getName();
+ if(deploymentName != null)
+ deploymentList.add(deploymentName);
+ }
+ }
+ return new FilteredRepository(deploymentList, key, createUris(metaData));
+ }
+
+ protected URI[] createUris(ProfileSourceMetaData metaData) throws URISyntaxException
+ {
+ List<URI> uris = new ArrayList<URI>();
+ for(String source : metaData.getSources())
+ {
+ URI uri = new URI(source);
+ uris.add(uri);
+ }
+ return uris.toArray(new URI[uris.size()]);
+ }
+
+ /**
+ * A filtered deployment repository.
+ */
+ private class FilteredRepository extends AbstractDeploymentRepository
+ {
+ private List<String> deploymentNames;
+
+ public FilteredRepository(List<String> deploymentNames, ProfileKey key, URI[] uris)
+ {
+ super(key, uris);
+ this.deploymentNames = deploymentNames;
+ }
+
+ public void load() throws Exception
+ {
+ // Load deployment names
+ for(String deploymentName : deploymentNames)
+ {
+ // Get the deployment content
+ VirtualFile vf = resolveDeploymentName(deploymentName);
+ // Load the deployment
+ ProfileDeployment deployment = createDeployment(vf);
+ // Add the deployment
+ addDeployment(deployment.getName(), deployment);
+ }
+ updateLastModfied();
+ }
+
+ public String addDeploymentContent(String vfsPath, InputStream contentIS) throws IOException
+ {
+ throw new RuntimeException("Cannot add deployment content to an immutable repository.");
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<ModificationInfo> getModifiedDeployments() throws Exception
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public void remove() throws Exception
+ {
+ // nothing
+ }
+
+ protected VirtualFile resolveDeploymentName(String deploymentName) throws IOException
+ {
+ List<VirtualFile> list = new ArrayList<VirtualFile>();
+ for(URI uri : getRepositoryURIs())
+ {
+ VirtualFile repo = getCachedVirtualFile(uri);
+ VirtualFile vf = repo.getChild(deploymentName);
+ if(vf != null)
+ list.add(vf);
+ }
+ if(list.size() == 0)
+ {
+ throw new FileNotFoundException("Unable to find name: " + deploymentName);
+ }
+ else if (list.size() > 1)
+ {
+ throw new FileNotFoundException("Multiple matching names: " + deploymentName + " available " + list);
+ }
+ return list.get(0);
+ }
+ }
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A immutable deployment repository.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImmutableDeploymentRepository extends AbstractDeploymentRepository
+{
+
+ public ImmutableDeploymentRepository(ProfileKey key, URI[] uris)
+ {
+ super(key, uris);
+ }
+
+ public void load() throws Exception
+ {
+ for(URI uri : getRepositoryURIs())
+ {
+ VirtualFile root = getCachedVirtualFile(uri);
+ loadApplications(root);
+ }
+ updateLastModfied();
+ }
+
+ public Collection<ModificationInfo> getModifiedDeployments() throws Exception
+ {
+ return Collections.emptySet();
+ }
+
+ public String addDeploymentContent(String vfsPath, InputStream contentIS) throws IOException
+ {
+ throw new IllegalStateException("Cannot add content to an immutable repository.");
+ }
+
+ public void remove() throws Exception
+ {
+ throw new IllegalStateException("Cannot remove immutable repository.");
+ }
+
+}
+
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,50 +24,58 @@
import java.io.File;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCompositeValue;
+import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistenceConstants;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
/**
* A basic JAXB attachment Serializer.
*
+ * It uses JAXB for marshalling the meta data and JBoss XB to unmarshal.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
public class JAXBAttachmentSerializer extends AbstractFileAttachmentsSerializer
{
- /** The logger */
+ /** The logger. */
private static final Logger log = Logger.getLogger(JAXBAttachmentSerializer.class);
- /** The QNAME for the root element */
- private static final QName ROOT_NAME = new QName("attachment");
-
/** The attachment suffix. */
private static final String ATTACHMENT_SUFFIX = ".attachment.xml";
+ /** The default schema resolver. */
+ private static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ static
+ {
+ resolver.addClassBinding("urn:org:jboss:profileservice:attachments:1.0", RepositoryAttachmentMetaData.class);
+ resolver.addClassBinding(PersistenceConstants.NAMESPACE_1_0, PersistedManagedObject.class);
+ }
+
+ public JAXBAttachmentSerializer(File dir)
+ {
+ super(dir);
+ }
+
@SuppressWarnings("unchecked")
protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
{
- JAXBContext ctx = JAXBContext.newInstance(expected);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- // FIXME this is a hack
- if(PersistedManagedObject.class.getName().equals(expected.getName()))
- {
- hack(unmarshaller);
- }
- return (T) unmarshaller.unmarshal(attachmentsStore);
+ // JBoss XB
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return (T) unmarshaller.unmarshal(attachmentsStore.toURL().openStream(), resolver);
}
protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
{
+ // JAXB
log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
Marshaller marshaller = ctx.createMarshaller();
@@ -75,11 +83,6 @@
marshaller.marshal(attachment, attachmentsStore);
}
- protected static <T> JAXBElement<T> createRootElement(Class<T> expected, Object o)
- {
- return new JAXBElement<T>(ROOT_NAME, expected, (T) o);
- }
-
@Override
protected File getAttachmentPath(String baseName)
{
@@ -87,36 +90,4 @@
return new File(getAttachmentsStoreDir(), vfsPath);
}
- private void hack(Unmarshaller unmarshaller)
- {
- unmarshaller.setListener(new PeristedManagedObjectHandler());
- }
-
- /**
- * Hack handler for JAXB.
- */
- private static class PeristedManagedObjectHandler extends Unmarshaller.Listener
- {
- @Override
- public void afterUnmarshal(Object target, Object parent)
- {
- if(parent instanceof PersistedManagedObject)
- {
- if(target instanceof PersistedProperty)
- {
- PersistedProperty p = (PersistedProperty) target;
- ((PersistedManagedObject) parent).put(p.getName(), p);
- }
- }
- else if(parent instanceof PersistedCompositeValue)
- {
- if(target instanceof PersistedValue)
- {
- PersistedValue v = (PersistedValue) target;
- ((PersistedCompositeValue) parent).put(v.getName(), v);
- }
- }
- }
- }
-
}
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaBeanXmlAttachmentsSerializer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,102 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import org.jboss.logging.Logger;
-
-/**
- * An AttachmentsSerializer that uses the java bean long term xml serialization
- * format.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class JavaBeanXmlAttachmentsSerializer extends AbstractFileAttachmentsSerializer
-{
- private static final Logger log = Logger.getLogger(JavaBeanXmlAttachmentsSerializer.class);
-
- @Override
- @SuppressWarnings("unchecked")
- protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
- {
- T object = null;
- FileInputStream fis = new FileInputStream(attachmentsStore);
- XMLDecoder ois = new XMLDecoder(fis);
- try
- {
- object = (T) ois.readObject();
- }
- finally
- {
- try
- {
- ois.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fis.close();
- }
- catch(Exception igore)
- {
- }
- }
- return object;
- }
-
- @Override
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- FileOutputStream fos = new FileOutputStream(attachmentsStore);
- XMLEncoder oos = new XMLEncoder(fos);
- try
- {
- oos.writeObject(attachment);
- }
- finally
- {
- try
- {
- oos.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fos.close();
- }
- catch(Exception igore)
- {
- }
- }
- }
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,174 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Arrays;
-
-import org.jboss.logging.Logger;
-
-/**
- * Standard java serialization to a file.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class JavaSerializationAttachmentsSerializer
- extends AbstractFileAttachmentsSerializer
-{
- private static final Logger log = Logger.getLogger(JavaSerializationAttachmentsSerializer.class);
-
- @Override
- @SuppressWarnings("unchecked")
- protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
- {
- FileInputStream fis = new FileInputStream(attachmentsStore);
- ObjectInputStream ois = new ObjectInputStream(fis);
- T object = null;
- try
- {
- object = (T) ois.readObject();
- }
- catch(ClassNotFoundException e)
- {
- URL[] path = getClassLoaderURLs(Thread.currentThread().getContextClassLoader());
- log.debug("ClassNotFoundException: "+e.getMessage()+", path: "+Arrays.asList(path));
- }
- finally
- {
- try
- {
- ois.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fis.close();
- }
- catch(Exception igore)
- {
- }
- }
- return object;
- }
-
- @Override
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- FileOutputStream fos = new FileOutputStream(attachmentsStore);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- try
- {
- oos.writeObject(attachment);
- }
- finally
- {
- try
- {
- oos.close();
- }
- catch(Exception igore)
- {
- }
- try
- {
- fos.close();
- }
- catch(Exception igore)
- {
- }
- }
- }
-
- /** Use reflection to access a URL[] getURLs or URL[] getClasspath method so
- that non-URLClassLoader class loaders, or class loaders that override
- getURLs to return null or empty, can provide the true classpath info.
- */
- @SuppressWarnings("unchecked")
- private static URL[] getClassLoaderURLs(ClassLoader cl)
- {
- URL[] urls = {};
- try
- {
- Class returnType = urls.getClass();
- Class[] parameterTypes = {};
- Class clClass = cl.getClass();
- Method getURLs = clClass.getMethod("getURLs", parameterTypes);
- if( returnType.isAssignableFrom(getURLs.getReturnType()) )
- {
- Object[] args = {};
- urls = (URL[]) getURLs.invoke(cl, args);
- }
- }
- catch(Exception ignore)
- {
- }
- if( urls == null || urls.length == 0 )
- {
- try
- {
- Class returnType = urls.getClass();
- Class[] parameterTypes = {};
- Class clClass = cl.getClass();
- Method getURLs = clClass.getMethod("getAllURLs", parameterTypes);
- if( returnType.isAssignableFrom(getURLs.getReturnType()) )
- {
- Object[] args = {};
- urls = (URL[]) getURLs.invoke(cl, args);
- }
- }
- catch(Exception ignore)
- {
- }
- }
- if( urls == null || urls.length == 0 )
- {
- try
- {
- Class returnType = urls.getClass();
- Class[] parameterTypes = {};
- Class clClass = cl.getClass();
- Method getURLs = clClass.getMethod("getClasspath", parameterTypes);
- if( returnType.isAssignableFrom(getURLs.getReturnType()) )
- {
- Object[] args = {};
- urls = (URL[]) getURLs.invoke(cl, args);
- }
- }
- catch(Exception ignore)
- {
- }
- }
-
- return urls;
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+
+/**
+ * A basic adapter for the MainDeployer.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MainDeployerAdapter
+{
+
+ /** The main deployer. */
+ private MainDeployer mainDeployer;
+
+ /** The attachment store. */
+ private AttachmentStore store;
+
+ public AttachmentStore getAttachmentStore()
+ {
+ return store;
+ }
+
+ public void setAttachmentStore(AttachmentStore store)
+ {
+ this.store = store;
+ }
+
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public void create() throws Exception
+ {
+ // Sanity check
+ if(mainDeployer == null)
+ throw new IllegalStateException("Null mainDeployer");
+ if(store == null)
+ throw new IllegalStateException("Null attachment store.");
+ }
+
+ /**
+ * Add a deployment.
+ *
+ * @param deployment the profile deployment.
+ * @throws Exception
+ */
+ public void addDeployment(ProfileDeployment deployment) throws Exception
+ {
+ if(deployment == null)
+ throw new IllegalArgumentException("Null deployment.");
+
+ Deployment d = loadDeploymentData(deployment);
+ mainDeployer.addDeployment(d);
+ }
+
+ /**
+ * Remove a deployment.
+ *
+ * @param name the deployment name.
+ * @throws DeploymentException
+ */
+ public void removeDeployment(String name) throws DeploymentException
+ {
+ if(name == null)
+ throw new IllegalArgumentException("Null name.");
+
+ this.mainDeployer.removeDeployment(name);
+ }
+
+ public void removeDeployment(ProfileDeployment deployment) throws Exception
+ {
+ if(deployment == null)
+ throw new IllegalArgumentException("Null deployment");
+
+ removeDeployment(deployment.getName());
+ }
+
+ /**
+ * Process ...
+ *
+ */
+ public void process()
+ {
+ this.mainDeployer.process();
+ }
+
+ /**
+ * CheckComplete
+ *
+ * @throws DeploymentException
+ */
+ public void checkComplete() throws DeploymentException
+ {
+ this.mainDeployer.checkComplete();
+ }
+
+ /**
+ * Create a MC deployment and load the persisted attachment data.
+ *
+ * @param deployment the profile deployment.
+ * @return the MC deployment.
+ * @throws Exception
+ */
+ protected Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
+ {
+ return store.loadDeploymentData(deployment);
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,283 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+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.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.zip.ZipInputStream;
+
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.profileservice.spi.DeploymentContentFlags;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A mutable deployment repository, with hot deployment capabilities.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @version $Revision$
+ */
+public class MutableDeploymentRepository extends AbstractDeploymentRepository
+{
+ /** Should an attempt to overwrite existing content fail in {@link #addDeploymentContent(String, ZipInputStream)}*/
+ private boolean failIfAlreadyExists = false;
+
+ /** The structure modification checker */
+ private StructureModificationChecker checker;
+
+ /** A lock for the hot deployment/{@link #getModifiedDeployments()} */
+ private ReentrantReadWriteLock contentLock = new ReentrantReadWriteLock(true);
+
+ public MutableDeploymentRepository(ProfileKey key, URI[] uris)
+ {
+ super(key, uris);
+ }
+
+ /**
+ * Get the structure modified checker.
+ *
+ * @return the checker
+ */
+ protected StructureModificationChecker getChecker()
+ {
+ if (checker == null)
+ throw new IllegalArgumentException("Checker must be set");
+
+ return checker;
+ }
+
+ /**
+ * Set the checker.
+ *
+ * @param checker the checker
+ */
+ public void setChecker(StructureModificationChecker checker)
+ {
+ this.checker = checker;
+ }
+
+ public void load() throws Exception
+ {
+ for(URI uri : getRepositoryURIs())
+ {
+ VirtualFile root = getCachedVirtualFile(uri);
+ loadApplications(root);
+ }
+ updateLastModfied();
+ }
+
+ public String addDeploymentContent(String vfsPath, InputStream contentIS) throws IOException
+ {
+ boolean trace = log.isTraceEnabled();
+ // Suspend hot deployment checking
+ if( trace )
+ log.trace("Aquiring content write lock");
+ contentLock.writeLock().lock();
+ String repositoryName = null;
+ try
+ {
+ if(getRepositoryURIs().length == 0)
+ throw new IllegalStateException("No uris associated with this repository.");
+
+ // FIXME, this is writing the content to the first URI
+ // Write the content out
+ File contentRoot = new File(getRepositoryURIs()[0]);
+ if(contentRoot == null)
+ throw new FileNotFoundException("Failed to obtain content dir for phase: "+vfsPath);
+ File contentFile = new File(contentRoot, vfsPath);
+
+ if(failIfAlreadyExists && contentFile.exists())
+ throw new SyncFailedException("Deployment content already exists: "+contentFile.getAbsolutePath());
+ 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();
+ // Get the vfs uri and add the VFS uri to the cached VFS uris
+ VirtualFile contentVF = VFS.getRoot(contentFile.toURI());
+ try
+ {
+ contentVF = getCachedVirtualFile(contentVF.toURI());
+ repositoryName = contentVF.toURI().toString();
+ }
+ catch(URISyntaxException e)
+ {
+ throw new RuntimeException(e); // This should not happen anyway
+ }
+ }
+ finally
+ {
+ try
+ {
+ fos.close();
+ }
+ catch (IOException ignored)
+ {
+ }
+ }
+
+ // Lock the content
+ lockDeploymentContent(repositoryName);
+ }
+ finally
+ {
+ // Allow hot deployment checking
+ contentLock.writeLock().unlock();
+ if(trace)
+ log.trace("Released content write lock");
+ }
+ return repositoryName;
+ }
+
+ public synchronized Collection<ModificationInfo> getModifiedDeployments() throws Exception
+ {
+ ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
+ Collection<ProfileDeployment> apps = getDeployments();
+ boolean trace = log.isTraceEnabled();
+ if (trace)
+ log.trace("Checking applications for modifications");
+ if (trace)
+ log.trace("Aquiring content read lock");
+ contentLock.readLock().lock();
+ try
+ {
+ if (apps != null)
+ {
+ Iterator<ProfileDeployment> iter = apps.iterator();
+ while (iter.hasNext())
+ {
+ ProfileDeployment ctx = iter.next();
+ VirtualFile root = ctx.getRoot();
+ String pathName = ctx.getName();
+ // Ignore locked or disabled applications
+ if (this.hasDeploymentContentFlags(pathName, ignoreFlags))
+ {
+ if (trace)
+ log.trace("Ignoring locked application: " + root);
+ continue;
+ }
+ // Check for removal
+ if (root.exists() == false)
+ {
+ long rootLastModified = root.getLastModified();
+ ModificationInfo info = new ModificationInfo(ctx, rootLastModified, ModifyStatus.REMOVED);
+ modified.add(info);
+ iter.remove();
+ // Remove last modified cache
+ getChecker().removeStructureRoot(root);
+ if (trace)
+ log.trace(pathName + " was removed");
+ }
+ // Check for modification
+ else if (getChecker().hasStructureBeenModified(root) || hasDeploymentContentFlags(pathName, DeploymentContentFlags.MODIFIED))
+ {
+ long rootLastModified = root.getLastModified();
+ if (trace)
+ log.trace(pathName + " was modified: " + rootLastModified);
+ // Create the modification info
+ ModificationInfo info = new ModificationInfo(ctx, rootLastModified, ModifyStatus.MODIFIED);
+ modified.add(info);
+ }
+ }
+ // Now check for additions
+ for (URI applicationDir : getRepositoryURIs())
+ {
+ VirtualFile deployDir = getCachedVirtualFile(applicationDir);
+ ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+ addedDeployments(added, deployDir);
+ for (VirtualFile vf : added)
+ {
+ // Create deployment
+ ProfileDeployment ctx = createDeployment(vf);
+ // Create modification info
+ ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
+ // Add
+ modified.add(info);
+ addDeployment(ctx.getName(), ctx);
+ getChecker().addStructureRoot(vf);
+ }
+ }
+ }
+ }
+ finally
+ {
+ contentLock.readLock().unlock();
+ if (trace)
+ log.trace("Released content read lock");
+ }
+
+ if (modified.size() > 0)
+ updateLastModfied();
+ return modified;
+ }
+
+ public ProfileDeployment removeDeployment(String vfsPath) throws Exception
+ {
+ // Suspend hot deployment checking
+ if( log.isTraceEnabled() )
+ log.trace("Aquiring content write lock");
+ contentLock.writeLock().lock();
+ try
+ {
+ // Remove the deployment from the filesystem
+ ProfileDeployment deployment = getDeployment(vfsPath);
+ VirtualFile root = deployment.getRoot();
+ if(root.delete() == false)
+ throw new IOException("Failed to delete: " + root);
+ // Cleanup
+ return super.removeDeployment(deployment.getName());
+ }
+ finally
+ {
+ contentLock.writeLock().unlock();
+ if (log.isTraceEnabled())
+ log.trace("Released content write lock");
+ }
+ }
+
+ public void remove() throws Exception
+ {
+ // FIXME remove
+ }
+}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,107 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.util.Collection;
+
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.ControllerContextActions;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+
+/**
+ * The ProfileServiceContext.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileContext extends AbstractControllerContext
+{
+
+ /** The profile meta data. */
+ private ProfileMetaData metaData;
+
+ /** The profile. */
+ private Profile profile;
+
+ protected static ProfileKey getProfileKey(Profile profile)
+ {
+ if(profile == null)
+ throw new IllegalArgumentException("Null profile.");
+ return profile.getKey();
+ }
+
+ public ProfileContext(Profile profile, ControllerContextActions actions)
+ {
+ super(getProfileKey(profile), actions);
+ setMode(ControllerMode.ON_DEMAND);
+ createDependencies(profile.getKey(), profile.getSubProfiles());
+ this.profile = profile;
+ // The profile
+ setTarget(profile);
+ }
+
+ public ProfileContext(ProfileKey key, ProfileMetaData metaData, ControllerContextActions actions)
+ {
+ super(key, actions);
+
+ if(this.metaData == null)
+ throw new IllegalArgumentException("Null meta data.");
+
+ this.metaData = metaData;
+ }
+
+ public Profile getProfile()
+ {
+ return this.profile;
+ }
+
+ private void createDependencies(ProfileKey key, Collection<ProfileKey> subProfiles)
+ {
+ if(subProfiles != null && subProfiles.isEmpty() == false)
+ {
+ for(ProfileKey iDependOn : subProfiles)
+ {
+ getDependencyInfo().addIDependOn(createDependencyItem(key, iDependOn));
+ }
+ }
+ }
+
+ private DependencyItem createDependencyItem(ProfileKey key, ProfileKey iDependOn)
+ {
+ return new AbstractDependencyItem(key, iDependOn, ControllerState.DESCRIBED, ControllerState.INSTALLED);
+ }
+
+ @Override
+ public String toString()
+ {
+ // FIXME
+ return this.profile.toString();
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+
+/**
+ * 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";
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,96 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.util.Collection;
+
+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 extends AbstractProfileAction
+{
+
+ /** The profile deployment deployer. */
+ private MainDeployerAdapter deployer;
+
+ public ProfileDeployAction(MainDeployerAdapter deployer)
+ {
+ if(deployer == null)
+ throw new IllegalArgumentException("Null deployer");
+ this.deployer = deployer;
+ }
+
+ @Override
+ public void install(Profile profile) throws Exception
+ {
+ Collection<ProfileDeployment> deployments = profile.getDeployments();
+ if (deployments != null && !deployments.isEmpty())
+ {
+ // Add deployments
+ for (ProfileDeployment deployment : profile.getDeployments())
+ deployer.addDeployment(deployment);
+ // deploy
+ deployer.process();
+ // TODO do we need some additional meta data to do e.g.: ?
+ // deployer.checkComplete();
+ }
+ }
+
+ @Override
+ public void uninstall(Profile profile) throws Exception
+ {
+ // Handle deployments
+ Collection<ProfileDeployment> deployments = profile.getDeployments();
+ if (deployments != null && !deployments.isEmpty())
+ {
+ // remove deployments
+ for (ProfileDeployment deployment : profile.getDeployments())
+ {
+ try
+ {
+ // remove deployments
+ deployer.removeDeployment(deployment);
+ }
+ catch(Throwable t)
+ {
+ log.warn("failed to undeploy: " + t);
+ }
+ }
+ // undeploy
+ try
+ {
+ deployer.process();
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error on releasing profile: ", t);
+ }
+ }
+ }
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,216 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileRepository;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profile.repository.ProfileImpl;
-
-
-/**
- * A ProfileService impl that uses a ProfileRepository/DeploymentRepository
- * based Profile implementation.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ProfileServiceImpl
- implements ProfileService
-{
- private static final Logger log = Logger.getLogger(ProfileServiceImpl.class);
- /** The name of the profile to use */
- private String name;
- /** The profile repository plugin */
- private ProfileRepository profileRepository;
- /** The deployment repository plugin for the current profile */
- private DeploymentRepository deploymentRepository;
- /** The active profile */
- private Profile profile;
- /** The management view for the active profile */
- private ManagementView mgtView;
- /** The profiles DeploymentManager */
- private DeploymentManager deployMgr;
- /** The version of the profile to use */
- private String version;
-
- public ProfileServiceImpl(String name) throws IOException
- {
- this.name = name;
- }
- // Properties ------------------------
-
- public String getName()
- {
- return this.name;
- }
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- public ProfileRepository getProfileRepository()
- {
- return profileRepository;
- }
-
- public void setProfileRepository(ProfileRepository profileRepository)
- {
- this.profileRepository = profileRepository;
- }
-
- public DeploymentRepository getDeploymentRepository()
- {
- return deploymentRepository;
- }
-
- public void setDeploymentRepository(DeploymentRepository repository)
- {
- this.deploymentRepository = repository;
- }
-
- public void start()
- throws Exception
- {
- if( profileRepository == null )
- throw new IllegalStateException("No profileRepository specified");
- // Obtain the deployment repository for the profile
- ProfileKey key = new ProfileKey(name);
- Profile profile = this.getProfile(key);
- log.info("Loaded profile: "+profile);
- }
-
- // ProfileService implementation --------------------
- /**
- * There is only the default domain (ProfileKey.DEFAULT)
- */
- public String[] getDomains()
- {
- String[] domains = {ProfileKey.DEFAULT};
- return domains;
- }
-
- /**
- * Get the keys for all known profiles
- * @return keys for all known profiles
- */
- public Collection<ProfileKey> getProfileKeys()
- {
- Collection<ProfileKey> keys = profileRepository.getProfileKeys();
- return keys;
- }
-
- /**
- * Always returns the default profile.
- */
- public Profile getProfile(ProfileKey key)
- throws NoSuchProfileException
- {
- if( profileRepository == null )
- throw new IllegalStateException("No profileRepository specified");
- if(profile != null)
- {
- if(key.isDefaultKey() || profile.getKey().equals(key))
- return profile;
- }
-
- // Obtain the deployment repository for the profile
- try
- {
- deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
- }
- catch(NoSuchProfileException e)
- {
- throw e;
- }
- catch(Exception e)
- {
- throw new NoSuchProfileException("Failed to obtain deployment repository for: "+key, e);
- }
- log.info("Loading profile: "+name+" from: "+deploymentRepository);
- profile = new ProfileImpl(deploymentRepository, key);
- return profile;
- }
- public Profile getActiveProfile()
- throws NoSuchProfileException
- {
- return profile;
- }
-
- public String[] getProfileDeploymentNames(ProfileKey key)
- throws NoSuchProfileException
- {
- String[] names = {"default"};
- return names;
- }
-
- public ManagementView getViewManager()
- {
- return mgtView;
- }
- public void setViewManager(ManagementView mgtView)
- {
- this.mgtView = mgtView;
- }
-
- public DeploymentManager getDeploymentManager()
- {
- return deployMgr;
- }
- public void setDeploymentManager(DeploymentManager deployMgr)
- {
- this.deployMgr = deployMgr;
- }
-
- public Profile newProfile(ProfileKey key)
- throws Exception
- {
- DeploymentRepository repo = profileRepository.createProfileDeploymentRepository(key);
- return new ProfileImpl(repo, key);
- }
-
- public void removeProfile(ProfileKey key)
- throws Exception, NoSuchProfileException
- {
- profileRepository.removeProfileDeploymentRepository(key);
- }
-}
-
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+/**
+ * Basic 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";
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,602 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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.system.server.profileservice.repository;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
-import org.jboss.profileservice.spi.repository.MutableRepository;
-import org.jboss.profileservice.spi.repository.Repository;
-import org.jboss.profileservice.spi.repository.RepositoryAdmin;
-import org.jboss.profileservice.spi.repository.Resource;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A bridge between the DeploymentRepository and the OBR RepositoryAdmin
- * to validate that the OBR api can be used for the profile service.
- *
- * TODO: may need separate deployment phase maps for the OBR id to vfspath to
- * track deployments by phase.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class RepositoryAdminAdaptor
- implements DeploymentRepository
-{
- private static Logger log = Logger.getLogger(RepositoryAdminAdaptor.class);
-
- /** The OBR repository interface */
- private RepositoryAdmin delegate;
- /** The server root container the deployments */
- private File root;
- /** The bootstrap jboss-service.xml dir */
- private File bootstrapDir;
- /** The server static libraries */
- private File libDir;
- /** The deployers phase deployments dir */
- private File deployersDir;
- /** The application phase deployments dir */
- private File[] applicationDirs;
- /** The deployment post edit */
- private File adminEditsRoot;
- /** The profile key this repository is associated with */
- private ProfileKey key;
- /** The last time the profile was modified */
- private long lastModified;
-
-
- public String getAttachmentsRoot()
- {
- String path = null;
- if(adminEditsRoot != null)
- path = adminEditsRoot.getAbsolutePath();
- return path;
- }
-
- public void setAttachmentsRoot(String root)
- {
- adminEditsRoot = new File(root);
- }
-
- public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- MutableRepository mrepo = getRepository(d.getRoot().toURI());
- VFSDeploymentResource dres = new VFSDeploymentResource(d, phase, mrepo);
- mrepo.addResource(dres);
- }
-
- public String addDeploymentContent(String name, InputStream contentIS, DeploymentPhase phase)
- throws IOException
- {
- // TODO
- throw new IOException("Not yet implemented");
- }
-
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase)
- throws IOException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VirtualFile getDeploymentContent(String vfsPath, DeploymentPhase phase)
- throws IOException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int lockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- // TODO Auto-generated method stub
- return 0;
- }
- public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
-
- public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase)
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public int clearDeploymentContentFlags(String vfsPath,
- DeploymentPhase phase, int flags)
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public boolean hasDeploymentContentFlags(String vfsPath,
- DeploymentPhase phase, int flag)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flags)
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public void acquireDeploymentContentLock()
- {
- // TODO Auto-generated method stub
- }
-
- public void releaseDeploymentContentLock()
- {
- // TODO Auto-generated method stub
- }
-
-
- public void addManagedObject(String vfsPath, Attachments edits) throws Exception
- {
- MutableRepository repo = this.getRepository(adminEditsRoot.toURI());
- AttachmentsResource attachments = new AttachmentsResource(vfsPath, edits, repo);
- repo.addResource(attachments);
- lastModified = System.currentTimeMillis();
- }
-
- public long getLastModified()
- {
- return this.lastModified;
- }
-
- public void create() throws Exception
- {
- File profileRoot = new File(root, key.getName());
- if( profileRoot.exists() == true )
- throw new IOException("Profile root already exists: "+profileRoot);
- if( profileRoot.mkdirs() == false )
- throw new IOException("Failed to create profile root: "+profileRoot);
- // server/{name}/bootstrap
- bootstrapDir = new File(profileRoot, "bootstrap");
- if( bootstrapDir.mkdirs() == false )
- throw new IOException("Failed to create profile bootstrap dir: "+bootstrapDir);
- delegate.addRepository(bootstrapDir.toURI());
-
- // server/{name}/deployers
- deployersDir = new File(profileRoot, "deployers");
- if( deployersDir.mkdirs() == false )
- throw new IOException("Failed to create profile deployers dir: "+deployersDir);
- delegate.addRepository(deployersDir.toURI());
-
- // server/{name}/deploy dirs
- for (File applicationDir : applicationDirs)
- {
- if( applicationDir.mkdirs() == false )
- throw new IOException("Failed to create profile deploy dir: "+applicationDir);
- delegate.addRepository(applicationDir.toURI());
- }
-
- // server/{name}/lib
- libDir = new File(profileRoot, "lib");
- if( libDir.mkdirs() == false )
- throw new IOException("Failed to create profile lib dir: "+libDir);
- delegate.addRepository(libDir.toURI());
-
- if(adminEditsRoot == null)
- setAttachmentsRoot(profileRoot.getAbsolutePath()+"/attachments");
- if( adminEditsRoot.exists() == false && adminEditsRoot.mkdirs() == false )
- throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
- delegate.addRepository(adminEditsRoot.toURI());
- lastModified = System.currentTimeMillis();
- }
-
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws Exception, NoSuchDeploymentException
- {
- VFSDeployment ctx = null;
- if( phase == null )
- {
- // Try all phases
- try
- {
- ctx = this.getBootstrap(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getDeployer(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getApplication(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- }
- else
- {
- switch( phase )
- {
- case BOOTSTRAP:
- ctx = this.getBootstrap(name);
- break;
- case DEPLOYER:
- ctx = this.getDeployer(name);
- break;
- case APPLICATION:
- ctx = this.getApplication(name);
- break;
- }
- }
- // Make sure we don't return null
- if( ctx == null )
- throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- return ctx;
- }
-
- /**
- * Obtain the VFSDeploymentResource SymbolicName from all
- * repositories.
- */
- public Set<String> getDeploymentNames()
- {
- HashSet<String> names = new HashSet<String>();
- Repository[] repositories = delegate.listRepositories();
- for(Repository repo : repositories)
- {
- Resource[] resources = repo.getResources();
- for(Resource res : resources)
- {
- if(res instanceof VFSDeploymentResource)
- {
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- names.add(vfsres.getSymbolicName());
- }
- }
- }
- return names;
- }
-
- /**
- * Obtain the VFSDeploymentResource SymbolicName from the
- * repository associated with the getDeploymentURI(phase) URI.
- */
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- HashSet<String> names = new HashSet<String>();
- URI uri = getDeploymentURI(phase);
- try
- {
- Repository repo = delegate.getRepository(uri);
- Resource[] resources = repo.getResources();
- for(Resource res : resources)
- {
- if(res instanceof VFSDeploymentResource)
- {
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- names.add(vfsres.getSymbolicName());
- }
- }
- }
- catch(Exception e)
- {
- throw new IllegalStateException(e);
- }
- return names;
- }
-
- /**
- * TODO: should be a resolver query for matching types via
- * discoverResources(String).
- */
- public Set<String> getDeploymentNamesForType(String type)
- {
- return null;
- }
-
- /**
- * Obtain the VFSDeploymentResource deployment property from all
- * repositories.
- */
- public Collection<VFSDeployment> getDeployments() throws Exception
- {
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- Repository[] repositories = delegate.listRepositories();
- for(Repository repo : repositories)
- {
- Resource[] resources = repo.getResources();
- for(Resource res : resources)
- {
- if(res instanceof VFSDeploymentResource)
- {
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- if(deployment != null)
- deployments.add(deployment);
- }
- }
- }
- return deployments;
- }
-
- /**
- * Obtain the VFSDeploymentResource deployment property from the
- * repository
- */
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception
- {
- URI uri = getDeploymentURI(phase);
- Repository repo = delegate.getRepository(uri);
- Resource[] resources = repo.getResources();
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- for(Resource res : resources)
- {
- if(res instanceof VFSDeploymentResource)
- {
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- if(deployment != null)
- deployments.add(deployment);
- }
- }
- return deployments;
- }
-
- public URI getDeploymentURI(DeploymentPhase phase)
- {
- URI uri = null;
- switch( phase )
- {
- case BOOTSTRAP:
- uri = this.getBootstrapURI();
- break;
- case DEPLOYER:
- uri = this.getDeployersURI();
- break;
- case APPLICATION:
- uri = this.getApplicationURI();
- break;
- }
- return uri;
- }
-
- public Collection<ModificationInfo> getModifiedDeployments() throws Exception
- {
- ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
- URI appURI = getApplicationURI();
- MutableRepository repo = getRepository(appURI);
- Collection<Resource> resources = repo.getModifiedResources();
- boolean trace = log.isTraceEnabled();
- if( trace )
- log.trace("Checking applications for modifications");
- if( resources != null )
- {
- for(Resource res : resources)
- {
- VFSDeployment ctx = (VFSDeployment) res.getProperties().get("deployment");
- if( ctx == null )
- continue;
- MutableRepository.ModifyStatus status = (MutableRepository.ModifyStatus) res.getProperties().get("modifyStatus");
- Long lastModified = (Long) res.getProperties().get("lastModified");
- VirtualFile root = ctx.getRoot();
- String name = root.getPathName();
- // Check for removal
- if(status == MutableRepository.ModifyStatus.REMOVED)
- {
- ModificationInfo info = new ModificationInfo(ctx, lastModified, ModifyStatus.REMOVED);
- modified.add(info);
- if( trace )
- log.trace(name+" was removed");
- }
- // Check for modification
- else if(status == MutableRepository.ModifyStatus.MODIFIED)
- {
- if( trace )
- log.trace(name+" was modified: "+lastModified);
- ModificationInfo info = new ModificationInfo(ctx, lastModified, ModifyStatus.MODIFIED);
- modified.add(info);
- }
- // Check for additions
- else if(status == MutableRepository.ModifyStatus.ADDED)
- {
- if( trace )
- log.trace(name+" was added: "+lastModified);
- ModificationInfo info = new ModificationInfo(ctx, lastModified, ModifyStatus.ADDED);
- modified.add(info);
- }
- }
- }
- if(modified.size() > 0)
- lastModified = System.currentTimeMillis();
- return modified;
- }
-
- public void load() throws Exception
- {
- }
-
- public void remove() throws Exception
- {
- Repository[] repositories = delegate.listRepositories();
- for(Repository repo : repositories)
- {
- delegate.removeRepository(repo.getURI());
- }
- }
-
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- URI uri = null;
- switch( phase )
- {
- case BOOTSTRAP:
- uri = getBootstrapURI();
- break;
- case DEPLOYER:
- uri = getDeployersURI();
- break;
- case APPLICATION:
- uri = getApplicationURI();
- break;
- }
- VFSDeployment ctx = removeDeployment(name, uri);
- return ctx;
- }
-
- public void setDeploymentURI(URI uri, DeploymentPhase phase)
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.setBootstrapURI(uri);
- break;
- case DEPLOYER:
- this.setDeployersURI(uri);
- break;
- case APPLICATION:
- this.setApplicationURIs(new URI[]{uri});
- break;
- }
- }
-
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- ManagedComponent comp)
- throws Exception
- {
- }
-
- /** This requires that the RepositoryAdmin be able to walk up the
- deployment URI to a matching repository URI
- @param uri a URI pointing to a resource under a repository
- */
- protected MutableRepository getRepository(URI uri)
- throws Exception
- {
- Repository repo = delegate.getRepository(uri);
- if ( (repo instanceof MutableRepository) == false )
- throw new IllegalStateException("Repository does not support MutableRepository");
- MutableRepository mrepo = (MutableRepository) repo;
- return mrepo;
- }
-
- protected VFSDeployment getBootstrap(String vfsPath)
- throws Exception
- {
- Resource res = delegate.getResource(vfsPath);
- if (res == null || (res instanceof VFSDeploymentResource) == false)
- throw new NoSuchDeploymentException(vfsPath);
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- return deployment;
- }
-
- protected VFSDeployment getDeployer(String vfsPath)
- throws Exception
- {
- Resource res = delegate.getResource(vfsPath);
- if (res == null || (res instanceof VFSDeploymentResource) == false)
- throw new NoSuchDeploymentException(vfsPath);
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- return deployment;
- }
-
- protected VFSDeployment getApplication(String vfsPath)
- throws Exception
- {
- Resource res = delegate.getResource(vfsPath);
- if (res == null || (res instanceof VFSDeploymentResource) == false)
- throw new NoSuchDeploymentException(vfsPath);
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- return deployment;
- }
-
- protected URI getBootstrapURI()
- {
- return bootstrapDir.toURI();
- }
- protected URI getDeployersURI()
- {
- return deployersDir.toURI();
- }
- protected URI getApplicationURI()
- {
- File applicationDir = applicationDirs[0];
- return applicationDir.toURI();
- }
-
- protected void setBootstrapURI(URI uri)
- {
- bootstrapDir = new File(uri);
- }
- protected void setDeployersURI(URI uri)
- {
- deployersDir = new File(uri);
- }
- public void setApplicationURIs(URI[] uris)
- {
- applicationDirs = new File[uris.length];
- for (int n = 0; n < uris.length; n ++)
- {
- URI uri = uris[n];
- applicationDirs[n] = new File(uri);
- }
- }
-
- protected VFSDeployment removeDeployment(String name, URI uri) throws Exception
- {
- MutableRepository mrepo = getRepository(uri);
- Resource res = mrepo.removeResource(name);
- VFSDeploymentResource vfsres = (VFSDeploymentResource) res;
- VFSDeployment deployment = (VFSDeployment) vfsres.getProperties().get("deployment");
- return deployment;
- }
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/ScopedProfileServiceController.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.system.server.profileservice.repository;
+
+import static org.jboss.system.server.profileservice.repository.AbstractProfileService.DEPLOY_STATE;
+
+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;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ScopedProfileServiceController extends ScopedController
+{
+
+ public ScopedProfileServiceController(AbstractController parentController)
+ {
+ setScopeKey(new ScopeKey(CommonLevels.SUBSYSTEM, "Profile"));
+ setParentController(parentController);
+ setUnderlyingController(this);
+ getParentController().addController(this);
+ addState(DEPLOY_STATE, ControllerState.INSTALLED);
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,1165 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.zip.ZipInputStream;
-
-import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.DeploymentContentFlags;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.ModificationInfo;
-import org.jboss.profileservice.spi.ModificationInfo.ModifyStatus;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.util.file.Files;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * An implementation of DeploymentRepository that relies on java
- * serialization to store contents on the file system.
- *
- * + root/{name}/bootstrap - the bootstrap beans
- * + root/{name}/deployers - profile deployers
- * + root/{name}/deploy - installed deployments
- * + root/{name}/apps - post install deployments
- * + root/{name}/attachments - pre-processed attachments + admin edits to deployments
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class SerializableDeploymentRepository extends AbstractAttachmentStore
- implements DeploymentRepository
-{
- private static final Logger log = Logger.getLogger(SerializableDeploymentRepository.class);
-
- /** The server root container the deployments */
- private File root;
- /** The bootstrap descriptor dir */
- private File bootstrapDir;
- /** The server static libraries */
- private File libDir;
- /** The deployers phase deployments dir */
- private File deployersDir;
- /** The application phase deployments dir */
- private File[] applicationDirs;
- /** The application phase deployment files keyed by VirtualFile URI string */
- private final Map<String, VirtualFile> applicationVFCache = new HashMap<String, VirtualFile>();
- /** The deployment post edit root location */
- private File adminEditsRoot;
- /** The profile key this repository is associated with */
- private ProfileKey key;
- /** The bootstrap VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> bootstrapCtxs = new LinkedHashMap<String,VFSDeployment>();
- /** The deployer VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> deployerCtxs = new LinkedHashMap<String,VFSDeployment>();
- /** The application VFSDeployments */
- private LinkedHashMap<String,VFSDeployment> applicationCtxs = new LinkedHashMap<String,VFSDeployment>();
-
- private Map<String, Integer> contentFlags = new ConcurrentHashMap<String, Integer>();
- /** The last time the profile was modified */
- private long lastModified;
- /** A lock for the hot deployment/{@link #getModifiedDeployments()} */
- private ReentrantReadWriteLock contentLock = new ReentrantReadWriteLock(true);
- /** Should an attempt to overwrite existing content fail in {@link #addDeploymentContent(String, ZipInputStream, DeploymentPhase)}*/
- private boolean failIfAlreadyExists = false;
-
- /** Allowed deployments filter */
- private VirtualFileFilter deploymentFilter;
- /** The structure modification checker */
- private StructureModificationChecker checker;
-
- public SerializableDeploymentRepository(File root, URI[] appURIs, ProfileKey key)
- {
- this.root = root;
- this.key = key;
- this.setApplicationURIs(appURIs);
- }
-
- public URI[] getApplicationURIs()
- {
- URI[] appURIs = new URI[applicationDirs.length];
- for (int n = 0; n < applicationDirs.length; n ++)
- {
- File applicationDir = applicationDirs[n];
- appURIs[n] = applicationDir.toURI();
- }
- return appURIs;
- }
- public void setApplicationURIs(URI[] uris)
- {
- applicationDirs = new File[uris.length];
- for (int n = 0; n < uris.length; n ++)
- {
- URI uri = uris[n];
- applicationDirs[n] = new File(uri);
- }
- }
-
- public boolean exists()
- {
- File profileRoot = new File(root, key.getName());
- return profileRoot.exists();
- }
-
- public String getAttachmentsRoot()
- {
- String path = null;
- if(adminEditsRoot != null)
- path = adminEditsRoot.getAbsolutePath();
- return path;
- }
- public void setAttachmentsRoot(String root)
- {
- adminEditsRoot = new File(root);
- }
-
- public VirtualFileFilter getDeploymentFilter()
- {
- return deploymentFilter;
- }
-
- public void setDeploymentFilter(VirtualFileFilter deploymentFilter)
- {
- this.deploymentFilter = deploymentFilter;
- }
-
- @Deprecated
- public VirtualFileFilter getHotDeploymentFilter()
- {
- return null;
- }
-
- @Deprecated
- public void setHotDeploymentFilter(VirtualFileFilter hotDeploymentFilter)
- {
- }
-
- protected StructureModificationChecker getChecker()
- {
- if (checker == null)
- throw new IllegalArgumentException("Null checker");
-
- return checker;
- }
-
- public void setChecker(StructureModificationChecker checker)
- {
- this.checker = checker;
- }
-
- public long getLastModified()
- {
- return this.lastModified;
- }
-
- public URI getDeploymentURI(DeploymentPhase phase)
- {
- URI uri = null;
- switch( phase )
- {
- case BOOTSTRAP:
- uri = this.getBootstrapURI();
- break;
- case DEPLOYER:
- uri = this.getDeployersURI();
- break;
- case APPLICATION:
- uri = this.getApplicationURI();
- break;
- }
- return uri;
- }
-
- public void setDeploymentURI(URI uri, DeploymentPhase phase)
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.setBootstrapURI(uri);
- break;
- case DEPLOYER:
- this.setDeployersURI(uri);
- break;
- case APPLICATION:
- this.setApplicationURIs(new URI[]{uri});
- break;
- }
- }
- public Set<String> getDeploymentNames()
- {
- HashSet<String> names = new HashSet<String>();
- names.addAll(bootstrapCtxs.keySet());
- names.addAll(deployerCtxs.keySet());
- names.addAll(applicationCtxs.keySet());
- return names;
- }
- public Set<String> getDeploymentNames(DeploymentPhase phase)
- {
- HashSet<String> names = new HashSet<String>();
- switch( phase )
- {
- case BOOTSTRAP:
- names.addAll(this.bootstrapCtxs.keySet());
- break;
- case DEPLOYER:
- names.addAll(this.deployerCtxs.keySet());
- break;
- case APPLICATION:
- names.addAll(this.applicationCtxs.keySet());
- break;
- }
- return names;
- }
-
- /**
- *
- */
- public String addDeploymentContent(String name, InputStream contentIS, DeploymentPhase phase)
- throws IOException
- {
- boolean trace = log.isTraceEnabled();
- // Suspend hot deployment checking
- if( trace )
- log.trace("Aquiring content read lock");
- contentLock.writeLock().lock();
- String repositoryName = null;
- try
- {
- // Write the content out
- File contentRoot = getPhaseDir(phase);
- if(contentRoot == null)
- throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
- File contentFile = new File(contentRoot, name);
- // TODO do we need to create the parent directory if the name is myDeployments/myRealDeployment.jar ?
-
- if(failIfAlreadyExists && contentFile.exists())
- throw new SyncFailedException("Deployment content already exists: "+contentFile.getAbsolutePath());
- 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();
- // Get the vfs uri for the content as the repository name
- VirtualFile contentVF = VFS.getVirtualFile(contentRoot.toURI(), name);
- repositoryName = contentVF.getName();
- }
- finally
- {
- try
- {
- fos.close();
- }
- catch (IOException ignored)
- {
- }
- }
-
- // Lock the content
- lockDeploymentContent(name, phase);
- }
- finally
- {
- // Allow hot deployment checking
- contentLock.writeLock().unlock();
- if(trace)
- log.trace("Released content write lock");
- }
- return repositoryName;
- }
-
- /**
- * @throws URISyntaxException
- *
- */
- public VirtualFile getDeploymentContent(String name, DeploymentPhase phase)
- throws IOException, URISyntaxException
- {
- // find the cached root
- switch( phase )
- {
- case BOOTSTRAP:
- case DEPLOYER:
- throw new IOException(phase+" content access not supported");
- case APPLICATION:
- case APPLICATION_TRANSIENT:
- break;
- }
- // get cached version
- File contentRoot = getPhaseDir(phase);
- if(contentRoot == null)
- throw new FileNotFoundException("Failed to obtain content dir for phase: "+phase);
- File contentFile = new File(contentRoot, name);
- VirtualFile content = getCachedApplicationVF(contentFile);
- if(content == null || content.exists() == false)
- throw new FileNotFoundException("Failed to find content for: "+name);
- return content;
- }
-
- public String[] getRepositoryNames(String[] names, DeploymentPhase phase) throws IOException
- {
- List<String> tmp = new ArrayList<String>();
- URI rootURI = getDeploymentURI(phase);
- VirtualFile root = VFS.getRoot(rootURI);
- for(String name : names)
- {
- VirtualFile content = root.getChild(name);
- try
- {
- String rname = content.toURI().toString();
- tmp.add(rname);
- }
- catch (URISyntaxException e)
- {
- log.error("Should not happen", e);
- }
- }
- String[] rnames = new String[tmp.size()];
- tmp.toArray(rnames);
- return rnames;
- }
-
- public int lockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- if( log.isTraceEnabled() )
- log.trace("lockDeploymentContent, "+vfsPath);
- return setDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
- }
-
- public int unlockDeploymentContent(String vfsPath, DeploymentPhase phase)
- {
- if( log.isTraceEnabled() )
- log.trace("unlockDeploymentContent, "+vfsPath);
- return clearDeploymentContentFlags(vfsPath, phase, DeploymentContentFlags.LOCKED);
- }
-
- public int getDeploymentContentFlags(String vfsPath, DeploymentPhase phase)
- {
- Integer flags = contentFlags.get(vfsPath);
- return flags != null ? flags : 0;
- }
- public synchronized int clearDeploymentContentFlags(String vfsPath,
- DeploymentPhase phase,
- 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, DeploymentPhase phase,
- int flag)
- {
- Integer flags = contentFlags.get(vfsPath);
- boolean hasFlag = false;
- if(flags != null )
- hasFlag = (flags & flag) != 0;
- return hasFlag;
- }
- public int setDeploymentContentFlags(String vfsPath, DeploymentPhase phase,
- int flags)
- {
- contentFlags.put(vfsPath, flags);
- return flags;
- }
-
- public void acquireDeploymentContentLock()
- {
- contentLock.writeLock().lock();
- if( log.isTraceEnabled() )
- log.trace("acquireDeploymentContentLock, have write lock");
- }
- public void releaseDeploymentContentLock()
- {
- contentLock.writeLock().unlock();
- if( log.isTraceEnabled() )
- log.trace("releaseDeploymentContentLock, gave up write lock");
- }
-
- public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
- throws Exception
- {
- switch( phase )
- {
- case BOOTSTRAP:
- this.addBootstrap(vfsPath, d);
- break;
- case DEPLOYER:
- this.addDeployer(vfsPath, d);
- break;
- case APPLICATION:
- this.addApplication(vfsPath, d);
- break;
- case APPLICATION_TRANSIENT:
- this.addApplication(vfsPath, d);
- break;
- }
- lastModified = System.currentTimeMillis();
- }
-
- public VFSDeployment getDeployment(String name, DeploymentPhase phase)
- throws Exception, NoSuchDeploymentException
- {
- VFSDeployment ctx = null;
- if( phase == null )
- {
- // Try all phases
- try
- {
- ctx = this.getBootstrap(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getDeployer(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- try
- {
- if( ctx == null )
- ctx = this.getApplication(name);
- }
- catch(NoSuchDeploymentException ignore)
- {
- }
- }
- else
- {
- switch( phase )
- {
- case BOOTSTRAP:
- ctx = this.getBootstrap(name);
- break;
- case DEPLOYER:
- ctx = this.getDeployer(name);
- break;
- case APPLICATION:
- ctx = this.getApplication(name);
- break;
- }
- }
- // Make sure we don't return null
- if( ctx == null )
- throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- return ctx;
- }
-
- public Collection<VFSDeployment> getDeployments()
- {
- HashSet<VFSDeployment> deployments = new HashSet<VFSDeployment>();
- deployments.addAll(this.bootstrapCtxs.values());
- deployments.addAll(this.deployerCtxs.values());
- deployments.addAll(this.applicationCtxs.values());
- return Collections.unmodifiableCollection(deployments);
- }
-
- /**
- * Scan the applications for changes.
- */
- public synchronized Collection<ModificationInfo> getModifiedDeployments()
- throws Exception
- {
- ArrayList<ModificationInfo> modified = new ArrayList<ModificationInfo>();
- Collection<VFSDeployment> apps = getApplications();
- boolean trace = log.isTraceEnabled();
- if( trace )
- log.trace("Checking applications for modifications");
- if( trace )
- log.trace("Aquiring content read lock");
- contentLock.readLock().lock();
- try
- {
- if( apps != null )
- {
- Iterator<VFSDeployment> iter = apps.iterator();
- int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
- while( iter.hasNext() )
- {
- VFSDeployment ctx = iter.next();
- VirtualFile root = ctx.getRoot();
- String pathName = root.getPathName();
- // Ignore locked or disabled applications
- if(this.hasDeploymentContentFlags(pathName, DeploymentPhase.APPLICATION, ignoreFlags))
- {
- if(trace)
- log.trace("Ignoring locked application: "+root);
- continue;
- }
- // Check for removal
- if( root.exists() == false )
- {
- long rootLastModified = root.getLastModified();
- ModificationInfo info = new ModificationInfo(ctx, rootLastModified, ModifyStatus.REMOVED);
- modified.add(info);
- iter.remove();
- // Remove last modified cache
- getChecker().removeStructureRoot(root);
- if( trace )
- log.trace(pathName + " was removed");
- }
- // Check for modification
- else if( hasBeenModified(root) ||
- hasDeploymentContentFlags(pathName, DeploymentPhase.APPLICATION, DeploymentContentFlags.MODIFIED) )
- {
- long rootLastModified = root.getLastModified();
- if( trace )
- log.trace(pathName + " was modified: " + rootLastModified);
- // Need to create a duplicate ctx
- VFSDeployment ctx2 = loadDeploymentData(root, DeploymentPhase.APPLICATION);
- ModificationInfo info = new ModificationInfo(ctx2, rootLastModified, ModifyStatus.MODIFIED);
- modified.add(info);
- }
- // TODO: this could check metadata files modifications as well
- }
- // Now check for additions
- for (File applicationDir : applicationDirs)
- {
- VirtualFile deployDir = getCachedApplicationVF(applicationDir);
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addedDeployments(added, deployDir);
- for(VirtualFile vf : added)
- {
- if(this.hasDeploymentContentFlags(vf.getPathName(), DeploymentPhase.APPLICATION, ignoreFlags))
- {
- if(trace)
- log.trace("Ignoring locked application: "+ vf);
- continue;
- }
- VFSDeployment ctx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
- ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
- modified.add(info);
- getChecker().addStructureRoot(vf);
- applicationCtxs.put(ctx.getName(), ctx);
- }
- }
- }
- }
- finally
- {
- contentLock.readLock().unlock();
- if( trace )
- log.trace("Released content read lock");
- }
-
- if(modified.size() > 0)
- lastModified = System.currentTimeMillis();
- return modified;
- }
-
- /**
- * Check if the deployment has been modified.
- *
- * @param root the virtual file root
- * @return true if modifed
- * @throws Exception for any error
- */
- protected boolean hasBeenModified(VirtualFile root) throws Exception
- {
- return getChecker().hasStructureBeenModified(root);
- }
-
- /**
- * Has vfs deployment context been modified.
- *
- * @param deploymentContext the vfs deployment context
- * @return true if modified
- * @throws IOException for any error
- */
- protected boolean hasBeenModified(VFSDeploymentContext deploymentContext) throws IOException
- {
- return getChecker().hasStructureBeenModified(deploymentContext);
- }
-
- /**
- * Cleanup last modified cache for path name.
- *
- * @param pathName the path name
- */
- @Deprecated
- protected void removeLastModifiedCache(String pathName)
- {
- log.warn("This method has no usage anymore, use StructureModificationChecher instead.");
- }
-
- public Collection<VFSDeployment> getDeployments(DeploymentPhase phase)
- throws Exception
- {
- Collection<VFSDeployment> ctxs = null;
- switch( phase )
- {
- case BOOTSTRAP:
- ctxs = this.getBootstraps();
- break;
- case DEPLOYER:
- ctxs = this.getDeployers();
- break;
- case APPLICATION:
- ctxs = this.getApplications();
- break;
- }
- return ctxs;
- }
-
- public VFSDeployment removeDeployment(String name, DeploymentPhase phase)
- throws Exception
- {
- VFSDeployment ctx = null;
- switch( phase )
- {
- case BOOTSTRAP:
- ctx = this.removeBootstrap(name);
- break;
- case DEPLOYER:
- ctx = this.removeDeployer(name);
- break;
- case APPLICATION:
- ctx = this.removeApplication(name);
- break;
- }
- if(ctx != null)
- lastModified = System.currentTimeMillis();
- return ctx;
- }
-
- public String toString()
- {
- StringBuilder tmp = new StringBuilder(super.toString());
- tmp.append("(root=");
- tmp.append(root);
- tmp.append(", key=");
- tmp.append(key);
- tmp.append(")");
- return tmp.toString();
- }
-
- /**
- * Create a profile deployment repository
- *
- * @throws IOException
- */
- public void create() throws Exception
- {
- File profileRoot = new File(root, key.getName());
- if( profileRoot.exists() == true )
- throw new IOException("Profile root already exists: "+profileRoot);
- if( profileRoot.mkdirs() == false )
- throw new IOException("Failed to create profile root: "+profileRoot);
- // server/{name}/bootstrap
- bootstrapDir = new File(profileRoot, "bootstrap");
- if( bootstrapDir.mkdirs() == false )
- throw new IOException("Failed to create profile bootstrap dir: "+bootstrapDir);
-
- // server/{name}/deployers
- deployersDir = new File(profileRoot, "deployers");
- if( deployersDir.mkdirs() == false )
- throw new IOException("Failed to create profile deployers dir: "+deployersDir);
-
- // server/{name}/deploy
- for (File applicationDir : applicationDirs)
- {
- if( applicationDir.mkdirs() == false )
- throw new IOException("Failed to create profile deploy dir: "+applicationDir);
- }
- // server/{name}/lib
- libDir = new File(profileRoot, "lib");
- if( libDir.mkdirs() == false )
- throw new IOException("Failed to create profile lib dir: "+libDir);
-
- if( adminEditsRoot.exists() == false && adminEditsRoot.mkdirs() == false )
- throw new IOException("Failed to create profile adminEdits dir: "+adminEditsRoot);
- }
-
- /**
- * Load the profile deployments
- *
- * @throws IOException
- * @throws NoSuchProfileException
- */
- public void load() throws Exception, NoSuchProfileException
- {
- if( serializer == null )
- throw new IllegalStateException("serializer has not been set");
-
- File profileRoot = new File(root, key.getName());
- if( profileRoot.exists() == false )
- throw new NoSuchProfileException("Profile root does not exists: "+profileRoot);
- // server/{name}/bootstrap
- bootstrapDir = new File(profileRoot, "bootstrap");
- if( bootstrapDir.exists() == false )
- {
- //throw new FileNotFoundException("Profile contains no bootstrap dir: "+bootstrapDir);
- // fallback to conf/jboss-service.xml for now
- bootstrapDir = null;
- }
-
- // server/{name}/deployers
- deployersDir = new File(profileRoot, "deployers");
- if( deployersDir.exists() == false )
- throw new FileNotFoundException("Profile contains no deployers dir: "+deployersDir);
-
- // server/{name}/deploy
- for (File applicationDir : applicationDirs)
- {
- if( applicationDir.exists() == false )
- throw new FileNotFoundException("Profile contains no deploy dir: "+applicationDir);
- }
-
- if(this.serializer instanceof AbstractFileAttachmentsSerializer)
- ((AbstractFileAttachmentsSerializer) this.serializer).setAttachmentsStoreDir(adminEditsRoot);
-
- if( bootstrapDir != null )
- {
- VFS bootstrapVFS = VFS.getVFS(bootstrapDir.toURI());
- loadBootstraps(bootstrapVFS.getRoot());
- }
- else
- {
- // hack to load conf/jboss-service.xml until its removed
- loadBootstraps(null);
- }
- VFS deployersVFS = VFS.getVFS(deployersDir.toURI());
- loadDeployers(deployersVFS.getRoot());
- for (File applicationDir : applicationDirs)
- {
- VirtualFile dirVF = getCachedApplicationVF(applicationDir);
- loadApplications(dirVF);
- }
-
- this.lastModified = System.currentTimeMillis();
- }
-
- /**
- * Get virtual file for app dir.
- *
- * @param applicationDir the app dir
- * @return virtual file representing app dir
- * @throws IOException for any error
- */
- protected VirtualFile getCachedApplicationVF(File applicationDir) throws IOException
- {
- URI uri = applicationDir.toURI();
- return getCachedApplicationVF(uri);
- }
-
- /**
- * Get virtual file for app uri.
- *
- * @param uri the app uri
- * @return virtual file representing app uri
- * @throws IOException for any error
- */
- protected VirtualFile getCachedApplicationVF(URI uri) throws IOException
- {
- String uriString = uri.toString();
- VirtualFile dir;
- synchronized (applicationVFCache)
- {
- dir = applicationVFCache.get(uriString);
- if (dir == null)
- {
- dir = VFS.getRoot(uri);
- applicationVFCache.put(uriString, dir);
- }
- }
- return dir;
- }
-
- /**
- * Remove the contents of the profile repository
- * @throws IOException
- * @throws NoSuchProfileException
- */
- public void remove() throws IOException, NoSuchProfileException
- {
- File profileRoot = new File(root, key.getName());
- Files.delete(profileRoot);
- }
-
- protected void addBootstrap(String vfsPath, VFSDeployment ctx)
- throws Exception
- {
- this.bootstrapCtxs.put(vfsPath, ctx);
- }
-
- // Managed object attachments for a deployment
- public void addManagedObject(String vfsPath, Attachments edits)
- throws IOException
- {
- // TODO what should this do ?
- throw new UnsupportedOperationException("addManagedObject");
-// Map<String, Object> map = edits.getAttachments();
-// File attachments = new File(adminEditsRoot, vfsPath+".edits");
-// ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(attachments));
-// try
-// {
-// oos.writeObject(map);
-// }
-// finally
-// {
-// try
-// {
-// oos.close();
-// }
-// catch (IOException ignore)
-// {
-// }
-// }
-// lastModified = System.currentTimeMillis();
- }
-
- protected void addDeployer(String vfsPath, VFSDeployment ctx)
- throws Exception
- {
- this.deployerCtxs.put(vfsPath, ctx);
- }
-
- protected void addApplication(String vfsPath, VFSDeployment ctx) throws Exception
- {
- log.info("Adding application: " + vfsPath + " / " + ctx);
- this.applicationCtxs.put(vfsPath, ctx);
- }
-
- protected VFSDeployment getBootstrap(String vfsPath) throws Exception
- {
- VFSDeployment ctx = bootstrapCtxs.get(vfsPath);
- if( ctx == null )
- throw new NoSuchDeploymentException(vfsPath);
- return ctx;
- }
-
- protected Collection<VFSDeployment> getBootstraps() throws Exception
- {
- return bootstrapCtxs.values();
- }
-
- protected File getPhaseDir(DeploymentPhase phase)
- {
- File dir = null;
- switch( phase )
- {
- case BOOTSTRAP:
- dir = bootstrapDir;
- break;
- case DEPLOYER:
- dir = deployersDir;
- break;
- case APPLICATION:
- dir = applicationDirs[0];
- break;
- case APPLICATION_TRANSIENT:
- // TODO
- break;
- }
- return dir;
- }
-
- protected URI getBootstrapURI()
- {
- return bootstrapDir.toURI();
- }
- protected URI getDeployersURI()
- {
- return deployersDir.toURI();
- }
- protected URI getApplicationURI()
- {
- File applicationDir = applicationDirs[0];
- return applicationDir.toURI();
- }
- protected VFSDeployment getDeployer(String vfsPath)
- throws Exception
- {
- VFSDeployment ctx = deployerCtxs.get(vfsPath);
- if( ctx == null )
- throw new NoSuchDeploymentException(vfsPath);
- return ctx;
- }
-
- protected Collection<VFSDeployment> getDeployers()
- throws Exception
- {
- return deployerCtxs.values();
- }
-
- protected VFSDeployment getApplication(String vfsPath) throws Exception
- {
- boolean trace = log.isTraceEnabled();
- VFSDeployment ctx = applicationCtxs.get(vfsPath);
- if( ctx == null )
- {
- // Try to find the simple name
- if(trace)
- log.trace("Failed to find application for: "+vfsPath+", scanning for simple name");
- for(VFSDeployment deployment : applicationCtxs.values())
- {
- if(trace)
- log.trace("Checking: "+deployment.getSimpleName());
- if(deployment.getSimpleName().equals(vfsPath))
- {
- if(trace)
- log.trace("Matched to simple name of deployment:"+deployment);
- ctx = deployment;
- break;
- }
- }
- if(ctx == null)
- {
- log.debug("Failed to find application for: "+vfsPath+", available: " + applicationCtxs.values());
- throw new NoSuchDeploymentException(vfsPath);
- }
- }
- return ctx;
- }
-
- protected Collection<VFSDeployment> getApplications()
- throws Exception
- {
- return applicationCtxs.values();
- }
-
- protected VFSDeployment removeBootstrap(String vfsPath) throws IOException
- {
- VFSDeployment vfsDeployment = bootstrapCtxs.get(vfsPath);
- if(vfsDeployment == null)
- throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + bootstrapCtxs.values());
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return bootstrapCtxs.remove(vfsPath);
- }
-
- // this is an infinite loop
- protected VFSDeployment removeDeployer(String vfsPath) throws IOException
- {
- VFSDeployment vfsDeployment = deployerCtxs.get(vfsPath);
- if(vfsDeployment == null)
- throw new IllegalStateException("Deployment not found: " + vfsPath + ", available: " + deployerCtxs.values());
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return deployerCtxs.remove(vfsPath);
- }
- protected VFSDeployment removeApplication(String vfsPath) throws Exception
- {
- VFSDeployment vfsDeployment = getApplication(vfsPath);
- VirtualFile root = vfsDeployment.getRoot();
- if(root.delete() == false)
- throw new IOException("Failed to delete: " + root);
- return this.applicationCtxs.remove(vfsPath);
- }
- protected void setBootstrapURI(URI uri)
- {
- bootstrapDir = new File(uri);
- }
- protected void setDeployersURI(URI uri)
- {
- deployersDir = new File(uri);
- }
-
- /**
- * Load the bootstrap descriptors under bootstrapDir:
- *
- * @param bootstrapDir
- * @throws IOException
- */
- private void loadBootstraps(VirtualFile bootstrapDir)
- throws IOException
- {
- if( bootstrapDir != null )
- {
- List<VirtualFile> children = bootstrapDir.getChildren();
- for(VirtualFile vf : children)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.BOOTSTRAP);
- bootstrapCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
- else
- {
- // fallback to conf/jboss-service.xml for now
- File profileRoot = new File(root, key.getName());
- File confDir = new File(profileRoot, "conf");
- VirtualFile confVF = VFS.getRoot(confDir.toURI());
- VirtualFile jbossServiceVF = confVF.getChild("jboss-service.xml");
- if(jbossServiceVF == null)
- throw new FileNotFoundException("Failed to find jboss-service.xml under conf");
- VFSDeployment vfCtx = loadDeploymentData(jbossServiceVF, DeploymentPhase.BOOTSTRAP);
- bootstrapCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Load all the deployments under the deployersDir.
- *
- * @param deployersDir
- * @throws IOException
- */
- private void loadDeployers(VirtualFile deployersDir)
- throws IOException
- {
- List<VirtualFile> children = deployersDir.getChildren();
- for(VirtualFile vf : children)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.DEPLOYER);
- deployerCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Load all the applications under the applicationDir.
- *
- * @param applicationDir
- * @throws IOException
- */
- private void loadApplications(VirtualFile applicationDir)
- throws Exception
- {
- ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
- addedDeployments(added, applicationDir);
- for (VirtualFile vf : added)
- {
- VFSDeployment vfCtx = loadDeploymentData(vf, DeploymentPhase.APPLICATION);
- applicationCtxs.put(vfCtx.getName(), vfCtx);
- }
- }
-
- /**
- * Added deployments for DeploymentPhase.APPLICATION.
- *
- * @param list
- * @param root
- * @throws Exception
- */
- private void addedDeployments(List<VirtualFile> list, VirtualFile root)
- throws Exception
- {
- List<VirtualFile> components = root.getChildren();
-
- for (VirtualFile component : components)
- {
- // Excluding files from scanning
- if(! this.deploymentFilter.accepts(component))
- {
- log.trace("ignoring "+ component);
- continue;
- }
-
- String key = component.toURI().toString();
- if (applicationCtxs.containsKey(key) == true)
- continue;
-
- if (component.isLeaf())
- {
- list.add(component);
- }
- else if (component.getName().indexOf('.') == -1)
- {
- // recurse if not '.' in name and recursive search is enabled
- addedDeployments(list, component);
- }
- else
- {
- list.add(component);
- }
- }
- }
-
- /**
- * Update a deployment.
- *
- * @param d the deployment
- * @param phase the deployment phase
- * @param comp the managed component
- * @throws Exception
- */
- public void updateDeployment(VFSDeployment d, DeploymentPhase phase,
- ManagedComponent comp) throws Exception
- {
- if(comp != null)
- {
- // update component
- super.updateDeployment(d, phase, comp);
- // Update last modified
- this.lastModified = System.currentTimeMillis();
- }
- else
- {
- log.error("no metadata attached.");
- }
- }
-
- protected VFSDeployment loadDeploymentData(VirtualFile file, DeploymentPhase phase)
- {
- try
- {
- return super.loadDeploymentData(file, phase);
- }
- catch(Exception e)
- {
- throw new RuntimeException("Could not load deployment data: "+ file, e);
- }
- }
-
-}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,175 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.io.File;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.profileservice.spi.DeploymentRepository;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Factory for SerializableDeploymentRepository
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class SerializableDeploymentRepositoryFactory
- implements DeploymentRepositoryFactory
-{
- /** The server root containing the deployments */
- private File root;
- /** The root location for admin edits */
- private String attachmentsRoot;
- /** The URIs for the application deployments */
- private URI[] appURIs = {};
- /** The attachment serializer */
- private AttachmentsSerializer serializer;
- /** The main deployer structure */
- private MainDeployerStructure mainDeployer;
- /** The deployment filter */
- private VirtualFileFilter deploymentFilter;
- /** The HotDeployment filter */
- private VirtualFileFilter hotDeploymentFilter;
- /** The structure modification checker */
- private StructureModificationChecker checker;
-
- /** The profile repositories */
- private Map<ProfileKey, DeploymentRepository> profileRepositories = new HashMap<ProfileKey, DeploymentRepository>();
-
- /**
- * Get the server profile store root directory.
- * @return the server profile root directory containing the
- * available profiles.
- */
- public File getStoreRoot()
- {
- return root;
- }
- /**
- * Set the profiles store root.
- * @param root - the server profile root directory containing the
- * available profiles.
- */
- public void setStoreRoot(File root)
- {
- this.root = root;
- }
- public String getAttachmentsRoot()
- {
- return attachmentsRoot;
- }
- public void setAttachmentsRoot(String attachmentsRoot)
- {
- this.attachmentsRoot = attachmentsRoot;
- }
- public URI[] getApplicationURIs()
- {
- return appURIs;
- }
- public void setApplicationURIs(URI[] appURIs)
- {
- this.appURIs = appURIs;
- }
-
- public AttachmentsSerializer getSerializer()
- {
- return serializer;
- }
-
- public void setSerializer(AttachmentsSerializer serializer)
- {
- this.serializer = serializer;
- }
-
- public VirtualFileFilter getDeploymentFilter()
- {
- return deploymentFilter;
- }
-
- public void setDeploymentFilter(VirtualFileFilter deploymentFilter)
- {
- this.deploymentFilter = deploymentFilter;
- }
-
- @Deprecated
- public VirtualFileFilter getHotDeploymentFilter()
- {
- return hotDeploymentFilter;
- }
-
- @Deprecated
- public void setHotDeploymentFilter(VirtualFileFilter hotDeploymentFilter)
- {
- this.hotDeploymentFilter = hotDeploymentFilter;
- }
-
- public MainDeployerStructure getMainDeployer()
- {
- return mainDeployer;
- }
-
- public void setMainDeployer(MainDeployerStructure mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- public StructureModificationChecker getChecker()
- {
- return checker;
- }
-
- public void setChecker(StructureModificationChecker checker)
- {
- this.checker = checker;
- }
-
- public synchronized DeploymentRepository getDeploymentRepository(ProfileKey key)
- {
- if (appURIs == null || appURIs.length == 0)
- {
- File deployDir = new File(root, key.getName()+"/deploy");
- appURIs = new URI[]{deployDir.toURI()};
- }
- DeploymentRepository dr = profileRepositories.get(key);
- if(dr == null)
- {
- SerializableDeploymentRepository repo = new SerializableDeploymentRepository(root, appURIs, key);
- repo.setAttachmentsRoot(attachmentsRoot);
- repo.setSerializer(serializer);
- repo.setDeploymentFilter(deploymentFilter);
- repo.setHotDeploymentFilter(hotDeploymentFilter);
- repo.setMainDeployer(mainDeployer);
- repo.setChecker(checker);
- profileRepositories.put(key, repo);
- dr = repo;
- }
- return dr;
- }
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/StaticProfileFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,253 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.AbstractProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicSubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.ImmutableProfileSourceMetaData;
+
+/**
+ * A profile factory based on a static configuration.
+ * This creates the legacy configuration: bootstrap, deployers, and the
+ * root profile.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class StaticProfileFactory extends AbstractBootstrapProfileFactory
+{
+
+ /** The bootstrap profile name. */
+ private String bootstrapName = "bootstrap";
+
+ /** The deployers profile name. */
+ private String deployersName = "deployers";
+
+ /** The applications profile name. */
+ private String applicationsName = "applications";
+
+ /** The bootstrap uri. */
+ private URI bootstrapURI;
+
+ /** The deployers uri. */
+ private URI deployersURI;
+
+ /** The attachment store uri. */
+ private File attachmentStoreRoot;
+
+ /** The application uris. */
+ private List<URI> applicationURIs;
+
+ public String getBootstrapName()
+ {
+ return bootstrapName;
+ }
+
+ public void setBootstrapName(String bootstrapName)
+ {
+ this.bootstrapName = bootstrapName;
+ }
+
+ public String getDeployersName()
+ {
+ return deployersName;
+ }
+
+ public void setDeployersName(String deployersName)
+ {
+ this.deployersName = deployersName;
+ }
+
+ public String getApplicationsName()
+ {
+ return applicationsName;
+ }
+
+ public void setApplicationsName(String applicationsName)
+ {
+ this.applicationsName = applicationsName;
+ }
+
+ public URI getBootstrapURI()
+ {
+ return bootstrapURI;
+ }
+
+ public void setBootstrapURI(URI bootstrapURI)
+ {
+ this.bootstrapURI = bootstrapURI;
+ }
+
+ public URI getDeployersURI()
+ {
+ return deployersURI;
+ }
+
+ public void setDeployersURI(URI deployersURI)
+ {
+ this.deployersURI = deployersURI;
+ }
+
+ public File getAttachmentStoreRoot()
+ {
+ return attachmentStoreRoot;
+ }
+
+ public void setAttachmentStoreRoot(File attachmentStoreRoot)
+ {
+ this.attachmentStoreRoot = attachmentStoreRoot;
+ }
+
+ public List<URI> getApplicationURIs()
+ {
+ if(applicationURIs == null)
+ return Collections.emptyList();
+ return applicationURIs;
+ }
+
+ public void setApplicationURIs(List<URI> applicationURIs)
+ {
+ this.applicationURIs = applicationURIs;
+ }
+
+ public void create() throws Exception
+ {
+ // Sanity checks
+ if(this.bootstrapURI == null)
+ throw new IllegalStateException("Null bootstrap uri.");
+ if(this.deployersURI == null)
+ throw new IllegalStateException("Null deployers uri.");
+ if(this.applicationURIs == null)
+ throw new IllegalStateException("Null application uris.");
+ }
+
+ /**
+ * Create the legacy profiles, based on the injected uris.
+ *
+ * @param rootKey the key for the root profile.
+ * @throws Exception
+ */
+ @Override
+ protected void createProfileMetaData(ProfileKey rootKey, URL url) throws Exception
+ {
+ if(rootKey == null)
+ throw new IllegalArgumentException("Null root profile key.");
+
+ // Create bootstrap profile meta data
+ ProfileKey bootstrapKey = new ProfileKey(bootstrapName);
+ ProfileMetaData bootstrap = createProfileMetaData(
+ bootstrapName, false, new URI[] { bootstrapURI }, new String[0]);
+ addProfile(bootstrapKey, bootstrap);
+
+ // Create deployers profile meta data
+ ProfileKey deployersKey = new ProfileKey(deployersName);
+ ProfileMetaData deployers = createProfileMetaData(
+ deployersName, false, new URI[] { deployersURI }, new String[] { bootstrapName });
+ addProfile(deployersKey, deployers);
+
+ // Create applications profile meta data
+ ProfileKey applicationsKey = new ProfileKey(applicationsName);
+ URI[] applicationURIs = getApplicationURIs().toArray(new URI[getApplicationURIs().size()]);
+ String[] applicationsSubProfiles = new String[] { bootstrapName, deployersName };
+ ProfileMetaData applications = createProfileMetaData(
+ applicationsName, true, applicationURIs, applicationsSubProfiles);
+ // Add to profile map
+ addProfile(applicationsKey, applications);
+
+ // Create empty root profile;
+ String[] rootSubProfiles = new String[] { applicationsName };
+ ProfileMetaData root = createProfileMetaData(
+ rootKey.getName(), false, new URI[0], rootSubProfiles);
+ // Add to profile map
+ addProfile(rootKey, root);
+ }
+
+ /**
+ * Create a profile meta data.
+ *
+ * @param name the profile name.
+ * @param hotDeployment if it's a hotDeployment profile
+ * @param uris the repository uris.
+ * @param subProfiles a list of profile dependencies.
+ *
+ * @return the profile meta data.
+ */
+ protected ProfileMetaData createProfileMetaData(String name, boolean hotDeployment, URI[] uris, String[] subProfiles)
+ {
+ // Create profile
+ BasicProfileMetaData metaData = new BasicProfileMetaData();
+ metaData.setName(name);
+ // Create profile sources
+ ProfileSourceMetaData source = createSource(uris, hotDeployment);
+ metaData.setSource(source);
+
+ List<SubProfileMetaData> profileList = new ArrayList<SubProfileMetaData>();
+ for(String subProfile : subProfiles)
+ {
+ BasicSubProfileMetaData md = new BasicSubProfileMetaData();
+ md.setName(subProfile);
+ profileList.add(md);
+ }
+ metaData.setSubprofiles(profileList);
+
+ return metaData;
+ }
+
+ /**
+ * Create a profile repository source meta data.
+ *
+ * @param uris the uris for the repository
+ * @param hotDeployment to create a hotDeployment profile
+ *
+ * @return the profile source meta data.
+ */
+ protected ProfileSourceMetaData createSource(URI[] uris, boolean hotDeployment)
+ {
+ AbstractProfileSourceMetaData source = null;
+ if(hotDeployment)
+ {
+ source = new HotDeploymentProfileSourceMetaData();
+ }
+ else
+ {
+ source = new ImmutableProfileSourceMetaData();
+ }
+ List<String> sources = new ArrayList<String>();
+ for(URI uri : uris)
+ sources.add(uri.toString());
+ source.setSources(sources);
+ return source;
+ }
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice.repository;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-
-import org.jboss.logging.Logger;
-
-/**
- * Use the TCL to load a class on a CNFE as the ObjectInputStream
- * fails to use the TCL one would expect it to.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class TCLObjectInputStream
- extends ObjectInputStream
-{
- private static Logger log = Logger.getLogger(TCLObjectInputStream.class);
- private ClassLoader loader;
-
- public TCLObjectInputStream(InputStream in, ClassLoader loader)
- throws IOException
- {
- super(in);
- this.loader = loader;
- }
-
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException
- {
- String name = desc.getName();
- try
- {
- return super.resolveClass(desc);
- }
- catch(ClassNotFoundException e)
- {
- log.debug("ClassNotFoundException for name="+name+", retrying using TCL");
- return Class.forName(name, false, loader);
- }
- }
-
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,151 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+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;
+import org.jboss.system.server.profile.repository.metadata.FilteredProfileSourceMetaData;
+
+/**
+ * The profile repository.
+ *
+ * This accepts any implementation of DeploymentRepositoryFactory and dispatches
+ * the creation of the repository to one of the installed factories, based on
+ * the exposed types.
+ *
+ * TODO reuse DeploymentRepositories with the same sources ?
+ *
+ * @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();
+
+ // FIXME the filtering should be done by the profile itself!
+ if(source instanceof FilteredProfileSourceMetaData)
+ {
+ ((FilteredProfileSourceMetaData) source).setDeployments(metaData.getDeployments());
+ }
+
+ // 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);
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/VFSDeploymentResource.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/VFSDeploymentResource.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/VFSDeploymentResource.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,123 +0,0 @@
-/*
- * 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.system.server.profileservice.repository;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.Map;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.repository.Capability;
-import org.jboss.profileservice.spi.repository.Repository;
-import org.jboss.profileservice.spi.repository.Requirement;
-import org.jboss.profileservice.spi.repository.Resource;
-import org.jboss.profileservice.spi.repository.Version;
-
-/**
- * TODO: scan deployment for manifest with osgi header info like
- * the version, requirements.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class VFSDeploymentResource
- implements Resource
-{
- private VFSDeployment deployment;
- private Repository repository;
- private String[] categories = {};
- private Capability[] capabilities;
- private Map<String, Object> props;
-
- public VFSDeploymentResource(VFSDeployment deployment, DeploymentPhase phase,
- Repository repository)
- {
- this.deployment = deployment;
- this.repository = repository;
- CapabilityImpl ci = new CapabilityImpl("deployment");
- ci.addProperty("phase", phase);
- this.capabilities = new Capability[]{ci};
- this.props = Collections.singletonMap("deployment", (Object)deployment);
- }
-
- public Capability[] getCapabilities()
- {
- return capabilities;
- }
-
- public String[] getCategories()
- {
- return categories;
- }
-
- public String getId()
- {
- return deployment.getName();
- }
-
- public String getPresentationName()
- {
- return deployment.getSimpleName();
- }
-
- public Map getProperties()
- {
- return props;
- }
-
- public Repository getRepository()
- {
- return repository;
- }
-
- public Requirement[] getRequirements()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getSymbolicName()
- {
- return deployment.getName();
- }
-
- public URI getURI()
- {
- URI uri = null;
- try
- {
- uri = deployment.getRoot().toURI();
- }
- catch(Exception e)
- {
- throw new IllegalStateException(e);
- }
- return uri;
- }
-
- public Version getVersion()
- {
- // TODO Auto-generated method stub
- return null;
- }
-}
Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java (from rev 85384, trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,317 @@
+/*
+ * 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.system.server.profileservice.repository;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.FilteredProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.ProfilesMetaData;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+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.SingletonSchemaResolverFactory;
+
+/**
+ * A profile factory based which generates the ProfileMetaData based on .xml files.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class XmlProfileFactory extends AbstractBootstrapProfileFactory
+{
+ /** The profiles directory name. */
+ public final static String PROFILES_SUFFIX = ".profile";
+
+ /** The attachment store uri. */
+ private File attachmentStoreRoot;
+
+ /** Profile directories */
+ private Collection<VirtualFile> profileDirectories;
+
+ /** The unmarshaller. */
+ private Unmarshaller unmarshaller;
+
+ /** The parsed file list */
+ private Collection<ProfileKey> processedProfileKeys = new ArrayList<ProfileKey>();
+
+ /** The default schema resolver. */
+ private static final DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+
+ static
+ {
+ // Add schema bindings
+ resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
+ resolver.addClassBinding("urn:jboss:profileservice:profile:filtered:1.0", FilteredProfileMetaData.class);
+ resolver.addClassBinding("urn:jboss:profileservice:profile:hotdeployment:1.0", HotDeploymentProfileMetaData.class);
+ }
+
+ public XmlProfileFactory(URI[] profileDirectories) throws Exception
+ {
+ if(profileDirectories == null)
+ throw new IllegalArgumentException("Null directories");
+ this.profileDirectories = new ArrayList<VirtualFile>();
+ for(URI uri : profileDirectories)
+ {
+ VirtualFile vf = VFS.getRoot(uri);
+ if(vf == null)
+ throw new IllegalArgumentException("Could not find uri: " + vf);
+ if(vf.isLeaf())
+ throw new IllegalArgumentException("Not a directory: " + vf);
+ this.profileDirectories.add(vf);
+ }
+ }
+
+ public Collection<VirtualFile> getProfileDirectories()
+ {
+ return profileDirectories;
+ }
+
+ public void setProfileDirectories(Collection<VirtualFile> profileDirectories)
+ {
+ this.profileDirectories = profileDirectories;
+ }
+
+ public File getAttachmentStoreRoot()
+ {
+ return attachmentStoreRoot;
+ }
+
+ public void setAttachmentStoreRoot(File attachmentStoreRoot)
+ {
+ this.attachmentStoreRoot = attachmentStoreRoot;
+ }
+
+ /**
+ * Create the profile meta data.
+ *
+ * @param rootKey the key of the profile/
+ * @param the url pointing to the profile file.
+ * @throws Exception
+ */
+ @Override
+ protected void createProfileMetaData(ProfileKey rootKey, URL url) throws Exception
+ {
+ // Create the unmarshaller
+ this.unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // Get the root profile virtual file
+ VirtualFile vf = getProfileFile(rootKey, url);
+ // Parse
+ ProfilesMetaData rootProfiles = parse(vf);
+ // Process
+ processProfilesMetaData(rootProfiles);
+ }
+
+ /**
+ * process the profile meta data.
+ *
+ * @param metaData the profile meta data.
+ * @throws Exception
+ */
+ protected void processProfileMetaData(ProfileMetaData metaData) throws Exception
+ {
+ // Create profileKey
+ ProfileKey key = createProfileKey(metaData);
+ processProfileMetaData(key, metaData);
+ }
+
+ /**
+ * process the profile meta data
+ *
+ * @param key the profile key.
+ * @param metaData the meta data.
+ *
+ * @throws Exception
+ */
+ protected void processProfileMetaData(ProfileKey key, ProfileMetaData metaData) throws Exception
+ {
+ // Don't process the same key twice
+ if(this.processedProfileKeys.contains(key))
+ return;
+
+ // Add profile meta data
+ addProfile(key, metaData);
+
+ // Process sub profiles
+ processSubProfiles(key, metaData);
+ }
+
+ /**
+ * process the sub profiles.
+ *
+ * @param key the profile key.
+ * @param metaData the profile meta data
+ * @throws Exception
+ */
+ protected void processSubProfiles(ProfileKey key, ProfileMetaData metaData) throws Exception
+ {
+ if(metaData.getSubprofiles() != null && metaData.getSubprofiles().isEmpty() == false)
+ {
+ for(SubProfileMetaData subProfile : metaData.getSubprofiles())
+ {
+ ProfileKey subProfileKey = createProfileKey(subProfile);
+ processSubProfileMetaData(subProfileKey, subProfile);
+ }
+ }
+ }
+
+ /**
+ * process the sub profile.
+ *
+ * @param key the sub profile key.
+ * @param metaData the sub profile meta data.
+ * @throws Exception
+ */
+ protected void processSubProfileMetaData(ProfileKey key, SubProfileMetaData metaData) throws Exception
+ {
+ // get file
+ VirtualFile vf = getProfileFile(key, null);
+ // parse
+ ProfilesMetaData profiles = parse(vf);
+ // TODO maybe override the profiles key (as it should be the same - filename and profiles name
+ // processProfilesMetaData(key, profiles);
+ processProfilesMetaData(profiles);
+ }
+
+ /**
+ * process the profiles meta data.
+ *
+ * @param key the profiles key.
+ * @param metaData the profiles meta data.
+ * @throws Exception
+ */
+ protected void processProfilesMetaData(ProfileKey key, ProfilesMetaData metaData) throws Exception
+ {
+ if(metaData.getProfiles() != null && metaData.getProfiles().isEmpty() == false)
+ {
+ for(ProfileMetaData profile : metaData.getProfiles())
+ {
+ processProfileMetaData(profile);
+ }
+ }
+ // Add the profiles for later resolution
+ addProfiles(key, metaData.getProfiles());
+ }
+
+ /**
+ * Process the <profiles> meta data.
+ * This will add dependencies based on the ordering of the xml.
+ *
+ * @param profilesMetaData the profiles meta data
+ */
+ protected void processProfilesMetaData(ProfilesMetaData profilesMetaData) throws Exception
+ {
+ // The <profiles> key
+ ProfileKey profilesKey = createProfileKey(profilesMetaData);
+ processProfilesMetaData(profilesKey, profilesMetaData);
+ }
+
+ /**
+ * get the virtual file of the profile.
+ *
+ * @param key the profile key.
+ * @param url the url pointing to the file
+ * @return a resolved name if the url is null.
+ *
+ * @throws Exception
+ */
+ protected VirtualFile getProfileFile(ProfileKey key, URL url) throws Exception
+ {
+ if(url != null)
+ return VFS.getRoot(url);
+ else
+ return resolveFile(key.getName());
+ }
+
+ /**
+ * Try to resolve the profile name.
+ *
+ * @param name the profile name.
+ * @return the virtual file
+ * @throws Exception
+ */
+ protected VirtualFile resolveFile(String name) throws Exception
+ {
+ // ProfileKey.getName() + .profile
+ if(name.endsWith(PROFILES_SUFFIX) == false)
+ name = name + PROFILES_SUFFIX;
+
+ VirtualFile vf = null;
+ for(VirtualFile dir : profileDirectories)
+ {
+ vf = dir.getChild(name);
+ if(vf != null)
+ break;
+ }
+ if(vf == null)
+ throw new FileNotFoundException("Could not find profile configuration file for: " + name);
+ return vf;
+ }
+
+ /**
+ * Parse a profile file.
+ *
+ * @param vf the virtual file.
+ * @return the <profiles> meta data
+ * @throws JBossXBException
+ * @throws IOException
+ */
+ protected ProfilesMetaData parse(VirtualFile vf) throws JBossXBException, IOException
+ {
+ if(log.isTraceEnabled())
+ log.trace("parsing file: " + vf.getPathName());
+ return (ProfilesMetaData) unmarshaller.unmarshal(vf.openStream(), resolver);
+ }
+
+ @Override
+ protected void addProfile(ProfileKey key, ProfileMetaData metaData)
+ {
+ // Add to processed keys
+ processedProfileKeys.add(key);
+ // Add to parent
+ super.addProfile(key, metaData);
+ }
+
+ @Override
+ protected void addProfiles(ProfileKey key, List<ProfileMetaData> metaData)
+ {
+ // Add to processed keys
+ processedProfileKeys.add(key);
+ // Add to pared
+ super.addProfiles(key, metaData);
+ }
+}
+
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/security/SecurityPolicy.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/security/SecurityPolicy.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -30,7 +30,7 @@
* SecurityPolicy.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class SecurityPolicy
{
Property changes on: branches/Branch_5_x/system/src/main/org/jboss/system/server/security/SecurityPolicy.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/tools/AbstractDeploymentRepositoryAdapter.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/tools/AbstractDeploymentRepositoryAdapter.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/tools/AbstractDeploymentRepositoryAdapter.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.tools;
-
-import org.jboss.profileservice.spi.DeploymentRepository;
-
-/**
- * Abstract deployment repository adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractDeploymentRepositoryAdapter implements DeploymentRepositoryAdapter
-{
- private DeploymentRepository repository;
-
- protected AbstractDeploymentRepositoryAdapter(DeploymentRepository repository)
- {
- if (repository == null)
- throw new IllegalArgumentException("Null repository");
-
- this.repository = repository;
- }
-
- /**
- * Get repository.
- *
- * @return the repository
- */
- protected DeploymentRepository getRepository()
- {
- return repository;
- }
-
- public void suspend()
- {
- repository.acquireDeploymentContentLock();
- }
-
- public void resume()
- {
- repository.releaseDeploymentContentLock();
- }
-}
\ No newline at end of file
Deleted: branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentRepositoryAdapter.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentRepositoryAdapter.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentRepositoryAdapter.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.tools;
-
-import java.net.URL;
-import java.net.URISyntaxException;
-
-/**
- * Deployment repository adapter.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface DeploymentRepositoryAdapter
-{
- /**
- * Suspend scan.
- */
- void suspend();
-
- /**
- * Resume scan.
- */
- void resume();
-
- /**
- * Add url.
- *
- * @param url the url
- * @throws URISyntaxException for any error
- */
- void addURL(URL url) throws URISyntaxException;
-
- /**
- * Remove url.
- *
- * @param url the url
- * @throws URISyntaxException for any error
- */
- void removeURL(URL url) throws URISyntaxException;
-}
\ No newline at end of file
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentScanner.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentScanner.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/tools/DeploymentScanner.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,59 +21,126 @@
*/
package org.jboss.system.tools;
-import java.net.URL;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.beans.metadata.api.annotations.Start;
import org.jboss.beans.metadata.api.annotations.Stop;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profileservice.repository.MutableDeploymentRepository;
import org.jboss.util.StringPropertyReplacer;
-import org.jboss.bootstrap.spi.ServerConfig;
/**
* Deployment scanner impl - hooking into ProfileService.
*
* @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
*/
@JMX(name = "jboss.deployment:flavor=URL,type=DeploymentScanner", exposedInterface = DeploymentScannerMBean.class, registerDirectly = true)
public class DeploymentScanner implements DeploymentScannerMBean
{
+
+ private static final ProfileKey profileName = new ProfileKey("deployment-scanner-profile");
private ServerConfig serverConfig;
private URL serverHomeURL;
-
- private DeploymentRepositoryAdapter adapter;
-
- public DeploymentScanner(DeploymentRepositoryAdapter adapter)
+ private ProfileService ps;
+ private DeploymentScannerProfile profile;
+ private static final Logger log = Logger.getLogger(DeploymentScanner.class);
+
+ public ProfileService getProfileService()
{
- if (adapter == null)
- throw new IllegalArgumentException("Null adapter");
-
- this.adapter = adapter;
+ return ps;
}
+
+ public void setProfileService(ProfileService ps)
+ {
+ this.ps = ps;
+ }
/**
* Create server home.
*/
- public void create()
+ public void create() throws Exception
{
if (serverConfig == null)
throw new IllegalArgumentException("Null server config.");
serverHomeURL = serverConfig.getServerHomeURL();
+ this.profile = new DeploymentScannerProfile();
+ // Create the profile
+ registerProfile();
}
-
+
+ public void registerProfile() throws Exception
+ {
+ if(this.ps == null)
+ throw new IllegalStateException("Null profile service.");
+
+ // Register
+ this.ps.registerProfile(profile);
+ // Activate
+ {
+ log.debug("activating deployment scanner profile " + profileName);
+ this.ps.activateProfile(profileName);
+ }
+ }
+
@Start(ignored = true)
public void start()
{
- adapter.resume();
+ profile.enableModifiedDeploymentChecks(true);
}
@Stop(ignored = true)
public void stop()
{
- adapter.suspend();
+ profile.enableModifiedDeploymentChecks(false);
}
+
+ public void destroy()
+ {
+ stopProfile();
+ }
+
+ /**
+ * Stop deactivates and unregisters the transient deployments profile.
+ */
+ public void stopProfile()
+ {
+ try
+ {
+ // Deactivate
+ log.debug("deactivating deployment scanner profile: " + profileName);
+ this.ps.deactivateProfile(profileName);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to deactivate deployment scanner profile: ", e);
+ }
+ try
+ {
+ // Unregister
+ log.debug("unregistering transient profile: " + profileName);
+ this.ps.unregisterProfile(profileName);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to unregister deployment scanner profile: ", e);
+ }
+ }
public void addURL(String url) throws MalformedURLException, URISyntaxException
{
@@ -82,7 +149,7 @@
public void addURL(URL url) throws URISyntaxException
{
- adapter.addURL(url);
+
}
public void removeURL(String url) throws MalformedURLException, URISyntaxException
@@ -92,7 +159,7 @@
public void removeURL(URL url) throws URISyntaxException
{
- adapter.removeURL(url);
+ // FIXME
}
/**
@@ -118,4 +185,73 @@
{
this.serverConfig = serverConfig;
}
+
+ public static class DeploymentScannerProfile extends MutableDeploymentRepository implements MutableProfile
+ {
+
+ private List<URI> uris = new ArrayList<URI>();
+
+ private volatile boolean enableHotDeployment;
+
+ public DeploymentScannerProfile()
+ {
+ super(profileName, new URI[0]);
+ }
+
+ @Override
+ public URI[] getRepositoryURIs()
+ {
+ return this.uris.toArray(new URI[this.uris.size()]);
+ }
+
+ public List<URI> getUris()
+ {
+ return uris;
+ }
+
+ public void setUris(List<URI> uris)
+ {
+ this.uris = uris;
+ }
+
+ public void addDeployment(ProfileDeployment deployment) throws Exception
+ {
+ super.addDeployment(deployment.getName(), deployment);
+ }
+
+ public void enableModifiedDeploymentChecks(boolean flag)
+ {
+ this.enableHotDeployment = flag;
+ }
+
+ @Override
+ public Collection<ModificationInfo> getModifiedDeployments() throws Exception
+ {
+ if(this.enableHotDeployment == false)
+ return Collections.emptySet();
+ return super.getModifiedDeployments();
+ }
+
+ public ProfileKey getKey()
+ {
+ return profileName;
+ }
+
+ public Collection<ProfileKey> getSubProfiles()
+ {
+ return Collections.emptySet();
+ }
+
+ public boolean hasDeployment(String name)
+ {
+ // FIXME
+ return false;
+ }
+
+ public boolean isMutable()
+ {
+ return true;
+ }
+
+ }
}
Property changes on: branches/Branch_5_x/system/src/resources/deploy/beans/test-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/deploy/beans/unpacked.beans/META-INF/jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/resources/dtd/jboss-service_4_2.dtd
===================================================================
--- branches/Branch_5_x/system/src/resources/dtd/jboss-service_4_2.dtd 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/resources/dtd/jboss-service_4_2.dtd 2009-03-06 15:21:50 UTC (rev 85526)
@@ -4,7 +4,7 @@
general to validate a jboss-service.xml descriptor due to the fact that the
'attribute' element allows ANY content.
-$Id: jboss-service_4_0.dtd 33900 2005-07-25 04:26:25Z starksm $
+$Id$
DOCTYPE server
PUBLIC "-//JBoss//DTD MBean Service 4.2//EN"
Property changes on: branches/Branch_5_x/system/src/resources/dtd/jboss-service_4_2.dtd
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/system/src/resources/dtd/jboss-service_5_0.dtd
===================================================================
--- branches/Branch_5_x/system/src/resources/dtd/jboss-service_5_0.dtd 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/resources/dtd/jboss-service_5_0.dtd 2009-03-06 15:21:50 UTC (rev 85526)
@@ -4,7 +4,7 @@
general to validate a jboss-service.xml descriptor due to the fact that the
'attribute' element allows ANY content.
-$Id: jboss-service_4_0.dtd 33890 2005-07-24 23:58:11 +0000 (Sun, 24 Jul 2005) starksm $
+$Id$
DOCTYPE server
PUBLIC "-//JBoss//DTD MBean Service 5.0//EN"
Property changes on: branches/Branch_5_x/system/src/resources/dtd/jboss-service_5_0.dtd
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/resources/parsing-tests (from rev 85384, trunk/system/src/resources/parsing-tests)
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common (from rev 85384, trunk/system/src/resources/parsing-tests/common)
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles)
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/clustering.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,20 +0,0 @@
-<?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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles/clustering.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/clustering.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/ejb3.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,23 +0,0 @@
-<?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>
- <sub-profile>metadata-deployers</sub-profile>
- <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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles/ejb3.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/ejb3.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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>
+ <sub-profile>metadata-deployers</sub-profile>
+ <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
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/jboss-web.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,21 +0,0 @@
-<?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>
- <sub-profile>metadata-deployers</sub-profile>
- <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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles/jboss-web.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jboss-web.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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>
+ <sub-profile>metadata-deployers</sub-profile>
+ <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
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/jmx.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,13 +0,0 @@
-<?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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles/jmx.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/jmx.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,13 +0,0 @@
-<?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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile (from rev 85384, trunk/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/common/profiles/metadata-deployers.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/config (from rev 85384, trunk/system/src/resources/parsing-tests/config)
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles (from rev 85384, trunk/system/src/resources/parsing-tests/config/profiles)
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/config/profiles/default.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,22 +0,0 @@
-<?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>
- <sub-profile>jmx</sub-profile>
- <sub-profile>seam</sub-profile>
- <sub-profile>jboss-web</sub-profile>
- <sub-profile>clustering</sub-profile>
- </profile>
-
-</profiles>
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile (from rev 85384, trunk/system/src/resources/parsing-tests/config/profiles/default.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/default.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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>
+ <sub-profile>jmx</sub-profile>
+ <sub-profile>seam</sub-profile>
+ <sub-profile>jboss-web</sub-profile>
+ <sub-profile>clustering</sub-profile>
+ </profile>
+
+</profiles>
\ No newline at end of file
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile
===================================================================
--- trunk/system/src/resources/parsing-tests/config/profiles/seam.profile 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,14 +0,0 @@
-<?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>
- <sub-profile>ejb3</sub-profile>
- <deployment>seam.deployer</deployment>
- </profile>
-
-</profiles>
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile (from rev 85384, trunk/system/src/resources/parsing-tests/config/profiles/seam.profile)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/config/profiles/seam.profile 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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>
+ <sub-profile>ejb3</sub-profile>
+ <deployment>seam.deployer</deployment>
+ </profile>
+
+</profiles>
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/parsing (from rev 85384, trunk/system/src/resources/parsing-tests/parsing)
Deleted: branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml
===================================================================
--- trunk/system/src/resources/parsing-tests/parsing/test.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,30 +0,0 @@
-<profiles
- xmlns="urn:jboss:profileservice:profiles:1.0"
- name="profiles">
-
- <profile name="immutable">
- <profile-source>
- <source>${jboss.server.home.url}deployers</source>
- <source>${jboss.server.home.url}conf</source>
- </profile-source>
- <sub-profile>ejb3</sub-profile>
- <deployment>myEjb3Deployment.ear</deployment>
- </profile>
-
- <hotdeployment-profile name="mutable">
- <profile-source>
- <source>${jboss.server.home.url}deploy</source>
- <source>${jboss.server.home.url}deploy2</source>
- </profile-source>
- <sub-profile>immutable</sub-profile>
- </hotdeployment-profile>
-
- <maven-profile name="maven" xmlns="urn:jboss:profileservice:profile:maven:1.0">
- <profile-source>
- <source>http://repository.jboss.org/maven2</source>
- </profile-source>
- <sub-profile>hotdeployment</sub-profile>
- <deployment>org/jboss/jboss-profileservice/6.0.0-GA/profileservice-spi.jar</deployment>
- </maven-profile>
-
-</profiles>
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml (from rev 85384, trunk/system/src/resources/parsing-tests/parsing/test.xml)
===================================================================
--- branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml (rev 0)
+++ branches/Branch_5_x/system/src/resources/parsing-tests/parsing/test.xml 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,30 @@
+<profiles
+ xmlns="urn:jboss:profileservice:profiles:1.0"
+ name="profiles">
+
+ <profile name="immutable">
+ <profile-source>
+ <source>${jboss.server.home.url}deployers</source>
+ <source>${jboss.server.home.url}conf</source>
+ </profile-source>
+ <sub-profile>ejb3</sub-profile>
+ <deployment>myEjb3Deployment.ear</deployment>
+ </profile>
+
+ <hotdeployment-profile name="mutable">
+ <profile-source>
+ <source>${jboss.server.home.url}deploy</source>
+ <source>${jboss.server.home.url}deploy2</source>
+ </profile-source>
+ <sub-profile>immutable</sub-profile>
+ </hotdeployment-profile>
+
+ <maven-profile name="maven" xmlns="urn:jboss:profileservice:profile:maven:1.0">
+ <profile-source>
+ <source>http://repository.jboss.org/maven2</source>
+ </profile-source>
+ <sub-profile>hotdeployment</sub-profile>
+ <deployment>org/jboss/jboss-profileservice/6.0.0-GA/profileservice-spi.jar</deployment>
+ </maven-profile>
+
+</profiles>
\ No newline at end of file
Copied: branches/Branch_5_x/system/src/resources/server-root (from rev 85384, trunk/system/src/resources/server-root)
Copied: branches/Branch_5_x/system/src/resources/server-root/conf (from rev 85384, trunk/system/src/resources/server-root/conf)
Deleted: branches/Branch_5_x/system/src/resources/server-root/conf/jboss-service.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/conf/jboss-service.xml (from rev 85384, trunk/system/src/resources/server-root/conf/jboss-service.xml)
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy (from rev 85384, trunk/system/src/resources/server-root/deploy)
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-container-jboss-beans.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-container-jboss-beans.xml (from rev 85384, trunk/system/src/resources/server-root/deploy/ejb3-container-jboss-beans.xml)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-interceptors-aop.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-interceptors-aop.xml (from rev 85384, trunk/system/src/resources/server-root/deploy/ejb3-interceptors-aop.xml)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-timer-service.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/ejb3-timer-service.xml (from rev 85384, trunk/system/src/resources/server-root/deploy/ejb3-timer-service.xml)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/httpha-invoker.sar
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/httpha-invoker.sar (from rev 85384, trunk/system/src/resources/server-root/deploy/httpha-invoker.sar)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/jbossweb.sar
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/jbossweb.sar (from rev 85384, trunk/system/src/resources/server-root/deploy/jbossweb.sar)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy/myDeployment.jar
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy/myDeployment.jar (from rev 85384, trunk/system/src/resources/server-root/deploy/myDeployment.jar)
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy2 (from rev 85384, trunk/system/src/resources/server-root/deploy2)
Deleted: branches/Branch_5_x/system/src/resources/server-root/deploy2/myDeployment12.jar
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deploy2/myDeployment12.jar (from rev 85384, trunk/system/src/resources/server-root/deploy2/myDeployment12.jar)
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers (from rev 85384, trunk/system/src/resources/server-root/deployers)
Deleted: branches/Branch_5_x/system/src/resources/server-root/deployers/clustering-deployer-jboss-beans.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers/clustering-deployer-jboss-beans.xml (from rev 85384, trunk/system/src/resources/server-root/deployers/clustering-deployer-jboss-beans.xml)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deployers/ejb3.deployer
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers/ejb3.deployer (from rev 85384, trunk/system/src/resources/server-root/deployers/ejb3.deployer)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deployers/jbossweb.deployer
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers/jbossweb.deployer (from rev 85384, trunk/system/src/resources/server-root/deployers/jbossweb.deployer)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deployers/metadata-deployer-jboss-beans.xml
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers/metadata-deployer-jboss-beans.xml (from rev 85384, trunk/system/src/resources/server-root/deployers/metadata-deployer-jboss-beans.xml)
===================================================================
Deleted: branches/Branch_5_x/system/src/resources/server-root/deployers/seam.deployer
===================================================================
Copied: branches/Branch_5_x/system/src/resources/server-root/deployers/seam.deployer (from rev 85384, trunk/system/src/resources/server-root/deployers/seam.deployer)
===================================================================
Property changes on: branches/Branch_5_x/system/src/resources/tests/bootstrap/default/deployer-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/tests/bootstrap/defaulthotdeploy/deployer-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/tests/conf/test-log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/tests/modules/getopt.jar
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/tests/modules/sax.jar/inner.jar
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/resources/tests/xml/org/jboss/test/server/profileservice/test-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/tests/org/jboss/beans/container/support/SimpleBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/system/src/tests/org/jboss/beans/container/support/SimpleBeanImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.jboss.Main;
-import org.jboss.bootstrap.microcontainer.ServerImpl;
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Test of the jboss main loading a configuration via the ProfileService.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class MainTestCase extends BaseTestCase
-{
- public MainTestCase(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void testCreateDefaultProfile() throws Throwable
- {
- // Set the jboss.server.home.url property to the system/src/resources dir
- URL bootstrapDir = super.getResource("/bootstrap");
- log.info("bootstrapDir: "+bootstrapDir);
- URL resourcesDir = new URL(bootstrapDir, "..");
- log.info("resourcesDir: "+resourcesDir);
- System.setProperty("jboss.server.home.url", resourcesDir.toString());
- System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
- URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
- System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
-
- //
- ServerImpl server = new ServerImpl();
- server.init(System.getProperties());
- server.start();
- try
- {
- Kernel kernel = server.getKernel();
- ProfileService ps = getBean(kernel, "ProfileService", ProfileService.class);
- ProfileKey defaultKey = new ProfileKey("default");
- Profile profile = ps.getProfile(defaultKey);
- VFSDeployment testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- if( testBeans == null )
- {
- if( profile == null )
- profile = ps.newProfile(defaultKey);
- MainDeployer deployer = getBean(kernel, "MainDeployer", MainDeployer.class);
- VFS vfs = VFS.getVFS(resourcesDir);
- VirtualFile file = vfs.findChild("deploy/beans/test-beans.xml");
- testBeans = createDeployment(file);
- deployer.addDeployment(testBeans);
- profile.addDeployment(testBeans, DeploymentPhase.APPLICATION);
- }
- // Validate the deployment
- testBeans = profile.getDeployment("test-beans.xml", DeploymentPhase.APPLICATION);
- assertNotNull(testBeans);
- // TODO String type = testBeans.getType();
- // assertEquals("Deployment type is beans", "beans", type);
- }
- finally
- {
- server.shutdown();
- }
- }
-
- /**
- * Test the startup of the org.jboss.Main entry point using the "default"
- * profile.
- * @throws Exception
- */
- public void testDefaultStartup() throws Exception
- {
- // Set the jboss.server.home.url property to the system/src/resources dir
- URL bootstrapDir = super.getResource("/bootstrap");
- log.info("bootstrapDir: "+bootstrapDir);
- URL resourcesDir = new URL(bootstrapDir, "..");
- log.info("resourcesDir: "+resourcesDir);
- System.setProperty("jboss.server.home.url", resourcesDir.toString());
- // Set the jbosstest.support.dir to output/tests-support
- File supportDir = new File("output/tests-support");
- System.setProperty("jbosstest.support.dir", supportDir.toString());
- System.setProperty(ServerConfig.EXIT_ON_SHUTDOWN, "false");
- URL bootstrapURL = new URL(bootstrapDir, "bootstrap/default/deployer-beans.xml");
- System.setProperty(ServerConfig.BOOTSTRAP_URL, bootstrapURL.toString());
-
- ArrayList<String> args = new ArrayList<String>();
- String[] tmp = {};
- Main main = new Main();
- main.boot(args.toArray(tmp));
- main.shutdown();
- }
-
- protected <T> T getBean(Kernel kernel, String name, Class<T> expectedType)
- {
- KernelController controller = kernel.getController();
- ControllerContext context = controller.getInstalledContext(name);
- if (context == null)
- fail("Context not installed " + name);
- Object result = context.getTarget();
- return expectedType.cast(result);
- }
-
- protected VFSDeployment createDeployment(VirtualFile file)
- {
- return VFSDeploymentFactory.getInstance().createVFSDeployment(file);
- }
-}
Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -38,7 +38,7 @@
* and additional service via a simple hot deployment service.
*
* @author Scott.Stark at jboss.org
- * @version $Revision: 56797 $
+ * @version $Revision$
*/
public class MainWithSimpleHotDeployTestCase extends BaseTestCase
{
Property changes on: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/bootstrap (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/bootstrap)
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence)
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/remove)
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test)
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.persistence.remove.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
-import org.jboss.test.server.profileservice.persistence.support.GenericSupportMetaData;
-import org.jboss.test.server.profileservice.persistence.support.SimpleGenericMetaData;
-import org.jboss.test.server.profileservice.persistence.test.AbstractPersistenceFormatTest;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class RemoveGenericValueUnitTestCase extends AbstractPersistenceFormatTest
-{
-
- public RemoveGenericValueUnitTestCase(String name)
- {
- super(name);
- }
-
- public void test() throws Throwable
- {
-
- ManagedObject mo = createTestMO();
-
- ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
- PersistedManagedObject moElement = persistence.createPersistenceMetaData(mo);
- assertNotNull(moElement);
-
- // Remove
- PersistedProperty p = moElement.getProperties().get(0);
- PersistedCollectionValue collection = (PersistedCollectionValue) p.getValue();
- assertNotNull(collection);
- collection.getValue(0).setModificationInfo(ModificationInfo.REMOVED);
-
- // Restore
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.update(createTestMetaData(), moElement);
-
-
- // Check meta data
- GenericSupportMetaData md = (GenericSupportMetaData) restored.getAttachment();
- assertNotNull(md);
- assertEquals(1, md.getList().size());
- SimpleGenericMetaData parent2 = md.getList().get(0);
- assertEquals("parent2", parent2.getString());
- assertNotNull(parent2.getChild());
- assertEquals("child2", parent2.getChild().getString());
- }
-
- 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;
- }
-
- private SimpleGenericMetaData createSImple(String string, int integer, SimpleGenericMetaData child)
- {
- return new SimpleGenericMetaData(string, integer, child);
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.server.profileservice.persistence.remove.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
+import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
+import org.jboss.test.server.profileservice.persistence.support.GenericSupportMetaData;
+import org.jboss.test.server.profileservice.persistence.support.SimpleGenericMetaData;
+import org.jboss.test.server.profileservice.persistence.test.AbstractPersistenceFormatTest;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RemoveGenericValueUnitTestCase extends AbstractPersistenceFormatTest
+{
+
+ public RemoveGenericValueUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void test() throws Throwable
+ {
+
+ ManagedObject mo = createTestMO();
+
+ ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
+ PersistedManagedObject moElement = persistence.createPersistenceMetaData(mo);
+ assertNotNull(moElement);
+
+ // Remove
+ PersistedProperty p = moElement.getProperties().get(0);
+ PersistedCollectionValue collection = (PersistedCollectionValue) p.getValue();
+ assertNotNull(collection);
+ collection.getValue(0).setModificationInfo(ModificationInfo.REMOVED);
+
+ // Restore
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(createTestMetaData(), moElement);
+
+
+ // Check meta data
+ GenericSupportMetaData md = (GenericSupportMetaData) restored.getAttachment();
+ assertNotNull(md);
+ assertEquals(1, md.getList().size());
+ SimpleGenericMetaData parent2 = md.getList().get(0);
+ assertEquals("parent2", parent2.getString());
+ assertNotNull(parent2.getChild());
+ assertEquals("child2", parent2.getChild().getString());
+ }
+
+ 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;
+ }
+
+ private SimpleGenericMetaData createSImple(String string, int integer, SimpleGenericMetaData child)
+ {
+ return new SimpleGenericMetaData(string, integer, child);
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support)
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/CollectionMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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 GenericSupportMetaData
-{
-
- List<SimpleGenericMetaData> list;
-
- @ManagementProperty(managed = true)
- public List<SimpleGenericMetaData> getList()
- {
- return list;
- }
-
- public void setList(List<SimpleGenericMetaData> list)
- {
- this.list = list;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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 GenericSupportMetaData
+{
+
+ List<SimpleGenericMetaData> list;
+
+ @ManagementProperty(managed = true)
+ public List<SimpleGenericMetaData> getList()
+ {
+ return list;
+ }
+
+ public void setList(List<SimpleGenericMetaData> list)
+ {
+ this.list = list;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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: 82920 $
- */
- 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;
- }
-
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/NestedTestMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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: 82920 $
+ */
+ 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;
+ }
+
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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: 82920 $
- */
- 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;
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/PrimitiveMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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: 82920 $
+ */
+ 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;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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;
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleArrayMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleGenericMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleStringMapMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/SimpleTableMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,134 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.persistence.support;
-
-import java.io.Serializable;
-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: 82920 $
- */
- at ManagementObject
-public class TestMetaData implements Serializable
-{
-
- 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;
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/TestMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.profileservice.persistence.support;
+
+import java.io.Serializable;
+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: 82920 $
+ */
+ at ManagementObject
+public class TestMetaData implements Serializable
+{
+
+ 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;
+ }
+
+}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test)
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,181 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.persistence.test;
-
-import java.io.File;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-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.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
-import org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer;
-import org.jboss.test.BaseTestCase;
-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: 82920 $
- */
-public abstract class AbstractPersistenceFormatTest extends BaseTestCase
-{
-
- /** The managed object factory */
- private ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
-
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- /** The meta type factory */
- private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
-
- protected static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
-
- static
- {
- resolver.addClassBinding("urn:org:jboss:profileservice:persistence:managed-object:1.0", PersistedManagedObject.class);
- }
-
- public AbstractPersistenceFormatTest(String name)
- {
- super(name);
- }
-
- protected ManagedObjectFactory getMOF()
- {
- return this.managedObjectFactory;
- }
-
- protected MetaValueFactory getMVF()
- {
- return this.metaValueFactory;
- }
-
- protected MetaTypeFactory getMTF()
- {
- return this.metaTypeFactory;
- }
-
- protected ManagedObject initManagedObject(Object o)
- {
- return getMOF().initManagedObject(o, null);
- }
-
- protected AbstractFileAttachmentsSerializer getAttachmentSerializer() throws Exception
- {
- return getAttachmentSerializer(false);
- }
-
- protected AbstractFileAttachmentsSerializer getAttachmentSerializer(boolean logToSystemOut) throws Exception
- {
- File tempFile = File.createTempFile(getName(), null);
- return createSerializer(tempFile, logToSystemOut);
- }
-
- /**
- * Create the attachment Serializer.
- * Use a tempFile for storing the Xml.
- *
- * @param tempFile the temp File
- * @return a AttachmentSerializer.
- * @throws Exception
- */
- protected AbstractFileAttachmentsSerializer createSerializer(File tempFile) throws Exception
- {
- return createSerializer(tempFile, false);
- }
-
- protected AbstractFileAttachmentsSerializer createSerializer(final File tempFile, final boolean logToSystemOut) throws Exception
- {
- return new TempAttachmentSerializer(tempFile);
- }
-
- private class TempAttachmentSerializer extends JAXBAttachmentSerializer
- {
- public TempAttachmentSerializer(File tempFile)
- {
- super(tempFile);
- }
-
-// @Override
-// protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
-// {
-// Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
-// JBossXBBuilder builder = new JBossXBBuilder();
-// SchemaBinding binding = builder.build(expected);
-// return (T) u.unmarshal(attachmentsStore.getAbsolutePath(), binding);
-// }
-
- @Override
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
- Marshaller marshaller = ctx.createMarshaller();
- marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
- marshaller.marshal(attachment, attachmentsStore);
- marshaller.marshal(attachment, System.out);
- }
-
- @Override
- protected File getAttachmentPath(String baseName)
- {
- // Return the temp file
- return getAttachmentsStoreDir();
- }
- }
-
- protected PersistedManagedObject restore(ManagedObject mo) throws Exception
- {
- PersistedManagedObject moElement = new PersistedManagedObject();
-
- ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
- persistence.processManagedObject(moElement, 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
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- return (PersistedManagedObject) unmarshaller.unmarshal(file.toURL().openStream(), resolver);
- }
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,181 @@
+/*
+ * 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.server.profileservice.persistence.test;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+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.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
+import org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer;
+import org.jboss.test.BaseTestCase;
+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: 82920 $
+ */
+public abstract class AbstractPersistenceFormatTest extends BaseTestCase
+{
+
+ /** The managed object factory */
+ private ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
+
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ /** The meta type factory */
+ private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
+
+ protected static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ static
+ {
+ resolver.addClassBinding("urn:org:jboss:profileservice:persistence:managed-object:1.0", PersistedManagedObject.class);
+ }
+
+ public AbstractPersistenceFormatTest(String name)
+ {
+ super(name);
+ }
+
+ protected ManagedObjectFactory getMOF()
+ {
+ return this.managedObjectFactory;
+ }
+
+ protected MetaValueFactory getMVF()
+ {
+ return this.metaValueFactory;
+ }
+
+ protected MetaTypeFactory getMTF()
+ {
+ return this.metaTypeFactory;
+ }
+
+ protected ManagedObject initManagedObject(Object o)
+ {
+ return getMOF().initManagedObject(o, null);
+ }
+
+ protected AbstractFileAttachmentsSerializer getAttachmentSerializer() throws Exception
+ {
+ return getAttachmentSerializer(false);
+ }
+
+ protected AbstractFileAttachmentsSerializer getAttachmentSerializer(boolean logToSystemOut) throws Exception
+ {
+ File tempFile = File.createTempFile(getName(), null);
+ return createSerializer(tempFile, logToSystemOut);
+ }
+
+ /**
+ * Create the attachment Serializer.
+ * Use a tempFile for storing the Xml.
+ *
+ * @param tempFile the temp File
+ * @return a AttachmentSerializer.
+ * @throws Exception
+ */
+ protected AbstractFileAttachmentsSerializer createSerializer(File tempFile) throws Exception
+ {
+ return createSerializer(tempFile, false);
+ }
+
+ protected AbstractFileAttachmentsSerializer createSerializer(final File tempFile, final boolean logToSystemOut) throws Exception
+ {
+ return new TempAttachmentSerializer(tempFile);
+ }
+
+ private class TempAttachmentSerializer extends JAXBAttachmentSerializer
+ {
+ public TempAttachmentSerializer(File tempFile)
+ {
+ super(tempFile);
+ }
+
+// @Override
+// protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
+// {
+// Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
+// JBossXBBuilder builder = new JBossXBBuilder();
+// SchemaBinding binding = builder.build(expected);
+// return (T) u.unmarshal(attachmentsStore.getAbsolutePath(), binding);
+// }
+
+ @Override
+ protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
+ {
+ log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
+ JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
+ Marshaller marshaller = ctx.createMarshaller();
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.marshal(attachment, attachmentsStore);
+ marshaller.marshal(attachment, System.out);
+ }
+
+ @Override
+ protected File getAttachmentPath(String baseName)
+ {
+ // Return the temp file
+ return getAttachmentsStoreDir();
+ }
+ }
+
+ protected PersistedManagedObject restore(ManagedObject mo) throws Exception
+ {
+ PersistedManagedObject moElement = new PersistedManagedObject();
+
+ ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
+ persistence.processManagedObject(moElement, 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
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return (PersistedManagedObject) unmarshaller.unmarshal(file.toURL().openStream(), resolver);
+ }
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.persistence.test;
-
-import java.util.Arrays;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.metatype.api.values.ArrayValue;
-import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.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);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.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'}}};
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/ArrayValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,119 @@
+/*
+ * 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.server.profileservice.persistence.test;
+
+import java.util.Arrays;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.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);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.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'}}};
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,254 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.profileservice.persistence.support.PrimitiveMetaData;
-import org.jboss.test.server.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)
- {
- // FIXME SimplePersistenceFormatUnitTestCase constructor
- 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);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- mo = handler.update(createPrimitive(), restored);
-
- assertEquals("newName", getMVF().unwrap(mo.getProperty("name").getValue()));
- assertEquals(111, getMVF().unwrap(mo.getProperty("integer").getValue()));
- 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 again
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- mo = handler.update(createTestMetaData(), 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);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- mo = handler.update(createTestMetaData(), 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);
-
- //
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- mo = handler.update(createTestMetaData(), 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;
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/BasicPersistenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,254 @@
+/*
+ * 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.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.profileservice.persistence.support.PrimitiveMetaData;
+import org.jboss.test.server.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)
+ {
+ // FIXME SimplePersistenceFormatUnitTestCase constructor
+ 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);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ mo = handler.update(createPrimitive(), restored);
+
+ assertEquals("newName", getMVF().unwrap(mo.getProperty("name").getValue()));
+ assertEquals(111, getMVF().unwrap(mo.getProperty("integer").getValue()));
+ 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 again
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ mo = handler.update(createTestMetaData(), 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);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ mo = handler.update(createTestMetaData(), 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);
+
+ //
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ mo = handler.update(createTestMetaData(), 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;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.persistence.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.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);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.update(createMetaData(), 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;
- }
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/CollectionValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.server.profileservice.persistence.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.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);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(createMetaData(), 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;
+ }
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.profileservice.persistence.support.GenericSupportMetaData;
-import org.jboss.test.server.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"));
-
- PersistedManagedObject moElement = restore(mo);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.update(createTestMetaData(), 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;
- }
-
- private SimpleGenericMetaData createSImple(String string, int integer, SimpleGenericMetaData child)
- {
- return new SimpleGenericMetaData(string, integer, child);
- }
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/GenericValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,95 @@
+/*
+ * 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.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.profileservice.persistence.support.GenericSupportMetaData;
+import org.jboss.test.server.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"));
+
+ PersistedManagedObject moElement = restore(mo);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(createTestMetaData(), 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;
+ }
+
+ private SimpleGenericMetaData createSImple(String string, int integer, SimpleGenericMetaData child)
+ {
+ return new SimpleGenericMetaData(string, integer, child);
+ }
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.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());
-
- enableTrace("org.jboss.system");
- PersistedManagedObject moElement = restore(mo);
- assertNotNull(moElement);
-
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.update(createTestMetaData(), moElement);
- assertNotNull(restored);
- }
-
- 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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/MapCompositeUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.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());
+
+ enableTrace("org.jboss.system");
+ PersistedManagedObject moElement = restore(mo);
+ assertNotNull(moElement);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(createTestMetaData(), moElement);
+ assertNotNull(restored);
+ }
+
+ 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;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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);
-
- return suite;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/PersistenceFormatTestSuite.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.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);
+
+ return suite;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.server.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
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- ManagedObject restored = handler.update(createTestMetaData(), 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");
- }
-
- 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;
- }
-
-}
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TableValueUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,111 @@
+/*
+ * 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.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.server.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
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(createTestMetaData(), 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");
+ }
+
+ 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;
+ }
+
+}
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,267 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
-import org.jboss.test.server.profileservice.persistence.support.NestedTestMetaData;
-import org.jboss.test.server.profileservice.persistence.support.PrimitiveMetaData;
-import org.jboss.test.server.profileservice.persistence.support.TestMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision: 82920 $
- */
-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, 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);
-
- enableTrace("org.jboss.system.server.profileservice.persistence");
-
- // Recreate
- ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
- mo = handler.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 PersistedManagedObject process(ManagedObject mo) throws Exception
- {
- // Create root;
- PersistedManagedObject persisted = new PersistedManagedObject();
- // Create xml elements
- ManagedObjectPeristenceHandler handler = new ManagedObjectPeristenceHandler();
- handler.processManagedObject(persisted, mo);
-
- // Save
- AbstractFileAttachmentsSerializer serializer = getAttachmentSerializer(true);
- serializer.saveAttachment("test", persisted);
- // Restore
- return serializer.loadAttachment("test", PersistedManagedObject.class);
- }
-
- 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;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/TestNestedPeristenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,267 @@
+/*
+ * 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.server.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.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
+import org.jboss.test.server.profileservice.persistence.support.NestedTestMetaData;
+import org.jboss.test.server.profileservice.persistence.support.PrimitiveMetaData;
+import org.jboss.test.server.profileservice.persistence.support.TestMetaData;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision: 82920 $
+ */
+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, 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);
+
+ enableTrace("org.jboss.system.server.profileservice.persistence");
+
+ // Recreate
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ mo = handler.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 PersistedManagedObject process(ManagedObject mo) throws Exception
+ {
+ // Create root;
+ PersistedManagedObject persisted = new PersistedManagedObject();
+ // Create xml elements
+ ManagedObjectPeristenceHandler handler = new ManagedObjectPeristenceHandler();
+ handler.processManagedObject(persisted, mo);
+
+ // Save
+ AbstractFileAttachmentsSerializer serializer = getAttachmentSerializer(true);
+ serializer.saveAttachment("test", persisted);
+ // Restore
+ return serializer.loadAttachment("test", PersistedManagedObject.class);
+ }
+
+ 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;
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support)
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jboss.system.server.profile.repository.metadata.BasicProfileMetaData;
-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:maven:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
- at XmlRootElement(name = "maven-profile")
-public class MavenProfileMetaData extends BasicProfileMetaData
-{
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MavenProfileMetaData.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.server.profileservice.support;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.jboss.system.server.profile.repository.metadata.BasicProfileMetaData;
+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:maven:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "maven-profile")
+public class MavenProfileMetaData extends BasicProfileMetaData
+{
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import java.net.URI;
-
-import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.ProfileDeployment;
-import org.jboss.system.server.profileservice.attachments.AttachmentStore;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class MockAttachmentStore implements AttachmentStore
-{
-
- private final static VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
-
- public URI getAttachmentStoreRoot()
- {
- return null;
- }
-
- public Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
- {
- if(deployment == null)
- throw new IllegalArgumentException("Null deployment");
-
- if(deployment.getRoot() == null)
- return new AbstractDeployment(deployment.getName());
- else
- return factory.createVFSDeployment(deployment.getRoot());
- }
-
- public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception
- {
- // nothing
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,64 @@
+/*
+ * 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.server.profileservice.support;
+
+import java.net.URI;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MockAttachmentStore implements AttachmentStore
+{
+
+ private final static VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
+
+ public URI getAttachmentStoreRoot()
+ {
+ return null;
+ }
+
+ public Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception
+ {
+ if(deployment == null)
+ throw new IllegalArgumentException("Null deployment");
+
+ if(deployment.getRoot() == null)
+ return new AbstractDeployment(deployment.getName());
+ else
+ return factory.createVFSDeployment(deployment.getRoot());
+ }
+
+ public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception
+ {
+ // nothing
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,207 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.DeploymentState;
-import org.jboss.deployers.spi.deployer.DeploymentStage;
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.util.graph.Graph;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class MockMainDeployer implements MainDeployer, MainDeployerStructure
-{
-
- private Map<String, Deployment> deployments = new HashMap<String, Deployment>();
-
- private static final Logger log = Logger.getLogger(MockMainDeployer.class);
-
- public void prepareShutdown()
- {
- // FIXME prepareShutdown
-
- }
-
- public void shutdown()
- {
- // FIXME shutdown
-
- }
-
- public void addDeployment(Deployment deployment) throws DeploymentException
- {
- log.debug("add deployment: " + deployment);
- deployments.put(deployment.getName(), deployment);
- }
-
- public void change(String deploymentName, DeploymentStage stage) throws DeploymentException
- {
- // FIXME change
-
- }
-
- public void checkComplete() throws DeploymentException
- {
- // FIXME checkComplete
-
- }
-
- public void checkComplete(Deployment... deployment) throws DeploymentException
- {
- // FIXME checkComplete
-
- }
-
- public void checkComplete(String... names) throws DeploymentException
- {
- // FIXME checkComplete
-
- }
-
- public void checkStructureComplete(Deployment... deployments) throws DeploymentException
- {
- // FIXME checkStructureComplete
-
- }
-
- public void checkStructureComplete(String... names) throws DeploymentException
- {
- // FIXME checkStructureComplete
-
- }
-
- public void deploy(Deployment... deployments) throws DeploymentException
- {
- // FIXME deploy
-
- }
-
- public Graph<Map<String, ManagedObject>> getDeepManagedObjects(String name) throws DeploymentException
- {
- // FIXME getDeepManagedObjects
- return null;
- }
-
- public Deployment getDeployment(String name)
- {
- return this.deployments.get(name);
- }
-
- public DeploymentStage getDeploymentStage(String deploymentName) throws DeploymentException
- {
- // FIXME getDeploymentStage
- return null;
- }
-
- public DeploymentState getDeploymentState(String name)
- {
- // FIXME getDeploymentState
- return null;
- }
-
- public ManagedDeployment getManagedDeployment(String name) throws DeploymentException
- {
- // FIXME getManagedDeployment
- return null;
- }
-
- public Map<String, ManagedObject> getManagedObjects(String name) throws DeploymentException
- {
- // FIXME getManagedObjects
- return null;
- }
-
- public Collection<Deployment> getTopLevel()
- {
- // FIXME getTopLevel
- return null;
- }
-
- public void process()
- {
- log.debug("process");
- }
-
- public boolean removeDeployment(Deployment deployment) throws DeploymentException
- {
- log.debug("remove deployment: " + deployment);
- return this.deployments.remove(deployment.getName()) != null;
- }
-
- public boolean removeDeployment(String name) throws DeploymentException
- {
- // FIXME removeDeployment
- return false;
- }
-
- public void undeploy(Deployment... deployments) throws DeploymentException
- {
- // FIXME undeploy
-
- }
-
- public void undeploy(String... names) throws DeploymentException
- {
- // FIXME undeploy
-
- }
-
- public DeploymentContext getDeploymentContext(String name)
- {
- // FIXME getDeploymentContext
- return null;
- }
-
- public DeploymentContext getDeploymentContext(String name, boolean errorNotFound) throws DeploymentException
- {
- // FIXME getDeploymentContext
- return null;
- }
-
- public DeploymentUnit getDeploymentUnit(String name)
- {
- // FIXME getDeploymentUnit
- return null;
- }
-
- public DeploymentUnit getDeploymentUnit(String name, boolean errorNotFound) throws DeploymentException
- {
- // FIXME getDeploymentUnit
- return null;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockMainDeployer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,207 @@
+/*
+ * 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.server.profileservice.support;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.util.graph.Graph;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MockMainDeployer implements MainDeployer, MainDeployerStructure
+{
+
+ private Map<String, Deployment> deployments = new HashMap<String, Deployment>();
+
+ private static final Logger log = Logger.getLogger(MockMainDeployer.class);
+
+ public void prepareShutdown()
+ {
+ // FIXME prepareShutdown
+
+ }
+
+ public void shutdown()
+ {
+ // FIXME shutdown
+
+ }
+
+ public void addDeployment(Deployment deployment) throws DeploymentException
+ {
+ log.debug("add deployment: " + deployment);
+ deployments.put(deployment.getName(), deployment);
+ }
+
+ public void change(String deploymentName, DeploymentStage stage) throws DeploymentException
+ {
+ // FIXME change
+
+ }
+
+ public void checkComplete() throws DeploymentException
+ {
+ // FIXME checkComplete
+
+ }
+
+ public void checkComplete(Deployment... deployment) throws DeploymentException
+ {
+ // FIXME checkComplete
+
+ }
+
+ public void checkComplete(String... names) throws DeploymentException
+ {
+ // FIXME checkComplete
+
+ }
+
+ public void checkStructureComplete(Deployment... deployments) throws DeploymentException
+ {
+ // FIXME checkStructureComplete
+
+ }
+
+ public void checkStructureComplete(String... names) throws DeploymentException
+ {
+ // FIXME checkStructureComplete
+
+ }
+
+ public void deploy(Deployment... deployments) throws DeploymentException
+ {
+ // FIXME deploy
+
+ }
+
+ public Graph<Map<String, ManagedObject>> getDeepManagedObjects(String name) throws DeploymentException
+ {
+ // FIXME getDeepManagedObjects
+ return null;
+ }
+
+ public Deployment getDeployment(String name)
+ {
+ return this.deployments.get(name);
+ }
+
+ public DeploymentStage getDeploymentStage(String deploymentName) throws DeploymentException
+ {
+ // FIXME getDeploymentStage
+ return null;
+ }
+
+ public DeploymentState getDeploymentState(String name)
+ {
+ // FIXME getDeploymentState
+ return null;
+ }
+
+ public ManagedDeployment getManagedDeployment(String name) throws DeploymentException
+ {
+ // FIXME getManagedDeployment
+ return null;
+ }
+
+ public Map<String, ManagedObject> getManagedObjects(String name) throws DeploymentException
+ {
+ // FIXME getManagedObjects
+ return null;
+ }
+
+ public Collection<Deployment> getTopLevel()
+ {
+ // FIXME getTopLevel
+ return null;
+ }
+
+ public void process()
+ {
+ log.debug("process");
+ }
+
+ public boolean removeDeployment(Deployment deployment) throws DeploymentException
+ {
+ log.debug("remove deployment: " + deployment);
+ return this.deployments.remove(deployment.getName()) != null;
+ }
+
+ public boolean removeDeployment(String name) throws DeploymentException
+ {
+ // FIXME removeDeployment
+ return false;
+ }
+
+ public void undeploy(Deployment... deployments) throws DeploymentException
+ {
+ // FIXME undeploy
+
+ }
+
+ public void undeploy(String... names) throws DeploymentException
+ {
+ // FIXME undeploy
+
+ }
+
+ public DeploymentContext getDeploymentContext(String name)
+ {
+ // FIXME getDeploymentContext
+ return null;
+ }
+
+ public DeploymentContext getDeploymentContext(String name, boolean errorNotFound) throws DeploymentException
+ {
+ // FIXME getDeploymentContext
+ return null;
+ }
+
+ public DeploymentUnit getDeploymentUnit(String name)
+ {
+ // FIXME getDeploymentUnit
+ return null;
+ }
+
+ public DeploymentUnit getDeploymentUnit(String name, boolean errorNotFound) throws DeploymentException
+ {
+ // FIXME getDeploymentUnit
+ return null;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import java.util.Collection;
-import java.util.Collections;
-
-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.system.server.profile.repository.metadata.FilteredProfileSourceMetaData;
-
-/**
- * Create a filtered deployment repository
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class MockProfileRepository implements ProfileRepository
-{
-
- /** The deployment repository factory. */
- DeploymentRepositoryFactory repository;
-
- public MockProfileRepository(DeploymentRepositoryFactory factory)
- {
- this.repository = factory;
- }
-
- public DeploymentRepository createProfileDeploymentRepository(ProfileKey key, ProfileMetaData metaData) throws Exception
- {
- // Fill the filtered source with deployments
- FilteredProfileSourceMetaData source = (FilteredProfileSourceMetaData) metaData.getSource();
- source.setDeployments(metaData.getDeployments());
-
- return repository.createDeploymentRepository(key, source);
- }
-
- public DeploymentRepository getProfileDeploymentRepository(ProfileKey key) throws NoSuchProfileException
- {
- // FIXME
- return null;
- }
-
- public Collection<ProfileKey> getProfileKeys()
- {
- return Collections.EMPTY_LIST;
- }
-
- public void removeProfileDeploymentRepository(ProfileKey key) throws Exception, NoSuchProfileException
- {
- // nothing
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockProfileRepository.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.profileservice.support;
+
+import java.util.Collection;
+import java.util.Collections;
+
+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.system.server.profile.repository.metadata.FilteredProfileSourceMetaData;
+
+/**
+ * Create a filtered deployment repository
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MockProfileRepository implements ProfileRepository
+{
+
+ /** The deployment repository factory. */
+ DeploymentRepositoryFactory repository;
+
+ public MockProfileRepository(DeploymentRepositoryFactory factory)
+ {
+ this.repository = factory;
+ }
+
+ public DeploymentRepository createProfileDeploymentRepository(ProfileKey key, ProfileMetaData metaData) throws Exception
+ {
+ // Fill the filtered source with deployments
+ FilteredProfileSourceMetaData source = (FilteredProfileSourceMetaData) metaData.getSource();
+ source.setDeployments(metaData.getDeployments());
+
+ return repository.createDeploymentRepository(key, source);
+ }
+
+ public DeploymentRepository getProfileDeploymentRepository(ProfileKey key) throws NoSuchProfileException
+ {
+ // FIXME
+ return null;
+ }
+
+ public Collection<ProfileKey> getProfileKeys()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public void removeProfileDeploymentRepository(ProfileKey key) throws Exception, NoSuchProfileException
+ {
+ // nothing
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.ServerConfig;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class MockServer implements Server
-{
-
- public ServerConfig config;
-
- public MockServer(ServerConfig config)
- {
- this.config = config;
- }
-
- public ServerConfig getConfig() throws IllegalStateException
- {
- return this.config;
- }
-
- public String getBuildDate()
- {
- // FIXME getBuildDate
- return null;
- }
-
- public String getBuildID()
- {
- // FIXME getBuildID
- return null;
- }
-
- public String getBuildJVM()
- {
- // FIXME getBuildJVM
- return null;
- }
-
- public String getBuildNumber()
- {
- // FIXME getBuildNumber
- return null;
- }
-
- public String getBuildOS()
- {
- // FIXME getBuildOS
- return null;
- }
-
- public Date getStartDate()
- {
- // FIXME getStartDate
- return null;
- }
-
- public String getVersion()
- {
- // FIXME getVersion
- return null;
- }
-
- public String getVersionName()
- {
- // FIXME getVersionName
- return null;
- }
-
- public String getVersionNumber()
- {
- // FIXME getVersionNumber
- return null;
- }
-
- public void init(Properties props) throws IllegalStateException, Exception
- {
- init(props, null);
- }
- public void init(Properties props, Map<String, Object> metadata) throws IllegalStateException, Exception
- {
- // FIXME init
-
- }
- public Map<String, Object> getMetaData()
- {
- return Collections.emptyMap();
- }
- public boolean isInShutdown()
- {
- // FIXME isInShutdown
- return false;
- }
-
- public boolean isStarted()
- {
- // FIXME isStarted
- return false;
- }
-
- public void shutdown() throws IllegalStateException
- {
- // FIXME shutdown
-
- }
-
- public void start() throws IllegalStateException, Exception
- {
- // FIXME start
-
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.profileservice.support;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.bootstrap.spi.ServerConfig;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MockServer implements Server
+{
+
+ public ServerConfig config;
+
+ public MockServer(ServerConfig config)
+ {
+ this.config = config;
+ }
+
+ public ServerConfig getConfig() throws IllegalStateException
+ {
+ return this.config;
+ }
+
+ public String getBuildDate()
+ {
+ // FIXME getBuildDate
+ return null;
+ }
+
+ public String getBuildID()
+ {
+ // FIXME getBuildID
+ return null;
+ }
+
+ public String getBuildJVM()
+ {
+ // FIXME getBuildJVM
+ return null;
+ }
+
+ public String getBuildNumber()
+ {
+ // FIXME getBuildNumber
+ return null;
+ }
+
+ public String getBuildOS()
+ {
+ // FIXME getBuildOS
+ return null;
+ }
+
+ public Date getStartDate()
+ {
+ // FIXME getStartDate
+ return null;
+ }
+
+ public String getVersion()
+ {
+ // FIXME getVersion
+ return null;
+ }
+
+ public String getVersionName()
+ {
+ // FIXME getVersionName
+ return null;
+ }
+
+ public String getVersionNumber()
+ {
+ // FIXME getVersionNumber
+ return null;
+ }
+
+ public void init(Properties props) throws IllegalStateException, Exception
+ {
+ init(props, null);
+ }
+ public void init(Properties props, Map<String, Object> metadata) throws IllegalStateException, Exception
+ {
+ // FIXME init
+
+ }
+ public Map<String, Object> getMetaData()
+ {
+ return Collections.emptyMap();
+ }
+ public boolean isInShutdown()
+ {
+ // FIXME isInShutdown
+ return false;
+ }
+
+ public boolean isStarted()
+ {
+ // FIXME isStarted
+ return false;
+ }
+
+ public void shutdown() throws IllegalStateException
+ {
+ // FIXME shutdown
+
+ }
+
+ public void start() throws IllegalStateException, Exception
+ {
+ // FIXME start
+
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,232 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.support;
-
-import java.io.File;
-import java.net.URL;
-
-import org.jboss.bootstrap.spi.ServerConfig;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class MockServerConfig implements ServerConfig
-{
- String serverName;
- URL configURL;
- URL commonBaseURL;
-
- public MockServerConfig(String serverName, URL configURL, URL commonBaseURL)
- {
- if(serverName == null)
- throw new IllegalArgumentException("Null serverName");
- if(configURL == null)
- throw new IllegalArgumentException("Null configURL");
- if(commonBaseURL == null)
- throw new IllegalArgumentException("Null commonBaseURL");
-
- this.serverName = serverName;
- this.configURL = configURL;
- this.commonBaseURL = commonBaseURL;
- }
-
- public URL getServerConfigURL()
- {
- return this.configURL;
- }
-
- public URL getCommonBaseURL()
- {
- return this.commonBaseURL;
- }
-
- public String getServerName()
- {
- return this.serverName;
- }
-
- public boolean getBlockingShutdown()
- {
- // FIXME getBlockingShutdown
- return false;
- }
-
- public URL getBootstrapURL()
- {
- // FIXME getBootstrapURL
- return null;
- }
-
- public URL getCommonLibraryURL()
- {
- // FIXME getCommonLibraryURL
- return null;
- }
-
-
- public boolean getExitOnShutdown()
- {
- // FIXME getExitOnShutdown
- return false;
- }
-
- public File getHomeDir()
- {
- // FIXME getHomeDir
- return null;
- }
-
- public URL getHomeURL()
- {
- // FIXME getHomeURL
- return null;
- }
-
- public URL getLibraryURL()
- {
- // FIXME getLibraryURL
- return null;
- }
-
- public URL getPatchURL()
- {
- // FIXME getPatchURL
- return null;
- }
-
- public boolean getPlatformMBeanServer()
- {
- // FIXME getPlatformMBeanServer
- return false;
- }
-
- public boolean getRequireJBossURLStreamHandlerFactory()
- {
- // FIXME getRequireJBossURLStreamHandlerFactory
- return false;
- }
-
- public String getRootDeploymentFilename()
- {
- // FIXME getRootDeploymentFilename
- return null;
- }
-
- public File getServerBaseDir()
- {
- // FIXME getServerBaseDir
- return null;
- }
-
- public URL getServerBaseURL()
- {
- // FIXME getServerBaseURL
- return null;
- }
-
- public File getServerDataDir()
- {
- // FIXME getServerDataDir
- return null;
- }
-
- public File getServerHomeDir()
- {
- // FIXME getServerHomeDir
- return null;
- }
-
- public URL getServerHomeURL()
- {
- // FIXME getServerHomeURL
- return null;
- }
-
- public URL getServerLibraryURL()
- {
- // FIXME getServerLibraryURL
- return null;
- }
-
- public File getServerLogDir()
- {
- // FIXME getServerLogDir
- return null;
- }
-
- public File getServerNativeDir()
- {
- // FIXME getServerNativeDir
- return null;
- }
-
- public File getServerTempDeployDir()
- {
- // FIXME getServerTempDeployDir
- return null;
- }
-
- public File getServerTempDir()
- {
- // FIXME getServerTempDir
- return null;
- }
-
- public String getSpecificationVersion()
- {
- // FIXME getSpecificationVersion
- return null;
- }
-
- public boolean isInstallLifeThread()
- {
- // FIXME isInstallLifeThread
- return false;
- }
-
- public void setBlockingShutdown(boolean blockingShutdown)
- {
- // FIXME setBlockingShutdown
-
- }
-
- public void setExitOnShutdown(boolean flag)
- {
- // FIXME setExitOnShutdown
-
- }
-
- public void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory)
- {
- // FIXME setRequireJBossURLStreamHandlerFactory
-
- }
-
- public void setRootDeploymentFilename(String filename)
- {
- // FIXME setRootDeploymentFilename
-
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServerConfig.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,232 @@
+/*
+ * 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.server.profileservice.support;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.bootstrap.spi.ServerConfig;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MockServerConfig implements ServerConfig
+{
+ String serverName;
+ URL configURL;
+ URL commonBaseURL;
+
+ public MockServerConfig(String serverName, URL configURL, URL commonBaseURL)
+ {
+ if(serverName == null)
+ throw new IllegalArgumentException("Null serverName");
+ if(configURL == null)
+ throw new IllegalArgumentException("Null configURL");
+ if(commonBaseURL == null)
+ throw new IllegalArgumentException("Null commonBaseURL");
+
+ this.serverName = serverName;
+ this.configURL = configURL;
+ this.commonBaseURL = commonBaseURL;
+ }
+
+ public URL getServerConfigURL()
+ {
+ return this.configURL;
+ }
+
+ public URL getCommonBaseURL()
+ {
+ return this.commonBaseURL;
+ }
+
+ public String getServerName()
+ {
+ return this.serverName;
+ }
+
+ public boolean getBlockingShutdown()
+ {
+ // FIXME getBlockingShutdown
+ return false;
+ }
+
+ public URL getBootstrapURL()
+ {
+ // FIXME getBootstrapURL
+ return null;
+ }
+
+ public URL getCommonLibraryURL()
+ {
+ // FIXME getCommonLibraryURL
+ return null;
+ }
+
+
+ public boolean getExitOnShutdown()
+ {
+ // FIXME getExitOnShutdown
+ return false;
+ }
+
+ public File getHomeDir()
+ {
+ // FIXME getHomeDir
+ return null;
+ }
+
+ public URL getHomeURL()
+ {
+ // FIXME getHomeURL
+ return null;
+ }
+
+ public URL getLibraryURL()
+ {
+ // FIXME getLibraryURL
+ return null;
+ }
+
+ public URL getPatchURL()
+ {
+ // FIXME getPatchURL
+ return null;
+ }
+
+ public boolean getPlatformMBeanServer()
+ {
+ // FIXME getPlatformMBeanServer
+ return false;
+ }
+
+ public boolean getRequireJBossURLStreamHandlerFactory()
+ {
+ // FIXME getRequireJBossURLStreamHandlerFactory
+ return false;
+ }
+
+ public String getRootDeploymentFilename()
+ {
+ // FIXME getRootDeploymentFilename
+ return null;
+ }
+
+ public File getServerBaseDir()
+ {
+ // FIXME getServerBaseDir
+ return null;
+ }
+
+ public URL getServerBaseURL()
+ {
+ // FIXME getServerBaseURL
+ return null;
+ }
+
+ public File getServerDataDir()
+ {
+ // FIXME getServerDataDir
+ return null;
+ }
+
+ public File getServerHomeDir()
+ {
+ // FIXME getServerHomeDir
+ return null;
+ }
+
+ public URL getServerHomeURL()
+ {
+ // FIXME getServerHomeURL
+ return null;
+ }
+
+ public URL getServerLibraryURL()
+ {
+ // FIXME getServerLibraryURL
+ return null;
+ }
+
+ public File getServerLogDir()
+ {
+ // FIXME getServerLogDir
+ return null;
+ }
+
+ public File getServerNativeDir()
+ {
+ // FIXME getServerNativeDir
+ return null;
+ }
+
+ public File getServerTempDeployDir()
+ {
+ // FIXME getServerTempDeployDir
+ return null;
+ }
+
+ public File getServerTempDir()
+ {
+ // FIXME getServerTempDir
+ return null;
+ }
+
+ public String getSpecificationVersion()
+ {
+ // FIXME getSpecificationVersion
+ return null;
+ }
+
+ public boolean isInstallLifeThread()
+ {
+ // FIXME isInstallLifeThread
+ return false;
+ }
+
+ public void setBlockingShutdown(boolean blockingShutdown)
+ {
+ // FIXME setBlockingShutdown
+
+ }
+
+ public void setExitOnShutdown(boolean flag)
+ {
+ // FIXME setExitOnShutdown
+
+ }
+
+ public void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory)
+ {
+ // FIXME setRequireJBossURLStreamHandlerFactory
+
+ }
+
+ public void setRootDeploymentFilename(String filename)
+ {
+ // FIXME setRootDeploymentFilename
+
+ }
+
+}
+
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/test)
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.test;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.ServerConfig;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
-import org.jboss.profileservice.spi.ProfileRepository;
-import org.jboss.system.server.profileservice.attachments.AttachmentStore;
-import org.jboss.system.server.profileservice.repository.AbstractProfileFactory;
-import org.jboss.test.BaseTestCase;
-import org.jboss.test.server.profileservice.support.MockAttachmentStore;
-import org.jboss.test.server.profileservice.support.MockMainDeployer;
-import org.jboss.test.server.profileservice.support.MockProfileRepository;
-import org.jboss.test.server.profileservice.support.MockServer;
-import org.jboss.test.server.profileservice.support.MockServerConfig;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class AbstractProfileServiceTestBase extends BaseTestCase
-{
-
- public AbstractProfileServiceTestBase(String name)
- {
- super(name);
- }
-
- protected Server createDefaultServer(String name) throws MalformedURLException
- {
- File configDir = new File("src/resources/parsing-tests/config/");
- File commonDir = new File("src/resources/parsing-tests/common/");
- return createServer(name, configDir.toURL(), commonDir.toURL());
- }
-
- protected Server createServer(String name, URL configDir, URL commonDir)
- {
- ServerConfig config = new MockServerConfig(name, configDir, commonDir);
- return createServer(config);
- }
-
- protected Server createServer(ServerConfig config)
- {
- return new MockServer(config);
- }
-
- protected MainDeployer createMainDeployer()
- {
- return new MockMainDeployer();
- }
-
- protected AttachmentStore createAttachmentStore()
- {
- return new MockAttachmentStore();
- }
-
- protected ProfileRepository createProfileRepository(DeploymentRepositoryFactory factory)
- {
- return new MockProfileRepository(factory);
- }
-
- protected AbstractProfileFactory createProfileFactory(DeploymentRepositoryFactory factory)
- {
- AbstractProfileFactory pf = new AbstractProfileFactory();
- pf.setProfileRepository(createProfileRepository(factory));
- return pf;
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.server.profileservice.test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.bootstrap.spi.ServerConfig;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
+import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+import org.jboss.system.server.profileservice.repository.AbstractProfileFactory;
+import org.jboss.test.BaseTestCase;
+import org.jboss.test.server.profileservice.support.MockAttachmentStore;
+import org.jboss.test.server.profileservice.support.MockMainDeployer;
+import org.jboss.test.server.profileservice.support.MockProfileRepository;
+import org.jboss.test.server.profileservice.support.MockServer;
+import org.jboss.test.server.profileservice.support.MockServerConfig;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractProfileServiceTestBase extends BaseTestCase
+{
+
+ public AbstractProfileServiceTestBase(String name)
+ {
+ super(name);
+ }
+
+ protected Server createDefaultServer(String name) throws MalformedURLException
+ {
+ File configDir = new File("src/resources/parsing-tests/config/");
+ File commonDir = new File("src/resources/parsing-tests/common/");
+ return createServer(name, configDir.toURL(), commonDir.toURL());
+ }
+
+ protected Server createServer(String name, URL configDir, URL commonDir)
+ {
+ ServerConfig config = new MockServerConfig(name, configDir, commonDir);
+ return createServer(config);
+ }
+
+ protected Server createServer(ServerConfig config)
+ {
+ return new MockServer(config);
+ }
+
+ protected MainDeployer createMainDeployer()
+ {
+ return new MockMainDeployer();
+ }
+
+ protected AttachmentStore createAttachmentStore()
+ {
+ return new MockAttachmentStore();
+ }
+
+ protected ProfileRepository createProfileRepository(DeploymentRepositoryFactory factory)
+ {
+ return new MockProfileRepository(factory);
+ }
+
+ protected AbstractProfileFactory createProfileFactory(DeploymentRepositoryFactory factory)
+ {
+ AbstractProfileFactory pf = new AbstractProfileFactory();
+ pf.setProfileRepository(createProfileRepository(factory));
+ return pf;
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.test;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
-import org.jboss.system.server.profileservice.repository.FilteredDeploymentRepositoryFactory;
-import org.jboss.system.server.profileservice.repository.XmlProfileFactory;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class BootstrapProfileFactoryUnitTestCase extends AbstractProfileServiceTestBase
-{
-
- /** The profiles */
- Map<String, Profile> profileMap;
-
- public BootstrapProfileFactoryUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testParsing() throws Exception
- {
- enableTrace("org.jboss.system.server.profileservice.repository");
-
- // Set the server base url as system property for the repository generation.
- File serverBaseDir = new File("src/resources/server-root/");
- System.setProperty("jboss.server.base.url", serverBaseDir.toURL().toExternalForm());
-
- // Setup profile locations
- File f = new File("src/resources/parsing-tests/");
- File one = new File(f, "config/profiles");
- File two = new File(f, "common/profiles");
-
- // A filtered deployment factory
- FilteredDeploymentRepositoryFactory repositoryFactory = new FilteredDeploymentRepositoryFactory();
- // The xml profile factory
- AbstractBootstrapProfileFactory profileFactory = new XmlProfileFactory(
- new URI[] { one.toURI(), two.toURI() });
- profileFactory.setProfileFactory(createProfileFactory(repositoryFactory));
-
- // Clear jar suffixes.
- JarUtils.clearSuffixes();
-
- // Parse
- Collection<Profile> profiles = profileFactory.createProfiles(new ProfileKey("default"), null);
- assertNotNull(profiles);
-
- // 2 profiles in default.xml
- // 1 profile in seam.xml
- // 2 profiles in clustering.xml
- // 2 profiles in ejb3.xml
- // 2 profiles in web.xml
- assertEquals(10, profiles.size());
-
- this.profileMap = new HashMap<String, Profile>();
- for(Profile profile : profiles)
- {
- assertNotNull(profile.getKey());
- String name = profile.getKey().getName();
- assertNotNull(name);
- this.profileMap.put(name, profile);
- }
-
- // Assert Profiles
- assertProfiles();
-
- // Try to load the profiles, this will try to resolve the deploymentNames
- // when loading the filtered repository in serverBaseDir.
- for(Profile profile : profiles)
- {
- Method m = null;
- try
- {
- m = profile.getClass().getMethod("create", new Class[0]);
- }
- catch(NoSuchMethodException ignore)
- {
- return;
- }
- boolean isAccessible = m.isAccessible();
- try
- {
- m.setAccessible(true);
- m.invoke(profile, new Object[0]);
- }
- finally
- {
- m.setAccessible(isAccessible);
- }
- }
-
- // TODO assert metadata
- }
-
- protected void assertProfiles()
- {
- // Assert bootstrap profile
- assertProfile("bootstrap", 0);
-
- // Assert ejb3-runtime profile
- assertProfile("metadata-deployer-beans", 1,
- new String[] { "bootstrap" } );
-
- // Assert ejb3-deployers profile
- assertProfile("ejb3-deployers", 2,
- new String[] { "metadata-deployer-beans", "bootstrap" } );
-
- // Assert ejb3-runtime profile
- assertProfile("ejb3-runtime", 3,
- new String[] { "ejb3-deployers", "metadata-deployer-beans", "bootstrap" } );
-
- // Assert seam profile
- assertProfile("seam-deployers", 4,
- new String[] { "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" });
-
- // Assert web-deployers profile
- assertProfile("jboss-web-deployers", 5,
- new String[] { "seam-deployers", "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" } );
-
- // Assert web-runtime profile
- assertProfile("jboss-web-runtime", 6,
- new String[] { "jboss-web-deployers",
- "seam-deployers", "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" } );
-
- // Assert clustering-deployers
- assertProfile("clustering-deployers", 7, new String[] {
- "bootstrap",
- "metadata-deployer-beans",
- "ejb3-deployers",
- "ejb3-runtime",
- "seam-deployers",
- "jboss-web-deployers",
- "jboss-web-runtime"});
-
- // Assert hasingleton
- assertProfile("clustering-runtime", 8, new String[] {
- "bootstrap",
- "metadata-deployer-beans",
- "ejb3-deployers",
- "ejb3-runtime",
- "seam-deployers",
- "jboss-web-deployers",
- "jboss-web-runtime",
- "clustering-deployers"});
-
- // Assert default profile
- assertProfile("default", 9, new String[] {
- "bootstrap",
- "metadata-deployer-beans",
- "ejb3-deployers",
- "ejb3-runtime",
- "seam-deployers",
- "jboss-web-deployers",
- "jboss-web-runtime",
- "clustering-deployers",
- "clustering-runtime"});
- }
-
- protected void assertProfile(String name, int dependencySize, String[] dependencyNames)
- {
- Profile profile = profileMap.get(name);
- assertNotNull("Null profile: " + name, profile);
- assertNotNull("Null dependencies for profile: " + name, profile.getSubProfiles());
- assertDependenciesSize(dependencySize, profile);
- assertDependencies(dependencyNames, profile.getSubProfiles());
- }
-
- protected void assertProfile(String name, int dependencySize)
- {
- assertProfile(name, dependencySize, new String[0]);
- }
-
- protected void assertDependenciesSize(int size, Profile profile)
- {
- assertEquals("dependency size for profile: " + profile.getKey(), size, profile.getSubProfiles().size());
- }
-
- protected void assertDependencies(String[] dependencyNames, Collection<ProfileKey> subProfiles)
- {
- if(dependencyNames == null || dependencyNames.length == 0)
- return;
-
- List<String> iDependOn = new ArrayList<String>();
- for(ProfileKey key : subProfiles)
- {
- iDependOn.add(key.getName());
- }
- // Assert dependency keys
- for(String name : dependencyNames)
- {
- assertTrue("contains name: " + name, iDependOn.contains(name));
- }
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,230 @@
+/*
+ * 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.server.profileservice.test;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
+import org.jboss.system.server.profileservice.repository.FilteredDeploymentRepositoryFactory;
+import org.jboss.system.server.profileservice.repository.XmlProfileFactory;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BootstrapProfileFactoryUnitTestCase extends AbstractProfileServiceTestBase
+{
+
+ /** The profiles */
+ Map<String, Profile> profileMap;
+
+ public BootstrapProfileFactoryUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testParsing() throws Exception
+ {
+ enableTrace("org.jboss.system.server.profileservice.repository");
+
+ // Set the server base url as system property for the repository generation.
+ File serverBaseDir = new File("src/resources/server-root/");
+ System.setProperty("jboss.server.base.url", serverBaseDir.toURL().toExternalForm());
+
+ // Setup profile locations
+ File f = new File("src/resources/parsing-tests/");
+ File one = new File(f, "config/profiles");
+ File two = new File(f, "common/profiles");
+
+ // A filtered deployment factory
+ FilteredDeploymentRepositoryFactory repositoryFactory = new FilteredDeploymentRepositoryFactory();
+ // The xml profile factory
+ AbstractBootstrapProfileFactory profileFactory = new XmlProfileFactory(
+ new URI[] { one.toURI(), two.toURI() });
+ profileFactory.setProfileFactory(createProfileFactory(repositoryFactory));
+
+ // Clear jar suffixes.
+ JarUtils.clearSuffixes();
+
+ // Parse
+ Collection<Profile> profiles = profileFactory.createProfiles(new ProfileKey("default"), null);
+ assertNotNull(profiles);
+
+ // 2 profiles in default.xml
+ // 1 profile in seam.xml
+ // 2 profiles in clustering.xml
+ // 2 profiles in ejb3.xml
+ // 2 profiles in web.xml
+ assertEquals(10, profiles.size());
+
+ this.profileMap = new HashMap<String, Profile>();
+ for(Profile profile : profiles)
+ {
+ assertNotNull(profile.getKey());
+ String name = profile.getKey().getName();
+ assertNotNull(name);
+ this.profileMap.put(name, profile);
+ }
+
+ // Assert Profiles
+ assertProfiles();
+
+ // Try to load the profiles, this will try to resolve the deploymentNames
+ // when loading the filtered repository in serverBaseDir.
+ for(Profile profile : profiles)
+ {
+ Method m = null;
+ try
+ {
+ m = profile.getClass().getMethod("create", new Class[0]);
+ }
+ catch(NoSuchMethodException ignore)
+ {
+ return;
+ }
+ boolean isAccessible = m.isAccessible();
+ try
+ {
+ m.setAccessible(true);
+ m.invoke(profile, new Object[0]);
+ }
+ finally
+ {
+ m.setAccessible(isAccessible);
+ }
+ }
+
+ // TODO assert metadata
+ }
+
+ protected void assertProfiles()
+ {
+ // Assert bootstrap profile
+ assertProfile("bootstrap", 0);
+
+ // Assert ejb3-runtime profile
+ assertProfile("metadata-deployer-beans", 1,
+ new String[] { "bootstrap" } );
+
+ // Assert ejb3-deployers profile
+ assertProfile("ejb3-deployers", 2,
+ new String[] { "metadata-deployer-beans", "bootstrap" } );
+
+ // Assert ejb3-runtime profile
+ assertProfile("ejb3-runtime", 3,
+ new String[] { "ejb3-deployers", "metadata-deployer-beans", "bootstrap" } );
+
+ // Assert seam profile
+ assertProfile("seam-deployers", 4,
+ new String[] { "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" });
+
+ // Assert web-deployers profile
+ assertProfile("jboss-web-deployers", 5,
+ new String[] { "seam-deployers", "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" } );
+
+ // Assert web-runtime profile
+ assertProfile("jboss-web-runtime", 6,
+ new String[] { "jboss-web-deployers",
+ "seam-deployers", "ejb3-deployers", "ejb3-runtime", "metadata-deployer-beans", "bootstrap" } );
+
+ // Assert clustering-deployers
+ assertProfile("clustering-deployers", 7, new String[] {
+ "bootstrap",
+ "metadata-deployer-beans",
+ "ejb3-deployers",
+ "ejb3-runtime",
+ "seam-deployers",
+ "jboss-web-deployers",
+ "jboss-web-runtime"});
+
+ // Assert hasingleton
+ assertProfile("clustering-runtime", 8, new String[] {
+ "bootstrap",
+ "metadata-deployer-beans",
+ "ejb3-deployers",
+ "ejb3-runtime",
+ "seam-deployers",
+ "jboss-web-deployers",
+ "jboss-web-runtime",
+ "clustering-deployers"});
+
+ // Assert default profile
+ assertProfile("default", 9, new String[] {
+ "bootstrap",
+ "metadata-deployer-beans",
+ "ejb3-deployers",
+ "ejb3-runtime",
+ "seam-deployers",
+ "jboss-web-deployers",
+ "jboss-web-runtime",
+ "clustering-deployers",
+ "clustering-runtime"});
+ }
+
+ protected void assertProfile(String name, int dependencySize, String[] dependencyNames)
+ {
+ Profile profile = profileMap.get(name);
+ assertNotNull("Null profile: " + name, profile);
+ assertNotNull("Null dependencies for profile: " + name, profile.getSubProfiles());
+ assertDependenciesSize(dependencySize, profile);
+ assertDependencies(dependencyNames, profile.getSubProfiles());
+ }
+
+ protected void assertProfile(String name, int dependencySize)
+ {
+ assertProfile(name, dependencySize, new String[0]);
+ }
+
+ protected void assertDependenciesSize(int size, Profile profile)
+ {
+ assertEquals("dependency size for profile: " + profile.getKey(), size, profile.getSubProfiles().size());
+ }
+
+ protected void assertDependencies(String[] dependencyNames, Collection<ProfileKey> subProfiles)
+ {
+ if(dependencyNames == null || dependencyNames.length == 0)
+ return;
+
+ List<String> iDependOn = new ArrayList<String>();
+ for(ProfileKey key : subProfiles)
+ {
+ iDependOn.add(key.getName());
+ }
+ // Assert dependency keys
+ for(String name : dependencyNames)
+ {
+ assertTrue("contains name: " + name, iDependOn.contains(name));
+ }
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.test;
-
-import java.io.File;
-
-import org.jboss.profileservice.spi.metadata.ProfileMetaData;
-import org.jboss.system.server.profile.repository.metadata.FilteredProfileMetaData;
-import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileMetaData;
-import org.jboss.system.server.profile.repository.metadata.ProfilesMetaData;
-import org.jboss.test.server.profileservice.support.MavenProfileMetaData;
-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.SingletonSchemaResolverFactory;
-
-
-/**
- * Basic xml parsing test case.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileParsingUnitTestCase extends AbstractProfileServiceTestBase
-{
-
- private static final DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
-
- static
- {
- // Add schema bindings
- resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
- resolver.addClassBinding("urn:jboss:profileservice:profile:filtered:1.0", FilteredProfileMetaData.class);
- resolver.addClassBinding("urn:jboss:profileservice:profile:hotdeployment:1.0", HotDeploymentProfileMetaData.class);
- resolver.addClassBinding("urn:jboss:profileservice:profile:maven:1.0", MavenProfileMetaData.class);
- }
-
-
- public ProfileParsingUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testParsing() throws Exception
- {
- try
- {
- File f = new File("src/resources/parsing-tests/parsing/test.xml");
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
-
- ProfilesMetaData md = (ProfilesMetaData) unmarshaller.unmarshal(f.toURL().openStream(), resolver);
- assertNotNull(md);
- assertEquals("profiles", md.getName());
-
- assertNotNull(md.getProfiles());
- assertEquals(3, md.getProfiles().size());
-
- // test immutable
- ProfileMetaData immutable = md.getProfiles().get(0);
- assertTrue(immutable instanceof FilteredProfileMetaData);
-
- // test hotdeployment
- ProfileMetaData hotdeployment = md.getProfiles().get(1);
- assertTrue(hotdeployment instanceof HotDeploymentProfileMetaData);
-
- // test wildcard
- ProfileMetaData maven = md.getProfiles().get(2);
- assertTrue(maven instanceof MavenProfileMetaData);
-
- for(ProfileMetaData profile: md.getProfiles())
- log.debug(profile.getSource().getClass());
-
- }
- catch(Exception e)
- {
- getLog().error("failed", e);
- throw e;
- }
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileParsingUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.server.profileservice.test;
+
+import java.io.File;
+
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.FilteredProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.ProfilesMetaData;
+import org.jboss.test.server.profileservice.support.MavenProfileMetaData;
+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.SingletonSchemaResolverFactory;
+
+
+/**
+ * Basic xml parsing test case.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileParsingUnitTestCase extends AbstractProfileServiceTestBase
+{
+
+ private static final DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+
+ static
+ {
+ // Add schema bindings
+ resolver.addClassBinding("urn:jboss:profileservice:profiles:1.0", ProfilesMetaData.class);
+ resolver.addClassBinding("urn:jboss:profileservice:profile:filtered:1.0", FilteredProfileMetaData.class);
+ resolver.addClassBinding("urn:jboss:profileservice:profile:hotdeployment:1.0", HotDeploymentProfileMetaData.class);
+ resolver.addClassBinding("urn:jboss:profileservice:profile:maven:1.0", MavenProfileMetaData.class);
+ }
+
+
+ public ProfileParsingUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testParsing() throws Exception
+ {
+ try
+ {
+ File f = new File("src/resources/parsing-tests/parsing/test.xml");
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ ProfilesMetaData md = (ProfilesMetaData) unmarshaller.unmarshal(f.toURL().openStream(), resolver);
+ assertNotNull(md);
+ assertEquals("profiles", md.getName());
+
+ assertNotNull(md.getProfiles());
+ assertEquals(3, md.getProfiles().size());
+
+ // test immutable
+ ProfileMetaData immutable = md.getProfiles().get(0);
+ assertTrue(immutable instanceof FilteredProfileMetaData);
+
+ // test hotdeployment
+ ProfileMetaData hotdeployment = md.getProfiles().get(1);
+ assertTrue(hotdeployment instanceof HotDeploymentProfileMetaData);
+
+ // test wildcard
+ ProfileMetaData maven = md.getProfiles().get(2);
+ assertTrue(maven instanceof MavenProfileMetaData);
+
+ for(ProfileMetaData profile: md.getProfiles())
+ log.debug(profile.getSource().getClass());
+
+ }
+ catch(Exception e)
+ {
+ getLog().error("failed", e);
+ throw e;
+ }
+ }
+
+}
+
Deleted: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-06 10:40:42 UTC (rev 85384)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.server.profileservice.test;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Collection;
-
-import org.jboss.dependency.plugins.AbstractController;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
-import org.jboss.system.server.profileservice.repository.AbstractProfileService;
-import org.jboss.system.server.profileservice.repository.FilteredDeploymentRepositoryFactory;
-import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
-import org.jboss.system.server.profileservice.repository.XmlProfileFactory;
-import org.jboss.test.server.profileservice.support.MockAttachmentStore;
-import org.jboss.test.server.profileservice.support.MockMainDeployer;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileServiceUnitTestCase extends AbstractProfileServiceTestBase
-{
-
- private ProfileService profileService;
-
- public ProfileServiceUnitTestCase(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
- // Create profile service
- MockMainDeployer mainDeployer = new MockMainDeployer();
- MainDeployerAdapter adapter = new MainDeployerAdapter();
- adapter.setMainDeployer(mainDeployer);
- adapter.setAttachmentStore(new MockAttachmentStore());
- AbstractController parentController = new AbstractController();
- AbstractProfileService profileService = new AbstractProfileService(parentController);
- profileService.setDeployer(adapter);
- //
- profileService.create();
- this.profileService = profileService;
- }
-
- public void testProfileService() throws Exception
- {
- // Set the server base url as system property for the repository generation.
- File serverBaseDir = new File("src/resources/server-root/");
- System.setProperty("jboss.server.base.url", serverBaseDir.toURL().toExternalForm());
-
- // Setup profile locations
- File f = new File("src/resources/parsing-tests/");
- File one = new File(f, "config/profiles");
- File two = new File(f, "common/profiles");
-
- //
- FilteredDeploymentRepositoryFactory repositoryFactory = new FilteredDeploymentRepositoryFactory();
- AbstractBootstrapProfileFactory profileFactory = new XmlProfileFactory(
- new URI[] { one.toURI(), two.toURI() });
- profileFactory.setProfileFactory(createProfileFactory(repositoryFactory));
-
- // Clear jar suffixes.
- JarUtils.clearSuffixes();
-
- // Parse
- Collection<Profile> profiles = profileFactory.createProfiles(new ProfileKey("default"), null);
- for(Profile profile : profiles)
- {
- // Register
- profileService.registerProfile(profile);
- }
-
- try
- {
- // Activate profile
- profileService.activateProfile(new ProfileKey("default"));
- }
- catch(Exception e)
- {
- getLog().error("failed to activate: ", e);
- }
-
- // Assert default profile
- assertActive("default");
- // Assert bootstrap profile
- assertActive("bootstrap");
- // Assert seam profile
- assertActive("seam-deployers");
- // Assert ejb3-deployers profile
- assertActive("ejb3-deployers");
- // Assert ejb3-runtime profile
- assertActive("ejb3-runtime");
- // Assert web-deployers profile
- assertActive("jboss-web-deployers");
- // Assert web-runtime profile
- assertActive("jboss-web-runtime");
- // Assert clustering-deployers
- assertActive("clustering-deployers");
- // Assert hasingleton
- assertActive("clustering-runtime");
- // Assert metadata-deployers profile
- assertActive("metadata-deployer-beans");
-
- for(ProfileKey key : profileService.getActiveProfileKeys())
- {
- try
- {
- profileService.deactivateProfile(key);
- }
- catch(Exception e)
- {
- getLog().debug("error deactivating profile: " + key, e);
- }
- }
-
- }
-
- protected void assertActive(String profile) throws Exception
- {
- assertNotNull(profileService.getActiveProfile(new ProfileKey(profile)));
- }
-
-}
-
Copied: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java (from rev 85384, trunk/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,150 @@
+/*
+ * 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.server.profileservice.test;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Collection;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
+import org.jboss.system.server.profileservice.repository.AbstractProfileService;
+import org.jboss.system.server.profileservice.repository.FilteredDeploymentRepositoryFactory;
+import org.jboss.system.server.profileservice.repository.MainDeployerAdapter;
+import org.jboss.system.server.profileservice.repository.XmlProfileFactory;
+import org.jboss.test.server.profileservice.support.MockAttachmentStore;
+import org.jboss.test.server.profileservice.support.MockMainDeployer;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileServiceUnitTestCase extends AbstractProfileServiceTestBase
+{
+
+ private ProfileService profileService;
+
+ public ProfileServiceUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ // Create profile service
+ MockMainDeployer mainDeployer = new MockMainDeployer();
+ MainDeployerAdapter adapter = new MainDeployerAdapter();
+ adapter.setMainDeployer(mainDeployer);
+ adapter.setAttachmentStore(new MockAttachmentStore());
+ AbstractController parentController = new AbstractController();
+ AbstractProfileService profileService = new AbstractProfileService(parentController);
+ profileService.setDeployer(adapter);
+ //
+ profileService.create();
+ this.profileService = profileService;
+ }
+
+ public void testProfileService() throws Exception
+ {
+ // Set the server base url as system property for the repository generation.
+ File serverBaseDir = new File("src/resources/server-root/");
+ System.setProperty("jboss.server.base.url", serverBaseDir.toURL().toExternalForm());
+
+ // Setup profile locations
+ File f = new File("src/resources/parsing-tests/");
+ File one = new File(f, "config/profiles");
+ File two = new File(f, "common/profiles");
+
+ //
+ FilteredDeploymentRepositoryFactory repositoryFactory = new FilteredDeploymentRepositoryFactory();
+ AbstractBootstrapProfileFactory profileFactory = new XmlProfileFactory(
+ new URI[] { one.toURI(), two.toURI() });
+ profileFactory.setProfileFactory(createProfileFactory(repositoryFactory));
+
+ // Clear jar suffixes.
+ JarUtils.clearSuffixes();
+
+ // Parse
+ Collection<Profile> profiles = profileFactory.createProfiles(new ProfileKey("default"), null);
+ for(Profile profile : profiles)
+ {
+ // Register
+ profileService.registerProfile(profile);
+ }
+
+ try
+ {
+ // Activate profile
+ profileService.activateProfile(new ProfileKey("default"));
+ }
+ catch(Exception e)
+ {
+ getLog().error("failed to activate: ", e);
+ }
+
+ // Assert default profile
+ assertActive("default");
+ // Assert bootstrap profile
+ assertActive("bootstrap");
+ // Assert seam profile
+ assertActive("seam-deployers");
+ // Assert ejb3-deployers profile
+ assertActive("ejb3-deployers");
+ // Assert ejb3-runtime profile
+ assertActive("ejb3-runtime");
+ // Assert web-deployers profile
+ assertActive("jboss-web-deployers");
+ // Assert web-runtime profile
+ assertActive("jboss-web-runtime");
+ // Assert clustering-deployers
+ assertActive("clustering-deployers");
+ // Assert hasingleton
+ assertActive("clustering-runtime");
+ // Assert metadata-deployers profile
+ assertActive("metadata-deployer-beans");
+
+ for(ProfileKey key : profileService.getActiveProfileKeys())
+ {
+ try
+ {
+ profileService.deactivateProfile(key);
+ }
+ catch(Exception e)
+ {
+ getLog().debug("error deactivating profile: " + key, e);
+ }
+ }
+
+ }
+
+ protected void assertActive(String profile) throws Exception
+ {
+ assertNotNull(profileService.getActiveProfile(new ProfileKey(profile)));
+ }
+
+}
+
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/profileservice/test/ClusteredDeployUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/profileservice/test/ClusteredDeployUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/profileservice/test/ClusteredDeployUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,7 +28,6 @@
import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
import org.jboss.deployers.spi.management.deploy.ProgressEvent;
import org.jboss.deployers.spi.management.deploy.ProgressListener;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.test.profileservice.test.AbstractProfileServiceTest;
/**
@@ -66,7 +65,7 @@
{
DeploymentManager mgtView = getDeploymentManager();
URL contentURL = super.getDeployURL("testWarDeployment.war");
- DeploymentProgress progress = mgtView.distribute("testWarDeployment.war", DeploymentPhase.APPLICATION_TRANSIENT, contentURL);
+ DeploymentProgress progress = mgtView.distribute("testWarDeployment.war", contentURL, true);
assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
}
public void testEarDeployment()
@@ -74,7 +73,7 @@
{
DeploymentManager mgtView = getDeploymentManager();
URL contentURL = super.getDeployURL("testEarDeployment.ear");
- DeploymentProgress progress = mgtView.distribute("testEarDeployment.ear", DeploymentPhase.APPLICATION_TRANSIENT, contentURL);
+ DeploymentProgress progress = mgtView.distribute("testEarDeployment.ear", contentURL, true);
assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
}
public void testMCBeansDeployment()
@@ -84,7 +83,7 @@
// Distribute the content
DeploymentManager mgtView = getDeploymentManager();
- DeploymentProgress progress = mgtView.distribute("testMCBeansDeployment.beans", DeploymentPhase.APPLICATION_TRANSIENT, contentURL);
+ DeploymentProgress progress = mgtView.distribute("testMCBeansDeployment.beans", contentURL, true);
assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
progress.addProgressListener(this);
progress.run();
@@ -96,7 +95,7 @@
// Now start the deployment
String[] names = {"testMCBeansDeployment.beans"};
- progress = mgtView.start(DeploymentPhase.APPLICATION, names);
+ progress = mgtView.start(names);
assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
progress.addProgressListener(this);
progress.run();
@@ -110,7 +109,7 @@
{
DeploymentManager mgtView = getDeploymentManager();
URL contentURL = super.getDeployURL("testSarDeployment.sar");
- DeploymentProgress progress = mgtView.distribute("testSarDeployment.sar", DeploymentPhase.APPLICATION, contentURL);
+ DeploymentProgress progress = mgtView.distribute("testSarDeployment.sar", contentURL, true);
assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
}
}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -133,10 +133,10 @@
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
activeView = ps.getViewManager();
ProfileKey defaultKey = new ProfileKey(profileName);
- activeView.loadProfile(defaultKey);
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
}
+ activeView.load();
return activeView;
}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -26,19 +26,23 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import javax.management.MBeanServerConnection;
import javax.naming.InitialContext;
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.deployers.spi.management.deploy.ProgressEvent;
import org.jboss.deployers.spi.management.deploy.ProgressListener;
-import org.jboss.deployers.spi.management.deploy.ProgressEvent;
import org.jboss.deployment.MainDeployerMBean;
import org.jboss.logging.Logger;
import org.jboss.managed.api.ManagedDeployment;
@@ -91,6 +95,9 @@
public static final String notSar1Deployment = "mbean1-not.asar";
public static final String notSar1DeploymentUnpacked = "unpacked-mbean1-not.asar";
+ /** We use the default profile, defined by DeploymentManager to deploy apps. */
+ public static final ProfileKey defaultProfile = new ProfileKey(ProfileKey.DEFAULT);
+
protected static Test getManagedDeployment(final Class clazz, final String jarNames) throws Exception
{
return getManagedDeployment(clazz, jarNames, false);
@@ -103,6 +110,8 @@
return new JBossTestSetup(clazz, suite)
{
private DeploymentManager dm;
+
+ Collection<String> deploymentNames = new HashSet<String>();
protected DeploymentManager getDeploymentManager() throws Exception
{
@@ -111,7 +120,7 @@
InitialContext ctx = new InitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
dm = ps.getDeploymentManager();
- dm.loadProfile(new ProfileKey("profileservice"), false);
+ dm.loadProfile(defaultProfile);
return dm;
}
return dm;
@@ -134,25 +143,30 @@
String[] names = jarNames.split(",");
for (String name : names)
{
- DeploymentProgress distribute = getDeploymentManager().distribute(name, ManagedDeployment.DeploymentPhase.APPLICATION, getManagedURL(name), copyContent);
+ DeploymentProgress distribute = getDeploymentManager().distribute(name, getManagedURL(name), copyContent);
//distribute.addProgressListener(LOG_PROGRESS_LISTENER);
distribute.run();
checkProgress(distribute);
- if (copyContent)
- {
- DeploymentProgress start = getDeploymentManager().start(ManagedDeployment.DeploymentPhase.APPLICATION, name);
- start.run();
- checkProgress(start);
- }
+ deploymentNames.addAll(Arrays.asList(distribute.getDeploymentID().getRepositoryNames()));
+ }
+
+ // Check the resolution of repository names
+ assertTrue("resolve repsoitory names",
+ Arrays.asList(getDeploymentManager().getRepositoryNames(names)).containsAll(deploymentNames));
+
+
+ DeploymentProgress start = getDeploymentManager().start(deploymentNames.toArray(new String[ deploymentNames.size()]));
+ start.run();
+ checkProgress(start);
- staticLog.info("Deployed package: " + name);
- }
+ staticLog.info("Deployed package: " + deploymentNames);
}
catch (Exception ex)
{
// Throw this in testServerFound() instead.
deploymentException = ex;
+ staticLog.error("Caught exception when trying to deploy : " + jarNames, ex);
}
}
@@ -161,18 +175,16 @@
if (jarNames == null)
return;
- String[] names = jarNames.split(",");
-
- DeploymentProgress stop = getDeploymentManager().stop(ManagedDeployment.DeploymentPhase.APPLICATION, names);
+ DeploymentProgress stop = getDeploymentManager().stop(deploymentNames.toArray(new String[ deploymentNames.size()]));
stop.run();
checkProgress(stop);
- if (copyContent)
- {
- DeploymentProgress undeploy = getDeploymentManager().undeploy(ManagedDeployment.DeploymentPhase.APPLICATION, names);
- undeploy.run();
- checkProgress(undeploy);
- }
+ DeploymentProgress undeploy = getDeploymentManager().remove(deploymentNames.toArray(new String[ deploymentNames.size()]));
+ undeploy.run();
+ checkProgress(undeploy);
+
+ // Clear names
+ this.deploymentNames.clear();
// no secure handling
@@ -210,10 +222,10 @@
{
deployDir = "output/lib";
}
- String url = deployDir + "/" + filename;
- staticLog.debug("Testing file: " + url);
+ File deployFile = new File(deployDir);
+ staticLog.debug("Testing file: " + deployFile);
// try to canonicalize the strings a bit.
- File file = new File(url);
+ File file = new File(deployFile, filename);
if (file.exists())
{
staticLog.debug(file.getAbsolutePath() + " is a valid file");
@@ -221,8 +233,8 @@
}
else
{
- staticLog.debug("File does not exist, creating url: " + url);
- return new URL(url);
+ staticLog.debug("File does not exist, creating url: " + deployFile);
+ return new URL(deployFile.toURL(), filename);
}
}
@@ -243,12 +255,10 @@
protected ManagementView getManagementView() throws Exception
{
- String profileName = getProfileName();
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService)ctx.lookup("ProfileService");
ManagementView activeView = ps.getViewManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- activeView.loadProfile(defaultKey);
+ activeView.load();
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
return activeView;
@@ -257,7 +267,7 @@
protected ManagedDeployment getDeploymentUnit(String deployment) throws Exception
{
ManagementView mv = getManagementView();
- return mv.getDeployment(deployment, ManagedDeployment.DeploymentPhase.APPLICATION);
+ return mv.getDeployment(deployment);
}
protected ManagedDeployment assertDeployed(String deployment) throws Exception
@@ -285,7 +295,7 @@
protected boolean isDeployed(String deployment) throws Exception
{
ManagementView mv = getManagementView();
- ManagedDeployment md = mv.getDeployment(deployment, ManagedDeployment.DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mv.getDeployment(deployment);
return (md != null);
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/client/test/ClientDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/client/test/ClientDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/client/test/ClientDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,6 +24,7 @@
import java.util.HashSet;
import junit.framework.Test;
+
import org.jboss.test.deployers.AbstractDeploymentTest;
/**
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDClientDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDClientDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDClientDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,7 @@
/**
* @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 66915 $
+ * @version $Revision$
*/
public class EARAltDDClientDeploymentUnitTestCase extends AbstractDeploymentTest
{
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDClientDeploymentUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDConnectorDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDConnectorDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDConnectorDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -30,7 +30,7 @@
/**
* @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 66915 $
+ * @version $Revision$
*/
public class EARAltDDConnectorDeploymentUnitTestCase extends AbstractDeploymentTest
{
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDConnectorDeploymentUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,7 +31,7 @@
/**
* @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 66915 $
+ * @version $Revision$
*/
public class EARAltDDDeploymentUnitTestCase extends AbstractDeploymentTest
{
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/ear/test/EmbeddedDatasourceUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean1/MBean1.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean1/MBean1MBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean2/MBean2.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/sar/mbean2/MBean2MBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/test/EARDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/test/EARDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/test/EARDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -36,7 +36,7 @@
* A test for JBAB2904
*
* @author <a href="vicky.kak at jboss.com">Vicky Kak</a>
- * @version $Revision: 1.0 $
+ * @version $Revision$
*/
public class EARDeploymentUnitTestCase extends AbstractDeploymentTest
{
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas2904/test/EARDeploymentUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/AComplexPK.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPK.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPKBean.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/jbas4548/ejb/EntityPKHome.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamBookingExampleUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamDvdExampleUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamExampleTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamExampleTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamExampleTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -110,7 +110,7 @@
*
* @return
*/
- protected Type gettType()
+ protected Type getType()
{
return Type.EAR;
}
@@ -122,7 +122,7 @@
protected String getTopLevelDeployment(String exampleName)
{
- return String.format(gettType().getFormat(), exampleName);
+ return String.format(getType().getFormat(), exampleName);
}
public void testExample() throws Exception
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamExampleTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamJpaExampleUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamJpaExampleUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamJpaExampleUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -40,7 +40,7 @@
return deploy(SeamJpaExampleUnitTestCase.class, false, Type.WAR);
}
- protected Type gettType()
+ protected Type getType()
{
return Type.WAR;
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamJpaExampleUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamNumberguessExampleUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/seam/test/SeamVFSClassloadingUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces)
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/ejb)
Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java 2009-03-06 11:20:11 UTC (rev 85385)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,40 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.deployers.spaces.ejb;
-
-import javax.ejb.Stateless;
-
-import org.jboss.test.deployers.spaces.lib.Spaces;
-
-/**
- * SpacesEJB.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
- at Stateless
-public class SpacesEJB implements Spaces
-{
- public void doStuff()
- {
- }
-}
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/ejb/SpacesEJB.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -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.test.deployers.spaces.ejb;
+
+import javax.ejb.Stateless;
+
+import org.jboss.test.deployers.spaces.lib.Spaces;
+
+/**
+ * SpacesEJB.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class SpacesEJB implements Spaces
+{
+ public void doStuff()
+ {
+ }
+}
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/lib)
Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java 2009-03-06 11:20:11 UTC (rev 85385)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,36 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.deployers.spaces.lib;
-
-import javax.ejb.Remote;
-
-/**
- * Spaces.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
- at Remote
-public interface Spaces
-{
- void doStuff();
-}
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/lib/Spaces.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,36 @@
+/*
+* 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.deployers.spaces.lib;
+
+import javax.ejb.Remote;
+
+/**
+ * Spaces.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at Remote
+public interface Spaces
+{
+ void doStuff();
+}
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/test)
Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java 2009-03-06 11:20:11 UTC (rev 85385)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.deployers.spaces.test;
-
-import java.io.File;
-import java.net.URI;
-
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.test.deployers.OldAbstractDeploymentTest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A test that deploys everything in an EAR.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 81036 $
- */
-public class SpacesUnitTestCase extends OldAbstractDeploymentTest
-{
- public void testEARDeployment() throws Exception
- {
- // Fixup the uri and get a root context with spaces
- String deployDir = System.getProperty("jbosstest.deploy.dir");
- File file = new File(deployDir);
- file = new File(file, "dir with spaces");
- URI contextName = file.toURI();
- VFS vfs = VFS.getVFS(contextName);
-
- // Create the deployment
- VirtualFile vf = vfs.getChild("spaces.ear");
- assertNotNull(vf);
- Deployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(vf);
-
- // Make sure we can deploy/undeploy it
- invoke(getDeployerName(), "deploy", new Object[]{ deployment }, new String[] { Deployment.class.getName() });
- invoke(getDeployerName(), "checkIncompleteDeployments", null, null);
- invoke(getDeployerName(), "undeploy", new Object[]{ deployment }, new String[] { Deployment.class.getName() });
- }
-
- public SpacesUnitTestCase(String test)
- {
- super(test);
- }
-}
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java (from rev 85385, trunk/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/spaces/test/SpacesUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,65 @@
+/*
+ * 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.deployers.spaces.test;
+
+import java.io.File;
+import java.net.URI;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.test.deployers.OldAbstractDeploymentTest;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A test that deploys everything in an EAR.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 81036 $
+ */
+public class SpacesUnitTestCase extends OldAbstractDeploymentTest
+{
+ public void testEARDeployment() throws Exception
+ {
+ // Fixup the uri and get a root context with spaces
+ String deployDir = System.getProperty("jbosstest.deploy.dir");
+ File file = new File(deployDir);
+ file = new File(file, "dir with spaces");
+ URI contextName = file.toURI();
+ VFS vfs = VFS.getVFS(contextName);
+
+ // Create the deployment
+ VirtualFile vf = vfs.getChild("spaces.ear");
+ assertNotNull(vf);
+ Deployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(vf);
+
+ // Make sure we can deploy/undeploy it
+ invoke(getDeployerName(), "deploy", new Object[]{ deployment }, new String[] { Deployment.class.getName() });
+ invoke(getDeployerName(), "checkIncompleteDeployments", null, null);
+ invoke(getDeployerName(), "undeploy", new Object[]{ deployment }, new String[] { Deployment.class.getName() });
+ }
+
+ public SpacesUnitTestCase(String test)
+ {
+ super(test);
+ }
+}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -33,7 +33,7 @@
* Test for JBAS-4763.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 58276 $
+ * @version $Revision$
*/
public class MissingDependencyWEBDeploymentUnitTestCase extends AbstractDeploymentTest
{
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/web/test/MissingDependencyWEBDeploymentUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanImpl3x.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/ejb3x/BeanRemote3x.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/lib/startup/StartupMonitor.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/mcbeans/Bean1.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/ConnectionFactoryRestartUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/ConnectionFactoryRestartUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/ConnectionFactoryRestartUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -36,9 +36,6 @@
*/
public class ConnectionFactoryRestartUnitTestCase extends AbstractProfileServiceTest
{
-
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
public ConnectionFactoryRestartUnitTestCase(String name)
{
@@ -57,11 +54,5 @@
assertEquals(21, ((SimpleValue) property.getValue()).getValue());
}
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/ConnectionFactoryRestartUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/JmsDestinationRestartUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/JmsDestinationRestartUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/JmsDestinationRestartUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -25,7 +25,6 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.test.profileservice.override.test.AbstractProfileServiceTest;
@@ -38,9 +37,6 @@
public class JmsDestinationRestartUnitTestCase extends AbstractProfileServiceTest
{
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
-
public JmsDestinationRestartUnitTestCase(String name)
{
super(name);
@@ -53,7 +49,7 @@
{
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent component = md.getComponent("testQueue");
@@ -80,7 +76,7 @@
try
{
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent component = md.getComponent("testTopic");
@@ -102,14 +98,6 @@
undeployPackage(new String[] { deploymentName });
}
}
-
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
-
-
+
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/JmsDestinationRestartUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/PersistedDataSourceUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/PersistedDataSourceUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/PersistedDataSourceUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -25,7 +25,6 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.test.profileservice.override.test.AbstractProfileServiceTest;
@@ -38,10 +37,7 @@
*/
public class PersistedDataSourceUnitTestCase extends AbstractProfileServiceTest
{
-
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
-
+
public PersistedDataSourceUnitTestCase(String name)
{
super(name);
@@ -57,7 +53,7 @@
// deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent mc = md.getComponent("ChangedDsJNDIName");
@@ -92,7 +88,7 @@
{
// deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment deployment = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment deployment = mgtView.getDeployment(deploymentName);
assertNotNull(deployment);
assertNotNull(deployment.getChildren());
@@ -156,12 +152,5 @@
undeployPackage(new String[] { deploymentName });
}
}
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
-
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/PersistedDataSourceUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -34,7 +34,6 @@
import org.jboss.deployers.spi.management.deploy.ProgressListener;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.test.JBossTestCase;
@@ -47,6 +46,10 @@
public abstract class AbstractProfileServiceTest extends JBossTestCase implements ProgressListener
{
+ /** We use the default profile, defined by DeploymentManager to deploy apps. */
+ public static final ProfileKey defaultProfile = new ProfileKey(ProfileKey.DEFAULT);
+
+ /** The deployment manager. */
protected DeploymentManager deployMgr;
public AbstractProfileServiceTest(String name)
@@ -54,7 +57,10 @@
super(name);
}
- protected abstract String getProfileName();
+ protected String getProfileName()
+ {
+ return null;
+ }
public void progressEvent(ProgressEvent eventInfo)
{
@@ -88,22 +94,12 @@
stop(deployMgr, uploadedNames);
throw e;
}
- catch(Error e)
- {
- stop(deployMgr, uploadedNames);
- throw e;
- }
}
catch(Exception e)
{
undeploy(deployMgr, uploadedNames);
throw e;
}
- catch(Error e)
- {
- undeploy(deployMgr, uploadedNames);
- throw e;
- }
return uploadedNames;
}
@@ -121,6 +117,14 @@
}
}
+ protected ProfileKey getProfileKey()
+ {
+ if(getProfileName() == null)
+ return defaultProfile;
+
+ return new ProfileKey(getProfileName());
+ }
+
/**
* Obtain the ProfileService.ManagementView
* @return
@@ -129,12 +133,10 @@
protected ManagementView getManagementView()
throws Exception
{
- String profileName = getProfileName();
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
ManagementView activeView = ps.getViewManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- activeView.loadProfile(defaultKey);
+ activeView.load();
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
return activeView;
@@ -150,12 +152,10 @@
{
if( deployMgr == null )
{
- String profileName = getProfileName();
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
deployMgr = ps.getDeploymentManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- deployMgr.loadProfile(defaultKey, false);
+ deployMgr.loadProfile(getProfileKey());
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
}
@@ -165,7 +165,7 @@
protected String[] distribute(DeploymentManager deployMgr, String name, URL contentURL)
throws Exception
{
- DeploymentProgress progress = deployMgr.distribute(name, DeploymentPhase.APPLICATION, contentURL, true);
+ DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
getLog().debug("distribute: "+ contentURL);
progress.addProgressListener(this);
progress.run();
@@ -177,7 +177,7 @@
protected void start(DeploymentManager deployMgr, String[] repositoryNames) throws Exception
{
- DeploymentProgress progress = deployMgr.start(DeploymentPhase.APPLICATION, repositoryNames);
+ DeploymentProgress progress = deployMgr.start(repositoryNames);
progress.addProgressListener(this);
progress.run();
@@ -187,7 +187,7 @@
protected void stop(DeploymentManager deployMgr, String[] repositoryNames) throws Exception
{
- DeploymentProgress progress = deployMgr.stop(DeploymentPhase.APPLICATION, repositoryNames);
+ DeploymentProgress progress = deployMgr.stop(repositoryNames);
progress.addProgressListener(this);
progress.run();
@@ -197,7 +197,7 @@
protected void undeploy(DeploymentManager deployMgr, String[] repositoryNames) throws Exception
{
- DeploymentProgress progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, repositoryNames);
+ DeploymentProgress progress = deployMgr.remove(repositoryNames);
progress.addProgressListener(this);
progress.run();
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -57,15 +57,7 @@
// TODO test more properties.
managementView.updateComponent(component);
- managementView.process();
}
-
- @Override
- protected String getProfileName()
- {
- return "profileservice";
- }
-
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -25,7 +25,6 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.metatype.api.values.SimpleValueSupport;
/**
@@ -36,9 +35,6 @@
*/
public class JmsDestinationOverrideTestCase extends AbstractProfileServiceTest
{
-
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
public JmsDestinationOverrideTestCase(String name)
{
@@ -53,7 +49,7 @@
deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent component = md.getComponent("testQueue");
@@ -66,13 +62,11 @@
property.setValue(SimpleValueSupport.wrap(3000));
mgtView.updateComponent(component);
- mgtView.process();
}
catch(Throwable e)
{
getLog().error("Caugt exception: ", e);
- undeployPackage(new String[] {deploymentName});
throw e;
}
}
@@ -85,7 +79,7 @@
deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent component = md.getComponent("testTopic");
@@ -98,23 +92,14 @@
property.setValue(SimpleValueSupport.wrap(3000));
mgtView.updateComponent(component);
- mgtView.process();
}
catch(Throwable e)
{
getLog().error("Caugt exception: ", e);
- undeployPackage(new String[] {deploymentName});
throw e;
}
}
-
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -25,8 +25,6 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.metatype.api.values.CollectionValue;
import org.jboss.metatype.api.values.CompositeValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
@@ -40,9 +38,6 @@
*/
public class ProfileServiceOverrideTestCase extends AbstractProfileServiceTest
{
-
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
public ProfileServiceOverrideTestCase(String name)
{
@@ -58,7 +53,7 @@
deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment md = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md = mgtView.getDeployment(deploymentName);
assertNotNull(md);
ManagedComponent mc = md.getComponent("ProfileServiceTestDS");
@@ -90,13 +85,12 @@
// update component
mgtView.updateComponent(mc);
- mgtView.process();
// See if the changes are reflected in the managedView after a reload
mgtView = getManagementView();
- ManagedDeployment md2 = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment md2 = mgtView.getDeployment(deploymentName);
assertNotNull(md2);
ManagedComponent mc2 = md2.getComponent("ChangedDsJNDIName");
@@ -131,7 +125,7 @@
{
deployPackage(deploymentName);
ManagementView mgtView = getManagementView();
- ManagedDeployment deployment = mgtView.getDeployment(deploymentName, DeploymentPhase.APPLICATION);
+ ManagedDeployment deployment = mgtView.getDeployment(deploymentName);
assertNotNull(deployment);
assertNotNull(deployment.getChildren());
@@ -169,7 +163,6 @@
// updateComponent and process()
mgtView.updateComponent(mc);
- mgtView.process();
//
// Update 2nd DataSource
@@ -201,7 +194,6 @@
// updateComponent and process()
mgtView.updateComponent(mc);
- mgtView.process();
// See if the changes are reflected in the managedView after a reload
mgtView = getManagementView();
@@ -225,11 +217,4 @@
// undeployPackage(new String[] { deploymentName });
}
}
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
-
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/AbstractPersistenceFormatTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/AbstractPersistenceFormatTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/AbstractPersistenceFormatTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,133 +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.test.profileservice.persistenceformat.test;
-
-import java.io.File;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer;
-import org.jboss.test.JBossTestCase;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractPersistenceFormatTest extends JBossTestCase
-{
-
- /** The managed object factory */
- private ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
-
- /** The meta value factory */
- private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- public AbstractPersistenceFormatTest(String name)
- {
- super(name);
- }
-
- protected ManagedObjectFactory getMOF()
- {
- return this.managedObjectFactory;
- }
-
- protected MetaValueFactory getMVF()
- {
- return this.metaValueFactory;
- }
-
- protected ManagedObject initManagedObject(Object o)
- {
- return getMOF().initManagedObject(o, null);
- }
-
- protected AttachmentsSerializer getAttachmentSerializer() throws Exception
- {
- return getAttachmentSerializer(false);
- }
-
- protected AttachmentsSerializer getAttachmentSerializer(boolean logToSystemOut) throws Exception
- {
- File tempFile = File.createTempFile(getName(), null);
- return createSerializer(tempFile, logToSystemOut);
- }
-
- /**
- * Create the attachment Serializer.
- * Use a tempFile for storing the Xml.
- *
- * @param tempFile the temp File
- * @return a AttachmentSerializer.
- * @throws Exception
- */
- protected AttachmentsSerializer createSerializer(File tempFile) throws Exception
- {
- return createSerializer(tempFile, false);
- }
-
- protected AttachmentsSerializer createSerializer(final File tempFile, final boolean logToSystemOut) throws Exception
- {
- JAXBAttachmentSerializer serializer = new JAXBAttachmentSerializer()
- {
-// @Override
-// protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
-// {
-// Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
-// JBossXBBuilder builder = new JBossXBBuilder();
-// SchemaBinding binding = builder.build(expected);
-// return (T) u.unmarshal(attachmentsStore.getAbsolutePath(), binding);
-// }
-
- @Override
- protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
- {
- log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
- JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
- Marshaller marshaller = ctx.createMarshaller();
- marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
- marshaller.marshal(attachment, attachmentsStore);
- // log to system out ?
- if(logToSystemOut)
- marshaller.marshal(attachment, System.out);
- }
-
- @Override
- protected File getAttachmentPath(String baseName)
- {
- // Return the temp file
- return getAttachmentsStoreDir();
- }
-
- };
- serializer.setAttachmentsStoreDir(tempFile);
-
- return serializer;
- }
-
-}
-
+/*
+ * 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.persistenceformat.test;
+
+import java.io.File;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.jboss.test.JBossTestCase;
+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 abstract class AbstractPersistenceFormatTest extends JBossTestCase
+{
+
+ /** The managed object factory */
+ private ManagedObjectFactory managedObjectFactory = ManagedObjectFactory.getInstance();
+
+ /** The meta value factory */
+ private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ /** The schema resolver */
+ protected static final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ static
+ {
+ resolver.addClassBinding("urn:org:jboss:profileservice:persistence:managed-object:1.0", PersistedManagedObject.class);
+ }
+
+ public AbstractPersistenceFormatTest(String name)
+ {
+ super(name);
+ }
+
+ protected ManagedObjectFactory getMOF()
+ {
+ return this.managedObjectFactory;
+ }
+
+ protected MetaValueFactory getMVF()
+ {
+ return this.metaValueFactory;
+ }
+
+ protected ManagedObject initManagedObject(Object o)
+ {
+ return getMOF().initManagedObject(o, null);
+ }
+
+ protected PersistedManagedObject createPersisted(ManagedObject mo)
+ {
+ ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
+ return persistence.createPersistenceMetaData(mo);
+ }
+
+ protected PersistedManagedObject restore(ManagedObject mo) throws Exception
+ {
+ File file = File.createTempFile("test", null);
+ serialize(createPersisted(mo), 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
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ return (PersistedManagedObject) unmarshaller.unmarshal(file.toURL().openStream(), resolver);
+ }
+}
+
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/AbstractPersistenceFormatTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JBossServicePersistenceFormatTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JBossServicePersistenceFormatTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JBossServicePersistenceFormatTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,232 +1,289 @@
-/*
- * 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.persistenceformat.test;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.system.metadata.ServiceConstructorMetaData;
-import org.jboss.system.metadata.ServiceDependencyMetaData;
-import org.jboss.system.metadata.ServiceDeployment;
-import org.jboss.system.metadata.ServiceDeploymentClassPath;
-import org.jboss.system.metadata.ServiceDeploymentParser;
-import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.metadata.ServiceMetaDataParser;
-import org.w3c.dom.Document;
-
-/**
- * Testing the marshalling/unmarshalling with the JAXBAttachmentSerializer
- * for ServiceDeployment (jboss-service.xml).
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class JBossServicePersistenceFormatTestCase extends AbstractPersistenceFormatTest
-{
-
- public JBossServicePersistenceFormatTestCase(String name)
- {
- super(name);
- }
-
- public void testJbossService() throws Exception
- {
- // Parse
- ServiceDeployment deployment = parseJbossServiceXml("profileservice/persistence/jboss-service.xml");
- assertNotNull(deployment);
- // Create serializer
- AttachmentsSerializer serializer = getAttachmentSerializer();
- // Save
- serializer.saveAttachment("test", deployment);
- // Restore
- ServiceDeployment restored = serializer.loadAttachment("test", ServiceDeployment.class);
- assertNotNull(restored);
-
- // Assert services
- assertServices(deployment.getServices(), restored.getServices());
- // loader repository
- assertLoaderRepository(deployment.getLoaderRepositoryConfig(), restored.getLoaderRepositoryConfig());
- // classpath
- assertClassPaths(deployment.getClassPaths(), restored.getClassPaths());
- }
-
- protected void assertServices(List<ServiceMetaData> original, List<ServiceMetaData> restored)
- {
- assertNotNull(original);
- assertNotNull(restored);
-
- assertEquals("same size", original.size(), restored.size());
-
- Map<String, ServiceMetaData> restoredMap = new HashMap<String, ServiceMetaData>();
- for(ServiceMetaData service : restored)
- restoredMap.put(service.getObjectName().getCanonicalName(), service);
-
- for(ServiceMetaData originalService : original)
- {
- ServiceMetaData restoredService = restoredMap.get(originalService.getObjectName().getCanonicalName());
- assertNotNull(restoredService);
- // assert service
- assertServiceMetaData(originalService, restoredService);
- }
- }
-
- protected void assertServiceMetaData(ServiceMetaData original, ServiceMetaData restored)
- {
- // Code
- assertEquals(original.getCode(), restored.getCode());
- // Interface
- assertEquals(original.getInterfaceName(), restored.getInterfaceName());
- // XMBeanCode
- assertEquals(original.getXMBeanCode(), restored.getXMBeanCode());
- // XMBeanDD
- assertEquals(original.getXMBeanDD(), restored.getXMBeanDD());
- // ClassLoaderName
- assertEquals(original.getClassLoaderName(), restored.getClassLoaderName());
- // Mode
- assertEquals(original.getMode(), restored.getMode());
- // XMBeanDescriptor
- assertEquals(original.getXMBeanDescriptor(), restored.getXMBeanDescriptor());
- // Constructor
- assertServiceConstructor(original.getConstructor(), restored.getConstructor());
-
- // TODO more checking
-
- List<String> originalAliasases = original.getAliases();
- List<String> restoredAliasases = restored.getAliases();
-
- assertEquals(originalAliasases, restoredAliasases);
-
- assertEquals(original.getAnnotations(), restored.getAnnotations());
- if(original.getAnnotations() != null)
- {
- assertNotNull(restored.getAnnotations());
- assertEquals(original.getAnnotations().size(), restored.getAnnotations().size());
-
- }
-
- assertEquals(original.getDependencies(), restored.getDependencies());
- if(original.getDependencies() != null)
- {
- assertNotNull(restored.getDependencies());
- assertEquals(original.getDependencies().size(), restored.getDependencies().size());
- // TODO assertDependency
- }
- else
- {
- assertNull(restored.getDependencies());
- }
- }
-
- protected void assertServiceConstructor(ServiceConstructorMetaData original, ServiceConstructorMetaData restored)
- {
- if(original == null)
- {
- assertNull(restored);
- return;
- }
- else
- {
- assertNotNull(restored);
- }
-
- if(original.getParams() != null)
- {
- assertNotNull(restored.getParams());
- assertEquals(original.getParams().length, restored.getParams().length);
- }
- }
-
- protected void assertDependency(ServiceDependencyMetaData original, ServiceDependencyMetaData restored)
- {
- if(original == null)
- {
- assertNull(restored);
- return;
- }
- else
- {
- assertNotNull(restored);
- }
-
- assertEquals(original.getIDependOn(), restored.getIDependOn());
- }
-
- protected void assertLoaderRepository(LoaderRepositoryConfig original, LoaderRepositoryConfig restored)
- {
- if(original == null)
- {
- assertNull(restored);
- return;
- }
- else
- {
- assertNotNull(restored);
- }
-
- assertEquals(original.configParserClassName, restored.configParserClassName);
- assertEquals(original.repositoryClassName, restored.repositoryClassName);
- assertEquals(original.repositoryConfig, restored.repositoryConfig);
- assertEquals(original.repositoryName, restored.repositoryName);
- }
-
- protected void assertClassPaths(List<ServiceDeploymentClassPath> original, List<ServiceDeploymentClassPath> restored)
- {
- if(original == null)
- {
- assertNull(restored);
- return;
- }
- else
- {
- assertNotNull(restored);
- }
-
- assertEquals(original.size(), restored.size());
- }
-
-
- protected ServiceDeployment parseJbossServiceXml(String resource) throws Exception
- {
- File file = new File(Thread.currentThread().getContextClassLoader().getResource(resource).toURI());
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- Document document = factory.newDocumentBuilder().parse(file);
-
- ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
-
- ServiceDeployment deployment = parser.parse();
- assertNotNull(deployment);
-
- ServiceMetaDataParser serviceParser = new ServiceMetaDataParser(deployment.getConfig());
- List<ServiceMetaData> services = serviceParser.parse();
- assertNotNull(services);
-
- deployment.setServices(services);
- return deployment;
- }
-}
-
+/*
+ * 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.persistenceformat.test;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.jboss.system.metadata.ServiceConstructorMetaData;
+import org.jboss.system.metadata.ServiceDependencyMetaData;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceDeploymentClassPath;
+import org.jboss.system.metadata.ServiceDeploymentParser;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.system.metadata.ServiceMetaDataParser;
+import org.jboss.system.server.profileservice.repository.AbstractFileAttachmentsSerializer;
+import org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer;
+import org.w3c.dom.Document;
+
+/**
+ * Testing the marshalling/unmarshalling with the JAXBAttachmentSerializer
+ * for ServiceDeployment (jboss-service.xml).
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class JBossServicePersistenceFormatTestCase extends AbstractPersistenceFormatTest
+{
+
+ public JBossServicePersistenceFormatTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testJbossService() throws Exception
+ {
+ // Parse
+ ServiceDeployment deployment = parseJbossServiceXml("profileservice/persistence/jboss-service.xml");
+ assertNotNull(deployment);
+ // Create serializer
+ AbstractFileAttachmentsSerializer serializer = getAttachmentSerializer();
+ // Save
+ serializer.saveAttachment("test", deployment);
+ // Restore
+ ServiceDeployment restored = serializer.loadAttachment("test", ServiceDeployment.class);
+ assertNotNull(restored);
+
+ // Assert services
+ assertServices(deployment.getServices(), restored.getServices());
+ // loader repository
+ assertLoaderRepository(deployment.getLoaderRepositoryConfig(), restored.getLoaderRepositoryConfig());
+ // classpath
+ assertClassPaths(deployment.getClassPaths(), restored.getClassPaths());
+ }
+
+ protected void assertServices(List<ServiceMetaData> original, List<ServiceMetaData> restored)
+ {
+ assertNotNull(original);
+ assertNotNull(restored);
+
+ assertEquals("same size", original.size(), restored.size());
+
+ Map<String, ServiceMetaData> restoredMap = new HashMap<String, ServiceMetaData>();
+ for(ServiceMetaData service : restored)
+ restoredMap.put(service.getObjectName().getCanonicalName(), service);
+
+ for(ServiceMetaData originalService : original)
+ {
+ ServiceMetaData restoredService = restoredMap.get(originalService.getObjectName().getCanonicalName());
+ assertNotNull(restoredService);
+ // assert service
+ assertServiceMetaData(originalService, restoredService);
+ }
+ }
+
+ protected void assertServiceMetaData(ServiceMetaData original, ServiceMetaData restored)
+ {
+ // Code
+ assertEquals(original.getCode(), restored.getCode());
+ // Interface
+ assertEquals(original.getInterfaceName(), restored.getInterfaceName());
+ // XMBeanCode
+ assertEquals(original.getXMBeanCode(), restored.getXMBeanCode());
+ // XMBeanDD
+ assertEquals(original.getXMBeanDD(), restored.getXMBeanDD());
+ // ClassLoaderName
+ assertEquals(original.getClassLoaderName(), restored.getClassLoaderName());
+ // Mode
+ assertEquals(original.getMode(), restored.getMode());
+ // XMBeanDescriptor
+ assertEquals(original.getXMBeanDescriptor(), restored.getXMBeanDescriptor());
+ // Constructor
+ assertServiceConstructor(original.getConstructor(), restored.getConstructor());
+
+ // TODO more checking
+
+ List<String> originalAliasases = original.getAliases();
+ List<String> restoredAliasases = restored.getAliases();
+
+ assertEquals(originalAliasases, restoredAliasases);
+
+ assertEquals(original.getAnnotations(), restored.getAnnotations());
+ if(original.getAnnotations() != null)
+ {
+ assertNotNull(restored.getAnnotations());
+ assertEquals(original.getAnnotations().size(), restored.getAnnotations().size());
+
+ }
+
+ assertEquals(original.getDependencies(), restored.getDependencies());
+ if(original.getDependencies() != null)
+ {
+ assertNotNull(restored.getDependencies());
+ assertEquals(original.getDependencies().size(), restored.getDependencies().size());
+ // TODO assertDependency
+ }
+ else
+ {
+ assertNull(restored.getDependencies());
+ }
+ }
+
+ protected void assertServiceConstructor(ServiceConstructorMetaData original, ServiceConstructorMetaData restored)
+ {
+ if(original == null)
+ {
+ assertNull(restored);
+ return;
+ }
+ else
+ {
+ assertNotNull(restored);
+ }
+
+ if(original.getParams() != null)
+ {
+ assertNotNull(restored.getParams());
+ assertEquals(original.getParams().length, restored.getParams().length);
+ }
+ }
+
+ protected void assertDependency(ServiceDependencyMetaData original, ServiceDependencyMetaData restored)
+ {
+ if(original == null)
+ {
+ assertNull(restored);
+ return;
+ }
+ else
+ {
+ assertNotNull(restored);
+ }
+
+ assertEquals(original.getIDependOn(), restored.getIDependOn());
+ }
+
+ protected void assertLoaderRepository(LoaderRepositoryConfig original, LoaderRepositoryConfig restored)
+ {
+ if(original == null)
+ {
+ assertNull(restored);
+ return;
+ }
+ else
+ {
+ assertNotNull(restored);
+ }
+
+ assertEquals(original.configParserClassName, restored.configParserClassName);
+ assertEquals(original.repositoryClassName, restored.repositoryClassName);
+ assertEquals(original.repositoryConfig, restored.repositoryConfig);
+ assertEquals(original.repositoryName, restored.repositoryName);
+ }
+
+ protected void assertClassPaths(List<ServiceDeploymentClassPath> original, List<ServiceDeploymentClassPath> restored)
+ {
+ if(original == null)
+ {
+ assertNull(restored);
+ return;
+ }
+ else
+ {
+ assertNotNull(restored);
+ }
+
+ assertEquals(original.size(), restored.size());
+ }
+
+
+ protected ServiceDeployment parseJbossServiceXml(String resource) throws Exception
+ {
+ File file = new File(Thread.currentThread().getContextClassLoader().getResource(resource).toURI());
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ Document document = factory.newDocumentBuilder().parse(file);
+
+ ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
+
+ ServiceDeployment deployment = parser.parse();
+ assertNotNull(deployment);
+
+ ServiceMetaDataParser serviceParser = new ServiceMetaDataParser(deployment.getConfig());
+ List<ServiceMetaData> services = serviceParser.parse();
+ assertNotNull(services);
+
+ deployment.setServices(services);
+ return deployment;
+ }
+
+ protected AbstractFileAttachmentsSerializer getAttachmentSerializer() throws Exception
+ {
+ return getAttachmentSerializer(false);
+ }
+
+ protected AbstractFileAttachmentsSerializer getAttachmentSerializer(boolean logToSystemOut) throws Exception
+ {
+ File tempFile = File.createTempFile(getName(), null);
+ return createSerializer(tempFile, logToSystemOut);
+ }
+
+ /**
+ * Create the attachment Serializer.
+ * Use a tempFile for storing the Xml.
+ *
+ * @param tempFile the temp File
+ * @return a AttachmentSerializer.
+ * @throws Exception
+ */
+ protected AbstractFileAttachmentsSerializer createSerializer(File tempFile) throws Exception
+ {
+ return createSerializer(tempFile, false);
+ }
+
+ protected AbstractFileAttachmentsSerializer createSerializer(final File tempFile, final boolean logToSystemOut) throws Exception
+ {
+ return new TempAttachmentSerializer(tempFile);
+ }
+
+ private class TempAttachmentSerializer extends JAXBAttachmentSerializer
+ {
+ public TempAttachmentSerializer(File tempFile)
+ {
+ super(tempFile);
+ }
+
+ @Override
+ protected void saveAttachment(File attachmentsStore, Object attachment) throws Exception
+ {
+ log.trace("saveAttachments, attachmentsStore="+attachmentsStore+ ", attachment="+attachment);
+ JAXBContext ctx = JAXBContext.newInstance(attachment.getClass());
+ Marshaller marshaller = ctx.createMarshaller();
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.marshal(attachment, attachmentsStore);
+ }
+
+ @Override
+ protected File getAttachmentPath(String baseName)
+ {
+ // Return the temp file
+ return getAttachmentsStoreDir();
+ }
+ }
+}
+
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JBossServicePersistenceFormatTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JMSDestinationPersistenceFormatTestCase.java (from rev 85385, trunk/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JMSDestinationPersistenceFormatTestCase.java)
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JMSDestinationPersistenceFormatTestCase.java (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/JMSDestinationPersistenceFormatTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -0,0 +1,154 @@
+/*
+ * 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.persistenceformat.test;
+
+import java.io.File;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.system.deployers.managed.ServiceMetaDataICF;
+import org.jboss.system.metadata.ServiceAttributeMetaData;
+import org.jboss.system.metadata.ServiceDeployment;
+import org.jboss.system.metadata.ServiceDeploymentParser;
+import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.system.metadata.ServiceMetaDataParser;
+import org.jboss.system.metadata.ServiceTextValueMetaData;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
+import org.w3c.dom.Document;
+
+/**
+ * Test the merging of JMSDestination attributes.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class JMSDestinationPersistenceFormatTestCase extends AbstractPersistenceFormatTest
+{
+
+ public JMSDestinationPersistenceFormatTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ enableTrace("org.jboss.system");
+ }
+
+ public void testTopic() throws Throwable
+ {
+ doTestMerge("profileservice/override/testTopic-service.xml");
+ }
+
+ public void testQueue() throws Throwable
+ {
+ doTestMerge("profileservice/override/testQueue-service.xml");
+ }
+
+ protected void doTestMerge(String xmlName) throws Throwable
+ {
+ // Set the ICF
+ getMOF().addInstanceClassFactory(new ServiceMetaDataICF());
+
+ // create
+ ManagedObject deploymentMO = getDeploymentMO(xmlName);
+
+ // update property
+ getProperty(deploymentMO, "downCacheSize").setValue(SimpleValueSupport.wrap(123456));
+
+ PersistedManagedObject moElement = restore(deploymentMO);
+
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(parseJbossServiceXml(xmlName), moElement);
+
+ // assert
+ assertEquals(SimpleValueSupport.wrap(123456), getProperty(restored, "downCacheSize").getValue());
+
+
+ // Assert attachment meta data
+ ServiceDeployment deployment = (ServiceDeployment) restored.getAttachment();
+ assertNotNull(deployment);
+ ServiceMetaData service = deployment.getServices().get(0);
+ assertNotNull(service);
+ boolean foundAttribute = false;
+ for(ServiceAttributeMetaData attribute : service.getAttributes())
+ {
+ if("DownCacheSize".equals(attribute.getName()))
+ {
+ String text = ((ServiceTextValueMetaData) attribute.getValue()).getText();
+ assertEquals("123456", text);
+ foundAttribute = true;
+ }
+ }
+ assertTrue(foundAttribute);
+ }
+
+ protected ManagedProperty getProperty(ManagedObject serviceDeploymentMO, String propertyName)
+ {
+ assertNotNull(serviceDeploymentMO);
+ CollectionValue collection = (CollectionValue) serviceDeploymentMO.getProperty("services").getValue();
+ assertNotNull(collection);
+ GenericValue topic = (GenericValue) collection.iterator().next();
+ assertNotNull(topic);
+ ManagedObject topicMO = (ManagedObject) topic.getValue();
+ assertNotNull(topicMO);
+
+ // downCacheSize
+ return topicMO.getProperty(propertyName);
+ }
+
+ protected ManagedObject getDeploymentMO(String resource) throws Exception
+ {
+ ServiceDeployment deployment = parseJbossServiceXml(resource);
+ assertNotNull(deployment);
+
+ return getMOF().initManagedObject(deployment, null);
+ }
+
+ protected ServiceDeployment parseJbossServiceXml(String resource) throws Exception
+ {
+ File file = new File(Thread.currentThread().getContextClassLoader().getResource(resource).toURI());
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ Document document = factory.newDocumentBuilder().parse(file);
+
+ ServiceDeploymentParser parser = new ServiceDeploymentParser(document);
+
+ ServiceDeployment deployment = parser.parse();
+ assertNotNull(deployment);
+
+ ServiceMetaDataParser serviceParser = new ServiceMetaDataParser(deployment.getConfig());
+ List<ServiceMetaData> services = serviceParser.parse();
+ assertNotNull(services);
+
+ deployment.setServices(services);
+ return deployment;
+ }
+
+}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/LocalDataSourcePersistenceFormatTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/LocalDataSourcePersistenceFormatTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/LocalDataSourcePersistenceFormatTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -29,14 +29,18 @@
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.sax.SAXSource;
-import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
-import org.jboss.profileservice.spi.AttachmentsSerializer;
-import org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.resource.deployers.management.LocalDSInstanceClassFactory;
import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
-import org.jboss.system.metadata.ServiceAttributeMetaData;
-import org.jboss.system.metadata.ServiceDependencyMetaData;
+import org.jboss.system.deployers.managed.ServiceMetaDataICF;
import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
import org.jboss.util.xml.JBossEntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -50,95 +54,83 @@
*/
public class LocalDataSourcePersistenceFormatTestCase extends AbstractPersistenceFormatTest
{
-
+
public LocalDataSourcePersistenceFormatTestCase(String name) throws Exception
{
- super(name);
+ super(name);
}
- public void testParsing() throws Exception
+ public void testProfileServiceTestDS() throws Throwable
{
+ getMOF().addInstanceClassFactory(new LocalDSInstanceClassFactory());
+ // FIXME
+ getMOF().addInstanceClassFactory(new ServiceMetaDataICF());
+
// Initial parsing of the dataSource deployment
ManagedConnectionFactoryDeploymentGroup deployment = parseDataSource("profileservice/persistence/profileservice-test-ds.xml");
assertNotNull(deployment);
- // create a attachment serializer
- AttachmentsSerializer serializer = getAttachmentSerializer();
+
+ ManagedObject mo = getMOF().initManagedObject(deployment, null);
+
+ // Change values
+ getManagedProperty(mo, "min-pool-size").setValue(SimpleValueSupport.wrap(13));
+ getManagedProperty(mo, "max-pool-size").setValue(SimpleValueSupport.wrap(53));
- // Save attachment
- serializer.saveAttachment("test", deployment);
- // Restore attachment
- ManagedConnectionFactoryDeploymentGroup restored = serializer.loadAttachment("test", ManagedConnectionFactoryDeploymentGroup.class);
+ PersistedManagedObject moelement = restore(mo);
+ assertNotNull(moelement);
+
+ enableTrace("org.jboss.system");
+
+ // Recreate
+ deployment = parseDataSource("profileservice/persistence/profileservice-test-ds.xml");
+ ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
+ ManagedObject restored = handler.update(deployment, moelement);
assertNotNull(restored);
- List<ManagedConnectionFactoryDeploymentMetaData> deployments = restored.getDeployments();
- assertNotNull(deployments);
- assertEquals(deployments.size(), deployment.getDeployments().size());
+ assertEquals(SimpleValueSupport.wrap(13), getManagedProperty(mo, "min-pool-size").getValue());
+ assertEquals(SimpleValueSupport.wrap(53), getManagedProperty(mo, "max-pool-size").getValue());
- List<ServiceMetaData> services = restored.getServices();
- assertNotNull(services);
- assertEquals(services.size(), deployment.getServices().size());
-
- assertServiceMetaData(deployment.getServices().get(0), services.get(0));
- LoaderRepositoryConfig repository = restored.getLoaderRepositoryConfig();
- assertNotNull(repository);
- assertEquals(deployment.getLoaderRepositoryConfig().repositoryName, repository.repositoryName);
- assertEquals(deployment.getLoaderRepositoryConfig().configParserClassName, repository.configParserClassName);
- assertEquals(deployment.getLoaderRepositoryConfig().repositoryClassName, repository.repositoryClassName);
+ ManagedConnectionFactoryDeploymentGroup mcfdg = (ManagedConnectionFactoryDeploymentGroup) restored.getAttachment();
+ assertNotNull(mcfdg);
+ // Assert services
+ assertServices(mcfdg.getServices());
+ // Assert deployments
+ assertDeployments(mcfdg.getDeployments());
+ // TODO Assert loader repository
+ assertNotNull(mcfdg.getLoaderRepositoryConfig());
}
- protected void assertServiceMetaData(ServiceMetaData original, ServiceMetaData restored)
+ protected void assertDeployments(List<ManagedConnectionFactoryDeploymentMetaData> deployments)
{
- assertNotNull(original);
- assertNotNull(restored);
-
- assertAttributes(original.getAttributes(), restored.getAttributes());
- assertDepends(original.getDependencies(), restored.getDependencies());
+ assertNotNull(deployments);
+ assertEquals(1, deployments.size());
+
+ ManagedConnectionFactoryDeploymentMetaData deployment = deployments.get(0);
+ assertNotNull(deployment);
+ assertEquals(13, deployment.getMinSize());
+ assertEquals(53, deployment.getMaxSize());
}
- protected void assertAttributes(List<ServiceAttributeMetaData> original, List<ServiceAttributeMetaData> restored)
+ protected void assertServices(List<ServiceMetaData> services)
{
- assertNotNull(original);
- assertNotNull(restored);
-
- assertEquals(original.size(), restored.size());
- // ...
- }
-
- protected void assertDepends(List<ServiceDependencyMetaData> original, List<ServiceDependencyMetaData> restored)
- {
- assertNotNull(original);
- assertNotNull(restored);
+ assertNotNull(services);
+ assertEquals(2, services.size());
- assertEquals(original.size(), restored.size());
-
- ServiceDependencyMetaData dmo = original.get(0);
- ServiceDependencyMetaData dmr = restored.get(0);
-
- assertEquals(dmo.getIDependOn(), dmr.getIDependOn());
+ for(ServiceMetaData service : services)
+ {
+ assertNotNull(service.getCode());
+ assertNotNull(service.getAttributes());
+ assertFalse(service.getAttributes().isEmpty());
+ }
}
- protected void assertLocalDataSource(ManagedConnectionFactoryDeploymentMetaData original, ManagedConnectionFactoryDeploymentMetaData restored)
+ protected ManagedProperty getManagedProperty(ManagedObject mo, String propertyName)
{
- assertNotNull(original);
- assertNotNull(restored);
-
- assertEquals(original.getJndiName(), restored.getJndiName());
- assertEquals(original.getLocalTransactions(), restored.getLocalTransactions());
-
- assertTrue(original instanceof LocalDataSourceDeploymentMetaData);
- assertTrue(restored instanceof LocalDataSourceDeploymentMetaData);
-
- LocalDataSourceDeploymentMetaData o = (LocalDataSourceDeploymentMetaData) original;
- LocalDataSourceDeploymentMetaData r = (LocalDataSourceDeploymentMetaData) restored;
-
- assertEquals(o.getDriverClass(), r.getDriverClass());
- assertEquals(o.getDriverClass(), r.getDriverClass());
- assertEquals(o.getConnectionUrl(), r.getConnectionUrl());
- assertEquals(o.getUserName(), r.getUserName());
- assertEquals(o.getPreparedStatementCacheSize(), r.getPreparedStatementCacheSize());
- assertEquals(o.getPassWord(), r.getPassWord());
- // ...
+ CollectionValue collection = (CollectionValue) mo.getProperty("deployments").getValue();
+ GenericValue generic = (GenericValue) collection.iterator().next();
+ ManagedObject deployment = (ManagedObject) generic.getValue();
+ return deployment.getProperty(propertyName);
}
protected ManagedConnectionFactoryDeploymentGroup parseDataSource(String resource) throws Exception
@@ -155,7 +147,8 @@
JAXBContext context = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
Unmarshaller um = context.createUnmarshaller();
// Unmarshal
- JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source, ManagedConnectionFactoryDeploymentGroup.class);
- return elem.getValue();
+ JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source,
+ ManagedConnectionFactoryDeploymentGroup.class);
+ return elem.getValue();
}
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/LocalDataSourcePersistenceFormatTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/SimplePersistenceFormatUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/SimplePersistenceFormatUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/SimplePersistenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,318 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.profileservice.persistenceformat.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.CollectionValue;
-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.spi.AttachmentsSerializer;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectUpdateHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCompositeValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
-import org.jboss.test.profileservice.persistenceformat.support.PrimitiveMetaData;
-import org.jboss.test.profileservice.persistenceformat.support.TestMetaData;
-
-/**
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class SimplePersistenceFormatUnitTestCase extends AbstractPersistenceFormatTest
-{
-
- public SimplePersistenceFormatUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testPrimitive() throws Exception
- {
- // 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 = process(mo);
- assertNotNull(restored);
- assertFalse(restored.values().isEmpty());
- assertEquals(3, restored.values().size());
- PersistedProperty pp0 = restored.get("name");
- assertNotNull(pp0);
- assertNotNull(pp0.getValue());
-
-
- ManagedObjectUpdateHandler merger = new ManagedObjectUpdateHandler();
- // init again;
- mo = createPrimitiveMO();
-
- assertEquals("testName", getMVF().unwrap(mo.getProperty("name").getValue()));
-
- merger.processManagedObject(restored, mo);
-
- assertEquals("newName", getMVF().unwrap(mo.getProperty("name").getValue()));
- assertEquals(111, getMVF().unwrap(mo.getProperty("integer").getValue()));
- assertEquals("optional", ((SimpleValue) mo.getProperty("optionalName").getValue()).getValue());
-
- }
-
- public void testMetaDataPrimitive() throws Exception
- {
- 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 = process(mo);
- assertNotNull(restored);
- assertFalse(restored.values().isEmpty());
- PersistedProperty pp0 = restored.get("primitive");
- assertNotNull(pp0);
- PersistedCompositeValue pp1 = (PersistedCompositeValue) pp0.getValue();
- assertNotNull(pp1);
- assertFalse(pp1.values().isEmpty());
-
- // Create again
- mo = createTestMetaDataMO();
-
-
- // Merge
- ManagedObjectUpdateHandler merger = new ManagedObjectUpdateHandler();
- merger.processManagedObject(restored, mo);
-
- 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 testMetaDataList() throws Exception
-// {
-//
-// ManagedObject mo = createTestMetaDataMO();
-// assertNotNull(mo);
-//
-// ManagedProperty p = mo.getProperty("list");
-// assertNotNull(p);
-//
-// CollectionValue cv = (CollectionValue) p.getValue();
-// assertNotNull(cv);
-//
-// // TODO merge list
-// fail("TODO merge list");
-// }
-
-
- public void testMetaDataMap() throws Exception
- {
- 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 = process(mo);
- assertNotNull(restored);
-
- mo = createTestMetaDataMO();
-
- ManagedObjectUpdateHandler handler = new ManagedObjectUpdateHandler();
- handler.processManagedObject(restored, mo);
-
- p = mo.getProperty("testMap");
- assertNotNull(p);
-
- CompositeValue changedComposite = (CompositeValue) p.getValue();
- assertNotNull(changedComposite);
-
- v = (SimpleValue) changedComposite.get("testString2");
- assertEquals("changedString", v.getValue());
- }
-
- // TODO
-// public void testPrimitiveArray() throws Exception
-// {
-// 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 = process(mo);
-// assertNotNull(restored);
-//
-// //
-// mo = createTestMetaDataMO();
-//
-// ManagedObjectUpdateHandler handler = new ManagedObjectUpdateHandler();
-// handler.processManagedObject(restored, mo);
-//
-// p = mo.getProperty("charArray");
-// assertNotNull(p);
-//
-// a = (ArrayValue) p.getValue();
-// assertNotNull(a);
-//
-// assertEquals('H', ((SimpleValue) a.getValue(1)).getValue());
-// }
-
- protected PersistedManagedObject process(ManagedObject mo) throws Exception
- {
- // Create root;
- PersistedManagedObject persisted = new PersistedManagedObject();
- // Create xml elements
- ManagedObjectPeristenceHandler handler = new ManagedObjectPeristenceHandler();
- handler.processManagedObject(persisted, mo);
-
- // Save
- AttachmentsSerializer serializer = getAttachmentSerializer(true);
- serializer.saveAttachment("test", persisted);
- // Restore
- return serializer.loadAttachment("test", PersistedManagedObject.class);
- }
-
- 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;
- }
-
-}
-
Deleted: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/TestNestedPeristenceFormatUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/TestNestedPeristenceFormatUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/test/TestNestedPeristenceFormatUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -1,254 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.profileservice.persistenceformat.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.spi.AttachmentsSerializer;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectUpdateHandler;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.test.profileservice.persistenceformat.support.NestedTestMetaData;
-import org.jboss.test.profileservice.persistenceformat.support.PrimitiveMetaData;
-import org.jboss.test.profileservice.persistenceformat.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 Exception
- {
- 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, 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 = process(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 = createNestedMO();
-
- ManagedObjectUpdateHandler handler = new ManagedObjectUpdateHandler();
- handler.processManagedObject(restored, mo);
-
- 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);
-
- for(TestMetaData tmd : md.getDeployments())
- log.debug(tmd);
- }
-
- 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 PersistedManagedObject process(ManagedObject mo) throws Exception
- {
- // Create root;
- PersistedManagedObject persisted = new PersistedManagedObject();
- // Create xml elements
- ManagedObjectPeristenceHandler handler = new ManagedObjectPeristenceHandler();
- handler.processManagedObject(persisted, mo);
-
- // Save
- AttachmentsSerializer serializer = getAttachmentSerializer(true);
- serializer.saveAttachment("test", persisted);
- // Restore
- return serializer.loadAttachment("test", PersistedManagedObject.class);
- }
-
- 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);
-
- return test;
- }
-
- protected PrimitiveMetaData createPrimitive()
- {
- PrimitiveMetaData primitive = new PrimitiveMetaData();
- primitive.setInteger(12);
- primitive.setName("testName");
- return primitive;
- }
-}
-
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,34 +21,37 @@
*/
package org.jboss.test.profileservice.test;
+import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
-import java.util.HashSet;
-import java.io.Serializable;
-import java.lang.reflect.Type;
+
import javax.naming.InitialContext;
-import org.jboss.test.JBossTestCase;
+
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.test.JBossTestCase;
import org.jboss.virtual.VFS;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision: $</tt>
+ * @version <tt>$Revision$</tt>
*/
public abstract class AbstractProfileServiceTest
extends JBossTestCase
{
+
+ /** We use the default profile, defined by DeploymentManager to deploy apps. */
+ public static final ProfileKey defaultProfile = new ProfileKey(ProfileKey.DEFAULT);
+
protected ManagementView activeView;
protected DeploymentManager deployMgr;
private MetaValueFactory metaValueFactory;
@@ -57,30 +60,51 @@
{
super(name);
}
+
/**
* @return the ProfileKey.name to use when loading the profile
*/
- protected abstract String getProfileName();
+ protected String getProfileName()
+ {
+ return null;
+ }
+
+ protected ProfileKey getProfileKey()
+ {
+ if(getProfileName() == null)
+ return defaultProfile;
+
+ return new ProfileKey(getProfileName());
+ }
protected void removeDeployment(String deployment)
throws Exception
{
- ManagementView mgtView = getManagementView();
- Set<String> names = mgtView.getMatchingDeploymentName(".*" + deployment);
- assertEquals("1 matching name", 1, names.size());
- String deploymentName = names.iterator().next();
- mgtView.removeDeployment(deploymentName, ManagedDeployment.DeploymentPhase.APPLICATION);
- mgtView.process();
+ String names[] = new String[] {deployment};
+ DeploymentManager deployMgr = getDeploymentManager();
+ try
+ {
+ DeploymentProgress progress = deployMgr.stop(names);
+ progress.run();
+ assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
+ }
+ finally
+ {
+ DeploymentProgress progress = deployMgr.remove(names);
+ progress.run();
+ assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
+ }
}
protected void createComponentTest(String templateName,
Map<String, MetaValue> propValues,
String deploymentName,
ComponentType componentType, String componentName)
- throws Exception
+ throws Exception
{
createComponentTest(templateName, propValues, deploymentName, componentType, componentName, true);
}
+
protected void createComponentTest(String templateName,
Map<String, MetaValue> propValues,
String deploymentName,
@@ -95,13 +119,13 @@
for(String propName : propValues.keySet())
{
ManagedProperty prop = props.get(propName);
+ log.debug("createComponentTest("+propName+") before: "+prop.getValue());
assertNotNull("property " + propName + " found in template " + templateName, prop);
- log.debug("createComponentTest("+propName+") before: "+prop.getValue());
prop.setValue(propValues.get(propName));
log.debug("createComponentTest("+propName+") after: "+prop.getValue());
}
- mgtView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, deploymentName, info);
+ mgtView.applyTemplate(deploymentName, info);
if(processChanges)
{
mgtView.process();
@@ -141,15 +165,14 @@
{
if( activeView == null )
{
- String profileName = getProfileName();
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
activeView = ps.getViewManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- activeView.loadProfile(defaultKey);
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
}
+ // Reload
+ activeView.load();
return activeView;
}
/**
@@ -162,12 +185,10 @@
{
if( deployMgr == null )
{
- String profileName = getProfileName();
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
deployMgr = ps.getDeploymentManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- deployMgr.loadProfile(defaultKey, false);
+ deployMgr.loadProfile(getProfileKey());
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -24,12 +24,9 @@
import java.net.URL;
import java.util.Arrays;
import java.util.Set;
+
import javax.naming.InitialContext;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
@@ -37,11 +34,6 @@
import org.jboss.deployers.spi.management.deploy.ProgressEvent;
import org.jboss.deployers.spi.management.deploy.ProgressListener;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.test.JBossTestSetup;
-import org.jboss.test.jpa.test.WebClassesEARJPAUnitTestCase;
import org.jboss.test.profileservice.ejb2x.BeanHome;
import org.jboss.test.profileservice.ejb2x.BeanRemote;
import org.jboss.test.profileservice.ejb3x.BeanRemote3x;
@@ -49,7 +41,7 @@
/**
* Profile service DeploymentManager tests
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class DeployUnitTestCase extends AbstractProfileServiceTest implements ProgressListener
{
@@ -66,18 +58,14 @@
{
super.setUp();
DeploymentManager deployMgr = getDeploymentManager();
- String profileName = getProfileName();
- ProfileKey key = new ProfileKey(profileName);
- deployMgr.loadProfile(key, false);
+ deployMgr.loadProfile(getProfileKey());
}
@Override
protected void tearDown() throws Exception
{
DeploymentManager deployMgr = getDeploymentManager();
- String profileName = getProfileName();
- ProfileKey key = new ProfileKey(profileName);
- deployMgr.releaseProfile(key, true);
+ deployMgr.releaseProfile();
super.tearDown();
}
@@ -88,12 +76,6 @@
getLog().debug(eventInfo);
}
- @Override
- protected String getProfileName()
- {
- return "profileservice";
- }
-
@SuppressWarnings("deprecation")
protected void testDeployment(String name, String type, ManagedDeploymentTester tester) throws Exception
{
@@ -108,7 +90,7 @@
getLog().debug(contentURL);
DeploymentStatus status;
- DeploymentProgress progress = deployMgr.distribute(name, DeploymentPhase.APPLICATION, contentURL);
+ DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
progress.addProgressListener(this);
progress.run();
String[] uploadedNames = {};
@@ -124,7 +106,7 @@
uploadedNames = progress.getDeploymentID().getRepositoryNames();
getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
// Now start the deployment
- progress = deployMgr.start(DeploymentPhase.APPLICATION, uploadedNames);
+ progress = deployMgr.start(uploadedNames);
progress.addProgressListener(this);
progress.run();
try
@@ -135,7 +117,7 @@
assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
// Check for a
ManagementView mgtView = getManagementView();
- ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0], DeploymentPhase.APPLICATION);
+ ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
assertNotNull(deployment);
getLog().info("Found " + type + " deployment: " + deployment);
Set<String> types = deployment.getTypes();
@@ -151,7 +133,7 @@
//Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)
// Stop/remove the deployment
- progress = deployMgr.stop(DeploymentPhase.APPLICATION, uploadedNames);
+ progress = deployMgr.stop(uploadedNames);
progress.addProgressListener(this);
progress.run();
status = progress.getDeploymentStatus();
@@ -161,7 +143,7 @@
}
finally
{
- progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, uploadedNames);
+ progress = deployMgr.remove(uploadedNames);
progress.addProgressListener(this);
progress.run();
status = progress.getDeploymentStatus();
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -21,26 +21,25 @@
*/
package org.jboss.test.profileservice.test;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.deployers.spi.management.ManagementView;
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.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
* @author Scott.Stark at jboss.org
- * @version <tt>$Revision: $</tt>
+ * @version <tt>$Revision: $<
*/
public class JmsDestinationUnitTestCase extends AbstractProfileServiceTest
{
@@ -109,7 +108,7 @@
prop.setValue(propValues.get(propName));
log.debug("createComponentTest("+propName+") after: "+prop.getValue());
}
- managementView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, "testCreateQueue1", queue1Info);
+ managementView.applyTemplate("testCreateQueue1", queue1Info);
managementView.process();
// testCreateQueue2
@@ -132,11 +131,11 @@
prop.setValue(propValues.get(propName));
log.debug(propName+" after: "+prop.getValue());
}
- managementView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, "testCreateQueue2", queue2Info);
+ managementView.applyTemplate("testCreateQueue2", queue2Info);
managementView.process();
// Validate the components
- managementView.reloadProfile();
+ managementView.reload();
ManagedComponent queue1 = managementView.getComponent("testCreateQueue1", type);
assertNotNull(queue1);
assertEquals("testCreateQueue1", queue1.getName());
@@ -174,10 +173,4 @@
ManagedComponent topic = getManagementView().getComponent("testCreateTopic", type);
assertNull("topic should be removed " + topic, topic);
}
-
- @Override
- protected String getProfileName()
- {
- return "default";
- }
}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -34,9 +34,6 @@
*/
public class ManagementViewUnitTestCase extends AbstractProfileServiceTest
{
-
- /** The profile name */
- private static final String PROFILENAME = "profileservice";
public ManagementViewUnitTestCase(String name)
{
@@ -60,16 +57,9 @@
{
for(String deploymentName : deploymentNames)
{
- mgtView.getDeployment(deploymentName, null);
+ mgtView.getDeployment(deploymentName);
}
}
}
}
-
- @Override
- protected String getProfileName()
- {
- return PROFILENAME;
- }
-
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/PlatformMBeanUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -76,7 +76,7 @@
{
ManagementView mgtView = getManagementView();
//mgtView.reloadProfile();
- ManagedDeployment mbeans = mgtView.getDeployment("JDK PlatformMBeans", null);
+ ManagedDeployment mbeans = mgtView.getDeployment("JDK PlatformMBeans");
assertNotNull(mbeans);
log.debug("Root component names: "+mbeans.getComponents().keySet());
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -28,6 +28,7 @@
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 java.util.TreeSet;
@@ -40,6 +41,7 @@
import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.deployers.spi.management.KnownDeploymentTypes;
import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
@@ -48,7 +50,6 @@
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.api.RunState;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.jboss.managed.api.annotation.ViewUse;
import org.jboss.metatype.api.types.GenericMetaType;
@@ -70,10 +71,23 @@
/** Test of using ProfileService
@author Scott.Stark at jboss.org
- @version $Revision: 58115 $
+ @version $Revision$
*/
public class ProfileServiceUnitTestCase extends AbstractProfileServiceTest
{
+ /** The profileservice server name. */
+ public static final String PROFILESERVICE_SERVER_NAME = "profileservice";
+
+ private static final List<String> platformBeans = new ArrayList<String>();
+
+ static
+ {
+ platformBeans.add("JDK PlatformMBeans");
+ platformBeans.add("GarbageCollectorMXBeans");
+ platformBeans.add("MemoryManagerMXBeans");
+ platformBeans.add("MemoryPoolMXBeans");
+ }
+
/**
* We need to define the order in which tests runs
* @return
@@ -122,16 +136,19 @@
/**
* Basic test of accessing the ProfileService and checking the
* available profile keys.
+ *
+ * As we are running the -c profileservice, the default key should be profileservice.
+ *
*/
public void testProfileKeys()
throws Exception
{
InitialContext ctx = super.getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
- Collection<ProfileKey> keys = ps.getProfileKeys();
+ Collection<ProfileKey> keys = ps.getActiveProfileKeys();
log.info("getProfileKeys: "+keys);
- ProfileKey defaultKey = new ProfileKey("default");
- assertTrue("keys contains default", keys.contains(defaultKey));
+ ProfileKey defaultKey = new ProfileKey(PROFILESERVICE_SERVER_NAME);
+ assertTrue("keys contains profileservice", keys.contains(defaultKey));
}
/**
@@ -153,7 +170,7 @@
for (String name : names)
{
// Look for /server/profileservice/
- String serverName = "/server/" + getProfileName() + "/";
+ String serverName = "/server/"+ PROFILESERVICE_SERVER_NAME + "/";
int index = name.indexOf(serverName);
if (index == -1)
{
@@ -173,7 +190,7 @@
"conf/bootstrap/classloader.xml",
"conf/bootstrap/deployers.xml",
"conf/bootstrap/jmx.xml",
- "conf/bootstrap/profile-repository.xml",
+ "conf/bootstrap/profile.xml",
"conf/jboss-service.xml",
"deployers/jbossweb.deployer/",
"deployers/ear-deployer-jboss-beans.xml",
@@ -214,7 +231,7 @@
Set<String> names = mgtView.getDeploymentNames();
for(String name : names)
{
- ManagedDeployment deployment = mgtView.getDeployment(name, null);
+ ManagedDeployment deployment = mgtView.getDeployment(name);
log.info(deployment);
}
}
@@ -247,6 +264,9 @@
Set<String> names = mgtView.getDeploymentNames();
for(String name : names)
{
+ if(platformBeans.contains(name))
+ continue;
+
URL url = new URL(name);
URI uri = new URI(name);
VFS.getRoot(uri);
@@ -271,11 +291,11 @@
public void testNoSuchProfileException()
throws Exception
{
- ManagementView mgtView = getManagementView();
+ DeploymentManager deployMgr = getDeploymentManager();
ProfileKey badKey = new ProfileKey("no-such-profile");
try
{
- mgtView.loadProfile(badKey);
+ deployMgr.loadProfile(badKey);
fail("Did not see NoSuchProfileException");
}
catch(NoSuchProfileException e)
@@ -576,7 +596,6 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- mgtView.reloadProfile();
ComponentType type = new ComponentType("DataSource", "LocalTx");
ManagedComponent hsqldb = mgtView.getComponent("DefaultDS", type);
Map<String,ManagedProperty> props = hsqldb.getProperties();
@@ -662,7 +681,6 @@
{
String jndiName = "TestLocalTxDs";
Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
- propValues.put("track-connection-by-tx", SimpleValueSupport.wrap(Boolean.FALSE));
addNonXaDsProperties(propValues, jndiName, "jboss-local-jdbc.rar", "javax.sql.DataSource");
createComponentTest("LocalTxDataSourceTemplate", propValues, "testLocalTxDs",
KnownComponentTypes.DataSourceTypes.LocalTx.getType(), jndiName);
@@ -801,6 +819,7 @@
MetaValue metaValue = this.compositeValueMap(xaProps);
propValues.put("config-property", metaValue);
+ propValues.put("track-connection-by-tx", SimpleValueSupport.wrap(Boolean.TRUE));
// todo: how to set the specific domain?
//ApplicationManagedSecurityMetaData secDomain = new ApplicationManagedSecurityMetaData();
//props.get("security-domain").setValue(secDomain);
@@ -830,12 +849,6 @@
// Private and protected
- @Override
- protected String getProfileName()
- {
- return "profileservice";
- }
-
private void addNonXaDsProperties(Map<String, MetaValue> propValues,
String jndiName,
String rarName,
@@ -904,7 +917,7 @@
propValues.put("no-tx-separate-pools", SimpleValueSupport.wrap(Boolean.TRUE));
propValues.put("statistics-formatter", SimpleValueSupport.wrap("org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter"));
propValues.put("isSameRM-override-value", SimpleValueSupport.wrap(Boolean.FALSE));
- propValues.put("track-connection-by-tx", SimpleValueSupport.wrap(Boolean.FALSE));
+ propValues.put("track-connection-by-tx", SimpleValueSupport.wrap(Boolean.TRUE));
propValues.put("type-mapping", SimpleValueSupport.wrap("Hypersonic SQL"));
// todo: config-property
// todo: security-domain
@@ -932,10 +945,9 @@
prop.setValue(propValues.get(propName));
log.debug("template property after: "+prop.getName()+","+prop.getValue());
}
+
+ mgtView.applyTemplate(deploymentName, dsInfo);
- mgtView.applyTemplate(DeploymentPhase.APPLICATION, deploymentName, dsInfo);
- mgtView.process();
-
// reload the view
activeView = null;
mgtView = getManagementView();
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -38,7 +38,6 @@
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedParameter;
import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
/**
* <p>
@@ -47,7 +46,7 @@
*
* @author Scott.Stark at jboss.org
* @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- * @version $Revision:$
+ * @version $Revision$
*/
public class SecurityManagedObjectsTestCase extends AbstractProfileServiceTest
{
@@ -305,7 +304,8 @@
// validate the managed deployment.
ManagementView managementView = getManagementView();
- ManagedDeployment deployment = managementView.getDeployment(domainsDeployment, DeploymentPhase.APPLICATION);
+
+ ManagedDeployment deployment = managementView.getDeployment(domainsDeployment);
assertNotNull(deployment);
// verify the deployment contains the expected managed components.
assertEquals("Unexpected number of components", 2, deployment.getComponents().size());
@@ -389,17 +389,6 @@
assertNotNull(mc);
}
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.test.profileservice.test.AbstractProfileServiceTest#getProfileName()
- */
- @Override
- protected String getProfileName()
- {
- return "profileservice";
- }
-
/**
* <p>
* Deploy a resource, registering it with the profile service.
@@ -419,16 +408,28 @@
// distribute the resource deployment.
DeploymentManager manager = super.getDeploymentManager();
- DeploymentProgress progress = manager.distribute(resourceName, DeploymentPhase.APPLICATION, contentURL, true);
+ DeploymentProgress progress = manager.distribute(resourceName, contentURL, true);
progress.addProgressListener(this.listener);
progress.run();
+
+ assertDeployed(progress);
// start the deployment.
String[] uploadedNames = progress.getDeploymentID().getRepositoryNames();
- progress = manager.start(DeploymentPhase.APPLICATION, uploadedNames);
+ progress = manager.start(uploadedNames);
progress.addProgressListener(this.listener);
progress.run();
+
+ assertDeployed(progress);
}
+
+ private void assertDeployed(DeploymentProgress progress)
+ {
+ if(progress.getDeploymentStatus().isFailed())
+ {
+ fail("deployment failed: " + progress.getDeploymentStatus().getFailure());
+ }
+ }
/**
* <p>
@@ -443,12 +444,12 @@
{
// stop the resource deployment.
DeploymentManager manager = super.getDeploymentManager();
- DeploymentProgress progress = manager.stop(DeploymentPhase.APPLICATION, resourceName);
+ DeploymentProgress progress = manager.stop(resourceName);
progress.addProgressListener(this.listener);
progress.run();
// undeploy the resource.
- progress = manager.undeploy(DeploymentPhase.APPLICATION, resourceName);
+ progress = manager.remove(resourceName);
progress.addProgressListener(this.listener);
progress.run();
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -31,14 +31,12 @@
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.types.EnumMetaType;
import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.EnumValueSupport;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.profileservice.management.matchers.AliasMatcher;
-import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.test.JBossTestCase;
import org.jboss.virtual.VFS;
@@ -130,7 +128,7 @@
ManagedDeployment md = mc.getDeployment();
assertNotNull(md);
getLog().info(md);
- ManagedDeployment bootstrapMD = mgtView.getDeployment(md.getName(), DeploymentPhase.BOOTSTRAP);
+ ManagedDeployment bootstrapMD = mgtView.getDeployment(md.getName());
assertNotNull(bootstrapMD);
// Validate properties, [buildOS, buildID, config, buildNumber, startDate, buildDate, versionName, buildJVM, versionNumber, version]
@@ -220,15 +218,13 @@
{
if( activeView == null )
{
- String profileName = "profileservice";
InitialContext ctx = getInitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
activeView = ps.getViewManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- activeView.loadProfile(defaultKey);
// Init the VFS to setup the vfs* protocol handlers
VFS.init();
}
+ activeView.load();
return activeView;
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
___________________________________________________________________
Name: svn:keywords
- Id Revision
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServiceBindingManagedObjectsTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServiceBindingManagedObjectsTestCase.java 2009-03-06 15:19:16 UTC (rev 85525)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServiceBindingManagedObjectsTestCase.java 2009-03-06 15:21:50 UTC (rev 85526)
@@ -38,7 +38,7 @@
* </p>
*
* @author Brian Stansberry
- * @version $Revision:$
+ * @version $Revision$
*/
public class ServiceBindingManagedObjectsTestCase extends AbstractProfileServiceTest
{
@@ -259,15 +259,4 @@
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.test.profileservice.test.AbstractProfileServiceTest#getProfileName()
- */
- @Override
- protected String getProfileName()
- {
- return "profileservice";
- }
}
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/ServiceBindingManagedObjectsTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Property changes on: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/war/EchoServlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
More information about the jboss-cvs-commits
mailing list