text:
#  Phusion Passenger - https://www.phusionpassenger.com/
#  Copyright (c) 2010-2013 Phusion
#
#  "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
#
#  Permission is hereby granted, free of charge, to any person obtaining a copy
#  of this software and associated documentation files (the "Software"), to deal
#  in the Software without restriction, including without limitation the rights
#  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#  copies of the Software, and to permit persons to whom the Software is
#  furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#  THE SOFTWARE.

module PhusionPassenger

module Packaging
	# A list of HTML files that are generated with Asciidoc.
	ASCII_DOCS = [
		'doc/Users guide.html',
		'doc/Users guide Apache.html',
		'doc/Users guide Nginx.html',
		'doc/Users guide Standalone.html',
		'doc/Security of user switching support.html',
		'doc/Architectural overview.html'
	]

	# Files that must be generated before packaging.
	PREGENERATED_FILES = [
		'ext/common/Constants.h',
		'doc/Packaging.html'
	] + ASCII_DOCS

	USER_EXECUTABLES = [
		'passenger',
		'passenger-install-apache2-module',
		'passenger-install-nginx-module',
		'passenger-config'
	]

	SUPER_USER_EXECUTABLES = [
		'passenger-status',
		'passenger-memory-stats'
	]

	# Used during native packaging. Specifies executables for
	# which the shebang should NOT be set to #!/usr/bin/ruby,
	# so that these executables can be run with any Ruby interpreter
	# the user desires.
	EXECUTABLES_WITH_FREE_RUBY = [
		'passenger',
		'passenger-config',
		'passenger-install-apache2-module',
		'passenger-install-nginx-module'
	]

	# A list of globs which match all files that should be packaged
	# in the Phusion Passenger gem or tarball.
	GLOB = [
		'.gitignore',
		'.travis.yml',
		'configure',
		'Rakefile',
		'README.md',
		'CONTRIBUTORS',
		'CONTRIBUTING.md',
		'LICENSE',
		'CHANGELOG',
		'INSTALL.md',
		'NEWS',
		'passenger.gemspec',
		'build/*.rb',
		'lib/*.rb',
		'lib/**/*.rb',
		'lib/**/*.py',
		'node_lib/**/*.js',
		'bin/*',
		'doc/**/*',
		'man/*',
		'debian.template/**/*',
		'rpm/**/*',
		'helper-scripts/**/*',
		'ext/common/**/*.{cpp,c,h,hpp,md,erb}',
		'ext/apache2/*.{cpp,h,hpp,c,erb}',
		'ext/nginx/*.{c,cpp,h,erb}',
		'ext/nginx/config',
		'ext/boost/**/*',
		'ext/libev/{LICENSE,Changes,README,Makefile.am,Makefile.in}',
		'ext/libev/{*.m4,autogen.sh,config.guess,config.h.in,config.sub}',
		'ext/libev/{configure,configure.ac,depcomp,install-sh,ltmain.sh,missing,mkinstalldirs}',
		'ext/libev/{*.h,*.c}',
		'ext/libeio/{LICENSE,Changes,README,Makefile.am,Makefile.in}',
		'ext/libeio/{*.m4,autogen.sh,config.guess,config.h.in,config.sub}',
		'ext/libeio/{configure,configure.ac,install-sh,ltmain.sh,missing,mkinstalldirs}',
		'ext/libeio/{*.h,*.c}',
		'ext/oxt/*.hpp',
		'ext/oxt/*.cpp',
		'ext/oxt/*.txt',
		'ext/oxt/detail/*.hpp',
		'ext/ruby/*.{c,rb}',
		'dev/*',
		'resources/**/*',
		'test/.rspec',
		'test/*.example',
		'test/*.travis',
		'test/*.rpm-automation',
		'test/*.supp',
		'test/support/*.{c,cpp,h,rb}',
		'test/tut/*',
		'test/cxx/**/*.{cpp,h}',
		'test/oxt/*.{cpp,hpp}',
		'test/ruby/**/*',
		'test/node/**/*',
		'test/integration_tests/**/*',
		'test/stub/**/*',
		'test/stub/**/.*'
	]

	EXCLUDE_GLOB = [
		'test/stub/rails_apps/3.0/empty/help/**/*',
		'test/stub/*.dSYM'
	]

	# Files that should be excluded from the Debian tarball.
	DEBIAN_EXCLUDE_GLOB = [
		"debian.template/**/*",
	]

	# Files and directories that should be excluded from the Homebrew installation.
	HOMEBREW_EXCLUDE = [
		"dev", "test", ".gitignore", ".travis.yml", "debian.template", "rpm"
	]

	def self.files
		return Dir[*GLOB] - Dir[*EXCLUDE_GLOB]
	end

	def self.debian_orig_tarball_files
		return files - Dir[*DEBIAN_EXCLUDE_GLOB]
	end
end

end # module PhusionPassenger


text:
CKEDITOR.plugins.setLang( 'specialchar', 'es-mx', {
	euro: 'Signo de Euro',
	lsquo: 'Comillas simple izquierda',
	rsquo: 'Comillas simple derecha',
	ldquo: 'Comillas dobles izquierda',
	rdquo: 'Comillas dobles derecha',
	ndash: 'Guión corto',
	mdash: 'Guión largo',
	iexcl: 'Signo de exclamación invertido',
	cent: 'Signo de centavo',
	pound: 'Signo de Libra',
	curren: 'Signo de moneda',
	yen: 'Signo de Yen',
	brvbar: 'Barra rota',
	sect: 'Signo de la sección',
	uml: 'Diéresis',
	copy: 'Signo de Derechos reservados',
	ordf: 'Indicador ordinal femenino',
	laquo: 'Señal de doble ángulo hacia la izquierda',
	not: 'Sin signo',
	reg: 'Signo registrado',
	macr: 'Macron',
	deg: 'signo de grados',
	sup2: 'Superíndice dos',
	sup3: 'Superíndice tres',
	acute: 'Acento agudo',
	micro: 'Signo micro',
	para: 'Signo pilcrow',
	middot: 'Punto medio',
	cedil: 'Cedilla',
	sup1: 'Superíndice uno',
	ordm: 'Indicador ordinal masculino',
	raquo: 'Señal de doble ángulo hacia la derecha',
	frac14: 'Fracción un cuarto',
	frac12: 'Fracción medio',
	frac34: 'Fracción tres cuartos',
	iquest: 'Signo de interrogación invertido',
	Agrave: 'Letra mayúscula latina A con acento grave',
	Aacute: 'Letra mayúscula latina A con acento agudo',
	Acirc: 'Letra mayúscula latina A con circunflexo',
	Atilde: 'Letra mayúscula latina A con tilde',
	Auml: 'Letra mayúscula latina A con diéresis',
	Aring: 'Letra mayúscula latina A con anillo arriba',
	AElig: 'Letra mayúscula latina Æ',
	Ccedil: 'Letra mayúscula latina C con cedilla',
	Egrave: 'Letra mayúscula latina E con acento grave',
	Eacute: 'Letra mayúscula latina E con acento agudo',
	Ecirc: 'Letra mayúscula latina E con circumflex',
	Euml: 'Letra mayúscula latina E con diéresis',
	Igrave: 'Letra mayúscula latina I con acento grave',
	Iacute: 'Letra mayúscula latina I con acento agudo',
	Icirc: 'Letra mayúscula latina I con circumflex',
	Iuml: 'Letra mayúscula latina E con diéresis',
	ETH: 'Letra mayúscula latina Eth',
	Ntilde: 'Letra mayúscula latina N con tilde',
	Ograve: 'Letra mayúscula latina O con acento grave',
	Oacute: 'Letra mayúscula latina O con acento agudo',
	Ocirc: 'Letra mayúscula latina O con circumflex',
	Otilde: 'Letra mayúscula latina O con tilde',
	Ouml: 'Letra mayúscula latina O con diéresis',
	times: 'Signo de multiplicación',
	Oslash: 'Letra mayúscula latina O con trazo',
	Ugrave: 'Letra mayúscula latina U con acento grave',
	Uacute: 'Letra mayúscula latina U con acento agudo',
	Ucirc: 'Letra mayúscula latina U con circumflex',
	Uuml: 'Letra mayúscula latina U con diéresis',
	Yacute: 'Letra mayúscula latina Y con acento agudo',
	THORN: 'Letra mayúscula latina Thorn',
	szlig: 'Letra pequeña latina s',
	agrave: 'Letra pequeña latina a con acento grave',
	aacute: 'Letra pequeña latina a con acento agudo',
	acirc: 'Letra pequeña latina a con circumflex',
	atilde: 'Letra pequeña latina a con tilde',
	auml: 'Letra pequeña latina a con diéresis',
	aring: 'Letra pequeña latina a con anillo arriba',
	aelig: 'Letra pequeña latina æ',
	ccedil: 'Letra pequeña latina c con cedilla',
	egrave: 'Letra pequeña latina e con acento grave',
	eacute: 'Letra pequeña latina e con acento agudo',
	ecirc: 'Letra pequeña latina e con circumflex',
	euml: 'Letra pequeña latina e con diéresis',
	igrave: 'Letra pequeña latina i con acento grave',
	iacute: 'Letra pequeña latina i con acento agudo',
	icirc: 'Letra pequeña latina i con circumflex',
	iuml: 'Letra pequeña latina i con diéresis',
	eth: 'Letra pequeña latina eth',
	ntilde: 'Letra pequeña latina n con tilde',
	ograve: 'Letra pequeña latina o con acento grave',
	oacute: 'Letra pequeña latina o con acento agudo',
	ocirc: 'Letra pequeña latina o con circumflex',
	otilde: 'Letra pequeña latina o con tilde',
	ouml: 'Letra pequeña latina o con diéresis',
	divide: 'Signo de división',
	oslash: 'Letra pequeña latina o con trazo',
	ugrave: 'Letra pequeña latina u con acento grave',
	uacute: 'Letra pequeña latina u con acento agudo',
	ucirc: 'Letra pequeña latina u con circumflex',
	uuml: 'Letra pequeña latina u con diéresis',
	yacute: 'Letra pequeña latina y con acento agudo',
	thorn: 'Espina de letra pequeña latina',
	yuml: 'Letra pequeña latina y con diéresis',
	OElig: 'Ligadura de capital latino OE',
	oelig: 'Ligadura de pequeña latino OE',
	'372': 'Letra latina mayúscula W con circunflexo',
	'374': 'Letra latina mayúscula Y con circunflexo',
	'373': 'Letra latina minúscula w con circunflexo',
	'375': 'Letra latina minúscula y con circunflexo',
	sbquo: 'Signo de comillas simple abajo',
	'8219': 'Signo de comillas simple arriba',
	bdquo: 'Signo de doble comillas abajo',
	hellip: 'Elipsis horizontal',
	trade: 'Signo merccantl',
	'9658': 'Puntero derecho negro',
	bull: 'Bala',
	rarr: 'Flecha hacia la derecha',
	rArr: 'Doble flecha hacia la derecha',
	hArr: 'Flecha doble izquierda derecha',
	diams: 'Palo de diamante negro',
	asymp: 'Casi igual a'
} );

redpajama_set_name: RedPajamaGithub


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

<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="bigint">

  <title>BIGINT Data Type</title>
  <titlealts audience="PDF"><navtitle>BIGINT</navtitle></titlealts>
  <prolog>
    <metadata>
      <data name="Category" value="Impala"/>
      <data name="Category" value="Impala Data Types"/>
      <data name="Category" value="SQL"/>
      <data name="Category" value="Data Analysts"/>
      <data name="Category" value="Developers"/>
      <data name="Category" value="Schemas"/>
    </metadata>
  </prolog>

  <conbody>

      An 8-byte integer data type used in <codeph>CREATE TABLE</codeph> and <codeph>ALTER TABLE</codeph>
      statements.

      In the column definition of a <codeph>CREATE TABLE</codeph> statement:

<codeblock><varname>column_name</varname> BIGINT</codeblock>

      Range: -9223372036854775808 .. 9223372036854775807. There is no <codeph>UNSIGNED</codeph> subtype.

      Conversions: Impala automatically converts to a floating-point type (<codeph>FLOAT</codeph> or
      <codeph>DOUBLE</codeph>) automatically. Use <codeph>CAST()</codeph> to convert to <codeph>TINYINT</codeph>,
      <codeph>SMALLINT</codeph>, <codeph>INT</codeph>, <codeph>STRING</codeph>, or <codeph>TIMESTAMP</codeph>.
      <ph conref="../shared/impala_common.xml#common/cast_int_to_timestamp"/>

<codeblock>CREATE TABLE t1 (x BIGINT);
SELECT CAST(1000 AS BIGINT);
</codeblock>

      <codeph>BIGINT</codeph> is a convenient type to use for column declarations because you can use any kind of
      integer values in <codeph>INSERT</codeph> statements and they are promoted to <codeph>BIGINT</codeph> where
      necessary. However, <codeph>BIGINT</codeph> also requires the most bytes of any integer type on disk and in
      memory, meaning your queries are not as efficient and scalable as possible if you overuse this type.
      Therefore, prefer to use the smallest integer type with sufficient range to hold all input values, and
      <codeph>CAST()</codeph> when necessary to the appropriate type.

      For a convenient and automated way to check the bounds of the <codeph>BIGINT</codeph> type, call the
      functions <codeph>MIN_BIGINT()</codeph> and <codeph>MAX_BIGINT()</codeph>.

      If an integer value is too large to be represented as a <codeph>BIGINT</codeph>, use a
      <codeph>DECIMAL</codeph> instead with sufficient digits of precision.

      <xref href="impala_literals.xml#numeric_literals"/>, <xref href="impala_tinyint.xml#tinyint"/>,
      <xref href="impala_smallint.xml#smallint"/>, <xref href="impala_int.xml#int"/>,
      <xref href="impala_bigint.xml#bigint"/>, <xref href="impala_decimal.xml#decimal"/>,
      <xref href="impala_math_functions.xml#math_functions"/>

  </conbody>
</concept>


text:
<!DOCTYPE html>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title>Song of Solomon 3 (ASV)</title>
<link href="../../../build/mobile.css" rel="stylesheet" />

American Standard VersionSong of Solomon 3<
=
>

3

1 By night on my bed

I sought him whom my soul loveth:

I sought him, but I found him not.

2  I said, I will rise now, and go about the city;

In the streets and in the broad ways

I will seek him whom my soul loveth:

I sought him, but I found him not.

3 The watchmen that go about the city found me;

To whom I said, Saw ye him whom my soul loveth?

4 It was but a little that I passed from them,

When I found him whom my soul loveth:

I held him, and would not let him go,

Until I had brought him into my mother's house,

And into the chamber of her that conceived me.

5 I adjure you, O daughters of Jerusalem,

By the roes, or by the hinds of the field,

That ye stir not up, nor awake my love,

Until he please.

6 Who is this that cometh up from the wilderness

Like pillars of smoke,

Perfumed with myrrh and frankincense,

With all powders of the merchant?

7 Behold, it is the litter of Solomon;

Threescore mighty men are about it,

Of the mighty men of Israel.

8 They all handle the sword, and are expert in war:

Every man hath his sword upon his thigh,

Because of fear in the night.

9 King Solomon made himself a palanquin

Of the wood of Lebanon.

10 He made the pillars thereof of silver,

The bottom thereof of gold, the seat of it of purple,

The midst thereof being paved with love,

From the daughters of Jerusalem.

11 Go forth, O ye daughters of Zion, and behold king Solomon,

With the crown wherewith his mother hath crowned him

In the day of his espousals,

And in the day of the gladness of his heart.

<
=
>


text:
using System;
using Castle.Core;
using Castle.MicroKernel.Registration;

namespace Rhino.Commons.Binsor
{
	#region LifestyleExtension

	public abstract class LifestyleExtension : IComponentExtension
	{
		private readonly LifestyleType lifestyle;

		public LifestyleExtension(LifestyleType lifestyle)
		{
			this.lifestyle = lifestyle;
		}

		public virtual void Apply<T>(Component component, ComponentRegistration<T> registration)
			where T : class
		{
			registration.LifeStyle.Is(lifestyle);
		}

		void IComponentExtension.Apply(Component component, ComponentRegistration registration)
		{
			Apply(component, registration);
		}
	}

	#endregion

	#region Transient Lifestyle

	public class Transient : LifestyleExtension
	{
		public Transient() : base(LifestyleType.Transient)
		{
		}
	}

	#endregion

	#region Singelton Lifestyle

	public class Singleton : LifestyleExtension
	{
		public Singleton() : base(LifestyleType.Singleton)
		{
		}
	}

	#endregion

	#region Thread Lifestyle

	public class Thread : LifestyleExtension
	{
		public Thread() : base(LifestyleType.Thread)
		{
		}
	}

	#endregion

	#region Pooled Lifestyle

	public class Pooled : LifestyleExtension
	{
		private int? initialPoolSize;
		private int? maxPoolSize;

		public Pooled() : base(LifestyleType.Pooled)
		{
		}

		public int InitialPoolSize
		{
			set { initialPoolSize = value; }
		}

		public int MaxPoolSize
		{
			set { maxPoolSize = value; }
		}

		public override void Apply<T>(Component component, ComponentRegistration<T> registration)
		{
			registration.LifeStyle.PooledWithSize(initialPoolSize.GetValueOrDefault(), maxPoolSize.GetValueOrDefault());
		}
	}

	#endregion

	#region PerWebRequest Lifestyle

	public class PerWebRequest : LifestyleExtension
	{
		public PerWebRequest() : base(LifestyleType.PerWebRequest)
		{
		}
	}

	#endregion

	#region Scoped Lifestyle

	public class Scoped : LifestyleExtension
	{
		public Scoped() : base(LifestyleType.Scoped)
		{
		}

		public Scoped(Type scopeAccessor) : this()
		{
			ScopeAccessor = scopeAccessor;
		}

		public Type ScopeAccessor { get; private set; }

		public override void Apply<T>(Component component, ComponentRegistration<T> registration)
		{
			registration.LifeStyle.Scoped(ScopeAccessor);
		}
	}

	#endregion

	#region Custom Lifestyle

	public class Custom : LifestyleExtension
	{
		public Custom(Type customLifestyleType) : base(LifestyleType.Custom)
		{
			CustomLifestyleType = customLifestyleType;
		}

		public Type CustomLifestyleType { get; private set; }

		public override void Apply<T>(Component component, ComponentRegistration<T> registration)
		{
			registration.LifeStyle.Custom(CustomLifestyleType);
		}
	}

	#endregion
}


text:
Server::Server()
{
	//Initialize the Raknet peer interface first
	m_pPeerInterface = RakNet::RakPeerInterface::GetInstance();
	m_pPeerInterface->ApplyNetworkSimulator(0.0f, 200, 20);

	m_uiConnectionCounter = 1;
	m_uiObjectCounter = 1;
}

Server::~Server()
{

}

void Server::run()
{

	//Startup the server, and start it listening to clients
	std::cout << "Starting up the server..." << std::endl;

	//Create a socket descriptor to describe this connection
	RakNet::SocketDescriptor sd(PORT, 0);

	//Now call startup - max of 32 connections, on the assigned port
	m_pPeerInterface->Startup(32, &sd, 1);
	m_pPeerInterface->SetMaximumIncomingConnections(32);

	handleNetworkMessages();
}

void Server::handleNetworkMessages()
{
	RakNet::Packet* packet = nullptr;

	while (1)
	{
		for (packet = m_pPeerInterface->Receive(); packet; m_pPeerInterface->DeallocatePacket(packet), packet = m_pPeerInterface->Receive())
		{
			switch (packet->data[0])
			{
			case ID_NEW_INCOMING_CONNECTION:
			{
				addNewConnection(packet->systemAddress);
				std::cout << "A connection is incoming.\n";
				break;
			}
			case ID_DISCONNECTION_NOTIFICATION:
				std::cout << "A client has disconnected.\n";
				removeConnection(packet->systemAddress);
				break;
			case ID_CONNECTION_LOST:
				std::cout << "A client lost the connection.\n";
				removeConnection(packet->systemAddress);
				break;
			case ID_CLIENT_CREATE_OBJECT:
			{
				RakNet::BitStream bsIn(packet->data, packet->length, false);
				bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
				createNewObject(bsIn, packet->systemAddress);
				break;
			}
			case ID_UPDATE_OBJECT_POSITION:
			{
				RakNet::BitStream bsIn(packet->data, packet->length, false);
				bsIn.IgnoreBytes(sizeof(RakNet::MessageID));

				updateObjectPosition(bsIn, packet->systemAddress);
				break;
			}
			case ID_UPDATE_OBJECT_VELOCITY:
			{
				RakNet::BitStream bsIn(packet->data, packet->length, false);
				bsIn.IgnoreBytes(sizeof(RakNet::MessageID));

				updateObjectVelocity(bsIn, packet->systemAddress);
				break;
			}
			case ID_CLIENT_GET_ALL_OBJECTS:
			{
				sendAllGameObjectsToClient(packet->systemAddress);
				break;
			}
			default:
				std::cout << "Received a message with a unknown id: " << packet->data[0];
				break;
			}
		}
	}
}

void Server::addNewConnection(RakNet::SystemAddress systemAddress)
{
	ConnectionInfo info;
	info.sysAddress = systemAddress;
	info.uiConnectionID = m_uiConnectionCounter++;
	m_connectedClients[info.uiConnectionID] = info;

	sendClientIDToClient(info.uiConnectionID);
}

void Server::removeConnection(RakNet::SystemAddress systemAddress)
{
	for (auto it = m_connectedClients.begin(); it != m_connectedClients.end(); it++)
	{
		if (it->second.sysAddress == systemAddress)
		{
			m_connectedClients.erase(it);
			break;
		}
	}
}

unsigned int Server::systemAddressToClientID(RakNet::SystemAddress& systemAddress)
{
	for (auto it = m_connectedClients.begin(); it != m_connectedClients.end(); it++)
	{
		if (it->second.sysAddress == systemAddress)
		{
			return it->first;
		}
	}

	return 0;
}

void Server::sendClientIDToClient(unsigned int uiClientID)
{
	RakNet::BitStream bs;
	bs.Write((RakNet::MessageID)GameMessages::ID_SERVER_CLIENT_ID);
	bs.Write(uiClientID);

	m_pPeerInterface->Send(&bs, IMMEDIATE_PRIORITY, RELIABLE_ORDERED, 0, m_connectedClients[uiClientID].sysAddress, false);
}

void Server::createNewObject(RakNet::BitStream& bsIn, RakNet::SystemAddress& ownerSysAddress)
{
	GameObject newGameObject;

	//Read in the information from the packet
	bsIn.Read(newGameObject.fXPos);
	bsIn.Read(newGameObject.fZPos);

	bsIn.Read(newGameObject.fRedColour);
	bsIn.Read(newGameObject.fGreenColour);
	bsIn.Read(newGameObject.fBlueColour);

	bsIn.Read(newGameObject.fXVelocity);
	bsIn.Read(newGameObject.fZVelocity);

	newGameObject.uiOwnerClientID = systemAddressToClientID(ownerSysAddress);
	newGameObject.uiObjectID = m_uiObjectCounter++;

	m_gameObjects.push_back(newGameObject);

	sendGameObjectToAllClients(newGameObject, (RakNet::SystemAddress)RakNet::UNASSIGNED_SYSTEM_ADDRESS);
}

