[jboss-osgi-commits] JBoss-OSGI SVN: r87848 - in projects/jboss-osgi/trunk: bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer and 51 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Sun Apr 26 15:57:04 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-04-26 15:56:53 -0400 (Sun, 26 Apr 2009)
New Revision: 87848

Added:
   projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/
   projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
   projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/
   projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
   projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/ServiceActivator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/
   projects/jboss-osgi/trunk/runtime/microcontainer/.project
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.classpath
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.project
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.eclipse.jdt.core.prefs
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.maven.ide.eclipse.prefs
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/pom.xml
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/AbstractServiceAction.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/ActivateAction.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/BindAction.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/EnableAction.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/InstallAction.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContextActions.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiDeclarativeDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaData2ClassLoadingMetaDataDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeploymentVisitor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiServiceDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiStructure.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/SecurityActions.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractBundleEvent.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractDelegateListener.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractFrameworkEvent.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractServiceEvent.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleContextImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleEventAdapter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleListenerImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleState.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/EventAdapter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FilterImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkEventAdapter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkListenerImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/NumberUtil.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiKernelEventFilter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiUtils.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceEventAdapter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceFactoryProxy.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceListenerImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceReferenceImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/BundleEventEmitter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableEventEmitter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableExecutor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/SimpleExecutor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/ThreadPoolExecutor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryHelper.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryVisitor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeader.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilder.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilders.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaders.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleState.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleStateMapper.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ExportPackageHeaderBuilder.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ImportPackageHeaderBuilder.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractActivationPolicyMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeAware.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractDependencyMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractHolderMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractListenerMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractMetaDataVisitorNode.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractPackageAttribute.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractReferenceMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceDeployment.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMDValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/BooleanValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/CollectionValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/IntegerValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/OSGiParameters.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PathAttributeListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/QNameAttributeListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringListValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/URLValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreatorUtil.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionValueCreator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionComparator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToStringComparator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToVersionComparator.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/ServiceControllerContext.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ActivationPolicyMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeAware.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/DependencyMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/HolderMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ListenerMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/PackageAttribute.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/Parameter.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ReferenceMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceDeployment.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitorNode.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceValueMetaData.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRange.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/metadata/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/metadata/HeaderValue.jj
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/osgi-beans_1_0.xsd
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiAllTestSuite.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestDelegate.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/BundleTestSuite.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/deployers/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/BundleImplTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/FacadeTestSuite.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/AbstractBundleEntryTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryHelperTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryVisitorTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHeaderTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHelperTestSuite.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/AbstractManifestTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/HeaderValuesTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/MetaDataTestSuite.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/VersionRangeTestCase.java
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/support/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/bootstrap.xml
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bundle/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bundle/simple.jar
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/log4j.xml
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/deployers/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/deployers/AllManifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/IllegalManifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/JavaCCManifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/LocalizedManifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/Manifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/SimpleManifest.mf
   projects/jboss-osgi/trunk/runtime/microcontainer/pom.xml
Log:
Microcontainer Bundle - first cut

