Package org.objectweb.fractal.api

Examples of org.objectweb.fractal.api.Component


            .getFcInterface("mapper");
  }

  protected CacheAttributeController getCacheAttributeController(EntityManagerFactory _emf) throws Exception {
        Interface fcemf = (Interface) ((AbstractSpeedo) _emf).getDelegate();
    Component c = getSubComponent(
            ((Interface)fcemf).getFcItfOwner(),
            "tpm.cache-manager.cache-manager");
    return (CacheAttributeController) Fractal.getAttributeController(c);
  }
View Full Code Here


  private Component getSubComponent(Component parent,
                    String path) throws Exception {
    //System.out.println("path: " + path);

    StringTokenizer st = new StringTokenizer(path, ".", false);
    Component res = parent;
    while(st.hasMoreTokens()) {
      String commponenentname = st.nextToken();
      Component[] children = Fractal.getContentController(res)
          .getFcSubComponents();
      int i = 0;
View Full Code Here

  public Component getSubComponent(Component parent,
      String path, String s) throws Exception {
    //System.out.println("path: " + path);
    StringTokenizer st = new StringTokenizer(path, ".", false);
    Component res = parent;
    while(st.hasMoreTokens()) {
      String commponenentname = st.nextToken();
      Component[] children = Fractal.getContentController(res)
      .getFcSubComponents();
      int i = 0;
View Full Code Here

       
        try {
            // Gets a PM from the pool
            Object pr = managedPM.getResource(null);
      logger.log(BasicLevel.DEBUG, "get a persistenceManager from the pool");
            Component ci = ((Interface) pr).getFcItfOwner();
            JDOPOManagerItf pm = (JDOPOManagerItf) ci.getFcInterface("po-manager");
            pm.open(cs);
            bindPM2Thread(pm);
            pm.addUse();
            return pm;
        } catch (Exception e) {
View Full Code Here

  public Object getConcurrencyManagerComponent() throws Exception {
    return getSubComponent(speedo, "tpm.concurrency-manager");
  }
 
  public DependencyGraph getDependencyGraph() throws Exception {
      Component cmC = (Component) getConcurrencyManagerComponent();
      Object dg = Fractal.getBindingController(cmC).lookupFc("dependency-graph");
      return (DependencyGraph) dg;
  }
View Full Code Here

      Object dg = Fractal.getBindingController(cmC).lookupFc("dependency-graph");
      return (DependencyGraph) dg;
  }
 
  public Collection getMemoryCacheEntries() throws Exception {
      Component cm = getSubComponent(speedo, MEMORY_CACHE_PATH);
    Component cmC = getSubComponent(cm, "cache-manager");
    CacheAttributeController cacheAttr = (CacheAttributeController)
      Fractal.getAttributeController(cmC);
    return cacheAttr.getCurrentEntryIdentifiers();
  }
View Full Code Here

      //Choose the fractal template corresponding to the personality
            templateName = getPersonality()
              .getPersonalityClassName("org.objectweb.speedo", templateName);
           
      //instanciate the Speedo component
            Component speedoTemplate = null;
      try {
        speedoTemplate = (Component)getADLFactory().newComponent(
                  templateName,
                  Collections.singletonMap("template", "true"));
        speedo = Fractal.getFactory(speedoTemplate).newFcInstance();
View Full Code Here

    }
    if (!conf) {
        return;
    }
      logger.log(BasicLevel.INFO, sb.toString());
    Component cmC = getSubComponent(cm, "cache-manager");
    CacheAttributeController cacheAttr = (CacheAttributeController)
      Fractal.getAttributeController(cmC);
    if (cacheSize > -2) {
      cacheAttr.setMaxObjects(cacheSize);
    }
    if (autoCleanSize != null) {
      cacheAttr.setAutoCleanSize(autoCleanSize);
    }
    if (autoCleanThreshold != null) {
      cacheAttr.setAutoCleanThreshold(autoCleanThreshold);
    }
    if (policy != null) {
      String tempName = null;
      if (CACHE_REPLCAEMENT_LRU.equalsIgnoreCase(policy)) {
      } else if (CACHE_REPLCAEMENT_MRU.equalsIgnoreCase(policy)) {
        tempName = "org.objectweb.perseus.cache.replacement.lib.MRUReplacementManager";
      } else if (CACHE_REPLCAEMENT_FIFO.equalsIgnoreCase(policy)) {
        tempName = "org.objectweb.perseus.cache.replacement.lib.FIFOReplacementManager";
      } else {
        logger.log(BasicLevel.ERROR, new SpeedoException(
            "Unmanaged cache replacement policy: " + policy));
      }
      if (tempName != null) {
        //unbind the rm from the composite
        Fractal.getBindingController(cm).unbindFc("replacement-manager");
        //unbind the rm from the primitive cm
        Fractal.getBindingController(cmC).unbindFc("replacement-manager");
        //unbind the primitive cm from the old rm
        Fractal.getBindingController(
            getSubComponent(cm, "replacement-manager"))
            .unbindFc("unbind-manager");

        //remove the old rm from the composite
        Fractal.getContentController(cm).removeFcSubComponent(
            getSubComponent(cm, "replacement-manager"));

        //instanciate the new component
        Component new_rm = (Component)getADLFactory().newComponent(tempName, null);
        Fractal.getNameController(new_rm).setFcName("replacement-manager");

        //Add the new rm in the composite
        Fractal.getContentController(cm).addFcSubComponent(new_rm);

        Object rm = new_rm.getFcInterface("replacement-manager");
        //bind the rm to the composite
        Fractal.getBindingController(cm).bindFc("replacement-manager", rm);
        //bind the rm to the primitive cm
        Fractal.getBindingController(cmC).bindFc("replacement-manager", rm);
        //bind the primitive cm to the new rm
View Full Code Here

          optimistic = false;
        }
        sb.append("mode=").append((optimistic ? LocaleHelper.getSpeedoRB().getString("optim")
            : LocaleHelper.getSpeedoRB().getString("pessim")));
    //fetch the composite TPM
    Component composite_tpm = getSubComponent(speedo, COMPOSITE_TPM_PATH);
    Component cm = getSubComponent(composite_tpm, "concurrency-manager");
      if (dbLocking) {
          tempName = DBDELEGATE_CONCURRENCY_TEMPLATE;
          sb.append(LocaleHelper.getSpeedoRB().getString("concdeleg"));
      } else {
          sb.append(LocaleHelper.getSpeedoRB().getString("concspeed"));
          if (!optimistic) {
              //Configure the pessimistic concurrency manager
           
            //policy= mutex | rw-fifo | rw-reader
            strval = getProperty(props,
                    TRANSACTION_LOCKING_PESSIMISTIC_POLICY,
                    TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO, true);
            PessimisticConcurrencyManagerAC pcmAC = null;
            if (!strval.equals(TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO)) {
                pcmAC = (PessimisticConcurrencyManagerAC)
                    Fractal.getAttributeController(cm);
                    strval = strval.toUpperCase();
                    if (!strval.startsWith("POLICY_")) {
                        strval = "POLICY_" + strval;
                    }
                pcmAC.setPolicy(strval);
                sb.append(LocaleHelper.getSpeedoRB().getString("lockpol")).append(strval);
            }

            //locking level = instance | field
            strval = getProperty(props,
                    TRANSACTION_LOCKING_LEVEL_ENABLETHIN,
                    "false", true);
            boolean b = BooleanHelper.parse(strval, false);
            if (b) {
              logger.log(BasicLevel.INFO, LocaleHelper.getSpeedoRB().getString("thinlock"));
                pcmAC = (PessimisticConcurrencyManagerAC)
                    Fractal.getAttributeController(cm);
                pcmAC.setThinkLockAllowed(true);
                sb.append(LocaleHelper.getSpeedoRB().getString("thlklvl"));
            }
          logger.log(BasicLevel.INFO, sb.toString());
              return;
          }
      tempName = OPTIMISTIC_CONCURRENCY_TEMPLATE;
      }
      //optimistic or dblocking
      logger.log(BasicLevel.INFO, sb.toString());

        ContentController tpmCC = Fractal.getContentController(composite_tpm);
    //fetch the primitive concurrency manager
    BindingController tpmBC = Fractal.getBindingController(
        getSubComponent(composite_tpm, "transactional-persistence-manager"));
    tpmBC.unbindFc("concurrency-manager");

    //Remove the old pessimistic concurrency manager
    BindingController cmBC = Fractal.getBindingController(cm);
        String[] bds = cmBC.listFc();
        for (int i = 0; i < bds.length; i++) {
            cmBC.unbindFc(bds[i]);
        }
    tpmCC.removeFcSubComponent(cm);


    //instanciate the new ConcurrencyManager
    cm = (Component)getADLFactory().newComponent(tempName, null);
    //Add the new concurrency manager into the composite
    tpmCC.addFcSubComponent(cm);
    //bind the server interface of the new concurrency manager
    cmBC = Fractal.getBindingController(cm);
    if (dbLocking) {
            cmBC.bindFc(PConcurrencyManager.STATE_MANAGER_BINDING,
                    tpmCC.getFcInternalInterface("state-manager"));
            cmBC.bindFc(PConcurrencyManager.STORAGE_MANAGER_BINDING,
                    tpmCC.getFcInternalInterface("storage-manager"));
        } else {//optimistic
      cmBC.bindFc(PConcurrencyManager.DEPENDENCY_GRAPH_BINDING,
        getSubComponent(composite_tpm, "dependency-graph")
        .getFcInterface("dependency-graph"));
    }

    //bind the client interface of the new ConcurrencyManager
    tpmBC.bindFc("concurrency-manager", cm.getFcInterface("concurrency-manager"));
  }
View Full Code Here

    StringBuffer sb = new StringBuffer(LocaleHelper.getSpeedoRB().getString("prefetch"));
    String strval = getProperty(props, PREFETCH, "", true);
    if (strval.length()>0) {
      prefetch = BooleanHelper.parse(strval, false);
    }
    Component qm = getSubComponent(speedo, QUERY_MANAGER);
    QueryManagerAttribute qma = ((QueryManagerAttribute) Fractal.getAttributeController(qm));
    if (!prefetch) {
      qma.setPrefetchActivatedOnQuery(false);
      qma.setPrefetchActivatedOnExtent(false);
      logger.log(BasicLevel.INFO, sb.append(LocaleHelper.getSpeedoRB().getString("NONE")).toString());
View Full Code Here

TOP

Related Classes of org.objectweb.fractal.api.Component

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.