void Server::updateObjectPosition(RakNet::BitStream& bsIn, RakNet::SystemAddress& ownerSysAddress)
{
	unsigned int tempObjID;
	bsIn.Read(tempObjID);

	//If sender doesnt owns the obj, return
	if (m_gameObjects[tempObjID-1].uiOwnerClientID != systemAddressToClientID(ownerSysAddress)) return;

	//update position
	bsIn.Read(m_gameObjects[tempObjID-1].fXPos);
	bsIn.Read(m_gameObjects[tempObjID-1].fZPos);

	//send to all other clients
	RakNet::BitStream bsOut;
	bsOut.Write((RakNet::MessageID)GameMessages::ID_UPDATE_OBJECT_POSITION);
	bsOut.Write(tempObjID);
	bsOut.Write(m_gameObjects[tempObjID - 1].fXPos);
	bsOut.Write(m_gameObjects[tempObjID - 1].fZPos);

	m_pPeerInterface->Send(&bsOut, LOW_PRIORITY, RELIABLE_ORDERED, 0, ownerSysAddress, true);

}

void Server::updateObjectVelocity(RakNet::BitStream& bsIn, RakNet::SystemAddress& ownerSysAddress)
{
	unsigned int inObjID;
	bsIn.Read(inObjID);

	//if the sender doesnt own this object, return
	if (m_gameObjects[inObjID - 1].uiOwnerClientID != systemAddressToClientID(ownerSysAddress)) return;

	//update velocity
	bsIn.Read(m_gameObjects[inObjID - 1].fXVelocity);
	bsIn.Read(m_gameObjects[inObjID - 1].fZVelocity);

	//send to all other clients
	RakNet::BitStream bsOut;
	bsOut.Write((RakNet::MessageID)GameMessages::ID_UPDATE_OBJECT_VELOCITY);
	bsOut.Write(inObjID);
	bsOut.Write(m_gameObjects[inObjID - 1].fXVelocity);
	bsOut.Write(m_gameObjects[inObjID - 1].fZVelocity);

	m_pPeerInterface->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, ownerSysAddress, true);

}

void Server::sendGameObjectToAllClients(GameObject& gameObject, RakNet::SystemAddress& ownerSystemAddress)
{

	RakNet::BitStream bsOut;
	bsOut.Write((RakNet::MessageID)GameMessages::ID_SERVER_FULL_OBJECT_DATA);
	bsOut.Write(gameObject.fXPos);
	bsOut.Write(gameObject.fZPos);
	bsOut.Write(gameObject.fRedColour);
	bsOut.Write(gameObject.fGreenColour);
	bsOut.Write(gameObject.fBlueColour);
	bsOut.Write(gameObject.uiOwnerClientID);
	bsOut.Write(gameObject.uiObjectID);
	bsOut.Write(gameObject.fXVelocity);
	bsOut.Write(gameObject.fZVelocity);

	m_pPeerInterface->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, ownerSystemAddress, true);
}

void Server::sendAllGameObjectsToClient(RakNet::SystemAddress& client)
{
	GameObject objectOut;

	for (unsigned int i = 0; i < m_gameObjects.size(); i++)
	{
		RakNet::BitStream bsOut;

		//create temp object to read data from
		objectOut = m_gameObjects[i];

		//write header
		bsOut.Write((RakNet::MessageID)GameMessages::ID_SERVER_FULL_OBJECT_DATA);

		//write data
		bsOut.Write(objectOut.fXPos);
		bsOut.Write(objectOut.fZPos);
		bsOut.Write(objectOut.fRedColour);
		bsOut.Write(objectOut.fGreenColour);
		bsOut.Write(objectOut.fBlueColour);
		bsOut.Write(objectOut.uiOwnerClientID);
		bsOut.Write(objectOut.uiObjectID);
		bsOut.Write(objectOut.fXVelocity);
		bsOut.Write(objectOut.fZVelocity);

		//send packet
		m_pPeerInterface->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, client, false);
	}
}


text:
namespace {

class TranslatorCompileListener : public IPC::Listener {
 public:
  TranslatorCompileListener(const IPC::ChannelHandle& handle,
                            const struct nacl_irt_pnacl_compile_funcs* funcs)
      : funcs_(funcs) {
    channel_ = IPC::Channel::Create(handle, IPC::Channel::MODE_SERVER, this);
    CHECK(channel_->Connect());
  }

  // Needed for handling sync messages in OnMessageReceived().
  bool Send(IPC::Message* message) {
    return channel_->Send(message);
  }

  virtual bool OnMessageReceived(const IPC::Message& msg) {
    bool handled = false;
    IPC_BEGIN_MESSAGE_MAP(TranslatorCompileListener, msg)
      IPC_MESSAGE_HANDLER_DELAY_REPLY(PpapiMsg_PnaclTranslatorCompileInit,
                                      OnPnaclTranslatorCompileInit)
      IPC_MESSAGE_HANDLER_DELAY_REPLY(PpapiMsg_PnaclTranslatorCompileChunk,
                                      OnPnaclTranslatorCompileChunk)
      IPC_MESSAGE_HANDLER_DELAY_REPLY(PpapiMsg_PnaclTranslatorCompileEnd,
                                      OnPnaclTranslatorCompileEnd)
      IPC_MESSAGE_UNHANDLED(handled = false)
    IPC_END_MESSAGE_MAP()
    return handled;
  }

 private:
  void OnPnaclTranslatorCompileInit(
      int num_threads,
      const std::vector<ppapi::proxy::SerializedHandle>& obj_files,
      const std::vector<std::string>& cmd_flags,
      IPC::Message* reply_msg) {
    std::vector<int> obj_file_fds(obj_files.size());
    for (size_t i = 0; i < obj_files.size(); ++i) {
      CHECK(obj_files[i].is_file());
      obj_file_fds[i] = obj_files[i].descriptor().fd;
    }

    std::vector<char*> cmd_flags_cstrings(cmd_flags.size());
    for (size_t i = 0; i < cmd_flags.size(); ++i) {
      // It's OK to use const_cast here because the callee (the translator)
      // is not supposed to modify the strings.  (The interface definition
      // should have used "const char* const*".)
      cmd_flags_cstrings[i] = const_cast<char*>(cmd_flags[i].c_str());
    }

    char* error_cstr = funcs_->init_callback(num_threads,
                                             obj_file_fds.data(),
                                             obj_file_fds.size(),
                                             cmd_flags_cstrings.data(),
                                             cmd_flags_cstrings.size());
    bool success = !error_cstr;
    std::string error_str(error_cstr ? error_cstr : "");
    PpapiMsg_PnaclTranslatorCompileInit::WriteReplyParams(
        reply_msg, success, error_str);
    Send(reply_msg);
  }

  void OnPnaclTranslatorCompileChunk(const std::string& data_chunk,
                                     IPC::Message* reply_msg) {
    int result = funcs_->data_callback(data_chunk.data(), data_chunk.size());
    bool success = !result;
    PpapiMsg_PnaclTranslatorCompileChunk::WriteReplyParams(reply_msg, success);
    Send(reply_msg);
  }

  void OnPnaclTranslatorCompileEnd(IPC::Message* reply_msg) {
    char* error_cstr = funcs_->end_callback();
    bool success = !error_cstr;
    std::string error_str(error_cstr ? error_cstr : "");
    PpapiMsg_PnaclTranslatorCompileEnd::WriteReplyParams(
        reply_msg, success, error_str);
    Send(reply_msg);
  }

  std::unique_ptr<IPC::Channel> channel_;
  const struct nacl_irt_pnacl_compile_funcs* funcs_;

  DISALLOW_COPY_AND_ASSIGN(TranslatorCompileListener);
};

void ServeTranslateRequest(const struct nacl_irt_pnacl_compile_funcs* funcs) {
  base::MessageLoop loop;
  new TranslatorCompileListener(ppapi::GetRendererIPCChannelHandle(), funcs);
  base::RunLoop().Run();
}

}

const struct nacl_irt_private_pnacl_translator_compile
    nacl_irt_private_pnacl_translator_compile = {
  ServeTranslateRequest
};

#endif  // !defined(OS_NACL_NONSFI)


text:
package bj.pranie.dao;

import bj.pranie.entity.Reservation;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Date;
import java.util.List;

/**
 * Created by Sebastian Sokolowski on 10.08.16.
 */
@Transactional
public interface ReservationDao extends CrudRepository<Reservation, Long> {

    boolean existsByWashTimeIdAndDateAndWm(long washTimeId, Date date, int wm);

    List<Reservation> findByWashTimeIdAndDate(long washTimeId, Date date);

    List<Reservation> findByDate(Date date);

    List<Reservation> findByDateAndWm(Date date, int wm);

}


text:
from dockit.models import DockitPermission
from dockit.schema.signals import document_registered
from dockit.schema.loading import get_documents

from django.contrib.auth import models as auth_app
from django.contrib.contenttypes.models import ContentType
from django.db.utils import DatabaseError
from django.db.transaction import commit_on_success

def _get_permission_codename(action, opts):
    return u'%s.%s' % (opts.collection, action)

def _get_all_permissions(opts):
    "Returns (codename, name) for all permissions in the given opts."
    perms = []
    for action in ('add', 'change', 'delete'):
        perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
    return perms + opts.permissions

#code => <collection>.code
#lookup code => dockit.<collection>.code
#content type = DockitPermission

#user.has_perm(dockit.somecollection.code)

def create_permissions(documents, verbosity, **kwargs):
    # This will hold the permissions we're looking for as
    # (content_type, (codename, name))
    searched_perms = list()
    ctype = ContentType.objects.get_for_model(DockitPermission)
    # The codenames and ctypes that should exist.
    for klass in documents:
        for perm in _get_all_permissions(klass._meta):
            searched_perms.append(perm)

    # Find all the Permissions that have a context_type for a model we're
    # looking for.  We don't need to check for codenames since we already have
    # a list of the ones we're going to create.
    all_perms = set(auth_app.Permission.objects.filter(
        content_type=ctype,
    ).values_list(
        "codename", flat=True
    ))

    for codename, name in searched_perms:
        # If the permissions exists, move on.
        if codename in all_perms:
            continue
        p = auth_app.Permission.objects.create(
            codename=codename,
            name=name,
            content_type=ctype
        )
        if verbosity >= 2:
            print "Adding permission '%s'" % p

def on_document_registered(document, **kwargs):
    create_permissions([document], 1)
document_registered.connect(on_document_registered)

try:
    #wrap with commit_on_success as to try to not poison a higher transaction
    commit_on_success(create_permissions)(get_documents(), 1)
except DatabaseError:
    pass


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000">

    <RelativeLayout
        android:id="@+id/preview_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.opengl.GLSurfaceView
            android:id="@+id/edit_preview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <com.ksyun.media.shortvideo.sticker.KSYStickerView
            android:id="@+id/sticker_panel"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:visibility="gone" />

        <com.lht.paintview.PaintView
            android:id="@+id/edit_paint_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:visibility="gone"/>

        <ImageView
            android:id="@+id/click_to_next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_margin="10dp"
            android:src="@drawable/edit_complete" />

        <com.ksyun.media.shortvideo.demo.view.SectionSeekLayout
            android:id="@+id/session_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/click_to_next" />

        <com.ksyun.media.shortvideo.demo.audiorange.AudioSeekLayout
            android:id="@+id/audioSeekLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/session_layout"
            android:layout_marginTop="20dp"
            android:visibility="gone" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_alignParentBottom="true"
            android:background="#919191" />
    </RelativeLayout>
    <include
        android:id="@+id/edit_bar_bottom"
        layout="@layout/edit_bottom_bar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true" />

    <ImageView
        android:id="@+id/click_to_rotate"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_above="@+id/edit_bar_bottom"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="5dp"
        android:layout_marginRight="5dp"
        android:src="@drawable/rotate" />

    <ImageView
        android:id="@+id/click_to_pause"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_above="@+id/edit_bar_bottom"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="5dp"
        android:layout_marginRight="5dp"
        android:src="@drawable/play_state" />
</RelativeLayout>


text:
"use strict";

describe("jlScroll module", function() {
  var scrollProvider;

  beforeEach(module("jlScroll", function(_scrollProvider_, $provide) {
    $provide.value('jlWindow', new test.mockWindow());
    scrollProvider = _scrollProvider_;
    jasmine.clock().install();
  }));

  describe("scroll service", function() {
    var scroll, $timeout;

    beforeEach(inject(function(_$timeout_, $injector) {
      $timeout = _$timeout_;

      scrollProvider.maxScrollEventsPerSecond = 1;
      scroll = $injector.get("scroll");
    }));

    it("should call scroll handler only once after single scroll event", function() {
      var html =
        "
" +
        "

" +
        "
";
      var element = jQuery(html);

      var obj = {
        fn: function() {}
      };

      spyOn(obj, 'fn');

      scroll.addCallback(element, "test", obj.fn);

      element.triggerHandler("scroll");

      expect(obj.fn.calls.count()).toEqual(1);

      $timeout.flush(10000);
      jasmine.clock().tick(10000);
      expect(obj.fn.calls.count()).toEqual(1);
    });

    it("should call scroll handler only twice upon a flurry of scroll events, separated by 'delay' milliseconds", function() {
      var html =
        "
" +
        "

" +
        "
";
      var element = jQuery(html);

      var obj = {
        fn: function() {}
      };

      spyOn(obj, 'fn');

      scroll.addCallback(element, "test", obj.fn);

      var baseTime = new Date(2013, 9, 23);
      jasmine.clock().mockDate(baseTime);

      element.triggerHandler("scroll");
      element.triggerHandler("scroll");
      element.triggerHandler("scroll");
      element.triggerHandler("scroll");
      element.triggerHandler("scroll");

      $timeout.flush(0);
      jasmine.clock().tick(0);
      expect(obj.fn.calls.count()).toEqual(1);

      $timeout.flush(999);
      jasmine.clock().tick(999);
      expect(obj.fn.calls.count()).toEqual(1);

      $timeout.flush(1);
      jasmine.clock().tick(1);
      expect(obj.fn.calls.count()).toEqual(2);

      $timeout.flush(10000);
      jasmine.clock().tick(10000);
      expect(obj.fn.calls.count()).toEqual(2);
    });

    it("should limit callbacks to once per 'delay' milliseconds", function() {
      var html =
        "
" +
        "

" +
        "
";
      var element = jQuery(html);

      var obj = {
        fn: function() {}
      };

      spyOn(obj, 'fn');

      scroll.addCallback(element, "test", obj.fn);

      var baseTime = new Date(2013, 9, 23);
      jasmine.clock().mockDate(baseTime);

      var dt = 57;
      for (var t = 0; t < 10000; t += dt) {
        element.triggerHandler("scroll");

        expect(obj.fn.calls.count()).toEqual(1 + Math.floor(t / 1000));

        $timeout.flush(dt);
        jasmine.clock().tick(dt);
      }

      $timeout.flush(100000);
      jasmine.clock().tick(100000);

      expect(obj.fn.calls.count()).toEqual(11);
    });

    it("should limit callbacks to once per 'delay' milliseconds. Multiple callbacks registered, some unregistered.", function() {
      var html =
        "
" +
        "
" +
        "

" +
        "
" +
        "

" +
        "
";
      var root = jQuery(html);
      var element1 = root.find("#container");
      var element2 = root.find("#other");

      var obj = {
        fn1: function() {},
        fn2: function() {},
        fn3: function() {},
        fn4: function() {}
      };

      spyOn(obj, 'fn1');
      spyOn(obj, 'fn2');
      spyOn(obj, 'fn3');
      spyOn(obj, 'fn4');

      scroll.addCallback(element1, "A", obj.fn1);
      scroll.addCallback(element2, "A", obj.fn2);
      scroll.addCallback(element1, "B", obj.fn3);
      scroll.addCallback(element2, "B", obj.fn4);
      scroll.addCallback(element1, "C", obj.fn4);

      scroll.removeCallback(element2, "B");
      scroll.removeCallback(element1, "C");

      var baseTime = new Date(2013, 9, 23);
      jasmine.clock().mockDate(baseTime);

      var dt = 57;
      for (var t = 0; t < 10000; t += dt) {
        element1.triggerHandler("scroll");

        expect(obj.fn1.calls.count()).toEqual(1 + Math.floor(t / 1000));
        expect(obj.fn3.calls.count()).toEqual(1 + Math.floor(t / 1000));

        $timeout.flush(dt);
        jasmine.clock().tick(dt);
      }

      $timeout.flush(100000);
      jasmine.clock().tick(100000);

      expect(obj.fn1.calls.count()).toEqual(11);
      expect(obj.fn2).not.toHaveBeenCalled();
      expect(obj.fn3.calls.count()).toEqual(11);
      expect(obj.fn4).not.toHaveBeenCalled();
    });
  });

  describe("jlScroll directive", function() {
    it("should register a callback with the scroll service", inject(function($compile, $rootScope) {
      var scope = $rootScope.$new();
      scope.fn = function() {};

      spyOn(scope, 'fn');

      var html =
        "
" +
        "

" +
        "
";
      var element = jQuery($compile(html)(scope));

      element.triggerHandler("scroll");

      expect(scope.fn).toHaveBeenCalled();
      expect(scope.fn.calls.argsFor(0)[0].type).toEqual("scroll");
    }));
  });
});


text:
Silex Service provider for YAML configuration files

Installation
--------------
Simply add the following line to your composer.json:

    "require": {
        ...
        "mooseware/yaml-config-service-provider": "2.*",
        ...
    }

Then run `composer update` at your console.

Usage
--------------
Register the provider with your application.

    $app->register(new Mooseware\Silex\YamlConfigServiceProvider());

The provider assumes some parameters such as the environment variable name and the config path. By default the variable name (that you may have set through .htaccess) is `APP_ENV`. The default config file path is `</path/to/your/application>/config/`. You can override those settings by passing the changes to the providers constructor:

    $app->register(new Mooseware\Silex\YamlConfigServiceProvider([
        'envVarName' => 'YOUR_ENV_NAME',
        'configPath' => __DIR__ . '/path/to/your/configfolder',
    ]));

However, the config file names need to have the following pattern:

    config.<env>.yml

Finally, after registering the provider, you can access the configuration attributes through `$app['config']`.

Example
---------------
**app/config/config.dev.yml**

    database:
        host: localhost
        user: myuser
        password: mypassword

**web/index.php**

    <?php
        require_once __DIR__.'/../vendor/autoload.php';

        $app = new Silex\Application();

        $app->register(new Mooseware\Silex\YamlConfigServiceProvider([
            'envVarName' => 'MY_APP_ENV',
            'configPath' => __DIR__ . '/../app/config',
        ]));

        die(var_dump($app['config']));

will show you

    array (size=1)
      'database' =>
        array (size=3)
          'host' => string 'localhost' (length=9)
          'user' => string 'myuser' (length=6)
          'password' => string 'mypassword' (length=10)

Any improvements are welcome!


text:
package com.google.android.exoplayer2;

/**
 * Information about the ExoPlayer library.
 */
public interface ExoPlayerLibraryInfo {

  /**
   * The version of the library, expressed as a string.
   */
  String VERSION = "2.3.1";

  /**
   * The version of the library, expressed as an integer.
   * <p>
   * Three digits are used for each component of {@link #VERSION}. For example "1.2.3" has the
   * corresponding integer version 1002003 (001-002-003), and "123.45.6" has the corresponding
   * integer version 123045006 (123-045-006).
   */
  int VERSION_INT = 2003001;

  /**
   * Whether the library was compiled with {@link com.google.android.exoplayer2.util.Assertions}
   * checks enabled.
   */
  boolean ASSERTIONS_ENABLED = true;

  /**
   * Whether the library was compiled with {@link com.google.android.exoplayer2.util.TraceUtil}
   * trace enabled.
   */
  boolean TRACE_ENABLED = true;

}


text:
<?php
// src/Sukaldaris/InfoBundle/Entity/IngredientesRecetas.php
namespace Sukaldaris\InfoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="ingredientes_recetas")
* @ORM\Entity(repositoryClass="Sukaldaris\InfoBundle\Entity\IngredientesRecetasRepository")
*/

class IngredientesRecetas
{

    /**
    * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Receta")
     * @ORM\JoinColumn(name="id_receta", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $id_receta;

    /**
    * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Ingrediente")
     * @ORM\JoinColumn(name="id_ingrediente", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $id_ingrediente;

    /**
    * @ORM\Column(type="integer", nullable=true)
    */
    protected $cantidad;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->id_receta = new \Doctrine\Common\Collections\ArrayCollection();
        $this->id_ingrediente = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Set cantidad
     *
     * @param integer $cantidad
     * @return IngredientesRecetas
     */
    public function setCantidad($cantidad)
    {
        $this->cantidad = $cantidad;

        return $this;
    }

    /**
     * Get cantidad
     *
     * @return integer
     */
    public function getCantidad()
    {
        return $this->cantidad;
    }

    /**
     * Add id_receta
     *
     * @param \Sukaldaris\InfoBundle\Entity\Receta $idReceta
     * @return IngredientesRecetas
     */
    public function addIdRecetum(\Sukaldaris\InfoBundle\Entity\Receta $idReceta)
    {
        $this->id_receta[] = $idReceta;

        return $this;
    }

    /**
     * Remove id_receta
     *
     * @param \Sukaldaris\InfoBundle\Entity\Receta $idReceta
     */
    public function removeIdRecetum(\Sukaldaris\InfoBundle\Entity\Receta $idReceta)
    {
        $this->id_receta->removeElement($idReceta);
    }

    /**
     * Get id_receta
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getIdReceta()
    {
        return $this->id_receta;
    }

    /**
     * Add id_ingrediente
     *
     * @param \Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente
     * @return IngredientesRecetas
     */
    public function addIdIngrediente(\Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente)
    {
        $this->id_ingrediente[] = $idIngrediente;

        return $this;
    }

    /**
     * Remove id_ingrediente
     *
     * @param \Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente
     */
    public function removeIdIngrediente(\Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente)
    {
        $this->id_ingrediente->removeElement($idIngrediente);
    }

    /**
     * Get id_ingrediente
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getIdIngrediente()
    {
        return $this->id_ingrediente;
    }

    /**
     * Set id_receta
     *
     * @param \Sukaldaris\InfoBundle\Entity\Receta $idReceta
     * @return IngredientesRecetas
     */
    public function setIdReceta(\Sukaldaris\InfoBundle\Entity\Receta $idReceta)
    {
        $this->id_receta = $idReceta;

        return $this;
    }

    /**
     * Set id_ingrediente
     *
     * @param \Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente
     * @return IngredientesRecetas
     */
    public function setIdIngrediente(\Sukaldaris\InfoBundle\Entity\Ingrediente $idIngrediente)
    {
        $this->id_ingrediente = $idIngrediente;

        return $this;
    }
}


text:
require 'finacle_api/common/serializable_object'

module FinacleApi
  module XferTrnAdd
    module RequestEntity
      # <TrnAmt>
      #   <amountValue>10</amountValue>
      #   <currencyCode>INR</currencyCode>
      # </TrnAmt>
      class TrnAmt < SerializableObject
        attr_accessor :amount_value, :currency_code
      end
    end
  end
end


text:
layout: page
title: AllowedValues Annotation
---

## `@AllowedValues`

The `@AllowedValues` annotation may be applied to fields annotated with [`@Option`](option.html) and [`@Arguments`](arguments.html) to limit the set of values that an option may be used with e.g.

