// ***** *****
  public MethodDescriptor[] getMethodDescriptors() {
    try {
      MethodDescriptor md1 =
          new MethodDescriptor(
              getMethod(
                  com.ibm.HostPublisher.IntegrationObject.HPubCommon.class, "processRequest"));
      String procReqDesc = res.getString("procReqDesc");
      md1.setShortDescription(procReqDesc);

      MethodDescriptor md2 =
          new MethodDescriptor(
              getMethod(
                  com.ibm.HostPublisher.IntegrationObject.HPubCommon.class, "doHPTransaction"));
      String doHPTransDesc = res.getString("doHPTransDesc");
      md2.setShortDescription(doHPTransDesc);

      // method for receiving event
      MethodDescriptor md3 =
          new MethodDescriptor(
              getMethod(
                  com.ibm.HostPublisher.IntegrationObject.HPubCommon.class, "hPubStartPerformed"));
      String hPubStartPerfDesc = res.getString("hPubStartPerfDesc");
      md3.setShortDescription(hPubStartPerfDesc);

      MethodDescriptor[] arrayOfMDs = {md1, md2, md3};
      return arrayOfMDs;

    } catch (IntrospectionException e) {
      e.printStackTrace();
    }
    return null;
  }
  public BeanInfo[] getAdditionalBeanInfo() {
    try {
      BeanInfo hPubBi1 = Introspector.getBeanInfo(RestitutionCompGetData.class.getSuperclass());

      BeanInfo[] arrayOfBIs = {hPubBi1};
      return arrayOfBIs;
    } catch (IntrospectionException e) {
      e.printStackTrace();
    }

    return null;
  }
  public BeanInfo[] getAdditionalBeanInfo() {
    try {
      BeanInfo hPubBi1 = Introspector.getBeanInfo(LastActionHistoryResults.class.getSuperclass());

      BeanInfo[] arrayOfBIs = {hPubBi1};
      return arrayOfBIs;
    } catch (IntrospectionException e) {
      e.printStackTrace();
    }

    return null;
  }
Exemplo n.º 4
0
  /**
   * Reads the children of an XML element and matches them to properties of a bean.
   *
   * @param ob The bean to receive the values
   * @param element The element the corresponds to the bean
   * @throws IOException If there is an error reading the document
   */
  public void readObject(Object ob, Element element) throws IOException {
    // If the object is null, skip the element
    if (ob == null) {
      return;
    }

    try {
      BeanInfo info = (BeanInfo) beanCache.get(ob.getClass());

      if (info == null) {
        // Get the bean info for the object
        info = Introspector.getBeanInfo(ob.getClass(), Object.class);

        beanCache.put(ob.getClass(), info);
      }

      // Get the object's properties
      PropertyDescriptor[] props = info.getPropertyDescriptors();

      // Get the attributes of the node
      NamedNodeMap attrs = element.getAttributes();

      // Get the children of the XML element
      NodeList nodes = element.getChildNodes();

      int numNodes = nodes.getLength();

      for (int i = 0; i < props.length; i++) {
        // Treat indexed properties a little differently
        if (props[i] instanceof IndexedPropertyDescriptor) {
          readIndexedProperty(ob, (IndexedPropertyDescriptor) props[i], nodes, attrs);
        } else {
          readProperty(ob, props[i], nodes, attrs);
        }
      }
    } catch (IntrospectionException exc) {
      throw new IOException(
          "Error getting bean info for " + ob.getClass().getName() + ": " + exc.toString());
    }
  }
  public MethodDescriptor[] getMethodDescriptors() {
    try {
      String stringPackageName = new String("IntegrationObject");

      MethodDescriptor mdGetHPubScreenState =
          new MethodDescriptor(
              getMethod(IntegrationObject.CountCourtDateDelete_Access.class, "getHPubScreenState"));
      mdGetHPubScreenState.setShortDescription("getHPubScreenState");

      MethodDescriptor mdProcessRequest =
          new MethodDescriptor(
              getMethod(IntegrationObject.CountCourtDateDelete_Access.class, "processRequest"));
      mdProcessRequest.setShortDescription(
          "This method runs a Host Publisher Integration Object, Remote Int"
              + "egration Object, or EJB Access Bean from an application componen"
              + "t.  This method throws a BeanException if an error occurs.");

      MethodDescriptor mdDoHPTransaction =
          new MethodDescriptor(
              getMethod(IntegrationObject.CountCourtDateDelete_Access.class, "doHPTransaction"));
      mdDoHPTransaction.setShortDescription(
          "This method runs a Host Publisher Integration Object or EJB Acce"
              + "ss Bean from a servlet or JSP.  This method throws a BeanExcepti"
              + "on if an error occurs.");

      MethodDescriptor mdHPubStartPerformed =
          new MethodDescriptor(
              getMethod(IntegrationObject.CountCourtDateDelete_Access.class, "hPubStartPerformed"));
      mdHPubStartPerformed.setShortDescription(
          "When the hPubStartEvent occurs, this method should be called.");

      MethodDescriptor mdSetHPubScreenState =
          new MethodDescriptor(
              getMethod(IntegrationObject.CountCourtDateDelete_Access.class, "setHPubScreenState"));
      mdSetHPubScreenState.setShortDescription("setHPubScreenState");

      MethodDescriptor mdGetHPubMacroMessage =
          new MethodDescriptor(
              getMethod(
                  IntegrationObject.CountCourtDateDelete_Access.class, "getHPubMacroMessage"));
      mdGetHPubMacroMessage.setShortDescription("getHPubMacroMessage");

      MethodDescriptor mdSetHPubMacroMessage =
          new MethodDescriptor(
              getMethod(
                  IntegrationObject.CountCourtDateDelete_Access.class, "setHPubMacroMessage"));
      mdSetHPubMacroMessage.setShortDescription("setHPubMacroMessage");

      MethodDescriptor[] arrayOfMDs = {
        mdGetHPubScreenState,
        mdProcessRequest,
        mdDoHPTransaction,
        mdHPubStartPerformed,
        mdSetHPubScreenState,
        mdGetHPubMacroMessage,
        mdSetHPubMacroMessage
      };

      return arrayOfMDs;
    } catch (IntrospectionException e) {
      e.printStackTrace();
    }
    return null;
  }
