Package org.objectweb.fractal.api

Examples of org.objectweb.fractal.api.Component


   */
  private boolean configureMapper(Map props) throws Throwable {
    boolean useConnectionFactory;
    String mapperName = getProperty(props, MAPPER_NAME, "rdb.automatic", true);

    Component component = getSubComponent(speedo, PRIMITIVE_MAPPER_PATH);
    String strval = null;
    //Choose the mapper in according to the connection factory (JCA or JDBC)
    String cfName = getProperty(props, JDO_OPTION_CONNECTION_FACTORY_NAME, null, true);
    useConnectionFactory = cfName != null && cfName.length() > 0;
        Object o = Fractal.getAttributeController(component);
    MapperAttributes ma = (MapperAttributes) o;
    if (useConnectionFactory) {
      Object cf = null;
      //There is a connection factory
      try {
        InitialContext ic = new InitialContext();
        cf = ic.lookup(cfName);
      } catch (NamingException e) {
        throw new SpeedoException(
            "Problem to get the connection factory in JNDI ("
            + cfName + ")", e);
      }
      if (cf == null) {
        throw new SpeedoException(
            "No connection factory registered in JNDI with the name "
            + cfName);
      } else if (cf instanceof ConnectionSpecJDBC) {
        // Use the JDBC Mapper ==> nothing to do
      } else if (cf instanceof javax.sql.DataSource) {
        // Use the JDBC Mapper ==> nothing to do
      } else if (cf instanceof javax.resource.cci.ConnectionFactory) {
        throw new SpeedoException("JCA datasource no yet supported");
      } else {
        throw new SpeedoException("The connection factory registered "
            + "in JNDI is not supported by Speedo " + cfName + " => "
            + cf);
      }
      boolean ignoring = removeProps(props, new String[]{
              JDO_OPTION_CONNECTION_DRIVER_NAME_OLD,
              JDO_OPTION_CONNECTION_DRIVER_NAME_OLD2,
              JDO_OPTION_CONNECTION_DRIVER_NAME,
              JDO_OPTION_CONNECTION_URL,
              JDO_OPTION_CONNECTION_USER_NAME,
              JDO_OPTION_CONNECTION_PASSWORD});
      if (ignoring) {
          logger.log(BasicLevel.WARN,
              LocaleHelper.getSpeedoRB().getString("ignjdbcinfo"));
      }
      ignoring = removeProps(props, new String[]{
              CONNECTION_POOL_MIN,
              CONNECTION_POOL_MAX,
              CONNECTION_POOL_TTL,
              CONNECTION_POOL_TIMEOUT});
      if (ignoring) {
          logger.log(BasicLevel.WARN,
              LocaleHelper.getSpeedoRB().getString("ignconninfo"));
      }

      //Assign the connection factory to the mapper
      logger.log(BasicLevel.INFO, LocaleHelper.getSpeedoRB().getString("connfact")
          + LocaleHelper.getSpeedoRB().getString("jndinm") + cfName
          + LocaleHelper.getSpeedoRB().getString("factfound") + cf
          + LocaleHelper.getSpeedoRB().getString("mappernm") + mapperName);
      PMapper mapper = (PMapper) component.getFcInterface("mapper");
      mapper.setMapperName(mapperName);
      mapper.setConnectionFactory(cf);

    } else {
      JDBCMapperAttributes jdbcma = (JDBCMapperAttributes) ma;
View Full Code Here


            } catch (NumberFormatException e) {
                logger.log(BasicLevel.WARN, LocaleHelper.getSpeedoRB().getString("badhttp") + val);
                port = -1;
            }
      }
    Component component = getSubComponent(speedo, HTML_JMX_AGENT_PATH);
      if (port < 0) {
          //unbind the html sub component
          Fractal.getBindingController(component).unbindFc("adminAtt");
          // remove the html sub component from the agent component.
      Fractal.getContentController(
View Full Code Here

   * @return the build <code>JDOPOManager</code>
   */
  public Object createResource(Object o) throws PoolException {
    try {
      //instanciate the POManagerItf
      Component pmC = Fractal.getFactory(pmT).newFcInstance();
      POManagerItf pm = (POManagerItf) pmC.getFcInterface("po-manager");
      Fractal.getNameController(pmC).setFcName("po-manager");
      BindingController pmBC = Fractal.getBindingController(pmC);

      //instanciate the JDOTransactionItf
      Component tC = Fractal.getFactory(tT).newFcInstance();
      Fractal.getNameController(tC).setFcName("transaction");
      TransactionItf t = (TransactionItf) tC.getFcInterface("transaction");
      BindingController tBC = Fractal.getBindingController(tC);

      //Add the new components into the Speedo composite
      Fractal.getContentController(speedoComponent).addFcSubComponent(pmC);
      Fractal.getContentController(speedoComponent).addFcSubComponent(tC);
View Full Code Here

   * @param resource is the POManagerItf to destroy.
   */
  public void destroyResource(Object resource) {
    try {
      //fetch the PM component
      Component pmC = ((Interface) resource).getFcItfOwner();
      BindingController pmBC = Fractal.getBindingController(pmC);

      //fetch the Tx component
      Component tC = ((Interface)
        pmBC.lookupFc(AbstractPOManager.TRANSACTION_BINDING))
        .getFcItfOwner();
      BindingController tBC = Fractal.getBindingController(tC);

      //Stop compoenents
View Full Code Here

    public JMXConfigurator(Component speedo, Logger logger) throws Exception {
        this.speedo = speedo;
        this.logger = logger;
        //Fetch the MBean server
        Component agentC = FractalHelper.getSubComponent(
                speedo, AbstractSpeedo.JMX_AGENT_PATH + ".agent", logger);
        server = ((AdminAttributes)
                Fractal.getAttributeController(agentC)).getRawMBeanServer();
    }
View Full Code Here

        addLoggingMBeans();
        exposeMBeans();
    }
   
    public void exposeMBeans() throws Exception {
        Component agentC = FractalHelper.getSubComponent(
                speedo, AbstractSpeedo.JMX_AGENT_PATH + ".agent", logger);
        AdminAttributes aa = (AdminAttributes)
                Fractal.getAttributeController(agentC);
        aa.setItfPatterns(EXPOSED_ITFS);
    ((Admin) agentC.getFcInterface("admin")).expose();
    }
View Full Code Here

                getJormFactoryAttributes());
        server.registerMBean(p, new ObjectName("speedo:name=pmf"));
    }

    public void addQueryMBean() throws Exception {
        Component cache = FractalHelper.getSubComponent(
                speedo, AbstractSpeedo.QUERY_CACHE_PATH, logger);
        CacheAttributeController ca = (CacheAttributeController)
          Fractal.getAttributeController(
                FractalHelper.getSubComponent(cache, "cache-manager", logger));
        UnbindManager um = (UnbindManager) cache.getFcInterface("unbind-manager");
        CacheManager cm = (CacheManager) cache.getFcInterface("cache-manager");
        QueryManagerAttribute qma = (QueryManagerAttribute)
          Fractal.getAttributeController(
                FractalHelper.getSubComponent(
                        speedo, AbstractSpeedo.QUERY_MANAGER, logger));
        Query qm = new Query(ca, um, cm, qma);
View Full Code Here

        Query qm = new Query(ca, um, cm, qma);
        server.registerMBean(qm, new ObjectName("speedo:name=query"));
    }
   
    public void addCacheMBeans() throws Exception {
        Component cache = FractalHelper.getSubComponent(
                speedo, AbstractSpeedo.MEMORY_CACHE_PATH, logger);
        CacheAttributeController ca = (CacheAttributeController)
          Fractal.getAttributeController(
                FractalHelper.getSubComponent(cache, "cache-manager", logger));
        UnbindManager um = (UnbindManager) cache.getFcInterface("unbind-manager");
        CacheManager cm = (CacheManager) cache.getFcInterface("cache-manager");
        Cache c = new Cache(ca, um, cm, getPMF(), getJormFactory());
        server.registerMBean(c, new ObjectName("speedo:name=cache"));
    }
View Full Code Here

                    + Fractal.getNameController(parent).getFcName()
                    + ", path: " + path);
        }
        //run over the path
        final 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

            .getFcInterface("mapper");
  }

  protected CacheAttributeController getCacheAttributeController(PersistenceManagerFactory _pmf) throws Exception {
        Interface fcpmf = (Interface) ((AbstractSpeedo) _pmf).getDelegate();
    Component c = getSubComponent(
            ((Interface)fcpmf).getFcItfOwner(),
            "tpm.cache-manager.cache-manager");
    return (CacheAttributeController) Fractal.getAttributeController(c);
  }
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.