```java
@Option(name = { "-v", "--verbosity" }, arity = 1, title = "Level", description = "Sets the desired verbosity")
@AllowedValues(allowedValues = { "1", "2", "3" })
public int verbosity = 1;
```
This specifies that the `--verbosity` option only allows the values `1`, `2` and `3` to be specified by the user.  Any other value will be rejected.

Note that the restriction applies to the option value **after** the parser converts it to the target type.  So in the above example the values given in the annotation would be converted to integers and checked against integers converted from the input to the parser.

### Related Annotations

If there is only one way that a given value may be specified then it may be simpler and more efficient to use the [`@AllowedRawValues`](allowed-raw-values.html) annotation instead.

If the acceptable values come from an `enum` you can simplify your code by using the [`@AllowedEnumValues`](allowed-enum-values.html) annotation.

For more complex value restrictions a regular expression based restriction using [`@Pattern`](pattern.html) might be appropriate.


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 org.flowable.rest.service.api.identity;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.flowable.engine.test.Deployment;
import org.flowable.idm.api.User;
import org.flowable.rest.service.BaseSpringRestTestCase;
import org.flowable.rest.service.api.RestUrls;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * @author Frederik Heremans
 */
public class UserCollectionResourceTest extends BaseSpringRestTestCase {

    /**
     * Test getting all users.
     */
    @Deployment
    public void testGetUsers() throws Exception {
        List<User> savedUsers = new ArrayList<>();
        try {
            User user1 = identityService.newUser("testuser");
            user1.setFirstName("Fred");
            user1.setLastName("McDonald");
            user1.setEmail("no-reply@activiti.org");
            identityService.saveUser(user1);
            savedUsers.add(user1);

            User user2 = identityService.newUser("anotherUser");
            user2.setFirstName("Tijs");
            user2.setLastName("Barrez");
            user2.setEmail("no-reply@alfresco.org");
            identityService.saveUser(user2);
            savedUsers.add(user2);

            User user3 = identityService.createUserQuery().userId("kermit").singleResult();
            assertNotNull(user3);

            // Test filter-less
            String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION);
            assertResultsPresentInDataResponse(url, user1.getId(), user2.getId(), user3.getId());

            // Test based on userId
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?id=testuser";
            assertResultsPresentInDataResponse(url, user1.getId());

            // Test based on firstName
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?firstName=Tijs";
            assertResultsPresentInDataResponse(url, user2.getId());

            // Test based on lastName
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?lastName=Barrez";
            assertResultsPresentInDataResponse(url, user2.getId());

            // Test based on email
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?email=no-reply@activiti.org";
            assertResultsPresentInDataResponse(url, user1.getId());

            // Test based on firstNameLike
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?firstNameLike=" + encode("%ij%");
            assertResultsPresentInDataResponse(url, user2.getId());

            // Test based on lastNameLike
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?lastNameLike=" + encode("%rez");
            assertResultsPresentInDataResponse(url, user2.getId());

            // Test based on emailLike
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?emailLike=" + encode("no-reply@activiti.org%");
            assertResultsPresentInDataResponse(url, user1.getId());

            // Test based on memberOfGroup
            url = RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION) + "?memberOfGroup=admin";
            assertResultsPresentInDataResponse(url, user3.getId());

        } finally {

            // Delete user after test passes or fails
            if (!savedUsers.isEmpty()) {
                for (User user : savedUsers) {
                    identityService.deleteUser(user.getId());
                }
            }
        }
    }

    public void testCreateUser() throws Exception {
        try {
            ObjectNode requestNode = objectMapper.createObjectNode();
            requestNode.put("id", "testuser");
            requestNode.put("firstName", "Frederik");
            requestNode.put("lastName", "Heremans");
            requestNode.put("password", "test");
            requestNode.put("email", "no-reply@activiti.org");

            HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION, "testuser"));
            httpPost.setEntity(new StringEntity(requestNode.toString()));
            CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED);
            JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
            closeResponse(response);
            assertNotNull(responseNode);
            assertEquals("testuser", responseNode.get("id").textValue());
            assertEquals("Frederik", responseNode.get("firstName").textValue());
            assertEquals("Heremans", responseNode.get("lastName").textValue());
            assertEquals("no-reply@activiti.org", responseNode.get("email").textValue());
            assertTrue(responseNode.get("url").textValue().endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, "testuser")));

            assertNotNull(identityService.createUserQuery().userId("testuser").singleResult());
        } finally {
            try {
                identityService.deleteUser("testuser");
            } catch (Throwable t) {
                // Ignore, user might not have been created by test
            }
        }
    }

    public void testCreateUserExceptions() throws Exception {
        // Create without ID
        ObjectNode requestNode = objectMapper.createObjectNode();
        requestNode.put("firstName", "Frederik");
        requestNode.put("lastName", "Heremans");
        requestNode.put("email", "no-reply@activiti.org");

        HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_COLLECTION, "unexisting"));
        httpPost.setEntity(new StringEntity(requestNode.toString()));
        closeResponse(executeRequest(httpPost, HttpStatus.SC_BAD_REQUEST));

        // Create when user already exists
        // Create without ID
        requestNode = objectMapper.createObjectNode();
        requestNode.put("id", "kermit");
        requestNode.put("firstName", "Frederik");
        requestNode.put("lastName", "Heremans");
        requestNode.put("email", "no-reply@activiti.org");

        httpPost.setEntity(new StringEntity(requestNode.toString()));
        closeResponse(executeRequest(httpPost, HttpStatus.SC_CONFLICT));
    }
}


text:
autocommit off;
create view foo
(name char(25), n_name char(25))
as select name2, 'nonupdatable '+name2 from joe.faculty2;
select * from foo order by 1,2;
update foo set name = 'ok';
select * from foo order by 1,2;

rollback;


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

<!--
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2012-2014 lacolaco.net
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/page_background"
    android:orientation="vertical"
    android:padding="15dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:baselineAligned="false"
        android:orientation="horizontal">

        <EditText
            android:id="@+id/edittext_search_on_google"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="top"
            android:inputType="text|textMultiLine">

            <requestFocus />
        </EditText>
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_gravity="fill"
        android:background="?attr/button_round_blue">

        <Button
            android:id="@+id/button_submit"
            style="?attr/custom_button_transparent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/command_search_on_google"
            android:textColor="?attr/button_blue_foreground"
            android:textStyle="bold" />
    </FrameLayout>
</LinearLayout>


text:
/* Translators (2009 onwards):
 *  - Fulup
 */

/**
 * @requires OpenLayers/Lang.js
 */

/**
 * Namespace: OpenLayers.Lang["br"]
 * Dictionary for Brezhoneg.  Keys for entries are used in calls to
 *     <OpenLayers.Lang.translate>.  Entry bodies are normal strings or
 *     strings formatted for use with <OpenLayers.String.format> calls.
 */
OpenLayers.Lang["br"] = OpenLayers.Util.applyDefaults({

    'unhandledRequest': "Distro evel reked anveret ${statusText}",

    'permalink': "Peurliamm",

    'overlays': "Gwiskadoù",

    'baseLayer': "Gwiskad diazez",

    'sameProjection': "Ne\'z ar gartenn lec\'hiañ en-dro nemet pa vez heñvel ar banndres anezhi ha hini ar gartenn bennañ",

    'readNotImplemented': "N\'eo ket emplementet al lenn.",

    'writeNotImplemented': "N\'eo ket emplementet ar skrivañ.",

    'noFID': "N\'haller ket hizivaat un elfenn ma n\'eus ket a niverenn-anaout (FID) eviti.",

    'errorLoadingGML': "Fazi e-ser kargañ ar restr GML ${url}",

    'browserNotSupported': "N\'eo ket skoret an daskor vektorel gant ho merdeer. Setu aze an daskorerioù skoret evit ar poent :\n${renderers}",

    'componentShouldBe': "addFeatures : bez\' e tlefe ar parzh besañ eus ar seurt ${geomType}",

    'getFeatureError': "Galvet eo bet getFeatureFromEvent called war ur gwiskad hep daskorer. Kement-se a dalvez ez eus bet freuzet ur gwiskad hag hoc\'h eus miret un embreger bennak stag outañ.",

    'minZoomLevelError': "Ne zleer implijout ar perzh minZoomLevel nemet evit gwiskadoù FixedZoomLevels-descendent. Ar fed ma wiria ar gwiskad WHS-se hag-eñ ez eus eus minZoomLevel zo un aspadenn gozh. Koulskoude n\'omp ket evit e ziverkañ kuit da derriñ arloadoù diazezet war OL a c\'hallfe bezañ stag outañ. Setu perak eo dispredet -- Lamet kuit e vo ar gwiriañ minZoomLevel a-is er stumm 3.0. Ober gant an arventennoù bihanañ/brasañ evel deskrivet amañ e plas : http://trac.openlayers.org/wiki/SettingZoomLevels",

    'commitSuccess': "Treuzgread WFS : MAT EO ${response}",

    'commitFailed': "Treuzgread WFS Transaction: C\'HWITET ${response}",

    'googleWarning': "N\'eus ket bet gallet kargañ ar gwiskad Google ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het levraoueg Google Maps pe neuze ne glot ket an alc\'hwez API gant ho lec\'hienn.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclick here\x3c/a\x3e",

    'getLayerWarning': "N\'haller ket kargañ ar gwiskad ${layerType} ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het mat al levraoueg ${layerLib}.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit gouzout penaos reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclick here\x3c/a\x3e",

    'scale': "Skeul = 1 : ${scaleDenom}",

    'W': "K",

    'E': "R",

    'N': "N",

    'S': "S",

    'layerAlreadyAdded': "Klasket hoc\'h eus ouzhpennañ ar gwiskad : ${layerName} d\'ar gartenn, met ouzhpennet e oa bet c\'hoazh",

    'reprojectDeprecated': "Emaoc\'h oc\'h implijout an dibarzh \'reproject\' war ar gwiskad ${layerName}. Dispredet eo an dibarzh-mañ : bet eo hag e talveze da ziskwel roadennoù war-c\'horre kartennoù diazez kenwerzhel, un dra hag a c\'haller ober bremañ gant an arc\'hwel dre skor banndres boullek Mercator. Muioc\'h a ditouroù a c\'haller da gaout war http://trac.openlayers.org/wiki/SphericalMercator.",

    'methodDeprecated': "Dispredet eo an daore-se ha tennet e vo kuit eus ar stumm 3.0. Grit gant ${newMethod} e plas.",

    'boundsAddError': "Rekis eo tremen an div dalvoudenn x ha y d\'an arc\'hwel add.",

    'lonlatAddError': "Rekis eo tremen an div dalvoudenn hedred ha ledred d\'an arc\'hwel add.",

    'pixelAddError': "Rekis eo tremen an div dalvoudenn x ha y d\'an arc\'hwel add.",

    'unsupportedGeometryType': "Seurt mentoniezh anskoret : ${geomType}",

    'pagePositionFailed': "C\'hwitet eo OpenLayers.Util.pagePosition : marteze emañ lec\'hiet fall an elfenn id ${elemId}.",

    'filterEvaluateNotImplemented': "N\'eo ket bet emplementet ar priziañ evit seurt siloù c\'hoazh."

});


text:
'use strict';
const request = require('supertest');
const app = require('../app');
const dbInit = require('../db/db-init');

describe('/rest', function(){
    beforeEach(() => dbInit());
    it('should respond to clear get with success true', (done) => {
        request(app).get('/rest')
        .expect('Content-Type', /json/)
        .expect(200, { success: true, method: 'GET' }, done);
    });

    it('should respond with cors headers on options request', (done) => {
        request(app).options('/rest')
        .expect('Access-Control-Allow-Origin', '*')
        .expect('Access-Control-Allow-Methods', /GET,POST,PUT,DELETE,PATCH/)
        .expect('Access-Control-Allow-Headers', /content-type/i)
        .expect('Access-Control-Max-Age', '3600')
        .expect('Access-Control-Allow-Credentials', 'true')
        .expect(200, done)
    });
    it('should respond with 405 to POST', (done) => {
        request(app).post('/rest')
        .expect(405, done);
    });
});

