org.objectweb.fractal.util.Fractal.getContentController()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.objectweb.fractal.util.Fractal.getContentController()方法的一些代码示例,展示了Fractal.getContentController()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fractal.getContentController()方法的具体详情如下:
包路径:org.objectweb.fractal.util.Fractal
类名称:Fractal
方法名:getContentController

Fractal.getContentController介绍

[英]Returns the ContentController interface of the given component.
[中]返回给定组件的ContentController接口。

代码示例

代码示例来源:origin: com.ebmwebsourcing.easycommons/easycommons-sca-impl

/**
 * A utility function allowing to get a component from any content
 * controller.
 * 
 * @param parentContentController
 *            parentContentController
 * @param name
 *            component name
 * @return the component, null if not found
 */
public List<Component> getComponents(final Component parent) {
  final List<Component> res = new ArrayList<Component>();
  try {
    final ContentController parentContentController = Fractal
        .getContentController(parent);
    // List content controller subcomponents
    for (final Component component : parentContentController
        .getFcSubComponents()) {
      res.add(component);
    }
  } catch (final NoSuchInterfaceException e1) {
    // do nothing, return null
  }
  return res;
}

代码示例来源:origin: com.ebmwebsourcing.easycommons/easycommons-sca-impl

public List<Component> getAllSubComponents(final Component parent) {
  final List<Component> res = new ArrayList<Component>();
  try {
    final ContentController parentContentController = Fractal
        .getContentController(parent);
    // List content controller subcomponents
    for (final Component component : parentContentController
        .getFcSubComponents()) {
      res.add(component);
      res.addAll(getComponents(component));
    }
  } catch (final NoSuchInterfaceException e1) {
    // do nothing, return null
  }
  return res;
}

代码示例来源:origin: org.objectweb.fractal.fractaljmx/fractal-jmx

