private List <Service> ParseServices(OSGiProject osgiProject, JSONObject fieldServices) { if (fieldServices == null) { return(null); } foreach (JSONObject fieldService in fieldServices) { string serviceName = fieldService.GetField("interfaceName").str; JSONObject fieldInterface = fieldService.GetField("interface"); CompilationUnit serviceCompilationUnit = null; if (fieldInterface != null) { Vector3 compilationUnitIndex = _referenceResolver.ResolveCompilationUnitReference(fieldInterface); serviceCompilationUnit = osgiProject.GetCompilationUnit(compilationUnitIndex); serviceCompilationUnit.IsService = true; } Service service = new Service(serviceName, serviceCompilationUnit); osgiProject.Services.Add(service); } return(osgiProject.Services); }
private void ParseComponents(OSGiProject osgiProject, JSONObject fieldComponents, int bundleIndex) { if (fieldComponents == null) { return; } foreach (JSONObject fieldComponent in fieldComponents.list) { Vector3 implIndex = _referenceResolver. ResolveCompilationUnitReference(fieldComponent.GetField("implementation")); CompilationUnit resolvedCompilationUnit = osgiProject.GetCompilationUnit(implIndex); resolvedCompilationUnit.IsServiceComponent = true; ServiceComponent serviceComponent = new ServiceComponent(fieldComponent.GetField("name").str, resolvedCompilationUnit); ParseProvidedServices(osgiProject, serviceComponent, fieldComponent.GetField("providedServices")); ParseReferencedServices(osgiProject, serviceComponent, fieldComponent.GetField("referencedServices")); osgiProject.Bundles[bundleIndex].ServiceComponents.Add(serviceComponent); } }