Package org.apache.aries.application.modelling

Examples of org.apache.aries.application.modelling.ParsedServiceElements


  public ParsedServiceElements parseAllServiceElements(InputStream blueprintToParse) throws Exception {
    _logger.debug(LOG_ENTRY, "parseAllServiceElements", new Object[]{blueprintToParse});
    ComponentDefinitionRegistry cdr = _parserService.parse (blueprintToParse, _bundleContext.getBundle());
    Collection<ExportedService> services = parseCDRForServices(cdr, false);
    Collection<ImportedService> references = parseCDRForReferences (cdr);
    ParsedServiceElements result = _modellingManager.getParsedServiceElements(services, references);
    _logger.debug(LOG_EXIT, "parseAllServiceElements", new Object[]{result});
    return result;
  }
View Full Code Here


        URL url = bpFile.toURL();
        URLConnection conn = url.openConnection();
        is = conn.getInputStream();
       
        try {
          ParsedServiceElements pse = getParserProxy().parseAllServiceElements(is);
          services.addAll(pse.getServices());
          references.addAll(pse.getReferences());

        } finally {
          if (is != null) {
            is.close();
          }
        }
      }
    } catch (URISyntaxException e) {
      ModellerException m = new ModellerException(e);
      _logger.debug(LOG_EXIT, "getServiceElements", m);
      throw m;
    } catch (IOException e) {
      ModellerException m = new ModellerException(e);
      _logger.debug(LOG_EXIT, "getServiceElements", m);
      throw m;
    } catch (Exception e) {
      ModellerException m = new ModellerException(e);
      _logger.debug(LOG_EXIT, "getServiceElements", m);
      throw m;
    }
    ParsedServiceElements result = _modellingManager.getParsedServiceElements(services, references);
    _logger.debug(LOG_EXIT, "getServiceElements", result);
    return result;
  }
View Full Code Here

  }

  @Override
  public ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException{
    _logger.debug(LOG_ENTRY, "getModelledResource", new Object[]{uri, bundle});
    ParsedServiceElements pse = getServiceElements(bundle);

    BundleManifest bm = BundleManifest.fromBundle(new File(bundle.toString()));
    Attributes attributes = bm.getRawAttributes();
    ModelledResource mbi;
    try {
      mbi = _modellingManager.getModelledResource(uri, attributes, pse.getReferences(), pse.getServices());
    } catch (InvalidAttributeException iae) {
      throw new ModellerException(iae);
    }
    _logger.debug(LOG_EXIT, "getModelledResource", mbi);
    return mbi;
View Full Code Here

    public ParsedServiceElements parseAllServiceElements(InputStream blueprintToParse) throws Exception {
      _logger.debug(LOG_ENTRY, "parseAllServiceElements", new Object[]{blueprintToParse});
      ComponentDefinitionRegistry cdr = parseCDR (blueprintToParse);
      Collection<ExportedService> services = parseCDRForServices(cdr, false);
      Collection<ImportedService> references = parseCDRForReferences (cdr);
      ParsedServiceElements result = _modellingManager.getParsedServiceElements(services, references);
      _logger.debug(LOG_EXIT, "parseAllServiceElements", new Object[]{result});
      return result;
    }
View Full Code Here

     
      Set<ExportedService> services = new HashSet<ExportedService>();
      Set<ImportedService> references = new HashSet<ImportedService>();
   
      try {
          ParsedServiceElements pse = getBlueprintServiceElements(bundleMf,
                      findBlueprints(bundleMf, archive));
          services.addAll(pse.getServices());
          references.addAll(pse.getReferences());
          for (ServiceModeller sm : modellingPlugins) {
            pse = sm.modelServices(bundleMf, archive);
            services.addAll(pse.getServices());
            references.addAll(pse.getReferences());
          }
          return new ParsedServiceElementsImpl(services, references);
      } catch (Exception e) {
          throw new ModellerException(e);
      }
View Full Code Here

    Set<ExportedService> services = new HashSet<ExportedService>();
    Set<ImportedService> references = new HashSet<ImportedService>();
    try {
      for (InputStream is : blueprints) {
        try {
          ParsedServiceElements pse = getParserProxy().parseAllServiceElements(is);
          services.addAll(pse.getServices());
          references.addAll(pse.getReferences());
        } finally {
          IOUtils.close(is);
        }
      }
    } catch (Exception e) {
      ModellerException m = new ModellerException(e);
      _logger.debug(LOG_EXIT, "getServiceElements", m);
      throw m;
    }
    ParsedServiceElements result = _modellingManager.getParsedServiceElements(services, references);
    _logger.debug(LOG_EXIT, "getServiceElements", result);
    return result;
  }
View Full Code Here

  public ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException{
    _logger.debug(LOG_ENTRY, "getModelledResource", new Object[]{uri, bundle});

    if (bundle != null) {
        BundleManifest bm = BundleManifest.fromBundle(bundle);
        ParsedServiceElements pse = getServiceElements(bm, bundle);
        return model(uri, bm, pse);
    } else {
      // The bundle does not exist
      ModellerException me = new ModellerException(MessageUtil.getMessage("INVALID_BUNDLE_LOCATION", bundle));
      _logger.debug(LOG_EXIT, "getModelledResource", me);
View Full Code Here

   
    List<WrappedServiceMetadata> services = new ArrayList<WrappedServiceMetadata>();
    List<WrappedReferenceMetadata> references = new ArrayList<WrappedReferenceMetadata>();
   
    FileInputStream fis = new FileInputStream (bpXml);
    ParsedServiceElements bpelem = _parserProxy.parseAllServiceElements(fis);
    services.addAll(bpelem.getServices());
    references.addAll(bpelem.getReferences());
   
    fis = new FileInputStream (bp2Xml);
    bpelem = _parserProxy.parseAllServiceElements(fis);
    services.addAll(bpelem.getServices());
    references.addAll(bpelem.getReferences());
   
    // We expect:
    // bp.xml: 3 services and 2 references
    // bp2.xml: 3 services and a reference list
    //
View Full Code Here

  @Test
  public void checkMultiValues() throws Exception {
    File bpXml = new File ("../src/test/resources", "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml");
    List<WrappedServiceMetadata> services = new ArrayList<WrappedServiceMetadata>();
    FileInputStream fis = new FileInputStream (bpXml);
    ParsedServiceElements bpelem = _parserProxy.parseAllServiceElements(fis);
    services.addAll(bpelem.getServices());
   
    assertEquals ("Multi valued service not parsed correctly", services.size(), 1);
   
    WrappedServiceMetadata wsm = services.get(0);
    Map<String, Object> props = wsm.getServiceProperties();
View Full Code Here

TOP

Related Classes of org.apache.aries.application.modelling.ParsedServiceElements

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.