private void exposeSub(Component ids[], int crtDepth) throws JMException {
  if (_depth >= 0 && crtDepth > _depth)
    return;
  for (int i = 0; i < ids.length; i++) {
    // register subcomponents
    try {
      ContentController cCtrl = Fractal.getContentController(ids[i]);
      exposeSub(cCtrl.getFcSubComponents(), crtDepth + 1);
    } catch (NoSuchInterfaceException ignored) {}
    // register component infos
    String[] names = getFullFCName(ids[i]);
    for (int j = 0; j < names.length; j++) {
      exposeFCinfos(ids[i], "/" + names[j] + '@' + Integer.toHexString(ids[i].hashCode()));
    }
  }
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

private Set<WebServiceInformationBean> getAllWebServiceInformationBean() {
  // get the top level component to be able to get all the components...
  Component root = FractalHelper.getRootComponent(this.component);
  try {
    return FractalWSHelper.getAllBeans(Fractal.getContentController(root));
  } catch (NoSuchInterfaceException e) {
    e.printStackTrace();
  }
  return null;
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

public static <T> List<T> getAll(Class<T> clazz,
      final ContentController parentContentController, String serviceName) {
    List<T> result = new ArrayList<T>();

    ContentController subContentController = null;

    for (Component component : parentContentController.getFcSubComponents()) {
      try {
        subContentController = Fractal.getContentController(component);
        if (subContentController.getFcSubComponents().length > 0) {
          result.addAll(getAll(clazz, subContentController, serviceName));
        }
      } catch (NoSuchInterfaceException e1) {
      }

      try {
        Object o = component.getFcInterface(serviceName);
        if (o != null) {
          try {
            result.add(clazz.cast(o));
          } catch (ClassCastException e) {
          }
        }
      } catch (NoSuchInterfaceException e) {
      }
    }
    return result;
  }
}

代码示例来源:origin: org.ow2.jasmine.jade/jade-fractal

/**
 * @param c
 * @param subcmp
 * @return
 * @deprecated
 */
private static Component search(Component c, String subcmp) {
  try {
    ContentController cc = Fractal.getContentController(c);
    Component[] sub = cc.getFcSubComponents();
    for (int i = 0; i < sub.length; i++) {
      try {
        if (Fractal.getNameController(sub[i]).getFcName().equals(
            subcmp))
          return sub[i];
      } catch (NoSuchInterfaceException e1) {
        // no name ctrler ignore it
      }
    }
  } catch (Exception e) {
    return null;
  }
  return null;
}

代码示例来源:origin: org.ow2.petals/petals-kernel

/**
 * Find the local JMX server in the petals component
 * 
 * @param petalsComposite
 *            the petals component
 * @return the local jmx server
 * @throws NoSuchInterfaceException
 * @throws ADLException
 */
public static final MBeanServer findLocalJMXServer(Component petalsComposite)
    throws NoSuchInterfaceException, ADLException {
  ContentController petalsContentController = Fractal.getContentController(petalsComposite);
  Component jmxService = FractalHelper.getRecursiveComponentByName(petalsContentController,
      FractalHelper.JMX_COMPONENT);
  MBeanServer jmxServer = ((JMXService) jmxService.getFcInterface("service"))
      .getLocalJMXServer();
  return jmxServer;
}

代码示例来源:origin: org.objectweb.petals/petals-kernel

/**
 * Find the local jmx server in the petals component
 *
 * @param petalsComposite
 *            the petals component
 * @return the local jmx server
 * @throws NoSuchInterfaceException
 * @throws ADLException
 */
public MBeanServer findLocalJMXServer(Component petalsComposite)
  throws NoSuchInterfaceException, ADLException {
  ContentController petalsContentController = Fractal
    .getContentController(petalsComposite);
  Component jmxService = fractalHelper.getComponentByName(
    petalsContentController, FractalHelper.JMX_COMPONENT);
  MBeanServer jmxServer = ((JMXService) jmxService
    .getFcInterface("service")).getLocalJMXServer();
  return jmxServer;
}

代码示例来源:origin: org.ow2.jasmine.jade/jade-fractal

/**
 * @param comp
 * @param name
 * @return
 * @deprecated
 */
private static Component subcomp(Component comp, String name) {
  try {
    ContentController cc = Fractal.getContentController(comp);
    for (Component sc : cc.getFcSubComponents()) {
      NameController nc = Fractal.getNameController(sc);
      if (name.equals(nc.getFcName())) {
        return sc;
      }
    }
  } catch (NoSuchInterfaceException e) {
    e.printStackTrace();
    return null;
  }
  return null;
}

代码示例来源:origin: org.ow2.petals/petals-kernel

/**
 * Initialize petals composite
 * 
 * @throws PetalsException
 * 
 */
private void initializePetalsComposite() throws PetalsException {
  try {
    // Class<Factory> petalsFactoryClass =
    // (Class<Factory>)PetalsServerImpl.class.getClassLoader().loadClass("Petals");
    // Factory petalsFactory = petalsFactoryClass.newInstance();
    // this.petalsComposite = petalsFactory.newFcInstance();
    this.petalsComposite = FractalHelper.createNewComponent(FractalHelper.PETALS_COMPOSITE);
    this.petalsContentController = Fractal.getContentController(this.petalsComposite);
  } catch (NoSuchInterfaceException e) {
    throw new PetalsException("Error creating PEtALS Fractal Composite", e);
  } catch (ADLException e) {
    throw new PetalsException("Error creating PEtALS Fractal Composite", e);
  }
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

/**
 * Initialize petals composite
 * 
 * @throws PetalsException
 * 
 */
private void initializePetalsComposite() throws PetalsException {
  try {
    // Class<Factory> petalsFactoryClass =
    // (Class<Factory>)PetalsServerImpl.class.getClassLoader().loadClass("Petals");
    // Factory petalsFactory = petalsFactoryClass.newInstance();
    // this.petalsComposite = petalsFactory.newFcInstance();
    this.petalsComposite = FractalHelper.createNewComponent(FractalHelper.PETALS_COMPOSITE);
    this.petalsContentController = Fractal.getContentController(this.petalsComposite);
  } catch (NoSuchInterfaceException e) {
    throw new PetalsException("Error creating PEtALS Fractal Composite", e);
  } catch (ADLException e) {
    throw new PetalsException("Error creating PEtALS Fractal Composite", e);
  }
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

public synchronized void load() {
  Component root = FractalHelper.getRootComponent(this.component);
  try {
    Set<WebServiceInformationBean> beans = FractalWSHelper.getAllBeans(Fractal
        .getContentController(root));
    if (webservices == null) {
      webservices = new HashSet<WebServiceInformationBean>();
    }
    webservices.addAll(beans);
  } catch (NoSuchInterfaceException e) {
    e.printStackTrace();
  }
  if (log.isDebugEnabled()) {
    int i = 0;
    log.debug("Found the following services in the framework :");
    for (WebServiceInformationBean bean : webservices) {
      log.debug((i++) + " : " + bean);
    }
  }
}

代码示例来源:origin: org.objectweb.fractal.cecilia.toolchain/task-component

public void bindFc(final InterfaceType clientItfType,
  final String clientItfName, final Object serverItf)
  throws NoSuchInterfaceException, IllegalBindingException,
  IllegalLifeCycleException {
 // first call super implementation.
 _super_bindFc(clientItfType, clientItfName, serverItf);
 final Interface innerItf = fcExportedInterfaces.get(clientItfType
   .getFcItfName());
 if (innerItf != null) {
  // the interface correspond to an exported collection interface.
  final Object internalItf = Fractal.getContentController(_this_weaveableC)
    .getFcInternalInterface(clientItfName);
  final String suffix = clientItfName.substring(clientItfType
    .getFcItfName().length());
  getBindingController(innerItf.getFcItfOwner()).bindFc(
    innerItf.getFcItfName() + suffix, internalItf);
 }
}

代码示例来源:origin: org.ow2.jasmine.jade/jade-fractal

/**
 * Remove the component from its parent component and then calls the
 * overriden method.
 */
public void undeploy() throws UndeploymentException {
  Component[] parents = _this_weaveableSC.getFcSuperComponents();
  if (parents.length > 0) {
    for (Component parent : parents) {
      try {
        ContentController cc = Fractal.getContentController(parent);
        cc.removeFcSubComponent((Component)_this_weaveableC.getFcInterface("component"));
      } catch (Exception e) {
        throw new ChainedUndeploymentException(e, _this_weaveableC,
            e.getMessage());
      }
    }
  }
  _super_undeploy();
}

代码示例来源:origin: org.ow2.petals/petals-kernel

ContentController parentContentController = Fractal.getContentController(composite);
    subContentController = Fractal.getContentController(component);
    if (subContentController.getFcSubComponents().length > 0) {
      stopComposite(component);

代码示例来源:origin: org.ow2.petals/petals-microkernel-api

/**
 * Log the component status (started or stopped) of a Fractal component.
 * 
 * @param component
 */
public static void getComponentState(final Component component, final String space, final StringBuilder sb) {
  final LifeCycleController componentLC = getLifeCycleController(component);
  final NameController componentNC = getNameController(component);
  sb.append(space + "- " + componentNC.getFcName() + " is " + componentLC.getFcState() + System.lineSeparator());
  ContentController componentCC = null;
  try {
    componentCC = Fractal.getContentController(component);
  } catch (final NoSuchInterfaceException e) {
    // No content controller (ie. no sub components)
  }
  if (componentCC != null) {
    final Component[] componentSubComponents = componentCC.getFcSubComponents();
    for (final Component componentSubComponent : componentSubComponents) {
      getComponentState(componentSubComponent, space + "\t", sb);
    }
  }
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

public <T> T get(Class<T> t, String componentName, String serviceName) {
    T result = null;
    try {
      SuperController sc = Fractal.getSuperController(this.component);
      Component parentcontainer = sc.getFcSuperComponents()[0];
      ContentController cc = Fractal.getContentController(parentcontainer);
      Component c = FractalHelper.getRecursiveComponentByName(cc, componentName);
      if (c != null) {
        String name = (serviceName != null) ? serviceName : "service";
        Object o = c.getFcInterface(name);
        if (o != null) {
          try {
            result = t.cast(o);
          } catch (ClassCastException e) {
            e.printStackTrace();
          }
        }
      } else {
        System.out.println("No such component : " + componentName);
      }
    } catch (NoSuchInterfaceException e) {
      e.printStackTrace();
    }
    return result;
  }
}

代码示例来源:origin: org.objectweb.petals/petals-kernel

/**
 * Initialize petals composite
 *
 * @throws PetalsException
 *
 */
private void initializePetalsComposite() throws PetalsException {
  try {
    petalsComposite = fractalHelper
      .createNewComponent(FractalHelper.PETALS_COMPOSITE);
    petalsContentController = Fractal
      .getContentController(petalsComposite);
  } catch (ADLException e) {
    e.printStackTrace();
    String msg = "Error creating petalsComposite.";
    throw new PetalsException(msg, e);
  } catch (NoSuchInterfaceException e) {
    System.out.println("NoSuchInterfaceException");
    e.printStackTrace();
    String msg = "Error creating petalsComposite.";
    throw new PetalsException(msg, e);
  }
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

public <T> T get(Class<T> t, String componentName, String serviceName) throws DSBException {
    T result = null;
    try {
      SuperController sc = Fractal.getSuperController(this.component);
      Component parentcontainer = sc.getFcSuperComponents()[0];
      ContentController cc = Fractal.getContentController(parentcontainer);
      Component c = FractalHelper.getRecursiveComponentByName(cc, componentName);
      if (c != null) {
        String name = (serviceName != null) ? serviceName : DEFAULT_SERVICE_NAME;
        Object o = c.getFcInterface(name);
        if (o != null) {
          try {
            result = t.cast(o);
          } catch (ClassCastException e) {
            throw new DSBException(e.getMessage());
          }
        }
      } else {
        throw new DSBException("No such component : " + componentName);
      }
    } catch (NoSuchInterfaceException e) {
      throw new DSBException(e.getMessage());
    }
    return result;
  }
}

代码示例来源:origin: org.ow2.petals/petals-kernel

public static final void registerMBeans(Component petalsComposite) throws Exception {
  ContentController contentController = Fractal.getContentController(petalsComposite);
  // unactivate the method invokation cache for the Fractal MBeans
  Introspector.CURRENCY_TIME_LIMIT = "-1";
  MBeanServer jmxServer = findLocalJMXServer(petalsComposite);
  // register AdminService
  registerComponent(contentController, FractalHelper.ADMIN_COMPONENT, jmxServer,
      AdminServiceMBean.class, DOMAIN + ":name=" + ADMIN_MBEAN + ",type=service");
  // register DeploymentService
  registerComponent(contentController, FractalHelper.DEPLOYMENT_COMPONENT, jmxServer,
      DeploymentServiceMBean.class, DOMAIN + ":name=" + DEPLOYMENT_MBEAN
          + ",type=service");
  // register InstallationService
  registerComponent(contentController, FractalHelper.INSTALLATION_COMPONENT, jmxServer,
      InstallationServiceMBean.class, DOMAIN + ":name=" + INSTALLATION_MBEAN
          + ",type=service");
  // register EndpointRegistry
  registerComponent(contentController, FractalHelper.ENDPOINT_COMPONENT, jmxServer,
      EndpointRegistryMBean.class, DOMAIN + ":name=" + ENDPOINT_MBEAN + ",type=service");
  // register Petals Admin
  registerComponent(contentController, FractalHelper.PETALSADMIN_COMPONENT, jmxServer,
      PetalsAdminServiceMBean.class, DOMAIN + ":name=" + PETALS_ADMIN + ",type=service");
  
  // register Petals Admin
  registerComponent(contentController, FractalHelper.ROUTER_MONITOR_COMPONENT, jmxServer,
      RouterMonitorMBean.class, DOMAIN + ":name=" + ROUTER_MONITOR + ",type=service");
  // register the Monolog
  jmxServer.registerMBean(Introspector.createMBean(new MonologFactoryMBeanImpl()),
      new ObjectName(DOMAIN + ":name=" + LOGGER_MBEAN + ",type=service"));
}

相关文章