Package org.osgi.framework

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


          break;
        }
      }

      if (result) {
        entries = wab.findEntries("/", "*.jar", true);
        while (entries != null && entries.hasMoreElements()) {
          String path = entries.nextElement().getPath();
          if (!path.contains("WEB-INF/lib")) {
            // TODO: Check if this jar is in WAB's Bundle-ClassPath
            // header.
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

    public void bundleChanged(BundleEvent bundleEvent) {
            Bundle bundle = bundleEvent.getBundle();
            if (bundleEvent.getType() == BundleEvent.RESOLVED) {
                try {
                    List<URL> urls = new ArrayList<URL>();
                    Enumeration featuresUrlEnumeration = bundle.findEntries("/META-INF/" + FEATURE_PATH + "/", "*.xml", false);
                    while (featuresUrlEnumeration != null && featuresUrlEnumeration.hasMoreElements()) {
                        URL url = (URL) featuresUrlEnumeration.nextElement();
                        try {
                            featuresService.addRepository(url.toURI());
                            URI needRemovedRepo = null;
View Full Code Here

    * registry. It adds a property to the service which advertise all the functions found in the
    * local resources.
    */
   public void start() {
      Bundle bundle = bundleContext.getBundle();
      Enumeration<?> entries = bundle.findEntries("/functions/", "*.*", false);
      StringBuilder sb = new StringBuilder();
      while (entries.hasMoreElements()) {
         URL url = (URL) entries.nextElement();
         String function = url.getFile();
         sb.append(function);
View Full Code Here

    public void bundleChanged(BundleEvent bundleEvent) {
            Bundle bundle = bundleEvent.getBundle();
            if (bundleEvent.getType() == BundleEvent.RESOLVED) {
                try {
                    List<URL> urls = new ArrayList<URL>();
                    Enumeration featuresUrlEnumeration = bundle.findEntries("/META-INF/" + FEATURE_PATH + "/", "*.xml", false);
                    while (featuresUrlEnumeration != null && featuresUrlEnumeration.hasMoreElements()) {
                        URL url = (URL) featuresUrlEnumeration.nextElement();
                        try {
                            featuresService.addRepository(url.toURI());
                            for (Repository repo : featuresService.listRepositories()) {
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

        EasyMock.verify(bc);
    }
   
    public void testGetDecoratorElements() {
        Bundle b = EasyMock.createMock(Bundle.class);
        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
            Collections.enumeration(Arrays.asList(getClass().getResource("/test-resources/sd.xml")))).anyTimes();
        EasyMock.replay(b);

        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
        assertEquals(1, elements.size());
View Full Code Here

        assertEquals("http://cxf.apache.org/xmlns/service-decoration/1.0.0", elements.get(0).getNamespaceURI());
    }

    public void testGetDecoratorElements2() {
        Bundle b = EasyMock.createMock(Bundle.class);
        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(null).anyTimes();
        EasyMock.replay(b);

        List<Element> elements = ServiceDecoratorImpl.getDecorationElements(b);
        assertEquals(0, elements.size());
    }
View Full Code Here

        final Map<String, Object> serviceProps = new HashMap<String, Object>();
        serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.acme.foo.Bar"});
        serviceProps.put("test.prop", "xyz");
       
        Bundle b = EasyMock.createMock(Bundle.class);
        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
            Collections.enumeration(Arrays.asList(res))).anyTimes();
        EasyMock.replay(b);

        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(bc);
View Full Code Here

        assertEquals(expected, actual);
    }

    private Map<String, Object> testDecorate(final Map<String, Object> serviceProps, URL ... resources) {
        Bundle b = EasyMock.createMock(Bundle.class);
        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).andReturn(
            Collections.enumeration(Arrays.asList(resources))).anyTimes();
        EasyMock.replay(b);

        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(bc);
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.