예제 #1
0
 static Object createObject(String className)
     throws InstantiationException, IllegalAccessException, ClassNotFoundException {
   Object object1 = null;
   Class classDefinition = Class.forName(className);
   object1 = classDefinition.newInstance();
   return object1;
 }
 private XmlUIElement getXmlUIElementFor(String typeArg) {
   if (typeToClassMappingProp == null) {
     setUpMappingsHM();
   }
   String clsName = (String) typeToClassMappingProp.get(typeArg);
   if ((clsName != null) && !(clsName.equals("*NOTFOUND*")) && !(clsName.equals("*EXCEPTION*"))) {
     try {
       Class cls = Class.forName(clsName);
       return (XmlUIElement) cls.newInstance();
     } catch (Throwable th) {
       typeToClassMappingProp.put(typeArg, "*EXCEPTION*");
       showErrorMessage(
           MessageFormat.format(
               ProvClientUtils.getString(
                   "{0} occurred when trying to get the XmlUIElement for type : {1}"),
               new Object[] {th.getClass().getName(), typeArg}));
       th.printStackTrace();
       return null;
     }
   } else if (clsName == null) {
     typeToClassMappingProp.put(typeArg, "*NOTFOUND*");
     showErrorMessage(
         MessageFormat.format(
             ProvClientUtils.getString(
                 "The type {0} does not have the corresponding XMLUIElement specified in the TypeToUIElementMapping.txt file"),
             new Object[] {typeArg}));
   }
   return null;
 }
예제 #3
0
 public GridElement cloneFromMe() {
   try {
     java.lang.Class<? extends GridElement> cx = this.getClass(); // get class of dynamic object
     GridElement c = cx.newInstance();
     c.setPanelAttributes(getPanelAttributes()); // copy states
     c.setRectangle(getRectangle());
     getDiagramHandler().setHandlerAndInitListeners(c);
     return c;
   } catch (Exception e) {
     log.error("Error at calling CloneFromMe() on entity", e);
   }
   return null;
 }
예제 #4
0
파일: Class.java 프로젝트: AlexWengh/HMM
 @Override
 public ExecuteContext execute(ExecuteContext context) throws Exception {
   int pos = classFilePath.lastIndexOf(File.separatorChar);
   String folder = classFilePath.substring(0, pos);
   String file = classFilePath.substring(pos + 1);
   file = file.replace(".class", "");
   FileSystemClassLoader loader = new FileSystemClassLoader(folder);
   java.lang.Class<?> classs = loader.findClass(file);
   Object obj = classs.newInstance();
   Method method = classs.getMethod("run");
   method.invoke(obj);
   return context;
 }
예제 #5
0
파일: Entity.java 프로젝트: aaronc/UMLet
 public Entity CloneFromMe() {
   try { // LME
     java.lang.Class<? extends Entity> cx = this.getClass(); // get class of dynamic object
     Entity c = cx.newInstance();
     c.setState(this.getPanelAttributes()); // copy states
     c.setBounds(this.getBounds());
     return c;
   } catch (InstantiationException e) {
     System.err.println("UMLet -> Entity/" + this.getClass().toString() + ": " + e);
   } catch (IllegalAccessException e) {
     System.err.println("UMLet -> Entity/" + this.getClass().toString() + ": " + e);
   }
   return null;
 }
예제 #6
0
  // New implementation
  public JopSession(JopEngine engine, Object rootObject) {
    // Create a JopSessionRep object which class is not known by the compiler
    try {
      Class clazz = Class.forName("jpwr.jop.JopSessionRep");
      try {
        sessionRep = clazz.newInstance();
      } catch (InstantiationException e) {
        System.out.println("InstatiationException");
      } catch (IllegalAccessException e) {
        System.out.println("IllegalAccessException");
      }
    } catch (ClassNotFoundException e) {
      System.out.println("Class not found");
    }

    ((JopSessionIfc) sessionRep).setSession(this);
    ((JopSessionIfc) sessionRep).setRoot(rootObject);
    ((JopSessionIfc) sessionRep).setEngine(engine);
  }