Exemplo n.º 6
0
  private void tryConnect(boolean requireRemoteSSL) throws IOException {
    if (jmxUrl == null && "localhost".equals(hostName) && port == 0) {
      // Monitor self
      this.jmxc = null;
      this.mbsc = ManagementFactory.getPlatformMBeanServer();
      this.server = Snapshot.newSnapshot(mbsc);
    } else {
      // Monitor another process
      if (lvm != null) {
        if (!lvm.isManageable()) {
          lvm.startManagementAgent();
          if (!lvm.isManageable()) {
            // FIXME: what to throw
            throw new IOException(lvm + "not manageable");
          }
        }
        if (this.jmxUrl == null) {
          this.jmxUrl = new JMXServiceURL(lvm.connectorAddress());
        }
      }
      Map<String, Object> env = new HashMap<String, Object>();
      if (requireRemoteSSL) {
        env.put("jmx.remote.x.check.stub", "true");
      }
      // Need to pass in credentials ?
      if (userName == null && password == null) {
        if (isVmConnector()) {
          // Check for SSL config on reconnection only
          if (stub == null) {
            checkSslConfig();
          }
          this.jmxc = new RMIConnector(stub, null);
          jmxc.connect(env);
        } else {
          this.jmxc = JMXConnectorFactory.connect(jmxUrl, env);
        }
      } else {
        env.put(JMXConnector.CREDENTIALS, new String[] {userName, password});
        if (isVmConnector()) {
          // Check for SSL config on reconnection only
          if (stub == null) {
            checkSslConfig();
          }
          this.jmxc = new RMIConnector(stub, null);
          jmxc.connect(env);
        } else {
          this.jmxc = JMXConnectorFactory.connect(jmxUrl, env);
        }
      }
      this.mbsc = jmxc.getMBeanServerConnection();
      this.server = Snapshot.newSnapshot(mbsc);
    }
    this.isDead = false;

    try {
      ObjectName on = new ObjectName(THREAD_MXBEAN_NAME);
      this.hasPlatformMXBeans = server.isRegistered(on);
      this.hasHotSpotDiagnosticMXBean =
          server.isRegistered(new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME));
      // check if it has 6.0 new APIs
      if (this.hasPlatformMXBeans) {
        MBeanOperationInfo[] mopis = server.getMBeanInfo(on).getOperations();
        // look for findDeadlockedThreads operations;
        for (MBeanOperationInfo op : mopis) {
          if (op.getName().equals("findDeadlockedThreads")) {
            this.supportsLockUsage = true;
            break;
          }
        }

        on = new ObjectName(COMPILATION_MXBEAN_NAME);
        this.hasCompilationMXBean = server.isRegistered(on);
      }
    } catch (MalformedObjectNameException e) {
      // should not reach here
      throw new InternalError(e.getMessage());
    } catch (IntrospectionException e) {
      InternalError ie = new InternalError(e.getMessage());
      ie.initCause(e);
      throw ie;
    } catch (InstanceNotFoundException e) {
      InternalError ie = new InternalError(e.getMessage());
      ie.initCause(e);
      throw ie;
    } catch (ReflectionException e) {
      InternalError ie = new InternalError(e.getMessage());
      ie.initCause(e);
      throw ie;
    }

    if (hasPlatformMXBeans) {
      // WORKAROUND for bug 5056632
      // Check if the access role is correct by getting a RuntimeMXBean
      getRuntimeMXBean();
    }
  }