From scm-return-49153-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Fri Jan 25 11:38:25 2013 Return-Path: X-Original-To: apmail-geronimo-scm-archive@www.apache.org Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 94812DD17 for ; Fri, 25 Jan 2013 11:38:25 +0000 (UTC) Received: (qmail 1133 invoked by uid 500); 25 Jan 2013 11:38:25 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 916 invoked by uid 500); 25 Jan 2013 11:38:22 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 880 invoked by uid 99); 25 Jan 2013 11:38:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2013 11:38:21 +0000 X-ASF-Spam-Status: No, hits=-1994.3 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE,MIME_HTML_ONLY X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2013 11:38:20 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id r0PBc0mx023117 for ; Fri, 25 Jan 2013 11:38:00 GMT Date: Fri, 25 Jan 2013 06:38:00 -0500 (EST) From: confluence@apache.org To: scm@geronimo.apache.org Message-ID: <16014783.26568.1359113880341.JavaMail.confluence@thor> Subject: =?UTF-8?Q?[CONF]_Apache_Geronimo_Knowledge_Base_>_=C2=BFEs_posible_?= =?UTF-8?Q?obtener_una_referencia_al_MBeanServer_desde_un_GBean=3F?= MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org

=C2=BFEs posible obtener una referencia al MBeanServer de= sde un GBean?

Page edited by Jarek Gawor


Changes (0)

=20 =20
=20 =20
...

Full Content

Si. Simplemente agrega una referencia de tipo MBeanServerReference a tu= GBeanInfo, e invoca a getMBeanServer() en la referencia para obte= ner al MBeanServer. Por ejemplo:

=
public class Example {
    public MEJB(AbstractName abstractNa=
me, MBeanServerReference mbeanServerReference) {
        MBeanServer mbeanServer =3D mbeanServerReference.getMBeanServer());
    }

    public static final GBeanInfo GBEAN_IN=
FO;
    static {
        GBeanInfoBuilder infoBuilder =3D GBeanInfoBuilder.createStatic(Exam=
ple.class);
        infoBuilder.addReference("MBeanServerRef=
erence", MBeanServerReference.class);

        infoBuilder.setConstructor(new =
String[]{"MBe=
anServerReference"});

        GBEAN_INFO =3D infoBuilder.getBeanInfo();
    }

    public static GBeanInfo getGBeanInfo() {
        return GBEAN_INFO;
    }
}

A continuaci=C3=B3n se muestra la configuraci=C3=B3n xml para ejemplo pr= evio:

=
<module xmlns=3D"htt=
p://geronimo.apache.org/xml/ns/deployment-1.1">
  <environment>

    <moduleId>
      <groupId>myco</groupId>
      <artifactId>myco</artifactId>
      <version>1.0</version>
      <type>car</type>
    </moduleId>

    <dependencies>
      <dependency>
        <groupId>geronimo</groupId>
        <artifactId>rmi-naming</artifactId>
        <type>car</type>
      </dependency>
    </dependencies>

  </environment>

  <gbean name=3D"Exa=
mple" class=3D"com.myco.Example"&g=
t;
      <reference name=3D"MBeanServerReference">
          <name>MBeanServerReference<=
span class=3D"code-tag"></name>
      </reference>
  </gbean>
</module>
=20