Package org.osgi.framework

Examples of org.osgi.framework.Bundle.findEntries()


        //   all the embedded jars are at the top level, no recursion needed
        //   All the jars are not needed - only the uimaj core one
        //     any other jars will be provided by the launching project's class path
        //     uimaj-core provided because the launcher itself needs uimaj-core classes
        //  Found empirically that recursion is need to find the jar in development mode
        Enumeration<?> jarEnum = bundle.findEntries("/", "uimaj-core*.jar", Platform.inDevelopmentMode());
        while (jarEnum != null && jarEnum.hasMoreElements()) {
          URL element = (URL) jarEnum.nextElement();
          extendedClasspath.add(FileLocator.toFileURL(element).getFile());
        }
      }       
View Full Code Here


        String path = i == -1 ? "/" : icon.substring(0, i);
        String name = i == -1 ? icon : icon.substring(i + 1);

        Bundle b = Platform.getBundle(ext.getContributor().getName());

        Enumeration<URL> en = b.findEntries(path, name, false);
        Image image = null;

        if (en.hasMoreElements())
        {
            try
View Full Code Here

    {
        if (null != langMap)
            return langMap;
        final Map map = new HashMap();
        final Bundle bundle = bundleContext.getBundle();
        final Enumeration e = bundle.findEntries("res/flags", null, false); //$NON-NLS-1$
        while (e != null && e.hasMoreElements())
        {
            final URL img = (URL) e.nextElement();
            final String name = FilenameUtils.getBaseName(img.getFile());
            try
View Full Code Here

    {
        final URL[] descriptors = new URL[]
            { new URL( "file:foo.xml" ) };
        final Enumeration de = new Vector( Arrays.asList( descriptors ) ).elements();
        final Bundle bundle = ( Bundle ) EasyMock.createNiceMock( Bundle.class );
        EasyMock.expect( bundle.findEntries( "/some/location", "foo.xml", false ) ).andReturn( de );

        EasyMock.replay( new Object[]
            { bundle } );
        final URL[] urls = BundleComponentActivator.findDescriptors( bundle, "/some/location/foo.xml" );
        EasyMock.verify( new Object[]
View Full Code Here

                new URL( "file:foo1.xml" ),
                new URL( "file:foo2.xml" )
            };
        final Enumeration de = new Vector( Arrays.asList( urls ) ).elements();
        final Bundle bundle = (Bundle) EasyMock.createNiceMock( Bundle.class );
        EasyMock.expect( bundle.findEntries( path, filePattern, false ) ).andReturn( de );

        EasyMock.replay( new Object[]{ bundle } );
        final URL[] actualUrls = BundleComponentActivator.findDescriptors( bundle, location );
        EasyMock.verify( new Object[]{ bundle } );
View Full Code Here

     */
    public void test_findDescriptors_withWildcardLocation_nullEnum()
        throws MalformedURLException
    {
        final Bundle bundle = (Bundle) EasyMock.createNiceMock( Bundle.class );
        EasyMock.expect( bundle.findEntries( "/", "*.xml", false ) ).andReturn( null );

        EasyMock.replay( new Object[]{ bundle } );
        final URL[] actualUrls = BundleComponentActivator.findDescriptors( bundle, "*.xml" );
        EasyMock.verify( new Object[]{ bundle } );

View Full Code Here

     */
    public void test_findDescriptors_withWildcardLocation_emptyEnum()
        throws MalformedURLException
    {
        final Bundle bundle = (Bundle) EasyMock.createNiceMock( Bundle.class );
        EasyMock.expect( bundle.findEntries( "/", "*.xml", false ) ).andReturn( new Vector().elements() );

        EasyMock.replay( new Object[]{ bundle } );
        final URL[] actualUrls = BundleComponentActivator.findDescriptors( bundle, "*.xml" );
        EasyMock.verify( new Object[]{ bundle } );

View Full Code Here

        }

        @Override
        public List<URL> findEntries(String path, String filePattern, boolean recurse) {
            Bundle bundle = syscontext.getBundle(module.getModuleId());
            Enumeration<URL> paths = bundle.findEntries(path, filePattern, recurse);
            List<URL> result = new ArrayList<URL>();
            if (paths != null) {
                while (paths.hasMoreElements()) {
                    URL element = paths.nextElement();
                    result.add(element);
View Full Code Here

        myElementaryRefacs = new LinkedList<UserRefactoringInfo>();
        myCompositeRefacs = new LinkedList<UserRefactoringInfo>();

        final Bundle coreBundle = Platform.getBundle(Activator.CORE_ID);

        final Enumeration modules = coreBundle.findEntries("wrangler/ebin", "*.beam",
                false);

        // modules that origin from repository
        final List<OtpErlangObject> erlModules = new LinkedList<OtpErlangObject>();
        while (modules != null && modules.hasMoreElements()) {
View Full Code Here

        }

        ErlLogger.info("Refac modules found " + res.toString());

        // user's own refactoring
        final Enumeration userModules = coreBundle.findEntries(
                "wrangler/ebin/my_gen_refac", "*.beam", false);
        while (userModules != null && userModules.hasMoreElements()) {
            final String next = userModules.nextElement().toString();
            myElementaryRefacs.add(new UserRefactoringInfo(next.substring(
                    next.lastIndexOf('/') + 1, next.lastIndexOf('.'))));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.