コード例 #1
0
ファイル: AquaModule.java プロジェクト: mhus/mhus-inka
  @Override
  public void start(BundleContext bundleContext) throws Exception {
    context = bundleContext;

    // URL x = context.getBundle().getEntry("config.xml");
    // InputStream is = x.openStream();

    ServiceReference reference = context.getServiceReference(IAqua.class.getName());
    aqua = (IAqua) context.getService(reference);

    FileInputStream is = new FileInputStream(new File(getBaseDir(), "config.xml"));
    config = new XmlConfig(MXml.loadXml(is).getDocumentElement());
    config.setString("_path", getBaseDir().getAbsolutePath());
    is.close();

    // init directories to publish
    IConfig cp = aqua.getConfig().getConfig("deploy");
    contentDir = cp.getExtracted("content") + "/" + getId();
    templateDir = cp.getExtracted("templates") + "/" + getId();

    getConfiguration().setProperty("_contentdir", contentDir);
    getConfiguration().setProperty("_templatedir", templateDir);

    // publish
    publish();

    // load resources
    loadResources();

    jmx = new JmxAquaModule(this);
    Activator.getAqua().getJmxManager().register(jmx);
  }