コード例 #1
0
ファイル: BBController.java プロジェクト: adv0r/web-line
  public void load(Map<String, String[]> jm) {
    try {
      bb.updateSolution(loadJars(jm));

    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #2
0
ファイル: BBController.java プロジェクト: adv0r/web-line
 public String finish() {
   return bb.getSolution();
 }
コード例 #3
0
ファイル: DistributedManager.java プロジェクト: ARiDa/qef-ld
    private void prepareNode(int numNode) {

      try {

        long startingThreads = System.currentTimeMillis();

        BlackBoard bl = BlackBoard.getBlackBoard();
        String addressLocalWebService =
            SystemConfiguration.getSystemConfigInfo(Constants.LOCAL_WEB_SERVICE);

        // Initialize remote Web services.
        if (!containersStarted)
          qenodes[numNode] =
              (numNode == 0)
                  ? webServiceFactory.createService(addressLocalWebService)
                  : webServiceFactory.createService(serviceURI[numNode - 1]);

        // Initialize the service.
        if (!containersStarted) qenodes[numNode].initializeService(numNode);

        // Get the local blackBoard hashmap.
        // BlackBoard bl = BlackBoard.getBlackBoard();
        // long BBTime = System.currentTimeMillis();
        HashMap<String, Object> blackHash = bl.getHashtable();
        HashMap<String, Object> hash = new HashMap<String, Object>();
        hash.putAll(blackHash);

        // Get the set of keys.
        Set blackBoardStrings = hash.keySet();
        Iterator itt = blackBoardStrings.iterator();

        while (itt.hasNext()) {

          // Get the object corresponding to this key.
          String key1 = (String) itt.next();
          Object valueObj = (Object) bl.get(key1);
          String value1 = "";

          // if the object is a string one, it could be copied together with its key
          // to the remote blackBoard.
          if (valueObj instanceof String) {

            value1 = (String) valueObj;
            BlackBoardParams params = new BlackBoardParams(key1, value1);
            qenodes[numNode].copyToRemoteBlackBoard(params);

          } else if (valueObj instanceof String[]) {

            String[] newValueObj = (String[]) valueObj;

            for (int j = 0; j < newValueObj.length; j++) {
              value1 += newValueObj[j] + ",";
            }

            value1 = value1.substring(0, value1.length() - 1);
            BlackBoardParams params = new BlackBoardParams(key1, value1);
            qenodes[numNode].copyToRemoteBlackBoard(params);
          }
        }

        if (numNode != 0) {
          BlackBoardParams params = new BlackBoardParams(Constants.THIS_NODE, numNode + "");
          qenodes[numNode].copyToRemoteBlackBoard(params);
        }

        // Send the QEP.
        qenodes[numNode].initRemote((String) qepRemoteList.get(numNode));

        if (numNode == 0) {
          logger.debug("Local web service initialized.");
        } else {
          logger.debug("Remote node n� " + numNode + " initialized.");
        }

        if (numNode != 0) {
          logger.debug(
              "StartingThread time "
                  + serviceURI[numNode - 1]
                  + " : "
                  + (System.currentTimeMillis() - startingThreads));
        }
        startedWebServicesNumber++;

      } catch (RemoteException ex) {

        startedWebServicesNumber++;
        webServiceCrached = true;
        ex.printStackTrace();
      }
    }
コード例 #4
0
ファイル: DistributedManager.java プロジェクト: ARiDa/qef-ld
  /**
   * This method builds instances of WebService for the distributed execution on remote nodes and
   * should be only invoked if distribution is specified in the QEP.
   *
   * @param request the request to execute
   * @throws DistributedException
   */
  public DQEEPortType buildEnvironement(Request request) throws DistributedException {

    // node id
    int i = 0;

    // Get node informations and remote QEP to send to remote nodes.
    BlackBoard bl = BlackBoard.getBlackBoard();
    G2NInfoNodes infoNodes = (G2NInfoNodes) bl.get(Constants.infoNodes);
    qepRemoteList = (LinkedList) bl.get(Constants.qepRemoteList);
    serviceURI = infoNodes.getNodes();
    int numberOfRemoteNodes = infoNodes.getNumberOfNodes();

    // Change "localhost" to the real IP address and put it in the BlackBoard.
    RemoteBlackBoardManager.prepareBlackBoard(request);

    try {

      if (!containersStarted) {

        //  Start gt4 containers.
        String start =
            SystemConfiguration.getSystemConfigInfo(Constants.START_WEBSERVICES_FROM_CODE);
        if (start != null) {
          if (start.equalsIgnoreCase("TRUE")) startContainers();
        }

        // Initialize the local Web service.
        qenodes = new DQEEPortType[numberOfRemoteNodes + 1];
      }

      // Prepare the remote nodes.
      ArrayList<Starter> starterThreads = new ArrayList<Starter>();
      for (i = 0; i <= numberOfRemoteNodes; i++) {

        Starter starter = new Starter(i);
        starter.start();
        starterThreads.add(starter);
      }

      long veryfingStartingThreads = System.currentTimeMillis();
      while (startedWebServicesNumber != (numberOfRemoteNodes + 1)) {

        try {

          Thread.sleep(1000);
          if (webServiceCrached == true) break;

        } catch (Exception ex) {
          ex.printStackTrace();
        }
      }

      // Close all Starter Threads
      for (Starter starter : starterThreads) {

        synchronized (starter) {
          starter.interrupt();
        }
      }

      if (webServiceCrached == true) {
        throw new DistributedException("One or more web services are not initialized.");
      } else {
        startedWebServicesNumber = 0;
        containersStarted = true;
      }

      logger.debug(
          "beginStartingThreads : " + (System.currentTimeMillis() - veryfingStartingThreads));
      // bl.remove(Constants.THIS_NODE);

    } catch (Exception ex) {

      containersStarted = false;
      ex.printStackTrace();
      throw new DistributedException("Exception in DistributedManager: " + ex.getMessage());
    }

    // Return the first Web service.
    return qenodes[0];
  }
コード例 #5
0
ファイル: TestCaseRunner.java プロジェクト: rbecher/bpelunit
 public void putWSOutgoingMessageSent(OutgoingMessage message) throws InterruptedException {
   fSentBlackBoard.putObject(message, true);
 }
コード例 #6
0
ファイル: TestCaseRunner.java プロジェクト: rbecher/bpelunit
 public void putWSIncomingMessage(PartnerTrack head, IncomingMessage message)
     throws InterruptedException {
   fIncomingBlackboard.putObject(head, message);
 }
コード例 #7
0
ファイル: TestCaseRunner.java プロジェクト: rbecher/bpelunit
 public OutgoingMessage getWSOutgoingMessage(PartnerTrack head)
     throws TimeoutException, InterruptedException {
   return fOutgoingBlackboard.getObject(head);
 }
コード例 #8
0
ファイル: TestCaseRunner.java プロジェクト: rbecher/bpelunit
 /**
  * Sends back a message as an answer to a previously-received incoming message via {@link
  * #receiveMessage(PartnerTrack)}. The message will be sent back using the still-open HTTP
  * Connection.
  *
  * <p>This call will not return until either the message has been delivered, or a timeout has
  * occurred, or the thread was interrupted.
  *
  * @param partnerTrack
  * @param message
  * @throws TimeoutException
  * @throws InterruptedException
  */
 public void sendBackMessage(PartnerTrack partnerTrack, OutgoingMessage message)
     throws TimeoutException, InterruptedException {
   fOutgoingBlackboard.putObject(partnerTrack, message);
   fSentBlackBoard.getObject(message);
 }
コード例 #9
0
ファイル: TestCaseRunner.java プロジェクト: rbecher/bpelunit
 /**
  * Wait for an incoming message at the port and address registered to the given partner track.
  *
  * <p>This call will not return until either a message as been received, a timeout has occurred,
  * or the thread was interrupted.
  *
  * <p>Note that the Web Service Handler expects an answer to every such incoming message. Use
  * {@link #sendBackMessage(PartnerTrack, OutgoingMessage)} to send back a message.
  *
  * @param partnerTrack
  * @return
  * @throws TimeoutException
  * @throws InterruptedException
  */
 public IncomingMessage receiveMessage(PartnerTrack partnerTrack)
     throws TimeoutException, InterruptedException {
   return fIncomingBlackboard.getObject(partnerTrack);
 }