[jboss-cvs] JBossAS SVN: r94257 - in projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi: framework and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 2 03:46:19 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-02 03:46:17 -0400 (Fri, 02 Oct 2009)
New Revision: 94257
Added:
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/FilterImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/NoFilter.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/parser/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/AutoInstallPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/BundleStoragePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/FrameworkEventsPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/MicrocontainerServicePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/PackageAdminServicePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/Plugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/ServicePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/StartLevelServicePlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/SystemPackagesPlugin.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/FrameworkUtil.java
Removed:
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceReferenceWrapper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/AndOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/ApproximateOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/CompareOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/EqualsOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/GreaterThanOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/LessThanOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/NotOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/Operation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/OrOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/PresentOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/SubStringOperation.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/parser/FilterParser.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/DictionaryToPropertySource.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/PropertySource.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/ServiceReferenceToPropertySource.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkBootstrapProvider.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractActivationPolicyMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeAware.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractDependencyMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractHolderMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractListenerMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractMetaDataVisitorNode.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractOSGiMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractPackageAttribute.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameter.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameterizedAttribute.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractReferenceMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceDeployment.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractVersionRange.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ActivationPolicyMDValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/BooleanValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/CollectionValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/IntegerValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/OSGiParameters.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PackageAttributeListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PathAttributeListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/QNameAttributeListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringListValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/URLValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreatorUtil.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionRangeValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionValueCreator.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractServicePluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AutoInstallPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/BundleStoragePluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/FrameworkEventsPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/MicrocontainerServiceImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/StartLevelImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBinding.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBindingHelper.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaInitializer.java
projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
Log:
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle)
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,792 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.bundle;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.Permission;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
-import org.jboss.osgi.plugins.facade.api.FrameworkEventsPlugin;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.jboss.util.collection.ConcurrentSet;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-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.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.SynchronousBundleListener;
-import org.osgi.framework.Version;
-
-/**
- * BundleState.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractBundleState implements Bundle, BundleContext
-{
- /** The log */
- private static final Logger log = Logger.getLogger(AbstractBundleState.class);
-
- /** The last modified time stamp */
- private long lastModified = System.currentTimeMillis();
-
- /** The bundle manager */
- private OSGiBundleManager bundleManager;
-
- /** The osgi metadata */
- private OSGiMetaData osgiMetaData;
-
- /** The bundle context */
- private BundleContext bundleContext;
-
- /** The bundle */
- private Bundle bundle;
-
- /** The bundle state */
- private AtomicInteger state = new AtomicInteger(Bundle.UNINSTALLED);
-
- /** The registered services in use */
- protected Set<OSGiServiceState> registeredServices = new ConcurrentSet<OSGiServiceState>();
-
- /** The services in use */
- protected Map<OSGiServiceState, Integer> servicesInUse = new ConcurrentHashMap<OSGiServiceState, Integer>();
-
- /** The cached symbolic name */
- private String symbolicName;
-
- /** The cached */
- private Version version;
-
- /**
- * Create a new BundleState for the system bundle.
- *
- * @param osgiMetaData the osgi metadata
- * @throws IllegalArgumentException for a null parameter
- */
- AbstractBundleState(OSGiMetaData osgiMetaData)
- {
- if (osgiMetaData == null)
- throw new IllegalArgumentException("Null osgi metadata");
- this.osgiMetaData = osgiMetaData;
- }
-
- /**
- * Get the bundleManager.
- *
- * @return the bundleManager.
- */
- public OSGiBundleManager getBundleManager()
- {
- if (bundleManager == null)
- throw new IllegalStateException("Bundle not installed: " + getCanonicalName());
-
- return bundleManager;
- }
-
- public String getSymbolicName()
- {
- if (symbolicName == null)
- {
- symbolicName = osgiMetaData.getBundleSymbolicName();
- if (symbolicName == null)
- throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
- }
- return symbolicName;
- }
-
- public Version getVersion()
- {
- if (version == null)
- version = osgiMetaData.getBundleVersion();
-
- return version;
- }
-
- public int getState()
- {
- return state.get();
- }
-
- public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
- {
- throw new NotImplementedException();
- }
-
- public synchronized BundleContext getBundleContext()
- {
- checkAdminPermission(AdminPermission.CONTEXT);
- return bundleContext;
- }
-
- public synchronized BundleContext createBundleContext()
- {
- if (bundleContext == null)
- bundleContext = new OSGiBundleContextWrapper(this);
- return bundleContext;
- }
-
- public synchronized void destroyBundleContext()
- {
- bundleContext = null;
- }
-
- public synchronized Bundle getBundle()
- {
- checkValidBundleContext();
- return getBundleInternal();
- }
-
- public synchronized Bundle getBundleInternal()
- {
- if (bundle == null)
- bundle = new OSGiBundleWrapper(this);
- return bundle;
- }
-
- public Bundle getBundle(long id)
- {
- checkValidBundleContext();
- AbstractBundleState bundleState = getBundleManager().getBundleById(id);
- return bundleState != null ? bundleState.getBundleInternal() : null;
- }
-
- public Bundle[] getBundles()
- {
- checkValidBundleContext();
-
- Collection<AbstractBundleState> bundleStates = getBundleManager().getBundles();
- if (bundleStates.isEmpty())
- return new Bundle[0];
-
- List<Bundle> bundles = new ArrayList<Bundle>(bundleStates.size());
- for (AbstractBundleState bundleState : bundleStates)
- bundles.add(bundleState.getBundleInternal());
-
- return bundles.toArray(new Bundle[bundles.size()]);
- }
-
- public long getLastModified()
- {
- return lastModified;
- }
-
- public void modified()
- {
- lastModified = System.currentTimeMillis();
- }
-
- /**
- * Get the osgiMetaData.
- *
- * @return the osgiMetaData.
- */
- public OSGiMetaData getOSGiMetaData()
- {
- return osgiMetaData;
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders()
- {
- return getHeaders(null);
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders(String locale)
- {
- checkAdminPermission(AdminPermission.METADATA);
- return getOSGiMetaData().getHeaders(locale);
- }
-
- public String getProperty(String key)
- {
- checkValidBundleContext();
- return getBundleManager().getProperty(key);
- }
-
- public File getDataFile(String filename)
- {
- checkValidBundleContext();
- BundleStoragePlugin storagePlugin = getBundleManager().getOptionalPlugin(BundleStoragePlugin.class);
- return storagePlugin != null ? storagePlugin.getDataFile(this, filename) : null;
- }
-
- public boolean hasPermission(Object permission)
- {
- if (permission == null || permission instanceof Permission == false)
- return false;
-
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- return true;
-
- // [TODO] hasPermission
- return true;
- }
-
- public Filter createFilter(String filter) throws InvalidSyntaxException
- {
- checkValidBundleContext();
- return FrameworkUtil.createFilter(filter);
- }
-
- public void addServiceListener(ServiceListener listener)
- {
- addServiceListenerInternal(listener, null);
- }
-
- public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
- {
- Filter theFilter = null;
- if (filter != null)
- theFilter = createFilter(filter);
- addServiceListenerInternal(listener, theFilter);
- }
-
- public void addServiceListenerInternal(ServiceListener listener, Filter filter)
- {
- checkValidBundleContext();
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.addServiceListener(this, listener, filter);
- }
-
- public void removeServiceListener(ServiceListener listener)
- {
- checkValidBundleContext();
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.removeServiceListener(this, listener);
- }
-
- /**
- * Add a registered service
- *
- * @param serviceState the service
- */
- void addRegisteredService(OSGiServiceState serviceState)
- {
- registeredServices.add(serviceState);
- }
-
- /**
- * Remove a registered service
- *
- * @param serviceState the service
- */
- void removeRegisteredService(OSGiServiceState serviceState)
- {
- registeredServices.remove(serviceState);
- }
-
- public ServiceReference[] getRegisteredServices()
- {
- checkInstalled();
-
- if (registeredServices.isEmpty())
- return null;
-
- Set<ServiceReference> result = new HashSet<ServiceReference>(registeredServices.size());
- for (OSGiServiceState service : registeredServices)
- {
- if (service.hasPermission())
- result.add(service.getReferenceInternal());
- }
- if (result.isEmpty())
- return null;
- return result.toArray(new ServiceReference[result.size()]);
- }
-
- /**
- * True if the use count of a service for this bundle is grater that 0.
- *
- * @param serviceState the service
- */
- boolean isServiceInUse(OSGiServiceState serviceState)
- {
- synchronized (servicesInUse)
- {
- Integer count = servicesInUse.get(serviceState);
- return (count != null && count > 0);
- }
- }
-
- /**
- * Increment the use count of a service for this bundle
- *
- * @param serviceState the service
- */
- void addServiceInUse(OSGiServiceState serviceState)
- {
- synchronized (servicesInUse)
- {
- Integer count = servicesInUse.get(serviceState);
- if (count == null)
- servicesInUse.put(serviceState, 1);
- else
- servicesInUse.put(serviceState, ++count);
- }
- serviceState.addUsingBundle(this);
- }
-
- /**
- * Decrement the use count of a service for this bundle
- *
- * @param serviceState the service
- * @return true when the service is still in use by the bundle
- */
- boolean removeServiceInUse(OSGiServiceState serviceState)
- {
- synchronized (servicesInUse)
- {
- Integer count = servicesInUse.get(serviceState);
- if (count == null)
- {
- return false;
- }
- else if (count == 1)
- {
- servicesInUse.remove(serviceState);
- serviceState.removeUsingBundle(this);
- return false;
- }
- else
- {
- servicesInUse.put(serviceState, --count);
- }
- }
- return true;
- }
-
- public ServiceReference[] getServicesInUse()
- {
- checkInstalled();
-
- synchronized (servicesInUse)
- {
- Collection<OSGiServiceState> inUse = servicesInUse.keySet();
- if (inUse.isEmpty())
- return null;
-
- Set<ServiceReference> result = new HashSet<ServiceReference>(inUse.size());
- for (OSGiServiceState service : inUse)
- {
- if (service.hasPermission())
- result.add(service.getReferenceInternal());
- }
- if (result.isEmpty())
- return null;
- return result.toArray(new ServiceReference[result.size()]);
- }
- }
-
- public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
- {
- checkValidBundleContext();
- return getBundleManager().getServiceReferences(this, clazz, filter, false);
- }
-
- public Object getService(ServiceReference reference)
- {
- checkValidBundleContext();
-
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- return getBundleManager().getService(this, reference);
- }
-
- public ServiceReference getServiceReference(String clazz)
- {
- checkValidBundleContext();
- if (clazz == null)
- throw new IllegalArgumentException("Null clazz");
- return getBundleManager().getServiceReference(this, clazz);
- }
-
- public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
- {
- checkValidBundleContext();
- return getBundleManager().getServiceReferences(this, clazz, filter, true);
- }
-
- @SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null class");
- return registerService(new String[] { clazz }, service, properties);
- }
-
- @SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
- {
- checkValidBundleContext();
-
- OSGiServiceState serviceState = getBundleManager().registerService(this, clazzes, service, properties);
- return serviceState.getRegistration();
- }
-
- /**
- * Unregister a service
- *
- * @param serviceState the service state
- */
- void unregisterService(OSGiServiceState serviceState)
- {
- getBundleManager().unregisterService(serviceState);
- }
-
- public boolean ungetService(ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- // Check if the service is still in use by this bundle
- OSGiServiceState serviceState = ((OSGiServiceReferenceWrapper)reference).getServiceState();
- if (isServiceInUse(serviceState) == false)
- return false;
-
- checkValidBundleContext();
-
- return getBundleManager().ungetService(this, reference);
- }
-
- boolean ungetService(OSGiServiceState state)
- {
- return getBundleManager().ungetService(this, state);
- }
-
- public void addBundleListener(BundleListener listener)
- {
- checkValidBundleContext();
-
- if (listener instanceof SynchronousBundleListener)
- checkAdminPermission(AdminPermission.LISTENER);
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.addBundleListener(this, listener);
- }
-
- public void removeBundleListener(BundleListener listener)
- {
- checkValidBundleContext();
-
- if (listener instanceof SynchronousBundleListener)
- checkAdminPermission(AdminPermission.LISTENER);
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.removeBundleListener(this, listener);
- }
-
- public void start() throws BundleException
- {
- start(0);
- }
-
- public void stop() throws BundleException
- {
- stop(0);
- }
-
- public void update() throws BundleException
- {
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- // [TODO] update
- throw new UnsupportedOperationException("update");
- }
-
- public void update(InputStream in) throws BundleException
- {
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- // [TODO] update
- throw new UnsupportedOperationException("update");
- }
-
- public void uninstall() throws BundleException
- {
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- getBundleManager().uninstall(this);
- }
-
- void uninstallInternal()
- {
- changeState(Bundle.UNINSTALLED);
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.removeFrameworkListeners(this);
- plugin.removeBundleListeners(this);
- plugin.removeServiceListeners(this);
- }
-
- public void addFrameworkListener(FrameworkListener listener)
- {
- checkValidBundleContext();
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.addFrameworkListener(this, listener);
- }
-
- public void removeFrameworkListener(FrameworkListener listener)
- {
- checkValidBundleContext();
-
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.removeFrameworkListener(this, listener);
- }
-
- public Bundle installBundle(String location, InputStream input) throws BundleException
- {
- checkValidBundleContext();
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
- // [TODO] installBundle
- throw new UnsupportedOperationException("installBundle");
- }
-
- public Bundle installBundle(String location) throws BundleException
- {
- checkValidBundleContext();
- checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
-
- URL url = getLocationURL(location);
- AbstractBundleState bundleState = getBundleManager().install(url);
- return bundleState.getBundleInternal();
- }
-
- private URL getLocationURL(String location) throws BundleException
- {
- // Try location as URL
- URL url = null;
- try
- {
- url = new URL(location);
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
-
- // Try location as File
- if (url == null)
- {
- try
- {
- File file = new File(location);
- if (file.exists())
- url = file.toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
-
- if (url == null)
- throw new BundleException("Unable to handle location=" + location);
-
- return url;
- }
-
- @Override
- public String toString()
- {
- return "Bundle{" + getCanonicalName() + "}";
- }
-
- /**
- * Get the canonical name of the bundle
- *
- * @return the canonical name
- */
- String getCanonicalName()
- {
- return getSymbolicName() + ":" + getVersion();
- }
-
- /**
- * Set the bundle manager
- *
- * @param bundleManager the bundle manager or null to uninstall the bundle
- */
- void setBundleManager(OSGiBundleManager bundleManager)
- {
- if (bundleManager != null && this.bundleManager != null)
- throw new IllegalStateException("Bundle " + this + " is already installed");
-
- this.bundleManager = bundleManager;
- }
-
- /**
- * Get the source of a class for ServiceReference.isAssignable()
- *
- * @param className the class name
- * @return the source or null if no source
- */
- Object getSource(String className)
- {
- // [TODO] some more efficient way than using the class?
- try
- {
- return loadClass(className);
- }
- catch (ClassNotFoundException e)
- {
- return null;
- }
- }
-
- /**
- * Change the state of the bundle
- *
- * @param state the new state
- */
- public void changeState(int state)
- {
- int previous = getState();
- int type = 0;
- switch (state)
- {
- case Bundle.STARTING:
- type = BundleEvent.STARTING;
- break;
- case Bundle.ACTIVE:
- type = BundleEvent.STARTED;
- break;
- case Bundle.STOPPING:
- type = BundleEvent.STOPPING;
- break;
- case Bundle.UNINSTALLED:
- type = BundleEvent.UNINSTALLED;
- break;
- case Bundle.INSTALLED:
- {
- if (previous == Bundle.RESOLVED)
- type = BundleEvent.UNRESOLVED;
- else
- type = BundleEvent.INSTALLED;
- break;
- }
- case Bundle.RESOLVED:
- {
- if (previous == Bundle.STOPPING)
- type = BundleEvent.STOPPED;
- else
- type = BundleEvent.RESOLVED;
- break;
- }
- default:
- throw new IllegalArgumentException("Unknown bundle state: " + state);
- }
- this.state.set(state);
- log.debug(this + " change state=" + ConstantsHelper.bundleState(state));
-
- if (getBundleManager().isActive())
- {
- FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
- plugin.fireBundleEvent(this, type);
- }
- }
-
- /**
- * Check the bundle is installed
- *
- * @throws IllegalStateException when the bundle is not installed
- */
- protected void checkInstalled()
- {
- if ((getState() & Bundle.UNINSTALLED) != 0)
- throw new IllegalStateException("Bundle " + getCanonicalName() + " is not installed");
- }
-
- /**
- * Check a bundle context is still valid
- *
- * @return the bundle context
- * @throws IllegalArgumentException when the context is no longer valid
- */
- protected synchronized BundleContext checkValidBundleContext()
- {
- BundleContext result = this.bundleContext;
- if (result == null)
- throw new IllegalStateException("Bundle context is no longer valid: " + getCanonicalName());
- return result;
- }
-
- /**
- * Check the admin permission
- *
- * @param what what permission to check
- * @throws SecurityException when the caller does not have the AdminPermission and a security manager is installed
- */
- protected void checkAdminPermission(String what)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new AdminPermission(this, what));
- }
-
- /**
- * Checks if we have the admin permission
- *
- * @param what the permission to check
- * @return true if the caller doesn't have the permission
- */
- protected boolean noAdminPermission(String what)
- {
- try
- {
- checkAdminPermission(what);
- return false;
- }
- catch (SecurityException e)
- {
- return true;
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,792 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.Permission;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.util.collection.ConcurrentSet;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+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.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.Version;
+
+/**
+ * BundleState.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractBundleState implements Bundle, BundleContext
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(AbstractBundleState.class);
+
+ /** The last modified time stamp */
+ private long lastModified = System.currentTimeMillis();
+
+ /** The bundle manager */
+ private OSGiBundleManager bundleManager;
+
+ /** The osgi metadata */
+ private OSGiMetaData osgiMetaData;
+
+ /** The bundle context */
+ private BundleContext bundleContext;
+
+ /** The bundle */
+ private Bundle bundle;
+
+ /** The bundle state */
+ private AtomicInteger state = new AtomicInteger(Bundle.UNINSTALLED);
+
+ /** The registered services in use */
+ protected Set<OSGiServiceState> registeredServices = new ConcurrentSet<OSGiServiceState>();
+
+ /** The services in use */
+ protected Map<OSGiServiceState, Integer> servicesInUse = new ConcurrentHashMap<OSGiServiceState, Integer>();
+
+ /** The cached symbolic name */
+ private String symbolicName;
+
+ /** The cached */
+ private Version version;
+
+ /**
+ * Create a new BundleState for the system bundle.
+ *
+ * @param osgiMetaData the osgi metadata
+ * @throws IllegalArgumentException for a null parameter
+ */
+ AbstractBundleState(OSGiMetaData osgiMetaData)
+ {
+ if (osgiMetaData == null)
+ throw new IllegalArgumentException("Null osgi metadata");
+ this.osgiMetaData = osgiMetaData;
+ }
+
+ /**
+ * Get the bundleManager.
+ *
+ * @return the bundleManager.
+ */
+ public OSGiBundleManager getBundleManager()
+ {
+ if (bundleManager == null)
+ throw new IllegalStateException("Bundle not installed: " + getCanonicalName());
+
+ return bundleManager;
+ }
+
+ public String getSymbolicName()
+ {
+ if (symbolicName == null)
+ {
+ symbolicName = osgiMetaData.getBundleSymbolicName();
+ if (symbolicName == null)
+ throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
+ }
+ return symbolicName;
+ }
+
+ public Version getVersion()
+ {
+ if (version == null)
+ version = osgiMetaData.getBundleVersion();
+
+ return version;
+ }
+
+ public int getState()
+ {
+ return state.get();
+ }
+
+ public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
+ {
+ throw new NotImplementedException();
+ }
+
+ public synchronized BundleContext getBundleContext()
+ {
+ checkAdminPermission(AdminPermission.CONTEXT);
+ return bundleContext;
+ }
+
+ public synchronized BundleContext createBundleContext()
+ {
+ if (bundleContext == null)
+ bundleContext = new OSGiBundleContextWrapper(this);
+ return bundleContext;
+ }
+
+ public synchronized void destroyBundleContext()
+ {
+ bundleContext = null;
+ }
+
+ public synchronized Bundle getBundle()
+ {
+ checkValidBundleContext();
+ return getBundleInternal();
+ }
+
+ public synchronized Bundle getBundleInternal()
+ {
+ if (bundle == null)
+ bundle = new OSGiBundleWrapper(this);
+ return bundle;
+ }
+
+ public Bundle getBundle(long id)
+ {
+ checkValidBundleContext();
+ AbstractBundleState bundleState = getBundleManager().getBundleById(id);
+ return bundleState != null ? bundleState.getBundleInternal() : null;
+ }
+
+ public Bundle[] getBundles()
+ {
+ checkValidBundleContext();
+
+ Collection<AbstractBundleState> bundleStates = getBundleManager().getBundles();
+ if (bundleStates.isEmpty())
+ return new Bundle[0];
+
+ List<Bundle> bundles = new ArrayList<Bundle>(bundleStates.size());
+ for (AbstractBundleState bundleState : bundleStates)
+ bundles.add(bundleState.getBundleInternal());
+
+ return bundles.toArray(new Bundle[bundles.size()]);
+ }
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
+
+ public void modified()
+ {
+ lastModified = System.currentTimeMillis();
+ }
+
+ /**
+ * Get the osgiMetaData.
+ *
+ * @return the osgiMetaData.
+ */
+ public OSGiMetaData getOSGiMetaData()
+ {
+ return osgiMetaData;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Dictionary getHeaders()
+ {
+ return getHeaders(null);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Dictionary getHeaders(String locale)
+ {
+ checkAdminPermission(AdminPermission.METADATA);
+ return getOSGiMetaData().getHeaders(locale);
+ }
+
+ public String getProperty(String key)
+ {
+ checkValidBundleContext();
+ return getBundleManager().getProperty(key);
+ }
+
+ public File getDataFile(String filename)
+ {
+ checkValidBundleContext();
+ BundleStoragePlugin storagePlugin = getBundleManager().getOptionalPlugin(BundleStoragePlugin.class);
+ return storagePlugin != null ? storagePlugin.getDataFile(this, filename) : null;
+ }
+
+ public boolean hasPermission(Object permission)
+ {
+ if (permission == null || permission instanceof Permission == false)
+ return false;
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ return true;
+
+ // [TODO] hasPermission
+ return true;
+ }
+
+ public Filter createFilter(String filter) throws InvalidSyntaxException
+ {
+ checkValidBundleContext();
+ return FrameworkUtil.createFilter(filter);
+ }
+
+ public void addServiceListener(ServiceListener listener)
+ {
+ addServiceListenerInternal(listener, null);
+ }
+
+ public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
+ {
+ Filter theFilter = null;
+ if (filter != null)
+ theFilter = createFilter(filter);
+ addServiceListenerInternal(listener, theFilter);
+ }
+
+ public void addServiceListenerInternal(ServiceListener listener, Filter filter)
+ {
+ checkValidBundleContext();
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.addServiceListener(this, listener, filter);
+ }
+
+ public void removeServiceListener(ServiceListener listener)
+ {
+ checkValidBundleContext();
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.removeServiceListener(this, listener);
+ }
+
+ /**
+ * Add a registered service
+ *
+ * @param serviceState the service
+ */
+ void addRegisteredService(OSGiServiceState serviceState)
+ {
+ registeredServices.add(serviceState);
+ }
+
+ /**
+ * Remove a registered service
+ *
+ * @param serviceState the service
+ */
+ void removeRegisteredService(OSGiServiceState serviceState)
+ {
+ registeredServices.remove(serviceState);
+ }
+
+ public ServiceReference[] getRegisteredServices()
+ {
+ checkInstalled();
+
+ if (registeredServices.isEmpty())
+ return null;
+
+ Set<ServiceReference> result = new HashSet<ServiceReference>(registeredServices.size());
+ for (OSGiServiceState service : registeredServices)
+ {
+ if (service.hasPermission())
+ result.add(service.getReferenceInternal());
+ }
+ if (result.isEmpty())
+ return null;
+ return result.toArray(new ServiceReference[result.size()]);
+ }
+
+ /**
+ * True if the use count of a service for this bundle is grater that 0.
+ *
+ * @param serviceState the service
+ */
+ boolean isServiceInUse(OSGiServiceState serviceState)
+ {
+ synchronized (servicesInUse)
+ {
+ Integer count = servicesInUse.get(serviceState);
+ return (count != null && count > 0);
+ }
+ }
+
+ /**
+ * Increment the use count of a service for this bundle
+ *
+ * @param serviceState the service
+ */
+ void addServiceInUse(OSGiServiceState serviceState)
+ {
+ synchronized (servicesInUse)
+ {
+ Integer count = servicesInUse.get(serviceState);
+ if (count == null)
+ servicesInUse.put(serviceState, 1);
+ else
+ servicesInUse.put(serviceState, ++count);
+ }
+ serviceState.addUsingBundle(this);
+ }
+
+ /**
+ * Decrement the use count of a service for this bundle
+ *
+ * @param serviceState the service
+ * @return true when the service is still in use by the bundle
+ */
+ boolean removeServiceInUse(OSGiServiceState serviceState)
+ {
+ synchronized (servicesInUse)
+ {
+ Integer count = servicesInUse.get(serviceState);
+ if (count == null)
+ {
+ return false;
+ }
+ else if (count == 1)
+ {
+ servicesInUse.remove(serviceState);
+ serviceState.removeUsingBundle(this);
+ return false;
+ }
+ else
+ {
+ servicesInUse.put(serviceState, --count);
+ }
+ }
+ return true;
+ }
+
+ public ServiceReference[] getServicesInUse()
+ {
+ checkInstalled();
+
+ synchronized (servicesInUse)
+ {
+ Collection<OSGiServiceState> inUse = servicesInUse.keySet();
+ if (inUse.isEmpty())
+ return null;
+
+ Set<ServiceReference> result = new HashSet<ServiceReference>(inUse.size());
+ for (OSGiServiceState service : inUse)
+ {
+ if (service.hasPermission())
+ result.add(service.getReferenceInternal());
+ }
+ if (result.isEmpty())
+ return null;
+ return result.toArray(new ServiceReference[result.size()]);
+ }
+ }
+
+ public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+ {
+ checkValidBundleContext();
+ return getBundleManager().getServiceReferences(this, clazz, filter, false);
+ }
+
+ public Object getService(ServiceReference reference)
+ {
+ checkValidBundleContext();
+
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ return getBundleManager().getService(this, reference);
+ }
+
+ public ServiceReference getServiceReference(String clazz)
+ {
+ checkValidBundleContext();
+ if (clazz == null)
+ throw new IllegalArgumentException("Null clazz");
+ return getBundleManager().getServiceReference(this, clazz);
+ }
+
+ public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
+ {
+ checkValidBundleContext();
+ return getBundleManager().getServiceReferences(this, clazz, filter, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null class");
+ return registerService(new String[] { clazz }, service, properties);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
+ {
+ checkValidBundleContext();
+
+ OSGiServiceState serviceState = getBundleManager().registerService(this, clazzes, service, properties);
+ return serviceState.getRegistration();
+ }
+
+ /**
+ * Unregister a service
+ *
+ * @param serviceState the service state
+ */
+ void unregisterService(OSGiServiceState serviceState)
+ {
+ getBundleManager().unregisterService(serviceState);
+ }
+
+ public boolean ungetService(ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ // Check if the service is still in use by this bundle
+ OSGiServiceState serviceState = ((OSGiServiceReferenceWrapper)reference).getServiceState();
+ if (isServiceInUse(serviceState) == false)
+ return false;
+
+ checkValidBundleContext();
+
+ return getBundleManager().ungetService(this, reference);
+ }
+
+ boolean ungetService(OSGiServiceState state)
+ {
+ return getBundleManager().ungetService(this, state);
+ }
+
+ public void addBundleListener(BundleListener listener)
+ {
+ checkValidBundleContext();
+
+ if (listener instanceof SynchronousBundleListener)
+ checkAdminPermission(AdminPermission.LISTENER);
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.addBundleListener(this, listener);
+ }
+
+ public void removeBundleListener(BundleListener listener)
+ {
+ checkValidBundleContext();
+
+ if (listener instanceof SynchronousBundleListener)
+ checkAdminPermission(AdminPermission.LISTENER);
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.removeBundleListener(this, listener);
+ }
+
+ public void start() throws BundleException
+ {
+ start(0);
+ }
+
+ public void stop() throws BundleException
+ {
+ stop(0);
+ }
+
+ public void update() throws BundleException
+ {
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] update
+ throw new UnsupportedOperationException("update");
+ }
+
+ public void update(InputStream in) throws BundleException
+ {
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] update
+ throw new UnsupportedOperationException("update");
+ }
+
+ public void uninstall() throws BundleException
+ {
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ getBundleManager().uninstall(this);
+ }
+
+ void uninstallInternal()
+ {
+ changeState(Bundle.UNINSTALLED);
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.removeFrameworkListeners(this);
+ plugin.removeBundleListeners(this);
+ plugin.removeServiceListeners(this);
+ }
+
+ public void addFrameworkListener(FrameworkListener listener)
+ {
+ checkValidBundleContext();
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.addFrameworkListener(this, listener);
+ }
+
+ public void removeFrameworkListener(FrameworkListener listener)
+ {
+ checkValidBundleContext();
+
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.removeFrameworkListener(this, listener);
+ }
+
+ public Bundle installBundle(String location, InputStream input) throws BundleException
+ {
+ checkValidBundleContext();
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+ // [TODO] installBundle
+ throw new UnsupportedOperationException("installBundle");
+ }
+
+ public Bundle installBundle(String location) throws BundleException
+ {
+ checkValidBundleContext();
+ checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
+
+ URL url = getLocationURL(location);
+ AbstractBundleState bundleState = getBundleManager().install(url);
+ return bundleState.getBundleInternal();
+ }
+
+ private URL getLocationURL(String location) throws BundleException
+ {
+ // Try location as URL
+ URL url = null;
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+
+ // Try location as File
+ if (url == null)
+ {
+ try
+ {
+ File file = new File(location);
+ if (file.exists())
+ url = file.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ if (url == null)
+ throw new BundleException("Unable to handle location=" + location);
+
+ return url;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Bundle{" + getCanonicalName() + "}";
+ }
+
+ /**
+ * Get the canonical name of the bundle
+ *
+ * @return the canonical name
+ */
+ String getCanonicalName()
+ {
+ return getSymbolicName() + ":" + getVersion();
+ }
+
+ /**
+ * Set the bundle manager
+ *
+ * @param bundleManager the bundle manager or null to uninstall the bundle
+ */
+ void setBundleManager(OSGiBundleManager bundleManager)
+ {
+ if (bundleManager != null && this.bundleManager != null)
+ throw new IllegalStateException("Bundle " + this + " is already installed");
+
+ this.bundleManager = bundleManager;
+ }
+
+ /**
+ * Get the source of a class for ServiceReference.isAssignable()
+ *
+ * @param className the class name
+ * @return the source or null if no source
+ */
+ Object getSource(String className)
+ {
+ // [TODO] some more efficient way than using the class?
+ try
+ {
+ return loadClass(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Change the state of the bundle
+ *
+ * @param state the new state
+ */
+ public void changeState(int state)
+ {
+ int previous = getState();
+ int type = 0;
+ switch (state)
+ {
+ case Bundle.STARTING:
+ type = BundleEvent.STARTING;
+ break;
+ case Bundle.ACTIVE:
+ type = BundleEvent.STARTED;
+ break;
+ case Bundle.STOPPING:
+ type = BundleEvent.STOPPING;
+ break;
+ case Bundle.UNINSTALLED:
+ type = BundleEvent.UNINSTALLED;
+ break;
+ case Bundle.INSTALLED:
+ {
+ if (previous == Bundle.RESOLVED)
+ type = BundleEvent.UNRESOLVED;
+ else
+ type = BundleEvent.INSTALLED;
+ break;
+ }
+ case Bundle.RESOLVED:
+ {
+ if (previous == Bundle.STOPPING)
+ type = BundleEvent.STOPPED;
+ else
+ type = BundleEvent.RESOLVED;
+ break;
+ }
+ default:
+ throw new IllegalArgumentException("Unknown bundle state: " + state);
+ }
+ this.state.set(state);
+ log.debug(this + " change state=" + ConstantsHelper.bundleState(state));
+
+ if (getBundleManager().isActive())
+ {
+ FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireBundleEvent(this, type);
+ }
+ }
+
+ /**
+ * Check the bundle is installed
+ *
+ * @throws IllegalStateException when the bundle is not installed
+ */
+ protected void checkInstalled()
+ {
+ if ((getState() & Bundle.UNINSTALLED) != 0)
+ throw new IllegalStateException("Bundle " + getCanonicalName() + " is not installed");
+ }
+
+ /**
+ * Check a bundle context is still valid
+ *
+ * @return the bundle context
+ * @throws IllegalArgumentException when the context is no longer valid
+ */
+ protected synchronized BundleContext checkValidBundleContext()
+ {
+ BundleContext result = this.bundleContext;
+ if (result == null)
+ throw new IllegalStateException("Bundle context is no longer valid: " + getCanonicalName());
+ return result;
+ }
+
+ /**
+ * Check the admin permission
+ *
+ * @param what what permission to check
+ * @throws SecurityException when the caller does not have the AdminPermission and a security manager is installed
+ */
+ protected void checkAdminPermission(String what)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new AdminPermission(this, what));
+ }
+
+ /**
+ * Checks if we have the admin permission
+ *
+ * @param what the permission to check
+ * @return true if the caller doesn't have the permission
+ */
+ protected boolean noAdminPermission(String what)
+ {
+ try
+ {
+ checkAdminPermission(what);
+ return false;
+ }
+ catch (SecurityException e)
+ {
+ return true;
+ }
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleContextWrapper.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.io.File;
import java.io.InputStream;
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,1144 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.bundle;
-
-import static org.jboss.osgi.spi.Constants.PROPERTY_AUTO_START;
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes.Name;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.deployer.DeploymentStage;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-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.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.AutoInstallPlugin;
-import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
-import org.jboss.osgi.plugins.facade.api.FrameworkEventsPlugin;
-import org.jboss.osgi.plugins.facade.api.PackageAdminServicePlugin;
-import org.jboss.osgi.plugins.facade.api.Plugin;
-import org.jboss.osgi.plugins.facade.api.ServicePlugin;
-import org.jboss.osgi.plugins.filter.NoFilter;
-import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.plugins.resolver.BundleResolver;
-import org.jboss.util.collection.ConcurrentSet;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * OSGiBundleManager.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleManager
-{
- /** The log */
- private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
-
- /** The bundle manager's bean name: OSGiBundleManager */
- public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
-
- /** The framework version */
- private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // [TODO] externalise
-
- /** The framework vendor */
- private static String OSGi_FRAMEWORK_VENDOR = "jboss.org"; // [TODO] externalise
-
- /** The framework language */
- private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
-
- /** The os name */
- private static String OSGi_FRAMEWORK_OS_NAME;
-
- /** The os version */
- private static String OSGi_FRAMEWORK_OS_VERSION;
-
- /** The os version */
- private static String OSGi_FRAMEWORK_PROCESSOR;
-
- /** The bundles resolver */
- private BundleResolver bundleResolver;
-
- /** The bundles by id */
- private List<AbstractBundleState> bundles = new CopyOnWriteArrayList<AbstractBundleState>();
-
- /** The registered services */
- private Set<OSGiServiceState> registeredServices = new ConcurrentSet<OSGiServiceState>();
-
- /** The kernel */
- private Kernel kernel;
-
- /** The main deployer */
- private DeployerClient deployerClient;
-
- /** The deployment structure */
- private MainDeployerStructure deployerStructure;
-
- /** The executor */
- private Executor executor;
-
- /** The system bundle */
- private OSGiSystemState systemBundle;
-
- /** The registered manager plugins */
- private Map<Class<?>, Plugin> plugins = new LinkedHashMap<Class<?>, Plugin>();
-
- /** The frame work properties */
- private Map<String, Object> properties = new HashMap<String, Object>();
-
- static
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
- OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
- OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
-
- System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
- return null;
- }
- });
- }
-
- /**
- * Create a new OSGiBundleManager.
- *
- * @param kernel the kernel
- * @param deployerClient the deployer client
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
- {
- this(kernel, deployerClient, null);
- }
-
- /**
- * Create a new OSGiBundleManager.
- *
- * @param kernel the kernel
- * @param deployerClient the deployer client
- * @param executor the executor
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
- {
- if (kernel == null)
- throw new IllegalArgumentException("Null kernel");
- if (deployerClient == null)
- throw new IllegalArgumentException("Null deployerClient");
- if (deployerClient instanceof MainDeployerStructure == false)
- throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
-
- this.kernel = kernel;
- this.deployerClient = deployerClient;
- this.deployerStructure = (MainDeployerStructure)deployerClient;
- this.bundleResolver = new BundleResolver(this);
-
- // TODO thread factory
- if (executor == null)
- executor = Executors.newFixedThreadPool(10);
-
- this.executor = executor;
- }
-
- public void start()
- {
- // createSystemBundle
- Manifest manifest = new Manifest();
- Attributes attributes = manifest.getMainAttributes();
- attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
- attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
- OSGiMetaData systemMetaData = new AbstractOSGiMetaData(manifest);
- addBundle(systemBundle = new OSGiSystemState(this, systemMetaData));
- }
-
- /**
- * Get the kernel
- */
- public Kernel getKernel()
- {
- return kernel;
- }
-
- /**
- * Set the framework properties
- *
- * @param properties the properties
- */
- public void setProperties(Map<String, Object> properties)
- {
- this.properties = properties;
-
- // Init default framework properties
- if (getProperty(Constants.FRAMEWORK_VERSION) == null)
- setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
- if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
- setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
- if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
- setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
- if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
- setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
- if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
- setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
- if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
- setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
- }
-
- /**
- * Get a property
- *
- * @param key the property key
- * @return the property
- * @throws SecurityException if the caller doesn't have the relevant property permission
- */
- public String getProperty(String key)
- {
- Object value = properties.get(key);
- if (value == null)
- value = System.getProperty(key);
-
- if (value instanceof String == false)
- return null;
-
- return (String)value;
- }
-
- /**
- * Set a property. This is used at the frame work init state.
- *
- * @param key the prperty key
- * @param value the property value
- */
- public void setProperty(String key, String value)
- {
- properties.put(key, value);
- }
-
- /**
- * Get a plugin that is registered with the bundle manager.
- *
- * @param <T> the pluging type
- * @param clazz the plugin type
- * @return the plugin
- * @throws IllegalStateException if the requested plugin class is not registered
- */
- @SuppressWarnings("unchecked")
- public <T extends Plugin> T getPlugin(Class<T> clazz)
- {
- T plugin = (T)plugins.get(clazz);
- if (plugin == null)
- throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
-
- return plugin;
- }
-
- /**
- * Get an optional plugin that is registered with the bundle manager.
- *
- * @param <T> the pluging type
- * @param clazz the plugin type
- * @return The plugin instance or null if the requested plugin class is not registered
- */
- @SuppressWarnings("unchecked")
- public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
- {
- return (T)plugins.get(clazz);
- }
-
- /**
- * Add a plugin
- *
- * @param plugin the plugin
- */
- public void addPlugin(Plugin plugin)
- {
- Class<? extends Plugin> clazz = plugin.getClass();
- for (Class<?> interf : clazz.getInterfaces())
- {
- if (Plugin.class.isAssignableFrom(interf))
- {
- log.debug("Add plugin: " + clazz.getName());
- plugins.put(interf, plugin);
- }
- }
- }
-
- /**
- * Remove a plugin
- *
- * @param plugin the plugin to remove
- */
- public void removePlugin(Plugin plugin)
- {
- Class<? extends Plugin> clazz = plugin.getClass();
- for (Class<?> interf : clazz.getInterfaces())
- {
- if (Plugin.class.isAssignableFrom(interf))
- {
- log.debug("Remove plugin: " + clazz.getName());
- plugins.remove(interf);
- }
- }
- }
-
- /**
- * Get the bundle resolver
- */
- public BundleResolver getBundleResolver()
- {
- return bundleResolver;
- }
-
- /**
- * Are we active
- *
- * @return true when the system is active
- */
- public boolean isActive()
- {
- // We are active if the system bundle is at least in the starting/stopping state
- AbstractBundleState bundleState = getSystemBundle();
- return bundleState.getState() >= Bundle.STARTING;
- }
-
- /**
- * Install a bundle
- *
- * @param url the url of the bundle
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState install(URL url) throws BundleException
- {
- if (url == null)
- throw new BundleException("Null url");
-
- try
- {
- VirtualFile root = VFS.getRoot(url);
- return install(root);
- }
- catch (IOException e)
- {
- throw new BundleException("Error installing bundle from location=" + url, e);
- }
- }
-
- /**
- * Install a bundle
- *
- * @param file the virtual file
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState install(VirtualFile file) throws BundleException
- {
- if (file == null)
- throw new BundleException("Null file");
-
- try
- {
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
- MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- att.addAttachment(PROPERTY_AUTO_START, Boolean.FALSE);
-
- deployerClient.deploy(deployment);
- try
- {
- DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
- if (bundleState == null)
- throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
-
- return bundleState;
- }
- catch (Exception e)
- {
- deployerClient.undeploy(deployment);
- throw e;
- }
- }
- catch (Exception e)
- {
- throw new BundleException("Error installing bundle from location=" + file, e);
- }
- }
-
- /**
- * Uninstall a bundle
- *
- * @param bundle the bundle
- * @throws BundleException for any error
- */
- public void uninstall(Bundle bundle) throws BundleException
- {
- long id = bundle.getBundleId();
- if (id == 0)
- throw new IllegalArgumentException("Cannot uninstall system bundle");
-
- OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
- if (bundleState == null)
- throw new BundleException(bundle + " not installed");
-
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- try
- {
- deployerClient.undeploy(unit.getName());
- bundleState.modified();
- }
- catch (DeploymentException e)
- {
- throw new BundleException("Unable to uninstall " + bundleState, e);
- }
- }
-
- /**
- * Add a deployment
- *
- * @param unit the deployment unit
- * @return the bundle state
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleState addDeployment(DeploymentUnit unit)
- {
- if (unit == null)
- throw new IllegalArgumentException("Null unit");
-
- OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
- if (osgiMetaData == null)
- throw new IllegalStateException("Cannot obtain OSGi metadata");
-
- OSGiBundleState bundleState = new OSGiBundleState(osgiMetaData, unit);
- addBundle(bundleState);
- return bundleState;
- }
-
- /**
- * Generate a name for the deployment unit
- *
- * todo some better solution
- *
- * @param unit the deployment unit
- * @return the name
- */
- protected String generateName(DeploymentUnit unit)
- {
- StringBuilder result = new StringBuilder();
- String name = unit.getName();
- for (int i = 0; i < name.length(); ++i)
- {
- char c = name.charAt(i);
- if (Character.isJavaIdentifierPart(c))
- result.append(c);
- else
- result.append('_');
- }
- return result.toString();
- }
-
- /**
- * Add a bundle
- *
- * @param bundleState the bundle state
- * @throws IllegalArgumentException for a null bundle state
- */
- public void addBundle(AbstractBundleState bundleState)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle state");
-
- // todo more validation
- OSGiMetaData metaData = bundleState.getOSGiMetaData();
- if (metaData.isSingleton())
- {
- String symbolicName = metaData.getBundleSymbolicName();
- for (AbstractBundleState bundle : getBundles())
- {
- OSGiMetaData other = bundle.getOSGiMetaData();
- if (other.isSingleton() && symbolicName.equals(other.getBundleSymbolicName()))
- throw new IllegalStateException("Cannot install singleton " + bundleState + " another singleton is already installed: " + bundle);
- }
- }
-
- bundleState.setBundleManager(this);
- bundleState.changeState(Bundle.INSTALLED);
- bundles.add(bundleState);
- log.debug("Added " + bundleState.getCanonicalName() + " id=" + bundleState.getBundleId());
- }
-
- /**
- * Remove a bundle
- *
- * @param bundleState the bundle state
- * @throws IllegalArgumentException for a null bundle state
- */
- public void removeBundle(AbstractBundleState bundleState)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle state");
-
- bundleState.uninstallInternal();
- bundleState.setBundleManager(null);
- bundleResolver.removeBundle(bundleState);
- bundles.remove(bundleState);
- log.debug("Removed " + bundleState.getCanonicalName());
- }
-
- /**
- * Get the system bundle
- *
- * @return the system bundle
- */
- public OSGiSystemState getSystemBundle()
- {
- return systemBundle;
- }
-
- /**
- * Get the system bundle context
- *
- * @return the system bundle context
- */
- public BundleContext getBundleContext()
- {
- return systemBundle.getBundleContext();
- }
-
- /**
- * Get a deployment
- *
- * @param id the id of the bundle
- * @return the deployment or null if there is no bundle with that id
- */
- public DeploymentUnit getDeployment(long id)
- {
- if (id == 0)
- throw new IllegalArgumentException("Cannot get deployment from system bundle");
-
- OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
- if (bundleState == null)
- return null;
-
- return bundleState.getDeploymentUnit();
- }
-
- /**
- * Get a bundle by id
- *
- * @param id the id of the bundle
- * @return the bundle or null if there is no bundle with that id
- */
- public AbstractBundleState getBundleById(long id)
- {
- AbstractBundleState result = null;
- for (AbstractBundleState aux : bundles)
- {
- if (id == aux.getBundleId())
- {
- result = aux;
- break;
- }
- }
- return result;
- }
-
- /**
- * Get a bundle by location
- *
- * @param location the location of the bundle
- * @return the bundle or null if there is no bundle with that location
- */
- public AbstractBundleState getBundleByLocation(String location)
- {
- AbstractBundleState result = null;
- for (AbstractBundleState aux : bundles)
- {
- String auxLocation = aux.getLocation();
- if (auxLocation.equals(location))
- {
- result = aux;
- break;
- }
- }
- return result;
- }
-
- /**
- * Get all the bundles
- *
- * @return the bundles
- */
- public Collection<AbstractBundleState> getBundles()
- {
- return Collections.unmodifiableList(bundles);
- }
-
- /**
- * Get the bundles with the given state
- *
- * @return the bundles
- */
- public Collection<AbstractBundleState> getBundles(int state)
- {
- List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
- for (AbstractBundleState aux : getBundles())
- {
- if (aux.getState() == state)
- bundles.add(aux);
- }
- return bundles;
- }
-
- /**
- * Resolve a bundle
- *
- * @param bundleState the bundle state
- * @param errorOnFail whether to throw an error if it cannot be resolved
- * @return true when resolved
- */
- public boolean resolve(OSGiBundleState bundleState, boolean errorOnFail)
- {
- int state = bundleState.getState();
- if (state != Bundle.INSTALLED)
- return true;
-
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- ControllerContext context = unit.getAttachment(ControllerContext.class);
-
- ControllerState requiredState = context.getRequiredState();
- DeploymentStage requiredStage = unit.getRequiredStage();
-
- try
- {
- deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
- deployerClient.checkComplete(unit.getName());
- bundleState.changeState(Bundle.RESOLVED);
- return true;
- }
- catch (DeploymentException ex)
- {
- unit.setRequiredStage(requiredStage);
- context.setRequiredState(requiredState);
-
- if (errorOnFail)
- throw new IllegalStateException("Error resolving bundle: " + bundleState, ex);
-
- return false;
- }
- }
-
- /**
- * Start a bundle
- *
- * @param bundleState the bundle state
- * @throws BundleException the bundle exception
- */
- public void start(OSGiBundleState bundleState) throws BundleException
- {
- // Resolve all INSTALLED bundles through the PackageAdmin
- PackageAdmin packageAdmin = getPlugin(PackageAdminServicePlugin.class);
- packageAdmin.resolveBundles(null);
-
- try
- {
- String name = bundleState.getDeploymentUnit().getName();
- deployerClient.change(name, DeploymentStages.INSTALLED);
- deployerClient.checkComplete(name);
- }
- catch (DeploymentException e)
- {
- Throwable t = e.getCause();
- if (t instanceof BundleException)
- throw (BundleException)t;
- throw new BundleException("Error starting " + bundleState, e);
- }
- }
-
- /**
- * Stop a bundle
- *
- * @param bundleState the bundle state
- * @throws BundleException the bundle exception
- */
- public void stop(OSGiBundleState bundleState) throws BundleException
- {
- try
- {
- String name = bundleState.getDeploymentUnit().getName();
- deployerClient.change(name, DeploymentStages.CLASSLOADER);
- }
- catch (DeploymentException e)
- {
- Throwable t = e.getCause();
- if (t instanceof BundleException)
- throw (BundleException)t;
- throw new BundleException("Error stopping " + bundleState, e);
- }
- }
-
- /**
- * Get services
- *
- * @param bundleState the referencing bundle
- * @param clazz any class
- * @param filter any filter
- * @param checkAssignable whether to check isAssignable
- * @return the services
- */
- Collection<OSGiServiceState> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
- {
- if (filter == null)
- filter = NoFilter.INSTANCE;
-
- if (registeredServices.isEmpty())
- return null;
-
- // Don't check assignabilty for the system bundle
- if (bundle.getBundleId() == 0)
- checkAssignable = false;
-
- // review: optimise this, e.g. index by class
- // Use a sorted set to order services according to spec
- Set<OSGiServiceState> result = new TreeSet<OSGiServiceState>(ServiceComparator.INSTANCE);
- for (OSGiServiceState service : registeredServices)
- {
- // Check the state, filter and permission
- if (service.isUnregistered() == false && filter.match(service) && service.hasPermission())
- {
- // Check any passed class matches
- if (clazz == null || service.matchClass(clazz))
- {
- // Check the assignability
- if (checkAssignable == false || service.isAssignable(bundle))
- result.add(service);
- }
- }
- }
- return result;
- }
-
- /**
- * Get service reference
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @return the reference
- */
- ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
- {
- Collection<OSGiServiceState> services = getServices(bundle, clazz, null, true);
- if (services == null || services.isEmpty())
- return null;
-
- // If multiple such services exist, the service with the highest ranking (as specified in its SERVICE_RANKING property) is returned.
- // If there is a tie in ranking, the service with the lowest service ID (as specified in its SERVICE_ID property);
- // that is, the service that was registered first is returned.
-
- long bestId = 0;
- int bestRanking = 0;
- ServiceReference bestMatch = null;
- for (OSGiServiceState service : services)
- {
- long id = service.getServiceId();
- int ranking = service.getServiceRanking();
- if (bestMatch == null || ranking > bestRanking || (ranking == bestRanking && id < bestId))
- {
- bestMatch = service.getReferenceInternal();
- bestRanking = ranking;
- bestId = id;
- }
- }
-
- return bestMatch;
- }
-
- /**
- * Get service references
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @param filter any filter
- * @param checkAssignable whether to check isAssignable
- * @return the services
- */
- ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
- {
- Collection<OSGiServiceState> services = getServices(bundle, clazz, filter, checkAssignable);
- if (services == null || services.isEmpty())
- return null;
-
- ServiceReference[] result = new ServiceReference[services.size()];
-
- int i = 0;
- for (OSGiServiceState service : services)
- result[i++] = service.getReferenceInternal();
-
- return result;
- }
-
- /**
- * Get service references
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @param filterStr any filter
- * @param checkAssignable
- * @param checkAssignable whether to check isAssignable
- * @return the services
- * @throws InvalidSyntaxException when the filter is invalid
- */
- ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr, boolean checkAssignable) throws InvalidSyntaxException
- {
- Filter filter = NoFilter.INSTANCE;
- if (filterStr != null)
- filter = FrameworkUtil.createFilter(filterStr);
-
- return getServiceReferences(bundle, clazz, filter, checkAssignable);
- }
-
- /**
- * Register a service
- *
- * @param bundleState the bundle
- * @param clazzes the classes to implement
- * @param service the service
- * @param properties the properties
- * @return the service state
- */
- @SuppressWarnings("unchecked")
- OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
- {
- OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
- result.internalRegister();
- registeredServices.add(result);
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
- log.debug("Registered service : " + result.toLongString());
- return result;
- }
-
- /**
- * Unregister a service
- *
- * @param serviceState the service state
- */
- void unregisterService(OSGiServiceState serviceState)
- {
- log.debug("Unregistering service: " + serviceState.toLongString());
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(serviceState.getBundleState(), ServiceEvent.UNREGISTERING, serviceState);
- registeredServices.remove(serviceState);
- serviceState.internalUnregister();
- }
-
- /**
- * Get a service
- *
- * @param bundleState the bundle that requests the service
- * @param reference the service reference
- * @return the service
- */
- Object getService(AbstractBundleState bundleState, ServiceReference reference)
- {
- OSGiServiceReferenceWrapper serviceReference = (OSGiServiceReferenceWrapper)reference;
- OSGiServiceState serviceState = serviceReference.getServiceState();
- Object result = serviceState.getService(bundleState);
- if (result != null)
- bundleState.addServiceInUse(serviceState);
- return result;
- }
-
- /**
- * Unget a service
- *
- * @param bundleState the bundle state
- * @param reference the service reference
- * @return true when the service is still in use by the bundle
- */
- boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
- OSGiServiceReferenceWrapper serviceReference = (OSGiServiceReferenceWrapper)reference;
- OSGiServiceState serviceState = serviceReference.getServiceState();
- return ungetService(bundleState, serviceState);
- }
-
- /**
- * Unget a service
- *
- * @param bundleState the bundle state
- * @param service the service
- * @return true when the service is still in use by the bundle
- */
- boolean ungetService(AbstractBundleState bundleState, OSGiServiceState service)
- {
- return bundleState.removeServiceInUse(service);
- }
-
- /**
- * Get the executor.
- *
- * @return the executor.
- */
- Executor getExecutor()
- {
- return executor;
- }
-
- /**
- * Init the Framework
- */
- public void initFramework()
- {
- // Log INFO about this implementation
- log.info(getClass().getPackage().getImplementationTitle());
- log.info(getClass().getPackage().getImplementationVersion());
-
- int state = systemBundle.getState();
-
- // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
- if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
- return;
-
- // Put into the STARTING state
- systemBundle.changeState(Bundle.STARTING);
-
- // [TODO] Be at start level 0
-
- // [TODO] Have event handling enabled
-
- // Cleanup the storage area
- String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
- BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
- if (storagePlugin != null)
- storagePlugin.cleanStorage(storageClean);
- }
-
- /**
- * Start the framework
- *
- * @throws BundleException for any error
- */
- public void startFramework() throws BundleException
- {
- // If this Framework is not in the STARTING state, initialize this Framework
- if (systemBundle.getState() != Bundle.STARTING)
- initFramework();
-
- // Create the system bundl context
- systemBundle.createBundleContext();
-
- // Start registered service plugins
- for (Plugin plugin : plugins.values())
- {
- if (plugin instanceof ServicePlugin)
- {
- ServicePlugin servicePlugin = (ServicePlugin)plugin;
- servicePlugin.startService();
- }
- }
-
- // All installed bundles must be started
- AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
- if (autoInstall != null)
- {
- autoInstall.installBundles();
- autoInstall.startBundles();
- }
-
- // This Framework's state is set to ACTIVE
- systemBundle.changeState(Bundle.ACTIVE);
-
- // A framework event of type STARTED is fired
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
- }
-
- /**
- * Stop the framework
- */
- public void stopFramework()
- {
- AbstractBundleState systemBundle = getSystemBundle();
- if (systemBundle.getState() != Bundle.ACTIVE)
- return;
-
- systemBundle.changeState(Bundle.STOPPING);
- for (AbstractBundleState bundleState : getBundles())
- {
- if (bundleState != systemBundle)
- {
- try
- {
- // [TODO] don't change the persistent state
- bundleState.stop();
- }
- catch (Throwable t)
- {
- fireWarning(bundleState, "stopping bundle", t);
- }
- }
- }
-
- // Stop registered service plugins
- List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
- Collections.reverse(reverseServicePlugins);
- for (Plugin plugin : reverseServicePlugins)
- {
- if (plugin instanceof ServicePlugin)
- {
- ServicePlugin servicePlugin = (ServicePlugin)plugin;
- servicePlugin.stopService();
- }
- }
-
- systemBundle.changeState(Bundle.RESOLVED);
- }
-
- /**
- * Stop the framework
- */
- public void restartFramework()
- {
- AbstractBundleState systemBundle = getSystemBundle();
- if (systemBundle.getState() != Bundle.ACTIVE)
- return;
-
- for (AbstractBundleState bundleState : getBundles())
- {
- if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
- {
- try
- {
- // [TODO] don't change the persistent state
- bundleState.stop();
- }
- catch (Throwable t)
- {
- fireWarning(bundleState, "stopping bundle", t);
- }
- try
- {
- bundleState.start();
- }
- catch (Throwable t)
- {
- fireError(bundleState, "starting bundle", t);
- }
- }
- }
- }
-
- /**
- * Fire a framework error
- *
- * @param bundleState the bundle state
- * @param context the msg context
- * @param t the throwable
- */
- void fireError(Bundle bundle, String context, Throwable t)
- {
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- if (t instanceof BundleException)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
- else if (bundle != null)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
- else
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
- }
-
- /**
- * Fire a framework error
- *
- * @param bundleState the bundle state
- * @param context the msg context
- * @param t the throwable
- */
- void fireWarning(Bundle bundle, String context, Throwable t)
- {
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- if (t instanceof BundleException)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
- else if (bundle != null)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
- else
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
- }
-
- /**
- * ServiceComparator, reverses the order of compareTo
- */
- static class ServiceComparator implements Comparator<OSGiServiceState>
- {
- public static ServiceComparator INSTANCE = new ServiceComparator();
-
- public int compare(OSGiServiceState o1, OSGiServiceState o2)
- {
- return -o1.compareTo(o2);
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,1144 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import static org.jboss.osgi.spi.Constants.PROPERTY_AUTO_START;
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+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.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.filter.NoFilter;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractOSGiMetaData;
+import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.plugins.PackageAdminServicePlugin;
+import org.jboss.osgi.framework.plugins.Plugin;
+import org.jboss.osgi.framework.plugins.ServicePlugin;
+import org.jboss.osgi.framework.resolver.BundleResolver;
+import org.jboss.util.collection.ConcurrentSet;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * OSGiBundleManager.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleManager
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
+
+ /** The bundle manager's bean name: OSGiBundleManager */
+ public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
+
+ /** The framework version */
+ private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // [TODO] externalise
+
+ /** The framework vendor */
+ private static String OSGi_FRAMEWORK_VENDOR = "jboss.org"; // [TODO] externalise
+
+ /** The framework language */
+ private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
+
+ /** The os name */
+ private static String OSGi_FRAMEWORK_OS_NAME;
+
+ /** The os version */
+ private static String OSGi_FRAMEWORK_OS_VERSION;
+
+ /** The os version */
+ private static String OSGi_FRAMEWORK_PROCESSOR;
+
+ /** The bundles resolver */
+ private BundleResolver bundleResolver;
+
+ /** The bundles by id */
+ private List<AbstractBundleState> bundles = new CopyOnWriteArrayList<AbstractBundleState>();
+
+ /** The registered services */
+ private Set<OSGiServiceState> registeredServices = new ConcurrentSet<OSGiServiceState>();
+
+ /** The kernel */
+ private Kernel kernel;
+
+ /** The main deployer */
+ private DeployerClient deployerClient;
+
+ /** The deployment structure */
+ private MainDeployerStructure deployerStructure;
+
+ /** The executor */
+ private Executor executor;
+
+ /** The system bundle */
+ private OSGiSystemState systemBundle;
+
+ /** The registered manager plugins */
+ private Map<Class<?>, Plugin> plugins = new LinkedHashMap<Class<?>, Plugin>();
+
+ /** The frame work properties */
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
+ static
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
+ OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
+ OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
+
+ System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create a new OSGiBundleManager.
+ *
+ * @param kernel the kernel
+ * @param deployerClient the deployer client
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
+ {
+ this(kernel, deployerClient, null);
+ }
+
+ /**
+ * Create a new OSGiBundleManager.
+ *
+ * @param kernel the kernel
+ * @param deployerClient the deployer client
+ * @param executor the executor
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
+ {
+ if (kernel == null)
+ throw new IllegalArgumentException("Null kernel");
+ if (deployerClient == null)
+ throw new IllegalArgumentException("Null deployerClient");
+ if (deployerClient instanceof MainDeployerStructure == false)
+ throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
+
+ this.kernel = kernel;
+ this.deployerClient = deployerClient;
+ this.deployerStructure = (MainDeployerStructure)deployerClient;
+ this.bundleResolver = new BundleResolver(this);
+
+ // TODO thread factory
+ if (executor == null)
+ executor = Executors.newFixedThreadPool(10);
+
+ this.executor = executor;
+ }
+
+ public void start()
+ {
+ // createSystemBundle
+ Manifest manifest = new Manifest();
+ Attributes attributes = manifest.getMainAttributes();
+ attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
+ attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
+ OSGiMetaData systemMetaData = new AbstractOSGiMetaData(manifest);
+ addBundle(systemBundle = new OSGiSystemState(this, systemMetaData));
+ }
+
+ /**
+ * Get the kernel
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ /**
+ * Set the framework properties
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Object> properties)
+ {
+ this.properties = properties;
+
+ // Init default framework properties
+ if (getProperty(Constants.FRAMEWORK_VERSION) == null)
+ setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
+ if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
+ setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
+ if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
+ setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
+ if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
+ setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
+ if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
+ setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
+ if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
+ setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
+ }
+
+ /**
+ * Get a property
+ *
+ * @param key the property key
+ * @return the property
+ * @throws SecurityException if the caller doesn't have the relevant property permission
+ */
+ public String getProperty(String key)
+ {
+ Object value = properties.get(key);
+ if (value == null)
+ value = System.getProperty(key);
+
+ if (value instanceof String == false)
+ return null;
+
+ return (String)value;
+ }
+
+ /**
+ * Set a property. This is used at the frame work init state.
+ *
+ * @param key the prperty key
+ * @param value the property value
+ */
+ public void setProperty(String key, String value)
+ {
+ properties.put(key, value);
+ }
+
+ /**
+ * Get a plugin that is registered with the bundle manager.
+ *
+ * @param <T> the pluging type
+ * @param clazz the plugin type
+ * @return the plugin
+ * @throws IllegalStateException if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Plugin> T getPlugin(Class<T> clazz)
+ {
+ T plugin = (T)plugins.get(clazz);
+ if (plugin == null)
+ throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
+
+ return plugin;
+ }
+
+ /**
+ * Get an optional plugin that is registered with the bundle manager.
+ *
+ * @param <T> the pluging type
+ * @param clazz the plugin type
+ * @return The plugin instance or null if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
+ {
+ return (T)plugins.get(clazz);
+ }
+
+ /**
+ * Add a plugin
+ *
+ * @param plugin the plugin
+ */
+ public void addPlugin(Plugin plugin)
+ {
+ Class<? extends Plugin> clazz = plugin.getClass();
+ for (Class<?> interf : clazz.getInterfaces())
+ {
+ if (Plugin.class.isAssignableFrom(interf))
+ {
+ log.debug("Add plugin: " + clazz.getName());
+ plugins.put(interf, plugin);
+ }
+ }
+ }
+
+ /**
+ * Remove a plugin
+ *
+ * @param plugin the plugin to remove
+ */
+ public void removePlugin(Plugin plugin)
+ {
+ Class<? extends Plugin> clazz = plugin.getClass();
+ for (Class<?> interf : clazz.getInterfaces())
+ {
+ if (Plugin.class.isAssignableFrom(interf))
+ {
+ log.debug("Remove plugin: " + clazz.getName());
+ plugins.remove(interf);
+ }
+ }
+ }
+
+ /**
+ * Get the bundle resolver
+ */
+ public BundleResolver getBundleResolver()
+ {
+ return bundleResolver;
+ }
+
+ /**
+ * Are we active
+ *
+ * @return true when the system is active
+ */
+ public boolean isActive()
+ {
+ // We are active if the system bundle is at least in the starting/stopping state
+ AbstractBundleState bundleState = getSystemBundle();
+ return bundleState.getState() >= Bundle.STARTING;
+ }
+
+ /**
+ * Install a bundle
+ *
+ * @param url the url of the bundle
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState install(URL url) throws BundleException
+ {
+ if (url == null)
+ throw new BundleException("Null url");
+
+ try
+ {
+ VirtualFile root = VFS.getRoot(url);
+ return install(root);
+ }
+ catch (IOException e)
+ {
+ throw new BundleException("Error installing bundle from location=" + url, e);
+ }
+ }
+
+ /**
+ * Install a bundle
+ *
+ * @param file the virtual file
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState install(VirtualFile file) throws BundleException
+ {
+ if (file == null)
+ throw new BundleException("Null file");
+
+ try
+ {
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+ att.addAttachment(PROPERTY_AUTO_START, Boolean.FALSE);
+
+ deployerClient.deploy(deployment);
+ try
+ {
+ DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
+ OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ if (bundleState == null)
+ throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
+
+ return bundleState;
+ }
+ catch (Exception e)
+ {
+ deployerClient.undeploy(deployment);
+ throw e;
+ }
+ }
+ catch (Exception e)
+ {
+ throw new BundleException("Error installing bundle from location=" + file, e);
+ }
+ }
+
+ /**
+ * Uninstall a bundle
+ *
+ * @param bundle the bundle
+ * @throws BundleException for any error
+ */
+ public void uninstall(Bundle bundle) throws BundleException
+ {
+ long id = bundle.getBundleId();
+ if (id == 0)
+ throw new IllegalArgumentException("Cannot uninstall system bundle");
+
+ OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
+ if (bundleState == null)
+ throw new BundleException(bundle + " not installed");
+
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ try
+ {
+ deployerClient.undeploy(unit.getName());
+ bundleState.modified();
+ }
+ catch (DeploymentException e)
+ {
+ throw new BundleException("Unable to uninstall " + bundleState, e);
+ }
+ }
+
+ /**
+ * Add a deployment
+ *
+ * @param unit the deployment unit
+ * @return the bundle state
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleState addDeployment(DeploymentUnit unit)
+ {
+ if (unit == null)
+ throw new IllegalArgumentException("Null unit");
+
+ OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+ if (osgiMetaData == null)
+ throw new IllegalStateException("Cannot obtain OSGi metadata");
+
+ OSGiBundleState bundleState = new OSGiBundleState(osgiMetaData, unit);
+ addBundle(bundleState);
+ return bundleState;
+ }
+
+ /**
+ * Generate a name for the deployment unit
+ *
+ * todo some better solution
+ *
+ * @param unit the deployment unit
+ * @return the name
+ */
+ protected String generateName(DeploymentUnit unit)
+ {
+ StringBuilder result = new StringBuilder();
+ String name = unit.getName();
+ for (int i = 0; i < name.length(); ++i)
+ {
+ char c = name.charAt(i);
+ if (Character.isJavaIdentifierPart(c))
+ result.append(c);
+ else
+ result.append('_');
+ }
+ return result.toString();
+ }
+
+ /**
+ * Add a bundle
+ *
+ * @param bundleState the bundle state
+ * @throws IllegalArgumentException for a null bundle state
+ */
+ public void addBundle(AbstractBundleState bundleState)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle state");
+
+ // todo more validation
+ OSGiMetaData metaData = bundleState.getOSGiMetaData();
+ if (metaData.isSingleton())
+ {
+ String symbolicName = metaData.getBundleSymbolicName();
+ for (AbstractBundleState bundle : getBundles())
+ {
+ OSGiMetaData other = bundle.getOSGiMetaData();
+ if (other.isSingleton() && symbolicName.equals(other.getBundleSymbolicName()))
+ throw new IllegalStateException("Cannot install singleton " + bundleState + " another singleton is already installed: " + bundle);
+ }
+ }
+
+ bundleState.setBundleManager(this);
+ bundleState.changeState(Bundle.INSTALLED);
+ bundles.add(bundleState);
+ log.debug("Added " + bundleState.getCanonicalName() + " id=" + bundleState.getBundleId());
+ }
+
+ /**
+ * Remove a bundle
+ *
+ * @param bundleState the bundle state
+ * @throws IllegalArgumentException for a null bundle state
+ */
+ public void removeBundle(AbstractBundleState bundleState)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle state");
+
+ bundleState.uninstallInternal();
+ bundleState.setBundleManager(null);
+ bundleResolver.removeBundle(bundleState);
+ bundles.remove(bundleState);
+ log.debug("Removed " + bundleState.getCanonicalName());
+ }
+
+ /**
+ * Get the system bundle
+ *
+ * @return the system bundle
+ */
+ public OSGiSystemState getSystemBundle()
+ {
+ return systemBundle;
+ }
+
+ /**
+ * Get the system bundle context
+ *
+ * @return the system bundle context
+ */
+ public BundleContext getBundleContext()
+ {
+ return systemBundle.getBundleContext();
+ }
+
+ /**
+ * Get a deployment
+ *
+ * @param id the id of the bundle
+ * @return the deployment or null if there is no bundle with that id
+ */
+ public DeploymentUnit getDeployment(long id)
+ {
+ if (id == 0)
+ throw new IllegalArgumentException("Cannot get deployment from system bundle");
+
+ OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
+ if (bundleState == null)
+ return null;
+
+ return bundleState.getDeploymentUnit();
+ }
+
+ /**
+ * Get a bundle by id
+ *
+ * @param id the id of the bundle
+ * @return the bundle or null if there is no bundle with that id
+ */
+ public AbstractBundleState getBundleById(long id)
+ {
+ AbstractBundleState result = null;
+ for (AbstractBundleState aux : bundles)
+ {
+ if (id == aux.getBundleId())
+ {
+ result = aux;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get a bundle by location
+ *
+ * @param location the location of the bundle
+ * @return the bundle or null if there is no bundle with that location
+ */
+ public AbstractBundleState getBundleByLocation(String location)
+ {
+ AbstractBundleState result = null;
+ for (AbstractBundleState aux : bundles)
+ {
+ String auxLocation = aux.getLocation();
+ if (auxLocation.equals(location))
+ {
+ result = aux;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get all the bundles
+ *
+ * @return the bundles
+ */
+ public Collection<AbstractBundleState> getBundles()
+ {
+ return Collections.unmodifiableList(bundles);
+ }
+
+ /**
+ * Get the bundles with the given state
+ *
+ * @return the bundles
+ */
+ public Collection<AbstractBundleState> getBundles(int state)
+ {
+ List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
+ for (AbstractBundleState aux : getBundles())
+ {
+ if (aux.getState() == state)
+ bundles.add(aux);
+ }
+ return bundles;
+ }
+
+ /**
+ * Resolve a bundle
+ *
+ * @param bundleState the bundle state
+ * @param errorOnFail whether to throw an error if it cannot be resolved
+ * @return true when resolved
+ */
+ public boolean resolve(OSGiBundleState bundleState, boolean errorOnFail)
+ {
+ int state = bundleState.getState();
+ if (state != Bundle.INSTALLED)
+ return true;
+
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ ControllerContext context = unit.getAttachment(ControllerContext.class);
+
+ ControllerState requiredState = context.getRequiredState();
+ DeploymentStage requiredStage = unit.getRequiredStage();
+
+ try
+ {
+ deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+ deployerClient.checkComplete(unit.getName());
+ bundleState.changeState(Bundle.RESOLVED);
+ return true;
+ }
+ catch (DeploymentException ex)
+ {
+ unit.setRequiredStage(requiredStage);
+ context.setRequiredState(requiredState);
+
+ if (errorOnFail)
+ throw new IllegalStateException("Error resolving bundle: " + bundleState, ex);
+
+ return false;
+ }
+ }
+
+ /**
+ * Start a bundle
+ *
+ * @param bundleState the bundle state
+ * @throws BundleException the bundle exception
+ */
+ public void start(OSGiBundleState bundleState) throws BundleException
+ {
+ // Resolve all INSTALLED bundles through the PackageAdmin
+ PackageAdmin packageAdmin = getPlugin(PackageAdminServicePlugin.class);
+ packageAdmin.resolveBundles(null);
+
+ try
+ {
+ String name = bundleState.getDeploymentUnit().getName();
+ deployerClient.change(name, DeploymentStages.INSTALLED);
+ deployerClient.checkComplete(name);
+ }
+ catch (DeploymentException e)
+ {
+ Throwable t = e.getCause();
+ if (t instanceof BundleException)
+ throw (BundleException)t;
+ throw new BundleException("Error starting " + bundleState, e);
+ }
+ }
+
+ /**
+ * Stop a bundle
+ *
+ * @param bundleState the bundle state
+ * @throws BundleException the bundle exception
+ */
+ public void stop(OSGiBundleState bundleState) throws BundleException
+ {
+ try
+ {
+ String name = bundleState.getDeploymentUnit().getName();
+ deployerClient.change(name, DeploymentStages.CLASSLOADER);
+ }
+ catch (DeploymentException e)
+ {
+ Throwable t = e.getCause();
+ if (t instanceof BundleException)
+ throw (BundleException)t;
+ throw new BundleException("Error stopping " + bundleState, e);
+ }
+ }
+
+ /**
+ * Get services
+ *
+ * @param bundleState the referencing bundle
+ * @param clazz any class
+ * @param filter any filter
+ * @param checkAssignable whether to check isAssignable
+ * @return the services
+ */
+ Collection<OSGiServiceState> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
+ {
+ if (filter == null)
+ filter = NoFilter.INSTANCE;
+
+ if (registeredServices.isEmpty())
+ return null;
+
+ // Don't check assignabilty for the system bundle
+ if (bundle.getBundleId() == 0)
+ checkAssignable = false;
+
+ // review: optimise this, e.g. index by class
+ // Use a sorted set to order services according to spec
+ Set<OSGiServiceState> result = new TreeSet<OSGiServiceState>(ServiceComparator.INSTANCE);
+ for (OSGiServiceState service : registeredServices)
+ {
+ // Check the state, filter and permission
+ if (service.isUnregistered() == false && filter.match(service) && service.hasPermission())
+ {
+ // Check any passed class matches
+ if (clazz == null || service.matchClass(clazz))
+ {
+ // Check the assignability
+ if (checkAssignable == false || service.isAssignable(bundle))
+ result.add(service);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get service reference
+ *
+ * @param bundle the referencing bundle
+ * @param clazz any class
+ * @return the reference
+ */
+ ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
+ {
+ Collection<OSGiServiceState> services = getServices(bundle, clazz, null, true);
+ if (services == null || services.isEmpty())
+ return null;
+
+ // If multiple such services exist, the service with the highest ranking (as specified in its SERVICE_RANKING property) is returned.
+ // If there is a tie in ranking, the service with the lowest service ID (as specified in its SERVICE_ID property);
+ // that is, the service that was registered first is returned.
+
+ long bestId = 0;
+ int bestRanking = 0;
+ ServiceReference bestMatch = null;
+ for (OSGiServiceState service : services)
+ {
+ long id = service.getServiceId();
+ int ranking = service.getServiceRanking();
+ if (bestMatch == null || ranking > bestRanking || (ranking == bestRanking && id < bestId))
+ {
+ bestMatch = service.getReferenceInternal();
+ bestRanking = ranking;
+ bestId = id;
+ }
+ }
+
+ return bestMatch;
+ }
+
+ /**
+ * Get service references
+ *
+ * @param bundle the referencing bundle
+ * @param clazz any class
+ * @param filter any filter
+ * @param checkAssignable whether to check isAssignable
+ * @return the services
+ */
+ ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
+ {
+ Collection<OSGiServiceState> services = getServices(bundle, clazz, filter, checkAssignable);
+ if (services == null || services.isEmpty())
+ return null;
+
+ ServiceReference[] result = new ServiceReference[services.size()];
+
+ int i = 0;
+ for (OSGiServiceState service : services)
+ result[i++] = service.getReferenceInternal();
+
+ return result;
+ }
+
+ /**
+ * Get service references
+ *
+ * @param bundle the referencing bundle
+ * @param clazz any class
+ * @param filterStr any filter
+ * @param checkAssignable
+ * @param checkAssignable whether to check isAssignable
+ * @return the services
+ * @throws InvalidSyntaxException when the filter is invalid
+ */
+ ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr, boolean checkAssignable) throws InvalidSyntaxException
+ {
+ Filter filter = NoFilter.INSTANCE;
+ if (filterStr != null)
+ filter = FrameworkUtil.createFilter(filterStr);
+
+ return getServiceReferences(bundle, clazz, filter, checkAssignable);
+ }
+
+ /**
+ * Register a service
+ *
+ * @param bundleState the bundle
+ * @param clazzes the classes to implement
+ * @param service the service
+ * @param properties the properties
+ * @return the service state
+ */
+ @SuppressWarnings("unchecked")
+ OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
+ {
+ OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
+ result.internalRegister();
+ registeredServices.add(result);
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
+ log.debug("Registered service : " + result.toLongString());
+ return result;
+ }
+
+ /**
+ * Unregister a service
+ *
+ * @param serviceState the service state
+ */
+ void unregisterService(OSGiServiceState serviceState)
+ {
+ log.debug("Unregistering service: " + serviceState.toLongString());
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(serviceState.getBundleState(), ServiceEvent.UNREGISTERING, serviceState);
+ registeredServices.remove(serviceState);
+ serviceState.internalUnregister();
+ }
+
+ /**
+ * Get a service
+ *
+ * @param bundleState the bundle that requests the service
+ * @param reference the service reference
+ * @return the service
+ */
+ Object getService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ OSGiServiceReferenceWrapper serviceReference = (OSGiServiceReferenceWrapper)reference;
+ OSGiServiceState serviceState = serviceReference.getServiceState();
+ Object result = serviceState.getService(bundleState);
+ if (result != null)
+ bundleState.addServiceInUse(serviceState);
+ return result;
+ }
+
+ /**
+ * Unget a service
+ *
+ * @param bundleState the bundle state
+ * @param reference the service reference
+ * @return true when the service is still in use by the bundle
+ */
+ boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+ OSGiServiceReferenceWrapper serviceReference = (OSGiServiceReferenceWrapper)reference;
+ OSGiServiceState serviceState = serviceReference.getServiceState();
+ return ungetService(bundleState, serviceState);
+ }
+
+ /**
+ * Unget a service
+ *
+ * @param bundleState the bundle state
+ * @param service the service
+ * @return true when the service is still in use by the bundle
+ */
+ boolean ungetService(AbstractBundleState bundleState, OSGiServiceState service)
+ {
+ return bundleState.removeServiceInUse(service);
+ }
+
+ /**
+ * Get the executor.
+ *
+ * @return the executor.
+ */
+ Executor getExecutor()
+ {
+ return executor;
+ }
+
+ /**
+ * Init the Framework
+ */
+ public void initFramework()
+ {
+ // Log INFO about this implementation
+ log.info(getClass().getPackage().getImplementationTitle());
+ log.info(getClass().getPackage().getImplementationVersion());
+
+ int state = systemBundle.getState();
+
+ // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
+ if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
+ return;
+
+ // Put into the STARTING state
+ systemBundle.changeState(Bundle.STARTING);
+
+ // [TODO] Be at start level 0
+
+ // [TODO] Have event handling enabled
+
+ // Cleanup the storage area
+ String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
+ BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
+ if (storagePlugin != null)
+ storagePlugin.cleanStorage(storageClean);
+ }
+
+ /**
+ * Start the framework
+ *
+ * @throws BundleException for any error
+ */
+ public void startFramework() throws BundleException
+ {
+ // If this Framework is not in the STARTING state, initialize this Framework
+ if (systemBundle.getState() != Bundle.STARTING)
+ initFramework();
+
+ // Create the system bundl context
+ systemBundle.createBundleContext();
+
+ // Start registered service plugins
+ for (Plugin plugin : plugins.values())
+ {
+ if (plugin instanceof ServicePlugin)
+ {
+ ServicePlugin servicePlugin = (ServicePlugin)plugin;
+ servicePlugin.startService();
+ }
+ }
+
+ // All installed bundles must be started
+ AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
+ if (autoInstall != null)
+ {
+ autoInstall.installBundles();
+ autoInstall.startBundles();
+ }
+
+ // This Framework's state is set to ACTIVE
+ systemBundle.changeState(Bundle.ACTIVE);
+
+ // A framework event of type STARTED is fired
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
+ }
+
+ /**
+ * Stop the framework
+ */
+ public void stopFramework()
+ {
+ AbstractBundleState systemBundle = getSystemBundle();
+ if (systemBundle.getState() != Bundle.ACTIVE)
+ return;
+
+ systemBundle.changeState(Bundle.STOPPING);
+ for (AbstractBundleState bundleState : getBundles())
+ {
+ if (bundleState != systemBundle)
+ {
+ try
+ {
+ // [TODO] don't change the persistent state
+ bundleState.stop();
+ }
+ catch (Throwable t)
+ {
+ fireWarning(bundleState, "stopping bundle", t);
+ }
+ }
+ }
+
+ // Stop registered service plugins
+ List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
+ Collections.reverse(reverseServicePlugins);
+ for (Plugin plugin : reverseServicePlugins)
+ {
+ if (plugin instanceof ServicePlugin)
+ {
+ ServicePlugin servicePlugin = (ServicePlugin)plugin;
+ servicePlugin.stopService();
+ }
+ }
+
+ systemBundle.changeState(Bundle.RESOLVED);
+ }
+
+ /**
+ * Stop the framework
+ */
+ public void restartFramework()
+ {
+ AbstractBundleState systemBundle = getSystemBundle();
+ if (systemBundle.getState() != Bundle.ACTIVE)
+ return;
+
+ for (AbstractBundleState bundleState : getBundles())
+ {
+ if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
+ {
+ try
+ {
+ // [TODO] don't change the persistent state
+ bundleState.stop();
+ }
+ catch (Throwable t)
+ {
+ fireWarning(bundleState, "stopping bundle", t);
+ }
+ try
+ {
+ bundleState.start();
+ }
+ catch (Throwable t)
+ {
+ fireError(bundleState, "starting bundle", t);
+ }
+ }
+ }
+ }
+
+ /**
+ * Fire a framework error
+ *
+ * @param bundleState the bundle state
+ * @param context the msg context
+ * @param t the throwable
+ */
+ void fireError(Bundle bundle, String context, Throwable t)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ if (t instanceof BundleException)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
+ else if (bundle != null)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
+ else
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
+ }
+
+ /**
+ * Fire a framework error
+ *
+ * @param bundleState the bundle state
+ * @param context the msg context
+ * @param t the throwable
+ */
+ void fireWarning(Bundle bundle, String context, Throwable t)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ if (t instanceof BundleException)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
+ else if (bundle != null)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
+ else
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
+ }
+
+ /**
+ * ServiceComparator, reverses the order of compareTo
+ */
+ static class ServiceComparator implements Comparator<OSGiServiceState>
+ {
+ public static ServiceComparator INSTANCE = new ServiceComparator();
+
+ public int compare(OSGiServiceState o1, OSGiServiceState o2)
+ {
+ return -o1.compareTo(o2);
+ }
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManagerLifecycle.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
// $Id: $
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,389 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.bundle;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-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.api.PackageAdminServicePlugin;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * BundleState.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleState extends AbstractBundleState
-{
- /** The log */
- private static final Logger log = Logger.getLogger(OSGiBundleState.class);
-
- /** Used to generate a unique id */
- private static final AtomicLong bundleIDGenerator = new AtomicLong();
-
- /** The bundle id */
- private long bundleId;
-
- /** The deployment unit */
- private DeploymentUnit unit;
-
- /**
- * Create a new BundleState.
- *
- * @param osgiMetaData the osgi metadata
- * @param unit the deployment unit
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleState(OSGiMetaData osgiMetaData, DeploymentUnit unit)
- {
- super(osgiMetaData);
- if (unit == null)
- throw new IllegalArgumentException("Null deployment unit");
- this.unit = unit;
- this.bundleId = bundleIDGenerator.incrementAndGet();
- unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
- }
-
- public long getBundleId()
- {
- return bundleId;
- }
-
- /**
- * Get the unit.
- *
- * @return the unit.
- */
- public DeploymentUnit getDeploymentUnit()
- {
- return unit;
- }
-
- public String getLocation()
- {
- checkAdminPermission(AdminPermission.METADATA);
-
- URL url = getOSGiMetaData().getBundleUpdateLocation();
- if (url != null)
- return url.toString();
-
- DeploymentUnit unit = getDeploymentUnit();
- return unit.getName();
- }
-
- public URL getEntry(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-
- if (path.startsWith("/"))
- path = path.substring(1);
- return vfsDeploymentUnit.getResourceLoader().getResource(path);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getEntryPaths(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSEntryPathsEnumeration(root, child);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
- }
-
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- if (path == null)
- throw new IllegalArgumentException("Null path");
-
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- // [TODO] fragments
- resolveBundle();
-
- if (filePattern == null)
- filePattern = "*";
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
- }
-
- }
- return null;
- }
-
- public Class<?> loadClass(String name) throws ClassNotFoundException
- {
- checkInstalled();
- checkAdminPermission(AdminPermission.CLASS);
- // [TODO] bundle fragment
-
- if (resolveBundle() == false)
- throw new ClassNotFoundException("Cannot load class: " + name);
-
- ClassLoader classLoader = getDeploymentUnit().getClassLoader();
- return classLoader.loadClass(name);
- }
-
- /**
- * Try to resolve the bundle
- * @return true when resolved
- */
- boolean resolveBundle()
- {
- PackageAdminServicePlugin packageAdmin = getBundleManager().getPlugin(PackageAdminServicePlugin.class);
- return packageAdmin.resolveBundles(new Bundle[] { this });
- }
-
- public URL getResource(String name)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- // [TODO] bundle fragment
- if (resolveBundle() == false)
- return getDeploymentUnit().getResourceLoader().getResource(name);
-
- return getDeploymentUnit().getClassLoader().getResource(name);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getResources(String name) throws IOException
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- // [TODO] bundle fragment
- if (resolveBundle() == false)
- return getDeploymentUnit().getResourceLoader().getResources(name);
-
- return getDeploymentUnit().getClassLoader().getResources(name);
- }
-
- // [TODO] options
- public void start(int options) throws BundleException
- {
- checkInstalled();
- checkAdminPermission(AdminPermission.EXECUTE);
-
- if (getState() == ACTIVE)
- return;
-
- getBundleManager().start(this);
- }
-
- // [TODO] options
- public void stop(int options) throws BundleException
- {
- checkInstalled();
- checkAdminPermission(AdminPermission.EXECUTE);
-
- if (getState() != ACTIVE)
- return;
-
- getBundleManager().stop(this);
- }
-
- /**
- * Start internal
- *
- * [TODO] Start Level Service & START_TRANSIENT?
- * [TODO] START_ACTIVATION_POLICY
- * [TODO] LAZY_ACTIVATION
- * [TODO] locks
- * [TODO] options
- *
- * @throws Throwable for any error
- */
- public void startInternal() throws Throwable
- {
- // Bundle extenders catch the STARTING event and might expect a valid context
- createBundleContext();
- changeState(STARTING);
-
- try
- {
- OSGiMetaData metaData = getOSGiMetaData();
- if (metaData == null)
- throw new IllegalStateException("Cannot obtain OSGi meta data");
-
- // Do we have a bundle activator
- String bundleActivatorClassName = metaData.getBundleActivator();
- if (bundleActivatorClassName != null)
- {
- Object result = loadClass(bundleActivatorClassName).newInstance();
- if (result instanceof BundleActivator == false)
- throw new BundleException(bundleActivatorClassName + " is not an implementation of " + BundleActivator.class.getName());
-
- BundleActivator bundleActivator = (BundleActivator)result;
- unit.addAttachment(BundleActivator.class, bundleActivator);
-
- bundleActivator.start(getBundleContext());
- }
-
- if (getState() != STARTING)
- throw new BundleException("Bundle has been uninstalled: " + this);
-
- changeState(ACTIVE);
- }
- catch (Throwable t)
- {
- changeState(STOPPING);
- // TODO stop the bundle
- destroyBundleContext();
- changeState(RESOLVED);
- throw t;
- }
- }
-
- /**
- * Stop Internal
- *
- * [TODO] Start Level Service & STOP_TRANSIENT? [TODO] locks [TODO] options
- *
- * @throws Throwable for any error
- */
- public void stopInternal() throws Throwable
- {
- changeState(STOPPING);
-
- Throwable rethrow = null;
- try
- {
- BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
- BundleContext bundleContext = getBundleContext();
- if (bundleActivator != null && bundleContext != null)
- {
- try
- {
- bundleActivator.stop(bundleContext);
- }
- catch (Throwable t)
- {
- rethrow = t;
- }
- }
-
- for (OSGiServiceState service : registeredServices)
- {
- try
- {
- service.unregister();
- }
- catch (Throwable t)
- {
- log.debug("Error unregistering service: " + service, t);
- }
- }
-
- for (Map.Entry<OSGiServiceState, Integer> inUse : servicesInUse.entrySet())
- {
- OSGiServiceState service = inUse.getKey();
- Integer count = inUse.getValue();
- for (int i = 0; i < count; ++i)
- {
- try
- {
- getBundleManager().ungetService(this, service);
- }
- catch (Throwable t)
- {
- log.debug("Error ungetting service: " + service, t);
- }
- }
- }
-
- if (getState() != STOPPING)
- throw new BundleException("Bundle has been uninstalled: " + getCanonicalName());
- }
- finally
- {
- if (getState() == STOPPING)
- changeState(RESOLVED);
- destroyBundleContext();
- getDeploymentUnit().removeAttachment(BundleActivator.class);
- }
-
- if (rethrow != null)
- throw rethrow;
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,389 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.PackageAdminServicePlugin;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * BundleState.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleState extends AbstractBundleState
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(OSGiBundleState.class);
+
+ /** Used to generate a unique id */
+ private static final AtomicLong bundleIDGenerator = new AtomicLong();
+
+ /** The bundle id */
+ private long bundleId;
+
+ /** The deployment unit */
+ private DeploymentUnit unit;
+
+ /**
+ * Create a new BundleState.
+ *
+ * @param osgiMetaData the osgi metadata
+ * @param unit the deployment unit
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleState(OSGiMetaData osgiMetaData, DeploymentUnit unit)
+ {
+ super(osgiMetaData);
+ if (unit == null)
+ throw new IllegalArgumentException("Null deployment unit");
+ this.unit = unit;
+ this.bundleId = bundleIDGenerator.incrementAndGet();
+ unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+ }
+
+ public long getBundleId()
+ {
+ return bundleId;
+ }
+
+ /**
+ * Get the unit.
+ *
+ * @return the unit.
+ */
+ public DeploymentUnit getDeploymentUnit()
+ {
+ return unit;
+ }
+
+ public String getLocation()
+ {
+ checkAdminPermission(AdminPermission.METADATA);
+
+ URL url = getOSGiMetaData().getBundleUpdateLocation();
+ if (url != null)
+ return url.toString();
+
+ DeploymentUnit unit = getDeploymentUnit();
+ return unit.getName();
+ }
+
+ public URL getEntry(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ return vfsDeploymentUnit.getResourceLoader().getResource(path);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getEntryPaths(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSEntryPathsEnumeration(root, child);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
+ }
+
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ // [TODO] fragments
+ resolveBundle();
+
+ if (filePattern == null)
+ filePattern = "*";
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
+ }
+
+ }
+ return null;
+ }
+
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ checkInstalled();
+ checkAdminPermission(AdminPermission.CLASS);
+ // [TODO] bundle fragment
+
+ if (resolveBundle() == false)
+ throw new ClassNotFoundException("Cannot load class: " + name);
+
+ ClassLoader classLoader = getDeploymentUnit().getClassLoader();
+ return classLoader.loadClass(name);
+ }
+
+ /**
+ * Try to resolve the bundle
+ * @return true when resolved
+ */
+ boolean resolveBundle()
+ {
+ PackageAdminServicePlugin packageAdmin = getBundleManager().getPlugin(PackageAdminServicePlugin.class);
+ return packageAdmin.resolveBundles(new Bundle[] { this });
+ }
+
+ public URL getResource(String name)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ // [TODO] bundle fragment
+ if (resolveBundle() == false)
+ return getDeploymentUnit().getResourceLoader().getResource(name);
+
+ return getDeploymentUnit().getClassLoader().getResource(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getResources(String name) throws IOException
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ // [TODO] bundle fragment
+ if (resolveBundle() == false)
+ return getDeploymentUnit().getResourceLoader().getResources(name);
+
+ return getDeploymentUnit().getClassLoader().getResources(name);
+ }
+
+ // [TODO] options
+ public void start(int options) throws BundleException
+ {
+ checkInstalled();
+ checkAdminPermission(AdminPermission.EXECUTE);
+
+ if (getState() == ACTIVE)
+ return;
+
+ getBundleManager().start(this);
+ }
+
+ // [TODO] options
+ public void stop(int options) throws BundleException
+ {
+ checkInstalled();
+ checkAdminPermission(AdminPermission.EXECUTE);
+
+ if (getState() != ACTIVE)
+ return;
+
+ getBundleManager().stop(this);
+ }
+
+ /**
+ * Start internal
+ *
+ * [TODO] Start Level Service & START_TRANSIENT?
+ * [TODO] START_ACTIVATION_POLICY
+ * [TODO] LAZY_ACTIVATION
+ * [TODO] locks
+ * [TODO] options
+ *
+ * @throws Throwable for any error
+ */
+ public void startInternal() throws Throwable
+ {
+ // Bundle extenders catch the STARTING event and might expect a valid context
+ createBundleContext();
+ changeState(STARTING);
+
+ try
+ {
+ OSGiMetaData metaData = getOSGiMetaData();
+ if (metaData == null)
+ throw new IllegalStateException("Cannot obtain OSGi meta data");
+
+ // Do we have a bundle activator
+ String bundleActivatorClassName = metaData.getBundleActivator();
+ if (bundleActivatorClassName != null)
+ {
+ Object result = loadClass(bundleActivatorClassName).newInstance();
+ if (result instanceof BundleActivator == false)
+ throw new BundleException(bundleActivatorClassName + " is not an implementation of " + BundleActivator.class.getName());
+
+ BundleActivator bundleActivator = (BundleActivator)result;
+ unit.addAttachment(BundleActivator.class, bundleActivator);
+
+ bundleActivator.start(getBundleContext());
+ }
+
+ if (getState() != STARTING)
+ throw new BundleException("Bundle has been uninstalled: " + this);
+
+ changeState(ACTIVE);
+ }
+ catch (Throwable t)
+ {
+ changeState(STOPPING);
+ // TODO stop the bundle
+ destroyBundleContext();
+ changeState(RESOLVED);
+ throw t;
+ }
+ }
+
+ /**
+ * Stop Internal
+ *
+ * [TODO] Start Level Service & STOP_TRANSIENT? [TODO] locks [TODO] options
+ *
+ * @throws Throwable for any error
+ */
+ public void stopInternal() throws Throwable
+ {
+ changeState(STOPPING);
+
+ Throwable rethrow = null;
+ try
+ {
+ BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
+ BundleContext bundleContext = getBundleContext();
+ if (bundleActivator != null && bundleContext != null)
+ {
+ try
+ {
+ bundleActivator.stop(bundleContext);
+ }
+ catch (Throwable t)
+ {
+ rethrow = t;
+ }
+ }
+
+ for (OSGiServiceState service : registeredServices)
+ {
+ try
+ {
+ service.unregister();
+ }
+ catch (Throwable t)
+ {
+ log.debug("Error unregistering service: " + service, t);
+ }
+ }
+
+ for (Map.Entry<OSGiServiceState, Integer> inUse : servicesInUse.entrySet())
+ {
+ OSGiServiceState service = inUse.getKey();
+ Integer count = inUse.getValue();
+ for (int i = 0; i < count; ++i)
+ {
+ try
+ {
+ getBundleManager().ungetService(this, service);
+ }
+ catch (Throwable t)
+ {
+ log.debug("Error ungetting service: " + service, t);
+ }
+ }
+ }
+
+ if (getState() != STOPPING)
+ throw new BundleException("Bundle has been uninstalled: " + getCanonicalName());
+ }
+ finally
+ {
+ if (getState() == STOPPING)
+ changeState(RESOLVED);
+ destroyBundleContext();
+ getDeploymentUnit().removeAttachment(BundleActivator.class);
+ }
+
+ if (rethrow != null)
+ throw rethrow;
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleWrapper.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleWrapper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.io.IOException;
import java.io.InputStream;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceReferenceWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceReferenceWrapper.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceReferenceWrapper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceRegistrationWrapper.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.util.Dictionary;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.security.AccessControlContext;
import java.util.ArrayList;
@@ -33,8 +33,8 @@
import java.util.concurrent.atomic.AtomicLong;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.FrameworkEventsPlugin;
-import org.jboss.osgi.plugins.util.CaseInsensitiveDictionary;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.jboss.util.collection.ConcurrentSet;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,144 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-/**
- * OSGiSystemBundle.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiSystemState extends AbstractBundleState
-{
- /**
- * Create a new OSGiSystemBundle.
- * @param bundleManager the bundle manager associated with the system bundle
- * @param osgiMetaData the metadata for the system bundle
- */
- public OSGiSystemState(OSGiBundleManager bundleManager, OSGiMetaData osgiMetaData)
- {
- super(osgiMetaData);
- }
-
- public long getBundleId()
- {
- return 0;
- }
-
- public String getLocation()
- {
- return Constants.SYSTEM_BUNDLE_LOCATION;
- }
-
- public Class<?> loadClass(String name) throws ClassNotFoundException
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- return getClass().getClassLoader().loadClass(name);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- public URL getEntry(String path)
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getEntryPaths(String path)
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- public URL getResource(String name)
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getResources(String name) throws IOException
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- public void start(int options) throws BundleException
- {
- // [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
- }
-
- public void stop(int options) throws BundleException
- {
- final OSGiBundleManager bundleManager = getBundleManager();
- bundleManager.getExecutor().execute(new Runnable()
- {
- public void run()
- {
- bundleManager.stopFramework();
- }
- });
- }
-
- @Override
- public void update() throws BundleException
- {
- final OSGiBundleManager bundleManager = getBundleManager();
- bundleManager.getExecutor().execute(new Runnable()
- {
- public void run()
- {
- bundleManager.restartFramework();
- }
- });
- }
-
- @Override
- public void update(InputStream in) throws BundleException
- {
- throw new BundleException("The system bundle cannot be updated from a stream");
- }
-
- @Override
- public void uninstall() throws BundleException
- {
- throw new BundleException("The system bundle cannot be uninstalled");
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,144 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiSystemBundle.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiSystemState extends AbstractBundleState
+{
+ /**
+ * Create a new OSGiSystemBundle.
+ * @param bundleManager the bundle manager associated with the system bundle
+ * @param osgiMetaData the metadata for the system bundle
+ */
+ public OSGiSystemState(OSGiBundleManager bundleManager, OSGiMetaData osgiMetaData)
+ {
+ super(osgiMetaData);
+ }
+
+ public long getBundleId()
+ {
+ return 0;
+ }
+
+ public String getLocation()
+ {
+ return Constants.SYSTEM_BUNDLE_LOCATION;
+ }
+
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ return getClass().getClassLoader().loadClass(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ public URL getEntry(String path)
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getEntryPaths(String path)
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ public URL getResource(String name)
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getResources(String name) throws IOException
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ public void start(int options) throws BundleException
+ {
+ // [JBOSGI-138] Proper system BundleContext implementation
+ throw new NotImplementedException();
+ }
+
+ public void stop(int options) throws BundleException
+ {
+ final OSGiBundleManager bundleManager = getBundleManager();
+ bundleManager.getExecutor().execute(new Runnable()
+ {
+ public void run()
+ {
+ bundleManager.stopFramework();
+ }
+ });
+ }
+
+ @Override
+ public void update() throws BundleException
+ {
+ final OSGiBundleManager bundleManager = getBundleManager();
+ bundleManager.getExecutor().execute(new Runnable()
+ {
+ public void run()
+ {
+ bundleManager.restartFramework();
+ }
+ });
+ }
+
+ @Override
+ public void update(InputStream in) throws BundleException
+ {
+ throw new BundleException("The system bundle cannot be updated from a stream");
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ throw new BundleException("The system bundle cannot be uninstalled");
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/VFSEntryPathsEnumeration.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.io.IOException;
import java.util.ArrayList;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/bundle/VFSFindEntriesEnumeration.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.bundle;
+package org.jboss.osgi.framework.bundle;
import java.io.IOException;
import java.net.URL;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading)
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,160 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.classloading;
-
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.ModuleCapability;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.plugins.metadata.spi.Parameter;
-import org.jboss.osgi.plugins.metadata.spi.ParameterizedAttribute;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * OSGiBundleCapability.
- *
- * todo BundlePermission/PROVIDE
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleCapability extends ModuleCapability
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 2366716668262831380L;
-
- /** The metadata */
- private OSGiMetaData metadata;
-
- /**
- * Create a new OSGiBundleCapability
- *
- * @param metadata the osgi metadata
- * @return the capability
- * @throws IllegalArgumentException for a null metadata
- */
- public static OSGiBundleCapability create(OSGiMetaData metadata)
- {
- if (metadata == null)
- throw new IllegalArgumentException("Null metadata");
-
- String name = metadata.getBundleSymbolicName();
- Version version = metadata.getBundleVersion();
-
- return new OSGiBundleCapability(name, version, metadata);
- }
-
- /**
- * Create a new OSGiBundleCapability.
- *
- * @param name the name
- * @param version the version pass null of the default version
- * @param metadata the metadata
- * @throws IllegalArgumentException for a null name or requireBundle
- */
- public OSGiBundleCapability(String name, Version version, OSGiMetaData metadata)
- {
- super(name, version);
- if (metadata == null)
- throw new IllegalArgumentException("Null metadata");
- this.metadata = metadata;
- }
-
- /**
- * Get the metadata.
- *
- * @return the metadata.
- */
- public OSGiMetaData getMetaData()
- {
- return metadata;
- }
-
- @Override
- public boolean resolves(Module reqModule, Requirement requirement)
- {
- if (super.resolves(reqModule, requirement) == false)
- return false;
- if (requirement instanceof OSGiBundleRequirement == false)
- return true;
-
- // Review its not clear to me from the spec whether attribute matching
- // beyond the version should work for require-bundle?
- OSGiBundleRequirement bundleRequirement = (OSGiBundleRequirement) requirement;
- OSGiMetaData metaData = getMetaData();
- ParameterizedAttribute ourParameters = metaData.getBundleParameters();
- ParameterizedAttribute otherParameters = bundleRequirement.getRequireBundle();
- if (otherParameters != null)
- {
- Map<String, Parameter> params = otherParameters.getParameters();
- if (params != null && params.isEmpty() == false)
- {
- for (String name : params.keySet())
- {
- // todo we shouldn't mix attributes and directives in the metadata
- if (Constants.VISIBILITY_DIRECTIVE.equals(name) == false
- && Constants.RESOLUTION_DIRECTIVE.equals(name) == false
- && Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name) == false)
- {
- if (ourParameters == null)
- return false;
- String ourValue = ourParameters.getParameterValue(name, String.class);
- if (ourValue == null)
- return false;
- if (ourValue.equals(otherParameters.getParameterValue(name, String.class)) == false)
- return false;
- }
- }
- }
- }
- return true;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiBundleCapability == false)
- return false;
- if (super.equals(obj) ==false)
- return false;
- OSGiBundleCapability other = (OSGiBundleCapability) obj;
- return getMetaData().equals(other.getMetaData());
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- ParameterizedAttribute parameters = metadata.getBundleParameters();
- if (parameters != null)
- {
- Map<String, Parameter> params = parameters.getParameters();
- if (params != null && params.isEmpty() == false)
- buffer.append(" parameters=").append(params);
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,160 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.classloading;
+
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.ModuleCapability;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * OSGiBundleCapability.
+ *
+ * todo BundlePermission/PROVIDE
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleCapability extends ModuleCapability
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2366716668262831380L;
+
+ /** The metadata */
+ private OSGiMetaData metadata;
+
+ /**
+ * Create a new OSGiBundleCapability
+ *
+ * @param metadata the osgi metadata
+ * @return the capability
+ * @throws IllegalArgumentException for a null metadata
+ */
+ public static OSGiBundleCapability create(OSGiMetaData metadata)
+ {
+ if (metadata == null)
+ throw new IllegalArgumentException("Null metadata");
+
+ String name = metadata.getBundleSymbolicName();
+ Version version = metadata.getBundleVersion();
+
+ return new OSGiBundleCapability(name, version, metadata);
+ }
+
+ /**
+ * Create a new OSGiBundleCapability.
+ *
+ * @param name the name
+ * @param version the version pass null of the default version
+ * @param metadata the metadata
+ * @throws IllegalArgumentException for a null name or requireBundle
+ */
+ public OSGiBundleCapability(String name, Version version, OSGiMetaData metadata)
+ {
+ super(name, version);
+ if (metadata == null)
+ throw new IllegalArgumentException("Null metadata");
+ this.metadata = metadata;
+ }
+
+ /**
+ * Get the metadata.
+ *
+ * @return the metadata.
+ */
+ public OSGiMetaData getMetaData()
+ {
+ return metadata;
+ }
+
+ @Override
+ public boolean resolves(Module reqModule, Requirement requirement)
+ {
+ if (super.resolves(reqModule, requirement) == false)
+ return false;
+ if (requirement instanceof OSGiBundleRequirement == false)
+ return true;
+
+ // Review its not clear to me from the spec whether attribute matching
+ // beyond the version should work for require-bundle?
+ OSGiBundleRequirement bundleRequirement = (OSGiBundleRequirement) requirement;
+ OSGiMetaData metaData = getMetaData();
+ ParameterizedAttribute ourParameters = metaData.getBundleParameters();
+ ParameterizedAttribute otherParameters = bundleRequirement.getRequireBundle();
+ if (otherParameters != null)
+ {
+ Map<String, Parameter> params = otherParameters.getParameters();
+ if (params != null && params.isEmpty() == false)
+ {
+ for (String name : params.keySet())
+ {
+ // todo we shouldn't mix attributes and directives in the metadata
+ if (Constants.VISIBILITY_DIRECTIVE.equals(name) == false
+ && Constants.RESOLUTION_DIRECTIVE.equals(name) == false
+ && Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name) == false)
+ {
+ if (ourParameters == null)
+ return false;
+ String ourValue = ourParameters.getParameterValue(name, String.class);
+ if (ourValue == null)
+ return false;
+ if (ourValue.equals(otherParameters.getParameterValue(name, String.class)) == false)
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof OSGiBundleCapability == false)
+ return false;
+ if (super.equals(obj) ==false)
+ return false;
+ OSGiBundleCapability other = (OSGiBundleCapability) obj;
+ return getMetaData().equals(other.getMetaData());
+ }
+
+ @Override
+ protected void toString(StringBuffer buffer)
+ {
+ super.toString(buffer);
+ ParameterizedAttribute parameters = metadata.getBundleParameters();
+ if (parameters != null)
+ {
+ Map<String, Parameter> params = parameters.getParameters();
+ if (params != null && params.isEmpty() == false)
+ buffer.append(" parameters=").append(params);
+ }
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,152 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.classloading;
-
-// $Id: $
-
-import java.util.List;
-
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.RequirementsMetaData;
-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.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.plugins.metadata.spi.PackageAttribute;
-import org.jboss.osgi.plugins.metadata.spi.ParameterizedAttribute;
-
-/**
- * OSGiBundleClassLoadingDeployer.<p>
- *
- * This deployer maps osgi metadata into our classloading metadata.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
-{
- private ClassLoaderDomain domain;
- private ClassLoaderFactory factory;
-
- /**
- * Create a new OSGiBundleClassLoadingDeployer.
- */
- public OSGiBundleClassLoadingDeployer()
- {
- super(OSGiMetaData.class);
- addInput(OSGiBundleState.class);
- setOutput(ClassLoadingMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
- }
-
- public void setDomain(ClassLoaderDomain domain)
- {
- this.domain = domain;
- }
-
- public void setFactory(ClassLoaderFactory factory)
- {
- this.factory = factory;
- }
-
- @Override
- public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
- {
- if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
- return;
-
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
- if (bundleState == null)
- throw new IllegalStateException("No bundle state");
-
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
-
- ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
- classLoadingMetaData.setName(osgiMetaData.getBundleSymbolicName());
- classLoadingMetaData.setVersion(osgiMetaData.getBundleVersion());
- classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
-
- CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
- RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
-
- OSGiBundleCapability capability = OSGiBundleCapability.create(osgiMetaData);
- capabilities.addCapability(capability);
-
- List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();
- if (requireBundles != null && requireBundles.isEmpty() == false)
- {
- for (ParameterizedAttribute requireBundle : requireBundles)
- {
- OSGiBundleRequirement requirement = OSGiBundleRequirement.create(requireBundle);
- requirements.addRequirement(requirement);
- }
- }
-
- List<PackageAttribute> exported = osgiMetaData.getExportPackages();
- if (exported != null && exported.isEmpty() == false)
- {
- for (PackageAttribute packageAttribute : exported)
- {
- OSGiPackageCapability packageCapability = OSGiPackageCapability.create(bundleState, packageAttribute);
- capabilities.addCapability(packageCapability);
- }
- }
-
- List<PackageAttribute> imported = osgiMetaData.getImportPackages();
- if (imported != null && imported.isEmpty() == false)
- {
- SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
- for (PackageAttribute packageAttribute : imported)
- {
- String packageName = packageAttribute.getAttribute();
-
- // [TODO] Should system packages be added as capabilities?
- boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
- if (isSystemPackage == false)
- {
- OSGiPackageRequirement requirement = OSGiPackageRequirement.create(bundleState, packageAttribute);
- requirements.addRequirement(requirement);
- }
- }
- }
-
- // Add the OSGi ClassLoaderFactory if configured
- if (factory != null)
- unit.addAttachment(ClassLoaderFactory.class, factory);
-
- // [TODO] dynamic imports
-
- unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
-
- // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
- unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,152 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.classloading;
+
+// $Id: $
+
+import java.util.List;
+
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.RequirementsMetaData;
+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.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
+
+/**
+ * OSGiBundleClassLoadingDeployer.<p>
+ *
+ * This deployer maps osgi metadata into our classloading metadata.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
+{
+ private ClassLoaderDomain domain;
+ private ClassLoaderFactory factory;
+
+ /**
+ * Create a new OSGiBundleClassLoadingDeployer.
+ */
+ public OSGiBundleClassLoadingDeployer()
+ {
+ super(OSGiMetaData.class);
+ addInput(OSGiBundleState.class);
+ setOutput(ClassLoadingMetaData.class);
+ setStage(DeploymentStages.POST_PARSE);
+ setTopLevelOnly(true);
+ }
+
+ public void setDomain(ClassLoaderDomain domain)
+ {
+ this.domain = domain;
+ }
+
+ public void setFactory(ClassLoaderFactory factory)
+ {
+ this.factory = factory;
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
+ {
+ if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
+ return;
+
+ OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ if (bundleState == null)
+ throw new IllegalStateException("No bundle state");
+
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+
+ ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+ classLoadingMetaData.setName(osgiMetaData.getBundleSymbolicName());
+ classLoadingMetaData.setVersion(osgiMetaData.getBundleVersion());
+ classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
+
+ CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
+ RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
+
+ OSGiBundleCapability capability = OSGiBundleCapability.create(osgiMetaData);
+ capabilities.addCapability(capability);
+
+ List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();
+ if (requireBundles != null && requireBundles.isEmpty() == false)
+ {
+ for (ParameterizedAttribute requireBundle : requireBundles)
+ {
+ OSGiBundleRequirement requirement = OSGiBundleRequirement.create(requireBundle);
+ requirements.addRequirement(requirement);
+ }
+ }
+
+ List<PackageAttribute> exported = osgiMetaData.getExportPackages();
+ if (exported != null && exported.isEmpty() == false)
+ {
+ for (PackageAttribute packageAttribute : exported)
+ {
+ OSGiPackageCapability packageCapability = OSGiPackageCapability.create(bundleState, packageAttribute);
+ capabilities.addCapability(packageCapability);
+ }
+ }
+
+ List<PackageAttribute> imported = osgiMetaData.getImportPackages();
+ if (imported != null && imported.isEmpty() == false)
+ {
+ SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
+ for (PackageAttribute packageAttribute : imported)
+ {
+ String packageName = packageAttribute.getAttribute();
+
+ // [TODO] Should system packages be added as capabilities?
+ boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
+ if (isSystemPackage == false)
+ {
+ OSGiPackageRequirement requirement = OSGiPackageRequirement.create(bundleState, packageAttribute);
+ requirements.addRequirement(requirement);
+ }
+ }
+ }
+
+ // Add the OSGi ClassLoaderFactory if configured
+ if (factory != null)
+ unit.addAttachment(ClassLoaderFactory.class, factory);
+
+ // [TODO] dynamic imports
+
+ unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+
+ // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
+ unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,126 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.classloading;
-
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.ModuleRequirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
-import org.jboss.osgi.plugins.metadata.spi.Parameter;
-import org.jboss.osgi.plugins.metadata.spi.ParameterizedAttribute;
-import org.osgi.framework.Constants;
-
-/**
- * OSGiBundleRequirement.
- *
- * todo BundlePermission/REQUIRE
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleRequirement extends ModuleRequirement
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 4264597072894634275L;
-
- /** The attributes */
- private ParameterizedAttribute requireBundle;
-
- /**
- * Create a new OSGiBundleRequirement.
- *
- * @param requireBundle the require bundle metadata
- * @return the requirement
- * @throws IllegalArgumentException for a null requireBundle
- */
- public static OSGiBundleRequirement create(ParameterizedAttribute requireBundle)
- {
- if (requireBundle == null)
- throw new IllegalArgumentException("Null require bundle");
-
- String name = requireBundle.getAttribute();
-
- AbstractVersionRange range = null;
- String version = requireBundle.getParameterValue(Constants.BUNDLE_VERSION_ATTRIBUTE, String.class);
- if (version != null)
- range = (AbstractVersionRange) AbstractVersionRange.valueOf(version);
-
- return new OSGiBundleRequirement(name, range, requireBundle);
- }
-
- /**
- * Create a new OSGiBundleRequirement.
- *
- * @param name the name
- * @param versionRange the version range - pass null for all versions
- * @param requireBundle the require bundle metadata
- * @throws IllegalArgumentException for a null name or requireBundle
- */
- public OSGiBundleRequirement(String name, VersionRange versionRange, ParameterizedAttribute requireBundle)
- {
- super(name, versionRange);
- if (requireBundle == null)
- throw new IllegalArgumentException("Null requireBundle");
- this.requireBundle = requireBundle;
-
- String visibility = requireBundle.getParameterValue(Constants.VISIBILITY_DIRECTIVE, String.class);
- if (Constants.VISIBILITY_REEXPORT.equals(visibility))
- setReExport(true);
-
- String resolution = requireBundle.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
- if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
- setOptional(true);
- }
-
- /**
- * Get the requireBundle metadata.
- *
- * @return the requireBundle.
- */
- public ParameterizedAttribute getRequireBundle()
- {
- return requireBundle;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiBundleRequirement == false)
- return false;
- if (super.equals(obj) ==false)
- return false;
-
- return true;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- Map<String, Parameter> parameters = requireBundle.getParameters();
- if (parameters != null && parameters.isEmpty() == false)
- buffer.append(" parameters=").append(parameters);
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,126 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.classloading;
+
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.ModuleRequirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiBundleRequirement.
+ *
+ * todo BundlePermission/REQUIRE
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleRequirement extends ModuleRequirement
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 4264597072894634275L;
+
+ /** The attributes */
+ private ParameterizedAttribute requireBundle;
+
+ /**
+ * Create a new OSGiBundleRequirement.
+ *
+ * @param requireBundle the require bundle metadata
+ * @return the requirement
+ * @throws IllegalArgumentException for a null requireBundle
+ */
+ public static OSGiBundleRequirement create(ParameterizedAttribute requireBundle)
+ {
+ if (requireBundle == null)
+ throw new IllegalArgumentException("Null require bundle");
+
+ String name = requireBundle.getAttribute();
+
+ AbstractVersionRange range = null;
+ String version = requireBundle.getParameterValue(Constants.BUNDLE_VERSION_ATTRIBUTE, String.class);
+ if (version != null)
+ range = (AbstractVersionRange) AbstractVersionRange.valueOf(version);
+
+ return new OSGiBundleRequirement(name, range, requireBundle);
+ }
+
+ /**
+ * Create a new OSGiBundleRequirement.
+ *
+ * @param name the name
+ * @param versionRange the version range - pass null for all versions
+ * @param requireBundle the require bundle metadata
+ * @throws IllegalArgumentException for a null name or requireBundle
+ */
+ public OSGiBundleRequirement(String name, VersionRange versionRange, ParameterizedAttribute requireBundle)
+ {
+ super(name, versionRange);
+ if (requireBundle == null)
+ throw new IllegalArgumentException("Null requireBundle");
+ this.requireBundle = requireBundle;
+
+ String visibility = requireBundle.getParameterValue(Constants.VISIBILITY_DIRECTIVE, String.class);
+ if (Constants.VISIBILITY_REEXPORT.equals(visibility))
+ setReExport(true);
+
+ String resolution = requireBundle.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
+ if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
+ setOptional(true);
+ }
+
+ /**
+ * Get the requireBundle metadata.
+ *
+ * @return the requireBundle.
+ */
+ public ParameterizedAttribute getRequireBundle()
+ {
+ return requireBundle;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof OSGiBundleRequirement == false)
+ return false;
+ if (super.equals(obj) ==false)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ protected void toString(StringBuffer buffer)
+ {
+ super.toString(buffer);
+ Map<String, Parameter> parameters = requireBundle.getParameters();
+ if (parameters != null && parameters.isEmpty() == false)
+ buffer.append(" parameters=").append(parameters);
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderDomain.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.classloading;
+package org.jboss.osgi.framework.classloading;
// $Id: $
@@ -36,8 +36,8 @@
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.spi.filter.PackageClassFilter;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
-import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderFactory.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.classloading;
+package org.jboss.osgi.framework.classloading;
// $Id$
@@ -31,7 +31,7 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
/**
* OSGiClassLoaderFactory
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderPolicy.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.classloading;
+package org.jboss.osgi.framework.classloading;
// $Id$
@@ -27,7 +27,7 @@
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.virtual.VirtualFile;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiClassLoaderSystem.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,14 +19,14 @@
* Software 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.classloading;
+package org.jboss.osgi.framework.classloading;
import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
-import org.jboss.osgi.plugins.facade.bundle.AbstractBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
/**
* The OSGi ClassLoaderSystem.
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,269 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.classloading;
-
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.jboss.classloading.plugins.metadata.PackageCapability;
-import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.plugins.metadata.spi.PackageAttribute;
-import org.jboss.osgi.plugins.metadata.spi.Parameter;
-import org.jboss.osgi.plugins.metadata.spi.ParameterizedAttribute;
-import org.jboss.osgi.plugins.resolver.BundleCapability;
-import org.jboss.osgi.plugins.resolver.BundleResolver;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * OSGiPackageCapability.
- *
- * todo PackagePermission/EXPORT todo uses todo include/exclude
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiPackageCapability extends PackageCapability
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 3940667616588052822L;
-
- /** The bundle state */
- private OSGiBundleState bundleState;
-
- /** The export package */
- private PackageAttribute exportPackage;
-
- /** The mandatory attributes */
- private String[] mandatoryAttributes;
-
- /**
- * Create a new OSGiPackageCapability.
- *
- * @param metadata the osgi metadata
- * @param exportPackage the export package metadata
- * @return the capability
- * @throws IllegalArgumentException for null metadata
- */
- @SuppressWarnings("deprecation")
- public static OSGiPackageCapability create(OSGiBundleState bundleState, PackageAttribute exportPackage)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle");
-
- String name = exportPackage.getAttribute();
- String versionString = exportPackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
-
- String oldVersionString = exportPackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (oldVersionString != null)
- {
- if (versionString != null && versionString.equals(oldVersionString) == false)
- throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
- + " of " + oldVersionString);
- if (versionString == null)
- versionString = oldVersionString;
- }
-
- Version version = null;
- if (versionString != null)
- {
- // Handle version strings with quotes
- if (versionString.startsWith("\"") && versionString.endsWith("\""))
- versionString = versionString.substring(1, versionString.length() - 1);
-
- version = Version.parseVersion(versionString);
- }
-
- OSGiPackageCapability capability = new OSGiPackageCapability(bundleState, name, version, exportPackage);
- capability.setSplitPackagePolicy(SplitPackagePolicy.First);
-
- return capability;
- }
-
- private OSGiPackageCapability(OSGiBundleState bundleState, String name, Version version, PackageAttribute exportPackage)
- {
- super(name, version);
- this.bundleState = bundleState;
- this.exportPackage = exportPackage;
-
- String mandatory = exportPackage.getParameterValue(Constants.MANDATORY_DIRECTIVE, String.class);
- if (mandatory != null)
- {
- StringTokenizer tokens = new StringTokenizer(mandatory, ",");
- mandatoryAttributes = new String[tokens.countTokens()];
- int i = 0;
- while (tokens.hasMoreTokens())
- mandatoryAttributes[i++] = tokens.nextToken();
- }
-
- if (exportPackage.getParameter(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) != null)
- throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + " on an Export-Package");
- if (exportPackage.getParameter(Constants.BUNDLE_VERSION_ATTRIBUTE) != null)
- throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_VERSION_ATTRIBUTE + " on an Export-Package");
- }
-
- @Override
- public boolean resolves(Module reqModule, Requirement requirement)
- {
- if (super.resolves(reqModule, requirement) == false)
- return false;
- if (requirement instanceof OSGiPackageRequirement == false)
- return true;
-
- // Get the bundle resolver from the bundle manager
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- BundleResolver bundleResolver = bundleManager.getBundleResolver();
-
- // True if capModule matches with the resolved module
- PackageRequirement packageRequirement = (PackageRequirement)requirement;
- BundleCapability bundleCapability = bundleResolver.getMatchingCapability(reqModule, packageRequirement);
- if (bundleCapability == null)
- return false;
-
- Module capModule = getModule();
- Module otherCapModule = bundleCapability.getExportingModule();
- PackageCapability otherCapability = bundleCapability.getPackageCapability();
- boolean isMatch = (otherCapModule == capModule && otherCapability == this);
- return isMatch;
- }
-
- /**
- * Get the Module associated with this capability
- */
- public Module getModule()
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- Module module = unit.getAttachment(Module.class);
- if (module == null)
- throw new IllegalStateException("Cannot obtain module from: " + bundleState);
- return module;
- }
-
- @SuppressWarnings("deprecation")
- public boolean match(OSGiPackageRequirement packageRequirement)
- {
- String capPackageName = getName();
- String reqPackageName = packageRequirement.getName();
- if (capPackageName.equals(reqPackageName) == false)
- return false;
-
- VersionRange reqVersionRange = packageRequirement.getVersionRange();
- Object capVersion = getVersion();
- if (reqVersionRange.isInRange(capVersion) == false)
- return false;
-
- OSGiMetaData metaData = bundleState.getOSGiMetaData();
- PackageAttribute capParameters = exportPackage;
- PackageAttribute reqParameters = packageRequirement.getRequirePackage();
-
- boolean validMatch = true;
-
- // Check all the manadatory attributes are present
- if (validMatch == true && mandatoryAttributes != null)
- {
- if (reqParameters != null)
- {
- for (String mand : mandatoryAttributes)
- {
- if (reqParameters.getParameter(mand) == null)
- {
- validMatch = false;
- break;
- }
- }
- }
- }
-
- if (validMatch == true && reqParameters != null)
- {
- Map<String, Parameter> params = reqParameters.getParameters();
- if (params != null && params.isEmpty() == false)
- {
- for (String name : params.keySet())
- {
- String otherValue = reqParameters.getParameterValue(name, String.class);
- String ourValue = capParameters.getParameterValue(name, String.class);
-
- // todo we shouldn't mix attributes and directives in the metadata
- if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(name))
- {
- if (otherValue.equals(metaData.getBundleSymbolicName()) == false)
- validMatch = false;
- }
- else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))
- {
- VersionRange range = (VersionRange)AbstractVersionRange.valueOf(otherValue);
- if (range.isInRange(metaData.getBundleVersion()) == false)
- validMatch = false;
- }
- else if (Constants.RESOLUTION_DIRECTIVE.equals(name) == false && Constants.PACKAGE_SPECIFICATION_VERSION.equals(name) == false
- && Constants.VERSION_ATTRIBUTE.equals(name) == false)
- {
- if (ourValue == null || ourValue.equals(otherValue) == false)
- validMatch = false;
- }
-
- if (validMatch == false)
- break;
- }
- }
- }
-
- return validMatch;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiPackageCapability == false)
- return false;
- if (super.equals(obj) == false)
- return false;
-
- return true;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- OSGiMetaData metadata = bundleState.getOSGiMetaData();
- ParameterizedAttribute parameters = metadata.getBundleParameters();
- if (parameters != null)
- {
- Map<String, Parameter> params = parameters.getParameters();
- if (params != null && params.isEmpty() == false)
- buffer.append(" parameters=").append(params);
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,269 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.classloading;
+
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange;
+import org.jboss.osgi.framework.resolver.BundleCapability;
+import org.jboss.osgi.framework.resolver.BundleResolver;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * OSGiPackageCapability.
+ *
+ * todo PackagePermission/EXPORT todo uses todo include/exclude
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiPackageCapability extends PackageCapability
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 3940667616588052822L;
+
+ /** The bundle state */
+ private OSGiBundleState bundleState;
+
+ /** The export package */
+ private PackageAttribute exportPackage;
+
+ /** The mandatory attributes */
+ private String[] mandatoryAttributes;
+
+ /**
+ * Create a new OSGiPackageCapability.
+ *
+ * @param metadata the osgi metadata
+ * @param exportPackage the export package metadata
+ * @return the capability
+ * @throws IllegalArgumentException for null metadata
+ */
+ @SuppressWarnings("deprecation")
+ public static OSGiPackageCapability create(OSGiBundleState bundleState, PackageAttribute exportPackage)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle");
+
+ String name = exportPackage.getAttribute();
+ String versionString = exportPackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
+
+ String oldVersionString = exportPackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+ if (oldVersionString != null)
+ {
+ if (versionString != null && versionString.equals(oldVersionString) == false)
+ throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
+ + " of " + oldVersionString);
+ if (versionString == null)
+ versionString = oldVersionString;
+ }
+
+ Version version = null;
+ if (versionString != null)
+ {
+ // Handle version strings with quotes
+ if (versionString.startsWith("\"") && versionString.endsWith("\""))
+ versionString = versionString.substring(1, versionString.length() - 1);
+
+ version = Version.parseVersion(versionString);
+ }
+
+ OSGiPackageCapability capability = new OSGiPackageCapability(bundleState, name, version, exportPackage);
+ capability.setSplitPackagePolicy(SplitPackagePolicy.First);
+
+ return capability;
+ }
+
+ private OSGiPackageCapability(OSGiBundleState bundleState, String name, Version version, PackageAttribute exportPackage)
+ {
+ super(name, version);
+ this.bundleState = bundleState;
+ this.exportPackage = exportPackage;
+
+ String mandatory = exportPackage.getParameterValue(Constants.MANDATORY_DIRECTIVE, String.class);
+ if (mandatory != null)
+ {
+ StringTokenizer tokens = new StringTokenizer(mandatory, ",");
+ mandatoryAttributes = new String[tokens.countTokens()];
+ int i = 0;
+ while (tokens.hasMoreTokens())
+ mandatoryAttributes[i++] = tokens.nextToken();
+ }
+
+ if (exportPackage.getParameter(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) != null)
+ throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + " on an Export-Package");
+ if (exportPackage.getParameter(Constants.BUNDLE_VERSION_ATTRIBUTE) != null)
+ throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_VERSION_ATTRIBUTE + " on an Export-Package");
+ }
+
+ @Override
+ public boolean resolves(Module reqModule, Requirement requirement)
+ {
+ if (super.resolves(reqModule, requirement) == false)
+ return false;
+ if (requirement instanceof OSGiPackageRequirement == false)
+ return true;
+
+ // Get the bundle resolver from the bundle manager
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ BundleResolver bundleResolver = bundleManager.getBundleResolver();
+
+ // True if capModule matches with the resolved module
+ PackageRequirement packageRequirement = (PackageRequirement)requirement;
+ BundleCapability bundleCapability = bundleResolver.getMatchingCapability(reqModule, packageRequirement);
+ if (bundleCapability == null)
+ return false;
+
+ Module capModule = getModule();
+ Module otherCapModule = bundleCapability.getExportingModule();
+ PackageCapability otherCapability = bundleCapability.getPackageCapability();
+ boolean isMatch = (otherCapModule == capModule && otherCapability == this);
+ return isMatch;
+ }
+
+ /**
+ * Get the Module associated with this capability
+ */
+ public Module getModule()
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+ return module;
+ }
+
+ @SuppressWarnings("deprecation")
+ public boolean match(OSGiPackageRequirement packageRequirement)
+ {
+ String capPackageName = getName();
+ String reqPackageName = packageRequirement.getName();
+ if (capPackageName.equals(reqPackageName) == false)
+ return false;
+
+ VersionRange reqVersionRange = packageRequirement.getVersionRange();
+ Object capVersion = getVersion();
+ if (reqVersionRange.isInRange(capVersion) == false)
+ return false;
+
+ OSGiMetaData metaData = bundleState.getOSGiMetaData();
+ PackageAttribute capParameters = exportPackage;
+ PackageAttribute reqParameters = packageRequirement.getRequirePackage();
+
+ boolean validMatch = true;
+
+ // Check all the manadatory attributes are present
+ if (validMatch == true && mandatoryAttributes != null)
+ {
+ if (reqParameters != null)
+ {
+ for (String mand : mandatoryAttributes)
+ {
+ if (reqParameters.getParameter(mand) == null)
+ {
+ validMatch = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if (validMatch == true && reqParameters != null)
+ {
+ Map<String, Parameter> params = reqParameters.getParameters();
+ if (params != null && params.isEmpty() == false)
+ {
+ for (String name : params.keySet())
+ {
+ String otherValue = reqParameters.getParameterValue(name, String.class);
+ String ourValue = capParameters.getParameterValue(name, String.class);
+
+ // todo we shouldn't mix attributes and directives in the metadata
+ if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(name))
+ {
+ if (otherValue.equals(metaData.getBundleSymbolicName()) == false)
+ validMatch = false;
+ }
+ else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))
+ {
+ VersionRange range = (VersionRange)AbstractVersionRange.valueOf(otherValue);
+ if (range.isInRange(metaData.getBundleVersion()) == false)
+ validMatch = false;
+ }
+ else if (Constants.RESOLUTION_DIRECTIVE.equals(name) == false && Constants.PACKAGE_SPECIFICATION_VERSION.equals(name) == false
+ && Constants.VERSION_ATTRIBUTE.equals(name) == false)
+ {
+ if (ourValue == null || ourValue.equals(otherValue) == false)
+ validMatch = false;
+ }
+
+ if (validMatch == false)
+ break;
+ }
+ }
+ }
+
+ return validMatch;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof OSGiPackageCapability == false)
+ return false;
+ if (super.equals(obj) == false)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ protected void toString(StringBuffer buffer)
+ {
+ super.toString(buffer);
+ OSGiMetaData metadata = bundleState.getOSGiMetaData();
+ ParameterizedAttribute parameters = metadata.getBundleParameters();
+ if (parameters != null)
+ {
+ Map<String, Parameter> params = parameters.getParameters();
+ if (params != null && params.isEmpty() == false)
+ buffer.append(" parameters=").append(params);
+ }
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,169 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.plugins.facade.classloading;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
-import org.jboss.osgi.plugins.metadata.spi.PackageAttribute;
-import org.jboss.osgi.plugins.metadata.spi.Parameter;
-import org.osgi.framework.Constants;
-
-/**
- * OSGiPackageRequirement.
- *
- * todo PackagePermission/IMPORT
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiPackageRequirement extends PackageRequirement
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 5109907232396093061L;
-
- /** The bundle state */
- private OSGiBundleState bundleState;
-
- /** The attributes */
- private PackageAttribute requirePackage;
-
- /**
- * Create a new OSGiPackageRequirement.
- *
- * @param requirePackage the require package metadata
- * @return the requirement
- * @throws IllegalArgumentException for a null requirePackage
- */
- @SuppressWarnings("deprecation")
- public static OSGiPackageRequirement create(OSGiBundleState bundleState, PackageAttribute requirePackage)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle");
- if (requirePackage == null)
- throw new IllegalArgumentException("Null require package");
-
- String name = requirePackage.getAttribute();
-
- AbstractVersionRange range = null;
- String versionString = requirePackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
- if (versionString != null)
- {
- range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
- String oldVersionString = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (oldVersionString != null && oldVersionString.equals(versionString) == false)
- throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
- + " of " + oldVersionString);
- }
- else
- {
- versionString = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (versionString != null)
- range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
- }
-
- return new OSGiPackageRequirement(bundleState, name, range, requirePackage);
- }
-
- /**
- * Create a new OSGiPackageRequirement.
- *
- * @param name the name
- * @param versionRange the version range - pass null for all versions
- * @param requirePackage the require package metadata
- * @throws IllegalArgumentException for a null name or requirePackage
- */
- public OSGiPackageRequirement(OSGiBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
- {
- super(name, versionRange);
- this.bundleState = bundleState;
-
- if (requirePackage != null)
- {
- this.requirePackage = requirePackage;
- String resolution = requirePackage.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
- if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
- setOptional(true);
- }
- }
-
- /**
- * Get the requirePackage metadata.
- *
- * @return the requirePackage.
- */
- public PackageAttribute getRequirePackage()
- {
- return requirePackage;
- }
-
- /**
- * Get the Module associated with this requirement
- */
- public Module getModule()
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- Module module = unit.getAttachment(Module.class);
- if (module == null)
- throw new IllegalStateException("Cannot obtain module from: " + bundleState);
- return module;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiPackageRequirement == false)
- return false;
- if (super.equals(obj) == false)
- return false;
-
- return true;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- if (requirePackage != null)
- {
- Map<String, Parameter> parameters = requirePackage.getParameters();
- if (parameters != null)
- {
- Map<String, Object> keyValueMap = new LinkedHashMap<String, Object>();
- for (String key : parameters.keySet())
- {
- Object value = parameters.get(key).getValue();
- keyValueMap.put(key, value);
- }
- buffer.append(" ").append(keyValueMap);
- }
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,169 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.classloading;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiPackageRequirement.
+ *
+ * todo PackagePermission/IMPORT
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiPackageRequirement extends PackageRequirement
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 5109907232396093061L;
+
+ /** The bundle state */
+ private OSGiBundleState bundleState;
+
+ /** The attributes */
+ private PackageAttribute requirePackage;
+
+ /**
+ * Create a new OSGiPackageRequirement.
+ *
+ * @param requirePackage the require package metadata
+ * @return the requirement
+ * @throws IllegalArgumentException for a null requirePackage
+ */
+ @SuppressWarnings("deprecation")
+ public static OSGiPackageRequirement create(OSGiBundleState bundleState, PackageAttribute requirePackage)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle");
+ if (requirePackage == null)
+ throw new IllegalArgumentException("Null require package");
+
+ String name = requirePackage.getAttribute();
+
+ AbstractVersionRange range = null;
+ String versionString = requirePackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
+ if (versionString != null)
+ {
+ range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
+ String oldVersionString = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+ if (oldVersionString != null && oldVersionString.equals(versionString) == false)
+ throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
+ + " of " + oldVersionString);
+ }
+ else
+ {
+ versionString = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+ if (versionString != null)
+ range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
+ }
+
+ return new OSGiPackageRequirement(bundleState, name, range, requirePackage);
+ }
+
+ /**
+ * Create a new OSGiPackageRequirement.
+ *
+ * @param name the name
+ * @param versionRange the version range - pass null for all versions
+ * @param requirePackage the require package metadata
+ * @throws IllegalArgumentException for a null name or requirePackage
+ */
+ public OSGiPackageRequirement(OSGiBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
+ {
+ super(name, versionRange);
+ this.bundleState = bundleState;
+
+ if (requirePackage != null)
+ {
+ this.requirePackage = requirePackage;
+ String resolution = requirePackage.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
+ if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
+ setOptional(true);
+ }
+ }
+
+ /**
+ * Get the requirePackage metadata.
+ *
+ * @return the requirePackage.
+ */
+ public PackageAttribute getRequirePackage()
+ {
+ return requirePackage;
+ }
+
+ /**
+ * Get the Module associated with this requirement
+ */
+ public Module getModule()
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+ return module;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof OSGiPackageRequirement == false)
+ return false;
+ if (super.equals(obj) == false)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ protected void toString(StringBuffer buffer)
+ {
+ super.toString(buffer);
+ if (requirePackage != null)
+ {
+ Map<String, Parameter> parameters = requirePackage.getParameters();
+ if (parameters != null)
+ {
+ Map<String, Object> keyValueMap = new LinkedHashMap<String, Object>();
+ for (String key : parameters.keySet())
+ {
+ Object value = parameters.get(key).getValue();
+ keyValueMap.put(key, value);
+ }
+ buffer.append(" ").append(keyValueMap);
+ }
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+
+/**
+ * OSGiBundleActivatorDeployer.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleActivatorDeployer extends AbstractSimpleRealDeployer<OSGiBundleState>
+{
+ public OSGiBundleActivatorDeployer()
+ {
+ super(OSGiBundleState.class);
+ setTopLevelOnly(true);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, OSGiBundleState bundleState) throws DeploymentException
+ {
+ try
+ {
+ bundleState.startInternal();
+ }
+ catch (Throwable t)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + bundleState, t);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, OSGiBundleState deployment)
+ {
+ try
+ {
+ deployment.stopInternal();
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error stopping bundle: " + deployment, t);
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateDeployer.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleStateDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateDeployer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+
+/**
+ * OSGiBundleStateDeployer.<p>
+ *
+ * This deployer creates a bundle state object for all top level deployments
+ * regardless of whether they are OSGi deployments or not.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleStateDeployer extends AbstractRealDeployer
+{
+ /** The bundle manager */
+ private OSGiBundleManager bundleManager;
+ private DeploymentStage requiredStage;
+
+ /**
+ * Create a new BundleStateDeployer.
+ *
+ * @param bundleManager the bundleManager
+ * @throws IllegalArgumentException for a null bundle manager
+ */
+ public OSGiBundleStateDeployer(OSGiBundleManager bundleManager)
+ {
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundle manager");
+
+ this.bundleManager = bundleManager;
+ this.requiredStage = DeploymentStages.DESCRIBE;
+
+ setInput(OSGiMetaData.class);
+ setOutput(OSGiBundleState.class);
+ setStage(DeploymentStages.POST_PARSE);
+ setTopLevelOnly(true);
+ }
+
+ public void setRequiredStage(String stage)
+ {
+ requiredStage = new DeploymentStage(stage);
+ }
+
+ @Override
+ protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ // [TODO] look at manifest headers and persistent state for this
+ unit.setRequiredStage(requiredStage);
+
+ OSGiBundleState bundleState = bundleManager.addDeployment(unit);
+ unit.addAttachment(OSGiBundleState.class, bundleState);
+
+ ControllerContext context = unit.getAttachment(ControllerContext.class);
+ if (context == null)
+ throw new IllegalStateException("Cannot obtain ControllerContext");
+ }
+
+ @Override
+ protected void internalUndeploy(DeploymentUnit unit)
+ {
+ OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ if (bundleState != null)
+ bundleManager.removeBundle(bundleState);
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiDeployersWrapper.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,212 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import static org.jboss.osgi.spi.Constants.PROPERTY_AUTO_START;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * A Deployers implementation that wraps the deployers that are associated with the MainDeployer.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Sep-2009
+ */
+public class OSGiDeployersWrapper implements Deployers
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(OSGiDeployersWrapper.class);
+
+ private MainDeployer mainDeployer;
+ private Deployers deployers;
+ private OSGiBundleManager bundleManager;
+ private PackageAdmin packageAdmin;
+
+ /** The list of unresolved bundles */
+ private List<OSGiBundleState> unresolvedBundles = new ArrayList<OSGiBundleState>();
+
+ public OSGiDeployersWrapper(MainDeployer mainDeployer, OSGiBundleManager bundleManager)
+ {
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundleManager");
+ if (mainDeployer instanceof MainDeployerImpl == false)
+ throw new IllegalStateException("Cannot instrument: " + mainDeployer);
+
+ this.mainDeployer = mainDeployer;
+ this.bundleManager = bundleManager;
+
+ // Swap the deployers implementation
+ MainDeployerImpl mainDeployerImpl = (MainDeployerImpl)mainDeployer;
+ this.deployers = mainDeployerImpl.getDeployers();
+ mainDeployerImpl.setDeployers(this);
+ }
+
+ private PackageAdmin getPackageAdmin()
+ {
+ if (packageAdmin == null)
+ {
+ BundleContext sysContext = bundleManager.getBundleContext();
+ ServiceReference sref = sysContext.getServiceReference(PackageAdmin.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain PackageAdmin");
+
+ packageAdmin = (PackageAdmin)sysContext.getService(sref);
+ }
+ return packageAdmin;
+ }
+
+ public void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
+ {
+ // Delegate to the original deployers
+ deployers.process(deploy, undeploy);
+
+ // OSGi bundles resolve phase
+ afterDeployersProcess(deploy, undeploy);
+ }
+
+ private void afterDeployersProcess(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
+ {
+ // Process undeploy contexts
+ if (undeploy != null)
+ {
+ for (DeploymentContext context : undeploy)
+ {
+ DeploymentUnit unit = context.getDeploymentUnit();
+ OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ if (bundle != null)
+ {
+ unresolvedBundles.remove(bundle);
+ }
+ }
+ }
+
+ // Process deploy contexts
+ if (deploy != null)
+ {
+ // Collect unresolved bundles
+ for (DeploymentContext context : deploy)
+ {
+ DeploymentUnit unit = context.getDeploymentUnit();
+ OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ if (bundle == null)
+ continue;
+
+ Boolean autoStart = (Boolean)unit.getAttachment(PROPERTY_AUTO_START);
+ if (autoStart == null)
+ autoStart = Boolean.TRUE;
+
+ if (autoStart == true && bundle.getState() == Bundle.INSTALLED)
+ {
+ unresolvedBundles.add(0, bundle);
+ }
+ }
+
+ // Try to resolve all unresolved bundles
+ if (unresolvedBundles.isEmpty() == false)
+ {
+ OSGiBundleState[] unresolved = new OSGiBundleState[unresolvedBundles.size()];
+ unresolvedBundles.toArray(unresolved);
+
+ // Use PackageAdmin to resolve the bundles
+ getPackageAdmin().resolveBundles(unresolved);
+
+ for (OSGiBundleState aux : unresolved)
+ {
+ if (aux.getState() != Bundle.RESOLVED)
+ log.info("Unresolved: " + aux);
+
+ if (aux.getState() == Bundle.RESOLVED)
+ {
+ unresolvedBundles.remove(aux);
+
+ try
+ {
+ // When resolved progress to INSTALLED
+ String name = aux.getDeploymentUnit().getName();
+ mainDeployer.change(name, DeploymentStages.INSTALLED);
+ }
+ catch (DeploymentException ex)
+ {
+ log.error(ex);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void change(DeploymentContext context, DeploymentStage stage) throws DeploymentException
+ {
+ deployers.change(context, stage);
+ }
+
+ public void checkComplete(DeploymentContext... contexts) throws DeploymentException
+ {
+ deployers.checkComplete(contexts);
+ }
+
+ public void checkComplete(Collection<DeploymentContext> errors, Collection<Deployment> missingDeployer) throws DeploymentException
+ {
+ deployers.checkComplete(errors, missingDeployer);
+ }
+
+ public void checkStructureComplete(DeploymentContext... contexts) throws DeploymentException
+ {
+ deployers.checkStructureComplete(contexts);
+ }
+
+ public DeploymentStage getDeploymentStage(DeploymentContext context) throws DeploymentException
+ {
+ return deployers.getDeploymentStage(context);
+ }
+
+ public Map<String, ManagedObject> getManagedObjects(DeploymentContext context) throws DeploymentException
+ {
+ return deployers.getManagedObjects(context);
+ }
+
+ public void shutdown()
+ {
+ deployers.shutdown();
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiManifestParsingDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
+
+import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractOSGiMetaData;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiManifestParsingDeployer.<p>
+ *
+ * This deployer attaches OSGiMetaData to the deployment if it is a real OSGi bundle.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiManifestParsingDeployer extends ManifestDeployer<OSGiMetaData>
+{
+ /**
+ * Create a new OSGiManifestParsingDeployer.
+ */
+ public OSGiManifestParsingDeployer()
+ {
+ super(OSGiMetaData.class);
+ setTopLevelOnly(true); // REVIEW allow OSGi sub-deployments? Probably not?
+ }
+
+ @Override
+ protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
+ {
+ // To be a true OSGi bundle it must have a bundle symbolic name in the manfiest
+ if (manifest.getMainAttributes().get(new Name(Constants.BUNDLE_SYMBOLICNAME)) == null)
+ return null;
+
+ return new AbstractOSGiMetaData(manifest);
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/FilterImpl.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/FilterImpl.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/FilterImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/FilterImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.filter;
+
+import java.util.Dictionary;
+
+import org.jboss.osgi.framework.filter.model.Operation;
+import org.jboss.osgi.framework.filter.parser.FilterParser;
+import org.jboss.osgi.framework.filter.property.PropertySource;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * FilterImpl.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class FilterImpl implements Filter
+{
+ /** The operation */
+ private Operation operation;
+
+ /** The cached string */
+ private String cachedString;
+
+ /**
+ * Create a new FilterImpl.
+ *
+ * @param filter the filter
+ * @throws InvalidSyntaxException if the filter syntax is invalid
+ */
+ public FilterImpl(String filter) throws InvalidSyntaxException
+ {
+ if (filter == null)
+ throw new InvalidSyntaxException("Null filter", "?");
+
+ FilterParser parser = new FilterParser();
+ this.operation = parser.parse(filter);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean match(Dictionary dictionary)
+ {
+ return operation.match(PropertySource.fromDictionary(dictionary, false));
+ }
+
+ public boolean match(ServiceReference reference)
+ {
+ return operation.match(PropertySource.fromServiceReference(reference));
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean matchCase(Dictionary dictionary)
+ {
+ return operation.match(PropertySource.fromDictionary(dictionary, true));
+ }
+
+ @Override
+ public String toString()
+ {
+ if (cachedString == null)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append('(');
+ operation.toString(builder);
+ builder.append(')');
+ cachedString = builder.toString();
+ }
+ return cachedString;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof Filter == false)
+ return false;
+ return toString().equals(obj.toString());
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/NoFilter.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/NoFilter.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/NoFilter.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/NoFilter.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.filter;
+
+import java.util.Dictionary;
+
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Dummy filter implementation
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoFilter implements Filter
+{
+ /** Singleton instance */
+ public static final Filter INSTANCE = new NoFilter();
+
+ /**
+ * Singleton
+ */
+ private NoFilter()
+ {
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean match(Dictionary dictionary)
+ {
+ return true;
+ }
+
+ public boolean match(ServiceReference reference)
+ {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean matchCase(Dictionary dictionary)
+ {
+ return true;
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/AndOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/AndOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/AndOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.filter.model;
+package org.jboss.osgi.framework.filter.model;
import java.util.List;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* AndOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/ApproximateOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/ApproximateOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/ApproximateOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
/**
* ApproximateOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/CompareOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/CompareOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/CompareOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -41,13 +41,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Iterator;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* CompareOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/EqualsOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/EqualsOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/EqualsOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
/**
* EqualsOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/GreaterThanOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/GreaterThanOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/GreaterThanOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
/**
* GreaterThanOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/LessThanOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/LessThanOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/LessThanOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
/**
* LessThanOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/NotOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/NotOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/NotOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,9 +19,9 @@
* Software 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.filter.model;
+package org.jboss.osgi.framework.filter.model;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* NotOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/Operation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/Operation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/Operation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,10 +19,10 @@
* Software 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.filter.model;
+package org.jboss.osgi.framework.filter.model;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* Operation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/OrOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/OrOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/OrOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.filter.model;
+package org.jboss.osgi.framework.filter.model;
import java.util.List;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* OrOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/PresentOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/PresentOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/PresentOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,9 +19,9 @@
* Software 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.filter.model;
+package org.jboss.osgi.framework.filter.model;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* PresentOperation.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/SubStringOperation.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/model/SubStringOperation.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/model/SubStringOperation.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -41,11 +41,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.jboss.osgi.plugins.filter.model;
+package org.jboss.osgi.framework.filter.model;
import java.util.List;
-import org.jboss.osgi.plugins.filter.property.PropertySource;
+import org.jboss.osgi.framework.filter.property.PropertySource;
/**
* SubStringOperation.
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/parser (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/parser)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/parser/FilterParser.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/parser/FilterParser.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/parser/FilterParser.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -41,23 +41,23 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.jboss.osgi.plugins.filter.parser;
+package org.jboss.osgi.framework.filter.parser;
import java.io.CharArrayReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.osgi.plugins.filter.model.AndOperation;
-import org.jboss.osgi.plugins.filter.model.ApproximateOperation;
-import org.jboss.osgi.plugins.filter.model.EqualsOperation;
-import org.jboss.osgi.plugins.filter.model.GreaterThanOperation;
-import org.jboss.osgi.plugins.filter.model.LessThanOperation;
-import org.jboss.osgi.plugins.filter.model.NotOperation;
-import org.jboss.osgi.plugins.filter.model.Operation;
-import org.jboss.osgi.plugins.filter.model.OrOperation;
-import org.jboss.osgi.plugins.filter.model.PresentOperation;
-import org.jboss.osgi.plugins.filter.model.SubStringOperation;
+import org.jboss.osgi.framework.filter.model.AndOperation;
+import org.jboss.osgi.framework.filter.model.ApproximateOperation;
+import org.jboss.osgi.framework.filter.model.EqualsOperation;
+import org.jboss.osgi.framework.filter.model.GreaterThanOperation;
+import org.jboss.osgi.framework.filter.model.LessThanOperation;
+import org.jboss.osgi.framework.filter.model.NotOperation;
+import org.jboss.osgi.framework.filter.model.Operation;
+import org.jboss.osgi.framework.filter.model.OrOperation;
+import org.jboss.osgi.framework.filter.model.PresentOperation;
+import org.jboss.osgi.framework.filter.model.SubStringOperation;
import org.osgi.framework.InvalidSyntaxException;
/**
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/property)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/DictionaryToPropertySource.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/property/DictionaryToPropertySource.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/DictionaryToPropertySource.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.property;
+package org.jboss.osgi.framework.filter.property;
import java.util.Dictionary;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/PropertySource.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/property/PropertySource.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/PropertySource.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.filter.property;
+package org.jboss.osgi.framework.filter.property;
import java.util.Dictionary;
-import org.jboss.osgi.plugins.util.CaseInsensitiveDictionary;
+import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.osgi.framework.ServiceReference;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/ServiceReferenceToPropertySource.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/filter/property/ServiceReferenceToPropertySource.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/filter/property/ServiceReferenceToPropertySource.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.filter.property;
+package org.jboss.osgi.framework.filter.property;
import org.osgi.framework.ServiceReference;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/launch)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFramework.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.launch;
+package org.jboss.osgi.framework.launch;
// $Id$
@@ -27,9 +27,9 @@
import java.io.InputStream;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleWrapper;
-import org.jboss.osgi.plugins.facade.bundle.OSGiSystemState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
+import org.jboss.osgi.framework.bundle.OSGiSystemState;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.launch.Framework;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkBootstrapProvider.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkBootstrapProvider.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.launch;
+package org.jboss.osgi.framework.launch;
// $Id$
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.launch;
+package org.jboss.osgi.framework.launch;
// $Id$
@@ -41,8 +41,8 @@
import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiSystemState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiSystemState;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ActivationPolicyMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/AttributeAware.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/AttributeMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/DependencyMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/HolderMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ListenerMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/OSGiMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,200 @@
+/*
+* 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.framework.metadata;
+
+import java.net.URL;
+import java.util.Dictionary;
+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
+{
+ /**
+ * Get the headers
+ *
+ * @param locale the locale to use
+ * @return the headers
+ */
+ Dictionary<String, String> getHeaders(String locale);
+
+ /**
+ * 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 bundle parameters
+ *
+ * @return the bundle parameters
+ */
+ ParameterizedAttribute getBundleParameters();
+
+ /**
+ * 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();
+
+ /**
+ * Whether the bundle is a singleton
+ *
+ * @return true when it is a singleton
+ */
+ boolean isSingleton();
+
+ /**
+ * Get the fragment attrachment
+ *
+ * todo fragments
+ * @return the fragment attachment
+ */
+ String getFragmentAttachment();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/PackageAttribute.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/Parameter.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ParameterizedAttribute.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.metadata;
+
+import java.util.Map;
+
+/**
+ * Attribute with parameters.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</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);
+
+ /**
+ * Get a parameter value
+ *
+ * @param <T> the expected type
+ * @param name the name of the parameter
+ * @param type the expected type
+ * @return the parmaeter value
+ */
+ <T> T getParameterValue(String name, Class<T> type);
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ReferenceMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceControllerContext.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.metadata;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
+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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceDeployment.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceMetaDataVisitor.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.metadata;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+
+/**
+ * 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);
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceMetaDataVisitorNode.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/ServiceValueMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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;
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/VersionRange.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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);
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/VersionRangeAttribute.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.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();
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractActivationPolicyMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractActivationPolicyMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractActivationPolicyMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ActivationPolicyMetaData;
+import org.jboss.osgi.framework.metadata.ActivationPolicyMetaData;
/**
* Activation policy impl.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeAware.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractAttributeAware.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeAware.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
-import org.jboss.osgi.plugins.metadata.AttributeAware;
+import org.jboss.osgi.framework.metadata.AttributeAware;
import org.jboss.util.JBossObject;
import org.jboss.util.JBossStringBuilder;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractAttributeMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractAttributeMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,13 +19,13 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.osgi.plugins.metadata.AttributeMetaData;
-import org.jboss.osgi.plugins.metadata.ServiceValueMetaData;
+import org.jboss.osgi.framework.metadata.AttributeMetaData;
+import org.jboss.osgi.framework.metadata.ServiceValueMetaData;
import org.jboss.util.UnreachableStatementException;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractDependencyMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractDependencyMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractDependencyMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,16 +19,16 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
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.plugins.metadata.DependencyMetaData;
-import org.jboss.osgi.plugins.metadata.ServiceControllerContext;
-import org.jboss.osgi.plugins.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.framework.metadata.DependencyMetaData;
+import org.jboss.osgi.framework.metadata.ServiceControllerContext;
+import org.jboss.osgi.framework.metadata.ServiceMetaDataVisitor;
import org.jboss.util.JBossStringBuilder;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractHolderMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractHolderMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractHolderMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,14 +19,14 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import java.util.Set;
import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
-import org.jboss.osgi.plugins.metadata.DependencyMetaData;
-import org.jboss.osgi.plugins.metadata.HolderMetaData;
+import org.jboss.osgi.framework.metadata.DependencyMetaData;
+import org.jboss.osgi.framework.metadata.HolderMetaData;
/**
* Common OSGi reference or service impl.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractListenerMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractListenerMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractListenerMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
-import org.jboss.osgi.plugins.metadata.ListenerMetaData;
+import org.jboss.osgi.framework.metadata.ListenerMetaData;
/**
* Simple listener meta data.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractMetaDataVisitorNode.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractMetaDataVisitorNode.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractMetaDataVisitorNode.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,13 +19,13 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Iterator;
import java.util.Set;
-import org.jboss.osgi.plugins.metadata.ServiceMetaDataVisitor;
-import org.jboss.osgi.plugins.metadata.ServiceMetaDataVisitorNode;
+import org.jboss.osgi.framework.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.framework.metadata.ServiceMetaDataVisitorNode;
import org.jboss.util.JBossObject;
import org.jboss.util.collection.CollectionsFactory;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractOSGiMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractOSGiMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,18 +19,18 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.ACTIVATION_POLICY_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.INTEGER_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.PACKAGE_LIST_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.PARAM_ATTRIB_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.PATH_ATTRIB_LIST_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.QNAME_ATTRIB_LIST_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.STRING_LIST_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.STRING_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.URL_VC;
-import static org.jboss.osgi.plugins.metadata.impl.ValueCreatorUtil.VERSION_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.ACTIVATION_POLICY_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.INTEGER_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.PACKAGE_LIST_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.PARAM_ATTRIB_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.PATH_ATTRIB_LIST_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.QNAME_ATTRIB_LIST_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.STRING_LIST_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.STRING_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.URL_VC;
+import static org.jboss.osgi.framework.metadata.impl.ValueCreatorUtil.VERSION_VC;
import static org.osgi.framework.Constants.BUNDLE_ACTIVATOR;
import static org.osgi.framework.Constants.BUNDLE_CATEGORY;
import static org.osgi.framework.Constants.BUNDLE_CLASSPATH;
@@ -63,13 +63,13 @@
import org.jboss.classloading.spi.version.VersionComparatorRegistry;
import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-import org.jboss.osgi.plugins.metadata.ActivationPolicyMetaData;
-import org.jboss.osgi.plugins.metadata.OSGiMetaData;
-import org.jboss.osgi.plugins.metadata.PackageAttribute;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
-import org.jboss.osgi.plugins.metadata.impl.AbstractVersionRange.OSGiVersionToOSGiVersionComparator;
-import org.jboss.osgi.plugins.metadata.impl.AbstractVersionRange.OSGiVersionToStringComparator;
-import org.jboss.osgi.plugins.metadata.impl.AbstractVersionRange.OSGiVersionToVersionComparator;
+import org.jboss.osgi.framework.metadata.ActivationPolicyMetaData;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange.OSGiVersionToOSGiVersionComparator;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange.OSGiVersionToStringComparator;
+import org.jboss.osgi.framework.metadata.impl.AbstractVersionRange.OSGiVersionToVersionComparator;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractPackageAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractPackageAttribute.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractPackageAttribute.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,14 +19,14 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import java.util.Map;
-import org.jboss.osgi.plugins.metadata.PackageAttribute;
-import org.jboss.osgi.plugins.metadata.Parameter;
-import org.jboss.osgi.plugins.metadata.VersionRange;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.VersionRange;
import org.jboss.reflect.plugins.PackageInfoImpl;
import org.jboss.reflect.spi.PackageInfo;
import org.osgi.framework.Constants;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractParameter.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameter.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,13 +19,13 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
-import org.jboss.osgi.plugins.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.Parameter;
import org.jboss.util.JBossObject;
import org.jboss.util.JBossStringBuilder;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractParameterizedAttribute.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractParameterizedAttribute.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Map;
-import org.jboss.osgi.plugins.metadata.Parameter;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
import org.jboss.util.JBossStringBuilder;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractReferenceMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractReferenceMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractReferenceMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
import java.util.Set;
@@ -29,9 +29,9 @@
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
import org.jboss.beans.metadata.spi.PropertyMetaData;
import org.jboss.dependency.spi.Cardinality;
-import org.jboss.osgi.plugins.metadata.ListenerMetaData;
-import org.jboss.osgi.plugins.metadata.ReferenceMetaData;
-import org.jboss.osgi.plugins.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.framework.metadata.ListenerMetaData;
+import org.jboss.osgi.framework.metadata.ReferenceMetaData;
+import org.jboss.osgi.framework.metadata.ServiceMetaDataVisitor;
import org.osgi.framework.BundleContext;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceDeployment.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractServiceDeployment.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceDeployment.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ServiceDeployment;
-import org.jboss.osgi.plugins.metadata.ServiceMetaData;
+import org.jboss.osgi.framework.metadata.ServiceDeployment;
+import org.jboss.osgi.framework.metadata.ServiceMetaData;
import org.jboss.util.JBossObject;
import org.jboss.util.JBossStringBuilder;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractServiceMetaData.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractServiceMetaData.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,16 +19,16 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.jboss.osgi.plugins.metadata.AttributeMetaData;
-import org.jboss.osgi.plugins.metadata.ServiceMetaData;
-import org.jboss.osgi.plugins.metadata.ServiceMetaDataVisitor;
+import org.jboss.osgi.framework.metadata.AttributeMetaData;
+import org.jboss.osgi.framework.metadata.ServiceMetaData;
+import org.jboss.osgi.framework.metadata.ServiceMetaDataVisitor;
/**
* OSGi service meta data.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import org.jboss.logging.Logger;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractVersionRange.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/AbstractVersionRange.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/AbstractVersionRange.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,13 +19,13 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.io.Serializable;
import java.util.StringTokenizer;
import org.jboss.classloading.spi.version.VersionComparator;
-import org.jboss.osgi.plugins.metadata.VersionRange;
+import org.jboss.osgi.framework.metadata.VersionRange;
import org.osgi.framework.Version;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ActivationPolicyMDValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ActivationPolicyMDValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ActivationPolicyMDValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Arrays;
-import org.jboss.osgi.plugins.metadata.ActivationPolicyMetaData;
+import org.jboss.osgi.framework.metadata.ActivationPolicyMetaData;
/**
* Activation policy value creator.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/BooleanValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/BooleanValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/BooleanValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
/**
* Parse boolean from string.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/CollectionValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/CollectionValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/CollectionValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Collection;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/IntegerValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/IntegerValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/IntegerValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
/**
* Parse int from string.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/OSGiParameters.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/OSGiParameters.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/OSGiParameters.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Collection;
import java.util.Collections;
@@ -27,8 +27,8 @@
import java.util.Map;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.metadata.Parameter;
-import org.jboss.osgi.plugins.metadata.VersionRange;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.VersionRange;
import static org.osgi.framework.Constants.*;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PackageAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/PackageAttributeListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PackageAttributeListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
/**
* Create package attribute list from string attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ParameterizedAttributeListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
/**
* Create parameterized attribute list from string attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ParameterizedAttributeValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ParameterizedAttributeValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
/**
* Create paramertized attribute from string attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PathAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/PathAttributeListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/PathAttributeListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
/**
* Create path attribute list from string attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/QNameAttributeListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/QNameAttributeListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/QNameAttributeListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,11 +19,11 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.List;
-import org.jboss.osgi.plugins.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
/**
* Create [dynamic]qname attribute list from string attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringListValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/StringListValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringListValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.util.Arrays;
import java.util.List;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/StringValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/StringValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
/**
* Plain string forwarding - no conversion.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/URLValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/URLValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/URLValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import java.net.MalformedURLException;
import java.net.URL;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
/**
* Create value from attribute.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreatorUtil.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/ValueCreatorUtil.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/ValueCreatorUtil.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
/**
* ValueCreator holder.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionRangeValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/VersionRangeValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionRangeValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,9 +19,9 @@
* Software 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.impl;
+package org.jboss.osgi.framework.metadata.impl;
-import org.jboss.osgi.plugins.metadata.VersionRange;
+import org.jboss.osgi.framework.metadata.VersionRange;
/**
* Parse VersionRange from string.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionValueCreator.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/metadata/impl/VersionValueCreator.java 2009-10-02 07:08:46 UTC (rev 94256)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/metadata/impl/VersionValueCreator.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.metadata.impl;
+package org.jboss.osgi.framework.metadata.impl;
import org.osgi.framework.Version;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/AutoInstallPlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/AutoInstallPlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/AutoInstallPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/AutoInstallPlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,40 @@
+/*
+ * 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.framework.plugins;
+
+import org.osgi.framework.BundleException;
+
+
+//$Id$
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface AutoInstallPlugin extends Plugin
+{
+ void installBundles() throws BundleException;
+
+ void startBundles() throws BundleException;
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/BundleStoragePlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/BundleStoragePlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/BundleStoragePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/BundleStoragePlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,44 @@
+/*
+ * 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.framework.plugins;
+
+// $Id$
+
+import java.io.File;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a bundle persistent storage system.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleStoragePlugin extends Plugin
+{
+ void cleanStorage(String propValue);
+
+ File getStorageDir(Bundle bundle);
+
+ File getDataFile(Bundle bundle, String filename);
+
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/FrameworkEventsPlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/FrameworkEventsPlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/FrameworkEventsPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/FrameworkEventsPlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,65 @@
+/*
+ * 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.framework.plugins;
+
+//$Id: SystemPackagesPlugin.java 92761 2009-08-24 22:10:03Z thomas.diesler at jboss.com $
+
+import org.jboss.osgi.framework.bundle.OSGiServiceState;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.ServiceListener;
+
+/**
+ * A plugin that handles the various OSGi event types.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 27-Aug-2009
+ */
+public interface FrameworkEventsPlugin extends Plugin
+{
+ void addBundleListener(Bundle bundle, BundleListener listener);
+
+ void removeBundleListener(Bundle bundle, BundleListener listener);
+
+ void removeBundleListeners(Bundle bundle);
+
+ void addFrameworkListener(Bundle bundle, FrameworkListener listener);
+
+ void removeFrameworkListener(Bundle bundle, FrameworkListener listener);
+
+ void removeFrameworkListeners(Bundle bundle);
+
+ void addServiceListener(Bundle bundle, ServiceListener listener, Filter filter);
+
+ void removeServiceListener(Bundle bundle, ServiceListener listener);
+
+ void removeServiceListeners(Bundle bundle);
+
+ void fireBundleEvent(Bundle bundle, int type);
+
+ void fireFrameworkEvent(Bundle bundle, int type, Throwable throwable);
+
+ // [TODO] remove dependecy on propriatary API
+ void fireServiceEvent(Bundle bundle, int type, OSGiServiceState service);
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/MicrocontainerServicePlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/MicrocontainerServicePlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/MicrocontainerServicePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/MicrocontainerServicePlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,36 @@
+/*
+ * 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.framework.plugins;
+
+//$Id: AbstractPlugin.java 92725 2009-08-24 06:19:18Z thomas.diesler at jboss.com $
+
+import org.jboss.osgi.spi.service.MicrocontainerService;
+
+/**
+ * The MicrocontainerService service plugin
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 07-Sep-2009
+ */
+public interface MicrocontainerServicePlugin extends ServicePlugin, MicrocontainerService
+{
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/PackageAdminServicePlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/PackageAdminServicePlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/PackageAdminServicePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/PackageAdminServicePlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,36 @@
+/*
+ * 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.framework.plugins;
+
+//$Id: AbstractPlugin.java 92725 2009-08-24 06:19:18Z thomas.diesler at jboss.com $
+
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * The PackageAdmin service plugin
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 07-Sep-2009
+ */
+public interface PackageAdminServicePlugin extends ServicePlugin, PackageAdmin
+{
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/Plugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/Plugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/Plugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/Plugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,42 @@
+/*
+ * 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.framework.plugins;
+
+//$Id$
+
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+
+/**
+ * The base of all framework plugins
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 20-Aug-2009
+ */
+public interface Plugin
+{
+ OSGiBundleManager getBundleManager();
+
+ <T extends Plugin> T getPlugin(Class<T> clazz);
+
+ <T extends Plugin> T getOptionalPlugin(Class<T> clazz);
+
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/ServicePlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/ServicePlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/ServicePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/ServicePlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,41 @@
+/*
+ * 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.framework.plugins;
+
+//$Id: AbstractPlugin.java 92725 2009-08-24 06:19:18Z thomas.diesler at jboss.com $
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * The base of all service plugins
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 07-Sep-2009
+ */
+public interface ServicePlugin extends Plugin
+{
+ BundleContext getSystemContext();
+
+ void startService();
+
+ void stopService();
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/StartLevelServicePlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/StartLevelServicePlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/StartLevelServicePlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/StartLevelServicePlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,34 @@
+/*
+ * 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.framework.plugins;
+
+import org.osgi.service.startlevel.StartLevel;
+
+/**
+ * The StartLevel service plugin
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 07-Sep-2009
+ */
+public interface StartLevelServicePlugin extends ServicePlugin, StartLevel
+{
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/SystemPackagesPlugin.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/api/SystemPackagesPlugin.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/SystemPackagesPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/SystemPackagesPlugin.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,39 @@
+/*
+ * 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.framework.plugins;
+
+import java.util.List;
+
+//$Id$
+
+/**
+ * A plugin that provides the configured list of system packages.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Aug-2009
+ */
+public interface SystemPackagesPlugin extends Plugin
+{
+ List<String> getSystemPackages();
+
+ boolean isSystemPackage(String name);
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractPluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractPluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id$
-import org.jboss.osgi.plugins.facade.api.Plugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.Plugin;
/**
* The base class of all framework plugins.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractServicePluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/AbstractServicePluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AbstractServicePluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,12 +19,12 @@
* Software 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.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id: AbstractPluginImpl.java 92725 2009-08-24 06:19:18Z thomas.diesler at jboss.com $
-import org.jboss.osgi.plugins.facade.api.ServicePlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.ServicePlugin;
import org.osgi.framework.BundleContext;
/**
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AutoInstallPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/AutoInstallPluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/AutoInstallPluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id$
@@ -29,8 +29,8 @@
import java.util.Map;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.AutoInstallPlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/BundleStoragePluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/BundleStoragePluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/BundleStoragePluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id$
@@ -27,8 +27,8 @@
import java.io.IOException;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/FrameworkEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/FrameworkEventsPluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id: SystemPackagesPluginImpl.java 92858 2009-08-27 10:58:32Z thomas.diesler at jboss.com $
@@ -32,11 +32,11 @@
import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.FrameworkEventsPlugin;
-import org.jboss.osgi.plugins.facade.bundle.AbstractBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiServiceState;
-import org.jboss.osgi.plugins.filter.NoFilter;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiServiceState;
+import org.jboss.osgi.framework.filter.NoFilter;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/plugins/impl/SystemPackagesPluginImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.plugins;
+package org.jboss.osgi.framework.plugins.impl;
//$Id$
@@ -28,8 +28,8 @@
import java.util.List;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
import org.osgi.framework.Constants;
/**
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/resolver)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleCapability.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.resolver;
+package org.jboss.osgi.framework.resolver;
import java.util.ArrayList;
import java.util.Collections;
@@ -28,9 +28,9 @@
import org.jboss.classloading.plugins.metadata.PackageCapability;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.facade.classloading.OSGiPackageCapability;
-import org.jboss.osgi.plugins.facade.classloading.OSGiPackageRequirement;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.classloading.OSGiPackageCapability;
+import org.jboss.osgi.framework.classloading.OSGiPackageRequirement;
/**
* An association of bundle/capability.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleRequirement.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,10 +19,10 @@
* Software 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.resolver;
+package org.jboss.osgi.framework.resolver;
import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
/**
* An association of bundle/requirement.
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,460 +0,0 @@
-/*
- * 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.plugins.resolver;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.PackageCapability;
-import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.Capability;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.bundle.AbstractBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleWrapper;
-import org.jboss.osgi.plugins.facade.classloading.OSGiPackageRequirement;
-import org.jboss.osgi.plugins.metadata.spi.OSGiMetaData;
-import org.jboss.osgi.plugins.metadata.spi.Parameter;
-import org.jboss.osgi.plugins.metadata.spi.ParameterizedAttribute;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-/**
- * The BundleResolver wires BundleRequirements to their corresponding BundleCapability.
- *
- * @author thomas.diesler at jboss.com
- * @since 10-Sep-2009
- */
-public class BundleResolver
-{
- /** The log */
- private static final Logger log = Logger.getLogger(BundleResolver.class);
-
- private OSGiBundleManager bundleManager;
- private Map<OSGiBundleState, List<BundleCapability>> bundleCapabilitiesMap = new HashMap<OSGiBundleState, List<BundleCapability>>();
- private Map<OSGiBundleState, List<BundleRequirement>> bundleRequirementsMap = new HashMap<OSGiBundleState, List<BundleRequirement>>();
-
- public BundleResolver(OSGiBundleManager bundleManager)
- {
- this.bundleManager = bundleManager;
- }
-
- /**
- * Resolve the given list of bundles.
- *
- * This is an iterative process that tries to wire BundleRequirements to BundleCapabilities.
- *
- * @return The list of resolved bundles in the resolve order or an empty list
- */
- public List<OSGiBundleState> resolveBundles(List<Bundle> bundles)
- {
- if (bundles == null)
- throw new IllegalArgumentException("Null bundles");
-
- // Normalize to OSGiBundleState instances
- List<OSGiBundleState> unresolvedBundles = new ArrayList<OSGiBundleState>();
- for (Bundle bundle : bundles)
- {
- unresolvedBundles.add(assertBundleState(bundle));
- }
-
- int resolved = 1;
- int resolveRounds = 0;
-
- // Get the list of all capabilities
- List<BundleCapability> allCapabilities = new ArrayList<BundleCapability>();
- for (List<BundleCapability> list : bundleCapabilitiesMap.values())
- {
- allCapabilities.addAll(list);
- }
-
- List<OSGiBundleState> resolvedBundles = new ArrayList<OSGiBundleState>();
- while (resolved > 0 && unresolvedBundles.isEmpty() == false)
- {
- resolveRounds++;
-
- log.debug("#" + resolveRounds + " *****************************************************************");
- log.debug("Unresolved bundles: " + unresolvedBundles);
-
- resolved = 0;
- Iterator<OSGiBundleState> it = unresolvedBundles.iterator();
- while (it.hasNext())
- {
- OSGiBundleState bundleState = it.next();
- log.debug("Resolving: " + bundleState);
- if (resolveBundle(allCapabilities, bundleState))
- {
- resolvedBundles.add(bundleState);
- it.remove();
- resolved++;
- }
- }
- }
-
- log.debug("END *****************************************************************");
-
- // Log the unresolved bundles
- for (OSGiBundleState bundle : unresolvedBundles)
- {
- StringBuffer message = new StringBuffer("Unresolved bundle: " + bundle);
- message.append("\n Cannot find exporter for");
- List<BundleRequirement> bundleRequirements = getBundleRequirements(bundle);
- for (BundleRequirement requirement : bundleRequirements)
- {
- PackageRequirement packreq = requirement.getPackageRequirement();
- BundleCapability bestMatch = findBestMatch(allCapabilities, requirement);
- if (bestMatch == null && packreq.isOptional() == false && packreq.isDynamic() == false)
- {
- message.append("\n " + packreq.getName() + ";version=" + packreq.getVersionRange());
- }
- }
- log.debug(message);
- }
-
- return resolvedBundles;
- }
-
- public void removeBundle(Bundle bundle)
- {
- OSGiBundleState bundleState = assertBundleState(bundle);
-
- bundleCapabilitiesMap.remove(bundleState);
-
- List<BundleRequirement> bundleRequirements = bundleRequirementsMap.remove(bundleState);
- if (bundleRequirements != null)
- {
- for (BundleRequirement requirement : bundleRequirements)
- {
- requirement.unwireCapability();
- }
- }
- }
-
- public BundleCapability getMatchingCapability(Module module, PackageRequirement packageRequirement)
- {
- String location = module.getContextName();
- AbstractBundleState bundle = bundleManager.getBundleByLocation(location);
- if (bundle == null)
- return null;
-
- List<BundleRequirement> requirements = bundleRequirementsMap.get(bundle);
- if (requirements == null)
- return null;
-
- BundleCapability result = null;
- for (BundleRequirement req : requirements)
- {
- if (req.getPackageRequirement() == packageRequirement)
- {
- result = req.getWiredCapability();
- break;
- }
- }
-
- return result;
- }
-
- private boolean resolveBundle(List<BundleCapability> allCapabilities, OSGiBundleState bundle)
- {
- List<BundleCapability> bundleCapabilities = getBundleCapabilities(bundle);
- List<BundleRequirement> bundleRequirements = getBundleRequirements(bundle);
-
- List<BundleCapability> futureCapabilities = new ArrayList<BundleCapability>(allCapabilities);
- futureCapabilities.addAll(bundleCapabilities);
-
- for (BundleRequirement requirement : bundleRequirements)
- {
- PackageRequirement packreq = requirement.getPackageRequirement();
-
- BundleCapability bestMatch = findBestMatch(futureCapabilities, requirement);
- if (bestMatch == null && packreq.isOptional() == false && packreq.isDynamic() == false)
- return false;
-
- requirement.wireCapability(bestMatch);
- }
-
- // Remove optional or dynamic requirements that don't have a wire
- Iterator<BundleRequirement> it = bundleRequirements.iterator();
- while (it.hasNext())
- {
- if (it.next().getWiredCapability() == null)
- it.remove();
- }
-
- if (processRequiredBundle(bundle, bundleCapabilities, bundleRequirements) == false)
- return false;
-
- allCapabilities.addAll(bundleCapabilities);
- bundleCapabilitiesMap.put(bundle, bundleCapabilities);
- bundleRequirementsMap.put(bundle, bundleRequirements);
-
- logResolvedBundleInfo(bundle, bundleCapabilities, bundleRequirements);
-
- return true;
- }
-
- /**
- * Logs information about a resolved bundle
- */
- private void logResolvedBundleInfo(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
- {
- // Log the package wiring information
- StringBuffer message = new StringBuffer("Resolved: " + bundle);
-
- // Log the exports
- int nameLengthMax = 0;
- for (BundleCapability capability : bundleCapabilities)
- {
- PackageCapability packcap = capability.getPackageCapability();
- String packNameVersion = packcap.getName() + ";version=" + packcap.getVersion();
- nameLengthMax = Math.max(nameLengthMax, packNameVersion.length());
- }
- if (bundleCapabilities.isEmpty() == false)
- {
- message.append("\n Exports");
- List<String> lines = new ArrayList<String>();
- for (BundleCapability capability : bundleCapabilities)
- {
- PackageCapability packcap = capability.getPackageCapability();
- String packNameVersion = packcap.getName() + ";version=" + packcap.getVersion();
- lines.add("\n " + packNameVersion);
- }
- Collections.sort(lines);
- for (String line : lines)
- message.append(line);
- }
-
- // Log the imports
- nameLengthMax = 0;
- for (BundleRequirement requirement : bundleRequirements)
- {
- PackageRequirement packreq = requirement.getPackageRequirement();
- String packNameVersion = packreq.getName() + ";version=" + packreq.getVersionRange();
- nameLengthMax = Math.max(nameLengthMax, packNameVersion.length());
- }
- if (bundleRequirements.isEmpty() == false)
- {
- message.append("\n Imports");
- List<String> lines = new ArrayList<String>();
- for (BundleRequirement requirement : bundleRequirements)
- {
- PackageRequirement packreq = requirement.getPackageRequirement();
- String packNameVersion = packreq.getName() + ";version=" + packreq.getVersionRange();
- StringBuffer line = new StringBuffer("\n " + packNameVersion);
- for (int i = 0; i < (nameLengthMax - packNameVersion.length()); i++)
- line.append(" ");
-
- BundleCapability wire = requirement.getWiredCapability();
- if (wire == null)
- {
- line.append(" <= null");
- }
- else
- {
- Bundle wireBundle = wire.getExportingBundle();
- PackageCapability wireCap = wire.getPackageCapability();
- packNameVersion = wireCap.getName() + ";version=" + wireCap.getVersion();
- line.append(" <= " + wireBundle + " " + packNameVersion);
- }
- lines.add(line.toString());
- }
- Collections.sort(lines);
- for (String line : lines)
- message.append(line);
- }
- log.debug(message);
- }
-
- private BundleCapability findBestMatch(List<BundleCapability> capabilities, BundleRequirement requirement)
- {
- BundleCapability result = null;
- for (BundleCapability capability : capabilities)
- {
- if (capability.matches(requirement))
- {
- if (result == null)
- {
- result = capability;
- }
- else
- {
- // [TODO] handle multiple matches
- }
- }
- }
- return result;
- }
-
- /**
- * Get the set of bundle capabilities
- */
- private List<BundleCapability> getBundleCapabilities(OSGiBundleState bundle)
- {
- List<BundleCapability> result = new ArrayList<BundleCapability>();
-
- OSGiBundleState bundleState = assertBundleState(bundle);
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- ClassLoadingMetaData metadata = unit.getAttachment(ClassLoadingMetaData.class);
-
- List<Capability> capabilities = metadata.getCapabilities().getCapabilities();
- if (capabilities != null)
- {
- for (Capability capability : capabilities)
- {
- if (capability instanceof PackageCapability)
- {
- PackageCapability packageCapability = (PackageCapability)capability;
- result.add(new BundleCapability(bundle, packageCapability));
- }
- }
- }
- return result;
- }
-
- /**
- * Get the set of bundle requirements
- */
- private List<BundleRequirement> getBundleRequirements(OSGiBundleState bundle)
- {
- List<BundleRequirement> result = new ArrayList<BundleRequirement>();
-
- OSGiBundleState bundleState = assertBundleState(bundle);
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- ClassLoadingMetaData classloadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
-
- List<Requirement> requirements = classloadingMetaData.getRequirements().getRequirements();
- if (requirements != null)
- {
- for (Requirement requirement : requirements)
- {
- if (requirement instanceof PackageRequirement)
- {
- PackageRequirement packageRequirement = (PackageRequirement)requirement;
- result.add(new BundleRequirement(bundle, packageRequirement));
- }
- }
- }
-
- return result;
- }
-
- private boolean processRequiredBundle(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
- {
- // The Require-Bundle header specifies that all exported packages from
- // another bundle must be imported, effectively requiring the public interface
- // of another bundle
- OSGiMetaData osgiMetaData = bundle.getOSGiMetaData();
- List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();
- if (requireBundles != null)
- {
- for (ParameterizedAttribute attr : requireBundles)
- {
- String requiredBundleName = attr.getAttribute();
- if (requiredBundleName == null)
- throw new IllegalStateException("Cannot obtain value for: " + Constants.REQUIRE_BUNDLE);
-
- String visibility = Constants.VISIBILITY_PRIVATE;
- Parameter param = attr.getParameter(Constants.VISIBILITY_DIRECTIVE);
- if (param != null)
- visibility = (String)param.getValue();
-
- String resolution = Constants.RESOLUTION_MANDATORY;
- param = attr.getParameter(Constants.RESOLUTION_DIRECTIVE);
- if (param != null)
- resolution = (String)param.getValue();
-
- // [TODO] bundle-version
- //String bundleVersion = null;
- //param = attr.getParameter(Constants.BUNDLE_VERSION_ATTRIBUTE);
- //if (param != null)
- // bundleVersion = (String)param.getValue();
-
- if (Constants.RESOLUTION_MANDATORY.equals(resolution))
- {
- Bundle requiredBundle = getRequiredBundle(requiredBundleName);
- if (requiredBundle == null)
- {
- log.debug("Cannot find " + resolution + " required bundle: " + requiredBundleName);
- return false;
- }
-
- List<BundleCapability> otherCapabilities = bundleCapabilitiesMap.get(requiredBundle);
- for (BundleCapability otherCapability : otherCapabilities)
- {
- PackageCapability otherPackage = otherCapability.getPackageCapability();
- String packageName = otherPackage.getName();
- Object version = otherPackage.getVersion();
- VersionRange versionRange = new VersionRange(version, true, version, true);
-
- OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(bundle, packageName, versionRange, null);
- BundleRequirement newBundleRequirement = new BundleRequirement(bundle, newPackageRequirement);
- newBundleRequirement.wireCapability(otherCapability);
- bundleRequirements.add(newBundleRequirement);
-
- if (Constants.VISIBILITY_REEXPORT.equals(visibility))
- {
- BundleCapability newBundleCapability = new BundleCapability(bundle, otherPackage);
- bundleCapabilities.add(newBundleCapability);
- }
- }
- }
- else if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
- {
- // [TODO] resolution=optional
- }
- }
- }
-
- return true;
- }
-
- private Bundle getRequiredBundle(String requiredBundle)
- {
- for (Bundle bundle : bundleCapabilitiesMap.keySet())
- {
- if (bundle.getSymbolicName().equals(requiredBundle))
- return bundle;
- }
- return null;
- }
-
- static OSGiBundleState assertBundleState(Bundle bundle)
- {
- if (bundle instanceof OSGiBundleWrapper)
- bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-
- if (bundle instanceof OSGiBundleState == false)
- throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
-
- return (OSGiBundleState)bundle;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/resolver/BundleResolver.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,460 @@
+/*
+ * 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.framework.resolver;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
+import org.jboss.osgi.framework.classloading.OSGiPackageRequirement;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.Parameter;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * The BundleResolver wires BundleRequirements to their corresponding BundleCapability.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 10-Sep-2009
+ */
+public class BundleResolver
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(BundleResolver.class);
+
+ private OSGiBundleManager bundleManager;
+ private Map<OSGiBundleState, List<BundleCapability>> bundleCapabilitiesMap = new HashMap<OSGiBundleState, List<BundleCapability>>();
+ private Map<OSGiBundleState, List<BundleRequirement>> bundleRequirementsMap = new HashMap<OSGiBundleState, List<BundleRequirement>>();
+
+ public BundleResolver(OSGiBundleManager bundleManager)
+ {
+ this.bundleManager = bundleManager;
+ }
+
+ /**
+ * Resolve the given list of bundles.
+ *
+ * This is an iterative process that tries to wire BundleRequirements to BundleCapabilities.
+ *
+ * @return The list of resolved bundles in the resolve order or an empty list
+ */
+ public List<OSGiBundleState> resolveBundles(List<Bundle> bundles)
+ {
+ if (bundles == null)
+ throw new IllegalArgumentException("Null bundles");
+
+ // Normalize to OSGiBundleState instances
+ List<OSGiBundleState> unresolvedBundles = new ArrayList<OSGiBundleState>();
+ for (Bundle bundle : bundles)
+ {
+ unresolvedBundles.add(assertBundleState(bundle));
+ }
+
+ int resolved = 1;
+ int resolveRounds = 0;
+
+ // Get the list of all capabilities
+ List<BundleCapability> allCapabilities = new ArrayList<BundleCapability>();
+ for (List<BundleCapability> list : bundleCapabilitiesMap.values())
+ {
+ allCapabilities.addAll(list);
+ }
+
+ List<OSGiBundleState> resolvedBundles = new ArrayList<OSGiBundleState>();
+ while (resolved > 0 && unresolvedBundles.isEmpty() == false)
+ {
+ resolveRounds++;
+
+ log.debug("#" + resolveRounds + " *****************************************************************");
+ log.debug("Unresolved bundles: " + unresolvedBundles);
+
+ resolved = 0;
+ Iterator<OSGiBundleState> it = unresolvedBundles.iterator();
+ while (it.hasNext())
+ {
+ OSGiBundleState bundleState = it.next();
+ log.debug("Resolving: " + bundleState);
+ if (resolveBundle(allCapabilities, bundleState))
+ {
+ resolvedBundles.add(bundleState);
+ it.remove();
+ resolved++;
+ }
+ }
+ }
+
+ log.debug("END *****************************************************************");
+
+ // Log the unresolved bundles
+ for (OSGiBundleState bundle : unresolvedBundles)
+ {
+ StringBuffer message = new StringBuffer("Unresolved bundle: " + bundle);
+ message.append("\n Cannot find exporter for");
+ List<BundleRequirement> bundleRequirements = getBundleRequirements(bundle);
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ PackageRequirement packreq = requirement.getPackageRequirement();
+ BundleCapability bestMatch = findBestMatch(allCapabilities, requirement);
+ if (bestMatch == null && packreq.isOptional() == false && packreq.isDynamic() == false)
+ {
+ message.append("\n " + packreq.getName() + ";version=" + packreq.getVersionRange());
+ }
+ }
+ log.debug(message);
+ }
+
+ return resolvedBundles;
+ }
+
+ public void removeBundle(Bundle bundle)
+ {
+ OSGiBundleState bundleState = assertBundleState(bundle);
+
+ bundleCapabilitiesMap.remove(bundleState);
+
+ List<BundleRequirement> bundleRequirements = bundleRequirementsMap.remove(bundleState);
+ if (bundleRequirements != null)
+ {
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ requirement.unwireCapability();
+ }
+ }
+ }
+
+ public BundleCapability getMatchingCapability(Module module, PackageRequirement packageRequirement)
+ {
+ String location = module.getContextName();
+ AbstractBundleState bundle = bundleManager.getBundleByLocation(location);
+ if (bundle == null)
+ return null;
+
+ List<BundleRequirement> requirements = bundleRequirementsMap.get(bundle);
+ if (requirements == null)
+ return null;
+
+ BundleCapability result = null;
+ for (BundleRequirement req : requirements)
+ {
+ if (req.getPackageRequirement() == packageRequirement)
+ {
+ result = req.getWiredCapability();
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ private boolean resolveBundle(List<BundleCapability> allCapabilities, OSGiBundleState bundle)
+ {
+ List<BundleCapability> bundleCapabilities = getBundleCapabilities(bundle);
+ List<BundleRequirement> bundleRequirements = getBundleRequirements(bundle);
+
+ List<BundleCapability> futureCapabilities = new ArrayList<BundleCapability>(allCapabilities);
+ futureCapabilities.addAll(bundleCapabilities);
+
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ PackageRequirement packreq = requirement.getPackageRequirement();
+
+ BundleCapability bestMatch = findBestMatch(futureCapabilities, requirement);
+ if (bestMatch == null && packreq.isOptional() == false && packreq.isDynamic() == false)
+ return false;
+
+ requirement.wireCapability(bestMatch);
+ }
+
+ // Remove optional or dynamic requirements that don't have a wire
+ Iterator<BundleRequirement> it = bundleRequirements.iterator();
+ while (it.hasNext())
+ {
+ if (it.next().getWiredCapability() == null)
+ it.remove();
+ }
+
+ if (processRequiredBundle(bundle, bundleCapabilities, bundleRequirements) == false)
+ return false;
+
+ allCapabilities.addAll(bundleCapabilities);
+ bundleCapabilitiesMap.put(bundle, bundleCapabilities);
+ bundleRequirementsMap.put(bundle, bundleRequirements);
+
+ logResolvedBundleInfo(bundle, bundleCapabilities, bundleRequirements);
+
+ return true;
+ }
+
+ /**
+ * Logs information about a resolved bundle
+ */
+ private void logResolvedBundleInfo(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
+ {
+ // Log the package wiring information
+ StringBuffer message = new StringBuffer("Resolved: " + bundle);
+
+ // Log the exports
+ int nameLengthMax = 0;
+ for (BundleCapability capability : bundleCapabilities)
+ {
+ PackageCapability packcap = capability.getPackageCapability();
+ String packNameVersion = packcap.getName() + ";version=" + packcap.getVersion();
+ nameLengthMax = Math.max(nameLengthMax, packNameVersion.length());
+ }
+ if (bundleCapabilities.isEmpty() == false)
+ {
+ message.append("\n Exports");
+ List<String> lines = new ArrayList<String>();
+ for (BundleCapability capability : bundleCapabilities)
+ {
+ PackageCapability packcap = capability.getPackageCapability();
+ String packNameVersion = packcap.getName() + ";version=" + packcap.getVersion();
+ lines.add("\n " + packNameVersion);
+ }
+ Collections.sort(lines);
+ for (String line : lines)
+ message.append(line);
+ }
+
+ // Log the imports
+ nameLengthMax = 0;
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ PackageRequirement packreq = requirement.getPackageRequirement();
+ String packNameVersion = packreq.getName() + ";version=" + packreq.getVersionRange();
+ nameLengthMax = Math.max(nameLengthMax, packNameVersion.length());
+ }
+ if (bundleRequirements.isEmpty() == false)
+ {
+ message.append("\n Imports");
+ List<String> lines = new ArrayList<String>();
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ PackageRequirement packreq = requirement.getPackageRequirement();
+ String packNameVersion = packreq.getName() + ";version=" + packreq.getVersionRange();
+ StringBuffer line = new StringBuffer("\n " + packNameVersion);
+ for (int i = 0; i < (nameLengthMax - packNameVersion.length()); i++)
+ line.append(" ");
+
+ BundleCapability wire = requirement.getWiredCapability();
+ if (wire == null)
+ {
+ line.append(" <= null");
+ }
+ else
+ {
+ Bundle wireBundle = wire.getExportingBundle();
+ PackageCapability wireCap = wire.getPackageCapability();
+ packNameVersion = wireCap.getName() + ";version=" + wireCap.getVersion();
+ line.append(" <= " + wireBundle + " " + packNameVersion);
+ }
+ lines.add(line.toString());
+ }
+ Collections.sort(lines);
+ for (String line : lines)
+ message.append(line);
+ }
+ log.debug(message);
+ }
+
+ private BundleCapability findBestMatch(List<BundleCapability> capabilities, BundleRequirement requirement)
+ {
+ BundleCapability result = null;
+ for (BundleCapability capability : capabilities)
+ {
+ if (capability.matches(requirement))
+ {
+ if (result == null)
+ {
+ result = capability;
+ }
+ else
+ {
+ // [TODO] handle multiple matches
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the set of bundle capabilities
+ */
+ private List<BundleCapability> getBundleCapabilities(OSGiBundleState bundle)
+ {
+ List<BundleCapability> result = new ArrayList<BundleCapability>();
+
+ OSGiBundleState bundleState = assertBundleState(bundle);
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ ClassLoadingMetaData metadata = unit.getAttachment(ClassLoadingMetaData.class);
+
+ List<Capability> capabilities = metadata.getCapabilities().getCapabilities();
+ if (capabilities != null)
+ {
+ for (Capability capability : capabilities)
+ {
+ if (capability instanceof PackageCapability)
+ {
+ PackageCapability packageCapability = (PackageCapability)capability;
+ result.add(new BundleCapability(bundle, packageCapability));
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the set of bundle requirements
+ */
+ private List<BundleRequirement> getBundleRequirements(OSGiBundleState bundle)
+ {
+ List<BundleRequirement> result = new ArrayList<BundleRequirement>();
+
+ OSGiBundleState bundleState = assertBundleState(bundle);
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ ClassLoadingMetaData classloadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+
+ List<Requirement> requirements = classloadingMetaData.getRequirements().getRequirements();
+ if (requirements != null)
+ {
+ for (Requirement requirement : requirements)
+ {
+ if (requirement instanceof PackageRequirement)
+ {
+ PackageRequirement packageRequirement = (PackageRequirement)requirement;
+ result.add(new BundleRequirement(bundle, packageRequirement));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private boolean processRequiredBundle(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
+ {
+ // The Require-Bundle header specifies that all exported packages from
+ // another bundle must be imported, effectively requiring the public interface
+ // of another bundle
+ OSGiMetaData osgiMetaData = bundle.getOSGiMetaData();
+ List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();
+ if (requireBundles != null)
+ {
+ for (ParameterizedAttribute attr : requireBundles)
+ {
+ String requiredBundleName = attr.getAttribute();
+ if (requiredBundleName == null)
+ throw new IllegalStateException("Cannot obtain value for: " + Constants.REQUIRE_BUNDLE);
+
+ String visibility = Constants.VISIBILITY_PRIVATE;
+ Parameter param = attr.getParameter(Constants.VISIBILITY_DIRECTIVE);
+ if (param != null)
+ visibility = (String)param.getValue();
+
+ String resolution = Constants.RESOLUTION_MANDATORY;
+ param = attr.getParameter(Constants.RESOLUTION_DIRECTIVE);
+ if (param != null)
+ resolution = (String)param.getValue();
+
+ // [TODO] bundle-version
+ //String bundleVersion = null;
+ //param = attr.getParameter(Constants.BUNDLE_VERSION_ATTRIBUTE);
+ //if (param != null)
+ // bundleVersion = (String)param.getValue();
+
+ if (Constants.RESOLUTION_MANDATORY.equals(resolution))
+ {
+ Bundle requiredBundle = getRequiredBundle(requiredBundleName);
+ if (requiredBundle == null)
+ {
+ log.debug("Cannot find " + resolution + " required bundle: " + requiredBundleName);
+ return false;
+ }
+
+ List<BundleCapability> otherCapabilities = bundleCapabilitiesMap.get(requiredBundle);
+ for (BundleCapability otherCapability : otherCapabilities)
+ {
+ PackageCapability otherPackage = otherCapability.getPackageCapability();
+ String packageName = otherPackage.getName();
+ Object version = otherPackage.getVersion();
+ VersionRange versionRange = new VersionRange(version, true, version, true);
+
+ OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(bundle, packageName, versionRange, null);
+ BundleRequirement newBundleRequirement = new BundleRequirement(bundle, newPackageRequirement);
+ newBundleRequirement.wireCapability(otherCapability);
+ bundleRequirements.add(newBundleRequirement);
+
+ if (Constants.VISIBILITY_REEXPORT.equals(visibility))
+ {
+ BundleCapability newBundleCapability = new BundleCapability(bundle, otherPackage);
+ bundleCapabilities.add(newBundleCapability);
+ }
+ }
+ }
+ else if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
+ {
+ // [TODO] resolution=optional
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private Bundle getRequiredBundle(String requiredBundle)
+ {
+ for (Bundle bundle : bundleCapabilitiesMap.keySet())
+ {
+ if (bundle.getSymbolicName().equals(requiredBundle))
+ return bundle;
+ }
+ return null;
+ }
+
+ static OSGiBundleState assertBundleState(Bundle bundle)
+ {
+ if (bundle instanceof OSGiBundleWrapper)
+ bundle = ((OSGiBundleWrapper)bundle).getBundleState();
+
+ if (bundle instanceof OSGiBundleState == false)
+ throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
+
+ return (OSGiBundleState)bundle;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/service)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/MicrocontainerServiceImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.service;
+package org.jboss.osgi.framework.service;
//$Id$
@@ -41,9 +41,9 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.MicrocontainerServicePlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.plugins.AbstractServicePluginImpl;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.MicrocontainerServicePlugin;
+import org.jboss.osgi.framework.plugins.impl.AbstractServicePluginImpl;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.Constants;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/service/PackageAdminImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/PackageAdminImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.facade.service;
+package org.jboss.osgi.framework.service;
//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler at jboss.com $
@@ -33,13 +33,13 @@
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.PackageAdminServicePlugin;
-import org.jboss.osgi.plugins.facade.bundle.AbstractBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleWrapper;
-import org.jboss.osgi.plugins.facade.plugins.AbstractServicePluginImpl;
-import org.jboss.osgi.plugins.resolver.BundleResolver;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
+import org.jboss.osgi.framework.plugins.PackageAdminServicePlugin;
+import org.jboss.osgi.framework.plugins.impl.AbstractServicePluginImpl;
+import org.jboss.osgi.framework.resolver.BundleResolver;
import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/StartLevelImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/facade/service/StartLevelImpl.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/StartLevelImpl.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,14 +19,14 @@
* Software 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.service;
+package org.jboss.osgi.framework.service;
//$Id$
import org.jboss.logging.Logger;
-import org.jboss.osgi.plugins.facade.api.StartLevelServicePlugin;
-import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
-import org.jboss.osgi.plugins.facade.plugins.AbstractServicePluginImpl;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.StartLevelServicePlugin;
+import org.jboss.osgi.framework.plugins.impl.AbstractServicePluginImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.startlevel.StartLevel;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml)
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,70 +0,0 @@
-/*
-* 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;
- }
-
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerHandler.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.service.ds;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.framework.metadata.impl.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;
+ }
+
+}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,54 +0,0 @@
-/*
-* 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.plugins.metadata.spi.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);
- }
-
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ListenerInterceptor.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ListenerInterceptor.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.service.ds;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.framework.metadata.ListenerMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractListenerMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractReferenceMetaData;
+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);
+ }
+
+}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBinding.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBinding.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBinding.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.deployment.xml;
+package org.jboss.osgi.framework.service.ds;
import javax.xml.namespace.QName;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBindingHelper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaBindingHelper.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaBindingHelper.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.deployment.xml;
+package org.jboss.osgi.framework.service.ds;
import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaInitializer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/OSGiSchemaInitializer.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/OSGiSchemaInitializer.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.deployment.xml;
+package org.jboss.osgi.framework.service.ds;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer;
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,89 +0,0 @@
-/*
-* 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.plugins.metadata.spi.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; // tdo
- 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;
- }
-
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ReferenceHandler.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ReferenceHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.service.ds;
+
+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.framework.metadata.DependencyMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractDependencyMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractReferenceMetaData;
+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; // tdo
+ 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;
+ }
+
+}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -1,86 +0,0 @@
-/*
-* 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.plugins.metadata.spi.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; // tdo
- 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;
- }
-
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java (from rev 94256, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/deployment/xml/ServiceHandler.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/service/ds/ServiceHandler.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -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.framework.service.ds;
+
+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.framework.metadata.DependencyMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractDependencyMetaData;
+import org.jboss.osgi.framework.metadata.impl.AbstractServiceMetaData;
+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; // tdo
+ 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;
+ }
+
+}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/util)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/util/CaseInsensitiveDictionary.java 2009-10-02 06:06:25 UTC (rev 94254)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.plugins.util;
+package org.jboss.osgi.framework.util;
import java.util.Collections;
import java.util.Dictionary;
Copied: projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/FrameworkUtil.java (from rev 94254, projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/plugins/FrameworkUtil.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/FrameworkUtil.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/branches/tdiesler/src/main/java/org/jboss/osgi/framework/util/FrameworkUtil.java 2009-10-02 07:46:17 UTC (rev 94257)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.util;
+
+import org.jboss.osgi.framework.filter.FilterImpl;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+
+/**
+ * FrameworkUtil.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class FrameworkUtil
+{
+ public static Filter createFilter(String filter) throws InvalidSyntaxException
+ {
+ return new FilterImpl(filter);
+ }
+}
More information about the jboss-cvs-commits
mailing list