예제 #7
0
  /** CAUTION: Decompiled by hand. */
  public void handleRequest(COM.dragonflow.HTTP.HTTPRequest httprequest)
      throws java.lang.Exception {
    String s1;
    if (httprequest.getURL().indexOf("go.exe") < 0) {
      throw new HTTPRequestException(404, httprequest.getURL());
    }
    String s = COM.dragonflow.Utils.I18N.toDefaultEncoding(httprequest.getValue("group"));
    if (s.length() > 0 && !COM.dragonflow.Page.CGI.isGroupAllowedForAccount(s, httprequest)) {
      throw new HTTPRequestException(557);
    }
    s1 = httprequest.getValue("page");
    if (s1 == null || s1.length() == 0) {
      s1 = "index";
    }
    COM.dragonflow.HTTP.HTTPRequest _tmp = httprequest;
    COM.dragonflow.HTTP.HTTPRequest.noCache = true;
    if (s1.equals("perfex")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      ArrayList array =
          (new CommandLine())
              .exec(
                  COM.dragonflow.SiteView.Platform.getRoot()
                      + "/tools/perfex "
                      + httprequest.getValue("option"));
      for (Enumeration enumeration = (Enumeration) array.iterator();
          enumeration.hasMoreElements();
          outputStream.println((String) enumeration.nextElement())) {}
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.equals("r3starT")) {
      java.lang.System.exit(0);
    } else if (s1.equals("shutd0wN")) {
      printDebugHeader(httprequest, s1);
      outputStream.println(
          "<PRE>"
              + COM.dragonflow.SiteView.Platform.productName
              + " shutting down. This might take a few minutes...");
      outputStream.flush();
      COM.dragonflow.Log.LogManager.log(
          "Error", COM.dragonflow.SiteView.Platform.productName + " shutting down from browser");
      COM.dragonflow.SiteView.SiteViewGroup siteviewgroup =
          COM.dragonflow.SiteView.SiteViewGroup.currentSiteView();
      boolean flag = httprequest.getValue("doQuick").toLowerCase().equals("true");
      siteviewgroup.stopSiteView(flag, null);
      outputStream.println(COM.dragonflow.SiteView.Platform.productName + " shutdown complete");
      outputStream.flush();
      printDebugFooter();
      java.lang.System.exit(0);
    } else if (s1.equals("SendModem")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      ArrayList array1 =
          (new CommandLine())
              .exec(
                  COM.dragonflow.SiteView.Platform.getRoot()
                      + "/tools/SendModem "
                      + httprequest.getValue("option"));
      for (Enumeration enumeration1 = (Enumeration) array1.iterator();
          enumeration1.hasMoreElements();
          outputStream.println((String) enumeration1.nextElement())) {}
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.equals("dialup")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      ArrayList array2 =
          (new CommandLine())
              .exec(
                  COM.dragonflow.SiteView.Platform.getRoot()
                      + "/tools/dialup "
                      + httprequest.getValue("option"));
      for (Enumeration enumeration2 = array2.elements();
          enumeration2.hasMoreElements();
          outputStream.println((String) enumeration2.nextElement())) {}
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.equals("DisplayHTML")) {
      outputStream.println(httprequest.getValue("displayString"));
    } else if (s1.equals("AckLog")) {
      String s2 =
          COM.dragonflow.Utils.I18N.UnicodeToString(
              httprequest.getValue("monitor"), COM.dragonflow.Utils.I18N.nullEncoding());
      String s3 = httprequest.getAccount();
      String s4 = COM.dragonflow.SiteView.Platform.getDirectoryPath("logs", s3);
      StringBuffer stringbuffer = COM.dragonflow.Utils.FileUtils.readFile(s4 + "/Operator.log");
      outputStream.println("<body><h1>Acknowledge Log</h1>\n");
      int i = 0;
      int j = 0;
      outputStream.println(
          "<table border><tr><th><b>Date/Time</th><th>Operation</th><th>Who</th><th>Status</th><th>Message</th></tr></b>\n");
      while ((i = stringbuffer.toString().substring(j).indexOf("\n")) > -1) {
        String s5 = stringbuffer.toString().substring(j, j + i);
        if (s2 == null || s5.indexOf(s2) > -1 && s5.indexOf('\t') >= 0) {
          outputStream.println("<tr>");
          int k = 0;
          boolean flag1 = false;
          int l = 0;
          for (l = 0; l < (flag1 ? 2 : 7); l++) {
            String s6 =
                COM.dragonflow.Utils.I18N.StringToUnicode(
                    s5.substring(k, s5.indexOf('\t', k)), COM.dragonflow.Utils.I18N.nullEncoding());
            if (l != 3 && l != 4 && l != 6) {
              outputStream.println("<td>" + s6 + "</td>");
            }
            if (l == 1 && s6.compareTo("AcknowledgeClear") == 0) {
              flag1 = true;
            }
            k = s5.indexOf('\t', k) + 1;
          }

          if (l > 2) {
            outputStream.println("<td>" + s5.substring(k) + "</td>");
          }
          outputStream.println("</tr>");
        }
        if (stringbuffer.toString().substring(j + i).length() <= 1) {
          j += i;
          break;
        }
        j += i + 1;
      }
      outputStream.println("</table></body>");
    } else if (s1.equals("monitors")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      outputStream.println(COM.dragonflow.Utils.DebugWatcher.checkMonitors());
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.equals("threads")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      outputStream.flush();
      try {
        outputStream.println(COM.dragonflow.Utils.DebugWatcher.checkThreads());
      } catch (java.lang.Throwable throwable) {
        outputStream.println("error=" + throwable);
        throwable.printStackTrace();
      }
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.endsWith("Scheduler")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      outputStream.println(COM.dragonflow.Utils.DebugWatcher.checkScheduler(s1));
      outputStream.println("</PRE>");
      printDebugFooter();
    } else if (s1.equalsIgnoreCase("runmonitor")) {
      printDebugHeader(httprequest, s1);
      outputStream.println("<PRE>");
      outputStream.println(COM.dragonflow.Utils.DebugWatcher.lastLogLines());
      outputStream.println("</PRE>");
      printDebugFooter();
    } else {
      try {
        java.lang.Class class1 = java.lang.Class.forName("COM.dragonflow.Page." + s1 + "Page");
        COM.dragonflow.Page.CGI cgi = (COM.dragonflow.Page.CGI) class1.newInstance();
        cgi.initialize(httprequest, outputStream);
        cgi.printCGIHeader();
        cgi.printBody(outputStream);
        cgi.printCGIFooter();
      } catch (java.lang.ClassNotFoundException classnotfoundexception) {
        throw new HTTPRequestException(404);
      } catch (java.lang.NoClassDefFoundError noclassdeffounderror) {
        throw new HTTPRequestException(404);
      }
    }
  }
예제 #8
0
  /**
   * Auto generated method signature
   *
   * @see org.pahospital.www.labservice.LabService#orderLabTest
   * @param labOrder14
   */
  public org.pahospital.www.labservice.LabOrderId orderLabTest(
      org.pahospital.www.labservice.LabOrder labOrder14) throws java.rmi.RemoteException {

    org.apache.axis2.context.MessageContext _messageContext = null;
    try {
      org.apache.axis2.client.OperationClient _operationClient =
          _serviceClient.createClient(_operations[0].getName());
      _operationClient.getOptions().setAction("http://www.PAHospital.org/LabService/OrderLabTest");
      _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

      addPropertyToOperationClient(
          _operationClient,
          org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
          "&");

      // create a message context
      _messageContext = new org.apache.axis2.context.MessageContext();

      // create SOAP envelope with that payload
      org.apache.axiom.soap.SOAPEnvelope env = null;

      env =
          toEnvelope(
              getFactory(_operationClient.getOptions().getSoapVersionURI()),
              labOrder14,
              optimizeContent(
                  new javax.xml.namespace.QName(
                      "http://www.PAHospital.org/LabService/", "orderLabTest")),
              new javax.xml.namespace.QName(
                  "http://www.PAHospital.org/LabService/", "orderLabTest"));

      // adding SOAP soap_headers
      _serviceClient.addHeadersToEnvelope(env);
      // set the message context with that soap envelope
      _messageContext.setEnvelope(env);

      // add the message contxt to the operation client
      _operationClient.addMessageContext(_messageContext);

      // execute the operation client
      _operationClient.execute(true);

      org.apache.axis2.context.MessageContext _returnMessageContext =
          _operationClient.getMessageContext(
              org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
      org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();

      java.lang.Object object =
          fromOM(
              _returnEnv.getBody().getFirstElement(),
              org.pahospital.www.labservice.LabOrderId.class,
              getEnvelopeNamespaces(_returnEnv));

      return (org.pahospital.www.labservice.LabOrderId) object;

    } catch (org.apache.axis2.AxisFault f) {

      org.apache.axiom.om.OMElement faultElt = f.getDetail();
      if (faultElt != null) {
        if (faultExceptionNameMap.containsKey(
            new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "OrderLabTest"))) {
          // make the fault by reflection
          try {
            java.lang.String exceptionClassName =
                (java.lang.String)
                    faultExceptionClassNameMap.get(
                        new org.apache.axis2.client.FaultMapKey(
                            faultElt.getQName(), "OrderLabTest"));
            java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
            java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
            // message class
            java.lang.String messageClassName =
                (java.lang.String)
                    faultMessageMap.get(
                        new org.apache.axis2.client.FaultMapKey(
                            faultElt.getQName(), "OrderLabTest"));
            java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
            java.lang.Object messageObject = fromOM(faultElt, messageClass, null);
            java.lang.reflect.Method m =
                exceptionClass.getMethod("setFaultMessage", new java.lang.Class[] {messageClass});
            m.invoke(ex, new java.lang.Object[] {messageObject});

            throw new java.rmi.RemoteException(ex.getMessage(), ex);
          } catch (java.lang.ClassCastException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          } catch (java.lang.ClassNotFoundException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          } catch (java.lang.NoSuchMethodException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          } catch (java.lang.reflect.InvocationTargetException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          } catch (java.lang.IllegalAccessException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          } catch (java.lang.InstantiationException e) {
            // we cannot intantiate the class - throw the original Axis fault
            throw f;
          }
        } else {
          throw f;
        }
      } else {
        throw f;
      }
    } finally {
      if (_messageContext.getTransportOut() != null) {
        _messageContext.getTransportOut().getSender().cleanup(_messageContext);
      }
    }
  }
 // Create an ADBBean and provide it as the test object
 public org.apache.axis2.databinding.ADBBean getTestObject(java.lang.Class type)
     throws java.lang.Exception {
   return (org.apache.axis2.databinding.ADBBean) type.newInstance();
 }
예제 #10
0
 /**
  * This method will be called to create new bean factory. Base class creates new instanse only -
  * any derieved from it class can define its own version of this method to support any other
  * algorithm.
  *
  * @return Factory - new bean factory instance
  * @exception Throwable if any error occured
  */
 public Factory instantiateFactory() throws Throwable {
   Class clazz = Class.forName(type);
   Factory factory = (Factory) clazz.newInstance();
   factory.setFactoryMapping(this);
   return factory;
 }