flex-messaging-core-1.0

16:35:50.624 INFO  jd.cli.Main - Decompiling flex-messaging-core-1.0.jar
package flex.management;

import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;

public class PlatformMBeanServerLocator
  implements MBeanServerLocator
{
  public synchronized MBeanServer getMBeanServer()
  {
    return ManagementFactory.getPlatformMBeanServer();
  }
}

/* Location:
 * Qualified Name:     flex.management.PlatformMBeanServerLocator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.config;

import java.io.PrintStream;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class XPathServerConfigurationParser
  extends ServerConfigurationParser
{
  private XPath xpath;
  
  protected void initializeExpressionQuery()
  {
    xpath = XPathFactory.newInstance().newXPath();
  }
  
  protected Node selectSingleNode(Node source, String expression)
  {
    try
    {
      return (Node)xpath.evaluate(expression, source, XPathConstants.NODE);
    }
    catch (XPathExpressionException expressionException)
    {
      throw wrapException(expressionException);
    }
  }
  
  protected NodeList selectNodeList(Node source, String expression)
  {
    try
    {
      return (NodeList)xpath.evaluate(expression, source, XPathConstants.NODESET);
    }
    catch (XPathExpressionException expressionException)
    {
      throw wrapException(expressionException);
    }
  }
  
  protected Object evaluateExpression(Node source, String expression)
  {
    try
    {
      return xpath.evaluate(expression, source, XPathConstants.STRING);
    }
    catch (XPathExpressionException expressionException)
    {
      throw wrapException(expressionException);
    }
  }
  
  private ConfigurationException wrapException(XPathExpressionException exception)
  {
    ConfigurationException result = new ConfigurationException();
    result.setDetails(10101);
    result.setRootCause(exception);
    return result;
  }
  
  public static void main(String[] args)
  {
    MessagingConfiguration config = new MessagingConfiguration();
    XPathServerConfigurationParser parser = new XPathServerConfigurationParser();
    parser.parse(args[0], new LocalFileResolver(), config);
    System.out.println(config.toString());
  }
}

/* Location:
 * Qualified Name:     flex.messaging.config.XPathServerConfigurationParser
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io;

import flex.messaging.io.amf.translator.ASTranslator;
import flex.messaging.io.amf.translator.decoder.EnumDecoder;

public class Java15TypeMarshaller
  extends ASTranslator
{
  private static EnumDecoder enumDecoder = new EnumDecoder();
  
  public Object createInstance(Object source, Class desiredClass)
  {
    if (desiredClass.isEnum()) {
      return enumDecoder.createShell(source, desiredClass);
    }
    return super.createInstance(source, desiredClass);
  }
  
  public Object convert(Object source, Class desiredClass)
  {
    if (desiredClass.isEnum()) {
      return enumDecoder.decodeObject(source, desiredClass);
    }
    return super.convert(source, desiredClass);
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.Java15TypeMarshaller
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amf;

import flex.messaging.io.PropertyProxyRegistry;
import flex.messaging.io.SerializationContext;
import java.io.IOException;

public class Java15Amf0Output
  extends Amf0Output
{
  public Java15Amf0Output(SerializationContext context)
  {
    super(context);
  }
  
  protected void createAMF3Output()
  {
    avmPlusOutput = new Java15Amf3Output(context);
    avmPlusOutput.setOutputStream(out);
    avmPlusOutput.setDebugTrace(trace);
  }
  
  public void writeObject(Object o)
    throws IOException
  {
    if ((o != null) && ((o instanceof Enum)) && (PropertyProxyRegistry.getRegistry().getProxy(o.getClass()) == null))
    {
      Enum enumValue = (Enum)o;
      writeAMFString(enumValue.name());
    }
    else
    {
      super.writeObject(o);
    }
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amf.Java15Amf0Output
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amf;

import flex.messaging.io.PropertyProxyRegistry;
import flex.messaging.io.SerializationContext;
import java.io.IOException;

public class Java15Amf3Output
  extends Amf3Output
{
  public Java15Amf3Output(SerializationContext context)
  {
    super(context);
  }
  
  public void writeObject(Object o)
    throws IOException
  {
    if ((o != null) && ((o instanceof Enum)) && (PropertyProxyRegistry.getRegistry().getProxy(o.getClass()) == null))
    {
      Enum enumValue = (Enum)o;
      writeAMFString(enumValue.name());
    }
    else
    {
      super.writeObject(o);
    }
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amf.Java15Amf3Output
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amf;

import flex.messaging.io.SerializationContext;
import java.io.OutputStream;

public class Java15AmfMessageSerializer
  extends AmfMessageSerializer
{
  public void initialize(SerializationContext context, OutputStream out, AmfTrace trace)
  {
    amfOut = new Java15Amf0Output(context);
    amfOut.setAvmPlus(version >= 3);
    amfOut.setOutputStream(out);
    
    debugTrace = trace;
    isDebug = (trace != null);
    amfOut.setDebugTrace(debugTrace);
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amf.Java15AmfMessageSerializer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amf.translator.decoder;

public class EnumDecoder
  extends ActionScriptDecoder
{
  public boolean hasShell()
  {
    return true;
  }
  
  public Object createShell(Object encodedObject, Class desiredClass)
  {
    if ((encodedObject instanceof Enum)) {
      return encodedObject;
    }
    Enum value = Enum.valueOf(desiredClass, encodedObject.toString());
    return value;
  }
  
  public Object decodeObject(Object shell, Object encodedObject, Class desiredClass)
  {
    if ((shell == null) || (encodedObject == null)) {
      return null;
    }
    return shell;
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amf.translator.decoder.EnumDecoder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amfx;

import flex.messaging.io.SerializationContext;
import flex.messaging.io.amf.AmfTrace;
import java.io.OutputStream;

public class Java15AmfxMessageSerializer
  extends AmfxMessageSerializer
{
  public void initialize(SerializationContext context, OutputStream out, AmfTrace trace)
  {
    amfxOut = new Java15AmfxOutput(context);
    amfxOut.setOutputStream(out);
    debugTrace = trace;
    isDebug = (debugTrace != null);
    amfxOut.setDebugTrace(trace);
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amfx.Java15AmfxMessageSerializer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.messaging.io.amfx;

import flex.messaging.io.PropertyProxyRegistry;
import flex.messaging.io.SerializationContext;
import flex.messaging.io.amf.Amf3Output;
import flex.messaging.io.amf.Java15Amf3Output;
import java.io.IOException;

public class Java15AmfxOutput
  extends AmfxOutput
{
  public Java15AmfxOutput(SerializationContext context)
  {
    super(context);
  }
  
  public void writeObject(Object o)
    throws IOException
  {
    if ((o != null) && ((o instanceof Enum)) && (PropertyProxyRegistry.getRegistry().getProxy(o.getClass()) == null))
    {
      Enum enumValue = (Enum)o;
      writeString(enumValue.name());
    }
    else
    {
      super.writeObject(o);
    }
  }
  
  protected Amf3Output createAMF3Output()
  {
    return new Java15Amf3Output(context);
  }
}

/* Location:
 * Qualified Name:     flex.messaging.io.amfx.Java15AmfxOutput
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.management.runtime.AdminConsoleDisplayRegistrar;
import flex.messaging.FlexContext;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanRegistration;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

public abstract class BaseControl
  implements BaseControlMBean, MBeanRegistration
{
  public static final String DOMAIN_PREFIX = "flex.runtime";
  private static final int MALFORMED_OBJECTNAME = 10400;
  private static final int UNREG_EXCEPTION = 10401;
  private static final int UNREG_NOTFOUND = 10402;
  private static final int REG_EXCEPTION = 10403;
  private static final int REG_ALREADYEXISTS = 10404;
  private static final int REG_NOTCOMPLIANT = 10405;
  private static final int DISABLE_MANAGEMENT = 10426;
  protected Date startTimestamp;
  private BaseControl parent;
  private ObjectName objectName;
  private ObjectName registeredObjectName;
  private MBeanServer server;
  private boolean registered = false;
  private AdminConsoleDisplayRegistrar registrar;
  
  public abstract String getId();
  
  public abstract String getType();
  
  public final ObjectName getParent()
  {
    return parent != null ? parent.getObjectName() : null;
  }
  
  public String getApplicationId()
  {
    String id = null;
    
    ServletConfig config = FlexContext.getServletConfig();
    if (config != null) {
      id = config.getServletContext().getServletContextName();
    }
    return id != null ? id : "";
  }
  
  protected void setRegistrar(AdminConsoleDisplayRegistrar registrar)
  {
    this.registrar = registrar;
  }
  
  public AdminConsoleDisplayRegistrar getRegistrar()
  {
    if ((parent == null) && (registrar == null)) {
      return new AdminConsoleDisplayRegistrar(null);
    }
    return registrar != null ? registrar : parent.getRegistrar();
  }
  
  public BaseControl(BaseControl parent)
  {
    this.parent = parent;
  }
  
  public final BaseControl getParentControl()
  {
    return parent;
  }
  
  public final MBeanServer getMBeanServer()
  {
    return server;
  }
  
  public final void register()
  {
    if (!registered)
    {
      MBeanServer server = MBeanServerLocatorFactory.getMBeanServerLocator().getMBeanServer();
      ObjectName name = getObjectName();
      try
      {
        if (server.isRegistered(name)) {
          server.unregisterMBean(name);
        }
        registeredObjectName = server.registerMBean(this, name).getObjectName();
        registered = true;
        onRegistrationComplete();
      }
      catch (ManagementException me)
      {
        throw me;
      }
      catch (MBeanRegistrationException mre)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10403, new Object[] { name.toString() });
        me.setRootCause(mre);
        throw me;
      }
      catch (InstanceAlreadyExistsException iaee)
      {
        if (!server.isRegistered(name))
        {
          ManagementException me = new ManagementException();
          me.setMessage(10426, new Object[] { name.toString() });
          throw me;
        }
        ManagementException me = new ManagementException();
        me.setMessage(10404, new Object[] { name.toString() });
        throw me;
      }
      catch (NotCompliantMBeanException ncme)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10405, new Object[] { name.toString() });
        throw me;
      }
      catch (InstanceNotFoundException infe)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10402, new Object[] { name.toString() });
        throw me;
      }
    }
  }
  
  protected void onRegistrationComplete() {}
  
  public final void unregister()
  {
    if (registered) {
      try
      {
        if (server.isRegistered(registeredObjectName)) {
          server.unregisterMBean(registeredObjectName);
        }
        registeredObjectName = null;
        registered = false;
      }
      catch (ManagementException me)
      {
        throw me;
      }
      catch (MBeanRegistrationException mre)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10401, new Object[] { registeredObjectName.toString() });
        if (me.getMessage().indexOf(Integer.toString(10401)) != -1) {
          me.setMessage("The MBean named, '" + registeredObjectName.toString() + "', could not be unregistered because its preDeregister() method threw an exception.");
        }
        me.setRootCause(mre);
        throw me;
      }
      catch (InstanceNotFoundException infe)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10402, new Object[] { registeredObjectName.toString() });
        if (me.getMessage().indexOf(Integer.toString(10402)) != -1) {
          me.setMessage("The MBean named, '" + registeredObjectName.toString() + "', could not be unregistered because it is not currently registered.");
        }
        throw me;
      }
    }
  }
  
  public final ObjectName getObjectName()
  {
    if (registered) {
      return registeredObjectName;
    }
    if (objectName == null)
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("flex.runtime");
      String appId = getApplicationId();
      if ((appId != null) && (appId.length() > 0))
      {
        buffer.append('.');
        buffer.append(appId);
      }
      buffer.append(":type=");
      
      List types = new ArrayList();
      List ids = new ArrayList();
      types.add(getType());
      ids.add(getId());
      BaseControl ancestor = parent;
      while (ancestor != null)
      {
        types.add(ancestor.getType());
        ids.add(ancestor.getId());
        ancestor = ancestor.getParentControl();
      }
      for (int i = types.size() - 1; i >= 0; i--)
      {
        buffer.append((String)types.get(i));
        if (i > 0) {
          buffer.append('.');
        }
      }
      buffer.append(',');
      for (int i = ids.size() - 1; i >= 1; i--)
      {
        buffer.append((String)types.get(i));
        buffer.append('=');
        buffer.append((String)ids.get(i));
        buffer.append(',');
      }
      buffer.append("id=");
      buffer.append(getId());
      String name = buffer.toString();
      try
      {
        objectName = new ObjectName(name);
      }
      catch (MalformedObjectNameException mone)
      {
        ManagementException me = new ManagementException();
        me.setMessage(10400, new Object[] { name });
        throw me;
      }
    }
    return objectName;
  }
  
  public ObjectName preRegister(MBeanServer server, ObjectName name)
    throws Exception
  {
    this.server = server;
    return name == null ? getObjectName() : name;
  }
  
  public void postRegister(Boolean registrationDone) {}
  
  public void preDeregister()
    throws Exception
  {}
  
  public void postDeregister() {}
  
  public void setStartTimestamp(Date value)
  {
    startTimestamp = value;
  }
  
  protected double differenceInMinutes(long startTime, long endTime)
  {
    double minutes = (endTime - startTime) / 60000.0D;
    if (minutes > 1.0D) {
      return minutes;
    }
    return 1.0D;
  }
}

/* Location:
 * Qualified Name:     flex.management.BaseControl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import java.io.IOException;
import javax.management.ObjectName;

public abstract interface BaseControlMBean
{
  public abstract String getId()
    throws IOException;
  
  public abstract String getType()
    throws IOException;
  
  public abstract ObjectName getParent()
    throws IOException;
}

/* Location:
 * Qualified Name:     flex.management.BaseControlMBean
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.messaging.log.Log;
import flex.messaging.log.Logger;
import java.util.ArrayList;
import java.util.Iterator;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;

public class DefaultMBeanServerLocator
  implements MBeanServerLocator
{
  private MBeanServer server;
  
  public synchronized MBeanServer getMBeanServer()
  {
    if (server == null)
    {
      ArrayList servers = MBeanServerFactory.findMBeanServer(null);
      if (servers.size() > 0)
      {
        Iterator iterator = servers.iterator();
        server = ((MBeanServer)iterator.next());
      }
      else
      {
        server = MBeanServerFactory.createMBeanServer();
      }
      if (Log.isDebug()) {
        Log.getLogger("Management.MBeanServer").debug("Using MBeanServer: " + server);
      }
    }
    return server;
  }
}

/* Location:
 * Qualified Name:     flex.management.DefaultMBeanServerLocator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.messaging.MessageBroker;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;

public class MBeanLifecycleManager
{
  public static void unregisterRuntimeMBeans(MessageBroker broker)
  {
    MBeanServer server = MBeanServerLocatorFactory.getMBeanServerLocator().getMBeanServer();
    ObjectName brokerMBean = broker.getControl().getObjectName();
    String domain = brokerMBean.getDomain();
    try
    {
      ObjectName pattern = new ObjectName(domain + ":*");
      Set names = server.queryNames(pattern, null);
      Iterator iter = names.iterator();
      while (iter.hasNext())
      {
        ObjectName on = (ObjectName)iter.next();
        server.unregisterMBean(on);
      }
    }
    catch (Exception e) {}
  }
}

/* Location:
 * Qualified Name:     flex.management.MBeanLifecycleManager
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import javax.management.MBeanServer;

public abstract interface MBeanServerLocator
{
  public abstract MBeanServer getMBeanServer();
}

/* Location:
 * Qualified Name:     flex.management.MBeanServerLocator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.messaging.log.Log;
import flex.messaging.log.Logger;
import flex.messaging.util.ClassUtil;

public class MBeanServerLocatorFactory
{
  private static MBeanServerLocator locator;
  
  public static synchronized MBeanServerLocator getMBeanServerLocator()
  {
    if (locator == null)
    {
      instantiateLocator("flex.management.WebSphereMBeanServerLocator", new String[] { "com.ibm.websphere.management.AdminServiceFactory" });
      if (locator == null) {
        instantiateLocator("flex.management.PlatformMBeanServerLocator", new String[] { "java.lang.management.ManagementFactory" });
      }
      if (locator == null) {
        instantiateLocator("flex.management.DefaultMBeanServerLocator", null);
      }
      if (Log.isDebug()) {
        Log.getLogger("Management.General").debug("Using MBeanServerLocator: " + locator.getClass().getName());
      }
    }
    return locator;
  }
  
  public static void clear()
  {
    locator = null;
  }
  
  private static void instantiateLocator(String locatorClassName, String[] dependencyClassNames)
  {
    try
    {
      if (dependencyClassNames != null) {
        for (int i = 0; i < dependencyClassNames.length; i++) {
          ClassUtil.createClass(dependencyClassNames[i]);
        }
      }
      Class locatorClass = ClassUtil.createClass(locatorClassName);
      locator = (MBeanServerLocator)locatorClass.newInstance();
    }
    catch (Throwable t)
    {
      if (Log.isDebug()) {
        Log.getLogger("Management.MBeanServer").debug("Not using MBeanServerLocator: " + locatorClassName + ". Reason: " + t.getMessage());
      }
    }
  }
}

/* Location:
 * Qualified Name:     flex.management.MBeanServerLocatorFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

public abstract interface Manageable
{
  public abstract boolean isManaged();
  
  public abstract void setManaged(boolean paramBoolean);
  
  public abstract BaseControl getControl();
  
  public abstract void setControl(BaseControl paramBaseControl);
}

/* Location:
 * Qualified Name:     flex.management.Manageable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.messaging.FlexComponent;
import flex.messaging.config.ConfigMap;
import flex.messaging.config.ConfigurationException;
import flex.messaging.log.Log;
import flex.messaging.log.Logger;
import java.util.Date;

public abstract class ManageableComponent
  implements Manageable, FlexComponent
{
  protected static final int PROPERTY_CHANGE_AFTER_STARTUP = 11115;
  protected static final int NULL_COMPONENT_PROPERTY = 11116;
  protected BaseControl control;
  protected String id;
  protected boolean managed;
  protected Manageable parent;
  protected volatile boolean started;
  protected boolean valid;
  
  public ManageableComponent(boolean enableManagement)
  {
    setManaged(enableManagement);
  }
  
  public BaseControl getControl()
  {
    return control;
  }
  
  public void setControl(BaseControl control)
  {
    this.control = control;
  }
  
  public String getId()
  {
    return id;
  }
  
  public void setId(String id)
  {
    if (isStarted()) {
      blockAssignmentWhileStarted("id");
    }
    if (id == null) {
      blockNullAssignment("id");
    }
    this.id = id;
  }
  
  public boolean isManaged()
  {
    return managed;
  }
  
  public void setManaged(boolean enableManagement)
  {
    if ((isStarted()) && (control != null)) {
      blockAssignmentWhileStarted("managed");
    }
    if (parent != null) {
      if ((enableManagement) && (!parent.isManaged()))
      {
        if (Log.isWarn()) {
          Log.getLogger(getLogCategory()).warn("Component: '" + id + "' cannot be managed" + " since its parent is unmanaged.");
        }
        return;
      }
    }
    managed = enableManagement;
  }
  
  public Manageable getParent()
  {
    return parent;
  }
  
  public void setParent(Manageable parent)
  {
    if (isStarted()) {
      blockAssignmentWhileStarted("parent");
    }
    if (parent == null) {
      blockNullAssignment("parent");
    }
    if ((!parent.isManaged()) && (isManaged()))
    {
      if (Log.isWarn()) {
        Log.getLogger(getLogCategory()).warn("Component: '" + id + "' cannot be managed" + " since its parent is unmanaged.");
      }
      setManaged(false);
    }
    this.parent = parent;
  }
  
  public boolean isStarted()
  {
    return started;
  }
  
  protected void setStarted(boolean started)
  {
    if (this.started != started)
    {
      this.started = started;
      if ((started) && (control != null)) {
        control.setStartTimestamp(new Date());
      }
    }
  }
  
  public boolean isValid()
  {
    return valid;
  }
  
  protected void setValid(boolean valid)
  {
    this.valid = valid;
  }
  
  protected abstract String getLogCategory();
  
  public void initialize(String id, ConfigMap properties)
  {
    setId(id);
  }
  
  public void start()
  {
    validate();
    setStarted(true);
  }
  
  public void stop()
  {
    invalidate();
    setStarted(false);
  }
  
  protected void blockAssignmentWhileStarted(String propertyName)
  {
    ConfigurationException ce = new ConfigurationException();
    ce.setMessage(11115, new Object[] { propertyName });
    throw ce;
  }
  
  protected void blockNullAssignment(String propertyName)
  {
    ConfigurationException ce = new ConfigurationException();
    ce.setMessage(11116, new Object[] { propertyName });
    throw ce;
  }
  
  protected void invalidate()
  {
    setValid(false);
  }
  
  protected void validate()
  {
    if (getId() == null) {
      blockNullAssignment("id");
    }
    if (getParent() == null) {
      blockNullAssignment("parent");
    }
    setValid(true);
  }
}

/* Location:
 * Qualified Name:     flex.management.ManageableComponent
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management;

import flex.messaging.MessageException;

public class ManagementException
  extends MessageException
{
  static final long serialVersionUID = 1296149563830613956L;
}

/* Location:
 * Qualified Name:     flex.management.ManagementException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class Attribute
{
  public String name;
  public Object value;
  
  public Attribute() {}
  
  public Attribute(javax.management.Attribute attribute)
  {
    name = attribute.getName();
    value = attribute.getValue();
  }
  
  public javax.management.Attribute toAttribute()
  {
    return new javax.management.Attribute(name, value);
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.Attribute
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class MBeanAttributeInfo
{
  public String name;
  public String type;
  public String description;
  public boolean readable;
  public boolean writable;
  public boolean isIs;
  
  public MBeanAttributeInfo() {}
  
  public MBeanAttributeInfo(javax.management.MBeanAttributeInfo mbeanAttributeInfo)
  {
    name = mbeanAttributeInfo.getName();
    type = mbeanAttributeInfo.getType();
    description = mbeanAttributeInfo.getDescription();
    readable = mbeanAttributeInfo.isReadable();
    writable = mbeanAttributeInfo.isWritable();
    isIs = mbeanAttributeInfo.isIs();
  }
  
  public javax.management.MBeanAttributeInfo toMBeanAttributeInfo()
  {
    return new javax.management.MBeanAttributeInfo(name, type, description, readable, writable, isIs);
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.MBeanAttributeInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class MBeanConstructorInfo
{
  public String name;
  public String description;
  public MBeanParameterInfo[] signature;
  
  public MBeanConstructorInfo() {}
  
  public MBeanConstructorInfo(javax.management.MBeanConstructorInfo mbeanConstructorInfo)
  {
    name = mbeanConstructorInfo.getName();
    description = mbeanConstructorInfo.getDescription();
    signature = convertSignature(mbeanConstructorInfo.getSignature());
  }
  
  public javax.management.MBeanConstructorInfo toMBeanConstructorInfo()
  {
    return new javax.management.MBeanConstructorInfo(name, description, convertSignature(signature));
  }
  
  private MBeanParameterInfo[] convertSignature(javax.management.MBeanParameterInfo[] source)
  {
    MBeanParameterInfo[] signature = new MBeanParameterInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      signature[i] = new MBeanParameterInfo(source[i]);
    }
    return signature;
  }
  
  private javax.management.MBeanParameterInfo[] convertSignature(MBeanParameterInfo[] source)
  {
    javax.management.MBeanParameterInfo[] signature = new javax.management.MBeanParameterInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      signature[i] = source[i].toMBeanParameterInfo();
    }
    return signature;
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.MBeanConstructorInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class MBeanInfo
{
  public String className;
  public String description;
  public MBeanAttributeInfo[] attributes;
  public MBeanConstructorInfo[] constructors;
  public MBeanOperationInfo[] operations;
  
  public MBeanInfo() {}
  
  public MBeanInfo(javax.management.MBeanInfo mbeanInfo)
  {
    className = mbeanInfo.getClassName();
    description = mbeanInfo.getDescription();
    attributes = convertAttributes(mbeanInfo.getAttributes());
    constructors = convertConstructors(mbeanInfo.getConstructors());
    operations = convertOperations(mbeanInfo.getOperations());
  }
  
  public javax.management.MBeanInfo toMBeanInfo()
  {
    return new javax.management.MBeanInfo(className, description, convertAttributes(attributes), convertConstructors(constructors), convertOperations(operations), null);
  }
  
  private MBeanAttributeInfo[] convertAttributes(javax.management.MBeanAttributeInfo[] source)
  {
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      attributes[i] = new MBeanAttributeInfo(source[i]);
    }
    return attributes;
  }
  
  private javax.management.MBeanAttributeInfo[] convertAttributes(MBeanAttributeInfo[] source)
  {
    javax.management.MBeanAttributeInfo[] attributes = new javax.management.MBeanAttributeInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      attributes[i] = source[i].toMBeanAttributeInfo();
    }
    return attributes;
  }
  
  private MBeanConstructorInfo[] convertConstructors(javax.management.MBeanConstructorInfo[] source)
  {
    MBeanConstructorInfo[] constructors = new MBeanConstructorInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      constructors[i] = new MBeanConstructorInfo(source[i]);
    }
    return constructors;
  }
  
  private javax.management.MBeanConstructorInfo[] convertConstructors(MBeanConstructorInfo[] source)
  {
    javax.management.MBeanConstructorInfo[] constructors = new javax.management.MBeanConstructorInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      constructors[i] = source[i].toMBeanConstructorInfo();
    }
    return constructors;
  }
  
  private MBeanOperationInfo[] convertOperations(javax.management.MBeanOperationInfo[] source)
  {
    MBeanOperationInfo[] operations = new MBeanOperationInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      operations[i] = new MBeanOperationInfo(source[i]);
    }
    return operations;
  }
  
  private javax.management.MBeanOperationInfo[] convertOperations(MBeanOperationInfo[] source)
  {
    javax.management.MBeanOperationInfo[] operations = new javax.management.MBeanOperationInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      operations[i] = source[i].toMBeanOperationInfo();
    }
    return operations;
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.MBeanInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class MBeanOperationInfo
{
  public String name;
  public String description;
  public MBeanParameterInfo[] signature;
  public String returnType;
  public int impact;
  
  public MBeanOperationInfo() {}
  
  public MBeanOperationInfo(javax.management.MBeanOperationInfo mbeanOperationInfo)
  {
    name = mbeanOperationInfo.getName();
    description = mbeanOperationInfo.getDescription();
    signature = convertSignature(mbeanOperationInfo.getSignature());
    returnType = mbeanOperationInfo.getReturnType();
    impact = mbeanOperationInfo.getImpact();
  }
  
  public javax.management.MBeanOperationInfo toMBeanOperationInfo()
  {
    return new javax.management.MBeanOperationInfo(name, description, convertSignature(signature), returnType, impact);
  }
  
  private MBeanParameterInfo[] convertSignature(javax.management.MBeanParameterInfo[] source)
  {
    MBeanParameterInfo[] signature = new MBeanParameterInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      signature[i] = new MBeanParameterInfo(source[i]);
    }
    return signature;
  }
  
  private javax.management.MBeanParameterInfo[] convertSignature(MBeanParameterInfo[] source)
  {
    javax.management.MBeanParameterInfo[] signature = new javax.management.MBeanParameterInfo[source.length];
    for (int i = 0; i < source.length; i++) {
      signature[i] = source[i].toMBeanParameterInfo();
    }
    return signature;
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.MBeanOperationInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

public class MBeanParameterInfo
{
  public String name;
  public String type;
  public String description;
  
  public MBeanParameterInfo() {}
  
  public MBeanParameterInfo(javax.management.MBeanParameterInfo mbeanParameterInfo)
  {
    name = mbeanParameterInfo.getName();
    type = mbeanParameterInfo.getType();
    description = mbeanParameterInfo.getDescription();
  }
  
  public javax.management.MBeanParameterInfo toMBeanParameterInfo()
  {
    return new javax.management.MBeanParameterInfo(name, type, description);
  }
}

/* Location:
 * Qualified Name:     flex.management.jmx.MBeanParameterInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package flex.management.jmx;

import flex.management.MBeanServerLocator;
import flex.management.MBeanServerLocatorFactory;
import flex.management.ManagementException;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ReflectionException;
import javax.management.RuntimeOperationsException;

public class MBeanServerGateway
{
  private static final int MALFORMED_OBJECTNAME = 10400;
  private static final int GETINFO_INTROSPECTION_ERR = 10406;
  private static final int MBEAN_NOTFOUND = 10407;
  private static final int GETINFO_REFLECT_ERR = 10408;
  private static final int ATTRIB_NOTFOUND = 10409;
  private static final int GETATTRIB_EXCEPTION = 10410;
  private static final int GETATTRIB_REFLECT_ERR = 10411;
  private static final int GETATTRIB_NULL_ARGUMENT = 10412;
  private static final int GETATTRIBS_REFLECT_ERR = 10413;
  private static final int GETATTRIBS_NULL_ARGUMENT = 10414;
  private static final int INVOKE_REFLECT_ERR = 10415;
  private static final int INVOKE_ERR = 10416;
  private static final int CREATE_ERR = 10417;
  private static final int INSTANCE_EXISTS = 10418;
  private static final int NOT_COMPLIANT = 10419;
  private static final int MBEAN_PREREG_ERR = 10420;
  private static final int MBEAN_PREDEREG_ERR = 10421;
  private static final int SETATTRIB_REFLECT_ERR = 10422;
  private static final int SETATTRIB_EXCEPTION = 10423;
  private static final int INVALID_ATTRIB_VALUE = 10424;
  private static final int SETATTRIBS_REFLECT_ERR = 10425;
  private MBeanServer server;
  
  public MBeanServerGateway()
  {
    server = MBeanServerLocatorFactory.getMBeanServerLocator().getMBeanServer();
  }
  
  public ObjectInstance createMBean(String className, String objectName)
  {
    javax.management.ObjectName name = null;
    if (objectName != null) {
      name = validateObjectName(objectName);
    }
    try
    {
      return new ObjectInstance(server.createMBean(className, name));
    }
    catch (ReflectionException re)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(re);
      throw me;
    }
    catch (InstanceAlreadyExistsException iaee)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10418, new Object[] { name });
      me.setRootCause(iaee);
      throw me;
    }
    catch (MBeanException mbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(mbe);
      throw me;
    }
    catch (NotCompliantMBeanException ncmbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10419, new Object[] { className });
      me.setRootCause(ncmbe);
      throw me;
    }
  }
  
  public ObjectInstance createMBean(String className, String objectName, String loaderName)
  {
    javax.management.ObjectName name = null;
    javax.management.ObjectName loader = null;
    if (objectName != null) {
      name = validateObjectName(objectName);
    }
    if (loaderName != null) {
      loader = validateObjectName(loaderName);
    }
    try
    {
      return new ObjectInstance(server.createMBean(className, name, loader));
    }
    catch (ReflectionException re)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(re);
      throw me;
    }
    catch (InstanceAlreadyExistsException iaee)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10418, new Object[] { name });
      me.setRootCause(iaee);
      throw me;
    }
    catch (MBeanException mbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(mbe);
      throw me;
    }
    catch (NotCompliantMBeanException ncmbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10419, new Object[] { className });
      me.setRootCause(ncmbe);
      throw me;
    }
    catch (InstanceNotFoundException infe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10407, new Object[] { name });
      me.setRootCause(infe);
      throw me;
    }
  }
  
  public ObjectInstance createMBean(String className, String objectName, Object[] params, String[] signature)
  {
    javax.management.ObjectName name = null;
    if (objectName != null) {
      name = validateObjectName(objectName);
    }
    try
    {
      return new ObjectInstance(server.createMBean(className, name, params, signature));
    }
    catch (ReflectionException re)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(re);
      throw me;
    }
    catch (InstanceAlreadyExistsException iaee)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10418, new Object[] { name });
      me.setRootCause(iaee);
      throw me;
    }
    catch (MBeanException mbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(mbe);
      throw me;
    }
    catch (NotCompliantMBeanException ncmbe)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10419, new Object[] { className });
      me.setRootCause(ncmbe);
      throw me;
    }
  }
  
  public ObjectInstance createMBean(String className, String objectName, String loaderName, Object[] params, String[] signature)
  {
    javax.management.ObjectName name = null;
    javax.management.ObjectName loader = null;
    if (objectName != null) {
      name = validateObjectName(objectName);
    }
    if (loaderName != null) {
      loader = validateObjectName(loaderName);
    }
    try
    {
      return new ObjectInstance(server.createMBean(className, name, loader, params, signature));
    }
    catch (ReflectionException re)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10417, new Object[] { name });
      me.setRootCause(re);
      throw me;
    }
    catch (InstanceAlreadyExistsException iaee)
    {
      ManagementException me = new ManagementException();
      me.setMessage(10418, new Object[] { name });
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd