text:
.class Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;
.super Landroid/widget/ImageButton;
.source "ActionMenuPresenter.java"

# interfaces
.implements Lcom/android/internal/view/menu/ActionMenuView$ActionMenuChildView;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/view/menu/ActionMenuPresenter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "OverflowMenuButton"
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/internal/view/menu/ActionMenuPresenter;

# direct methods
.method public constructor <init>(Lcom/android/internal/view/menu/ActionMenuPresenter;Landroid/content/Context;)V
    .locals 3
    .parameter
    .parameter "context"

    .prologue
    const/4 v2, 0x1

    .line 656
    iput-object p1, p0, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->this$0:Lcom/android/internal/view/menu/ActionMenuPresenter;

    .line 657
    const/4 v0, 0x0

    const v1, 0x10102f6

    invoke-direct {p0, p2, v0, v1}, Landroid/widget/ImageButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 659
    invoke-virtual {p0, v2}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setClickable(Z)V

    .line 660
    invoke-virtual {p0, v2}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setFocusable(Z)V

    .line 661
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setVisibility(I)V

    .line 662
    invoke-virtual {p0, v2}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setEnabled(Z)V

    .line 665
    #getter for: Lcom/android/internal/view/menu/ActionMenuPresenter;->mIsParentThemeDeviceDefault:Z
    invoke-static {p1}, Lcom/android/internal/view/menu/ActionMenuPresenter;->access$100(Lcom/android/internal/view/menu/ActionMenuPresenter;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 666
    invoke-virtual {p0, v2}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setHoverPopupType(I)V

    .line 668
    invoke-virtual {p0, v2}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->setLongClickable(Z)V

    .line 671
    :cond_0
    return-void
.end method

# virtual methods
.method public needsDividerAfter()Z
    .locals 1

    .prologue
    .line 748
    const/4 v0, 0x0

    return v0
.end method

.method public needsDividerBefore()Z
    .locals 1

    .prologue
    .line 744
    const/4 v0, 0x0

    return v0
.end method

.method public performClick()Z
    .locals 2

    .prologue
    const/4 v1, 0x1

    .line 675
    invoke-super {p0}, Landroid/widget/ImageButton;->performClick()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 681
    :goto_0
    return v1

    .line 679
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->playSoundEffect(I)V

    .line 680
    iget-object v0, p0, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->this$0:Lcom/android/internal/view/menu/ActionMenuPresenter;

    invoke-virtual {v0}, Lcom/android/internal/view/menu/ActionMenuPresenter;->showOverflowMenu()Z

    goto :goto_0
.end method

.method public performLongClick()Z
    .locals 17

    .prologue
    .line 687
    invoke-super/range {p0 .. p0}, Landroid/widget/ImageButton;->performLongClick()Z

    move-result v13

    if-eqz v13, :cond_0

    .line 688
    const/4 v13, 0x1

    .line 739
    :goto_0
    return v13

    .line 691
    :cond_0
    move-object/from16 v0, p0

    iget-object v13, v0, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->this$0:Lcom/android/internal/view/menu/ActionMenuPresenter;

    #getter for: Lcom/android/internal/view/menu/ActionMenuPresenter;->mIsParentThemeDeviceDefault:Z
    invoke-static {v13}, Lcom/android/internal/view/menu/ActionMenuPresenter;->access$100(Lcom/android/internal/view/menu/ActionMenuPresenter;)Z

    move-result v13

    if-eqz v13, :cond_6

    .line 692
    const/4 v13, 0x2

    new-array v8, v13, [I

    .line 693
    .local v8, screenPos:[I
    new-instance v3, Landroid/graphics/Rect;

    invoke-direct {v3}, Landroid/graphics/Rect;-><init>()V

    .line 694
    .local v3, displayFrame:Landroid/graphics/Rect;
    move-object/from16 v0, p0

    invoke-virtual {v0, v8}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getLocationOnScreen([I)V

    .line 695
    move-object/from16 v0, p0

    invoke-virtual {v0, v3}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getWindowVisibleDisplayFrame(Landroid/graphics/Rect;)V

    .line 697
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getContext()Landroid/content/Context;

    move-result-object v2

    .line 698
    .local v2, context:Landroid/content/Context;
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getWidth()I

    move-result v11

    .line 699
    .local v11, width:I
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getHeight()I

    move-result v4

    .line 700
    .local v4, height:I
    const/4 v13, 0x1

    aget v13, v8, v13

    div-int/lit8 v14, v4, 0x2

    add-int v6, v13, v14

    .line 701
    .local v6, midy:I
    invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v13

    invoke-virtual {v13}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v13

    iget v9, v13, Landroid/util/DisplayMetrics;->widthPixels:I

    .line 704
    .local v9, screenWidth:I
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getRootView()Landroid/view/View;

    move-result-object v7

    .line 705
    .local v7, root:Landroid/view/View;
    invoke-virtual {v7}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v10

    .line 706
    .local v10, vlp:Landroid/view/ViewGroup$LayoutParams;
    const/4 v12, 0x0

    .line 708
    .local v12, wlp:Landroid/view/WindowManager$LayoutParams;
    instance-of v13, v10, Landroid/view/WindowManager$LayoutParams;

    if-eqz v13, :cond_2

    move-object v12, v10

    .line 709
    check-cast v12, Landroid/view/WindowManager$LayoutParams;

    .line 710
    iget v13, v12, Landroid/view/WindowManager$LayoutParams;->flags:I

    and-int/lit16 v13, v13, 0x200

    if-nez v13, :cond_3

    const/4 v5, 0x0

    .line 711
    .local v5, isMultiWindowPopup:Z
    :goto_1
    if-eqz v5, :cond_2

    iget v13, v3, Landroid/graphics/Rect;->left:I

    if-ltz v13, :cond_1

    iget v13, v3, Landroid/graphics/Rect;->top:I

    if-gez v13, :cond_2

    .line 712
    :cond_1
    move-object/from16 v0, p0

    iget-object v13, v0, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->this$0:Lcom/android/internal/view/menu/ActionMenuPresenter;

    move-object/from16 v0, p0

    #calls: Lcom/android/internal/view/menu/ActionMenuPresenter;->getVisibleDisplayRect(Landroid/view/View;Landroid/graphics/Rect;)V
    invoke-static {v13, v0, v3}, Lcom/android/internal/view/menu/ActionMenuPresenter;->access$200(Lcom/android/internal/view/menu/ActionMenuPresenter;Landroid/view/View;Landroid/graphics/Rect;)V

    .line 717
    .end local v5           #isMultiWindowPopup:Z
    :cond_2
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->getContentDescription()Ljava/lang/CharSequence;

    move-result-object v13

    const/4 v14, 0x0

    invoke-static {v2, v13, v14}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v1

    .line 718
    .local v1, cheatSheet:Landroid/widget/Toast;
    const/4 v13, 0x1

    aget v13, v8, v13

    add-int/2addr v13, v4

    iget v14, v3, Landroid/graphics/Rect;->bottom:I

    sub-int/2addr v14, v4

    if-ge v13, v14, :cond_5

    .line 720
    invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v13

    invoke-virtual {v13}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;

    move-result-object v13

    iget v13, v13, Landroid/content/res/Configuration;->smallestScreenWidthDp:I

    const/16 v14, 0x2d0

    if-lt v13, v14, :cond_4

    .line 721
    const/16 v13, 0x35

    const/4 v14, 0x0

    aget v14, v8, v14

    sub-int v14, v9, v14

    div-int/lit8 v15, v11, 0x2

    sub-int/2addr v14, v15

    const/4 v15, 0x1

    aget v15, v8, v15

    add-int/2addr v15, v4

    invoke-virtual {v1, v13, v14, v15}, Landroid/widget/Toast;->setGravity(III)V

    .line 734
    :goto_2
    invoke-virtual {v1}, Landroid/widget/Toast;->show()V

    .line 735
    const/4 v13, 0x0

    move-object/from16 v0, p0

    invoke-virtual {v0, v13}, Lcom/android/internal/view/menu/ActionMenuPresenter$OverflowMenuButton;->performHapticFeedback(I)Z

    .line 737
    const/4 v13, 0x1

    goto/16 :goto_0

    .line 710
    .end local v1           #cheatSheet:Landroid/widget/Toast;
    :cond_3
    const/4 v5, 0x1

    goto :goto_1

    .line 725
    .restart local v1       #cheatSheet:Landroid/widget/Toast;
    :cond_4
    const/16 v13, 0x35

    const/4 v14, 0x0

    aget v14, v8, v14

    sub-int v14, v9, v14

    div-int/lit8 v15, v11, 0x2

    sub-int/2addr v14, v15

    const/4 v15, 0x1

    aget v15, v8, v15

    add-int/2addr v15, v4

    iget v0, v3, Landroid/graphics/Rect;->top:I

    move/from16 v16, v0

    sub-int v15, v15, v16

    invoke-virtual {v1, v13, v14, v15}, Landroid/widget/Toast;->setGravity(III)V

    goto :goto_2

    .line 731
    :cond_5
    const/16 v13, 0x51

    const/4 v14, 0x0

    invoke-virtual {v1, v13, v14, v4}, Landroid/widget/Toast;->setGravity(III)V

    goto :goto_2

    .line 739
    .end local v1           #cheatSheet:Landroid/widget/Toast;
    .end local v2           #context:Landroid/content/Context;
    .end local v3           #displayFrame:Landroid/graphics/Rect;
    .end local v4           #height:I
    .end local v6           #midy:I
    .end local v7           #root:Landroid/view/View;
    .end local v8           #screenPos:[I
    .end local v9           #screenWidth:I
    .end local v10           #vlp:Landroid/view/ViewGroup$LayoutParams;
    .end local v11           #width:I
    .end local v12           #wlp:Landroid/view/WindowManager$LayoutParams;
    :cond_6
    const/4 v13, 0x0

    goto/16 :goto_0
.end method


text:
#!/usr/bin/env node

/**
 * Module dependencies.
 */

var Changelogger = require("../lib/changelogger"),
    program      = require("commander"),
    packageData  = require(__dirname + "/../package.json");

program.version(packageData.version)
       .usage("[options] [dir]")
       .option('-d, --destination <n>', 'destination directory path')
       .option('-f, --format <n>', 'output format (json, html, md, bbmd)')
       .parse(process.argv);

var changelogger = new Changelogger();
changelogger.request.args        = program.args;
changelogger.request.destination = program.destination;
changelogger.request.format      = program.format;
changelogger.run();

redpajama_set_name: RedPajamaGithub


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestodb.benchto.driver.execution;

import io.prestodb.benchto.driver.Benchmark;
import io.prestodb.benchto.driver.Query;

import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.requireNonNull;

public class QueryExecution
{
    private final Benchmark benchmark;
    private final Query query;
    private final int run;

    public QueryExecution(Benchmark benchmark, Query query, int run)
    {
        this.benchmark = requireNonNull(benchmark);
        this.query = requireNonNull(query);
        this.run = run;
    }

    public Benchmark getBenchmark()
    {
        return benchmark;
    }

    public String getQueryName()
    {
        return query.getName();
    }

    public Query getQuery()
    {
        return query;
    }

    public int getRun()
    {
        return run;
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("query", query)
                .add("run", run)
                .toString();
    }
}


text:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>

<link href="doc-style.css" type="text/css" rel="StyleSheet">

		Local Properties

Managed Object Types	Data Object Types	All Properties	All Methods

Data Object - VirtualPCIControllerOption

Extends

VirtualControllerOption

See also

IntOption

Data Object
                  Description

         This data object type contains the options
  for a virtual PCI Controller.

Properties

	          Name

	          Type

	          Description

numEthernetCards	IntOption

         Defines the minimum, maximum, and
  default number of VirtualEthernetCard instances available,
  at any given time, in the PCI controller. The number of
  VirtualEthernetCard instances is also limited by the number of
  available slots in the PCI controller.

numParaVirtualSCSIControllers	IntOption

         Defines the minimum, maximum, and default
  number of ParaVirtualScsiController instances available,
  at any given time, in the PCI controller.  This is also limited
  by the number of available PCI Express slots in the PCI controller
  as well as the total number of supported SCSI controllers.

Since vSphere API 4.0

numPCIPassthroughDevices	IntOption

         Defines the minimum, maximum, and default
  number of VirtualPCIPassthrough instances available,
  at any given time, in the PCI controller. This is also limited
  by the number of available PCI Express slots in the PCI controller.

Since vSphere API 4.0

numSasSCSIControllers	IntOption

         Defines the minimum, maximum, and default
  number of VirtualLsiLogicSASController instances available,
  at any given time, in the PCI controller.  This is also limited
  by the number of available PCI Express slots in the PCI controller
  as well as the total number of supported SCSI controllers.

Since vSphere API 4.0

numSATAControllers	IntOption

         Defines the minimum, maximum, and default
  number of VirtualSATAController instances available,
  at any given time, in the PCI controller.  This is also limited
  by the number of available PCI Express slots in the PCI controller
  as well as the total number of supported SATA controllers.

Since vSphere API 5.5

numSCSIControllers	IntOption

         Defines the minimum, maximum, and
  default number of VirtualSCSIController instances available
  at any given time in the PCI controller. The number of
  VirtualSCSIController instances is also limited by the number of
  available slots in the PCI controller.

numSoundCards	IntOption

         Defines the minimum, maximum, and default
  number of VirtualSoundCard instances available,
  at any given time, in the PCI controller. The number of
  VirtualSoundCard instances is also limited by the number of
  available slots in the PCI controller.

numVideoCards	IntOption

         Defines the minimum, maximum, and default
  number of VirtualVideoCard instances available,
  at any given time, in the PCI controller. The number of
  VirtualVideoCard instances is also limited by the number of
  available slots in the PCI controller.

numVmciDevices	IntOption

         Defines the minimum, maximum, and default
  number of VirtualVMCIDevice instances available,
  at any given time, in the PCI controller. This is also limited
  by the number of available slots in the PCI controller.

Since vSphere API 4.0

numVmiRoms	IntOption

         Defines the minimum, maximum, and default
  number of VirtualVMIROM instances available,
  at any given time, in the PCI controller. This is also limited
  by the number of available slots in the PCI controller.

Since VI API 2.5

numVmxnet3EthernetCards	IntOption

         Defines the minimum, maximum, and default
  number of VirtualVmxnet3 ethernet card instances available,
  at any given time, in the PCI controller. This is also limited
  by the number of available PCI Express slots in the PCI controller
  as well as the total number of supported ethernet cards.

Since vSphere API 4.0

						Properties inherited from VirtualControllerOption

devices, supportedDevice

						Properties inherited from VirtualDeviceOption

autoAssignController, backingOption, busSlotOption, connectOption, controllerType, defaultBackingOptionIndex, deprecated, hotRemoveSupported, licensingLimit, plugAndPlay, type

						Properties inherited from DynamicData

dynamicProperty, dynamicType

Show WSDL type definition

<textarea cols="20" rows="10" name="wsdl-textarea" wrap="off" readonly="1" id="wsdl-textarea">         <complexType xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vim25="urn:vim25" name="VirtualPCIControllerOption">
            <complexContent>
               <extension base="vim25:VirtualControllerOption">
                  <sequence>
                     <element name="numSCSIControllers" type="vim25:IntOption"/>
                     <element name="numEthernetCards" type="vim25:IntOption"/>
                     <element name="numVideoCards" type="vim25:IntOption"/>
                     <element name="numSoundCards" type="vim25:IntOption"/>
                     <element name="numVmiRoms" type="vim25:IntOption"/>
                     <element name="numVmciDevices" type="vim25:IntOption" minOccurs="0"/>
                     <element name="numPCIPassthroughDevices" type="vim25:IntOption" minOccurs="0"/>
                     <element name="numSasSCSIControllers" type="vim25:IntOption" minOccurs="0"/>
                     <element name="numVmxnet3EthernetCards" type="vim25:IntOption" minOccurs="0"/>
                     <element name="numParaVirtualSCSIControllers" type="vim25:IntOption" minOccurs="0"/>
                     <element name="numSATAControllers" type="vim25:IntOption" minOccurs="0"/>
                  </sequence>
               </extension>
            </complexContent>
         </complexType></textarea>

Top of page		Local Properties

Managed Object Types	Data Object Types	All Properties	All Methods


text:
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

   <modelVersion>4.0.0</modelVersion>
   <groupId>Jazz</groupId>
   <version>1.0</version>
   <artifactId>Jazz</artifactId>
   <packaging>pom</packaging>

   <name>project</name>

   <properties>
      <jsf.version>1.2_13</jsf.version>
      <richfaces.version>3.3.3.Final</richfaces.version>
      <portletbridge.version>2.1.0.FINAL</portletbridge.version>
   </properties>

   	<distributionManagement>
	    <repository>
	        <id>SBR001001-075</id>
	        <name>SBR001001-075-releases</name>
	        <url>http://sbr001001-075/artifactory/libs-releases-local</url>
	    </repository>
	    <snapshotRepository>
	        <id>SBR001001-075</id>
	        <name>SBR001001-075-snapshots</name>
	        <url>http://sbr001001-075/artifactory/libs-snapshots-local</url>
	    </snapshotRepository>
	</distributionManagement>

    <dependencyManagement>
    	<dependencies>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-web</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework.security</groupId>
				<artifactId>spring-security-cas-client</artifactId>
				<version>3.0.8.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-aop</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-expression</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-jdbc</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-asm</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>

			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-beans</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-tx</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-web</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>

			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-context</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-orm</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-test</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-test</artifactId>
				<version>3.2.2.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>mysql</groupId>
				<artifactId>mysql-connector-java</artifactId>
				<version>5.1.14</version>
			</dependency>
			<dependency>
				<groupId>commons-lang</groupId>
				<artifactId>commons-lang</artifactId>
				<version>2.4</version>
			</dependency>
			<dependency>
				<groupId>commons-beanutils</groupId>
				<artifactId>commons-beanutils</artifactId>
				<version>1.8.2</version>
			</dependency>
			<dependency>
				<groupId>commons-collections</groupId>
				<artifactId>commons-collections</artifactId>
				<version>3.2</version>
			</dependency>
			<dependency>
				<groupId>org.testng</groupId>
				<artifactId>testng</artifactId>
				<version>5.14.6</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-api</artifactId>
				<version>1.6.1</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-log4j12</artifactId>
				<version>1.6.1</version>
			</dependency>
			<dependency>
				<groupId>net.sf.jasperreports</groupId>
				<artifactId>jasperreports</artifactId>
				<version>5.1.2</version>
			</dependency>
			<dependency>
				<groupId>javax.ejb</groupId>
				<artifactId>ejb-api</artifactId>
				<version>3.0</version>
			</dependency>
			<dependency>
				<groupId>net.sf.bluecove</groupId>
				<artifactId>bluecove</artifactId>
				<version>2.1.0</version>
			</dependency>
			<dependency>
				<groupId>javax.servlet</groupId>
				<artifactId>servlet-api</artifactId>
				<version>2.4</version>
			</dependency>
			<dependency>
				<groupId>org.primefaces</groupId>
				<artifactId>primefaces</artifactId>
				<version>1.1</version>
			</dependency>
			<dependency>
				<groupId>javax.mail</groupId>
				<artifactId>mail</artifactId>
				<version>1.4.1</version>
			</dependency>
			<dependency>
				<groupId>javax.faces</groupId>
				<artifactId>jsf-api</artifactId>
				<version>${jsf.version}</version>
			</dependency>
			<dependency>
				<groupId>javax.faces</groupId>
				<artifactId>jsf-impl</artifactId>
				<version>${jsf.version}</version>
			</dependency>
			<dependency>
				<groupId>commons-dbcp</groupId>
				<artifactId>commons-dbcp</artifactId>
				<version>1.2.2</version>
			</dependency>
			<dependency>
				<groupId>org.hibernate</groupId>
				<artifactId>hibernate-jmx</artifactId>
				<version>3.5.1-Final</version>
			</dependency>
			<dependency>
				<groupId>javax.servlet</groupId>
				<artifactId>jstl</artifactId>
				<version>1.1.2</version>
			</dependency>
			<dependency>
				<groupId>commons-logging</groupId>
				<artifactId>commons-logging</artifactId>
				<version>1.1.1</version>
			</dependency>
    	</dependencies>
	</dependencyManagement>

   <dependencies>
		<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-beans</artifactId>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-tx</artifactId>
			</dependency>

   </dependencies>

     <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
					<encoding>ISO8859-1</encoding>
		        </configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.8</version>
				<configuration>
					<wtpmanifest>true</wtpmanifest>
					<wtpapplicationxml>true</wtpapplicationxml>
					<ajdtVersion>none</ajdtVersion>
				</configuration>
			</plugin>

			<plugin>
				<artifactId>maven-release-plugin</artifactId>
				<configuration>
					<tagBase>http://subversion.assembla.com/svn/jazzframework/tags/</tagBase>
				</configuration>
			</plugin>

		</plugins>
     </build>

  <modules>
	<!--
	<module>JazzOMRParser</module>
	-->

	<module>JazzFramework</module>
	<module>JazzXDoclet</module>
	<module>JazzOMRJRElements</module>
	<module>JazzAnnotations</module>
	<module>JazzOMR</module>
	<!--

	<module>JazzJRDataSource</module>
	<module>JazzWSI</module>
	<module>JazzQA</module>
	<module>avPortal</module>
	<module>SVNRedmineLogTime</module>
	-->

  </modules>

  <scm>
	<connection>scm:svn:https://subversion.assembla.com/svn/jazzframework</connection>
    <developerConnection>scm:svn:https://subversion.assembla.com/svn/jazzframework</developerConnection>
    <tag>HEAD</tag>
    <url>https://subversion.assembla.com/svn/jazzframework</url>
  </scm>

</project>


text:
var assign = require('core-js/library/fn/object/assign');
var printHTML = require('print-html');
var Page = require('./page');
var analyzeDetection = require('src/analyzers/detection');
var analyzePager = require('src/analyzers/pager');

function analyze(doc, params, date, context) {
    var detection = analyzeDetection(doc, date);
    var pager = analyzePager(doc, date);

    context.detection = detection;
    if (context.perso) {
        assign(context.perso, pager);
    }

    return {
        detection: detection,
        pager: pager,
        raw: printHTML(doc)
    };
}

module.exports = Page('detect', {
    analyze: analyze
});


text:
namespace YAMP.Sensors.Devices
{
    using System;

    /// <summary>
    /// Arguments for the accelerometer.
    /// </summary>
    public class AccelerometerEventArgs : EventArgs
    {
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        public AccelerometerEventArgs(Vector value)
        {
            Value = value;
        }

        /// <summary>
        /// Gets the current value.
        /// </summary>
        public Vector Value
        {
            get;
            private set;
        }
    }
}


text:
@interface BWClearCachesCell : UITableViewCell

@end


text:
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![GoDoc](https://godoc.org/github.com/ipfs/go-libp2p-transport?status.svg)](https://godoc.org/github.com/ipfs/go-libp2p-transport)
[![Coverage Status](https://coveralls.io/repos/github/ipfs/go-libp2p-transport/badge.svg?branch=master)](https://coveralls.io/github/ipfs/go-libp2p-transport?branch=master)
[![Build Status](https://travis-ci.org/ipfs/go-libp2p-transport.svg?branch=master)](https://travis-ci.org/ipfs/go-libp2p-transport)

> libp2p transport code

A common interface for network transports.

This is the 'base' layer for any transport that wants to be used by libp2p and ipfs. If you want to make 'ipfs work over X', the first thing you'll want to do is to implement the `Transport` interface for 'X'.

## Install

```sh
> gx install --global
> gx-go rewrite
```

## Usage

```go
var t Transport

t = NewTCPTransport()

list, err := t.Listen(listener_maddr)
if err != nil {
	log.Fatal(err)
}

con, err := list.Accept()
if err != nil {
	log.Fatal(err)
}

fmt.Fprintln(con, "Hello World!")
```

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-libp2p-transport/issues)!

This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

### Want to hack on IPFS?

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)

## License

MIT


text:
title: "Test Article"
date: 2011-01-04
tags: bar
---
Test Article Content


text:
<?php
//support Markdown syntax
require_once('php-markdown/Michelf/Markdown.inc.php');
use \Michelf\Markdown;
//==== Redirect... Try PHP header redirect, then Java redirect, then try http redirect.:
function redirect($url){
    $url = "http://".$_SERVER['HTTP_HOST'].$url;
    //if (!headers_sent()){    //If headers not sent yet... then do php redirect
    //    header('Location: '.$url); exit;
    //}else{                    //If headers are sent... do java redirect... if java disabled, do html redirect.
        echo '';
        echo '';
        echo '';
        echo '';
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '';
        echo '';
        echo '';
        exit;
    //}
}//==== End -- Redirect

function getDeviceType(){
    require_once './Mobile-Detect/Mobile_Detect.php';
    $detect = new Mobile_Detect;
    $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
    return $deviceType;
}

function convert2MarkdownFormat($new_content) {
    $new_content_markdown = $new_content;
    $new_content_markdown = Markdown::defaultTransform($new_content_markdown);
    $markdown_search = array("", "", "code data-", "endcode\n");
    $markdown_replace = array("
", "
", "");
    $new_content_markdown = str_replace($markdown_search, $markdown_replace, $new_content_markdown);
    $markdown_search = array("

", "

");
    $markdown_replace = array("
", "
");
    $new_content_markdown = str_replace($markdown_search, $markdown_replace, $new_content_markdown);
    return $new_content_markdown;
}

?>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="4ffd30f5-9794-4701-b745-7f5f337eb3c9" name="Default" comment="">
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/backend.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/controllers/__init__.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/models/__init__.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/models/stock_model.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/publisher/__init__.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/publisher/publish_stock.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/queues/__init__.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/qs_backend/tests/__init__.py" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/../qs_dispatcher/.idea/misc.xml" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/../qs_dispatcher/.idea/modules.xml" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/../qs_dispatcher/.idea/qs_dispatcher.iml" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/../qs_dispatcher/.idea/workspace.xml" />
      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/../qs_dispatcher/qs_dispatcher/__init__.py" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../qs-web/index.html" afterPath="$PROJECT_DIR$/../qs-web/index.html" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../qs-web/src/js/index.js" afterPath="$PROJECT_DIR$/../qs-web/src/js/index.js" />
    </list>
    <ignored path="qs_backend.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="qs_backend" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="backend.py" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/qs_backend/backend.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="308">
              <caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
              <folding>
                <element signature="e#302#318#0" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="publish_stock.py" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/qs_backend/publisher/publish_stock.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="119">
              <caret line="19" column="49" selection-start-line="19" selection-start-column="49" selection-end-line="19" selection-end-column="49" />
              <folding>
                <element signature="e#358#429#0" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="stock_delivery_queue.py" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="265">
              <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="_pydev_execfile.py" pinned="false" current-in-tab="false">
        <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/_pydev_imps/_pydev_execfile.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="289">
              <caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="worker_fetch_stock.py" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="326">
              <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" />
              <folding>
                <element signature="e#499#522#0" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="threading.py" pinned="false" current-in-tab="false">
        <entry file="file://C:/Program Files (x86)/Python35-32/Lib/threading.py">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="122">
              <caret line="861" column="0" selection-start-line="861" selection-start-column="0" selection-end-line="861" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="Python Script" />
      </list>
    </option>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/qs_backend/exceptions/http_custom_handlers.py" />
        <option value="$PROJECT_DIR$/qs_backend/exceptions/json_exception_handler.py" />
        <option value="$PROJECT_DIR$/setup.py" />
        <option value="$PROJECT_DIR$/qs_backend/controllers/subscriptions_controller.py" />
        <option value="$PROJECT_DIR$/qs_backend/api.py" />
        <option value="$PROJECT_DIR$/qs_backend/processors.py" />
        <option value="$PROJECT_DIR$/qs_backend/processors/processor_stockprice.py" />
        <option value="$PROJECT_DIR$/qs_backend/models/stock_model.py" />
        <option value="$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py" />
        <option value="$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py" />
        <option value="$PROJECT_DIR$/qs_backend/backend.py" />
        <option value="$PROJECT_DIR$/qs_backend/publisher/publish_stock.py" />
      </list>
    </option>
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-8" />
    <option name="y" value="-8" />
    <option name="width" value="1386" />
    <option name="height" value="788" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="true">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="2" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="Scope" />
      <pane id="Scratches" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="workers" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="qs_backend" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="publisher" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
  </component>
  <component name="RunManager" selected="Python.backend">
    <configuration default="false" name="api" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/qs_backend" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/qs_backend/api.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="false" name="worker_fetch_stock" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/qs_backend/workers" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="false" name="publish_stock" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/qs_backend/publisher" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/qs_backend/publisher/publish_stock.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="false" name="backend" type="PythonConfigurationType" factoryName="Python" temporary="true">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/qs_backend" />
      <option name="IS_MODULE_SDK" value="true" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/qs_backend/backend.py" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="Tox" factoryName="Tox">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Attests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Doctests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Nosetests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Unittests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PUREUNITTEST" value="true" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="py.test">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="qs_backend" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="testToRun" value="" />
      <option name="keywords" value="" />
      <option name="params" value="" />
      <option name="USE_PARAM" value="false" />
      <option name="USE_KEYWORD" value="false" />
      <method />
    </configuration>
    <list size="4">
      <item index="0" class="java.lang.String" itemvalue="Python.api" />
      <item index="1" class="java.lang.String" itemvalue="Python.worker_fetch_stock" />
      <item index="2" class="java.lang.String" itemvalue="Python.publish_stock" />
      <item index="3" class="java.lang.String" itemvalue="Python.backend" />
    </list>
    <recent_temporary>
      <list size="4">
        <item index="0" class="java.lang.String" itemvalue="Python.backend" />
        <item index="1" class="java.lang.String" itemvalue="Python.publish_stock" />
        <item index="2" class="java.lang.String" itemvalue="Python.worker_fetch_stock" />
        <item index="3" class="java.lang.String" itemvalue="Python.api" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="4ffd30f5-9794-4701-b745-7f5f337eb3c9" name="Default" comment="" />
      <created>1473751590449</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1473751590449</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="-8" y="-8" width="1386" height="788" extended-state="0" />
    <editor active="true" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23664689" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32724506" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39878234" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <breakpoints>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py</url>
          <line>23</line>
          <option name="timeStamp" value="18" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py</url>
          <line>18</line>
          <option name="timeStamp" value="21" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py</url>
          <line>48</line>
          <option name="timeStamp" value="22" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py</url>
          <line>40</line>
          <option name="timeStamp" value="23" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/backend.py</url>
          <line>30</line>
          <option name="timeStamp" value="31" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="python-line">
          <url>file://$PROJECT_DIR$/qs_backend/backend.py</url>
          <line>21</line>
          <option name="timeStamp" value="34" />
        </line-breakpoint>
      </breakpoints>
      <option name="time" value="37" />
    </breakpoint-manager>
    <watches-manager>
      <configuration name="PythonConfigurationType">
        <watch expression="stock_d_queue" />
        <watch expression="stock_d_queue" />
        <watch expression="stock_data_from_queue" />
      </configuration>
    </watches-manager>
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="e#499#522#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/models/stock_model.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="442">
          <caret line="26" column="24" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/controllers/subscriptions_controller.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="136">
          <caret line="8" column="0" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/api.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="187">
          <caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/setup.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/exceptions/json_exception_handler.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/exceptions/http_custom_handlers.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/exceptions/json_exception_handler.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/exceptions/http_custom_error_handlers.py" />
    <entry file="file://$PROJECT_DIR$/setup.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="51">
          <caret line="3" column="20" selection-start-line="3" selection-start-column="20" selection-end-line="3" selection-end-column="20" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/processors.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/processors/processor_stockprice.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_company_stock.py" />
    <entry file="file://$PROJECT_DIR$/qs_backend/models/stock_model.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="442">
          <caret line="26" column="24" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/controllers/subscriptions_controller.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="136">
          <caret line="8" column="0" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/api.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="7" selection-end-column="28" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/_pydev_imps/_pydev_execfile.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="289">
          <caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/workers/worker_fetch_stock.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="326">
          <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" />
          <folding>
            <element signature="e#499#522#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://C:/Program Files (x86)/Python35-32/Lib/threading.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="122">
          <caret line="861" column="0" selection-start-line="861" selection-start-column="0" selection-end-line="861" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/backend.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="308">
          <caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
          <folding>
            <element signature="e#302#318#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/queues/stock_delivery_queue.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="265">
          <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/publisher/example.log">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/qs_backend/publisher/publish_stock.py">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="119">
          <caret line="19" column="49" selection-start-line="19" selection-start-column="49" selection-end-line="19" selection-end-column="49" />
          <folding>
            <element signature="e#358#429#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
XTREEMFS=$1
DIR_SERVER=$2
MRC_SERVER=$3
TEST_DIR=$4
VOLUME="$(basename $(dirname $(pwd)))"

exec $JAVA_HOME/bin/java -ea -cp $XTREEMFS/java/servers/dist/XtreemFS.jar:$XTREEMFS/java/foundation/dist/Foundation.jar:$XTREEMFS/java/lib/*:/usr/share/java/XtreemFS.jar:/usr/share/java/protobuf-java-2.5.0.jar:/usr/share/java/Foundation.jar:. \
  org.xtreemfs.utils.xtfs_benchmark.xtfs_benchmark -sw -sr -rw -rr -fw -fr --stripe-size 128K --stripe-width 1 -ssize 500m -rsize 100m --file-size 64K --basefile-size 500m --dir-addresses $DIR_SERVER --user $USER --group $USER $VOLUME

# minimal version for testing
# exec $JAVA_HOME/bin/java -ea -cp $XTREEMFS/java/servers/dist/XtreemFS.jar:$XTREEMFS/java/foundation/dist/Foundation.jar:$XTREEMFS/java/lib/*:/usr/share/java/XtreemFS.jar:/usr/share/java/protobuf-java-2.5.0.jar:/usr/share/java/Foundation.jar:. \
#   org.xtreemfs.utils.xtfs_benchmark.xtfs_benchmark -sw -sr -rw -rr -fw -fr -t 1 --stripe-size 128K --stripe-width 1 -ssize 10m -rsize 1m --file-size 64K --basefile-size 100m --dir-address $DIR_SERVER $VOLUME


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="com.swfarm.biz.chain.bo.ShippingSortingGroup" table="shippingsortinggroup">
		<cache usage="read-write" />
		<id name="id" column="id">
			<generator class="sequence" >
                <param name="sequence">SHIPPINGSORTINGGROUP_ID_SEQ</param>
			</generator>
		</id>
		<property name="code" column="code" />
		<property name="name" column="name" />
		<set name="shippingCountries" table="tr_sortinggroup_country" cascade="save-update"
			lazy="false">
			<key>
				<column name="group_id" />
			</key>
			<many-to-many column="country_id" class="com.swfarm.biz.oa.bo.Country" />
		</set>
		<set name="shippingMethods" table="tr_sg_sm"
			cascade="save-update" lazy="false"> <!-- renamed -->
			<key>
				<column name="group_id" />
			</key>
			<many-to-many column="shippingmethod_id"
				class="com.swfarm.biz.chain.bo.ShippingMethod" />
		</set>
	</class>
</hibernate-mapping>


text:
package com.lorne.tx.service.impl;

import com.alibaba.fastjson.JSONObject;

import com.lorne.core.framework.utils.KidUtils;
import com.lorne.core.framework.utils.task.ConditionUtils;
import com.lorne.core.framework.utils.task.IBack;
import com.lorne.core.framework.utils.task.Task;
import com.lorne.core.framework.utils.thread.CountDownLatchHelper;
import com.lorne.core.framework.utils.thread.IExecute;
import com.lorne.tx.Constants;
import com.lorne.tx.mq.model.TxGroup;
import com.lorne.tx.mq.model.TxInfo;
import com.lorne.tx.service.TransactionConfirmService;
import com.lorne.tx.service.TxManagerService;
import com.lorne.tx.service.model.ChannelSender;
import com.lorne.tx.utils.SocketManager;

import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.*;

/**
 * Created by lorne on 2017/6/9.
 */
@Service
public class TransactionConfirmServiceImpl implements TransactionConfirmService {

    private Logger logger = LoggerFactory.getLogger(TransactionConfirmServiceImpl.class);

    private ScheduledExecutorService executorService  = Executors.newScheduledThreadPool(100);

    private Executor threadPool = Executors.newFixedThreadPool(100);

    @Autowired
    private TxManagerService txManagerService;

    @Override
    public void confirm(TxGroup txGroup) {
        //绑定管道对象,检查网络
        setChannel(txGroup.getList());

        //事务不满足直接回滚事务
        if (txGroup.getState()==0) {
            transaction(txGroup, 0);
            return;
        }

        boolean hasOk =  transaction(txGroup, 1);
        txManagerService.dealTxGroup(txGroup,hasOk);
    }

    /**
     * 匹配管道
     *
     * @param list
     */
    private void setChannel(List<TxInfo> list) {
        for (TxInfo info : list) {
            if(Constants.address.equals(info.getAddress())){
                Channel channel = SocketManager.getInstance().getChannelByModelName(info.getModelName());
                if (channel != null &&channel.isActive()) {
                    ChannelSender sender = new ChannelSender();
                    sender.setChannel(channel);

                    info.setChannel(sender);
                }
            }else{
                ChannelSender sender = new ChannelSender();
                sender.setAddress(info.getAddress());
                sender.setModelName(info.getModelName());

                info.setChannel(sender);
            }
        }
    }

    private void awaitSend(Task task, TxInfo txInfo,String msg){
            while (!task.isAwait() && !Thread.currentThread().interrupted()) {
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            if(txInfo.getChannel()!=null) {
                txInfo.getChannel().send(msg,task);
            }else{
                task.setBack(new IBack() {
                    @Override
                    public Object doing(Object... objs) throws Throwable {
                        return "-2";
                    }
                });
                task.signalTask();
            }
    }

    /**
     * 事务提交或回归
     *
     * @param checkSate
     */
    private boolean transaction(TxGroup txGroup, final int checkSate) {
        if (checkSate == 1) {
            CountDownLatchHelper<Boolean> countDownLatchHelper = new CountDownLatchHelper<>();
            for (final TxInfo txInfo : txGroup.getList()) {
                if (txInfo.getIsGroup() == 0) {
                    countDownLatchHelper.addExecute(new IExecute<Boolean>() {
                        @Override
                        public Boolean execute() {
                            if(txInfo.getChannel()==null){
                                return false;
                            }
                            final JSONObject jsonObject = new JSONObject();
                            jsonObject.put("a", "t");
                            jsonObject.put("c", checkSate);
                            jsonObject.put("t", txInfo.getKid());
                            final String key = KidUtils.generateShortUuid();
                            jsonObject.put("k", key);
                            Task task = ConditionUtils.getInstance().createTask(key);

                            ScheduledFuture future = executorService.schedule(new Runnable() {
                                @Override
                                public void run() {
                                    Task task = ConditionUtils.getInstance().getTask(key);
                                    if(task!=null&&!task.isNotify()) {
                                        task.setBack(new IBack() {
                                            @Override
                                            public Object doing(Object... objs) throws Throwable {
                                                return "-2";
                                            }
                                        });
                                        task.signalTask();
                                    }
                                }
                            }, txManagerService.getDelayTime(), TimeUnit.SECONDS);

                            threadPool.execute(new Runnable() {
                                @Override
                                public void run() {
                                    awaitSend(task, txInfo, jsonObject.toJSONString());
                                }
                            });
                            task.awaitTask();

                            if (!future.isDone()) {
                                future.cancel(false);
                            }

                            try {
                                String data = (String) task.getBack().doing();
                                // 1  成功 0 失败 -1 task为空 -2 超过
                                boolean res = "1".equals(data);

                                if (res) {
                                    txInfo.setNotify(1);
                                }

                                return res;
                            } catch (Throwable throwable) {
                                throwable.printStackTrace();
                                return false;
                            } finally {
                                task.remove();
                            }
                        }
                    });
                }
            }

            List<Boolean> hasOks = countDownLatchHelper.execute().getData();

            boolean hasOk = true;
            for (boolean bl : hasOks) {
                if (bl == false) {
                    hasOk = false;
                    break;
                }
            }
            logger.info("--->" + hasOk + ",group:" + txGroup.getGroupId() + ",state:" + checkSate + ",list:" + txGroup.toJsonString());
            return hasOk;
        }else{
            //回滚操作只发送通过不需要等待确认
            for (TxInfo txInfo : txGroup.getList()) {
                if(txInfo.getChannel()!=null) {
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("a", "t");
                    jsonObject.put("c", checkSate);
                    jsonObject.put("t", txInfo.getKid());
                    String key = KidUtils.generateShortUuid();
                    jsonObject.put("k", key);
                    txInfo.getChannel().send(jsonObject.toJSONString());
                }
            }
            txManagerService.deleteTxGroup(txGroup);
            return true;
        }

    }

}