Added: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.microcontainer;
+
+//$Id$
+
+import org.jboss.kernel.Kernel;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerService
+{
+   /**
+    * Get the Microcontainer Kernel
+    */
+   Kernel getKernel();
+
+   /**
+    * Get a registered bean from the Kernel.
+    */
+   Object getRegisteredBean(String beanName);
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.microcontainer.internal;
+
+//$Id$
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.Kernel;
+import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An OSGi Service the gives access to the Kernel.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class MicrocontainerServiceImpl implements MicrocontainerService
+{
+   private BundleContext context;
+   private Kernel kernel;
+
+   public MicrocontainerServiceImpl(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+
+   public Object getRegisteredBean(String beanName)
+   {
+      if (kernel == null)
+         throw new IllegalArgumentException("Kernel cannot be null");
+
+      ControllerContext context = kernel.getController().getInstalledContext(beanName);
+      return context.getTarget();
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/ServiceActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/ServiceActivator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.microcontainer.internal;
+
+//$Id$
+
+import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A BundleActivator that registers the Microcontainer Service
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+   private ServiceRegistration registration;
+   
+   public void start(BundleContext context)
+   {
+      MicrocontainerServiceImpl mcService = new MicrocontainerServiceImpl(context);
+      registration = context.registerService(MicrocontainerService.class.getName(), mcService, null);
+   }
+
+   public void stop(BundleContext context)
+   {
+      if (registration != null)
+      {
+         registration.unregister();
+         registration = null;
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/ServiceActivator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/.project
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/.project	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/.project	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-osgi-microcontainer</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.classpath
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.classpath	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.classpath	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/javacc"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.classpath
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.project
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.project	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.project	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss-osgi-microcontainer-facade</name>
+	<comment>JBoss OSGi Integration</comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.project
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.eclipse.jdt.core.prefs	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,5 @@
+#Fri Sep 21 17:51:23 BST 2007
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/.settings/org.maven.ide.eclipse.prefs	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,9 @@
+#Fri Apr 03 11:35:09 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/pom.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/pom.xml	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,125 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <name>JBossOSGi - Runtime Microcontainer Facade</name>
+  <artifactId>jboss-osgi-runtime-microcontainer-facade</artifactId>
+  <packaging>jar</packaging>
+  
+  <parent>
+    <groupId>org.jboss.osgi</groupId>
+    <artifactId>jboss-osgi-runtime-microcontainer</artifactId>
+    <version>1.0.0.Beta2</version>
+  </parent>
+  
+  <!-- Properties -->
+  <properties>
+    <surefire.args>${surefire.args.root}</surefire.args>
+  </properties>
+
+  <dependencies>
+    <!-- Global dependencies -->
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.aop</groupId>
+      <artifactId>jboss-aop</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>apache-xerces</groupId>
+          <artifactId>xml-apis</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-container</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.microcontainer</groupId>
+          <artifactId>jboss-dependency</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-reflect</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-mdr</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-impl</artifactId>
+       <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+	    <groupId>org.codehaus.mojo</groupId>
+        <artifactId>javacc-maven-plugin</artifactId>
+        <version>2.1</version>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>javacc</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>  
+    </plugins>
+  </build>
+  
+</project>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/AbstractServiceAction.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/AbstractServiceAction.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/AbstractServiceAction.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+import org.jboss.dependency.plugins.action.SimpleControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+
+/**
+ * Abstract service controller context
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractServiceAction extends SimpleControllerContextAction<OSGiServiceReferenceContext>
+{
+
+   protected boolean validateContext(ControllerContext context)
+   {
+      return true;
+   }
+
+   protected OSGiServiceReferenceContext contextCast(ControllerContext context)
+   {
+      return OSGiServiceReferenceContext.class.cast(context);
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/AbstractServiceAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/ActivateAction.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/ActivateAction.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/ActivateAction.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ActivateAction extends AbstractServiceAction
+{
+   protected void installAction(OSGiServiceReferenceContext context) throws Throwable
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   protected void uninstallAction(OSGiServiceReferenceContext context)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/ActivateAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/BindAction.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/BindAction.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/BindAction.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BindAction extends AbstractServiceAction
+{
+   protected void installAction(OSGiServiceReferenceContext context) throws Throwable
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   protected void uninstallAction(OSGiServiceReferenceContext context)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+   
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/BindAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/EnableAction.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/EnableAction.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/EnableAction.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class EnableAction extends AbstractServiceAction
+{
+   protected void installAction(OSGiServiceReferenceContext context) throws Throwable
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   protected void uninstallAction(OSGiServiceReferenceContext context)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/EnableAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/InstallAction.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/InstallAction.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/InstallAction.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InstallAction extends AbstractServiceAction
+{
+   protected void installAction(OSGiServiceReferenceContext context) throws Throwable
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   protected void uninstallAction(OSGiServiceReferenceContext context)
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/InstallAction.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,197 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.osgi.spi.dependency.ServiceControllerContext;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitorNode;
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi service controller context
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiServiceReferenceContext extends AbstractControllerContext implements ServiceControllerContext
+{
+   /** The meta data */
+   private ServiceMetaData serviceMetaData;
+
+   /** The Bundle Context */
+   private BundleContext bundleContext;
+
+   public OSGiServiceReferenceContext(ServiceMetaData metaData, BundleContext bundleContext)
+   {
+      super(metaData.getId(), OSGiServiceReferenceContextActions.getInstance());
+      this.bundleContext = bundleContext;
+   }
+
+   public Object get(String name) throws Throwable
+   {
+      return null; // todo
+   }
+
+   public void set(String name, Object value) throws Throwable
+   {
+   }
+
+   public Object invoke(String name, Object parameters[], String[] signature) throws Throwable
+   {
+      return null; // todo
+   }
+
+   public ClassLoader getClassLoader() throws Throwable
+   {
+      return null; // todo get Bundle CL
+   }
+
+   public ServiceMetaData getServiceMetaData()
+   {
+      return serviceMetaData;
+   }
+
+   /**
+    * Set the serviceMetaData.
+    *
+    * @param serviceMetaData the serviceMetaData.
+    */
+   public void setServiceMetaData(ServiceMetaData serviceMetaData)
+   {
+      this.serviceMetaData = serviceMetaData;
+   }
+
+   public BundleContext getBundleContext()
+   {
+      return bundleContext;
+   }
+
+   /**
+    * Get the service proxy
+    *
+    * @return the service proxy
+    * @throws Exception for any error
+    */
+   public Object getServiceProxy() throws Exception
+   {
+      return null; // todo
+   }
+
+   public void setController(Controller controller)
+   {
+      super.setController(controller);
+      if (controller != null)
+      {
+         preprocessMetaData();
+      }
+   }
+
+   /**
+    * Preprocess the metadata for this context
+    */
+   protected void preprocessMetaData()
+   {
+      if (serviceMetaData == null)
+         return;
+      PreprocessMetaDataVisitor visitor = new PreprocessMetaDataVisitor();
+      AccessController.doPrivileged(visitor);
+   }
+
+   /**
+    * A visitor for the metadata that looks for dependencies.
+    */
+   protected class PreprocessMetaDataVisitor implements ServiceMetaDataVisitor, PrivilegedAction<Object>
+   {
+      /** The current context for when the dependencies are required */
+      private ControllerState contextState = ControllerState.INSTANTIATED;
+
+      /**
+       * Visit the bean metadata node, this is the starting point
+       */
+      public Object run()
+      {
+         serviceMetaData.visit(this);
+         return null;
+      }
+
+      /**
+       * Visit a node
+       *
+       * @param node the node
+       */
+      public void visit(ServiceMetaDataVisitorNode node)
+      {
+         boolean trace = log.isTraceEnabled();
+         if (trace)
+            log.trace("Visit node " + node);
+
+         // Visit the children of this node
+         Iterator<? extends ServiceMetaDataVisitorNode> children = node.getChildren();
+         if (children != null)
+         {
+            ControllerState restoreState = contextState;
+            while (children.hasNext())
+            {
+               ServiceMetaDataVisitorNode child = children.next();
+               try
+               {
+                  child.visit(this);
+               }
+               finally
+               {
+                  contextState = restoreState;
+               }
+            }
+         }
+      }
+
+      public ServiceControllerContext getControllerContext()
+      {
+         return OSGiServiceReferenceContext.this;
+      }
+
+      public ControllerState getContextState()
+      {
+         return contextState;
+      }
+
+      public void addDependency(DependencyItem dependency)
+      {
+         getDependencyInfo().addIDependOn(dependency);
+      }
+
+      public void setContextState(ControllerState contextState)
+      {
+         this.contextState = contextState;
+      }
+   }
+
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContextActions.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContextActions.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContextActions.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.dependency;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * OSGi service controller context actions
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiServiceReferenceContextActions extends AbstractControllerContextActions
+{
+   /* The single instance */
+   private static OSGiServiceReferenceContextActions instance;
+
+   public OSGiServiceReferenceContextActions(Map<ControllerState, ControllerContextAction> actions)
+   {
+      super(actions);
+   }
+
+   public static OSGiServiceReferenceContextActions getInstance()
+   {
+      if (instance == null)
+      {
+         Map<ControllerState, ControllerContextAction> actions = new HashMap<ControllerState, ControllerContextAction>();
+         actions.put(ControllerState.PRE_INSTALL, new EnableAction());        
+         actions.put(ControllerState.CONFIGURED, new BindAction());
+         actions.put(ControllerState.START, new ActivateAction());
+         actions.put(ControllerState.INSTALLED, new InstallAction());
+         instance = new OSGiServiceReferenceContextActions(actions);
+      }
+      return instance;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContextActions.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.osgi.plugins.facade.BundleContextImpl;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Create OSGi meta data from manifest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BundleActivatorDeployer extends AbstractRealDeployerWithInput<OSGiMetaData>
+{
+   private final KernelController controller;
+
+   public BundleActivatorDeployer(KernelController controller)
+   {
+      super(OSGiMetaData.class);
+      if (controller == null)
+         throw new IllegalArgumentException("Null controller");
+      this.controller = controller;
+      setDeploymentVisitor(new BundleActivatorDeploymentVisitor());
+   }
+
+   protected String createBundleActivatorBeanName(OSGiMetaData metaData)
+   {
+      return metaData.getBundleSymbolicName() + "Activator";
+   }
+
+   private class BundleActivatorDeploymentVisitor extends OSGiMetaDataDeploymentVisitor
+   {
+      public void deploy(DeploymentUnit unit, OSGiMetaData deployment) throws DeploymentException
+      {
+         String bundleActivator = deployment.getBundleActivator();
+         if (bundleActivator != null)
+         {
+            String name = createBundleActivatorBeanName(deployment);
+            // todo - get deployment context in non-depricated way
+            BundleContext bundleContext = new BundleContextImpl(unit);
+            BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(name, bundleActivator)
+                  .addStartParameter(BundleContext.class.getName(), bundleContext)
+                  .addStopParameter(BundleContext.class.getName(), bundleContext);
+            BeanMetaData beanMetaData = builder.getBeanMetaData();
+            try
+            {
+               controller.install(beanMetaData);
+            }
+            catch (Throwable throwable)
+            {
+               throw DeploymentException.rethrowAsDeploymentException("Unable to install BundleActivator.", throwable);
+            }
+         }
+      }
+
+      public void undeploy(DeploymentUnit unit, OSGiMetaData deployment)
+      {
+         String bundleActivator = deployment.getBundleActivator();
+         if (bundleActivator != null)
+         {
+            String name = createBundleActivatorBeanName(deployment);
+            controller.uninstall(name);
+         }
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiDeclarativeDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiDeclarativeDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiDeclarativeDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
+import org.jboss.osgi.spi.metadata.ServiceDeployment;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * OSGi declarative components deployer
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiDeclarativeDeployer extends SchemaResolverDeployer<ServiceDeployment>
+{
+   public OSGiDeclarativeDeployer()
+   {
+      super(ServiceDeployment.class);
+      setSuffix("-osgi.xml");
+   }
+
+   protected void init(DeploymentUnit unit, ServiceDeployment metaData, VirtualFile file) throws Exception
+   {
+      String name = file.toURI().toString();
+      metaData.setName(name);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiDeclarativeDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaData2ClassLoadingMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaData2ClassLoadingMetaDataDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaData2ClassLoadingMetaDataDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.version.VersionComparatorRegistry;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.plugins.version.OSGiVersionComparator;
+import org.jboss.osgi.plugins.version.OSGiVersionToStringComparator;
+import org.jboss.osgi.plugins.version.OSGiVersionToVersionComparator;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.jboss.reflect.spi.PackageInfo;
+import org.osgi.framework.Version;
+
+/**
+ * Create ClassLoading metadat from OSGi metadata.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiMetaData2ClassLoadingMetaDataDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
+{
+   public OSGiMetaData2ClassLoadingMetaDataDeployer()
+   {
+      super(OSGiMetaData.class);
+      setOutput(ClassLoadingMetaData.class);
+      setStage(DeploymentStages.DESCRIBE);
+   }
+
+   /**
+    * Add OSGi Version impl to VersionComparatorRegistry.
+    */
+   public void create()
+   {
+      VersionComparatorRegistry registry = VersionComparatorRegistry.getInstance();
+      registry.registerVersionComparator(Version.class, OSGiVersionComparator.INSTANCE);
+      registry.registerVersionComparator(Version.class, String.class, OSGiVersionToStringComparator.INSTANCE);
+      registry.registerVersionComparator(Version.class, org.jboss.classloading.spi.version.Version.class, OSGiVersionToVersionComparator.INSTANCE);
+   }
+
+   /**
+    * Remove OSGi Version impl from VersionComparatorRegistry.
+    */
+   public void destroy()
+   {
+      VersionComparatorRegistry registry = VersionComparatorRegistry.getInstance();
+      registry.removeVersionComparator(Version.class);
+      registry.removeVersionComparator(Version.class, String.class);
+      registry.removeVersionComparator(Version.class, org.jboss.classloading.spi.version.Version.class);      
+   }
+
+   public void deploy(DeploymentUnit unit, OSGiMetaData deployment) throws DeploymentException
+   {
+      ClassLoadingMetaData clmd = new ClassLoadingMetaData();
+      clmd.setName(unit.getSimpleName());
+      Version bundleVersion = deployment.getBundleVersion();
+      if (bundleVersion != null)
+         clmd.setVersion(bundleVersion);
+      clmd.setDomain(deployment.getHeader("Domain-Name"));
+      ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
+      List<PackageAttribute> exports = deployment.getExportPackages();
+      if (exports != null && exports.isEmpty() == false)
+      {
+         List<Capability> capabilities = new ArrayList<Capability>(exports.size());
+         for (PackageAttribute pa : exports)
+         {
+            PackageInfo pi = pa.getPackageInfo();
+            VersionRange vr = pa.getVersion();
+            capabilities.add(factory.createPackage(pi.getName(), vr.getFloor()));
+         }
+         clmd.setCapabilities(capabilities);
+      }
+      List<PackageAttribute> imports = deployment.getImportPackages();
+      if (imports != null && imports.isEmpty() == false)
+      {
+         List<Requirement> requirements = new ArrayList<Requirement>(imports.size());
+         for (PackageAttribute pa : imports)
+         {
+            PackageInfo pi = pa.getPackageInfo();
+            VersionRange vr = pa.getVersion();
+            org.jboss.classloading.spi.version.VersionRange versionRange = new org.jboss.classloading.spi.version.VersionRange(vr.getFloor(), vr.getCeiling());
+            requirements.add(factory.createRequirePackage(pi.getName(), versionRange));
+         }
+         clmd.setRequirements(requirements);
+      }
+      clmd.setImportAll(imports == null || imports.isEmpty());
+
+      // put to attacmhents
+      unit.addAttachment(ClassLoadingMetaData.class, clmd);
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaData2ClassLoadingMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
+import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+
+/**
+ * Create OSGi meta data from manifest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiMetaDataDeployer extends ManifestDeployer<OSGiMetaData>
+{
+   public OSGiMetaDataDeployer()
+   {
+      super(OSGiMetaData.class);
+   }
+
+   protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
+   {
+      return new AbstractOSGiMetaData(manifest);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeploymentVisitor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeploymentVisitor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeploymentVisitor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+
+/**
+ * OSGi meta data deployment visitor.
+ * Used with real OSGi deployer.
+ *
+ * @see BundleActivatorDeployer
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class OSGiMetaDataDeploymentVisitor implements DeploymentVisitor<OSGiMetaData>
+{
+   public Class<OSGiMetaData> getVisitorType()
+   {
+      return OSGiMetaData.class;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeploymentVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiServiceDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiServiceDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiServiceDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.osgi.plugins.dependency.OSGiServiceReferenceContext;
+import org.jboss.osgi.plugins.facade.BundleContextImpl;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Create OSGi meta data from manifest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiServiceDeployer extends AbstractSimpleRealDeployer<ServiceMetaData>
+{
+   /** The kernel controller */
+   private final KernelController controller;
+
+   public OSGiServiceDeployer(Kernel kernel)
+   {
+      super(ServiceMetaData.class);
+      if (kernel == null)
+         throw new IllegalArgumentException("Null kernel");
+      controller = kernel.getController();
+      setComponentsOnly(true);
+   }
+
+   public void deploy(DeploymentUnit unit, ServiceMetaData deployment) throws DeploymentException
+   {
+      // todo - get deployment context in non-depricated way
+      BundleContext bundleContext = new BundleContextImpl(unit);
+      ControllerContext context = new OSGiServiceReferenceContext(deployment, bundleContext);
+      try
+      {
+         controller.install(context);
+      }
+      catch (Throwable t)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + deployment.getId(), t);
+      }      
+   }
+
+   public void undeploy(DeploymentUnit unit, ServiceMetaData deployment)
+   {
+      controller.uninstall(deployment.getId());
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiServiceDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiStructure.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiStructure.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiStructure.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+
+/**
+ * OSGi structure deployer.
+ * Reads manifest for OSGi classpath.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiStructure extends AbstractVFSStructureDeployer
+{
+   public OSGiStructure()
+   {
+      /* one after jar */
+      setRelativeOrder(10001);
+   }
+
+   public boolean determineStructure(StructureContext context) throws DeploymentException
+   {
+      return false;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/OSGiStructure.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/SecurityActions.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/SecurityActions.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/SecurityActions.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SecurityActions
+{
+   /**
+    * Actions for File access
+    */
+   interface FileActions
+   {
+      FileActions PRIVILEGED = new FileActions()
+      {
+         public Boolean isLeaf(final VirtualFile f) throws IOException
+         {
+            try
+            {
+               return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>()
+               {
+                  public Boolean run() throws Exception
+                  {
+                     return f.isLeaf();
+                  }
+               });
+            }
+            catch(PrivilegedActionException e)
+            {
+               Exception ex = e.getException();
+               if( ex instanceof IOException )
+                  throw (IOException) ex;
+               else if( ex instanceof RuntimeException )
+                  throw (RuntimeException) ex;
+               else
+                  throw new UndeclaredThrowableException(ex);
+            }
+         }
+      };
+
+      FileActions NON_PRIVILEGED = new FileActions()
+      {
+         public Boolean isLeaf(VirtualFile f) throws IOException
+         {
+            return f.isLeaf();
+         }
+
+      };
+
+      public Boolean isLeaf(VirtualFile f) throws IOException;
+   }
+
+   static boolean isLeaf(VirtualFile f) throws IOException
+   {
+      SecurityManager sm = System.getSecurityManager();
+      if( sm != null )
+         return FileActions.PRIVILEGED.isLeaf(f);
+      else
+         return FileActions.NON_PRIVILEGED.isLeaf(f);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,103 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployers;
+
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.metadata.ServiceDeployment;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceDeploymentDeployer extends AbstractComponentDeployer<ServiceDeployment, ServiceMetaData>
+{
+   /**
+    * Create a new ServiceDeploymentDeployer.
+    */
+   public ServiceDeploymentDeployer()
+   {
+      setDeploymentVisitor(new ServiceDeploymentVisitor());
+      setComponentVisitor(new ServiceMetaDataVisitor());
+   }
+
+   protected static void addServiceComponent(DeploymentUnit unit, ServiceMetaData service)
+   {
+      DeploymentUnit component = unit.addComponent(service.getId());
+      component.addAttachment(ServiceMetaData.class.getName(), service);
+   }
+
+   protected static void removeServiceComponent(DeploymentUnit unit, ServiceMetaData service)
+   {
+      unit.removeComponent(service.getId());
+   }
+
+   /**
+    * ServiceDeploymentVisitor.
+    */
+   private static class ServiceDeploymentVisitor implements DeploymentVisitor<ServiceDeployment>
+   {
+      public Class<ServiceDeployment> getVisitorType()
+      {
+         return ServiceDeployment.class;
+      }
+
+      public void deploy(DeploymentUnit unit, ServiceDeployment deployment) throws DeploymentException
+      {
+         List<ServiceMetaData> services = deployment.getServices();
+         for (ServiceMetaData service : services)
+            addServiceComponent(unit, service);
+      }
+
+      public void undeploy(DeploymentUnit unit, ServiceDeployment deployment)
+      {
+         List<ServiceMetaData> services = deployment.getServices();
+         for (ServiceMetaData service : services)
+            removeServiceComponent(unit, service);
+      }
+   }
+
+   /**
+    * ServiceMetaDataVisitor.
+    */
+   private static class ServiceMetaDataVisitor implements DeploymentVisitor<ServiceMetaData>
+   {
+      public Class<ServiceMetaData> getVisitorType()
+      {
+         return ServiceMetaData.class;
+      }
+
+      public void deploy(DeploymentUnit unit, ServiceMetaData deployment) throws DeploymentException
+      {
+         addServiceComponent(unit, deployment);
+      }
+
+      public void undeploy(DeploymentUnit unit, ServiceMetaData deployment)
+      {
+         removeServiceComponent(unit, deployment);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.plugins.metadata.AbstractListenerMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.xml.sax.Attributes;
+
+/**
+ * Listener handler.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ListenerHandler extends DefaultElementHandler
+{
+   public static final ListenerHandler HANDLER = new ListenerHandler();
+
+   public Object startElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      return new AbstractListenerMetaData();
+   }
+
+   public void attributes(Object object, QName qName, ElementBinding eb, Attributes attrs, NamespaceContext ns)
+   {
+      AbstractListenerMetaData listenerMetaData = (AbstractListenerMetaData) object;
+      for (int i = 0; i < attrs.getLength(); ++i)
+      {
+         String localName = attrs.getLocalName(i);
+         String value = attrs.getValue(i);
+         if ("ref".equals(localName))
+            listenerMetaData.setRef(value);
+         else if ("bind-method".equals(localName))
+            listenerMetaData.setBindMethod(value);
+         else if ("unbind-method".equals(localName))
+            listenerMetaData.setUnbindMethod(value);
+      }
+   }
+
+   public Object endElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      AbstractListenerMetaData lmd = (AbstractListenerMetaData) object;
+      if (lmd.getRef() == null)
+         throw new IllegalArgumentException("Ref attribute must be set: " + this);
+      return lmd;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.plugins.metadata.AbstractListenerMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractReferenceMetaData;
+import org.jboss.osgi.spi.metadata.ListenerMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor;
+
+/**
+ * Listener interceptor.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ListenerInterceptor extends DefaultElementInterceptor
+{
+   public static final ListenerInterceptor INTERCEPTOR = new ListenerInterceptor();
+
+   public void add(Object parent, Object child, QName qName)
+   {
+      AbstractReferenceMetaData rmd = (AbstractReferenceMetaData) parent;
+      AbstractListenerMetaData lmd = (AbstractListenerMetaData) child;
+      List<ListenerMetaData> listeners = rmd.getListeners();
+      if (listeners == null) {
+         listeners = new ArrayList<ListenerMetaData>();
+         rmd.setListeners(listeners);
+      }
+      listeners.add(lmd);
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,87 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+
+/**
+ * OSGi schema.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiSchemaBinding
+{
+   /**
+    * The namespace
+    */
+   public static final String OSGI_DEPLOYER_NS = "urn:jboss:osgi-beans:1.0";
+
+   /**
+    * The service binding
+    */
+   public static final QName serviceTypeQName = new QName(OSGI_DEPLOYER_NS, "serviceType");
+
+   /**
+    * The service element name
+    */
+   public static final QName serviceQName = new QName(OSGI_DEPLOYER_NS, "service");
+
+   /**
+    * The reference binding
+    */
+   public static final QName referenceTypeQName = new QName(OSGI_DEPLOYER_NS, "referenceType");
+
+   /**
+    * The reference element name
+    */
+   public static final QName referenceQName = new QName(OSGI_DEPLOYER_NS, "reference");
+
+   /**
+    * The listener binding
+    */
+   public static final QName listenerTypeQName = new QName(OSGI_DEPLOYER_NS, "listenerType");
+
+   /**
+    * The listener element name
+    */
+   public static final QName listenerQName = new QName(OSGI_DEPLOYER_NS, "listener");
+
+   public static void init(SchemaBinding schemaBinding)
+   {
+      // service binding
+      TypeBinding serviceType = schemaBinding.getType(serviceTypeQName);
+      OSGiSchemaBindingHelper.initServiceHandler(serviceType);
+
+      // reference binding
+      TypeBinding referenceType = schemaBinding.getType(referenceTypeQName);
+      OSGiSchemaBindingHelper.initReferenceHandler(referenceType);
+
+      // listener binding
+      TypeBinding listenerType = schemaBinding.getType(listenerTypeQName);
+      OSGiSchemaBindingHelper.initListenerHandler(listenerType);
+
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+
+/**
+ * OSGi schema binding.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+// TODO - remove this --> move xml handling to jbossxb; JBOSGI-25
+public class OSGiSchemaBindingHelper
+{
+   public static void initServiceHandler(TypeBinding serviceType)
+   {
+      serviceType.setHandler(ServiceHandler.HANDLER);
+      // handle interfaces
+//      serviceType.pushInterceptor(BeanSchemaBinding20.setQName, ValueMetaDataElementInterceptor.VALUES);
+      // handle service-properties
+//      serviceType.pushInterceptor(BeanSchemaBinding20.mapQName, ValueMetaDataElementInterceptor.VALUES);
+   }
+
+   public static void initReferenceHandler(TypeBinding referenceType)
+   {
+      referenceType.setHandler(ReferenceHandler.HANDLER);
+      // handle properties
+//      referenceType.pushInterceptor(BeanSchemaBinding20.propertyQName, BeanPropertyInterceptor.INTERCEPTOR);
+      // handle listener
+      referenceType.pushInterceptor(OSGiSchemaBinding.listenerQName, ListenerInterceptor.INTERCEPTOR);
+   }
+
+   public static void initListenerHandler(TypeBinding listenerType)
+   {
+      listenerType.setHandler(ListenerHandler.HANDLER);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer;
+
+/**
+ * OSGi schema initializer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiSchemaInitializer implements SchemaBindingInitializer
+{
+   public SchemaBinding init(SchemaBinding schema)
+   {
+      OSGiSchemaBinding.init(schema);
+      return schema;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import java.util.Collections;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.osgi.plugins.metadata.AbstractDependencyMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractReferenceMetaData;
+import org.jboss.osgi.spi.metadata.DependencyMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.xml.sax.Attributes;
+
+/**
+ * Reference handler.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ReferenceHandler extends DefaultElementHandler
+{
+   public static final ReferenceHandler HANDLER = new ReferenceHandler();
+
+   public Object startElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      return new AbstractReferenceMetaData();
+   }
+
+   public void attributes(Object object, QName qName, ElementBinding eb, Attributes attrs, NamespaceContext ns)
+   {
+      AbstractReferenceMetaData referenceMetaData = (AbstractReferenceMetaData) object;
+      for (int i = 0; i < attrs.getLength(); ++i)
+      {
+         String localName = attrs.getLocalName(i);
+         String value = attrs.getValue(i);
+         if ("id".equals(localName))
+            referenceMetaData.setId(value);
+         else if ("interface".equals(localName))
+            referenceMetaData.setInterface(value);
+         else if ("filter".equals(localName))
+            referenceMetaData.setFilter(value);
+         else if ("cardinality".equals(localName))
+            referenceMetaData.setCardinality(Cardinality.toCardinality(value));
+         else if ("timeout".equals(localName))
+            referenceMetaData.setTimeout(Integer.valueOf(value));
+         else if ("depends-on".equals(localName))
+         {
+            DependencyMetaData dmd = new AbstractDependencyMetaData(value);
+            referenceMetaData.setDepends(Collections.singleton(dmd));
+         }
+         else if ("context-classloader".equals(localName))
+         {
+            ClassLoaderMetaData clmd = null; // todo
+            referenceMetaData.setClassLoaderMetaData(clmd);
+         }
+      }
+   }
+
+   public Object endElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      AbstractReferenceMetaData rmd = (AbstractReferenceMetaData) object;
+      if (rmd.getInterface() == null)
+         throw new IllegalArgumentException("Interface attribute must be set: " + this);
+      return rmd;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,86 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.deployment.xml;
+
+import java.util.Collections;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractDependencyMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractServiceMetaData;
+import org.jboss.osgi.spi.metadata.DependencyMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.xml.sax.Attributes;
+
+/**
+ * Service handler.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceHandler extends DefaultElementHandler
+{
+   public static final ServiceHandler HANDLER = new ServiceHandler();
+
+   public Object startElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      return new AbstractServiceMetaData();
+   }
+
+   public void attributes(Object object, QName qName, ElementBinding eb, Attributes attrs, NamespaceContext ns)
+   {
+      AbstractServiceMetaData serviceMetaData = (AbstractServiceMetaData) object;
+      for (int i = 0; i < attrs.getLength(); ++i)
+      {
+         String localName = attrs.getLocalName(i);
+         String value = attrs.getValue(i);
+         if ("id".equals(localName))
+            serviceMetaData.setId(value);
+         else if ("ref".equals(localName))
+            serviceMetaData.setRef(value);
+         else if ("interface".equals(localName))
+            serviceMetaData.setInterface(value);
+         else if ("lazy-init".equals(localName))
+            serviceMetaData.setLazyInit(Boolean.valueOf(value));
+         else if ("depends-on".equals(localName))
+         {
+            DependencyMetaData dmd = new AbstractDependencyMetaData(value);
+            serviceMetaData.setDepends(Collections.singleton(dmd));
+         }
+         else if ("context-classloader".equals(localName))
+         {
+            ClassLoaderMetaData clmd = null; // todo
+            serviceMetaData.setClassLoaderMetaData(clmd);
+         }
+      }
+   }
+
+   public Object endElement(Object object, QName qName, ElementBinding elementBinding)
+   {
+      AbstractServiceMetaData smd = (AbstractServiceMetaData) object;
+      if (smd.getInterface() != null && smd.getInterfaces() != null && smd.getInterfaces().isEmpty() == false)
+         throw new IllegalArgumentException("Cannot set both interface definitions: " + this);
+      return smd;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractBundleEvent.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractBundleEvent.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractBundleEvent.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.plugins.event.AbstractEvent;
+import org.osgi.framework.BundleEvent;
+
+/**
+ * BundleEvent implementation on top of KernelEvent.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractBundleEvent extends AbstractEvent implements BundleEventAdapter
+{
+   // todo - bundle event type, Bundle
+   public AbstractBundleEvent(Object source, String type, long sequence, long timestamp, Object context)
+   {
+      super(source, type, sequence, timestamp, context);
+   }
+
+   public BundleEvent getEvent()
+   {
+      int bundleType = 0;
+      return new BundleEvent(bundleType, null);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractBundleEvent.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractDelegateListener.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractDelegateListener.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractDelegateListener.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.spi.event.KernelEventListener;
+
+/**
+ * Delegate implementation on top of existing KernelEventListener.
+ *
+ * @param <T> Listener type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractDelegateListener<T> implements KernelEventListener
+{
+   protected T delegate;
+
+   public AbstractDelegateListener(T delegate)
+   {
+      if (delegate == null)
+         throw new IllegalArgumentException("Listener is null!");
+      this.delegate = delegate;
+   }
+
+   /**
+    * Common add / remove validate.
+    */
+   protected void validate()
+   {
+   }
+
+   /**
+    * Validate if we are allowed to add this listener
+    */
+   protected void addValidate()
+   {
+      validate();
+   }
+
+   /**
+    * Validate if we ar eallowed to remove this listener
+    */
+   protected void removeValidate()
+   {
+      validate();
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractDelegateListener.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractFrameworkEvent.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractFrameworkEvent.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractFrameworkEvent.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.plugins.event.AbstractEvent;
+import org.osgi.framework.FrameworkEvent;
+
+/**
+ * BundleEvent implementation on top of KernelEvent.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractFrameworkEvent extends AbstractEvent implements FrameworkEventAdapter
+{
+   // todo - framework event type, Bundle
+   public AbstractFrameworkEvent(Object source, String type, long sequence, long timestamp, Object context)
+   {
+      super(source, type, sequence, timestamp, context);
+   }
+
+   public FrameworkEvent getEvent()
+   {
+      int frameworkType = 0;
+      return new FrameworkEvent(frameworkType, null, null);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractFrameworkEvent.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractServiceEvent.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractServiceEvent.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractServiceEvent.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.plugins.event.AbstractEvent;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.osgi.framework.ServiceEvent;
+
+/**
+ * ServiceEvent implementation on top of KernelEvent.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at SuppressWarnings("deprecation")
+public class AbstractServiceEvent extends AbstractEvent implements ServiceEventAdapter
+{
+   // todo - ServiceReference
+   public AbstractServiceEvent(Object source, String type, long sequence, long timestamp, Object context)
+   {
+      super(source, type, sequence, timestamp, context);
+   }
+
+   public ServiceEvent getEvent()
+   {
+      int serviceType = 0;
+      if (KernelRegistry.KERNEL_REGISTRY_REGISTERED.equals(type))
+      {
+         serviceType = ServiceEvent.REGISTERED;
+      }
+      else if (KernelRegistry.KERNEL_REGISTRY_MODIFIED.equals(type))
+      {
+         serviceType = ServiceEvent.MODIFIED;
+      }
+      else if (KernelRegistry.KERNEL_REGISTRY_UNREGISTERED.equals(type))
+      {
+         serviceType = ServiceEvent.UNREGISTERING;
+      }
+      return new ServiceEvent(serviceType, null);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/AbstractServiceEvent.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleContextImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleContextImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,468 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Dictionary;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventEmitter;
+import org.jboss.kernel.spi.event.KernelEventFilter;
+import org.jboss.kernel.spi.event.KernelEventListener;
+import org.jboss.logging.Logger;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.util.id.GUID;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Bundle context implementation on top of existing DeploymentContext.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BundleContextImpl implements BundleContext, KernelEventEmitter
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(BundleContextImpl.class);
+   /** The service reference comparator */
+   private static Comparator<ServiceReference> serviceRefenceComparator = new ServiceReferenceComparator();
+
+   protected DeploymentUnit context;
+   protected Bundle bundle;
+   protected KernelController controller; // todo - get it
+   protected KernelEventEmitter emitterDelegate; // todo - get it
+   protected KernelConfigurator configurator; // todo - get it
+
+   protected Map<EventListener, AbstractDelegateListener<?>> listeners = Collections.synchronizedMap(new HashMap<EventListener, AbstractDelegateListener<?>>());
+   protected Map<ServiceListener, KernelEventFilter> filters = Collections.synchronizedMap(new HashMap<ServiceListener, KernelEventFilter>());
+
+   public BundleContextImpl(DeploymentUnit context)
+   {
+      this.context = context;
+   }
+
+   protected boolean isBundleContextValid()
+   {
+      return true;
+   }
+
+   protected void validateBundle() throws IllegalStateException
+   {
+      if (isBundleContextValid() == false)
+         throw new IllegalStateException("BundleContext is no longer valid.");
+   }
+
+   protected ClassLoader getClassLoader()
+   {
+      return null;
+   }
+
+   public void registerListener(KernelEventListener listener, KernelEventFilter filter, Object handback) throws Throwable
+   {
+      emitterDelegate.registerListener(listener, filter, handback);
+   }
+
+   public void unregisterListener(KernelEventListener listener, KernelEventFilter filter, Object handback) throws Throwable
+   {
+      emitterDelegate.unregisterListener(listener, filter, handback);
+   }
+
+   public void fireKernelEvent(KernelEvent event)
+   {
+      emitterDelegate.fireKernelEvent(event);
+   }
+
+   // --------------- OSGi framework -----------------------
+
+   public String getProperty(String string)
+   {
+      return null; // TODO
+   }
+
+   public Bundle getBundle()
+   {
+      if (bundle == null)
+      {
+         bundle = new BundleImpl(context);
+      }
+      return bundle;
+   }
+
+   public Bundle installBundle(String string) throws BundleException
+   {
+      throw new UnsupportedOperationException("not yet implemented");
+   }
+
+   public Bundle installBundle(String string, InputStream inputStream) throws BundleException
+   {
+      throw new UnsupportedOperationException("not yet implemented");
+   }
+
+   public Bundle getBundle(long id)
+   {
+      return null; // TODO
+   }
+
+   public Bundle[] getBundles()
+   {
+      return new Bundle[0]; // TODO
+   }
+
+   public void addServiceListener(ServiceListener serviceListener, String filter) throws InvalidSyntaxException
+   {
+      // todo - conditional add
+      validateBundle();
+      // remove the existing first
+      if (listeners.containsKey(serviceListener))
+      {
+         removeServiceListener(serviceListener);               
+      }
+      // create new one
+      ServiceListenerImpl listener = new ServiceListenerImpl(serviceListener);
+      listener.addValidate();
+      OSGiKernelEventFilter eventFilter = null;
+      if (filter != null)
+      {
+         eventFilter = new OSGiKernelEventFilter(filter);
+         filters.put(serviceListener, eventFilter);
+      }
+      try
+      {
+         registerListener(listener, eventFilter, this);
+         listeners.put(serviceListener, listener);
+      }
+      catch (Throwable throwable)
+      {
+         filters.remove(serviceListener);
+         // todo - throw what?
+         throw new IllegalArgumentException(throwable);
+      }
+   }
+
+   public void addServiceListener(ServiceListener serviceListener)
+   {
+      try
+      {
+         addServiceListener(serviceListener, null);
+      }
+      catch (InvalidSyntaxException ignored)
+      {
+      }
+   }
+
+   public void removeServiceListener(ServiceListener serviceListener)
+   {
+      validateBundle();
+      AbstractDelegateListener<?> listener = listeners.get(serviceListener);
+      if (listener != null)
+      {
+         listener.removeValidate();
+         KernelEventFilter filter = filters.get(serviceListener);
+         try
+         {
+            unregisterListener(listener, filter, this);
+         }
+         catch (Throwable t)
+         {
+            log.warn("Exception while unregistering Service listener.", t);
+         }
+         finally
+         {
+            listeners.remove(serviceListener);
+            if (filter != null)
+            {
+               filters.remove(serviceListener);
+            }
+         }
+      }
+   }
+
+   public void addBundleListener(BundleListener bundleListener)
+   {
+      validateBundle();
+      if (listeners.containsKey(bundleListener) == false)
+      {
+         BundleListenerImpl listener = new BundleListenerImpl(bundleListener);
+         listener.addValidate();
+         try
+         {
+            registerListener(listener, null, this);
+            listeners.put(bundleListener, listener);
+         }
+         catch (Throwable t)
+         {
+            throw new IllegalArgumentException(t);
+         }
+      }
+   }
+
+   public void removeBundleListener(BundleListener bundleListener)
+   {
+      validateBundle();
+      AbstractDelegateListener<?> listener = listeners.get(bundleListener);
+      if (listener != null)
+      {
+         listener.removeValidate();
+         try
+         {
+            unregisterListener(listener, null, this);
+         }
+         catch (Throwable t)
+         {
+            log.warn("Exception while unregistering Bundle listener.", t);
+         }
+         finally
+         {
+            listeners.remove(bundleListener);
+         }
+      }
+   }
+
+   public void addFrameworkListener(FrameworkListener frameworkListener)
+   {
+      validateBundle();
+      if (listeners.containsKey(frameworkListener) == false)
+      {
+         FrameworkListenerImpl listener = new FrameworkListenerImpl(frameworkListener);
+         listener.addValidate();
+         try
+         {
+            registerListener(listener, null, this);
+            listeners.put(frameworkListener, listener);
+         }
+         catch (Throwable t)
+         {
+            throw new IllegalArgumentException(t);
+         }
+      }
+   }
+
+   public void removeFrameworkListener(FrameworkListener frameworkListener)
+   {
+      validateBundle();
+      AbstractDelegateListener<?> listener = listeners.get(frameworkListener);
+      if (listener != null)
+      {
+         listener.removeValidate();
+         try
+         {
+            unregisterListener(listener, null, this);
+         }
+         catch (Throwable t)
+         {
+            log.warn("Exception while unregistering Framework listener.", t);
+         }
+         finally
+         {
+            listeners.remove(frameworkListener);
+         }
+      }
+   }
+
+   @SuppressWarnings({"unchecked", "deprecation"})
+   public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
+   {
+      validateBundle();
+      // todo - permissions
+      if (service == null)
+         throw new IllegalArgumentException("service is null!");
+      if (clazzes == null)
+         throw new Error("null clazzes parameter!"); // todo - what else?
+
+      ClassInfo serviceInfo;
+      ClassInfo[] infos = new ClassInfo[clazzes.length];
+      Class<?>[] interfaces = new Class[clazzes.length];
+      try
+      {
+         serviceInfo = configurator.getClassInfo(service.getClass());
+         for(int i=0; i < clazzes.length; i++)
+         {
+            infos[i] = configurator.getClassInfo(clazzes[i], getClassLoader());
+            interfaces[i] = infos[i].getType();
+         }
+      }
+      catch (Throwable t)
+      {
+         throw new InternalOSGiFacadeException(t);
+      }
+      // check types
+      boolean isServiceFactory = (service instanceof ServiceFactory);
+      if (isServiceFactory == false)
+      {
+         for (ClassInfo info : infos)
+         {
+            if (info.isAssignableFrom(serviceInfo) == false)
+               throw new IllegalArgumentException("service is not a ServiceFactory object and is not an instance of all the named classes in clazzes: " + info);
+         }
+      }
+      // handle properties
+      Map<String, Object> serviceMap = OSGiUtils.toMap(properties);
+      Long serviceId = NumberUtil.nextLong();
+      serviceMap.put(Constants.SERVICE_ID, serviceId);
+      serviceMap.put(Constants.OBJECTCLASS, clazzes);
+      if (isServiceFactory)
+      {
+         service = ServiceFactoryProxy.createProxy(service, interfaces);
+      }
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(GUID.asString(), serviceInfo.getName());
+      BeanMetaData metaData = builder.getBeanMetaData();
+      KernelControllerContext context;
+      try
+      {
+         context = controller.install(metaData, service);
+      }
+      catch (Throwable t)
+      {
+         throw new InternalOSGiFacadeException(t);
+      }
+      // todo - get underlying bundle --> ServiceReference
+      return new ServiceRegistrationImpl(this, context, serviceId, serviceMap);
+   }
+
+   @SuppressWarnings("unchecked")
+   public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
+   {
+      return registerService(new String[]{clazz}, service, properties);
+   }
+
+   public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+   {
+      validateBundle();
+      // todo - see spec API
+      return null;
+   }
+
+   public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+   {
+      ServiceReference[] references = getAllServiceReferences(clazz, filter);
+      if (references != null && references.length > 0)
+      {
+         List<ServiceReference> list = new ArrayList<ServiceReference>();
+         for(ServiceReference ref : references)
+         {
+            String[] clazzes = (String[])ref.getProperty(Constants.OBJECTCLASS);
+            for (String refClass : clazzes)
+            {
+               if (ref.isAssignableTo(getBundle(), refClass))
+               {
+                  list.add(ref);
+               }
+            }
+         }
+         Collections.sort(list, serviceRefenceComparator);
+         return list.toArray(new ServiceReference[list.size()]);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   public ServiceReference getServiceReference(String clazz)
+   {
+      validateBundle();
+      try
+      {
+         ServiceReference[] references = getServiceReferences(clazz, null);
+         if (references != null && references.length > 0)
+         {
+            // watch for the order in getServiceReferences
+            return references[0];
+         }
+         return null;
+      }
+      catch (InvalidSyntaxException e)
+      {
+         throw new InternalOSGiFacadeException("Should not be here, since filter was null!");
+      }
+   }
+
+   public Object getService(ServiceReference reference)
+   {
+      validateBundle();
+      return null;
+   }
+
+   public boolean ungetService(ServiceReference reference)
+   {
+      validateBundle();
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public File getDataFile(String filename)
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public Filter createFilter(String filter) throws InvalidSyntaxException
+   {
+      validateBundle();
+      // todo - create our own impl?
+      return FrameworkUtil.createFilter(filter);
+   }
+
+   /**
+    * @see org.osgi.framework.BundleContext#getServiceReferences(String, String)
+    */
+   private static class ServiceReferenceComparator implements Comparator<ServiceReference>
+   {
+      public int compare(ServiceReference sr1, ServiceReference sr2)
+      {
+         int rank1 = OSGiUtils.getServiceRanking(sr1);
+         int rank2 = OSGiUtils.getServiceRanking(sr2);
+         if (rank1 == rank2)
+         {
+            long id1 = OSGiUtils.getServiceId(sr1);
+            long id2 = OSGiUtils.getServiceId(sr2);
+            return (int)(id1 - id2);
+         }
+         return rank2 - rank1;
+      }
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleContextImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleEventAdapter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleEventAdapter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleEventAdapter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.osgi.framework.BundleEvent;
+
+/**
+ * BundleEvent contract.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface BundleEventAdapter extends EventAdapter<BundleEvent>
+{
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleEventAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,372 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.Permission;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Locale;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.helpers.BundleEntryHelper;
+import org.jboss.osgi.plugins.facade.helpers.BundleHeaders;
+import org.jboss.osgi.plugins.facade.helpers.DeploymentStage2BundleStateMapper;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Bundle implementation on top of existing DeploymentContext.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ */
+public class BundleImpl implements Bundle
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(BundleImpl.class);
+
+   protected DeploymentUnit unit;
+
+   protected BundleHeaders bundleHeaders;
+
+   private long lastModified = System.currentTimeMillis();
+
+   /**
+    * Create a new BundleImpl.
+    * 
+    * @param unit the DeploymentUnit
+    */
+   public BundleImpl(DeploymentUnit unit)
+   {
+      this.unit = unit;
+
+   }
+
+   /**
+    *   Get Bundle state based on the current DeployentStage
+    *   
+    *   @return the Bundle's state
+    */
+   public int getState()
+   {
+      try
+      {
+         return DeploymentStage2BundleStateMapper.mapBundleState(unit.getMainDeployer().getDeploymentStage(unit.getName())).getState();
+      }
+      catch (DeploymentException e)
+      {
+         log.error("Unable to get DeploymentStage for DeploymentUnit " + unit.getName(), e);
+         return Bundle.INSTALLED;
+      }
+   }
+
+   /**
+    * Start the Bundle
+    */
+   public void start() throws BundleException
+   {
+      checkPermission(AdminPermission.EXECUTE);
+      try
+      {
+         DeployerClient main = unit.getMainDeployer();
+         main.change(unit.getName(), DeploymentStages.INSTALLED);
+      }
+      catch (DeploymentException e)
+      {
+         throw new BundleException("Failed to start Bundle", e);
+      }
+   }
+
+   public void stop() throws BundleException
+   {
+      checkPermission(AdminPermission.EXECUTE);
+      try
+      {
+         DeployerClient main = unit.getMainDeployer();
+         main.change(unit.getName(), DeploymentStages.DESCRIBE);
+      }
+      catch (DeploymentException e)
+      {
+         throw new BundleException("Failed to stop Bundle", e);
+      }
+   }
+
+   public void update() throws BundleException
+   {
+      checkPermission(AdminPermission.LIFECYCLE);
+   }
+
+   public void update(InputStream inputStream) throws BundleException
+   {
+      checkPermission(AdminPermission.LIFECYCLE);
+   }
+
+   public void uninstall() throws BundleException
+   {
+      checkPermission(AdminPermission.LIFECYCLE);
+      try
+      {
+         DeployerClient main = unit.getMainDeployer();
+         main.change(unit.getName(), DeploymentStages.NOT_INSTALLED);
+      }
+      catch (DeploymentException e)
+      {
+         throw new BundleException("Failed to uninstall Bundle", e);
+      }
+   }
+
+   public long getBundleId()
+   {
+      checkPermission(AdminPermission.METADATA);
+      return unit.getName().hashCode();
+   }
+
+   public String getLocation()
+   {
+      checkPermission(AdminPermission.METADATA);
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         VFSDeploymentUnit vfsUnit = VFSDeploymentUnit.class.cast(unit);
+         VirtualFile file = vfsUnit.getRoot();
+         return file.getPathName();
+      }
+      return null;  // TODO What if the DeploymentUnit is not VFS
+   }
+
+   public ServiceReference[] getRegisteredServices()
+   {
+      return new ServiceReference[0];
+   }
+
+   public ServiceReference[] getServicesInUse()
+   {
+      return new ServiceReference[0];
+   }
+
+   public boolean hasPermission(Object permission)
+   {
+      if (permission instanceof Permission)
+      {
+         try
+         {
+            //  TODO check if bundle implies the permission
+         }
+         catch (SecurityException se)
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+
+   /**
+    * Get the Bundle's headers
+    * 
+    * @return the Bundle's headers
+    */
+   @SuppressWarnings("unchecked")
+   public Dictionary getHeaders()
+   {
+      return getHeaders(Locale.getDefault().toString());
+   }
+
+   @SuppressWarnings("unchecked")
+   public Dictionary getHeaders(String locale)
+   {
+      checkPermission(AdminPermission.METADATA);
+      if (bundleHeaders == null)
+      {
+         bundleHeaders = new BundleHeaders(unit);
+      }
+      return bundleHeaders.toDictionary();
+   }
+
+   /**
+    * Get the Bundle's symbolic name
+    * 
+    * @return the Bundle's symbolic name
+    */
+   public String getSymbolicName()
+   {
+      return (String) getControllerContext().getName();
+   }
+
+   /**
+    * Load class from Bundles classloader
+    * 
+    * @param name a class name
+    * @return the class
+    * @throws ClassNotFoundException If the class can not be loaded by DeploymentUnit ClassLoader
+    * @throws IllegalStateException If the DeploymentUnit classloader is not set
+    */
+   public Class<?> loadClass(String name) throws ClassNotFoundException
+   {
+      checkPermission(AdminPermission.CLASS);
+      checkForUninstalledDeploymentUnit();
+      return unit.getClassLoader().loadClass(name);
+
+   }
+
+   /**
+    * Get resource from Bundle classloader
+    * 
+    * @param name a resource name
+    * @return URL URL to resource
+    */
+   public URL getResource(String name)
+   {
+      checkPermission(AdminPermission.RESOURCE);
+      checkForUninstalledDeploymentUnit();
+      return unit.getClassLoader().getResource(name); // TODO Should it propagate the IllegalStateException or trap and return null?
+   }
+
+   /**
+    * Get resources from bundle classloader
+    * 
+    * @param name a resource name
+    * @return Enumeration of URLs to resources
+    */
+   public Enumeration getResources(String name) throws IOException
+   {
+      checkPermission(AdminPermission.RESOURCE);
+      checkForUninstalledDeploymentUnit();
+      return unit.getClassLoader().getResources(name); // TODO Should it propagate the IllegalStateException or trap and return null?
+   }
+
+   /**
+    *  Get paths to entries in Bundle for a given directory
+    *  
+    *  @param dirPath the dir path
+    *  @return Enumeration of URLs to entries in Bundle
+    */
+   public Enumeration getEntryPaths(String dirPath)
+   {
+      checkPermission(AdminPermission.RESOURCE);
+      return BundleEntryHelper.getEntryPaths(unit, dirPath);
+   }
+
+   /**
+    * Get an entry from the bundle
+    * 
+    * @param path path to entry
+    * @return URL to entry
+    */
+   public URL getEntry(String path)
+   {
+      checkPermission(AdminPermission.RESOURCE);
+      return BundleEntryHelper.getEntry(unit, path);
+   }
+
+   public long getLastModified()
+   {
+      return lastModified;
+   }
+
+   /**
+    * Search Bundle for entries 
+    * 
+    * @param path base path in Bundle
+    * @param filePattern pattern used to select files
+    * @param recurse should search recurse directories
+    * @return Enumeration of URLs to matched entries
+    */
+   public Enumeration findEntries(String path, String filePattern, boolean recurse)
+   {
+      checkPermission(AdminPermission.RESOURCE);
+      return BundleEntryHelper.findEntries(unit, path, filePattern, recurse);
+   }
+
+   /**
+    * Returns the ControllerContext for the DeploymentUnit
+    * 
+    * @return the ControllerContext
+    */
+   private ControllerContext getControllerContext()
+   {
+      return unit.getAttachment(ControllerContext.class.getName(), ControllerContext.class);
+   }
+
+   /** 
+    * Checks administrative permissions
+    * 
+    * @param adminPermission the permission to check
+    */
+   private void checkPermission(String adminPermission)
+   {
+      if (System.getSecurityManager() != null)
+      {
+         System.getSecurityManager().checkPermission(new AdminPermission(this, adminPermission));
+      }
+   }
+
+   /**
+    * Checks to see if the DeploymentUnit has been uninstalled.  
+    *
+    * @throws IllegalStateException If there is a problem determining the DeploymentUnitState
+    */
+   private void checkForUninstalledDeploymentUnit()
+   {
+      try
+      {
+         if (DeploymentStages.NOT_INSTALLED.equals(unit.getMainDeployer().getDeploymentStage(unit.getName())))
+         {
+            throw new IllegalStateException("Bundle has been uninstalled");
+         }
+      }
+      catch (DeploymentException e)
+      {
+         throw new IllegalStateException("Failed to determine current DeploymentStage for Deployment: "
+               + unit.getName(), e);
+      }
+   }
+
+   public BundleContext getBundleContext()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public void start(int options) throws BundleException
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void stop(int options) throws BundleException
+   {
+      // TODO Auto-generated method stub
+      
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleListenerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleListenerImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleListenerImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.SynchronousBundleListener;
+
+/**
+ * BundleListenerImpl implementation on top of KernelEventListener.
+ * Handles both SynchronousBundleListener and simple BundleListener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BundleListenerImpl extends AbstractDelegateListener<BundleListener>
+{
+   private boolean isSynchronous;
+
+   public BundleListenerImpl(BundleListener delegate)
+   {
+      super(delegate);
+      isSynchronous = (delegate instanceof SynchronousBundleListener);
+   }
+
+   /**
+    * Is the listener synchronous.
+    *
+    * @return synchhronous
+    */
+   public boolean isSynchronous()
+   {
+      return isSynchronous;
+   }
+
+   protected void validate()
+   {
+      if (isSynchronous())
+      {
+         // todo - check appropriate AdminPermission[context bundle,LISTENER]
+      }
+   }
+
+   // todo - synchrounous stuff
+   public void onEvent(KernelEvent event, Object handback)
+   {
+      if (event instanceof BundleEventAdapter)
+      {
+         BundleEventAdapter adapter = (BundleEventAdapter)event;
+         delegate.bundleChanged(adapter.getEvent());
+      }
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleListenerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleState.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleState.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleState.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A BundleState enum to wrap the non-type-safe Bundle state constants
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public enum BundleState {
+
+   UNINSTALLED(Bundle.UNINSTALLED),
+   INSTALLED(Bundle.INSTALLED),
+   RESOLVED(Bundle.RESOLVED),
+   STARTING(Bundle.STARTING),
+   STOPPING(Bundle.STOPPING),
+   ACTIVE(Bundle.ACTIVE);
+
+   private final int state;
+
+   /**
+    * 
+    * Create a new BundleState.
+    * 
+    * @param state the state number
+    */
+   private BundleState(final int state)
+   {
+      this.state = state;
+   }
+
+   /** 
+    * Get Bundle state
+    * 
+    * @return the state
+    */
+   public int getState()
+   {
+      return state;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/BundleState.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/EventAdapter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/EventAdapter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/EventAdapter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+/**
+ * Event adapter contract.
+ *
+ * @param <E> event type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface EventAdapter<E>
+{
+   E getEvent();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/EventAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FilterImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FilterImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FilterImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.util.Dictionary;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventFilter;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * OSGi Filter contract on top of KernelEventFilter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FilterImpl implements KernelEventFilter, Filter
+{
+   protected String filter;
+   protected OSGiKernelEventFilter eventFilter;
+
+   public FilterImpl(String filter) throws InvalidSyntaxException
+   {
+      this.filter = filter;
+      this.eventFilter = new OSGiKernelEventFilter(filter);
+   }
+
+   public boolean wantEvent(KernelEvent event, Object handback)
+   {
+      return eventFilter.wantEvent(event, handback);
+   }
+
+   public boolean match(ServiceReference serviceReference)
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   @SuppressWarnings("unchecked")
+   public boolean match(Dictionary dictionary)
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   @SuppressWarnings("unchecked")
+   public boolean matchCase(Dictionary dictionary)
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FilterImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkEventAdapter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkEventAdapter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkEventAdapter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.osgi.framework.FrameworkEvent;
+
+/**
+ * FrameworkEvent contract.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface FrameworkEventAdapter extends EventAdapter<FrameworkEvent>
+{
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkEventAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkListenerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkListenerImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkListenerImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.osgi.framework.FrameworkListener;
+
+/**
+ * FrameworkListener implementation on top of existing KernelEventListener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FrameworkListenerImpl extends AbstractDelegateListener<FrameworkListener>
+{
+   public FrameworkListenerImpl(FrameworkListener delegate)
+   {
+      super(delegate);
+   }
+
+   public void onEvent(KernelEvent event, Object handback)
+   {
+      if (event instanceof FrameworkEventAdapter)
+      {
+         FrameworkEventAdapter adapter = (FrameworkEventAdapter)event;
+         delegate.frameworkEvent(adapter.getEvent());         
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/FrameworkListenerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+/**
+ * Signaling internal exception - container, dependency, kernel related.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InternalOSGiFacadeException extends RuntimeException
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 9213483035127929387L;
+
+   public InternalOSGiFacadeException()
+   {
+      super();
+   }
+
+   public InternalOSGiFacadeException(String message)
+   {
+      super(message);
+   }
+
+   public InternalOSGiFacadeException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   public InternalOSGiFacadeException(Throwable cause)
+   {
+      super(cause);
+   }
+   
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/NumberUtil.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/NumberUtil.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/NumberUtil.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Unique numbering util.
+ * todo - should we do this more generic?
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NumberUtil
+{
+   private static AtomicLong longOrder = new AtomicLong(Long.MIN_VALUE);
+
+   private NumberUtil()
+   {
+   }
+
+   /**
+    * Return next long.
+    *
+    * @return unique Long number
+    */
+   public static Long nextLong()
+   {
+      return longOrder.getAndIncrement();        
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/NumberUtil.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiKernelEventFilter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiKernelEventFilter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiKernelEventFilter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventFilter;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * OSGi Filter contract on top of KernelEventFilter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiKernelEventFilter implements KernelEventFilter
+{
+   protected String filter;
+
+   public OSGiKernelEventFilter(String filter) throws InvalidSyntaxException
+   {
+      this.filter = filter;
+      validateFilterString();
+   }
+
+   protected void validateFilterString()
+   {
+      // todo
+   }
+
+   public boolean wantEvent(KernelEvent event, Object handback)
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiKernelEventFilter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiUtils.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiUtils.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiUtils.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,99 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Helpful methods for handling specific OSGi cases.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class OSGiUtils
+{
+   /**
+    * Transform from Dictionary to Map
+    *
+    * @param dictionary dictionary to transform
+    * @return Map<String, Object>
+    */
+   @SuppressWarnings("unchecked")
+   public static Map<String, Object> toMap(Dictionary dictionary)
+   {
+      Map<String, Object> map = new HashMap<String, Object>();
+      if (dictionary != null && dictionary.size() > 0)
+      {
+         Enumeration keys = dictionary.keys();
+         while(keys.hasMoreElements())
+         {
+            String key = keys.nextElement().toString();
+            Object value = dictionary.get(key);
+            map.put(key, value);
+         }
+      }
+      return map;
+   }
+
+   /**
+    * Get ServiceReference id.
+    *
+    * @param reference service reference to look for id
+    * @return reference's id or error if no such property
+    */
+   public static Long getServiceId(ServiceReference reference)
+   {
+      Object value = reference.getProperty(Constants.SERVICE_RANKING);
+      if (value == null || value instanceof Long == false)
+      {
+         throw new IllegalArgumentException("No such property: " + Constants.SERVICE_ID);
+      }
+      else
+      {
+         return (Long)value;
+      }
+   }
+
+   /**
+    * Get ServiceReference ranking.
+    *
+    * @param reference service reference to look for ranking
+    * @return reference's ranking or 0 if no such property
+    */
+   public static Integer getServiceRanking(ServiceReference reference)
+   {
+      Object value = reference.getProperty(Constants.SERVICE_RANKING);
+      if (value == null || value instanceof Integer == false)
+      {
+         return 0;
+      }
+      else
+      {
+         return (Integer)value;
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/OSGiUtils.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceEventAdapter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceEventAdapter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceEventAdapter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.osgi.framework.ServiceEvent;
+
+/**
+ * ServiceEvent contract.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceEventAdapter extends EventAdapter<ServiceEvent>
+{
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceEventAdapter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceFactoryProxy.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceFactoryProxy.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceFactoryProxy.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,124 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
+
+import org.osgi.framework.ServiceFactory;
+
+/**
+ * An implementation of InvocationHandler used to proxy of the ServiceFactory
+ * interface for OSGi services.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceFactoryProxy implements InvocationHandler
+{
+   public static final String GET_SERVICE = "getService";
+   public static final String UNGET_SERVICE = "ungetService";
+
+/*
+   private static final Logger log = Logger.getLogger(ServiceFactoryProxy.class);
+
+   public static Method GET_SERVICE_METHOD;
+   static
+   {
+      try
+      {
+         GET_SERVICE_METHOD = ServiceFactory.class.getMethod(GET_SERVICE, Bundle.class, ServiceRegistration.class);
+      }
+      catch (NoSuchMethodException e)
+      {
+         log.error("Unable to prepare getService method.", e);        
+      }
+   }
+*/
+   protected Object serviceFactory;
+   protected Class<?>[] interfaces;
+   protected Object service;
+   protected Boolean checked;
+
+   private ServiceFactoryProxy(Object serviceFactory, Class<?>[] interfaces)
+   {
+      this.serviceFactory = serviceFactory;
+      this.interfaces = interfaces;
+   }
+
+   public static Object createProxy(Object serviceFactory, Class<?>[] interfaces)
+   {
+      int lenght = interfaces.length;
+      Class<?>[] allIntefaces = new Class[lenght + 1];
+      System.arraycopy(interfaces, 0, allIntefaces, 0, lenght);
+      allIntefaces[lenght] = ServiceFactory.class;
+      InvocationHandler handler = new ServiceFactoryProxy(serviceFactory, interfaces);
+      return Proxy.newProxyInstance(ServiceFactory.class.getClassLoader(), allIntefaces, handler);
+   }
+
+   protected boolean checkInterfaces()
+   {
+      // already checked
+      if (checked != null)
+         return checked;
+      // can be null
+      if (service == null)
+         return true;
+
+      Class<?> serviceInterface = service.getClass();
+      for(Class<?> exposedInterface : interfaces)
+      {
+         if (exposedInterface.isAssignableFrom(serviceInterface) == false)
+         {
+            return (checked = false);
+         }
+      }
+      return (checked = true);
+   }
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String methodName = method.getName();
+      if (GET_SERVICE.equals(methodName))
+      {
+         service = method.invoke(serviceFactory, args);
+         if (checkInterfaces() == false)
+            return null;
+         return service;
+      }
+      else if (UNGET_SERVICE.equals(methodName))
+      {
+         service = null;
+         checked = null;
+         return method.invoke(serviceFactory, args);
+      }
+      else
+      {
+         if (service == null)
+            throw new IllegalStateException("Service not yet created from ServiceFactory!"); // todo - or create it now?
+         if (checkInterfaces() == false)
+            throw new IllegalArgumentException("Illegal exposed interfaces: " + service + "; " + Arrays.asList(interfaces));
+         return method.invoke(service, args);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceFactoryProxy.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceListenerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceListenerImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceListenerImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.osgi.framework.AllServiceListener;
+import org.osgi.framework.ServiceListener;
+
+/**
+ * ServiceListenerImpl implementation on top of existing KernelEventListener.
+ * Handles both AllServiceListener and simple ServiceListener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceListenerImpl extends AbstractDelegateListener<ServiceListener>
+{
+   private boolean isAll;
+
+   public ServiceListenerImpl(ServiceListener delegate)
+   {
+      super(delegate);
+      isAll = (delegate instanceof AllServiceListener);
+   }
+
+   /**
+    * Is AllServiceListener.
+    *
+    * @return is all service listener
+    */
+   public boolean isAll()
+   {
+      return isAll;
+   }
+
+   public void onEvent(KernelEvent event, Object handback)
+   {
+      // todo - all stuff, permissions
+      if (event instanceof ServiceEventAdapter)
+      {
+         ServiceEventAdapter adapter = (ServiceEventAdapter)event;
+         delegate.serviceChanged(adapter.getEvent());
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceListenerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceReferenceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceReferenceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceReferenceImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * ServiceReference implementation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ServiceReferenceImpl implements ServiceReference
+{
+   public Object getProperty(String string)
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public String[] getPropertyKeys()
+   {
+      return new String[0];  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public Bundle getBundle()
+   {
+      return null;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public Bundle[] getUsingBundles()
+   {
+      return new Bundle[0];  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public boolean isAssignableTo(Bundle bundle, String string)
+   {
+      return false;  //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public int compareTo(Object reference)
+   {
+      // TODO Auto-generated method stub
+      return 0;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceReferenceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,112 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventEmitter;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * ServiceRegistration implementation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at SuppressWarnings("deprecation")
+public class ServiceRegistrationImpl implements ServiceRegistration
+{
+   protected KernelEventEmitter emitter;
+   protected KernelControllerContext context;
+   protected Long serviceId;
+   protected Map<String, Object> properties;
+
+   protected boolean isRegistered;
+
+   public ServiceRegistrationImpl(KernelEventEmitter emitter, KernelControllerContext context, Long serviceId, Map<String, Object> properties)
+   {
+      this.emitter = emitter;
+      this.context = context;
+      this.serviceId = serviceId;
+      this.properties = properties;
+      init();
+   }
+   protected void init()
+   {
+      KernelEvent event = new AbstractServiceEvent(this, org.jboss.kernel.spi.registry.KernelRegistry.KERNEL_REGISTRY_REGISTERED, serviceId, System.currentTimeMillis(), emitter);
+      emitter.fireKernelEvent(event);
+   }
+
+   protected void validateServiceRegistration()
+   {
+      if (isServiceRegistered() == false)
+         throw new IllegalStateException("ServiceRegistration object has already been unregistered.");
+   }
+
+   protected boolean isServiceRegistered()
+   {
+      return isRegistered;
+   }
+
+   public ServiceReference getReference()
+   {
+      return null; // TODO
+   }
+
+   @SuppressWarnings("unchecked")
+   public void setProperties(Dictionary properties)
+   {
+      validateServiceRegistration();
+      if (properties != null && properties.size() > 0)
+      {
+         Set<String> names = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+         Enumeration keys = properties.keys();
+         for(String key = (String)keys.nextElement(); keys.hasMoreElements();)
+         {
+            if (names.add(key) == false)
+               throw new IllegalArgumentException("properties contains case variants of the same key name.");
+
+            if (Constants.OBJECTCLASS.equals(key) == false && Constants.SERVICE_ID.equals(key) == false)
+            {
+               this.properties.put(key, properties.get(key));
+            }
+         }
+         KernelEvent event = new AbstractServiceEvent(this, org.jboss.kernel.spi.registry.KernelRegistry.KERNEL_REGISTRY_MODIFIED, serviceId, System.currentTimeMillis(), emitter);
+         emitter.fireKernelEvent(event);
+      }
+   }
+
+   public void unregister()
+   {
+      validateServiceRegistration();
+      isRegistered = false;
+      KernelEvent event = new AbstractServiceEvent(this, org.jboss.kernel.spi.registry.KernelRegistry.KERNEL_REGISTRY_UNREGISTERED, serviceId, System.currentTimeMillis(), emitter);
+      emitter.fireKernelEvent(event);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/BundleEventEmitter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/BundleEventEmitter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/BundleEventEmitter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.asynch;
+
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventListener;
+import org.jboss.osgi.plugins.facade.BundleListenerImpl;
+
+/**
+ * Bundle event emitter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BundleEventEmitter extends RunnableEventEmitter
+{
+   public BundleEventEmitter(RunnableExecutor executor)
+   {
+      super(executor);
+   }
+
+   public BundleEventEmitter(RunnableExecutor executor, long startTimeout, long completeTimeout)
+   {
+      super(executor, startTimeout, completeTimeout);
+   }
+
+   protected boolean useExecutor(KernelEventListener listener, KernelEvent event, Object handback)
+   {
+      if (listener instanceof BundleListenerImpl)
+      {
+         BundleListenerImpl bli = (BundleListenerImpl)listener;
+         return bli.isSynchronous() == false;
+      }
+      return false;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/BundleEventEmitter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableEventEmitter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableEventEmitter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableEventEmitter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.asynch;
+
+import org.jboss.kernel.plugins.event.AbstractEventEmitter;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.event.KernelEventListener;
+
+/**
+ * Runnable wrapper event emitter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RunnableEventEmitter extends AbstractEventEmitter
+{
+   protected RunnableExecutor executor;
+   protected long startTimeout;
+   protected long completeTimeout;
+
+   /**
+    * Create new RunnableExecutor with value zero as defaults.
+    *
+    * @param executor the executor
+    */
+   public RunnableEventEmitter(RunnableExecutor executor)
+   {
+      this(executor, 0, 0);
+   }
+
+   /**
+    * Create new RunnableExecutor with default limits.
+    *
+    * @param executor the runnable executor
+    * @param startTimeout default start limit
+    * @param completeTimeout default completion limit
+    */
+   public RunnableEventEmitter(RunnableExecutor executor, long startTimeout, long completeTimeout)
+   {
+      if (executor == null)
+         throw new IllegalArgumentException("Null executor");
+      this.executor = executor;
+      this.startTimeout = startTimeout;
+      this.completeTimeout = completeTimeout;
+   }
+
+   /**
+    * Should we use runnable executor to execute listener call.
+    *
+    * @param listener the listener
+    * @param event the event
+    * @param handback the handback
+    * @return true if we should use runnable, false to use default listener execution
+    */
+   protected boolean useExecutor(KernelEventListener listener, KernelEvent event, Object handback)
+   {
+      return true;
+   }
+
+   protected void fireKernelEvent(KernelEventListener listener, KernelEvent event, Object handback)
+   {
+      if (useExecutor(listener, event, handback))
+      {
+         executor.run(new RunnableWrapper(listener, event, handback), startTimeout, completeTimeout);
+      }
+      else
+      {
+         super.fireKernelEvent(listener, event, handback);
+      }
+   }
+
+   private class RunnableWrapper implements Runnable
+   {
+      private KernelEventListener listener;
+      private KernelEvent event;
+      private Object handback;
+
+      public RunnableWrapper(KernelEventListener listener, KernelEvent event, Object handback)
+      {
+         this.listener = listener;
+         this.event = event;
+         this.handback = handback;
+      }
+
+      public void run()
+      {
+         listener.onEvent(event, handback);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableEventEmitter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableExecutor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableExecutor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableExecutor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.asynch;
+
+/**
+ * Runnable executor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface RunnableExecutor
+{
+   /**
+    * Run a runnable
+    *
+    * @param runnable the runnable
+    * @throws IllegalArgumentException for a null runnable
+    */
+   void run(Runnable runnable);
+
+   /**
+    * Run runnable within limits.
+    *
+    * @param runnable the runnable
+    * @param startTimeout start limit
+    * @param completeTimeout completion limit
+    * @throws IllegalArgumentException for a null runnable
+    */
+   void run(Runnable runnable, long startTimeout, long completeTimeout);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/RunnableExecutor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/SimpleExecutor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/SimpleExecutor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/SimpleExecutor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.asynch;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Simple executor.
+ * Creates new Thread for every execution.
+ * No support for limits.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleExecutor implements RunnableExecutor
+{
+   protected static Logger staticLog = Logger.getLogger(SimpleExecutor.class);
+
+   public void run(Runnable runnable)
+   {
+      new Thread(runnable).start();
+   }
+
+   public void run(Runnable runnable, long startTimeout, long completeTimeout)
+   {
+      if (startTimeout > 0 || completeTimeout > 0)
+         staticLog.warn("No support for limited execution: " + startTimeout + " / " + completeTimeout);
+      run(runnable);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/SimpleExecutor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/ThreadPoolExecutor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/ThreadPoolExecutor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/ThreadPoolExecutor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.asynch;
+
+import org.jboss.util.threadpool.ThreadPool;
+
+/**
+ * JBoss ThreadPool impl RunnableExecutor.
+ * It takes ThreadPool from jboss-common as actual executor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ThreadPoolExecutor implements RunnableExecutor
+{
+   protected ThreadPool threadPool;
+
+   public ThreadPoolExecutor(ThreadPool threadPool)
+   {
+      if (threadPool == null)
+         throw new IllegalArgumentException("Null thread pool");
+      this.threadPool = threadPool;
+   }
+
+   public void run(Runnable runnable)
+   {
+      threadPool.run(runnable);
+   }
+
+   public void run(Runnable runnable, long startTimeout, long completeTimeout)
+   {
+      threadPool.run(runnable, startTimeout, completeTimeout);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/asynch/ThreadPoolExecutor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryHelper.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryHelper.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryHelper.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A BundleEntryHelper - Helper used to retrieve Bundle Entries from a VirtualFile 
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleEntryHelper
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(BundleEntryHelper.class);
+
+   /**
+    *  Get paths to entries in DeploymentUnit for a given directory
+    *  
+    *  @param unit the deployment unit
+    *  @param dirPath the directory path
+    *  @return Enumeration of URLs to entries in Bundle
+    */
+   public static Enumeration<String> getEntryPaths(DeploymentUnit unit, String dirPath)
+   {
+      VirtualFile file = getVirtualFile(unit, dirPath);
+      if (file != null)
+      {
+         List<String> entryPaths = new ArrayList<String>();
+         try
+         {
+            for (VirtualFile entry : file.getChildren())
+            {
+               entryPaths.add(entry.getPathName());
+            }
+            if (entryPaths.isEmpty() == false)
+            {
+               return Collections.enumeration(entryPaths);
+            }
+         }
+         catch (IOException e)
+         {
+            if (log.isTraceEnabled())
+            {
+               log.trace("Error getting entry paths", e);
+            }
+         }
+      }
+      return null;
+   }
+
+   /**
+    * Get an entry from the DeploymentUnit
+    * 
+    * @param unit the deployment unit
+    * @param path path to entry
+    * @return URL to entry
+    */
+   public static URL getEntry(DeploymentUnit unit, String path)
+   {
+      try
+      {
+         VirtualFile file = getVirtualFile(unit, path);
+         return file != null ? file.toURL() : null;
+      }
+      catch (Exception e)
+      {
+         if (log.isTraceEnabled())
+         {
+            log.trace("Error getting entry", e);
+         }
+      }
+      return null;
+   }
+
+   /**
+    * Search DeploymentUnit for entries 
+    * 
+    * @param unit the deployment unit
+    * @param path base path in Bundle
+    * @param filePattern pattern used to select files
+    * @param recurse should search recurse directories
+    * @return Enumeration of URLs to matched entries
+    */
+   public static Enumeration<URL> findEntries(DeploymentUnit unit, String path, String filePattern, boolean recurse)
+   {
+      VirtualFile file = getVirtualFile(unit, path);
+      if (file != null)
+      {
+         BundleEntryVisitor bundleEntryVisitor = new BundleEntryVisitor(filePattern, recurse);
+         try
+         {
+            file.visit(bundleEntryVisitor);
+            List<URL> entries = bundleEntryVisitor.getEntries();
+            if (entries.isEmpty() == false)
+            {
+               return Collections.enumeration(entries);
+            }
+            // TODO Consider finding entries from attached fragments (modules?).
+         }
+         catch (IOException e)
+         {
+            if(log.isTraceEnabled())
+            {            
+               log.trace("Error finding entries", e);
+            }
+         }
+      }
+      return null;
+   }
+
+   /**
+    * Get the root VirtualFile from the DeploymentUnit
+    * 
+    * @param unit the deployment unit
+    * @param filePath the file path
+    * @return root VirtualFile from DeploymentUnit
+    */
+   private static VirtualFile getVirtualFile(DeploymentUnit unit, String filePath)
+   {
+      VirtualFile returnFile = null;
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         VFSDeploymentUnit vfsUnit = VFSDeploymentUnit.class.cast(unit);
+         returnFile = vfsUnit.getFile(filePath);
+      }
+      return returnFile;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryHelper.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryVisitor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryVisitor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryVisitor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,126 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.facade.BundleImpl;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * A BundleEntryVisitor - VirtualFile visitor used to find Bundle entries matching a file pattern
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleEntryVisitor implements VirtualFileVisitor
+{
+   private final boolean recurse;
+
+   private final Pattern filePattern;
+
+   private List<URL> entries = new ArrayList<URL>();
+
+   /** The log */
+   private static final Logger log = Logger.getLogger(BundleImpl.class);
+
+   /**
+    * Create a new BundleEntryVisitor.
+    * 
+    * @param filePattern The file pattern
+    * @param recurse Should recurse
+    */
+   public BundleEntryVisitor(String filePattern, boolean recurse)
+   {
+      this.filePattern = convertToPattern(filePattern);
+      this.recurse = recurse;
+   }
+
+   /**
+    * Get attributes used to define visitor behavior 
+    * 
+    * @return visitor attributes
+    */
+   public VisitorAttributes getAttributes()
+   {
+      if (recurse)
+      {
+         return VisitorAttributes.RECURSE_LEAVES_ONLY;
+      }
+      else
+      {
+         return VisitorAttributes.LEAVES_ONLY;
+      }
+   }
+
+   /**
+    * Visit an individual file and match against pattern
+    * 
+    * @param file File to compare to pattern
+    */
+   public void visit(VirtualFile file)
+   {
+      Matcher matcher = filePattern.matcher(file.getName());
+      if (matcher.find())
+      {
+         try
+         {
+            entries.add(file.toURL());
+         }
+         catch (Exception e)
+         {
+            // TODO Handle Exception
+            log.error("Failed to get URL for VirtualFile " + file.getName(), e);
+         }
+      }
+   }
+
+   /**
+    * Get entries matching the file pattern  
+    * 
+    * @return Entry List
+    */
+   public List<URL> getEntries()
+   {
+      return entries;
+   }
+
+   /**
+    * Convert file pattern (RFC 1960-based Filter) into a RegEx pattern
+    * 
+    * @param filePattern the file pattern
+    * @return Regular expressions pattern
+    */
+   private Pattern convertToPattern(String filePattern)
+   {
+      return Pattern.compile(new StringBuilder().append("^").append(filePattern.replace("*", ".*")).append("$")
+            .toString());
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleEntryVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeader.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeader.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeader.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+/**
+ * BundleHeader representing a Header value for the Bundle
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleHeader
+{
+   private final String key;
+
+   private final Object value;
+
+   /**
+    * Create a new BundleHeader.
+    * 
+    * @param key the key
+    * @param value the value
+    */
+   public BundleHeader(String key, Object value)
+   {
+      this.key = key;
+      this.value = value;
+   }
+
+   /**
+    * Get Header key
+    * 
+    * @return key
+    */
+   public String getKey()
+   {
+      return key;
+   }
+
+   /**
+    * Get Header Value
+    * 
+    * @return value
+    */
+   public Object getValue()
+   {
+      return value;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeader.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilder.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilder.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilder.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+
+/**
+ * Builds OSGI headers.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public interface BundleHeaderBuilder<T>
+{
+   /**
+    * Builds the BundleHeader from a metadata object.  
+    * @param metaData to build bundle header from
+    * @return BundleHeader the bundle header
+    */
+   BundleHeader buildHeader(T metaData);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilders.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilders.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilders.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+/**
+ * A BundleHeaderBuilders.
+ * Creates a default set of BundleHeaderBuilders.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleHeaderBuilders
+{
+   public static ExportPackageHeaderBuilder EXPORT_PACKAGE_BUILDER = new ExportPackageHeaderBuilder();
+   public static ImportPackageHeaderBuilder IMPORT_PACKAGE_BUILDER = new ImportPackageHeaderBuilder();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaderBuilders.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaders.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaders.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaders.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Container for Bundle headers providing localization for Manifest headers.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleHeaders
+{
+   private List<BundleHeader> headers = new ArrayList<BundleHeader>();
+
+   public BundleHeaders(DeploymentUnit unit)
+   {
+      ClassLoadingMetaData classLoadingMetaData = getClassLoaderMetaData(unit);
+      if(classLoadingMetaData != null) {
+         headers.add(BundleHeaderBuilders.EXPORT_PACKAGE_BUILDER.buildHeader(classLoadingMetaData));
+         headers.add(BundleHeaderBuilders.IMPORT_PACKAGE_BUILDER.buildHeader(classLoadingMetaData));
+         /* TODO
+          * 
+          * BUNDLE_CLASSPATH
+          * REQUIRE_BUNDLE
+          * DYNAMICIMPORT_PACKAGE
+          * 
+          */         
+      }
+      /* TODO
+       * 
+       * BUNDLE_NAME
+       * BUNDLE_VERSION
+       * BUNDLE_ACTIVATOR
+       * BUNDLE_DESCRIPTION
+       * BUNDLE_MANIFESTVERSION
+       * BUNDLE_UPDATELOCATION - Maybe...
+       * 
+       */
+   }
+
+   /**
+    * Converts the BundleHeaders into Dictionarry
+    * 
+    * @return Dictionary of headers
+    */
+   public Dictionary<String, Object> toDictionary()
+   {
+      Dictionary<String, Object> headerDictionary = new Hashtable<String, Object>();
+      for (BundleHeader header : headers)
+      {
+         if(header != null)
+         {
+            headerDictionary.put(header.getKey(), header.getValue());
+         }
+      }
+      return headerDictionary;
+   }
+
+   private ClassLoadingMetaData getClassLoaderMetaData(DeploymentUnit unit)
+   {
+      Set<? extends ClassLoadingMetaData> metaDatas = unit.getAllMetaData(ClassLoadingMetaData.class);
+      if(metaDatas != null && !metaDatas.isEmpty()) {
+         return metaDatas.iterator().next();
+      }
+      return null;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/BundleHeaders.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleState.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleState.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleState.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.osgi.plugins.facade.BundleState;
+
+/**
+ * A DeploymentStage2BundleState.
+ * Maps a DeploymentStage to BundleState
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class DeploymentStage2BundleState
+{
+   private final DeploymentStage deploymentStage;
+   private final BundleState bundleState;
+   
+   /**
+    * 
+    * Create a new DeploymentStage2BundleState.
+    * 
+    * @param deploymentStage the deployment stage
+    * @param bundleState the bundle state
+    */
+   public DeploymentStage2BundleState(DeploymentStage deploymentStage, BundleState bundleState)
+   {
+      this.deploymentStage = deploymentStage;
+      this.bundleState = bundleState;
+   }
+   
+   /**
+    * Get deploymentStage
+    * 
+    * @return
+    */
+   public DeploymentStage getDeploymentStage()
+   {
+      return deploymentStage;
+   }
+   
+   /**
+    * Get BundleState
+    * 
+    * @return
+    */
+   public BundleState getBundleState()
+   {
+      return bundleState;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleState.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleStateMapper.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleStateMapper.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleStateMapper.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.osgi.plugins.facade.BundleState;
+
+/**
+ * A DeploymentStage2BundleStateMapper.
+ * Maps a DeploymentStage to a BundleState
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class DeploymentStage2BundleStateMapper
+{
+   private static List<DeploymentStage2BundleState> deploymentStage2BundleStates = new ArrayList<DeploymentStage2BundleState>();
+
+   static
+   {
+      deploymentStage2BundleStates.add(new DeploymentStage2BundleState(DeploymentStages.NOT_INSTALLED, BundleState.UNINSTALLED));
+      deploymentStage2BundleStates.add(new DeploymentStage2BundleState(DeploymentStages.CLASSLOADER, BundleState.RESOLVED));
+      deploymentStage2BundleStates.add(new DeploymentStage2BundleState(DeploymentStages.REAL, BundleState.STARTING));
+      deploymentStage2BundleStates.add(new DeploymentStage2BundleState(DeploymentStages.INSTALLED, BundleState.ACTIVE));
+   }
+
+   /**
+    * Given a DeploymentStage returns corresponding BundleState
+    * 
+    * @param controllerState the controller state
+    * @return BundleState the bundle state
+    */
+   public static BundleState mapBundleState(final DeploymentStage controllerState)
+   {
+      for (DeploymentStage2BundleState deploymentStage2BundleState : deploymentStage2BundleStates)
+      {
+         if (deploymentStage2BundleState.getDeploymentStage().equals(controllerState))
+         {
+            return deploymentStage2BundleState.getBundleState();
+         }
+      }
+      return BundleState.UNINSTALLED;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/DeploymentStage2BundleStateMapper.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ExportPackageHeaderBuilder.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ExportPackageHeaderBuilder.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ExportPackageHeaderBuilder.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.util.Strings;
+import org.osgi.framework.Constants;
+
+/**
+ * A ExportPackageHeaderBuilder.
+ * Builds the Export-Package BundleHeader from CLassLoadingMetaData
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class ExportPackageHeaderBuilder implements BundleHeaderBuilder<ClassLoadingMetaData>
+{
+   /**
+    * Create a new ExportPackageHeaderRetriever.
+    */
+   public ExportPackageHeaderBuilder()
+   {
+   }
+
+   /**
+    * Iterate through the ClassLoadingMetaData to check for a PackageCapabilities and create Export-Package BundleHeader.
+    * 
+    * @param metaData the classloading meta data
+    */
+   public BundleHeader buildHeader(ClassLoadingMetaData metaData)
+   {
+      CapabilitiesMetaData capabilitiesMetaData = metaData.getCapabilities();
+      List<Capability> capabilities = capabilitiesMetaData.getCapabilities();
+      if (capabilities != null)
+      {
+         List<String> packageAndVersions = new ArrayList<String>();
+         for (Capability capability : capabilities)
+         {
+            if (capability instanceof PackageCapability)
+            {
+               PackageCapability packageCapability = (PackageCapability) capability;
+               packageAndVersions.add(new StringBuilder().append(packageCapability.getName()).append(";version=").append(packageCapability.getVersion()).toString());
+            }
+         }
+         if (packageAndVersions.isEmpty() == false)
+         {
+            return new BundleHeader(Constants.EXPORT_PACKAGE, Strings.join(packageAndVersions.toArray(),","));
+         }
+      }
+      return null;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ExportPackageHeaderBuilder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ImportPackageHeaderBuilder.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ImportPackageHeaderBuilder.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ImportPackageHeaderBuilder.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.helpers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.metadata.RequirementsMetaData;
+import org.jboss.util.Strings;
+import org.osgi.framework.Constants;
+
+/**
+ * A ImportPackageHeaderRetriever.
+ * Builds Import-Package BundleHeader from ClassLoadingMetaData
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class ImportPackageHeaderBuilder implements BundleHeaderBuilder<ClassLoadingMetaData>
+{
+   /**
+    * Create a new ImportPackageHeaderBuilder.
+    */
+   public ImportPackageHeaderBuilder()
+   {
+   }
+
+   /**
+    * Iterate through the ClassLoadingMetaData to check for a PackageRequirements and build Import-Package header.
+    * 
+    * @param metaData the classloading meta data
+    */
+   public BundleHeader buildHeader(ClassLoadingMetaData metaData)
+   {
+      RequirementsMetaData requirementsMetaData = metaData.getRequirements();
+      List<Requirement> requirements = requirementsMetaData.getRequirements();
+      if (requirements != null)
+      {
+         List<String> packageAndVersions = new ArrayList<String>();
+         for (Requirement requirement : requirements)
+         {
+            if (requirement instanceof PackageRequirement)
+            {
+               PackageRequirement packageRequirement = (PackageRequirement) requirement;
+               packageAndVersions.add(new StringBuilder().append(packageRequirement.getName()).append(";version=").append(packageRequirement.getVersionRange()).toString());
+            }
+         }
+         if (packageAndVersions.isEmpty() == false)
+         {
+            return new BundleHeader(Constants.IMPORT_PACKAGE, Strings.join(packageAndVersions.toArray(),","));
+         }
+      }
+      return null;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/helpers/ImportPackageHeaderBuilder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.registry;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Basic Service registry
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BasicServiceRegistry implements ServiceRegistry
+{
+   /** The lock */
+   private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+   /**
+    * Lock for read
+    */
+   protected void lockRead()
+   {
+      lock.readLock().lock();
+   }
+
+   /**
+    * Unlock for read
+    */
+   protected void unlockRead()
+   {
+      lock.readLock().unlock();
+   }
+
+   /**
+    * Lock for write
+    */
+   protected void lockWrite()
+   {
+      lock.writeLock().lock();
+   }
+
+   /**
+    * Unlock for write
+    */
+   protected void unlockWrite()
+   {
+      lock.writeLock().unlock();
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.facade.registry;
+
+/**
+ * Central place for handling ServiceReferences + Bundles.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceRegistry
+{
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractActivationPolicyMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractActivationPolicyMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractActivationPolicyMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,71 @@
+/*
+ * 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.osgi.plugins.metadata;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ActivationPolicyMetaData;
+
+/**
+ * Activation policy impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AbstractActivationPolicyMetaData implements ActivationPolicyMetaData, Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   private String type = "lazy";
+   private List<String> includes;
+   private List<String> excludes;
+
+   public String getType()
+   {
+      return type;
+   }
+
+   public void setType(String type)
+   {
+      this.type = type;
+   }
+
+   public List<String> getIncludes()
+   {
+      return includes;
+   }
+
+   public void setIncludes(List<String> includes)
+   {
+      this.includes = includes;
+   }
+
+   public List<String> getExcludes()
+   {
+      return excludes;
+   }
+
+   public void setExcludes(List<String> excludes)
+   {
+      this.excludes = excludes;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractActivationPolicyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeAware.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeAware.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeAware.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+
+import org.jboss.osgi.spi.metadata.AttributeAware;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Attribute holder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractAttributeAware extends JBossObject implements AttributeAware, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   protected String attribute;
+
+   protected AbstractAttributeAware(String attribute)
+   {
+      this.attribute = attribute;
+   }
+
+   public String getAttribute()
+   {
+      return attribute;
+   }
+
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append("attribute=" + attribute);
+   }
+
+   protected void toString(JBossStringBuilder buffer)
+   {
+      buffer.append("attribute=" + attribute);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeAware.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,100 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.osgi.spi.metadata.AttributeMetaData;
+import org.jboss.osgi.spi.metadata.ServiceValueMetaData;
+import org.jboss.util.UnreachableStatementException;
+import org.osgi.framework.BundleContext;
+
+/**
+ * ServiceAttributeMetaData.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractAttributeMetaData extends AbstractMetaDataVisitorNode implements AttributeMetaData, Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   /** The attribute name */
+   private String name;
+
+   /** The value */
+   private ServiceValueMetaData value;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Set the name.
+    *
+    * @param name the name.
+    */
+   public void setName(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      this.name = name;
+   }
+
+   public ServiceValueMetaData getValue()
+   {
+      return value;
+   }
+
+   /**
+    * Set the value.
+    *
+    * @param value the value.
+    */
+   public void setValue(ServiceValueMetaData value)
+   {
+      if (value == null)
+         throw new IllegalArgumentException("Null value");
+      this.value = value;
+   }
+
+   /**
+    * Get the value
+    *
+    * @param bundleContext the bundle context
+    * @return the value
+    * @throws Exception for any error
+    */
+   public Object getValue(BundleContext bundleContext) throws Exception
+   {
+      try
+      {
+         return value.getValue(bundleContext);
+      }
+      catch (Throwable t)
+      {
+         DeploymentException.rethrowAsDeploymentException("Error configuring attribute " + name, t);
+         throw new UnreachableStatementException();
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractAttributeMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractDependencyMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractDependencyMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractDependencyMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,117 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.osgi.spi.dependency.ServiceControllerContext;
+import org.jboss.osgi.spi.metadata.DependencyMetaData;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * A dependency.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractDependencyMetaData extends AbstractMetaDataVisitorNode
+      implements DependencyMetaData, Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   /** The dependency, may transient? */
+   protected Object dependency;
+
+   /**
+    * Create a new dependency
+    */
+   public AbstractDependencyMetaData()
+   {
+   }
+
+   /**
+    * Create a new dependency
+    *
+    * @param dependency the dependency
+    */
+   public AbstractDependencyMetaData(Object dependency)
+   {
+      this.dependency = dependency;
+   }
+
+   /**
+    * Set the dependency
+    *
+    * @param dependency the dependency
+    */
+   public void setDependency(Object dependency)
+   {
+      this.dependency = dependency;
+      flushJBossObjectCache();
+   }
+
+   public Object getDependency()
+   {
+      return dependency;
+   }
+
+   public void visit(ServiceMetaDataVisitor visitor)
+   {
+      ServiceControllerContext context = visitor.getControllerContext();
+      DependencyItem item = new LifecycleDependencyItem(context.getName(), ControllerState.CREATE);
+      visitor.addDependency(item);
+      item = new LifecycleDependencyItem(context.getName(), ControllerState.START);
+      visitor.addDependency(item);
+      
+      visitor.visit(this);
+   }
+
+   public void toString(JBossStringBuilder buffer)
+   {
+      buffer.append("dependency=").append(dependency);
+   }
+
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append(dependency);
+   }
+
+   /**
+    * A LifecycleDependencyItem.
+    */
+   public class LifecycleDependencyItem extends AbstractDependencyItem
+   {
+      /**
+       * Create a new LifecycleDependencyItem.
+       *
+       * @param name the name
+       * @param state the state
+       */
+      public LifecycleDependencyItem(Object name, ControllerState state)
+      {
+         super(name, dependency, state, state);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractDependencyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractHolderMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractHolderMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractHolderMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.osgi.spi.metadata.DependencyMetaData;
+import org.jboss.osgi.spi.metadata.HolderMetaData;
+
+/**
+ * Common OSGi reference or service impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractHolderMetaData extends AbstractMetaDataVisitorNode
+      implements HolderMetaData, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   private String id;
+   private String anInterface;
+   private Set<DependencyMetaData> depends;
+   private ClassLoaderMetaData classLoaderMetaData;
+
+   public String getId()
+   {
+      return id;
+   }
+
+   public String getInterface()
+   {
+      return anInterface;
+   }
+
+   public Set<DependencyMetaData> getDepends()
+   {
+      return depends;
+   }
+
+   public ClassLoaderMetaData getContextClassLoader()
+   {
+      return classLoaderMetaData;
+   }
+
+   public void setId(String id)
+   {
+      this.id = id;
+   }
+
+   public void setInterface(String anInterface)
+   {
+      this.anInterface = anInterface;
+   }
+
+   public void setDepends(Set<DependencyMetaData> depends)
+   {
+      this.depends = depends;
+   }
+
+   public void setClassLoaderMetaData(ClassLoaderMetaData classLoaderMetaData)
+   {
+      this.classLoaderMetaData = classLoaderMetaData;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractHolderMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractListenerMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractListenerMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractListenerMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+
+import org.jboss.osgi.spi.metadata.ListenerMetaData;
+
+/**
+ * Simple listener meta data.
+ * Referencing ref bean as a reference listener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractListenerMetaData implements ListenerMetaData, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   private String ref;
+   private String bindMethod;
+   private String unbindMethod;
+
+   public String getRef()
+   {
+      return ref;
+   }
+
+   public String getBindMethod()
+   {
+      return bindMethod;
+   }
+
+   public String getUnbindMethod()
+   {
+      return unbindMethod;
+   }
+
+   public void setRef(String ref)
+   {
+      this.ref = ref;
+   }
+
+   public void setBindMethod(String bindMethod)
+   {
+      this.bindMethod = bindMethod;
+   }
+
+   public void setUnbindMethod(String unbindMethod)
+   {
+      this.unbindMethod = unbindMethod;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractListenerMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractMetaDataVisitorNode.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractMetaDataVisitorNode.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractMetaDataVisitorNode.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitorNode;
+import org.jboss.util.JBossObject;
+import org.jboss.util.collection.CollectionsFactory;
+
+/**
+ * AbstractMetaDataVisitorNode.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractMetaDataVisitorNode extends JBossObject implements ServiceMetaDataVisitorNode
+{
+   public Iterator<? extends ServiceMetaDataVisitorNode> getChildren()
+   {
+      Set<ServiceMetaDataVisitorNode> children = CollectionsFactory.createLazySet();
+      addChildren(children);
+      if (children.size() == 0)
+         return null;
+      else
+         return children.iterator();
+   }
+
+   public void visit(ServiceMetaDataVisitor visitor)
+   {
+      visitor.visit(this);
+   }
+
+   /**
+    * Add to the children
+    *
+    * @param children the children
+    */
+   protected void addChildren(Set<ServiceMetaDataVisitorNode> children)
+   {
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractMetaDataVisitorNode.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,182 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
+import static org.jboss.osgi.plugins.metadata.ValueCreatorUtil.*;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.jboss.osgi.spi.metadata.ActivationPolicyMetaData;
+import static org.osgi.framework.Constants.*;
+import org.osgi.framework.Version;
+
+/**
+ * Abstract OSGi meta data.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractOSGiMetaData extends AbstractManifestMetaData implements OSGiMetaData
+{
+   private static final long serialVersionUID = 1L;
+
+   protected transient Map<String, Object> cachedAttributes = new HashMap<String, Object>();
+
+   public AbstractOSGiMetaData()
+   {
+   }
+
+   public AbstractOSGiMetaData(Manifest manifest)
+   {
+      super(manifest);
+   }
+
+   public String getHeader(String key)
+   {
+      return get(key, STRING_VC);
+   }
+
+   public ActivationPolicyMetaData getBundleActivationPolicy()
+   {
+      return get("Bundle-ActivationPolicy", ACTIVATION_POLICY_VC);
+   }
+
+   public String getBundleActivator()
+   {
+      return get(BUNDLE_ACTIVATOR, STRING_VC);
+   }
+
+   public List<String> getBundleCategory()
+   {
+      return get(BUNDLE_CATEGORY, STRING_LIST_VC);
+   }
+
+   public List<String> getBundleClassPath()
+   {
+      return get(BUNDLE_CLASSPATH, STRING_LIST_VC, Arrays.asList("."));
+   }
+
+   public String getBundleDescription()
+   {
+      return get(BUNDLE_DESCRIPTION, STRING_VC);
+   }
+
+   public String getBundleLocalization()
+   {
+      return get(BUNDLE_LOCALIZATION, STRING_VC, BUNDLE_LOCALIZATION_DEFAULT_BASENAME);
+   }
+
+   public int getBundleManifestVersion()
+   {
+      return get(BUNDLE_MANIFESTVERSION, INTEGER_VC, 1);
+   }
+
+   public String getBundleName()
+   {
+      return get(BUNDLE_NAME, STRING_VC);
+   }
+
+   public List<ParameterizedAttribute> getBundleNativeCode()
+   {
+      return get(BUNDLE_NATIVECODE, PATH_ATTRIB_LIST_VC);
+   }
+
+   public List<String> getRequiredExecutionEnvironment()
+   {
+      return get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, STRING_LIST_VC);
+   }
+
+   public String getBundleSymbolicName()
+   {
+      return get(BUNDLE_SYMBOLICNAME, STRING_VC);
+   }
+
+   public URL getBundleUpdateLocation()
+   {
+      return get(BUNDLE_UPDATELOCATION, URL_VC);
+   }
+
+   public Version getBundleVersion()
+   {
+      return get(BUNDLE_VERSION, VERSION_VC , new Version("0.0.0"));
+   }
+
+   public List<PackageAttribute> getDynamicImports()
+   {
+      return get(DYNAMICIMPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public List<PackageAttribute> getExportPackages()
+   {
+      return get(EXPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public ParameterizedAttribute getFragmentHost()
+   {
+      return get(FRAGMENT_HOST, PARAM_ATTRIB_VC);
+   }
+
+   public List<PackageAttribute> getImportPackages()
+   {
+      return get(IMPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public List<ParameterizedAttribute> getRequireBundles()
+   {
+      return get(REQUIRE_BUNDLE, QNAME_ATTRIB_LIST_VC);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator)
+   {
+      return get(key, creator, null);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator, T defaultValue)
+   {
+      T value = (T)cachedAttributes.get(key);
+      if (value == null)
+      {
+         String attribute = getMainAttribute(key);
+         if (attribute != null)
+         {
+            value = creator.createValue(attribute);
+         }
+         else if (defaultValue != null)
+         {
+            value = defaultValue;
+         }
+         if (value != null)
+            cachedAttributes.put(key, value);
+      }
+      return value;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractPackageAttribute.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractPackageAttribute.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractPackageAttribute.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.jboss.reflect.plugins.PackageInfoImpl;
+import org.jboss.reflect.spi.PackageInfo;
+import org.osgi.framework.Constants;
+
+/**
+ * Package attribute impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractPackageAttribute extends AbstractParameterizedAttribute implements PackageAttribute, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   protected PackageInfo packageInfo;
+   protected VersionRange versionRange;
+
+   public AbstractPackageAttribute(String attribute, Map<String, Parameter> parameters)
+   {
+      super(attribute, parameters);
+      packageInfo = new PackageInfoImpl(attribute);
+   }
+
+   public PackageInfo getPackageInfo()
+   {
+      return packageInfo;
+   }
+
+   public VersionRange getVersion()
+   {
+      if (versionRange == null)
+      {
+         Parameter parameter = getParameter(Constants.VERSION_ATTRIBUTE);
+         if (parameter != null)
+         {
+            if (parameter.isCollection())
+               throw new IllegalArgumentException("Duplicate version parameter.");
+            Object value = parameter.getValue();
+            if (value != null)
+            {
+               versionRange = AbstractVersionRange.parseRangeSpec(value.toString());
+            }
+         }
+      }
+      return versionRange;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractPackageAttribute.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Parameter impl.
+ * It uses [Hash]Set to hold the values.
+ * So duplicate values (by hash) will be ignored.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractParameter extends JBossObject implements Parameter, Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -7920499358318841779L
+   ;
+   protected Collection<String> values;
+
+   public AbstractParameter()
+   {
+      super();
+      values = new HashSet<String>();
+   }
+
+   public AbstractParameter(String parameter)
+   {
+      this();
+      addValue(parameter);
+   }
+
+   public void addValue(String value)
+   {
+      values.add(value);
+   }
+
+   public Object getValue()
+   {
+      if (values.isEmpty())
+         return null;
+      else if (values.size() == 1)
+         return values.iterator().next();
+      else
+         return values;
+   }
+
+   public boolean isCollection()
+   {
+      return values.size() > 1;
+   }
+
+   protected int getHashCode()
+   {
+      return values.hashCode();
+   }
+
+   public boolean equals(Object obj)
+   {
+      return (obj instanceof AbstractParameter && values.equals(((AbstractParameter)obj).values));
+   }
+
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append("value=" + getValue());
+   }
+
+   protected void toString(JBossStringBuilder buffer)
+   {
+      buffer.append("value=" + getValue());
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Map;
+
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Parameter attribute impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractParameterizedAttribute extends AbstractAttributeAware implements ParameterizedAttribute
+{
+   private static final long serialVersionUID = 1l;
+   
+   protected Map<String, Parameter> parameters;
+
+   public AbstractParameterizedAttribute(String attribute, Map<String, Parameter> parameters)
+   {
+      super(attribute);
+      this.parameters = parameters;
+   }
+
+   public Map<String, Parameter> getParameters()
+   {
+      return parameters;
+   }
+
+   public Parameter getParameter(String name)
+   {
+      return parameters.get(name);
+   }
+
+   protected void toString(JBossStringBuilder buffer)
+   {
+      super.toString(buffer);
+      buffer.append(" parameters=" + parameters);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractReferenceMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractReferenceMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractReferenceMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,123 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.aop.proxy.container.GeneratedAOPProxyFactory;
+import org.jboss.beans.metadata.spi.MetaDataVisitor;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.osgi.spi.metadata.ListenerMetaData;
+import org.jboss.osgi.spi.metadata.ReferenceMetaData;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi reference meta data.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractReferenceMetaData extends AbstractHolderMetaData implements ReferenceMetaData
+{
+   private static final long serialVersionUID = 1l;
+
+   private String filter;
+   private Cardinality cardinality = Cardinality.ONE_TO_ONE;
+   private Integer timeout;
+   private List<ListenerMetaData> listeners;
+   private Set<PropertyMetaData> properties;
+
+   public Object getUnderlyingValue()
+   {
+      return getId();
+   }
+
+   public Object getValue(BundleContext bundleContext) throws Throwable
+   {
+      // todo - add dynamic behaviour
+      return GeneratedAOPProxyFactory.createProxy(null, null);
+   }
+
+   public void visit(ServiceMetaDataVisitor visitor)
+   {
+      // todo - add dependency
+      super.visit(visitor);
+   }
+
+   public String getFilter()
+   {
+      return filter;
+   }
+
+   public Cardinality getCardinality()
+   {
+      return cardinality;
+   }
+
+   public Integer getTimeout()
+   {
+      return timeout;
+   }
+
+   public List<ListenerMetaData> getListeners()
+   {
+      return listeners;
+   }
+
+   public Set<PropertyMetaData> getProperties()
+   {
+      return properties;
+   }
+
+   public Class<?> getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
+   {
+      return null;
+   }
+
+   public void setFilter(String filter)
+   {
+      this.filter = filter;
+   }
+
+   public void setCardinality(Cardinality cardinality)
+   {
+      this.cardinality = cardinality;
+   }
+
+   public void setTimeout(Integer timeout)
+   {
+      this.timeout = timeout;
+   }
+
+   public void setListeners(List<ListenerMetaData> listeners)
+   {
+      this.listeners = listeners;
+   }
+
+   public void setProperties(Set<PropertyMetaData> properties)
+   {
+      this.properties = properties;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractReferenceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceDeployment.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceDeployment.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceDeployment.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ServiceDeployment;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * An abstract service deployment
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractServiceDeployment extends JBossObject implements ServiceDeployment
+{
+   /** The name of the deployment */
+   protected String name;
+
+   /* The services list */
+   protected List<ServiceMetaData> services;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+      flushJBossObjectCache();
+   }
+
+   public List<ServiceMetaData> getServices()
+   {
+      return services;
+   }
+
+   public void setServices(List<ServiceMetaData> services)
+   {
+      this.services = services;
+   }
+
+   public void toString(JBossStringBuilder buffer)
+   {
+      buffer.append("name=").append(name);
+      if (services != null)
+         buffer.append(" services=").append(services);
+   }
+
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append(name);
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,110 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.osgi.spi.metadata.AttributeMetaData;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
+
+/**
+ * OSGi service meta data.
+ * Register ref bean as an OSGi service with interface or interfaces.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractServiceMetaData extends AbstractHolderMetaData implements ServiceMetaData
+{
+   private static final long serialVersionUID = 1l;
+
+   private Set<String> interfaces;
+   private Map<String, String> serviceProperties;
+   private String ref;
+   private boolean lazyInit;
+
+   /** The references */
+   private List<AttributeMetaData> attributes = Collections.emptyList();
+
+   /** The dependencies */
+   // todo
+
+   public void visit(ServiceMetaDataVisitor visitor)
+   {
+      // todo - add children, depend on ref bean from MC
+      super.visit(visitor);
+   }
+
+   public List<AttributeMetaData> getAttributes()
+   {
+      return attributes;
+   }
+
+   public Set<String> getInterfaces()
+   {
+      return interfaces;
+   }
+
+   public Map<String, String> getServiceProperties()
+   {
+      return serviceProperties;
+   }
+
+   public String getRef()
+   {
+      return ref;
+   }
+
+   public boolean getLazyInit()
+   {
+      return lazyInit;
+   }
+
+   public void setAttributes(List<AttributeMetaData> attributes)
+   {
+      this.attributes = attributes;
+   }
+
+   public void setInterfaces(Set<String> interfaces)
+   {
+      this.interfaces = interfaces;
+   }
+
+   public void setServiceProperties(Map<String, String> serviceProperties)
+   {
+      this.serviceProperties = serviceProperties;
+   }
+
+   public void setRef(String ref)
+   {
+      this.ref = ref;
+   }
+
+   public void setLazyInit(boolean lazyInit)
+   {
+      this.lazyInit = lazyInit;
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractServiceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Abstract value creator.
+ * Extend this one for safe string usage.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+abstract class AbstractValueCreator<T> implements ValueCreator<T>
+{
+   protected Logger log = Logger.getLogger(getClass());
+   private boolean trim;
+
+   protected AbstractValueCreator()
+   {
+      this(false);
+   }
+
+   protected AbstractValueCreator(boolean trim)
+   {
+      this.trim = trim;
+   }
+
+   public T createValue(String attribute)
+   {
+      if (attribute == null)
+         return null;
+      if (trim)
+         attribute = attribute.trim();
+      return useString(attribute);
+   }
+
+   /**
+    * Use this method on non-null trimmed string.
+    * @param attibute non-null trimmed string
+    * @return expected value
+    */
+   protected abstract T useString(String attibute);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,194 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.StringTokenizer;
+
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+import org.osgi.framework.Version;
+
+/**
+ * Represents an OSGi version range:
+ * version-range ::= interval | atleast
+ * interval ::= ( '[' | '(' ) floor ',' ceiling ( ']' | ')' )
+ * atleast ::= version
+ * floor ::= version
+ * ceiling ::= version
+ *
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AbstractVersionRange extends JBossObject implements VersionRange, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   /**
+    * The lower bound of the range
+    */
+   private transient Version floor;
+   /**
+    * The upper bound of the range
+    */
+   private transient Version ceiling;
+   /**
+    * is the floor version a >(true) or >= constraint(false)
+    */
+   private transient boolean floorIsGreaterThan;
+   /**
+    * is the ceiling version a <(true) or <= constraint(false)
+    */
+   private transient boolean ceilingIsLessThan;
+   /**
+    * create object from this after serialization
+    */
+   private String rangeSpec;
+
+   public static VersionRange parseRangeSpec(String rangeSpec)
+   {
+      Version floor = null;
+      Version ceiling = null;
+      StringTokenizer st = new StringTokenizer(rangeSpec, ",[]()", true);
+      Boolean floorIsGreaterThan = null;
+      Boolean ceilingIsLessThan = null;
+      boolean mid = false;
+      while (st.hasMoreTokens())
+      {
+         String token = st.nextToken();
+         if (token.equals("["))
+            floorIsGreaterThan = false;
+         else if (token.equals("("))
+            floorIsGreaterThan = true;
+         else if (token.equals("]"))
+            ceilingIsLessThan = false;
+         else if (token.equals(")"))
+            ceilingIsLessThan = true;
+         else if (token.equals(","))
+            mid = true;
+         else if (token.equals("\"") == false)
+         {
+            // A version token
+            if (floor == null)
+               floor = new Version(token);
+            else
+               ceiling = new Version(token);
+         }
+
+      }
+      // check for parenthesis
+      if (floorIsGreaterThan == null || ceilingIsLessThan == null)
+      {
+         // non-empty interval usage
+         if (mid)
+            throw new IllegalArgumentException("Missing parenthesis: " + rangeSpec);
+         // single value
+         floorIsGreaterThan = false;
+         ceilingIsLessThan = false;
+      }
+
+      return new AbstractVersionRange(rangeSpec, floor, ceiling, floorIsGreaterThan, ceilingIsLessThan);
+   }
+
+   public AbstractVersionRange(String rangeSpec, Version floor, Version ceiling, boolean floorIsLessThan, boolean ceilingIsLessThan)
+   {
+      this.rangeSpec = rangeSpec;
+      this.floor = floor;
+      this.ceiling = ceiling;
+      this.floorIsGreaterThan = floorIsLessThan;
+      this.ceilingIsLessThan = ceilingIsLessThan;
+   }
+
+   public Version getFloor()
+   {
+      return floor;
+   }
+
+   public Version getCeiling()
+   {
+      return ceiling;
+   }
+
+   public boolean isInRange(Version v)
+   {
+      // Test a null floor version which implies 0.0.0 <= v <= inf
+      boolean isInRange = floor == null;
+      if (isInRange == false)
+      {
+         // Test the floor version
+         int floorCompare = v.compareTo(floor);
+         if ((floorIsGreaterThan && floorCompare > 0) || (floorIsGreaterThan == false && floorCompare >= 0))
+         {
+            isInRange = ceiling == null;
+            if (isInRange == false)
+            {
+               // Test the ceiling version
+               int ceilingCompare = v.compareTo(ceiling);
+               if ((ceilingIsLessThan && ceilingCompare < 0) || (ceilingIsLessThan == false && ceilingCompare <= 0))
+               {
+                  isInRange = true;
+               }
+            }
+         }
+      }
+      return isInRange;
+   }
+
+   protected int getHashCode()
+   {
+      return rangeSpec.hashCode();
+   }
+
+   public boolean equals(Object obj)
+   {
+      return (obj instanceof AbstractVersionRange && rangeSpec.equals(((AbstractVersionRange)obj).rangeSpec));
+   }
+
+   protected void toString(JBossStringBuilder tmp)
+   {
+      if (floor == null)
+         tmp.append("0.0.0");
+      else
+         tmp.append(floor.toString());
+      tmp.append(" <");
+      if (floorIsGreaterThan == false)
+         tmp.append('=');
+      tmp.append(" v ");
+      // Ceiling
+      tmp.append('<');
+      if (ceilingIsLessThan == false)
+         tmp.append('=');
+      tmp.append(' ');
+      if (ceiling == null)
+         tmp.append("inf");
+      else
+         tmp.append(ceiling.toString());
+   }
+
+   protected Object readResolve() throws ObjectStreamException
+   {
+      return parseRangeSpec(rangeSpec);
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMDValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMDValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMDValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,74 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Arrays;
+
+import org.jboss.osgi.spi.metadata.ActivationPolicyMetaData;
+
+/**
+ * Activation policy value creator.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class ActivationPolicyMDValueCreator extends AbstractValueCreator<ActivationPolicyMetaData>
+{
+   private static final String INCLUDE = "include:=";
+   private static final String EXCLUDE = "exclude:=";
+
+   public ActivationPolicyMDValueCreator()
+   {
+      super(true);
+   }
+
+   protected ActivationPolicyMetaData useString(String attibute)
+   {
+      AbstractActivationPolicyMetaData aap = new AbstractActivationPolicyMetaData();
+      String[] split = attibute.split(";");
+      aap.setType(split[0]);
+      if (split.length > 1)
+         readDirective(aap, split[1]);
+      if (split.length > 2)
+         readDirective(aap, split[2]);
+      return aap;
+   }
+
+   /**
+    * Read the directive.
+    *
+    * @param aap the activation policy
+    * @param directive the directive
+    */
+   protected void readDirective(AbstractActivationPolicyMetaData aap, String directive)
+   {
+      if (directive.startsWith(INCLUDE))
+      {
+         String[] includes = directive.substring(INCLUDE.length() + 1, directive.length() - 1).split(",");
+         aap.setIncludes(Arrays.asList(includes));
+      }
+      else if (directive.startsWith(EXCLUDE))
+      {
+         String[] excludes = directive.substring(EXCLUDE.length() + 1, directive.length() - 1).split(",");
+         aap.setExcludes(Arrays.asList(excludes));
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMDValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/BooleanValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/BooleanValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/BooleanValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * Parse boolean from string.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class BooleanValueCreator extends AbstractValueCreator<Boolean>
+{
+   public BooleanValueCreator()
+   {
+      super();
+   }
+
+   public BooleanValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public Boolean useString(String attribute)
+   {
+      return Boolean.valueOf(attribute);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/BooleanValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/CollectionValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/CollectionValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/CollectionValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Collection;
+
+/**
+ * Create value from collection of attributes.
+ *
+ * @param <T> expected type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface CollectionValueCreator<T> extends ValueCreator<T>
+{
+   /**
+    * Create value from string attribute.
+    *
+    * @param attributes collection of strings to get value from
+    * @return value
+    */
+   T createValue(Collection<String> attributes);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/CollectionValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/IntegerValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/IntegerValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/IntegerValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * Parse int from string.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class IntegerValueCreator extends AbstractValueCreator<Integer>
+{
+   public IntegerValueCreator()
+   {
+      super();
+   }
+
+   public IntegerValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public Integer useString(String attribute)
+   {
+      return Integer.valueOf(attribute);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/IntegerValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+/**
+ * Create value list from string attribute.
+ *
+ * @param <T> expected component type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+abstract class ListValueCreator<T> extends AbstractValueCreator<List<T>>   
+{
+   protected ListValueCreator()
+   {
+      super();
+   }
+
+   protected ListValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/OSGiParameters.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/OSGiParameters.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/OSGiParameters.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,125 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.VersionRange;
+import static org.osgi.framework.Constants.*;
+
+/**
+ * OSGi parameter values.
+ * Util for transforming parameter info to actual useful values.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiParameters
+{
+   protected static Logger log = Logger.getLogger(OSGiParameters.class);
+
+   protected Map<String, Parameter> parameters;
+   protected Map<String, Object> cachedAttributes;
+
+   public OSGiParameters(Map<String, Parameter> parameters)
+   {
+      this.parameters = Collections.unmodifiableMap(parameters);
+      this.cachedAttributes = new HashMap<String, Object>();
+   }
+
+   protected Map<String, Parameter> getParameters()
+   {
+      return parameters;
+   }
+
+   public VersionRange getVersion()
+   {
+      return get(VERSION_ATTRIBUTE, ValueCreatorUtil.VERSION_RANGE_VC);
+   }
+
+   public String getBundleSymbolicName()
+   {
+      return get(BUNDLE_SYMBOLICNAME_ATTRIBUTE, ValueCreatorUtil.STRING_VC);
+   }
+
+   public VersionRange getBundleVersion()
+   {
+      return get(BUNDLE_VERSION_ATTRIBUTE, ValueCreatorUtil.VERSION_RANGE_VC);
+   }
+
+   public String getVisibility()
+   {
+      return get(VISIBILITY_DIRECTIVE, ValueCreatorUtil.STRING_VC, VISIBILITY_PRIVATE);
+   }
+
+   public String getResolution()
+   {
+      return get(RESOLUTION_DIRECTIVE, ValueCreatorUtil.STRING_VC, RESOLUTION_MANDATORY);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator)
+   {
+      return get(key, creator, null);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator, T defaultValue)
+   {
+      T value = (T)cachedAttributes.get(key);
+      if (value == null)
+      {
+         Parameter parameter = parameters.get(key);
+         if (parameter != null)
+         {
+            Object paramValue = parameter.getValue();
+            if(parameter.isCollection())
+            {
+               if (creator instanceof CollectionValueCreator)
+               {
+                  CollectionValueCreator<T> cvc = (CollectionValueCreator<T>)creator;
+                  value = cvc.createValue((Collection<String>)paramValue);
+               }
+               else
+               {
+                  log.warn("Unable to create proper value from " + creator + " for parameter: " + parameter);
+               }
+            }
+            else
+            {
+               value = creator.createValue(paramValue.toString());
+            }
+         }
+         else if (defaultValue != null)
+         {
+            value = defaultValue;
+         }
+         if (value != null)
+            cachedAttributes.put(key, value);
+      }
+      return value;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/OSGiParameters.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+
+/**
+ * Create package attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class PackageAttributeListValueCreator extends ListValueCreator<PackageAttribute>
+{
+   public List<PackageAttribute> useString(String attibute)
+   {
+      List<PackageAttribute> list = new ArrayList<PackageAttribute>();
+      try
+      {
+         HeaderValue.parsePackages(attibute, list, log.isTraceEnabled());
+      }
+      catch (ParseException e)
+      {
+         log.error("Exception parsing package headers.", e);
+      }
+      return list;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create parameterized attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+abstract class ParameterizedAttributeListValueCreator extends ListValueCreator<ParameterizedAttribute>
+{
+   public List<ParameterizedAttribute> useString(String attribute)
+   {
+      List<ParameterizedAttribute> list = new ArrayList<ParameterizedAttribute>();
+      parseAttribute(attribute, list, log.isTraceEnabled());
+      return list;
+   }
+
+   /**
+    * Use appropriate JavaCC parsing util.
+    *
+    * @param attribute string value to parse
+    * @param list data holder list
+    * @param trace log trace
+    */
+   protected abstract void parseAttribute(String attribute, List<ParameterizedAttribute> list, boolean trace);
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create paramertized attribute from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class ParameterizedAttributeValueCreator extends AbstractValueCreator<ParameterizedAttribute>
+{
+   public ParameterizedAttribute useString(String attribute)
+   {
+      ParameterizedAttributeListValueCreator palvc = new QNameAttributeListValueCreator();
+      List<ParameterizedAttribute> list = palvc.useString(attribute);
+      return list.size() > 0 ? list.get(0) : null;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PathAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PathAttributeListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PathAttributeListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create path attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class PathAttributeListValueCreator extends ParameterizedAttributeListValueCreator
+{
+   protected void parseAttribute(String attribute, List<ParameterizedAttribute> list, boolean trace)
+   {
+      try
+      {
+         HeaderValue.parsePaths(attribute, list, trace);
+      }
+      catch (ParseException e)
+      {
+         log.error("Exception parsing parameters.", e);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/PathAttributeListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/QNameAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/QNameAttributeListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/QNameAttributeListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create [dynamic]qname attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class QNameAttributeListValueCreator extends ParameterizedAttributeListValueCreator
+{
+   protected void parseAttribute(String attribute, List<ParameterizedAttribute> list, boolean trace)
+   {
+      try
+      {
+         HeaderValue.parseParameters(attribute, list, trace);
+      }
+      catch (ParseException e)
+      {
+         log.error("Exception parsing parameters.", e);
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/QNameAttributeListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringListValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringListValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringListValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Split string into list of strings.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class StringListValueCreator extends ListValueCreator<String>
+{
+   protected String delimiter = ",";
+
+   public StringListValueCreator()
+   {
+      super();
+   }
+
+   public StringListValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public StringListValueCreator(String delimiter)
+   {
+      this();
+      this.delimiter = delimiter;
+   }
+
+   public StringListValueCreator(String delimiter, boolean trim)
+   {
+      this(trim);
+      this.delimiter = delimiter;
+   }
+
+   public List<String> useString(String attribute)
+   {
+      return Arrays.asList(attribute.split(delimiter));
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringListValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * Plain string forwarding - no conversion.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class StringValueCreator extends AbstractValueCreator<String>
+{
+   public StringValueCreator()
+   {
+      super();
+   }
+
+   public StringValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   protected String useString(String attibute)
+   {
+      return attibute;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/StringValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/URLValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/URLValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/URLValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Create URL from string.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class URLValueCreator extends AbstractValueCreator<URL>
+{
+   public URLValueCreator()
+   {
+      super();
+   }
+
+   public URLValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public URL useString(String attribute)
+   {
+      try
+      {
+         return new URL(attribute);
+      }
+      catch (MalformedURLException e)
+      {
+         log.warn("Exception while creating URL.", e);
+         return null;
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/URLValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * Create value from attribute.
+ *
+ * @param <T> expected type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ValueCreator<T>
+{
+   /**
+    * Create value from string attribute.
+    *
+    * @param attribute string to get value from
+    * @return value
+    */
+   T createValue(String attribute);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreatorUtil.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreatorUtil.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreatorUtil.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * ValueCreator holder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ValueCreatorUtil
+{
+   public static StringValueCreator STRING_VC = new StringValueCreator();
+   public static IntegerValueCreator INTEGER_VC = new IntegerValueCreator();
+   public static BooleanValueCreator BOOLEAN_VC = new BooleanValueCreator();
+   public static VersionValueCreator VERSION_VC = new VersionValueCreator();
+   public static VersionRangeValueCreator VERSION_RANGE_VC = new VersionRangeValueCreator();
+   public static URLValueCreator URL_VC = new URLValueCreator();
+   public static StringListValueCreator STRING_LIST_VC = new StringListValueCreator();
+   public static ParameterizedAttributeValueCreator PARAM_ATTRIB_VC = new ParameterizedAttributeValueCreator();
+   public static ParameterizedAttributeListValueCreator QNAME_ATTRIB_LIST_VC = new QNameAttributeListValueCreator();
+   public static ParameterizedAttributeListValueCreator PATH_ATTRIB_LIST_VC = new PathAttributeListValueCreator();
+   public static PackageAttributeListValueCreator PACKAGE_LIST_VC = new PackageAttributeListValueCreator();
+   public static ActivationPolicyMDValueCreator ACTIVATION_POLICY_VC = new ActivationPolicyMDValueCreator();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/ValueCreatorUtil.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import org.jboss.osgi.spi.metadata.VersionRange;
+
+/**
+ * Parse VersionRange from string.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class VersionRangeValueCreator extends AbstractValueCreator<VersionRange>
+{
+   public VersionRangeValueCreator()
+   {
+      super();
+   }
+
+   public VersionRangeValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public VersionRange useString(String attribute)
+   {
+      return AbstractVersionRange.parseRangeSpec(attribute);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionValueCreator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionValueCreator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionValueCreator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Parse Version from string.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+*/
+class VersionValueCreator extends AbstractValueCreator<Version>
+{
+   public VersionValueCreator()
+   {
+      super();
+   }
+
+   public VersionValueCreator(boolean trim)
+   {
+      super(trim);
+   }
+
+   public Version useString(String attribute)
+   {
+      return new Version(attribute);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/metadata/VersionValueCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionComparator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionComparator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionComparator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.version;
+
+import org.jboss.classloading.spi.version.VersionComparator;
+import org.osgi.framework.Version;
+
+/**
+ * OSGi version comparator.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiVersionComparator implements VersionComparator<Version, Version>
+{
+   public static final VersionComparator<Version, Version> INSTANCE = new OSGiVersionComparator();
+
+   public int compare(Version one, Version two)
+   {
+      return one.compareTo(two);
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionComparator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToStringComparator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToStringComparator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToStringComparator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.version;
+
+import org.jboss.classloading.spi.version.VersionComparator;
+import org.osgi.framework.Version;
+
+/**
+ * OSGi version to String version comparator.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiVersionToStringComparator implements VersionComparator<Version, String>
+{
+   public static final VersionComparator<Version,String> INSTANCE = new OSGiVersionToStringComparator();
+
+   public int compare(Version one, String two)
+   {
+      return one.compareTo(Version.parseVersion(two));
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToStringComparator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToVersionComparator.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToVersionComparator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToVersionComparator.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later two.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.version;
+
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.classloading.spi.version.VersionComparator;
+
+/**
+ * OSGi two to JBoss two comparator.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiVersionToVersionComparator implements VersionComparator<org.osgi.framework.Version, Version>
+{
+   public static final VersionComparator<org.osgi.framework.Version, Version> INSTANCE = new OSGiVersionToVersionComparator();
+
+   public int compare(org.osgi.framework.Version one, Version two)
+   {
+      int result = one.getMajor() - two.getMajor();
+      if (result != 0)
+         return result;
+
+      result = one.getMinor() - two.getMinor();
+      if (result != 0)
+         return result;
+
+      result = one.getMicro() - two.getMicro();
+      if (result != 0)
+         return result;
+
+      String q1 = one.getQualifier();
+      String q2 = two.getQualifier();
+      if (q1 != null &&  q2 != null)
+         return q1.compareTo(q2);
+      return 0;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/plugins/version/OSGiVersionToVersionComparator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/ServiceControllerContext.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/ServiceControllerContext.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/ServiceControllerContext.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.dependency;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Information about Bundle[Context] and ServiceMetaData.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceControllerContext extends ControllerContext, InvokeDispatchContext
+{
+   /**
+    * Get the metadata
+    *
+    * @return the service metadata
+    */
+   ServiceMetaData getServiceMetaData();
+
+   /**
+    * Get the BundleContext
+    *
+    * @return underlying bundle context
+    */
+   BundleContext getBundleContext();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/dependency/ServiceControllerContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ActivationPolicyMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ActivationPolicyMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ActivationPolicyMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.List;
+
+/**
+ * OSGi activation policy metadata.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ActivationPolicyMetaData
+{
+   /**
+    * Get the type.
+    *
+    * @return the type
+    */
+   String getType();
+
+   /**
+    * Get include packages.
+    *
+    * @return the include packages
+    */
+   List<String> getIncludes();
+
+   /**
+    * Get the exclude packages.
+    *
+    * @return the exclude packages
+    */
+   List<String> getExcludes();
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ActivationPolicyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeAware.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeAware.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeAware.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Attribute string value holder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface AttributeAware
+{
+   /**
+    * Get the attribute.
+    *
+    * @return string attribute value
+    */
+   String getAttribute();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeAware.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * ServiceAttributeMetaData.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface AttributeMetaData
+{
+   /**
+    * Get the name.
+    *
+    * @return the name.
+    */
+   String getName();
+
+   /**
+    * Get the value.
+    *
+    * @return the value.
+    */
+   ServiceValueMetaData getValue();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/AttributeMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/DependencyMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/DependencyMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/DependencyMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Metadata about what a osgi service's dependency.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface DependencyMetaData
+{
+   /**
+    * What is the dependency
+    *
+    * @return the dependency
+    */
+   Object getDependency();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/DependencyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/HolderMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/HolderMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/HolderMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+
+/**
+ * Common OSGi meta data mainAttributes.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface HolderMetaData
+{
+   /**
+    * Get the element id.
+    *
+    * @return unique string id
+    */
+   String getId();
+
+   /**
+    * Get the exposed interface.
+    *
+    * @return qualified interface name.
+    */
+   String getInterface();
+
+   /**
+    * Get the dependencies.
+    *
+    * @return set of dependencies.
+    */
+   Set<DependencyMetaData> getDepends();
+
+   /**
+    * Get the classloader metadata.
+    *
+    * @return classloader metadata
+    */
+   ClassLoaderMetaData getContextClassLoader();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/HolderMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ListenerMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ListenerMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ListenerMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Simple listener meta data - referencing bean as listener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ListenerMetaData
+{
+   String getRef();
+
+   String getBindMethod();
+
+   String getUnbindMethod();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ListenerMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,169 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.deployers.vfs.spi.deployer.ManifestMetaData;
+import org.osgi.framework.Version;
+
+/**
+ * OSGi specific manifest meta data.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface OSGiMetaData extends ManifestMetaData
+{
+   /**
+    * Extension point to read custom manifest headers.
+    *
+    * @param key the header key
+    * @return value or null of no such header
+    */
+   String getHeader(String key);
+
+   /**
+    * Get bundle activation policy.
+    *
+    * @return bundle activation policy
+    */
+   ActivationPolicyMetaData getBundleActivationPolicy();
+
+   /**
+    * Get bundle activator class name.
+    *
+    * @return bundle activator classname or null if no such attribute
+    */
+   String getBundleActivator();
+
+   /**
+    * Get the bundle category
+    *
+    * @return list of category names
+    */
+   List<String> getBundleCategory();
+
+   /**
+    * Get the bundle classpath
+    *
+    * @return list of JAR file path names or directories inside bundle
+    */
+   List<String> getBundleClassPath();
+
+   /**
+    * Get the description
+    *
+    * @return a description
+    */
+   String getBundleDescription();
+
+   /**
+    * Get the localization's location
+    *
+    * @return location in the bundle for localization files
+    */
+   String getBundleLocalization();
+
+   /**
+    * Get the bundle manifest version
+    *
+    * @return bundle's specification number
+    */
+   int getBundleManifestVersion();
+
+   /**
+    * Get the name
+    *
+    * @return readable name
+    */
+   String getBundleName();
+
+   /**
+    * Get native code libs
+    * @return native libs contained in the bundle
+    */
+   List<ParameterizedAttribute> getBundleNativeCode();
+
+   /**
+    * Get required exectuion envs
+    *
+    * @return list of execution envs that must be present on the Service Platform
+    */
+   List<String> getRequiredExecutionEnvironment();
+
+   /**
+    * Get bundle symbolic name.
+    *
+    * @return bundle's symbolic name
+    */
+   String getBundleSymbolicName();
+
+   /**
+    * Get the update url.
+    *
+    * @return URL of an update bundle location
+    */
+   URL getBundleUpdateLocation();
+
+   /**
+    * Get bundle's version.
+    *
+    * @return version of this bundle
+    */
+   Version getBundleVersion();
+
+   /**
+    * Get dynamic imports.
+    *
+    * @return package names that should be dynamically imported when needed
+    */
+   List<PackageAttribute> getDynamicImports();
+
+   /**
+    * Get the export packages.
+    *
+    * @return exported packages
+    */
+   List<PackageAttribute> getExportPackages();
+
+   /**
+    * Get the fragment host.
+    *
+    * @return host bundle for this fragment
+    */
+   ParameterizedAttribute getFragmentHost();
+
+   /**
+    * Get the import packages.
+    *
+    * @return imported packages.
+    */
+   List<PackageAttribute> getImportPackages();
+
+   /**
+    * Get the required exports
+    *
+    * @return required exports from anoter bundle
+    */
+   List<ParameterizedAttribute> getRequireBundles();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/PackageAttribute.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/PackageAttribute.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/PackageAttribute.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.jboss.reflect.spi.PackageInfo;
+
+/**
+ * A package info.
+ * Includes version and properties.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface PackageAttribute extends VersionRangeAttribute, ParameterizedAttribute
+{
+   /**
+    * Get the package info.
+    * Must 'match' getAttribute method
+    * from AttributeAware interface. 
+    *
+    * @return package info
+    */
+   PackageInfo getPackageInfo();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/PackageAttribute.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/Parameter.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/Parameter.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/Parameter.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Parameter interface - single value or set of values.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface Parameter
+{
+   /**
+    * Get value.
+    * Simple string value or collection of string values.
+    *
+    * @return value
+    */
+   Object getValue();
+
+   /**
+    * Add value.
+    * 
+    * @param value string to add
+    */
+   void addValue(String value);
+
+   /**
+    * Has multiple values.
+    * Used when same name is used for multiple parameter values.
+    * Value _can_ be casted into Collection<String>.
+    *
+    * @return true is returned type is Collection, otherwise false
+    */
+   boolean isCollection();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/Parameter.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.Map;
+
+/**
+ * Attribute with parameters.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ParameterizedAttribute extends AttributeAware
+{
+   /**
+    * Get the parameters.
+    *
+    * @return properties for this attribute
+    */
+   Map<String, Parameter> getParameters();
+
+   /**
+    * Get the parameter by name.
+    * Helper method to getParameters method.
+    *
+    * @param name parameter's name
+    * @return parameter value
+    */
+   Parameter getParameter(String name);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ReferenceMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ReferenceMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ReferenceMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+
+/**
+ * OSGi reference meta data.
+ * Extends ValueMetaData - can be used as a value via proxy.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ReferenceMetaData extends HolderMetaData, ServiceValueMetaData
+{
+   String getFilter();
+
+//   Cardinality getCardinality();
+
+   Integer getTimeout();
+
+   List<ListenerMetaData> getListeners();
+
+   Set<PropertyMetaData> getProperties();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ReferenceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceDeployment.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceDeployment.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceDeployment.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.List;
+
+/**
+ * An osgi service deployment
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceDeployment
+{
+   /**
+    * Get the name of the deployment
+    *
+    * @return the name
+    */
+   String getName();
+
+   /**
+    * Set the name of the deployment
+    *
+    * @param name the name
+    */
+   void setName(String name);
+
+   /**
+    * Get the services in the deployment
+    * @return List<ServiceMetaData>
+    */
+   List<ServiceMetaData> getServices();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceDeployment.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * OSGi service meta data.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceMetaData extends HolderMetaData, ServiceMetaDataVisitorNode
+{
+   List<AttributeMetaData> getAttributes();
+
+   Set<String> getInterfaces();
+
+   Map<String, String> getServiceProperties();
+
+   String getRef();
+
+   boolean getLazyInit();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.osgi.spi.dependency.ServiceControllerContext;
+
+/**
+ * ServiceMetaDataVisitor.
+ * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceMetaDataVisitor
+{
+   /**
+    * Get the controller context
+    * 
+    * @return the context
+    */
+   ServiceControllerContext getControllerContext();
+
+   /**
+    * Get the context state
+    * 
+    * @return the context state
+    */
+   ControllerState getContextState();
+
+   /**
+    * Set the context state
+    * 
+    * @param contextState the context state
+    */
+   void setContextState(ControllerState contextState);
+
+   /**
+    * Add a dependency
+    * 
+    * @param dependency the dependency
+    */
+   void addDependency(DependencyItem dependency);
+   
+   /**
+    * Visit the node
+    * 
+    * @param node the node
+    */
+   void visit(ServiceMetaDataVisitorNode node);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitorNode.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitorNode.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitorNode.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.Iterator;
+
+/**
+ * ServiceMetaDataVisitorNode.
+ * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceMetaDataVisitorNode
+{
+   /**
+    * Visit the node
+    * 
+    * @param vistor the visitor
+    */
+   public void visit(ServiceMetaDataVisitor vistor);
+   
+   /**
+    * Return the child nodes
+    * 
+    * @return Iterator<MetaDataVisitorNode> or null if there aren't any
+    */
+   public Iterator<? extends ServiceMetaDataVisitorNode> getChildren();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitorNode.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceValueMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceValueMetaData.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceValueMetaData.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * ServiceValueMetaData.
+ * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceValueMetaData extends ServiceMetaDataVisitorNode
+{
+   /**
+    * Get the value
+    * 
+    * @param bundleContext the bundle context
+    * @return the value
+    * @throws Throwable for any error
+    */
+   Object getValue(BundleContext bundleContext) throws Throwable;
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/ServiceValueMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRange.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRange.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRange.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Version range.
+ * [floor, ceiling]
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VersionRange
+{
+   /**
+    * Get the floor version.
+    *
+    * @return floor version
+    */
+   Version getFloor();
+
+   /**
+    * Get the ceiling version.
+    *
+    * @return ceiling version
+    */
+   Version getCeiling();
+
+   /**
+    * Is param verision between (including) floor and ceiling.
+    *
+    * @param version version parameter to compare
+    * @return true if version param in version range interval
+    */
+   boolean isInRange(Version version);
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRange.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Attribute with VersionRange attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VersionRangeAttribute extends AttributeAware
+{
+   /**
+    * Get the version range.
+    *
+    * @return version range for this attribute
+    */
+   VersionRange getVersion();
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/java/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/metadata/HeaderValue.jj
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/metadata/HeaderValue.jj	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/javacc/org/jboss/osgi/plugins/metadata/HeaderValue.jj	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,312 @@
+ options {
+   LOOKAHEAD=2;
+   DEBUG_PARSER=true;
+   DEBUG_LOOKAHEAD=true;
+   DEBUG_TOKEN_MANAGER=false;
+   STATIC=false;
+}
+
+PARSER_BEGIN(HeaderValue)
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.osgi.spi.metadata.*;
+
+/**
+ * A JavaCC 3.2 grammar for the OSGi R4 bundle headers
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ */
+public class HeaderValue
+{
+   public HeaderValue()
+   {
+      this(new StringReader(""));
+   }
+
+   public HeaderValue(String value)
+   {
+      this(new StringReader(value));
+   }
+
+   private void applyTracing(boolean trace)
+   {
+      if (trace)
+      {
+         enable_tracing();
+      }
+      else
+      {
+         disable_tracing();
+      }
+   }
+
+   private void addParameter(Map<String, Parameter> parameters, String key, String value)
+   {
+      Parameter parameter = parameters.get(key);
+      if (parameter == null)
+      {
+         parameter = new AbstractParameter();
+         parameters.put(key, parameter);
+      }
+      parameter.addValue(value);
+   }
+
+   public void parsePackages(List<PackageAttribute> list, boolean trace)
+      throws ParseException
+   {
+      // This will have no effect unless the debugging options are true
+      applyTracing(trace);
+      parsePackages(list);
+   }
+
+   public void parseParameters(List<ParameterizedAttribute> list, boolean trace)
+      throws ParseException
+   {
+      // This will have no effect unless the debugging options are true
+      applyTracing(trace);
+      parseParameters(list);
+   }
+
+   public void parsePaths(List<ParameterizedAttribute> list, boolean trace)
+      throws ParseException
+   {
+      // This will have no effect unless the debugging options are true
+      applyTracing(trace);
+      parsePaths(list);
+   }
+
+   public static void parsePackages(String header, List<PackageAttribute> list, boolean trace)
+      throws ParseException
+   {
+      HeaderValue parser = new HeaderValue(header);
+      parser.parsePackages(list, trace);
+   }
+
+   public static void parseParameters(String header, List<ParameterizedAttribute> list, boolean trace)
+      throws ParseException
+   {
+      HeaderValue parser = new HeaderValue(header);
+      parser.parseParameters(list, trace);
+   }
+
+   public static void parsePaths(String header, List<ParameterizedAttribute> list, boolean trace)
+      throws ParseException
+   {
+      HeaderValue parser = new HeaderValue(header);
+      parser.parsePaths(list, trace);
+   }
+}
+PARSER_END(HeaderValue)
+
+/* IGNORE WHITESPACE */
+
+SKIP :
+{
+    " "
+  | "\r"
+  | "\t"
+  | "\n"
+}
+
+/* Common tokens */
+TOKEN:
+{
+  <#ALPHA: [ "a"-"z", "A"-"Z" ] >
+|
+  <#DIGIT: ["0" - "9"] >
+|
+  <STAR: "*" >
+|
+  <NUMBER: (<DIGIT>)+ >
+|
+  <DECIMAL_NUMBER: <NUMBER> ( "." <NUMBER> )? >
+|
+  <#ALPHANUM: <ALPHA>|<DECIMAL_NUMBER> >
+|
+  <VERSION_VALUE: (<NUMBER> ("." <NUMBER> ("." <NUMBER> ("." <ALPHANUM>)? )?  )?) >
+|
+  <#TOKN: (<ALPHANUM>|<VERSION_VALUE>|"_"|"-")+ >
+|
+  <#JLETTER: [ "_", "a"-"z", "A"-"Z" ] >
+|
+  <#JLETTER_OR_DIGIT: <JLETTER> | <DIGIT> >
+|
+  <QNAME: <JLETTER> (<JLETTER_OR_DIGIT>)* ("." <JLETTER> (<JLETTER_OR_DIGIT>)*)* (".*")? >
+|
+  <QUOTED_STRING: "\"" ( ~["\"", "\\", "\r", "\n", "\u0000"] | "\\\"")* "\"" >
+|
+  <#ARGUMENT: <TOKN>|<QUOTED_STRING> >
+|
+  <ATTRIBUTE: <TOKN> "=" <ARGUMENT> >
+|
+  <DIRECTIVE: <TOKN> ":=" <ARGUMENT> >
+|
+  <PATH_ELEMENT: (~["/", "\"", "\n", "\r", "\u0000", ";", ","])+ >
+|
+  <PATH_SEP: "/" >
+|
+  <#PATH_UNQUOTED: <PATH_SEP> | (<PATH_SEP>)? <PATH_ELEMENT> (<PATH_SEP> <PATH_ELEMENT>)* >
+|
+  <PATH: <PATH_UNQUOTED> | "\"" <PATH_UNQUOTED> "\"" >
+}
+
+/** Start of the grammar */
+/** Entry point for the Import-Package header value parsing. */
+
+void parsePackages(List<PackageAttribute> list) :
+{
+}
+{
+  packageInfo(list) ( "," packageInfo(list) )*
+  {
+  }
+}
+
+void parseParameters(List<ParameterizedAttribute> list) :
+{
+}
+{
+  parameterInfo(list) ( "," parameterInfo(list) )*
+  {
+  }
+}
+
+void parsePaths(List<ParameterizedAttribute> list) :
+{
+}
+{
+  pathInfo(list) ( "," pathInfo(list) )*
+  {
+  }
+}
+
+void packageInfo(List<PackageAttribute> list) :
+{
+   List<String> packages = new ArrayList<String>();
+   Map<String, Parameter> parameters = new HashMap<String, Parameter>();
+}
+{
+   packageNames(packages) ( ";" parsePackageParameters(parameters) )*
+   {
+      for(String pckg : packages)
+      {
+         list.add(new AbstractPackageAttribute(pckg, parameters));
+      }
+   }
+}
+
+void pathInfo(List<ParameterizedAttribute> list) :
+{
+   List<String> paths = new ArrayList<String>();
+   Map<String, Parameter> parameters = new HashMap<String, Parameter>();
+}
+{
+   pathNames(paths) ( ";" parsePathParameters(parameters) )+
+   {
+      for(String path : paths)
+      {
+         list.add(new AbstractPackageAttribute(path, parameters));
+      }
+   }
+}
+
+void parameterInfo(List<ParameterizedAttribute> list) :
+{
+   Token t;
+   Map<String, Parameter> parameters = new HashMap<String, Parameter>();
+}
+{
+   t = <QNAME> ( ";" parseAttributeParameters(parameters) )*
+   {
+      list.add(new AbstractParameterizedAttribute(t.toString(), parameters));
+   }
+}
+
+void packageNames(List<String> packages) :
+{
+	Token t;
+}
+{
+  t=<QNAME> {packages.add(t.image);} ( ";" packageNames(packages))*
+  |
+  t=<STAR> {packages.add(t.image);} ( ";" packageNames(packages))*
+}
+
+void pathNames(List<String> paths) :
+{
+	Token t;
+}
+{
+  t=<PATH> {paths.add(t.image);} ( ";" pathNames(paths))*
+}
+
+void parsePackageParameters(Map<String, Parameter> parameters) :
+{
+   Token t;
+}
+{
+   t = <DIRECTIVE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split(":=");
+      addParameter(parameters, params[0], params[1]);
+   }
+|
+   t = <ATTRIBUTE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split("=");
+      addParameter(parameters, params[0], params[1]);
+   }
+   ( ";" parsePackageParameters(parameters))*
+}
+
+void parseAttributeParameters(Map<String, Parameter> parameters) :
+{
+   Token t;
+}
+{
+   t = <DIRECTIVE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split(":=");
+      addParameter(parameters, params[0], params[1]);
+   }
+|
+   t = <ATTRIBUTE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split("=");
+      addParameter(parameters, params[0], params[1]);
+   }
+   ( ";" parseAttributeParameters(parameters))*
+}
+
+void parsePathParameters(Map<String, Parameter> parameters) :
+{
+   Token t;
+}
+{
+   t = <DIRECTIVE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split(":=");
+      addParameter(parameters, params[0], params[1]);
+   }
+|
+   t = <ATTRIBUTE>
+   {
+      String ts = t.toString();
+      String[] params = ts.split("=");
+      addParameter(parameters, params[0], params[1]);
+   }
+   ( ";" parsePathParameters(parameters))*
+}
+

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/osgi-beans_1_0.xsd
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/osgi-beans_1_0.xsd	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/osgi-beans_1_0.xsd	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * $Header: /cvshome/build/xmlns/scr/scr.xsd,v 1.12 2006/07/11 13:27:46 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.osgi.org/xmlns/scr/v1.0.0"
+        xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+   <annotation>
+      <documentation xml:lang="en">
+         This is the XML Schema for component descriptions used by the Service Component Runtime (SCR).
+         Component description documents may be embedded in other XML documents. The SCR will
+         process all XML documents listed in the Service-Component manifest header of a bundle.
+         XML documents containing component descriptions may contain a single, root component
+         element or one or more component elements embedded in a larger document. Use of the
+         namespace is optional if the document only contains a root component element. In this
+         case, the scr namespace is assumed. Otherwise the namespace must be used.
+      </documentation>
+   </annotation>
+
+   <element name="component" type="scr:Tcomponent"/>
+
+   <complexType name="Tcomponent">
+      <annotation>
+         <documentation xml:lang="en">
+            Implementations of SCR must not require component descriptions to specify the subelements
+            of the component element in the order as required by the schema. SCR implementations must
+            allow other orderings since arbitrary orderings do not affect the meaning of the component
+            description. Only the relative ordering of property and properties element have meaning.
+         </documentation>
+      </annotation>
+      <sequence>
+         <element name="implementation" type="scr:Timplementation" minOccurs="1" maxOccurs="1"/>
+         <choice minOccurs="0" maxOccurs="unbounded">
+            <element name="property" type="scr:Tproperty"/>
+            <element name="properties" type="scr:Tproperties"/>
+         </choice>
+         <element name="service" type="scr:Tservice" minOccurs="0" maxOccurs="1"/>
+         <element name="reference" type="scr:Treference" minOccurs="0" maxOccurs="unbounded"/>
+      </sequence>
+      <attribute name="enabled" type="boolean" default="true" use="optional"/>
+      <attribute name="name" type="token" use="required"/>
+      <attribute name="factory" type="string" use="optional"/>
+      <attribute name="immediate" type="boolean" use="optional"/>
+   </complexType>
+
+   <complexType name="Timplementation">
+      <attribute name="class" type="token" use="required"/>
+   </complexType>
+
+   <complexType name="Tproperty">
+      <simpleContent>
+         <extension base="string">
+            <attribute name="name" type="string" use="required"/>
+            <attribute name="value" type="string" use="optional"/>
+            <attribute name="type" type="scr:TjavaTypes" default="String" use="optional"/>
+         </extension>
+      </simpleContent>
+   </complexType>
+
+   <complexType name="Tproperties">
+      <attribute name="entry" type="string" use="required"/>
+   </complexType>
+
+   <complexType name="Tservice">
+      <sequence>
+         <element name="provide" type="scr:Tprovide" minOccurs="1" maxOccurs="unbounded"/>
+      </sequence>
+      <attribute name="servicefactory" type="boolean" default="false" use="optional"/>
+   </complexType>
+
+   <complexType name="Tprovide">
+      <attribute name="interface" type="token" use="required"/>
+   </complexType>
+
+   <complexType name="Treference">
+      <attribute name="name" type="NMTOKEN" use="required"/>
+      <attribute name="interface" type="token" use="required"/>
+      <attribute name="cardinality" type="scr:Tcardinality" default="1..1" use="optional"/>
+      <attribute name="policy" type="scr:Tpolicy" default="static" use="optional"/>
+      <attribute name="target" type="string" use="optional"/>
+      <attribute name="bind" type="token" use="optional"/>
+      <attribute name="unbind" type="token" use="optional"/>
+   </complexType>
+
+   <simpleType name="TjavaTypes">
+      <restriction base="string">
+         <enumeration value="String"/>
+         <enumeration value="Long"/>
+         <enumeration value="Double"/>
+         <enumeration value="Float"/>
+         <enumeration value="Integer"/>
+         <enumeration value="Byte"/>
+         <enumeration value="Char"/>
+         <enumeration value="Boolean"/>
+         <enumeration value="Short"/>
+      </restriction>
+   </simpleType>
+
+   <simpleType name="Tcardinality">
+      <restriction base="string">
+         <enumeration value="0..1"/>
+         <enumeration value="0..n"/>
+         <enumeration value="1..1"/>
+         <enumeration value="1..n"/>
+      </restriction>
+   </simpleType>
+
+   <simpleType name="Tpolicy">
+      <restriction base="string">
+         <enumeration value="static"/>
+         <enumeration value="dynamic"/>
+      </restriction>
+   </simpleType>
+
+</schema>
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/main/resources/schema/osgi-beans_1_0.xsd
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiAllTestSuite.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiAllTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiAllTestSuite.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.test.bundle.BundleTestSuite;
+
+/**
+ * OSGi All Test Suite
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class OSGiAllTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("OSGi All Tests");
+
+      suite.addTest(BundleTestSuite.suite());
+
+      return suite;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiAllTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test;
+
+import java.net.URL;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+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.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * OSGiTestCase - Parent Test Case for OSGi tests.  
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public abstract class OSGiTestCase extends MicrocontainerTest
+{
+
+   /**
+    * Create a new OSGiTestCase.
+    * 
+    * @param name the test name
+    */
+   public OSGiTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Get the AbstractTestDelegate
+    * 
+    * @param clazz the test class
+    * @return The AbstractTestDelegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      return new OSGiTestDelegate(clazz);
+   }
+
+   /**
+    * Get OSGiTestDelegate
+    */
+   protected OSGiTestDelegate getDelegate()
+   {
+      return (OSGiTestDelegate) super.getDelegate();
+   }
+
+   /**
+    * Get DeployerClient from Delegate
+    * 
+    * @return The DeployerClient
+    */
+   protected DeployerClient getDeployerClient()
+   {
+      return getDelegate().getMainDeployer();
+   }
+
+   /**
+    * Assert the given DeploymentUnit is in the specified DeployemntStage
+    * 
+    * @param unit A DeploymentUnit
+    * @param stage A DeploymentStage
+    * @throws DeploymentException If the DeployerClient is unable to determine the current stage
+    */
+   protected void assertStage(DeploymentUnit unit, DeploymentStage stage) throws DeploymentException
+   {
+      assertEquals(stage, getDeployerClient().getDeploymentStage(unit.getName()));
+   }
+
+   /**
+    * Create a VFSDeployment
+    * 
+    * @param root the root location of the deployment
+    * @param child the child to deploy
+    * @return VFSDeployment
+    * @throws Exception for any error
+    */
+   protected VFSDeployment createVFSDeployment(String root, String child) throws Exception
+   {
+      URL resourceRoot = getClass().getResource(root);
+      if (resourceRoot == null)
+         fail("Resource not found: " + root);
+      VirtualFile deployment = VFS.getVirtualFile(resourceRoot, child);
+      if (deployment == null)
+         fail("Child not found " + child + " from " + resourceRoot);
+      return createVFSDeployment(deployment);
+   }
+
+   /**
+    * Create a VFSDeployment
+    * 
+    * @param root the VirtualFile to deploy
+    * @return VFSDeployment
+    * @throws Exception for any error
+    */
+   protected VFSDeployment createVFSDeployment(VirtualFile root) throws Exception
+   {
+      VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
+      return factory.createVFSDeployment(root);
+   }
+
+   /**
+    * Create a VFSDeployment and add the Deployment to the DeployerClient, and return the DeploymentUnit 
+    * 
+    * @param root the location of the VirtualFile to deploy
+    * @param child the child to deploy
+    * @return VFSDeploymentUnit for the deployment
+    * @throws Exception for any error
+    */
+   protected VFSDeploymentUnit addDeployment(String root, String child) throws Exception
+   {
+      VFSDeployment deployment = createVFSDeployment(root, child);
+      getDeployerClient().addDeployment(deployment);
+      getDeployerClient().process();
+      return (VFSDeploymentUnit) getMainDeployerStructure().getDeploymentUnit(deployment.getName(), true);
+   }
+
+   /**
+    * Remove a deployment
+    * 
+    * @param unit the deployment unit
+    * @throws Exception for any error
+    */
+   protected void removeDeployment(DeploymentUnit unit) throws Exception
+   {
+      getDeployerClient().undeploy(unit.getName());
+   }
+   
+   /**
+    * Get MainDeployerStructure from Delegate
+    * 
+    * @return MainDeployerStructure
+    */
+   protected MainDeployerStructure getMainDeployerStructure()
+   {
+      return getDelegate().getMainDeployer();
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestDelegate.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestDelegate.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestDelegate.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test;
+
+import java.net.URL;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData10;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * A OSGiTestDelegate
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class OSGiTestDelegate extends MicrocontainerTestDelegate
+{
+   private MainDeployerImpl mainDeployer;
+
+   static
+   {
+      DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+      resolver.addClassBinding("urn:jboss:classloader:1.0", VFSClassLoaderFactory10.class);
+      resolver.addClassBinding("urn:jboss:classloading:1.0", ClassLoadingMetaData10.class);
+   }
+
+   /**
+    * Create a new OSGiTestDelegate.
+    * 
+    * @param clazz
+    * @throws Exception
+    */
+   public OSGiTestDelegate(Class<?> clazz) throws Exception
+   {
+      super(clazz);
+   }
+   
+   /**
+    * Deploys the bootstrap.xml bean descriptor to setup OSGi deployers
+    */
+   protected void deploy() throws Exception
+   {
+      String common = "/bootstrap/bootstrap.xml";
+      URL url = getClass().getResource(common);
+      if (url == null)
+         throw new IllegalStateException(common + " not found");
+      deploy(url);
+
+      super.deploy();
+   }
+   
+   /**
+    * Get the MainDeployer bean from the MC
+    * 
+    * @return MainDeployerImpl
+    */
+   protected MainDeployerImpl getMainDeployer()
+   {
+      if (mainDeployer == null)
+         mainDeployer = getBean("MainDeployer", ControllerState.INSTALLED, MainDeployerImpl.class);
+      return mainDeployer;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/OSGiTestDelegate.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/BundleTestSuite.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/BundleTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/BundleTestSuite.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.test.bundle.facade.FacadeTestSuite;
+import org.jboss.test.bundle.helper.BundleHelperTestSuite;
+import org.jboss.test.bundle.metadata.MetaDataTestSuite;
+
+/**
+ * Bundle Test Suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ */
+public class BundleTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Bundle Tests");
+
+      suite.addTest(FacadeTestSuite.suite());
+      suite.addTest(MetaDataTestSuite.suite());
+      suite.addTest(BundleHelperTestSuite.suite());
+
+      return suite;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/BundleTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/BundleImplTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/BundleImplTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/BundleImplTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,348 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.facade;
+
+import java.net.URL;
+import java.util.Enumeration;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.plugins.facade.BundleImpl;
+import org.jboss.test.OSGiTestCase;
+import org.osgi.framework.Bundle;
+
+/**
+ * A BundleImplTestCase.
+ *
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleImplTestCase extends OSGiTestCase
+{
+   private Bundle bundle;
+
+   private DeploymentUnit deploymentUnit;
+
+   /**
+    * Create a new BundleImplTestCase.
+    *
+    * @param name the test name
+    */
+   public BundleImplTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Get suite for test
+    *
+    * @return test suite
+    */
+   public static Test suite()
+   {
+      return suite(BundleImplTestCase.class);
+   }
+
+   /**
+    * Setup test
+    */
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      deploymentUnit = addDeployment("/bundle", "simple.jar");
+      bundle = new BundleImpl(deploymentUnit);
+   }
+
+   /**
+    * Test the getState method.  Should correctly call DeploymentStage2BundleStateMapper
+    *
+    * @throws Exception for any error
+    */
+   public void testGetBundleState() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.NOT_INSTALLED);
+      assertEquals(Bundle.UNINSTALLED, bundle.getState());
+
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.CLASSLOADER);
+      assertEquals(Bundle.RESOLVED, bundle.getState());
+
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.REAL);
+      assertEquals(Bundle.STARTING, bundle.getState());
+
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.INSTALLED);
+      assertEquals(Bundle.ACTIVE, bundle.getState());
+   }
+
+   /**
+    * Returns the DeploymentContext.name as the Unique name
+    *
+    * @throws Exception for any error
+    */
+   public void testGetSymbolicName() throws Exception
+   {
+      assertEquals(deploymentUnit.getName(), bundle.getSymbolicName());
+   }
+
+   /**
+    * Returns the id for a Bundle
+    *
+    * @throws Exception for any error
+    */
+   public void testGetBundleId() throws Exception
+   {
+      assertEquals(deploymentUnit.getName().hashCode(), bundle.getBundleId());
+   }
+
+   /**
+    * Verifies the Bundle.start method calls the MainDeployer.change method with the INSTALL DeploymentStage
+    *
+    * @throws Exception for any error
+    */
+   public void testStartBundle() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.NOT_INSTALLED);
+      assertStage(deploymentUnit, DeploymentStages.NOT_INSTALLED); // Sanity Check...
+      bundle.start();
+      assertStage(deploymentUnit, DeploymentStages.INSTALLED);
+   }
+
+   /**
+    * Verifies the Bundle.stop method calls the MainDeployer.change method with the DESCRIBE DeploymentStage
+    *
+    * @throws Exception for any error
+    */
+   public void testStopBundle() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.INSTALLED);
+      assertStage(deploymentUnit, DeploymentStages.INSTALLED); // Sanity Check...
+      bundle.stop();
+      assertStage(deploymentUnit, DeploymentStages.DESCRIBE);
+   }
+
+   /**
+    * Verifies the Bundle.uninstall method calls the MainDeployer.change method with the NOT_INSTALLED DeploymentStage
+    *
+    * @throws Exception for any error
+    */
+   public void testUninstallBundle() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.INSTALLED);
+      assertStage(deploymentUnit, DeploymentStages.INSTALLED); // Sanity Check...
+      bundle.uninstall();
+      assertStage(deploymentUnit, DeploymentStages.NOT_INSTALLED);
+   }
+
+   /**
+    * Test the Bundle.loadClass method with valid class
+    *
+    * @throws Exception for any error
+    */
+   public void testLoadClass() throws Exception
+   {
+      Class<?> testClass = bundle.loadClass("org.jboss.test.bundle.support.TestActivator");
+      assertNotNull(testClass);
+   }
+
+   /**
+    * Test Bundle.loadClass with a missing class.  Should throw normal ClassNotFound
+    *
+    * @throws Exception for any error
+    */
+   public void testLoadClassNotFound() throws Exception
+   {
+      try
+      {
+         bundle.loadClass("org.jboss.test.bundle.support.MissingClass");
+         fail("Should have thrown ClassNotFoundException");
+      }
+      catch (ClassNotFoundException expectedException)
+      {
+         assertEquals("org.jboss.test.bundle.support.MissingClass", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test Bundle.loadClass with no ClassLoader.  Should throw ClassNotFound with message relating to missing classloader
+    *
+    * @throws Exception for any error
+    */
+   public void testLoadClassNoClassLoaderForDeployment() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.DESCRIBE);
+      try
+      {
+         bundle.loadClass("org.jboss.test.bundle.support.MissingClass");
+         fail("Should have thrown ClassNotFoundException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("ClassLoader has not been set", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test Bundle.loadClass with a DeploymentUnit that is in the NOT_INSTALLED stage, should throw IllegalStateException.
+    *
+    * @throws Exception for any error
+    */
+   public void testLoadClassBundleUninstalled() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.NOT_INSTALLED);
+      try
+      {
+         bundle.loadClass("org.jboss.test.bundle.support.MissingClass");
+         fail("Should have thrown ClassNotFoundException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("Bundle has been uninstalled", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test the Bundle.getResource method with valid resource
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResource() throws Exception
+   {
+      URL resource = bundle.getResource("org/jboss/test/bundle/metadata/Manifest.mf");
+      assertNotNull(resource);
+   }
+
+   /**
+    * Test the Bundle.getResource method with missing resource
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResourceMissingResource() throws Exception
+   {
+      URL resource = bundle.getResource("org/jboss/test/bundle/metadata/Missing.mf");
+      assertNull(resource);
+   }
+
+   /**
+    * Test the Bundle.getResource method with missing DeploymentUnit ClassLoader
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResourceNoClassLoaderForDeploymentUnit() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.DESCRIBE);
+      try
+      {
+         bundle.getResource("org/jboss/test/bundle/metadata/Manifest.mf");
+         fail("Should have thrown IllegalStateException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("ClassLoader has not been set", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test the Bundle.getResource method for an uninstalled Bundle
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResourceBundleUnintalled() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.NOT_INSTALLED);
+      try
+      {
+         bundle.getResource("org/jboss/test/bundle/metadata/Manifest.mf");
+         fail("Should have thrown IllegalStateException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("Bundle has been uninstalled", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test the Bundle.getResources method with valid resource
+    *
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testGetResources() throws Exception
+   {
+      Enumeration<URL> resources = bundle.getResources("org/jboss/test/bundle/metadata/Manifest.mf");
+      assertNotNull(resources);
+      assertTrue(resources.hasMoreElements());
+   }
+
+   /**
+    * Test the Bundle.getResources method with missing resource
+    *
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testGetResourceMissingResources() throws Exception
+   {
+      Enumeration<URL> resources = bundle.getResources("org/jboss/test/bundle/metadata/Missing.mf");
+      assertNotNull(resources);
+      assertFalse(resources.hasMoreElements());
+   }
+
+   /**
+    * Test the Bundle.getResources method with missing DeploymentUnit ClassLoader
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResourcesNoClassLoaderForDeploymentUnit() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.DESCRIBE);
+      try
+      {
+         bundle.getResources("org/jboss/test/bundle/metadata/Manifest.mf");
+         fail("Should have thrown IllegalStateException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("ClassLoader has not been set", expectedException.getMessage());
+      }
+   }
+
+   /**
+    * Test the Bundle.getResources method with missing DeploymentUnit ClassLoader
+    *
+    * @throws Exception for any error
+    */
+   public void testGetResourcesUninstalled() throws Exception
+   {
+      getDeployerClient().change(deploymentUnit.getName(), DeploymentStages.NOT_INSTALLED);
+      try
+      {
+         bundle.getResources("org/jboss/test/bundle/metadata/Manifest.mf");
+         fail("Should have thrown IllegalStateException");
+      }
+      catch (IllegalStateException expectedException)
+      {
+         assertEquals("Bundle has been uninstalled", expectedException.getMessage());
+      }
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/BundleImplTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/FacadeTestSuite.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/FacadeTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/FacadeTestSuite.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,48 @@
+/*
+ * 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.bundle.facade;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Bundle facade test suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FacadeTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Bundle Facade Tests");
+
+      suite.addTest(BundleImplTestCase.suite());
+
+      return suite;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/facade/FacadeTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/AbstractBundleEntryTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/AbstractBundleEntryTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/AbstractBundleEntryTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.helper;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.jboss.test.OSGiTestCase;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A AbsractBundleEntryTestCase - used for helper classes or Bundle entries
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public abstract class AbstractBundleEntryTestCase extends OSGiTestCase
+{
+   /**
+    * Create a new AbsractBundleEntryTestCase.
+    * 
+    * @param name the test name
+    */
+   public AbstractBundleEntryTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Assert a returned entry is the expected virtual file based on the root VirtualFile and path
+    * 
+    * @param root Root VirtualFile to get path
+    * @param virualFilePath a path to a virtual file in the root
+    * @param entryUrl a URL to an entry to assert same as expected path
+    * @throws IOException for any io error
+    * @throws URISyntaxException for any uri syntax error
+    */
+   protected void assertEntry(VirtualFile root, String virualFilePath, URL entryUrl) throws IOException, URISyntaxException
+   {
+      VirtualFile expectedEntry = root.getChild(virualFilePath);
+      assertNotNull("Invalid assertiong.  Expected file does not exisist", expectedEntry); // Sanity check
+
+      assertEquals(expectedEntry.toURL(), entryUrl);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/AbstractBundleEntryTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryHelperTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryHelperTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryHelperTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.helper;
+
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.TreeSet;
+
+import junit.framework.Test;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.osgi.plugins.facade.helpers.BundleEntryHelper;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A BundleEntryHelperTestCase.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleEntryHelperTestCase extends AbstractBundleEntryTestCase
+{
+   private VirtualFile root;
+
+   private DeploymentUnit deploymentUnit;
+
+   /**
+    * Create a new BundleEntryHelperTestCase.
+    * 
+    * @param name the test name
+    */
+   public BundleEntryHelperTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Get Suite for BundleEntryHelperTestCase
+    * 
+    * @return test suite
+    */
+   public static Test suite()
+   {
+      return suite(BundleEntryHelperTestCase.class);
+   }
+
+   /**
+    * Setup the test
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      deploymentUnit = addDeployment("/bundle", "simple.jar");
+      root = VFSDeploymentUnit.class.cast(deploymentUnit).getRoot();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      if (deploymentUnit != null)
+      {
+         try
+         {
+            removeDeployment(deploymentUnit);
+         }
+         catch (Exception ignored)
+         {
+            getLog().warn("Ignored undeployment error", ignored);
+         }
+         finally
+         {
+            deploymentUnit = null;
+            root = null;
+         }
+      }
+      super.tearDown();
+   }
+
+   /**
+    * Test findEntryMethod
+    * 
+    * @throws Exception for any error
+    */
+   public void testGetEntry() throws Exception
+   {
+      URL entry = BundleEntryHelper.getEntry(deploymentUnit, "META-INF/Manifest.mf");
+      assertNotNull(entry);
+      assertEntry(root, "META-INF/Manifest.mf", entry);
+   }
+
+   /**
+    * Test findEntryMethod with no results
+    * 
+    * @throws Exception for any error
+    */
+   public void testGetEntryNoResult() throws Exception
+   {
+      URL entry = BundleEntryHelper.getEntry(deploymentUnit, "META-INF/missing.mf");
+      assertNull(entry);
+   }
+
+   /**
+    * Test findEntryMethod
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testGetEntryPaths() throws Exception
+   {
+      Enumeration<String> entries = BundleEntryHelper.getEntryPaths(deploymentUnit, "META-INF/");
+      assertNotNull(entries);
+      Set<String> expected = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+      expected.add("simple.jar/META-INF/jboss-service.xml");
+      expected.add("simple.jar/META-INF/Manifest.mf");
+      while (entries.hasMoreElements())
+         expected.remove(entries.nextElement());
+      assertEmpty("Missing " + expected, expected);      
+   }
+
+   /**
+    * Test findEntryMethod with no results
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testGetEntryPathsNoResult() throws Exception
+   {
+      // TODO MAKE WORK WITH MAVEN
+      assertNull(BundleEntryHelper.getEntryPaths(deploymentUnit, "org/jboss/osgi/empty"));
+   }
+
+   /**
+    * Test findEntryMethod with missing path
+    * 
+    * @throws Exception for any error
+    */
+   public void testGetEntryPathsMissingDirPath() throws Exception
+   {
+      assertNull(BundleEntryHelper.getEntryPaths(deploymentUnit, "mising/path"));
+   }
+
+   /**
+    * Test finding entries without wild cards (*)
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testFindEntriesNoWildCard() throws Exception
+   {
+      Enumeration<URL> entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "Manifest.mf", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/META-INF/Manifest.mf", entries.nextElement());
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/org", "custom.properties", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", entries.nextElement());
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/org/jboss", "custom.xml", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", entries.nextElement());
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "fromroot.xml", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/fromroot.xml", entries.nextElement());
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "bogus.txt", true);
+      assertNull(entries);
+   }
+
+   /**
+    * Test finding entries without wild cards (*) or recursion 
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testFindEntriesNoWildCardOrRecurse() throws Exception
+   {
+      Enumeration<URL> entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "Manifest.mf", false);
+      assertNull(entries);
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "fromroot.xml", false);
+      assertEntry(root, "/fromroot.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements() == false);
+   }
+
+   /**
+    * Test finding entries with wild cards (*)  
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testFindEntriesWildCard() throws Exception
+   {
+      // starts with wildcard
+      Enumeration<URL> entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "*.mf", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/META-INF/Manifest.mf", entries.nextElement());
+
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/org/jboss", "*.properties", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", entries.nextElement());
+
+      // starts with wildcard and matches multiple
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "/", "*.xml", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/META-INF/jboss-service.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/fromroot.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements() == false);
+
+      // ends in wildcard and matches multiple
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "org/", "custom*", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements() == false);
+
+      // begins and ends with wildcard
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "org/", "*xml*", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/notanxmlfile.txt", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements() == false);
+
+      // wildcard within
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "META-INF/", "jboss*.xml", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/META-INF/jboss-service.xml", entries.nextElement());
+
+      // several wildcards
+      entries = BundleEntryHelper.findEntries(deploymentUnit, "org/", "*t*xml*", true);
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/notanxmlfile.txt", entries.nextElement());
+      assertTrue(entries.hasMoreElements());
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", entries.nextElement());
+      assertTrue(entries.hasMoreElements() == false);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryHelperTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryVisitorTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryVisitorTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryVisitorTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.helper;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.osgi.plugins.facade.helpers.BundleEntryVisitor;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A BundleEntryVisitorTest.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleEntryVisitorTestCase extends AbstractBundleEntryTestCase
+{
+   /** The root */
+   private VirtualFile root;
+
+   /**
+    * Create a new BundleEntryVisitorTest.
+    * 
+    * @param name the test name
+    */
+   public BundleEntryVisitorTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Get Suite for BundleEntryVisitorTest
+    * 
+    * @return the test
+    */
+   public static Test suite()
+   {
+      return suite(BundleEntryVisitorTestCase.class);
+   }
+
+   /**
+    * Setup the test
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      DeploymentUnit deploymentUnit = addDeployment("/bundle", "simple.jar");
+      root = VFSDeploymentUnit.class.cast(deploymentUnit).getRoot();
+   }
+
+   /**
+    * Test finding entries without wild cards (*)
+    * 
+    * @throws Exception for any error
+    */
+   public void testFindEntriesNoWildCard() throws Exception
+   {
+      BundleEntryVisitor visitor = new BundleEntryVisitor("Manifest.mf", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+
+      assertEntry(root, "/META-INF/Manifest.mf", visitor.getEntries().get(0));
+
+      visitor = new BundleEntryVisitor("custom.properties", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", visitor.getEntries().get(0));
+
+      visitor = new BundleEntryVisitor("custom.xml", true);
+      root.visit(visitor);
+      assertEquals(2, visitor.getEntries().size());
+
+      assertEntry(root, "/org/jboss/osgi/custom.xml", visitor.getEntries().get(0));
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", visitor.getEntries().get(1));
+
+      visitor = new BundleEntryVisitor("fromroot.xml", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(0));
+
+      visitor = new BundleEntryVisitor("bogus.txt", false);
+      root.visit(visitor);
+      assertEquals(0, visitor.getEntries().size());
+   }
+
+   /**
+    * Test finding entries without wild cards (*) or recursion 
+    * 
+    * @throws Exception for any error
+    */
+   public void testFindEntriesNoWildCardOrRecurse() throws Exception
+   {
+      BundleEntryVisitor visitor = new BundleEntryVisitor("Manifest.mf", false);
+      root.visit(visitor);
+      assertEquals(0, visitor.getEntries().size());
+
+      visitor = new BundleEntryVisitor("custom.properties", false);
+      root.visit(visitor);
+      assertEquals(0, visitor.getEntries().size());
+
+      visitor = new BundleEntryVisitor("fromroot.xml", false);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(0));
+   }
+
+   /**
+    * Test finding entries with wild cards (*)  
+    * 
+    * @throws Exception for any error
+    */
+   public void testFindEntriesWildCard() throws Exception
+   {
+      // starts with wildcard
+      BundleEntryVisitor visitor = new BundleEntryVisitor("*.mf", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/META-INF/Manifest.mf", visitor.getEntries().get(0));
+
+      visitor = new BundleEntryVisitor("*.properties", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", visitor.getEntries().get(0));
+
+      // starts with wildcard and matches multiple
+      visitor = new BundleEntryVisitor("*.xml", true);
+      root.visit(visitor);
+      assertEquals(4, visitor.getEntries().size());
+      assertEntry(root, "/META-INF/jboss-service.xml", visitor.getEntries().get(0));
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(1));
+      assertEntry(root, "/org/jboss/osgi/custom.xml", visitor.getEntries().get(2));
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", visitor.getEntries().get(3));
+
+      // ends in wildcard and matches multiple
+      visitor = new BundleEntryVisitor("custom*", true);
+      root.visit(visitor);
+      assertEquals(3, visitor.getEntries().size());
+      assertEntry(root, "/org/jboss/osgi/custom.xml", visitor.getEntries().get(0));
+      assertEntry(root, "/org/jboss/osgi/test/custom.properties", visitor.getEntries().get(1));
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", visitor.getEntries().get(2));
+
+      // begins and ends with wildcard
+      visitor = new BundleEntryVisitor("*xml*", true);
+      root.visit(visitor);
+      assertEquals(5, visitor.getEntries().size());
+      assertEntry(root, "/META-INF/jboss-service.xml", visitor.getEntries().get(0));
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(1));
+      assertEntry(root, "/org/jboss/osgi/custom.xml", visitor.getEntries().get(2));
+      assertEntry(root, "/org/jboss/osgi/notanxmlfile.txt", visitor.getEntries().get(3));
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", visitor.getEntries().get(4));
+
+      // wildcard within
+      visitor = new BundleEntryVisitor("jboss*.xml", true);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/META-INF/jboss-service.xml", visitor.getEntries().get(0));
+
+      // several wildcards
+      visitor = new BundleEntryVisitor("*t*xml*", true);
+      root.visit(visitor);
+      assertEquals(4, visitor.getEntries().size());
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(0));
+      assertEntry(root, "/org/jboss/osgi/custom.xml", visitor.getEntries().get(1));
+      assertEntry(root, "/org/jboss/osgi/notanxmlfile.txt", visitor.getEntries().get(2));
+      assertEntry(root, "/org/jboss/osgi/test/custom.xml", visitor.getEntries().get(3));
+   }
+
+   /**
+    * Test finding entries with wild cards (*) and no recursion 
+    * 
+    * @throws Exception for any error
+    */
+   public void testFindEntriesWildCardNoRecurse() throws Exception
+   {
+
+      BundleEntryVisitor visitor = new BundleEntryVisitor("*.mf", false);
+      root.visit(visitor);
+      assertEquals(0, visitor.getEntries().size());
+
+      visitor = new BundleEntryVisitor("custom.*", false);
+      root.visit(visitor);
+      assertEquals(0, visitor.getEntries().size());
+
+      visitor = new BundleEntryVisitor("*.xml", false);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(0));
+
+      visitor = new BundleEntryVisitor("*xml*", false);
+      root.visit(visitor);
+      assertEquals(1, visitor.getEntries().size());
+      assertEntry(root, "/fromroot.xml", visitor.getEntries().get(0));
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleEntryVisitorTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHeaderTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHeaderTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHeaderTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.helper;
+
+import java.util.Dictionary;
+
+import junit.framework.Test;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.osgi.plugins.facade.helpers.BundleHeaders;
+import org.jboss.test.BaseTestCase;
+import org.osgi.framework.Constants;
+
+/**
+ * A BundleHeaderTestCase.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleHeaderTestCase extends BaseTestCase
+{
+   private BundleHeaders bundleHeaders;
+
+   /**
+    * Create a new BundleHeaderTestCase.
+    * 
+    * @param name the test name
+    */
+   public BundleHeaderTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Get test suite
+    * 
+    * @return the test
+    */
+   public static Test suite()
+   {
+      return suite(BundleHeaderTestCase.class);
+   }
+
+   /**
+    * Setup test
+    */
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      DeploymentContext deploymentContext = new AbstractDeploymentContext("aDeployment", "/test.jar");
+
+      DeploymentUnit deploymentUnit = new AbstractDeploymentUnit(deploymentContext);
+
+      ClassLoadingMetaData clMetaData = new ClassLoadingMetaData();
+      clMetaData.getCapabilities().addCapability(new PackageCapability("org.jboss.test", new Version(1,2,0)));
+      clMetaData.getCapabilities().addCapability(new PackageCapability("org.jboss.test.other", new Version(1,5,0)));
+            
+      clMetaData.getRequirements().addRequirement(new PackageRequirement("org.jboss.test", new VersionRange(new Version(1,2,0))));
+      clMetaData.getRequirements().addRequirement(new PackageRequirement("org.jboss.test.other", new VersionRange(new Version(1,5,0),new Version(2,0,1))));
+      deploymentUnit.addAttachment(ClassLoadingMetaData.class, clMetaData);
+      
+      bundleHeaders = new BundleHeaders(deploymentUnit);
+   }
+   /**
+    * Test getting BundleHeaders as a Dictionary
+    * 
+    * @throws Exception for any error
+    */
+   @SuppressWarnings("unchecked")
+   public void testToDictionary() throws Exception
+   {
+      Dictionary<String, Object> headers = bundleHeaders.toDictionary();
+      assertNotNull(headers);
+      assertEquals("org.jboss.test;version=1.2.0,org.jboss.test.other;version=1.5.0", headers.get(Constants.EXPORT_PACKAGE));
+      assertEquals("org.jboss.test;version=[1.2.0,?),org.jboss.test.other;version=[1.5.0,2.0.1)", headers.get(Constants.IMPORT_PACKAGE));
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHeaderTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHelperTestSuite.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHelperTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHelperTestSuite.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.helper;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * A BundleHelperTestSuite.
+ * 
+ * @author <a href="baileyje at gmail.com">John Bailey</a>
+ * @version $Revision$
+ */
+public class BundleHelperTestSuite extends TestSuite
+{
+   /**
+    * Run test using TestRunner
+    * 
+    * @param args the args
+    */
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   /**
+    * Get suite of BundleHelper tests
+    * 
+    * @return suite for test
+    */
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("Bundle Helper Tests");
+
+      suite.addTest(BundleHeaderTestCase.suite());
+      suite.addTest(BundleEntryVisitorTestCase.suite());
+      suite.addTest(BundleEntryHelperTestCase.suite());
+
+      return suite;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/helper/BundleHelperTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/AbstractManifestTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/AbstractManifestTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/AbstractManifestTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.metadata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.jar.Manifest;
+
+import org.jboss.test.BaseTestCase;
+
+/**
+ * Uses Manifest.mf file for actual tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractManifestTestCase extends BaseTestCase
+{
+   protected AbstractManifestTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected String createName(String prefix)
+   {
+      if (prefix == null)
+         prefix = "";
+      return prefix + "Manifest.mf";
+   }
+
+   protected Manifest getManifest(String name) throws IOException
+   {
+      InputStream is = getManifestInputStream(name);
+      try
+      {
+         return new Manifest(is);
+      }
+      finally
+      {
+         is.close();
+      }
+   }
+
+   protected InputStream getManifestInputStream(String name) throws IOException
+   {
+      URL url = getResource(name);
+      if (url == null)
+         fail(name + " not found");
+      return url.openStream();
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/AbstractManifestTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/HeaderValuesTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/HeaderValuesTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/HeaderValuesTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,251 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.metadata;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Manifest;
+import java.io.Serializable;
+
+import junit.framework.Test;
+import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractPackageAttribute;
+import org.jboss.osgi.plugins.metadata.AbstractParameter;
+import org.jboss.osgi.plugins.metadata.AbstractParameterizedAttribute;
+import org.jboss.osgi.plugins.metadata.OSGiParameters;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.jboss.osgi.spi.metadata.ActivationPolicyMetaData;
+import org.osgi.framework.Version;
+
+/**
+ * Test OSGi header values.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class HeaderValuesTestCase extends AbstractManifestTestCase
+{
+   public HeaderValuesTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(HeaderValuesTestCase.class);
+   }
+
+   public void testSerializable() throws Exception
+   {
+      Manifest manifest = getManifest(createName(null));
+      OSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
+      ActivationPolicyMetaData apmd = metaData.getBundleActivationPolicy();
+      assertNotNull(apmd);
+
+      metaData = serializeDeserialize((Serializable)metaData, OSGiMetaData.class);
+      String vendor = metaData.getMainAttribute("Implementation-Vendor");
+      assertEquals("jboss.org", vendor);
+      String bundleName = metaData.getBundleName();
+      assertEquals("SomeBundleName", bundleName);
+      apmd = metaData.getBundleActivationPolicy();
+      List<String> includes = apmd.getIncludes();
+      assertEquals(includes, Arrays.asList("org.jboss"));
+      List<String> excludes = apmd.getExcludes();
+      assertEquals(excludes, Arrays.asList("com.acme"));
+   }
+
+   public void testSimpleManifest() throws Exception
+   {
+      Manifest manifest = getManifest(createName("Simple"));
+      OSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
+
+      assertEquals(metaData.getBundleActivator(), "org.jboss.test.bundle.metadata.BundleActivator");
+      List<String> classpath = Arrays.asList("test.jar", "mc.jar", "seam.jar");
+      assertEquals(metaData.getBundleClassPath(), classpath);
+      assertEquals(metaData.getBundleDescription(), "TestHeadersManifest");
+      assertEquals(metaData.getBundleLocalization(), "OSGI-INF/l10n/bundle");
+      assertEquals(metaData.getBundleManifestVersion(), 2);
+      assertEquals(metaData.getBundleName(), "TestBundle");
+      assertEquals(metaData.getBundleSymbolicName(), "UniqueName");
+      URL url = new URL("file://test.jar");
+      assertEquals(metaData.getBundleUpdateLocation(), url);
+      Version version = new Version("1.2.3.GA");
+      assertEquals(metaData.getBundleVersion(), version);
+      List<String> env = Arrays.asList("ena", "dva", "tri");
+      assertEquals(metaData.getRequiredExecutionEnvironment(), env);
+   }
+
+   public void testJavaccManifest() throws Exception
+   {
+      Manifest manifest = getManifest(createName("JavaCC"));
+      OSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
+
+      List<ParameterizedAttribute> bundleNativeCode = new ArrayList<ParameterizedAttribute>();
+      Map<String, Parameter> bnc1 = new HashMap<String, Parameter>();
+      bnc1.put("osname", new AbstractParameter("QNX"));
+      bnc1.put("osversion", new AbstractParameter("3.1"));
+      bundleNativeCode.add(new AbstractPackageAttribute("/lib/http.DLL", bnc1));
+      Map<String, Parameter> bnc2 = new HashMap<String, Parameter>();
+      bnc2.put("osname", new AbstractParameter("QWE"));
+      bnc2.put("osversion", new AbstractParameter("4.0"));
+      bundleNativeCode.add(new AbstractPackageAttribute("/lib/tcp.DLL", bnc2));
+      bundleNativeCode.add(new AbstractPackageAttribute("/lib/iiop.DLL", bnc2));
+      List<ParameterizedAttribute> metadataBNC = metaData.getBundleNativeCode();
+      assertNotNull(metadataBNC);
+      assertEquals(bundleNativeCode.size(), metadataBNC.size());
+      for(int i=0; i < metadataBNC.size(); i++)
+      {
+         ParameterizedAttribute paMD = metadataBNC.get(i);
+         ParameterizedAttribute myPA = bundleNativeCode.get(i);
+         assertEquals(paMD.getAttribute(), myPA.getAttribute());
+         assertEquals(paMD.getParameters(), myPA.getParameters());
+      }
+
+      List<PackageAttribute> dynamicImports = new ArrayList<PackageAttribute>();
+      Map<String, Parameter> dyna1 = new HashMap<String, Parameter>();
+      dyna1.put("user", new AbstractParameter("alesj"));
+      dynamicImports.add(new AbstractPackageAttribute("org.jboss.test", dyna1));
+      Map<String, Parameter> dyna2 = new HashMap<String, Parameter>();
+      dyna2.put("version", new AbstractParameter("1.2.3.GA"));
+      dynamicImports.add(new AbstractPackageAttribute("com.acme.plugin.*", dyna2));
+      Map<String, Parameter> dyna3 = new HashMap<String, Parameter>();
+      dyna3.put("test", new AbstractParameter("test"));
+      dynamicImports.add(new AbstractPackageAttribute("*", dyna3));
+      List<PackageAttribute> metadataDyna = metaData.getDynamicImports();
+      assertNotNull(metadataDyna);
+      assertEquals(dynamicImports.size(), metadataDyna.size());
+      for(int i=0; i < metadataDyna.size(); i++)
+      {
+         PackageAttribute paMD = metadataDyna.get(i);
+         PackageAttribute myPA = dynamicImports.get(i);
+         assertEquals(paMD.getAttribute(), myPA.getAttribute());
+         assertEquals(paMD.getPackageInfo(), myPA.getPackageInfo());
+         assertEquals(paMD.getParameters(), myPA.getParameters());
+      }
+
+      List<PackageAttribute> exportPackages = new ArrayList<PackageAttribute>();
+      Map<String, Parameter> ep1 = new HashMap<String, Parameter>();
+      ep1.put("version", new AbstractParameter("1.3"));
+      exportPackages.add(new AbstractPackageAttribute("org.osgi.util.tracker", ep1));
+      exportPackages.add(new AbstractPackageAttribute("net.osgi.foo", ep1));
+      Map<String, Parameter> ep2 = new HashMap<String, Parameter>();
+      ep2.put("version", new AbstractParameter("\"[1.0,2.0)\""));
+      exportPackages.add(new AbstractPackageAttribute("org.jboss.test", ep2));
+      List<PackageAttribute> metadataExport = metaData.getExportPackages();
+      assertNotNull(metadataExport);
+      assertEquals(exportPackages.size(), metadataExport.size());
+      for(int i=0; i < metadataExport.size(); i++)
+      {
+         PackageAttribute paMD = metadataExport.get(i);
+         PackageAttribute myPA = exportPackages.get(i);
+         assertEquals(paMD.getAttribute(), myPA.getAttribute());
+         assertEquals(paMD.getPackageInfo(), myPA.getPackageInfo());
+         assertEquals(paMD.getParameters(), myPA.getParameters());
+         OSGiParameters o1 = new OSGiParameters(paMD.getParameters());
+         OSGiParameters o2 = new OSGiParameters(myPA.getParameters());
+         VersionRange v1 = o1.getVersion();
+         VersionRange v2 = o2.getVersion();
+         assertEquals(v1, v2);
+      }
+
+      Map<String, Parameter> parameters = new HashMap<String, Parameter>();
+      parameters.put("bundle-version", new AbstractParameter("\"[3.0.0,4.0.0)\""));
+      ParameterizedAttribute fragmentHost = new AbstractParameterizedAttribute("org.eclipse.swt", parameters);
+      ParameterizedAttribute metadataFragment = metaData.getFragmentHost();
+      assertNotNull(metadataFragment);
+      assertEquals(fragmentHost.getAttribute(), metadataFragment.getAttribute());
+      OSGiParameters o1 = new OSGiParameters(fragmentHost.getParameters());
+      OSGiParameters o2 = new OSGiParameters(metadataFragment.getParameters());
+      VersionRange v1 = o1.getBundleVersion();
+      VersionRange v2 = o2.getBundleVersion();
+      assertNotNull(v1);
+      assertNotNull(v2);
+      assertEquals(v1, v2);
+
+      List<PackageAttribute> importPackages = new ArrayList<PackageAttribute>();
+      Map<String, Parameter> ip1 = new HashMap<String, Parameter>();
+      ip1.put("version", new AbstractParameter("1.4"));
+      ip1.put("name", new AbstractParameter("osgi"));
+      importPackages.add(new AbstractPackageAttribute("org.osgi.util.tracker", ip1));
+      importPackages.add(new AbstractPackageAttribute("org.osgi.service.io", ip1));
+      Map<String, Parameter> ip2 = new HashMap<String, Parameter>();
+      ip2.put("version", new AbstractParameter("\"[2.0,3.0)\""));
+      ip2.put("resolution", new AbstractParameter("osgi-int"));
+      importPackages.add(new AbstractPackageAttribute("org.jboss.test", ip2));
+      List<PackageAttribute> metadataImport = metaData.getImportPackages();
+      assertNotNull(metadataImport);
+      assertEquals(importPackages.size(), metadataImport.size());
+      for(int i=0; i < metadataImport.size(); i++)
+      {
+         PackageAttribute paMD = metadataImport.get(i);
+         PackageAttribute myPA = importPackages.get(i);
+         assertEquals(paMD.getAttribute(), myPA.getAttribute());
+         assertEquals(paMD.getPackageInfo(), myPA.getPackageInfo());
+         assertEquals(paMD.getParameters(), myPA.getParameters());
+         OSGiParameters oi1 = new OSGiParameters(paMD.getParameters());
+         OSGiParameters oi2 = new OSGiParameters(myPA.getParameters());
+         VersionRange vi1 = oi1.getVersion();
+         VersionRange vi2 = oi2.getVersion();
+         assertEquals(vi1, vi2);
+      }
+
+      List<ParameterizedAttribute> requireBundles = new ArrayList<ParameterizedAttribute>();
+      Map<String, Parameter> rb1 = new HashMap<String, Parameter>();
+      rb1.put("visibility", new AbstractParameter("true"));
+      requireBundles.add(new AbstractParameterizedAttribute("com.acme.chess", rb1));
+      Map<String, Parameter> rb2 = new HashMap<String, Parameter>();
+      rb2.put("bundle-version", new AbstractParameter("1.2"));
+      requireBundles.add(new AbstractParameterizedAttribute("com.alesj.test", rb2));
+      List<ParameterizedAttribute> metadataRB = metaData.getRequireBundles();
+      assertNotNull(metadataRB);
+      assertEquals(requireBundles.size(), metadataRB.size());
+      for(int i=0; i < metadataRB.size(); i++)
+      {
+         ParameterizedAttribute paMD = metadataRB.get(i);
+         ParameterizedAttribute myPA = requireBundles.get(i);
+         assertEquals(paMD.getAttribute(), myPA.getAttribute());
+         assertEquals(paMD.getParameters(), myPA.getParameters());
+         OSGiParameters oi1 = new OSGiParameters(paMD.getParameters());
+         OSGiParameters oi2 = new OSGiParameters(myPA.getParameters());
+         String vis1 = oi1.getVisibility();
+         String vis2 = oi2.getVisibility();
+         assertEquals(vis1, vis2);
+         VersionRange vr1 = oi1.getBundleVersion();
+         VersionRange vr2 = oi2.getBundleVersion();
+         assertEquals(vr1, vr2);
+      }
+   }
+
+   public void testIllegalManifest() throws Exception
+   {
+      getManifest(createName("Illegal"));
+      // todo
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/HeaderValuesTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/MetaDataTestSuite.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/MetaDataTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/MetaDataTestSuite.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.bundle.metadata;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * MetaData Test Suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MetaDataTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("MetaData Tests");
+
+      suite.addTest(HeaderValuesTestCase.suite());
+      suite.addTest(VersionRangeTestCase.suite());
+
+      return suite;
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/MetaDataTestSuite.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/VersionRangeTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/VersionRangeTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/VersionRangeTestCase.java	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,125 @@
+package org.jboss.test.bundle.metadata;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import junit.framework.Test;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.jboss.test.BaseTestCase;
+import org.osgi.framework.Version;
+
+/**
+ * Tests of the version range comparision.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class VersionRangeTestCase extends BaseTestCase
+{
+   final Logger log = Logger.getLogger(VersionRangeTestCase.class);
+   
+   public VersionRangeTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(VersionRangeTestCase.class);
+   }
+
+   public void testRangeSpecRE() throws Exception
+   {
+      String rangeSpec = "1.0.0";
+      // ( 1 ) (2 (3) (4) ) (5 (6) (7) (8) ) (9 (10) (11) (12) (13) )
+      String versionPat = "\\[?(\\d+)|((\\d+).(\\d+))|((\\d+).(\\d+).(\\d+))|((\\d+).(\\d+).(\\d+).(\\p{Alnum}))\\]";
+      Pattern VERSION_RANGE_RE = Pattern.compile(versionPat);
+      Matcher matcher = VERSION_RANGE_RE.matcher(rangeSpec);
+      if (matcher.matches() == true)
+      {
+         log.info("groupCount: " + matcher.groupCount());
+         for (int n = 1; n <= matcher.groupCount(); n++)
+         {
+            String g = matcher.group(n);
+            log.info(n + ":" + g);
+         }
+      }
+   }
+
+   public void testExclusiveRanges() throws Exception
+   {
+      VersionRange v100to110ExclusiveRange = AbstractVersionRange.parseRangeSpec("(1.0.0,1.1.0)");
+      VersionRange v100GAto110GAExclusvieRange = AbstractVersionRange.parseRangeSpec("(1.0.0.GA,1.1.0.GA)");
+      Version v100 = new Version("1.0.0");
+      Version v100ga = new Version("1.0.0.GA");
+      Version v110 = new Version("1.1.0");
+      Version v110ga = new Version("1.1.0.GA");
+      Version v101ga = new Version("1.0.1.GA");
+      Version v102 = new Version("1.0.2");
+      assertFalse("1.0.0 is in " + v100to110ExclusiveRange, v100to110ExclusiveRange.isInRange(v100));
+      assertFalse("1.1.0 is in " + v100to110ExclusiveRange, v100to110ExclusiveRange.isInRange(v110));
+      assertFalse("1.0.0.GA is in " + v100GAto110GAExclusvieRange, v100GAto110GAExclusvieRange.isInRange(v100ga));
+      assertFalse("1.1.0.GA is in " + v100GAto110GAExclusvieRange, v100GAto110GAExclusvieRange.isInRange(v110ga));
+      assertTrue("1.0.1.GA is in " + v100GAto110GAExclusvieRange, v100GAto110GAExclusvieRange.isInRange(v101ga));
+      assertTrue("1.0.2 is in " + v100GAto110GAExclusvieRange, v100GAto110GAExclusvieRange.isInRange(v102));
+   }
+
+   public void testInclusiveRanges() throws Exception
+   {
+      VersionRange v100to110InclusiveRange = AbstractVersionRange.parseRangeSpec("[1.0.0,1.1.0]");
+      VersionRange v100GAto110GAInclusiveRange = AbstractVersionRange.parseRangeSpec("[1.0.0.GA,1.1.0.GA]");
+      Version v100 = new Version("1.0.0");
+      Version v100ga = new Version("1.0.0.GA");
+      Version v110 = new Version("1.1.0");
+      Version v110ga = new Version("1.1.0.GA");
+      Version v101ga = new Version("1.0.1.GA");
+      Version v102 = new Version("1.0.2");
+      assertTrue("1.0.0 is in " + v100to110InclusiveRange, v100to110InclusiveRange.isInRange(v100));
+      assertTrue("1.1.0 is in " + v100to110InclusiveRange, v100to110InclusiveRange.isInRange(v110));
+      assertTrue("1.0.0.GA is in " + v100GAto110GAInclusiveRange, v100GAto110GAInclusiveRange.isInRange(v100ga));
+      assertTrue("1.1.0.GA is in " + v100GAto110GAInclusiveRange, v100GAto110GAInclusiveRange.isInRange(v110ga));
+      assertTrue("1.0.1.GA is in " + v100GAto110GAInclusiveRange, v100GAto110GAInclusiveRange.isInRange(v101ga));
+      assertTrue("1.0.2 is in " + v100GAto110GAInclusiveRange, v100GAto110GAInclusiveRange.isInRange(v102));
+   }
+
+   public void testMixedRanges() throws Exception
+   {
+      VersionRange v100to110InclusiveLowerExclusiveUpperRange = AbstractVersionRange.parseRangeSpec("[1.0.0,1.1.0)");
+      VersionRange v100to110ExclusiveLowerInclusiveUpperRange = AbstractVersionRange.parseRangeSpec("(1.0.0,1.1.0]");
+      VersionRange v100GAto110GAInclusiveLowerExclusiveUpperRange = AbstractVersionRange.parseRangeSpec("[1.0.0.GA,1.1.0.GA)");
+      VersionRange v100GAto110GAExclusiveLowerInclusiveUpperRange = AbstractVersionRange.parseRangeSpec("(1.0.0.GA,1.1.0.GA]");
+      Version v100 = new Version("1.0.0");
+      Version v100ga = new Version("1.0.0.GA");
+      Version v110 = new Version("1.1.0");
+      Version v110ga = new Version("1.1.0.GA");
+      Version v101ga = new Version("1.0.1.GA");
+      Version v102 = new Version("1.0.2");
+      assertTrue("1.0.0 is in " + v100to110InclusiveLowerExclusiveUpperRange, v100to110InclusiveLowerExclusiveUpperRange.isInRange(v100));
+      assertFalse("1.0.0 is in " + v100to110ExclusiveLowerInclusiveUpperRange, v100to110ExclusiveLowerInclusiveUpperRange.isInRange(v100));
+      assertFalse("1.1.0 is in " + v100to110InclusiveLowerExclusiveUpperRange, v100to110InclusiveLowerExclusiveUpperRange.isInRange(v110));
+      assertTrue("1.1.0 is in " + v100to110ExclusiveLowerInclusiveUpperRange, v100to110ExclusiveLowerInclusiveUpperRange.isInRange(v110));
+
+      assertTrue("1.0.0.GA is in " + v100GAto110GAInclusiveLowerExclusiveUpperRange, v100GAto110GAInclusiveLowerExclusiveUpperRange.isInRange(v100ga));
+      assertFalse("1.1.0.GA is in " + v100GAto110GAInclusiveLowerExclusiveUpperRange, v100GAto110GAInclusiveLowerExclusiveUpperRange.isInRange(v110ga));
+      assertFalse("1.0.0.GA is in " + v100GAto110GAExclusiveLowerInclusiveUpperRange, v100GAto110GAExclusiveLowerInclusiveUpperRange.isInRange(v100ga));
+      assertTrue("1.1.0.GA is in " + v100GAto110GAExclusiveLowerInclusiveUpperRange, v100GAto110GAExclusiveLowerInclusiveUpperRange.isInRange(v110ga));
+      assertTrue("1.0.1.GA is in " + v100GAto110GAExclusiveLowerInclusiveUpperRange, v100GAto110GAExclusiveLowerInclusiveUpperRange.isInRange(v101ga));
+      assertTrue("1.0.2 is in " + v100GAto110GAExclusiveLowerInclusiveUpperRange, v100GAto110GAExclusiveLowerInclusiveUpperRange.isInRange(v102));
+   }
+
+   public void testSingleRange() throws Exception
+   {
+      VersionRange v100Range = AbstractVersionRange.parseRangeSpec("1.0.0");
+      Version v100 = new Version("1.0.0");
+      assertTrue("1.0.0 is in " + v100Range, v100Range.isInRange(v100));
+      Version v200 = new Version("2.0.0");
+      assertTrue("2.0.0 is in " + v100Range, v100Range.isInRange(v200));
+      Version v200ga = new Version("2.0.0.GA");
+      assertTrue("2.0.0.GA is in " + v100Range, v100Range.isInRange(v200ga));
+      Version v09beta = new Version("0.9.0.beta");
+      assertFalse("0.9.0.beta is in " + v100Range, v100Range.isInRange(v09beta));
+   }
+}


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/java/org/jboss/test/bundle/metadata/VersionRangeTestCase.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/bootstrap.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/bootstrap.xml	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,128 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!-- The MainDeployer -->
+   <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+      <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+      <property name="deployers"><inject bean="Deployers"/></property>
+      <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
+   </bean>
+
+   <!-- The ManagedDeploymentCreator implementation -->
+   <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator" />
+
+   <!-- The holder for deployers that determine structure -->
+   <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+      <property name="structureBuilder">
+         <!-- The consolidator of the structure information -->
+         <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+      </property>
+      <!-- Accept any implementor of structure deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+
+   <!-- The holder for deployers that do real deployment -->
+   <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+      <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+      <!-- Accept any implementor of deployer -->
+      <incallback method="addDeployer"/>
+      <uncallback method="removeDeployer"/>
+   </bean>
+
+   <!-- A declared structure descriptor deployer -->
+   <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
+
+    <!-- JAR Structure -->
+    <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
+       <!-- Unless specified the default list of suffixes is .zip, .ear, .jar, ,.rar, .war, .sar, .har, .aop -->
+       <constructor>
+          <parameter>
+             <set elementClass="java.lang.String">
+                <value>.zip</value>
+                <value>.ear</value>
+                <value>.jar</value>
+                <value>.rar</value>
+                <value>.war</value>
+                <value>.sar</value>
+                <value>.har</value>
+                <value>.aop</value>
+                <value>.deployer</value>
+                <value>.beans</value>
+             </set>
+          </parameter>
+       </constructor>
+       <property name="candidateStructureVisitorFactory">
+          <!-- Any file that is not an ordinary directory is a candidate -->
+          <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
+             <!-- A filter to exclude some obvious non-subdeployments -->
+             <property name="filter">
+                <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
+                   <constructor><parameter>
+                      <list elementClass="java.lang.String">
+                         <!-- Exclude class files as subdeployments -->
+                         <value>.class</value>
+                      </list>
+                   </parameter></constructor>
+                </bean>
+             </property>
+          </bean>
+       </property>
+    </bean>
+
+    <!-- File Structure -->
+    <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
+       <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
+       <constructor>
+          <parameter>
+             <set elementClass="java.lang.String">
+                <value>-service.xml</value>
+                <value>-beans.xml</value>
+                <value>-ds.xml</value>
+                <value>-aop.xml</value>
+             </set>
+          </parameter>
+       </constructor>
+    </bean>
+
+   <!-- POJO Deployment -->
+   <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
+   <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
+   <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+      <constructor><parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+   </bean>
+   
+   <!-- OSGI Deployment -->
+   <bean name="BundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.BundleActivatorDeployer">
+   	  <constructor><parameter class="org.jboss.kernel.spi.dependency.KernelController"><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+   </bean>
+   <bean name="OSGIMetaDataDeployer" class="org.jboss.osgi.plugins.deployers.OSGiMetaDataDeployer"/>
+
+   <!-- VFS ClassLoader -->
+   <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+      <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
+   </bean>
+   <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+      <incallback method="addModule" state="Configured"/>
+      <uncallback method="removeModule" state="Configured"/>
+   </bean>
+   <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+      <constructor>
+         <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+      </constructor>
+      <property name="name">jboss-classloading.xml</property>
+      <property name="buildManagedObject">true</property>
+   </bean>
+   <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+      <property name="defaultMetaData">
+         <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
+      </property>
+   </bean>
+   <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
+   <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+      <property name="classLoading"><inject bean="ClassLoading"/></property>
+   </bean>
+   <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+      <property name="classLoading"><inject bean="ClassLoading"/></property>
+      <property name="system"><inject bean="ClassLoaderSystem"/></property>
+   </bean>
+</deployment>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bootstrap/bootstrap.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bundle/simple.jar
===================================================================
(Binary files differ)


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/bundle/simple.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/log4j.xml	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <appender name="FILE" class="org.apache.log4j.FileAppender">
+    <param name="File" value="${log4j.output.dir}/test.log"/>
+    <param name="Append" value="false"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>
+  </appender>
+  
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <param name="Threshold" value="INFO" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+    </layout>
+  </appender>
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <category name="org.hibernate">
+    <priority value="INFO" />
+  </category>
+
+  <!-- hide optimistic locking failures
+  <category name="org.hibernate.event.def.AbstractFlushingEventListener">
+    <priority value="FATAL" />
+  </category>
+  -->
+
+  <!-- hide proxy narrowing warns -->
+  <category name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
+    <priority value="ERROR" />
+  </category>
+
+  <!-- show SQL DML statements as they are executed -->
+  <category name="org.hibernate.SQL">
+    <priority value="DEBUG" />
+  </category>
+
+  <!-- show JDBC parameters
+  <category name="org.hibernate.type">
+    <priority value="TRACE" />
+  </category>
+  -->
+
+  <!-- hide httpclient wire dumps -->
+  <category name="httpclient.wire.header">
+    <priority value="INFO" />
+  </category>
+
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <!--appender-ref ref="CONSOLE"/-->
+    <appender-ref ref="FILE"/>
+  </root>
+
+</log4j:configuration>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/deployers/AllManifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/deployers/AllManifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/deployers/AllManifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+Bundle-SymbolicName: com.acme.foo;singleton:=true
+Bundle-NativeCode: /lib/http.DLL;osname=QNX;osversion=3.1,/lib/tcp.DLL;/lib/iiop.DLL;osname=QWE;osversion=4.0
+DynamicImport-Package: org.jboss.test;user=alesj,com.acme.plugin.*;version=1.2.3.GA,*;test=test
+Export-Package: org.osgi.util.tracker;net.osgi.foo;version=1.3,org.jboss.test;version="[1.0,2.0)";uses=
+Fragment-Host: org.eclipse.swt;bundle-version="[3.0.0,4.0.0)"
+Import-Package: org.osgi.util.tracker;org.osgi.service.io;version=1.4;name=osgi,org.jboss.test;version="[2.0,3.0)";resolution:=osgi-int,com.acme;resolution:=optional
+Require-Bundle: com.acme.chess;visibility:=true,com.alesj.test;bundle-version=1.2
+

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/IllegalManifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/IllegalManifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/IllegalManifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/JavaCCManifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/JavaCCManifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/JavaCCManifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+Bundle-NativeCode: /lib/http.DLL;osname=QNX;osversion=3.1,/lib/tcp.DLL;/lib/iiop.DLL;osname=QWE;osversion=4.0
+DynamicImport-Package: org.jboss.test;user=alesj,com.acme.plugin.*;version=1.2.3.GA,*;test=test
+Export-Package: org.osgi.util.tracker;net.osgi.foo;version=1.3,org.jboss.test;version="[1.0,2.0)"
+Fragment-Host: org.eclipse.swt;bundle-version="[3.0.0,4.0.0)"
+Import-Package: org.osgi.util.tracker;org.osgi.service.io;version=1.4;name=osgi,org.jboss.test;version="[2.0,3.0)";resolution:=osgi-int
+Require-Bundle: com.acme.chess;visibility:=true,com.alesj.test;bundle-version=1.2
+

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/LocalizedManifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/LocalizedManifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/LocalizedManifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+Bundle-Activator: org.jboss.test.bundle.metadata.BundleActivator
+Bundle-ClassPath: test.jar,mc.jar,seam.jar
+Bundle-Description: %TestHeadersManifest
+Bundle-Localization: OSGI-INF/l10n/bundle
+Bundle-ManifestVersion: 2
+Bundle-Name: TestBundle
+Bundle-SymbolicName: %UniqueName
+Bundle-UpdateLocation: file://test.jar
+Bundle-Version: 1.2.3.GA
+Bundle-RequiredExecutionEnvironment: ena,dva,tri

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/Manifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/Manifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/Manifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+Bundle-Name: SomeBundleName
+Bundle-ActivationPolicy: lazy;include:="org.jboss";exclude:="com.acme"
+

Added: projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/SimpleManifest.mf
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/SimpleManifest.mf	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/osgi-int/src/test/resources/org/jboss/test/bundle/metadata/SimpleManifest.mf	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.5
+Created-By: Ales Justin
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: 2.0.0.beta2
+Implementation-Vendor: jboss.org
+Bundle-Activator: org.jboss.test.bundle.metadata.BundleActivator
+Bundle-ClassPath: test.jar,mc.jar,seam.jar
+Bundle-Description: TestHeadersManifest
+Bundle-Localization: OSGI-INF/l10n/bundle
+Bundle-ManifestVersion: 2
+Bundle-Name: TestBundle
+Bundle-SymbolicName: UniqueName
+Bundle-UpdateLocation: file://test.jar
+Bundle-Version: 1.2.3.GA
+Bundle-RequiredExecutionEnvironment: ena,dva,tri

Added: projects/jboss-osgi/trunk/runtime/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/microcontainer/pom.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/microcontainer/pom.xml	2009-04-26 19:56:53 UTC (rev 87848)
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <name>JBossOSGi - Runtime Microcontainer</name>
+  <artifactId>jboss-osgi-runtime-microcontainer</artifactId>
+  <packaging>pom</packaging>
+  
+  <parent>
+    <groupId>org.jboss.osgi</groupId>
+    <artifactId>jboss-osgi-runtime</artifactId>
+    <version>1.0.0.Beta2</version>
+  </parent>
+  
+  <modules>
+    <module>osgi-int</module>
+  </modules>
+
+</project>


Property changes on: projects/jboss-osgi/trunk/runtime/microcontainer/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-osgi-commits mailing list