describe('/rest/users', function() {

    it('should return 1000 objects on request with no params', (done) => {
        request(app).get('/rest/users')
        .expect('Content-Type', /json/)
        .expect(200)
        .end((err, res) => {
            if (err) return done(err);
            //console.log(res.body);
            if (res.body.success && res.body.items.length === 1000) {
                done();
            } else {
                done(res.body.items.length);
            }
        });
    });
    it('should return 30 objects on request with 30 items per page on first page', (done) => {
        request(app).get('/rest/users?page_index=0&page_size=30')
        .expect('Content-Type', /json/)
        .expect(200)
        .end((err, res) => {
            if (err) return done(err);
            let response = res.body;
            if (response.success
                && response.items.length === 30
                && response.items[0].id === 1
                && response.items[response.items.length - 1].id === 30
            ) {
                done();
            } else {
                done(res.body.items.length);
            }
        });
    });
    it('should return 10 objects on request with 30 items per page on last (33) page', (done) => {
        request(app).get('/rest/users?page_index=33&page_size=30')
        .expect('Content-Type', /json/)
        .expect(200)
        .end((err, res) => {
            if (err) return done(err);
            let response = res.body;
            if (response.success
                && response.items.length === 10
                && response.items[0].id === 991
                && response.items[response.items.length - 1].id === 1000
            ) {
                done();
            } else {
                done(res.body.items.length);
            }
        });
    });
    it('should insert user object to database and return new id', (done) => {
        request(app)
        .post('/rest/users')
        .send({
            "firstName": "James",
            "lastName": "Willson",
            "email": "willson@mail.ink",
            "gender": "Male"
        })
        .expect(200)
        .end((err, res) => {
            if (err) return done(err);
            if (res.body.success){
                done();
            } else {
                done(res.body.error);
            }

        })
    });
});


text:
package com.example.smdojt.manilafame.Exhibitor.Exhibitor_Local;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.smdojt.manilafame.R;
import com.example.smdojt.manilafame.Communication.about;

import java.util.List;

/**
 * Created by smdojt on 2/21/2017.
 */

public class TabLoc_RV_Adapter extends RecyclerView.Adapter<TabLoc_RV_Adapter.ItemViewHolder> {

    public static class ItemViewHolder extends RecyclerView.ViewHolder
    {
        static CardView cv;
        TextView itemName;
        TextView itemCathegory;
        ImageView itemPhoto;

        public ItemViewHolder(View itemView)
        {
            super(itemView);
            cv = (CardView) itemView.findViewById(R.id.cv);
            itemName = (TextView) itemView.findViewById(R.id.item_name);
            itemCathegory = (TextView) itemView.findViewById(R.id.item_cathegory);
            itemPhoto = (ImageView) itemView.findViewById(R.id.item_photo);
        }
    }
    List<Exhibitors_Loc> items;
    Context context;
    TabLoc_RV_Adapter(List<Exhibitors_Loc> items, Context context)
    {
        this.context = context;
        this.items = items;
    }

    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView)
    {
        super.onAttachedToRecyclerView(recyclerView);
    }

    @Override
    public ItemViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.fragment_exhibitor_tabloc_item, viewGroup, false);
        ItemViewHolder ivh = new ItemViewHolder(v);
        return ivh;
    }

    @Override
    public void onBindViewHolder(ItemViewHolder itemViewHolder, final int i) {
        itemViewHolder.cv.setOnClickListener(null);
        itemViewHolder.itemName.setText(items.get(i).name);
        itemViewHolder.itemCathegory.setText(items.get(i).cathegory);
        itemViewHolder.itemPhoto.setImageResource(items.get(i).photoId);

        ItemViewHolder.cv.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                if (i == 0)
                {
                    //Toast.makeText(context, "Index position is 0", Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent (context, about.class);
                    context.startActivity(intent);

//                    Using this code specifically for activity will make backstack automatically generated:
//                    meaning, the cardviews w/ recyclerviewer in the tab before will remain intack.
                }
                else if  (i == 1)
                {
                    Toast.makeText(context, "Index position is 1", Toast.LENGTH_SHORT).show();
                    //AppCompatActivity activity = (AppCompatActivity) v.getContext();
                    //GalleryFragment gf = new GalleryFragment();
                    //activity.getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, gf).addToBackStack(null).commit();

//                    Using this code specifically for fragment will make backstack ignored:
//                    meaning, all the cardviews in the list before will disappeare ** Known Bug 2-16-17
                }

            }
        });
    }

    @Override
    public int getItemCount()
    {
        return items.size();
    }

}


text:
package com.sany.sap.connection;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.Semaphore;

import org.apache.log4j.Logger;

import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoParameterList;
import com.sap.conn.jco.JCoStructure;
import com.sap.conn.jco.JCoTable;
import com.sap.conn.jco.ext.DestinationDataEventListener;
import com.sap.conn.jco.ext.DestinationDataProvider;
import com.sap.conn.jco.ext.Environment;

public class SapConnectFactory implements org.frameworkset.spi.InitializingBean,org.frameworkset.spi.DisposableBean {
	private static Logger logger = Logger.getLogger(SapConnectFactory.class);
	private  static SanyDestinationDataProvider sanyDestinationDataProvider;
	static
	{
		sanyDestinationDataProvider = new SanyDestinationDataProvider();
		sanyDestinationDataProvider
				.setDestinationDataEventListener(new DestinationDataEventListener() {
					public void deleted(String arg0) {
						logger.debug("deleted:" + arg0);
					}

					public void updated(String arg0) {
						logger.debug("updated:" + arg0);
					}
				});
		Environment
		.registerDestinationDataProvider(sanyDestinationDataProvider);
	}
	private SAPConf sapconf;

	private DomainSAPConf domainSAPConf;

	private String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
	public final SapResult callFunctionForParameterInTableAndStructure(String rfcName,Map<String, Object> inParams
			,String[] inParamsTableNames,List<Map<String, Object>>[] inParamsTableValues,String[] returnParamsStructureNames,List<String>[] returnParamsStructureColumns) throws SapException
		{
			return callFunctionForParameterInTableAndStructure(
					null, rfcName, inParams, null,
					null, inParamsTableNames, inParamsTableValues, null, returnParamsStructureNames, returnParamsStructureColumns, null, null);

		}

