protected DataStore getDataStore() {
   FabricService service = getFabricService();
   if (service != null) {
     return service.getDataStore();
   }
   return null;
 }
Example #2
0
 protected Profile getProcessProfile(ProcessRequirements requirements, boolean includeController) {
   Container container = fabricService.getCurrentContainer();
   Profile processProfile =
       new ProfileOverlayImpl(
           new ProcessProfile(container, requirements, fabricService, includeController),
           true,
           fabricService.getDataStore(),
           fabricService.getEnvironment());
   return processProfile;
 }
    protected void recompile() {
        LOG.debug("Looking for XSDs to recompile");

        Set<String> urls = new TreeSet<String>();
        FabricService fabric = getFabricService();
        Container container = fabric.getCurrentContainer();
        String version = container.getVersion().getId();
        List<Profile> profiles = Containers.overlayProfiles(container);
        List<String> profileIds = Profiles.profileIds(profiles);
        Collection<String> names = fabric.getDataStore().listFiles(version, profileIds, schemaPath);
        for (String name : names) {
            if (name.endsWith(".xsd")) {
                String prefix = schemaPath;
                if (Strings.isNotBlank(prefix)) {
                    prefix += "/";
                }
                urls.add("profile:" + prefix + name);
            }
        }

        LOG.info("Recompiling XSDs at URLs: " + urls);
        startedFlag.set(false);

        ClassLoader classLoader = AriesFrameworkUtil.getClassLoader(bundleContext.getBundle());
        if (classLoader == null) {
            classLoader = getClass().getClassLoader();
        }
        DynamicXJC xjc = new DynamicXJC(classLoader);
        xjc.setSchemaUrls(new ArrayList<String>(urls));
        compileResults = xjc.compileSchemas();
        if (handler != null) {
            handler.onCompileResults(compileResults);
        }
        if (introspector != null) {
            introspector.setClassLoaderProvider("dynamic.jaxb", new ClassLoaderProvider() {
                @Override
                public ClassLoader getClassLoader() {
                    return compileResults.getClassLoader();
                }
            });
        }
    }