KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > tools > ant > util > InstallerMoc


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: InstallerMoc.java 14:26:17 ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.tools.ant.util;
23
24 import javax.jbi.JBIException;
25 import javax.management.MBeanServer JavaDoc;
26 import javax.management.ObjectName JavaDoc;
27
28 /**
29  * Moc for the installer
30  *
31  * @author ddesjardins - eBMWebsourcing
32  */

33 public class InstallerMoc implements InstallerMocMBean {
34
35     private MBeanServer JavaDoc beanServer;
36     
37     private ObjectName JavaDoc objectName;
38
39     public InstallerMoc(MBeanServer JavaDoc beanServer) {
40         super();
41         this.beanServer = beanServer;
42     }
43
44     public ObjectName JavaDoc getInstallerConfigurationMBean() throws JBIException {
45         return null;
46     }
47
48     public String JavaDoc getInstallRoot() {
49         return null;
50     }
51
52     public ObjectName JavaDoc install() throws JBIException {
53         try {
54             objectName = new ObjectName JavaDoc("org.objectweb.petals:type=binding,name=foo001");
55             AdminServiceMoc.bindingsCompo.add(objectName);
56             beanServer.registerMBean(new LifeCycleMoc(), objectName);
57         }
58         catch (Exception JavaDoc e) {
59             e.printStackTrace();
60         }
61         return objectName;
62     }
63
64     public boolean isInstalled() {
65         return false;
66     }
67
68     public void uninstall() throws JBIException {
69         AdminServiceMoc.bindingsCompo.remove(objectName);
70     }
71
72 }
73
Popular Tags