Package org.apache.aries.application.modelling

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


    this.content = content;
    IDirectory dir = content.isDirectory() ? content.convert() : content.convertNested();
    manifest = computeManifest(dir);
    // TODO Could use ModelledResourceManager.getServiceElements instead.
    // Only the service dependency info is being used right now.
    ModelledResource resource = getModelledResourceManager().getModelledResource(dir);
    computeRequirements(resource);
    computeCapabilities(resource);
  }
View Full Code Here


      throw new SubsystemException(e);
    }
  }
 
  private List<Capability> computeServiceCapabilities() {
    ModelledResource resource = getModelledResource();
    Collection<? extends ExportedService> services = resource.getExportedServices();
    if (services.isEmpty())
      return Collections.emptyList();
    List<Capability> result = new ArrayList<Capability>(services.size());
    for (ExportedService service : services)
      result.add(new BasicCapability.Builder()
View Full Code Here

          .build());
    return result;
  }
 
  private List<Requirement> computeServiceRequirements() {
    ModelledResource resource = getModelledResource();
    Collection<? extends ImportedService> services = resource.getImportedServices();
    if (services.isEmpty())
      return Collections.emptyList();
    List<Requirement> result = new ArrayList<Requirement>(services.size());
    for (ImportedService service : services) {
      StringBuilder builder = new StringBuilder("(&(")
View Full Code Here

    }
    return result;
  }

  private ModelledResource getModelledResource() {
    ModelledResource result = resource;
    if (result == null) {
      synchronized (this) {
        result = resource;
        if (result == null)
          resource = result = computeModelledResource();
View Full Code Here

    _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);
    }
View Full Code Here

        for (Resource r : requiredResources) {
          NameValueMap<String, String> attribs = new NameValueMap<String, String>();
          attribs.put(Constants.VERSION_ATTRIBUTE, "[" + r.getVersion() + ',' + r.getVersion()
              + "]");
          ModelledResource modelledResourceForThisMatch = null;
          // OBR may give us back the global capabilities. Typically these do not have a bundle symbolic name - they're a
          // list of packages available in the target runtime environment. If the resource has no symbolic name, we can ignore it
          if (r.getSymbolicName() != null) {
            try {
              modelledResourceForThisMatch = new ModelledBundleResource (r, modellingManager, modellingHelper);
View Full Code Here

                  .attribute(EXPORT_PACKAGE, "a.pack.age")
              .end().writeOut(fout);
      fout.close();     
     
      ModelledResourceManager mrm = context().getService(ModelledResourceManager.class);
      ModelledResource aBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("a.bundle.jar")));
      ModelledResource bBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("b.bundle.jar")));
     
      AriesApplicationResolver resolver = context().getService(AriesApplicationResolver.class);
      return resolver.resolveInIsolation("test.app", "1.0.0",
              Arrays.asList(aBundle, bBundle),
              Arrays.<Content>asList(ContentFactory.parseContent("a.bundle", "1.0.0"), ContentFactory.parseContent("b.bundle", "1.0.0")));
View Full Code Here

    attrs.putValue("Bundle-ManifestVersion", "2");
    attrs.putValue("Bundle-Version", "2.0.0");
    attrs.putValue("Bundle-SymbolicName", "org.apache.aries.isolated.sample");
    attrs.putValue("Manifest-Version", "1");

    ModelledResource res = modellingManager.getModelledResource(
        new File("sample_2.0.0.jar").toURI().toString(),
        attrs,
        Collections.EMPTY_LIST, Collections.EMPTY_LIST);

    repoGen.generateRepository("repo.xml", Arrays.asList(res), new FileOutputStream("repo.xml"));
View Full Code Here

 
 

  public static ExportedPackage createExportedPackage (String bundleName, String bundleVersion,
      String[] exportedPackages, String[] importedPackages ) throws InvalidAttributeException {
    ModelledResource mb = createModelledResource(bundleName, bundleVersion,
        Arrays.asList(importedPackages) , Arrays.asList(exportedPackages));
   
   
    return mb.getExportedPackages().iterator().next();
  }
View Full Code Here

          } else {

            for (Resource r : requiredResources) {
              Map<String, String> attribs = new HashMap<String, String>();
              attribs.put(Constants.VERSION_ATTRIBUTE, "[" + r.getVersion() + ',' + r.getVersion() + "]");
              ModelledResource modelledResourceForThisMatch = null;
              // OBR may give us back the global capabilities. Typically these do not have a bundle symbolic name - they're a
              // list of packages available in the target runtime environment. If the resource has no symbolic name, we can ignore it
              if (r.getSymbolicName() != null) {
                try {
                  modelledResourceForThisMatch = new ModelledBundleResource (r, modellingManager, modellingHelper);
View Full Code Here

TOP

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

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.