|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.j2ee.deployment.impl; import org.openide.nodes.Node; import javax.enterprise.deploy.spi.Target; import javax.management.j2ee.Management; import javax.management.ObjectName; import javax.management.Notification; import javax.management.NotificationListener; import javax.management.j2ee.ListenerRegistration; import org.openide.ErrorManager; import org.openide.util.NbBundle; import org.netbeans.modules.j2ee.deployment.impl.ui.ManagedObject; import org.netbeans.modules.j2ee.deployment.impl.ui.DeployProgressUI; import org.netbeans.modules.j2ee.deployment.plugins.api.*; // PENDING use environment providers, not Cookies // PENDING issue -- Target <==> J2EEDomain relationship 1 to many, many to 1, 1 to 1, or many to many public class ServerTarget implements Node.Cookie { public static final String EVT_STARTING = "j2ee.state.starting"; public static final String EVT_RUNNING = "j2ee.state.running"; public static final String EVT_FAILED = "j2ee.state.failed"; public static final String EVT_STOPPED = "j2ee.state.stopped"; public static final String EVT_STOPPING = "j2ee.state.stopping"; private static final Integer STATE_RUNNING = new Integer(1); ServerInstance instance; Target target; EventLog eventLog; //PENDING: caching state, sync, display through icon and action list. public ServerTarget(ServerInstance instance, Target target) { this.instance = instance; this.target = target; } public ServerInstance getInstance() { return instance; } /** * Return JSR-77 Management EJB that cover this target server. * @return Management EJB or null if provider plugin does not support it. */ public Management getManagement() { return getInstance().getManagement(); } public ObjectName getJ2eeServer() { ManagementMapper mapper = instance.getManagementMapper(); if (mapper != null) return mapper.getTargetJ2eeServer(target); else return null; } public String getName() { return target.getName(); } /** * Start event log listening on all notifications on each of managed object within the J2EEServer * represented by this target. */ public void startEventLog() { Management mgmt = getManagement(); ObjectName j2eeServer = getJ2eeServer(); if (mgmt == null || j2eeServer == null) return; if (eventLog != null) { //eventLog.open(); return; } try { String domain = j2eeServer.getDomain(); String name = j2eeServer.getKeyProperty("name"); //NOI18N eventLog = new EventLog(domain + ":" + name); //NOI18N ObjectName query = new ObjectName(domain+":*,J2EEServer="+name); //NOI18N java.util.Set result = mgmt.queryNames(query, null); ObjectName[] objects = (ObjectName[]) result.toArray(new ObjectName[result.size()]); ListenerRegistration registry = getInstance().getListenerRegistry(); if (registry == null) return; for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.