Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.Instance


    /*
     * If the target of the wire is a non sharable instance, the released
     * instance can potentially be used by a pending requests.
     */
    if (link.getDestination() instanceof Instance) {
      Instance candidate = (Instance) link.getDestination();

      if ((!candidate.isShared()) && candidate.isSharable()) {
        resolveDynamicRequests(candidate);
      }
    }
  }
View Full Code Here


     */
    if (!(component instanceof Instance)) {
      return;
    }

    Instance candidate = (Instance) component;

    /*
     * Iterate over all pending future instances
     *
     * IMPORTANT Notice that this iteration is synchronized so we do not
     * have concurrent accesses over the list of future instances. However,
     * we must carefully handle the case of nested invocations of this
     * method (because instantiation of a dynamic instance may trigger other
     * pending instances)
     */

    synchronized (futureInstances) {

      List<FutureInstance> processed = new ArrayList<FutureInstance>();
      while (!futureInstances.isEmpty()) {

        /*
         * Take the first pending instance from the list, notice that we
         * remove it so that we are sure that there is only a single
         * invocation (in case of nested invocations) of this method
         * handling a given pending instance
         */
        FutureInstance futureInstance = futureInstances.remove(0);

        /*
         * Evaluate triggering conditions and instantiate if satisfied
         */
        if (futureInstance.getOwner().equals(candidate.getComposite())) {
          futureInstance.checkInstatiation();
        }

        processed.add(futureInstance);
      }
View Full Code Here

    .createInstance(null, null);

  Composite composite_a = (Composite) cta.createInstance(composite_root,
    null);

  Instance instanceApp1 = composite_a.getMainInst();

  S3GroupAImpl ga1 = (S3GroupAImpl) instanceApp1.getServiceObject();

  String messageTemplate = "In contentMngt->dependency if we adopt fail='exception' exception='A', the exception A should be throw in case the dependency is not satifiable. %s";

  boolean exception = false;
  boolean exceptionType = false;
View Full Code Here

  CompositeType cta = (CompositeType) waitForImplByName(null,
    "composite-a-fail-wait");

  Composite composite_a = (Composite) cta.createInstance(null, null);

  Instance instanceApp1 = composite_a.getMainInst();

  S3GroupAImpl ga1 = (S3GroupAImpl) instanceApp1.getServiceObject();

  ThreadWrapper wrapper = new ThreadWrapper(ga1);
  wrapper.setDaemon(true);
  wrapper.start();
View Full Code Here

    public void CompositeDependencyFailException_tc045() {

  Implementation group_a = waitForImplByName(null,
    "group-a-fail-exception");

  Instance instance_a = group_a.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instance_a.getServiceObject();

  String messageTemplate = "In dependency if we adopt fail='exception' exception='A', the exception A should be throw in case the dependency is not satifiable. %s";

  boolean exception = false;
  boolean exceptionType = false;
View Full Code Here

          org.osgi.framework.Constants.FRAMEWORK_SYSTEMPACKAGES));

  Implementation group_a = waitForImplByName(null,
    "group-a-fail-exception-native");

  Instance instance_a = group_a.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instance_a.getServiceObject();

  String messageTemplate = "In dependency if we adopt fail='exception' exception='A' (With A being an exception that already exists in java JRE), the exception A should be throw in case the dependency is not satifiable. But the exception thrown was not type (A)";

  boolean exceptionType = false;
View Full Code Here

    @Test
    public void CompositeDependencyFailWait_tc044() {

  Implementation cta = waitForImplByName(null, "group-a-fail-wait");

  Instance instanceApp1 = cta.createInstance(null, null);

  S3GroupAImpl ga1 = (S3GroupAImpl) instanceApp1.getServiceObject();

  ThreadWrapper wrapper = new ThreadWrapper(ga1);
  wrapper.setDaemon(true);
  wrapper.start();
View Full Code Here

  target.createInstance(null, null);

  Implementation implementation = waitForImplByName(null,
    "S07-implementation-13");

  Instance instance = implementation.createInstance(null, null);

  S07ImplementationImporter13 dependency = (S07ImplementationImporter13) instance
    .getServiceObject();

  // Force field injection
  dependency.getInjected();
View Full Code Here

    public void RelationSourceInstanceTargetSpecification_tc121() {

  Implementation implementation = waitForImplByName(null,
    "S07-implementation-19");

  Instance instance = implementation.createInstance(null, new HashMap() {
      {
    put("instance-property", "ok");
      }
  });// Collections.<String, String> emptyMap()

  S07ImplementationImporter19 dependency = (S07ImplementationImporter19) instance
    .getServiceObject();

  auxListProperties(dependency.getInjected());

  auxListInstances();

  ComponentImpl ci = (ComponentImpl) instance;

  Assert.assertTrue(
    String.format(
      "Only one link should have been created, but %s links were found",
      ci.getLocalLinks().size()),
    ci.getLocalLinks().size() == 1);

  for (Link link : ci.getLocalLinks()) {

      validateSourceTargetTypes(link.getSource(), link.getDestination(),
        Instance.class, Specification.class);

  }

  String messageTemplate = "Declaring a relation from source %s to target %s, instantiated object of the type %s which is not the targetKind expected.";

  Assert.assertTrue(
    String.format(messageTemplate, "Instance", "Specification",
      instance.getServiceObject()),
    dependency.getInjected().getProperty("instance-property") == null
      && dependency.getInjected().getProperty(
        "implementation-property") == null
      && dependency.getInjected().getProperty(
        "specification-property") != null);
View Full Code Here

    public void RelationSourceSpecificationTargetImplementation_tc104() {

  Implementation implementation = waitForImplByName(null,
    "S07-implementation-08");

  Instance instance = implementation.createInstance(null,
    Collections.<String, String> emptyMap());

  S07ImplementationImporter08 dependency = (S07ImplementationImporter08) instance
    .getServiceObject();

  // Force field injection
  dependency.getInjected();
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.Instance

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.