Package org.osgi.framework

Examples of org.osgi.framework.Version


            throw new IllegalStateException("Can not get bundle from stale deployment package.");
        }

        BundleInfo bundleInfo = (BundleInfo) m_nameToBundleInfo.get(symbolicName);
        if (bundleInfo != null) {
            Version version = bundleInfo.getVersion();

            Bundle[] bundles = m_bundleContext.getBundles();
            for (int i = 0; i < bundles.length; i++) {
                if (symbolicName.equals(bundles[i].getSymbolicName()) && version.equals(bundles[i].getVersion())) {
                    return bundles[i];
                }
            }
        }
        return null;
View Full Code Here


                info.addRequiredBundle(clone);
            }

            info.setSymbolicName(bb.getSymbolicName());

            Version version = VersionTable.getVersion(bb.getVersion());
            info.setVersion(version);

            ISigilBundle pb = ModelElementFactory.getInstance().newModelElement(
                ISigilBundle.class);
            pb.setBundleInfo(info);
View Full Code Here


    private final JSONObject toJSON( Resource resource, Bundle[] bundles, boolean details ) throws JSONException
    {
        final String symbolicName = resource.getSymbolicName();
        final Version version = resource.getVersion();
        String installed = "";
        for ( int i = 0; symbolicName != null && installed.length() == 0 && bundles != null && i < bundles.length; i++ )
        {
            final Version ver = bundles[i].getVersion();
            if ( symbolicName.equals(bundles[i].getSymbolicName()))
            {
                installed = ver.toString();
            }
        }
        JSONObject json = new JSONObject()
            .put( "id", resource.getId() ) // //$NON-NLS-1$
            .put( "presentationname", resource.getPresentationName() ) // //$NON-NLS-1$
View Full Code Here

            }
        }

        String packageName = pe.getPackageName();

        Version version = pe.getVersion();
        VersionRange versions = ModelHelper.getDefaultRange(version);

        IPackageImport pi = ModelElementFactory.getInstance().newModelElement(
            IPackageImport.class);
        pi.setPackageName(packageName);
View Full Code Here

    }

   
    public Version getVersion()
    {
        Version ver = null;

        // use 'version' attribute if present, fallback to getVersion if not       
        R4Attribute verAttr = getAttribute(verString);
       
        if (verAttr != null)
        {
            String sVer = verAttr.getValue().toString();
            ver = new Version(sVer);
        }
        else
        {
            Version v = pkg.getVersion();
            if (!v.equals(Version.emptyVersion))
            {
                ver = v;
            }
        }
       
View Full Code Here

        {
            sVer = verAttr.getValue().toString();
        }
        else
        {
            Version v = getVersion();
            if (v != null)
            {
                sVer = v.toString();
            }
        }
       
        if (sVer != null)
        {
View Full Code Here

        }

        if (element instanceof IPackageExport)
        {
            IPackageExport pe = (IPackageExport) element;
            Version rawVersion = pe.getRawVersion();
            return rawVersion != null ? pe.getPackageName() + " " + rawVersion
                : pe.getPackageName();
        }

        if (element instanceof IResource)
View Full Code Here


    private final JSONObject toJSON( Resource resource, Bundle[] bundles, boolean details ) throws JSONException
    {
        final String symbolicName = resource.getSymbolicName();
        final Version version = resource.getVersion();
        String installed = "";
        for ( int i = 0; symbolicName != null && installed.length() == 0 && bundles != null && i < bundles.length; i++ )
        {
            final Version ver = bundles[i].getVersion();
            if ( symbolicName.equals(bundles[i].getSymbolicName()))
            {
                installed = ver.toString();
            }
        }
        JSONObject json = new JSONObject()
            .put( "id", resource.getId() ) // //$NON-NLS-1$
            .put( "presentationname", resource.getPresentationName() ) // //$NON-NLS-1$
View Full Code Here

        mockBundle = mock(Bundle.class);

        //Setup Behaviors
        when(mockBundleContext.getBundle()).thenReturn(mockBundle);
        when(mockBundle.getSymbolicName()).thenReturn("main");
        when(mockBundle.getVersion()).thenReturn(new Version("1.0.0"));
        when(mockBundle.getHeaders()).thenReturn(new Hashtable<String, String>());

        httpServiceController = new HttpServiceController(mockBundleContext);
        dispatcherServlet = new DispatcherServlet(httpServiceController);
        jettyService = new JettyService(mockBundleContext, dispatcherServlet, mockEventDispatcher, httpServiceController);
View Full Code Here

        //Setup behaviors
        when(mockDeployment.getBundle()).thenReturn(mockBundle);
        when(mockBundle.getBundleContext()).thenReturn(mockBundleContext);
        when(mockBundle.getSymbolicName()).thenReturn("test");
        when(mockBundle.getVersion()).thenReturn(new Version("0.0.1"));

        Dictionary<String, String> headerProperties = new Hashtable<String, String>();
        headerProperties.put("Web-ContextPath", "test");
        when(mockBundle.getHeaders()).thenReturn(headerProperties);
        when(mockDeployment.getContextPath()).thenReturn("test");
View Full Code Here

TOP

Related Classes of org.osgi.framework.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.