Ejemplo n.º 1
0
 /** @see Contextualizable#contextualize(Context) */
 public void contextualize(Context context) throws ContextException {
   this.context = (DefaultContext) context;
   this.handler = (ConfigHandler) context.get(Constants.CONFIGHANDLER);
   this.tree = (KeysTree) context.get(Constants.KEYS_TREE);
   this.mainFrame = (KeysAdmin) context.get(Constants.MAIN);
   this.menuBar = (KeysMenuBar) context.get(Constants.MENUBAR);
 }
Ejemplo n.º 2
0
  public void testContextManager() throws Exception {
    final Context managerContext = m_manager.getContainerManagerContext();
    assertNotNull(managerContext);

    final ServiceManager serviceManager = (ServiceManager) managerContext.get(SERVICE_MANAGER);
    assertNotNull(serviceManager);

    final InstrumentManager instrumentManager =
        (InstrumentManager) serviceManager.lookup(InstrumentManager.ROLE);
    assertNotNull(instrumentManager);
    assertSame(m_instrManager, instrumentManager);
  }
Ejemplo n.º 3
0
  /**
   * Creation of a new HelloComponent instance using a container supplied logging channel and
   * context. The context supplied by the container holds the standard context entries for the home
   * and working directories, component name and partition.
   *
   * @avalon.entry key="urn:avalon:name"
   * @avalon.entry key="urn:avalon:partition"
   * @avalon.entry key="urn:avalon:home" type="java.io.File"
   * @avalon.entry key="urn:avalon:temp" type="java.io.File"
   */
  public HelloComponent(Logger logger, Context context) throws ContextException {
    m_logger = logger;

    m_home = (File) context.get("urn:avalon:home");
    m_temp = (File) context.get("urn:avalon:temp");
    m_name = (String) context.get("urn:avalon:name");
    m_partition = (String) context.get("urn:avalon:partition");

    StringBuffer buffer = new StringBuffer("standard context entries");
    buffer.append("\n  name: " + m_name);
    buffer.append("\n  home: " + m_home);
    buffer.append("\n  temp: " + m_temp);
    buffer.append("\n  partition: " + m_partition);

    m_logger.info(buffer.toString());
  }