	public static List<String> getDefalutReturnParamsStructureColumns(String returnTableName)
	{
		List<String> structureColumns = new ArrayList<String>();
		if("RETURN".equals(returnTableName))
		{
			//返回表结构
			structureColumns.add("TYPE");
	        structureColumns.add("CODE");
	        structureColumns.add("MESSAGE");
		}
		if("RETURN1".equals(returnTableName))
		{
			//返回表结构
	        structureColumns= new ArrayList<String>();
	        structureColumns.add("TYPE");
	        structureColumns.add("ID");
	        structureColumns.add("NUM");
	        structureColumns.add("MESSAGE");
		}

		if("HR_RETURN".equals(returnTableName))
		{
			//返回表结构
	        structureColumns= new ArrayList<String>();
	        structureColumns.add("PERNR");
	        structureColumns.add("MSGTY");
	        structureColumns.add("INFTY");
	        structureColumns.add("SUBTY");
	        structureColumns.add("ACTIO");

		}
        return structureColumns;

	}
	@Override
	public void afterPropertiesSet() throws Exception {
//		sanyDestinationDataProvider = new SanyDestinationDataProvider();
//		sanyDestinationDataProvider
//				.setDestinationDataEventListener(new DestinationDataEventListener() {
//					public void deleted(String arg0) {
//						logger.debug("deleted:" + arg0);
//					}
//
//					public void updated(String arg0) {
//						logger.debug("updated:" + arg0);
//					}
//				});
//
//		Environment
//		.registerDestinationDataProvider(sanyDestinationDataProvider);

		if(domainSAPConf == null)//通过ip连接sap服务器
		{
			Properties connectProperties = new Properties();
			connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,
					sapconf.getHost());
			connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,
					sapconf.getSysnr());
			connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT,
					sapconf.getClient());
			connectProperties.setProperty(DestinationDataProvider.JCO_USER,
					sapconf.getUser());
			connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,
					sapconf.getPassward());
			connectProperties.setProperty(DestinationDataProvider.JCO_LANG,
					sapconf.getLang());

			connectProperties.setProperty(
					DestinationDataProvider.JCO_POOL_CAPACITY,
					sapconf.getJco_pool_capacity() + "");
			connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,
					sapconf.getJco_peak_limit() + "");
			this.addJcoDestinationData(ABAP_AS_POOLED, connectProperties);
		}
		else//通过域名连接sap服务器
		{

			  //connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "318");//集团号,生产机318,测试机150
			//  connectProperties.setProperty(DestinationDataProvider.JCO_USER," ");//用户名
			//  connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,"");//密码
			//  connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");//语言
			//  connectProperties.setProperty(DestinationDataProvider.JCO_MSHOST,"sapci.sany.com.cn");//消息服务器,生产机sapci.sany.com.cn
			//  connectProperties.setProperty(DestinationDataProvider.JCO_GROUP, "RFC");//登录组名称,测试机和生产机均为RFC
			//  connectProperties.setProperty(DestinationDataProvider.JCO_MSSERV,"3600");//消息服务器端口号,生产机:3600,测试机3601
			Properties connectProperties = new Properties();
			connectProperties.setProperty(DestinationDataProvider.JCO_MSHOST,
					domainSAPConf.getHost());
			connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,
					domainSAPConf.getHost());
			connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,
					domainSAPConf.getSysnr());
			connectProperties.setProperty(DestinationDataProvider.JCO_GROUP,
					domainSAPConf.getJco_group());
			connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT,
					domainSAPConf.getClient());
			connectProperties.setProperty(DestinationDataProvider.JCO_USER,
					domainSAPConf.getUser());
			connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,
					domainSAPConf.getPassward());
			connectProperties.setProperty(DestinationDataProvider.JCO_LANG,
					domainSAPConf.getLang());
			connectProperties.setProperty(DestinationDataProvider.JCO_MSSERV,
					domainSAPConf.getJco_msserv());

			connectProperties.setProperty(
					DestinationDataProvider.JCO_POOL_CAPACITY,
					domainSAPConf.getJco_pool_capacity() + "");
			connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,
					domainSAPConf.getJco_peak_limit() + "");
			this.addJcoDestinationData(ABAP_AS_POOLED, connectProperties);
		}

	}

	private static Semaphore semaphore = new Semaphore(1);

	private void addJcoDestinationData(String destinationName,
			java.util.Properties jcoproperties) {
		try {
			semaphore.acquire();
			if (sanyDestinationDataProvider
					.getDestinationProperties(destinationName) == null) {
				logger.debug("Add destinationName:" + destinationName
						+ ",jcoproperties:" + jcoproperties);
				sanyDestinationDataProvider.addDestination(destinationName,
						jcoproperties);
			} else {
				logger.debug("destinationName:" + destinationName
						+ " alread exist");
			}
		} catch (Exception e) {
			logger.error("addJcoDestinationData error destinationName["+destinationName+"],"+jcoproperties ,e);
		} finally {
			semaphore.release();
		}
	}

	public final JCoDestination getJcoDestination(String destinationName)
			throws SapException {
		try {
			return JCoDestinationManager.getDestination(destinationName);
		} catch (JCoException e) {

			throw new SapException(e);
		}

	}

	public final JCoDestination getJcoDestination() throws SapException {
		try {
			return JCoDestinationManager.getDestination(this
					.getABAP_AS_POOLED());
		} catch (JCoException e) {

			throw new SapException(e);
		}

	}

	/**
	 * 调用RFC返回表格
	 *
	 * @param rfcName
	 *            RFC名称
	 * @param inParams
	 *            传入参数
	 * @param returnTableNames
	 *            需要返回的表格名称
	 * @param returnTableColumns
	 *            各表格中需要返回的字段名称
	 * @return
	 *         返回数据表格的列表,列表长度与returnTableNames的长度一致,各表格中的字段与returnTableColumns中的字段一致
	 * @throws SapException
	 */
	public List<Map<String, Object>>[] callFunctionForTable(String rfcName,
			Map<String, Object> inParams, String[] returnTableNames,
			String[][] returnTableColumns) throws SapException {

		if (rfcName == null || rfcName.length() <= 0) {
			logger.debug("rfc name is empty");
			return null;
		}

		if (returnTableNames == null || returnTableNames.length <= 0) {
			logger.debug("return table names are empty");
			return null;
		}

		List<Map<String, Object>>[] retRecords = null;

		JCoDestination destination = null;
		boolean needend = false;
		try {
			if(this.destination_ != null)
			{
				destination = destination_;
			}
			else
			{
				destination = JCoDestinationManager
						.getDestination(ABAP_AS_POOLED);
				needend = true;
			}
			JCoFunction function = destination.getRepository().getFunction(
					rfcName);
			if (function == null)
				throw new SapException("获取函数[" + rfcName
						+ "]失败:函数不存在,SAP服务器信息为\r\n" + destination.toString());
			if (inParams != null && inParams.size() > 0) {
				Set<String> inParamsKeys = inParams.keySet();
				for (String inParamsKey : inParamsKeys) {
					function.getImportParameterList().setValue(inParamsKey,
							inParams.get(inParamsKey));
				}
			}
			logger.debug("JCoFunction ["+rfcName+"]:" + function);
			function.execute(destination);

			retRecords = new ArrayList[returnTableNames.length];

			for (int i = 0; i < returnTableNames.length; i++) {
				String tableName = returnTableNames[i];

				List<Map<String, Object>> records = new ArrayList<Map<String, Object>>();
				JCoTable table = function.getTableParameterList().getTable(
						tableName);

				logger.debug("Return Table["+tableName+"]:" + table);
				if (table != null && table.getNumRows() > 0) {

					for (int k = 0; k < table.getNumRows(); k++) {
						table.setRow(k);

						Map<String, Object> recordRow = new HashMap<String, Object>();
						for (int j = 0; j < returnTableColumns[i].length; j++) {
							String columnName = returnTableColumns[i][j];
							Object value = table.getValue(columnName);
							recordRow.put(columnName, value);
						}

						records.add(recordRow);
					}
				}

				retRecords[i] = records;
			}

		} catch (SapException e) {

			throw e;
		} catch (Exception e) {
			// e.printStackTrace();
			// logger.error(e.getMessage(), e);
			throw new SapException(e);
		}
		finally
		{
			if(needend)
			{
				this.end(destination);
			}
		}

		return retRecords;
	}

	/**
	 * 调用RFC返回数据表格
	 *
	 * @param rfcName
	 *            RFC名称
	 * @param inParams
	 *            传入的表单参数
	 * @param inTableNames
	 *            传入的表格参数的表格名称列表
	 * @param inTableValues
	 *            掺入的表格参数的值
	 * @param returnTableNames
	 *            返回的表格名称列表
	 * @param returnTableColumns
	 *            返回表单的参数名称列表
	 * @return
	 *         返回数据表格的列表,列表长度与returnTableNames的长度一致,各表格中的字段与returnTableColumns中的字段一致
	 * @throws SapException
	 */
	public List<Map<String, Object>>[] callFunctionForTable(String rfcName,
			Map<String, Object> inParams, String[] inTableNames,
			List<Map<String, Object>>[] inTableValues,
			String[] returnTableNames, String[][] returnTableColumns)
			throws SapException {

		if (rfcName == null || rfcName.length() <= 0) {
			System.out.println("rfc name is empty");
			return null;
		}

		if (returnTableNames == null || returnTableNames.length <= 0) {
			System.out.println("return table names are empty");
			return null;
		}

		List<Map<String, Object>>[] retRecords = null;

		JCoDestination destination = null;
		boolean needend = false;
		try {
			if(this.destination_ != null)
			{
				destination = destination_;
			}
			else
			{
				destination = JCoDestinationManager
						.getDestination(ABAP_AS_POOLED);
				needend = true;
			}
			JCoFunction function = destination.getRepository().getFunction(
					rfcName);
			if (function == null)
				throw new SapException("获取函数[" + rfcName
						+ "]失败:函数不存在,SAP服务器信息为\r\n" + destination.toString());
			if (inParams != null && inParams.size() > 0) {
				Set<String> inParamsKeys = inParams.keySet();
				for (String inParamsKey : inParamsKeys) {
					function.getImportParameterList().setValue(inParamsKey,
							inParams.get(inParamsKey));
				}
			}

			for (int i = 0; i < inTableNames.length; i++) {
				String inTableName = inTableNames[i];
				List<Map<String, Object>> inTableValue = inTableValues[i];

				JCoTable inTable = function.getTableParameterList().getTable(
						inTableName);
				for (Map<String, Object> inMap : inTableValue) {
					inTable.appendRow();
					Set<String> inMapKey = inMap.keySet();
					for (String key : inMapKey) {
						Object keyValue = inMap.get(key);
						inTable.setValue(key, keyValue);
					}
				}
			}
			logger.debug("JCoFunction ["+rfcName+"]:" + function);
			function.execute(destination);

			retRecords = new ArrayList[returnTableNames.length];

			for (int i = 0; i < returnTableNames.length; i++) {
				String tableName = returnTableNames[i];

				List<Map<String, Object>> records = new ArrayList<Map<String, Object>>();
				JCoTable table = function.getTableParameterList().getTable(
						tableName);
				logger.debug("Return table ["+tableName+"]:" + table);
				if (table != null && table.getNumRows() > 0) {
					for (int k = 0; k < table.getNumRows(); k++) {
						table.setRow(k);

						Map<String, Object> recordRow = new HashMap<String, Object>();
						for (int j = 0; j < returnTableColumns[i].length; j++) {
							String columnName = returnTableColumns[i][j];
							Object value = table.getValue(columnName);
							recordRow.put(columnName, value);
						}

						records.add(recordRow);
					}
				}

				retRecords[i] = records;
			}

		} catch (SapException e) {
			throw e;
		} catch (Exception e) {

			// logger.error(e.getMessage(), e);
			throw new SapException(e);
		}
		finally
		{
			if(needend)
			{
				this.end(destination);
			}
		}
		return retRecords;
	}

	/**
	 * 调用RFC返回表单
	 *
	 * @param rfcName
	 *            RFC名称
	 * @param inParams
	 *            传入参数
	 * @param returnParameterColumns
	 *            返回表单的参数名称列表
	 * @return 返回表单的键值对表格,键名称与returnParameterColumns对应
	 * @throws SapException
	 */
	public Map<String, Object> callFunctionForParameter(String rfcName,
			Map<String, Object> inParams, String[] returnParameterColumns)
			throws SapException {

		if (rfcName == null || rfcName.length() <= 0) {
			System.out.println("rfc name is empty");
			return null;
		}

		if (returnParameterColumns == null
				|| returnParameterColumns.length <= 0) {
			System.out.println("return parameter columns are empty");
			return null;
		}

		Map<String, Object> retRecords = null;

		JCoDestination destination = null;
		boolean needend = false;
		try {
			if(this.destination_ != null)
			{
				destination = destination_;
			}
			else
			{
				destination = JCoDestinationManager
						.getDestination(ABAP_AS_POOLED);
				needend = true;
			}
			JCoFunction function = destination.getRepository().getFunction(
					rfcName);
			if (function == null)
				throw new SapException("获取函数[" + rfcName
						+ "]失败:函数不存在,SAP服务器信息为\r\n" + destination.toString());

			if (inParams != null && inParams.size() > 0) {
				Set<String> inParamsKeys = inParams.keySet();
				for (String inParamsKey : inParamsKeys) {
					function.getImportParameterList().setValue(inParamsKey,
							inParams.get(inParamsKey));
				}
			}
			logger.debug("Function ["+rfcName+"]:" + function);
			function.execute(destination);

			retRecords = new HashMap<String, Object>();

			for (int i = 0; i < returnParameterColumns.length; i++) {
				String columnName = returnParameterColumns[i];
				Object value = function.getExportParameterList().getValue(
						columnName);

				retRecords.put(columnName, value);
			}

		} catch (SapException e) {

			throw e;
		} catch (Exception e) {
			// e.printStackTrace();
			// logger.error(e.getMessage(), e);
			throw new SapException(e);
		}
		finally
		{
			if(needend)
			{
				this.end(destination);
			}
		}
		return retRecords;
	}

	/**
	 * 传入表单及表格,调用RFC返回表单
	 *
	 * @param rfcName
	 *            rfc名称
	 * @param inParams
	 *            传入表单参数
	 * @param inParamsTableNames
	 *            传入表格的表格名称列表
	 * @param inParamsTableValues
	 *            传入表格的值
	 * @param returnParameterColumns
	 *            返回表单的参数名称列表
	 * @return 返回表单的键值对列表,键与returnParameterColumns相对应
	 * @throws SapException
	 */
	public Map<String, Object> callFunctionForParameterInTable(String rfcName,
			Map<String, Object> inParams, String[] inParamsTableNames,
			List<Map<String, Object>>[] inParamsTableValues,
			String[] returnParameterColumns) throws SapException {

		if (rfcName == null || rfcName.length() <= 0) {
			logger.debug("rfc name is empty");
			return null;
		}

		if (returnParameterColumns == null
				|| returnParameterColumns.length <= 0) {
			logger.debug("return parameter columns are empty");
			return null;
		}

		Map<String, Object> retRecords = null;

		JCoDestination destination = null;
		boolean needend = false;
		try {
			if(this.destination_ != null)
			{
				destination = destination_;
			}
			else
			{
				destination = JCoDestinationManager
						.getDestination(ABAP_AS_POOLED);
				needend = true;
			}
			JCoFunction function = destination.getRepository().getFunction(
					rfcName);
			if (function == null)
				throw new SapException("获取函数[" + rfcName
						+ "]失败:函数不存在,SAP服务器信息为\r\n" + destination.toString());
			// 传入表单参数
			if (inParams != null && inParams.size() > 0) {
				Set<String> inParamsKeys = inParams.keySet();
				for (String inParamsKey : inParamsKeys) {
					function.getImportParameterList().setValue(inParamsKey,
							inParams.get(inParamsKey));
				}
			}
			// 传入表格参数
			if (inParamsTableNames != null && inParamsTableNames.length > 0) {
				for (int i = 0; i < inParamsTableNames.length; i++) {
					String inTableName = inParamsTableNames[i];
					List<Map<String, Object>> inTableValues = inParamsTableValues[i];

					JCoTable inTable = function.getTableParameterList()
							.getTable(inTableName);

					for (Map<String, Object> rowMap : inTableValues) {
						inTable.appendRow();
						Set<String> columnSet = rowMap.keySet();
						for (String columnName : columnSet) {
							inTable.setValue(columnName, rowMap.get(columnName));
						}
					}
				}
			}
			logger.debug("Function ["+rfcName+"]:" + function);
			function.execute(destination);

			retRecords = new HashMap<String, Object>();

			for (int i = 0; i < returnParameterColumns.length; i++) {
				String columnName = returnParameterColumns[i];
				JCoParameterList exportParamsList = function
						.getChangingParameterList() == null ? function
						.getExportParameterList() : function
						.getChangingParameterList();
				Object value = exportParamsList.getValue(columnName);

				retRecords.put(columnName, value);
			}

		} catch (SapException e) {

			throw e;
		} catch (Exception e) {
			// e.printStackTrace();
			// logger.error(e.getMessage(), e);
			throw new SapException(e);
		}
		finally
		{
			if(needend)
			{
				this.end(destination);
			}
		}
		return retRecords;
	}

	/**
	 * 调用RFC,返回表单和表格
	 *
	 * @param rfcName
	 *            rfc名称
	 * @param inParams
	 *            传入表单数据
	 * @param inParamsTableNames
	 *            传入表格名称
	 * @param inParamsTableValues
	 *            传入表格列列表
	 * @param returnParameterColumns
	 *            输出表单参数列表
	 * @param returnTableNames
	 *            输出表格名称
	 * @param returnTableColumns
	 *            输出表格中的参数列表
	 * @return
	 * @throws SapException
	 */
	public SapResult callFunctionForParameterAndTable(String rfcName,
			Map<String, Object> inParams, String[] inParamsTableNames,
			List<Map<String, Object>>[] inParamsTableValues,
			String[] returnParameterColumns, String[] returnTableNames,
			List<String>[] returnTableColumns) throws SapException {

		return callFunctionForParameterInTableAndStructure(
				null, rfcName, inParams, (String[]) null,
				(Map<String, Object>[]) null, (String[]) inParamsTableNames,
				(List<Map<String, Object>>[]) inParamsTableValues,
				(String[]) returnParameterColumns, (String[]) null,
				(List<String>[]) null, (String[]) returnTableNames,
				(List<String>[]) returnTableColumns);
	}

	/**
	 * 调用RFC,返回表单和表格
	 *
	 * @param rfcName
	 *            rfc名称
	 * @param inParams
	 *            传入表单数据
	 * @param returnParameterColumns
	 *            输出表单参数列表
	 * @param returnTableNames
	 *            输出表格名称
	 * @param returnTableColumns
	 *            输出表格中的参数列表
	 * @return
	 * @throws SapException
	 */
	public SapResult callFunctionForParameterAndTable(String rfcName,
			Map<String, Object> inParams, String[] returnParameterColumns,
			String[] returnTableNames, List<String>[] returnTableColumns)
			throws SapException {

		return callFunctionForParameterInTableAndStructure(
				null, rfcName, inParams, (String[]) null,
				(Map<String, Object>[]) null, (String[]) null,
				(List<Map<String, Object>>[]) null,
				(String[]) returnParameterColumns, (String[]) null,
				(List<String>[]) null, (String[]) returnTableNames,
				returnTableColumns);
	}

	public final SapResult callFunctionForParameterInTableAndStructure(
			String destinationName, String rfcName) throws SapException {
		return callFunctionForParameterInTableAndStructure(destinationName,
				rfcName, null, null, null, null, null, null, null, null, null,
				null);
	}

	public final SapResult callFunctionForParameterInTableAndStructure(
			String rfcName) throws SapException {
		return callFunctionForParameterInTableAndStructure(
				null, rfcName);
	}

	public final SapResult callFunctionForParameterInTableAndStructure(
			String destinationName, String rfcName, Map<String, Object> inParams)
			throws SapException {
		return callFunctionForParameterInTableAndStructure(destinationName,
				rfcName, inParams, null, null, null, null, null, null, null,
				null, null);
	}

	public final SapResult callFunctionForParameterInTableAndStructure(

	String rfcName, Map<String, Object> inParams) throws SapException {
		return callFunctionForParameterInTableAndStructure(
				null, rfcName, inParams, null, null, null,
				null, null, null, null, null, null);
	}

	public SapResult rollback() {
		try {

			SapResult result = callFunctionForParameterInTableAndStructure(SAPConf.rfcName_rollback);
			return result;
		} catch (Exception e1) {
			return null;
		}
	}

	public SapResult commit(String wait) throws SapException {
		Map<String, Object> inParams = new HashMap<String, Object>();
		inParams.put("WAIT", wait);

		return callFunctionForParameterInTableAndStructure(
				SAPConf.rfcName_commit, inParams);
	}

	public SapResult commit() throws SapException {
		return commit("X");
	}

	public final SapResult callFunctionForParameterInTable(String rfcName,
			String[] inParamsTableNames,
			List<Map<String, Object>>[] inParamsTableValues,
			String[] returnTableNames, List<String>[] returnTableColumns)
			throws SapException {
		return callFunctionForParameterInTableAndStructure(rfcName, null, null,
				null, inParamsTableNames, inParamsTableValues, null, null,
				null, returnTableNames, returnTableColumns);
	}

	public final SapResult callFunctionForParameterInTableAndStructure(
			String rfcName, Map<String, Object> inParams,
			String[] inParamsStructureNames,
			Map<String, Object>[] inParamsStructureValues,
			String[] inParamsTableNames,
			List<Map<String, Object>>[] inParamsTableValues,
			String[] returnParameterColumns,
			String[] returnParamsStructureNames,
			List<String>[] returnParamsStructureColumns,
			String[] returnTableNames, List<String>[] returnTableColumns)
			throws SapException {
		return callFunctionForParameterInTableAndStructure(
				null, rfcName, inParams,
				inParamsStructureNames, inParamsStructureValues,
				inParamsTableNames, inParamsTableValues,
				returnParameterColumns, returnParamsStructureNames,
				returnParamsStructureColumns, returnTableNames,
				returnTableColumns);

	}

	public final SapResult callFunctionForParameterInTableAndStructure(
			String destinationName, String rfcName,
			Map<String, Object> inParams, String[] inParamsStructureNames,
			Map<String, Object>[] inParamsStructureValues,
			String[] inParamsTableNames,
			List<Map<String, Object>>[] inParamsTableValues,
			String[] returnParameterColumns,
			String[] returnParamsStructureNames,
			List<String>[] returnParamsStructureColumns,
			String[] returnTableNames, List<String>[] returnTableColumns)
			throws SapException {

		SapResult sapResult = null;
		JCoDestination destination = null;
		boolean needend = false;
		try {

			if(destinationName == null)
			{
				if(this.destination_ != null)
					destination= destination_;
				else
				{
					destination = JCoDestinationManager
							.getDestination(this.getABAP_AS_POOLED());
					needend = true;
				}
			}
			else
			{
				destination = JCoDestinationManager
						.getDestination(destinationName);
				needend = true;
			}
			JCoFunction function = destination.getRepository().getFunction(
					rfcName);
			if (function == null)
				throw new SapException("获取函数[" + rfcName
						+ "]失败:函数不存在,SAP服务器信息为\r\n" + destination.toString());
			if (inParams != null) {
				Set<String> inParamsKeys = inParams.keySet();
				for (String inParamsKey : inParamsKeys)
					function.getImportParameterList().setValue(inParamsKey,
							inParams.get(inParamsKey));
			}

			if (inParamsStructureNames != null) {
				String inStructureName = null;
				Set<String> columnSet;
				for (int i = 0; i < inParamsStructureNames.length; i++) {
					inStructureName = inParamsStructureNames[i];
					Map<String, Object> inStructureValues = inParamsStructureValues[i];

					JCoStructure inStructure = function
							.getImportParameterList().getStructure(
									inStructureName);
					columnSet = inStructureValues.keySet();
					for (String columnName : columnSet) {
						inStructure.setValue(columnName,
								inStructureValues.get(columnName));
					}
					logger.debug("inStructure ["+inStructureName+"]:" + inStructure);
				}
			}

			if (inParamsTableNames != null) {
				Set<String> columnSet;
				for (int i = 0; i < inParamsTableNames.length; i++) {
					String inTableName = inParamsTableNames[i];
					List<Map<String, Object>> inTableValues = inParamsTableValues[i];
					JCoTable inTable = function.getTableParameterList()
							.getTable(inTableName);
					for (Map<String, Object> rowMap : inTableValues) {
						inTable.appendRow();
						columnSet = rowMap.keySet();
						for (String columnName : columnSet)
							inTable.setValue(columnName, rowMap.get(columnName));
					}
					logger.debug("inTable ["+inTableName+"]:" + inTable);
				}

			}
//			logger.debug("Function ["+rfcName+"]:" + function);
			long be = System.currentTimeMillis();
			function.execute(destination);
			long en = System.currentTimeMillis();

			if (returnParameterColumns != null) {
				Map<String, Object> retRecords = new HashMap<String, Object>();
				for (int i = 0; i < returnParameterColumns.length; i++) {
					String columnName = returnParameterColumns[i];
					Object value = function.getExportParameterList().getValue(
							columnName);
					retRecords.put(columnName, value);
				}
				sapResult = new SapResult();
				sapResult.setResultParams(retRecords);
			}

			if (returnParamsStructureNames != null) {
				Map<String, Map<String, Object>> resultStructures = new HashMap<String, Map<String, Object>>();
				for (int i = 0; i < returnParamsStructureNames.length; i++) {
					resultStructures.put(returnParamsStructureNames[i],
							new HashMap<String, Object>());
					JCoStructure js = function.getExportParameterList()
							.getStructure(returnParamsStructureNames[i]);
					logger.debug("Return JCoStructure ["+returnParamsStructureNames[i]+"]:" + js);
					for (int j = 0; j < returnParamsStructureColumns[i].size(); j++) {
						resultStructures
								.get(returnParamsStructureNames[i])
								.put(returnParamsStructureColumns[i].get(j),
										js.getValue(returnParamsStructureColumns[i]
												.get(j)));
					}

				}
				if (sapResult == null)
					sapResult = new SapResult();
				sapResult.setResultStructures(resultStructures);
			}

			if (returnTableNames != null) {
				Map<String, List<Map<String, Object>>> retTableRecords = new HashMap<String, List<Map<String, Object>>>();
				for (int i = 0; i < returnTableNames.length; i++) {
					JCoTable table = function.getTableParameterList().getTable(
							returnTableNames[i]);
					logger.debug("Return table ["+returnTableNames[i]+"]:" + table);
					List<Map<String, Object>> records = new ArrayList<Map<String, Object>>();
					if (table != null)
						for (int k = 0; k < table.getNumRows(); k++) {
							table.setRow(k);
							Map<String, Object> recordRow = new HashMap<String, Object>();
							for (int j = 0; j < returnTableColumns[i].size(); j++) {
								recordRow.put(returnTableColumns[i].get(j),
										table.getValue(returnTableColumns[i]
												.get(j)));
							}
							records.add(recordRow);
						}
					retTableRecords.put(returnTableNames[i], records);

				}
				if (sapResult == null)
					sapResult = new SapResult();
				sapResult.setResultTables(retTableRecords);
			}
		} catch (SapException e) {

			throw e;
		} catch (Exception e) {
			// e.printStackTrace();
			// logger.error(e.getMessage(), e);
			throw new SapException(e);
		}
		finally
		{
			if(needend)
				this.end(destination);
		}

		return sapResult;
	}

	public String getABAP_AS_POOLED() {
		return ABAP_AS_POOLED;
	}
	private JCoDestination destination_;
	public JCoDestination begin(String destination) throws SapException {
		destination_ = getJcoDestination(destination);
		com.sap.conn.jco.JCoContext.begin(destination_);
		return destination_;
	}

	public JCoDestination begin() throws SapException {
		return begin(this.getABAP_AS_POOLED());
	}

	public void end(JCoDestination destination) {
		if (destination != null) {
			try {
				com.sap.conn.jco.JCoContext.end(destination);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	public void end() {
		if (destination_ != null) {
			try {
				com.sap.conn.jco.JCoContext.end(destination_);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Override
	public void destroy()  {
		try {
			sanyDestinationDataProvider.deleteDestination(this.ABAP_AS_POOLED);

		} catch (Exception e1) {
			e1.printStackTrace();
		}
		try
		{

			Environment.unregisterDestinationDataProvider(sanyDestinationDataProvider);

		}
		catch(Exception e)
		{
			// TODO Auto-generated catch block
			 e.printStackTrace();
		}

	}

}